content
stringlengths
1
15.9M
\section{Preliminaries} \label{section_setting} We begin with a brief discussion of Rabinowitz Floer homology, with a special emphasis on the non-compact framework. To keep the exposition concise we place ourselves throughout in the linear setting of $T^*\mathbb{R}^m$. Whilst this restriction is at present necessary for the construction of Rabinowitz Floer homology for non-compact hypersurfaces, this is by no means the case for compact hypersurfaces. We refer the reader to the survey article \cite{albers2012} for a leisurely introduction to the various settings that (compact) Rabinowitz Floer homology can be defined.\\ \textbf{Sign Conventions}: Let $\omega = d p \wedge dq$ denote the standard symplectic form on $T^* \mathbb{R}^m = \mathbb{R}^m \times (\mathbb{R}^m)^*$. We identify $T^* \mathbb{R}^m$ with the complex vector space $(\mathbb{C}^m, i)$ via the map $(q,p) \mapsto q + ip$, and denote by $\mathbb{J}$ the corresponding complex structure.\footnote{As a general notational guide to the reader, throughout the rest of this article, we work with compact hypersurfaces in $T^*\mathbb{R}^k$ and non-compact hypersurfaces in $T^* \mathbb{R}^n$, where $ 0< k < n$. In this preliminary section we treat both cases simultaneously, and hence use the letter $m$ instead.} Explicitly, this means that \begin{equation} \label{pref-J} \mathbb{J} = \begin{pmatrix} 0 &\operatorname{Id} \\ -\operatorname{Id} & 0 \end{pmatrix}. \end{equation} Let $g_{\mathbb{J}} \coloneqq \omega( \cdot , \mathbb{J} \cdot )$, so that $g_{\mathbb{J}}$ is the real part of the standard Hermitian structure on $\mathbb{C}^m$, and hence a Riemannian metric on $ T^*\mathbb{R}^m$. Sometimes it will be necessary to include the dimension in our notation, in which case we write $ \omega_m$, $\mathbb{J}_m$ and so on. We use the sign convention that the symplectic gradient/Hamiltonian vector field $X_H$ of a Hamiltonian $H \colon T^*\mathbb{R}^m \to \mathbb{R}$ is given by $\omega(X_H, \cdot ) = -dH$, so that the Poisson bracket of two Hamiltonians on $T^*\mathbb{R}^m$ is given by $\{ F,H\} \coloneqq \omega(X_F,X_H)$.\\ \textbf{Hamiltonians:} We now introduce the class of Hamiltonians that we work with. A vector field $Y$ on $ T^* \mathbb{R}^m$ is said to be a \textit{Liouville vector field} if $ d( \omega(Y, \cdot )) = \omega$. A Liouville vector field $Y$ is said to be \textit{asymptotically regular} if $\Vert DY(x)\Vert \le c$ for some positive constant $c$ and all $x\in T^*{\mathbb R}^m$. \begin{definition}\label{def:TentHam} Let $\mathcal{H}^*$ denote the set of Hamiltonians $H$ on $T^*\mathbb{R}^m$ such that \textit{either} \begin{enumerate} \item[(c)\namedlabel{c1}{(c)}] $dH$ is compactly supported, \end{enumerate} or the following three axioms are satisfied: \begin{enumerate} \item[(h1)\namedlabel{h1}{(h1)}] there exists an asymptotically regular Liouville vector field $Z$ and constants $c,c'>0$, such that $dH(Z)(x) \ge c|x|^2 - c'$, for all $x\in T^*{\mathbb R}^m$; \item[(h2)\namedlabel{h2}{(h2)}] (sub-quadratic growth) $\sup_{x\in T^*{\mathbb R}^m} \Vert D^3 H(x)\Vert \cdot |x| <\infty$; \item[(h3)\namedlabel{h3}{(h3)}] in the neighbourhood of $H^{-1}(0)$ exists a coercive function $F$, such that for all $x\in H^{-1}(0)$ either $\{H,F\}(x)\neq 0$ or $\{H,\{H,F\}\}(x)>0,$ as $|x|\to\infty$. \end{enumerate} \end{definition} \begin{remark} Note that if $H \in \mathcal{H}^*$ and $h \in C^{ \infty }_c(T^*\mathbb{R}^n)$ then also $H+h\in\mathcal{H}^*$. \end{remark} We say that $H^{-1}(0)$ is of \textit{contact type} if there exists an asymptotically regular Liouville vector field $Y$ such that $dH(Y)(x) >0 $ for all $x \in H^{-1}(0)$. Note that this implies that $H^{-1}(0)$ is a smooth hypersurface. \begin{definition} \label{defn-tenta} Let $ \mathcal{H} \subseteq \mathcal{H}^*$ denote the subset of those Hamiltonians $H$ which in addition have the property that $H^{-1}(0)$ is of contact type. We say that Hamiltonians $H \in \mathcal{H}$ satisfying \ref{h1}, \ref{h2} and \ref{h3} are \textit{strongly tentacular}. If we drop the requirement that the function $F$ in \ref{h3} is coercive then $H$ is called simply \textit{tentacular}. \end{definition} \begin{remark} The strongly tentacular condition implies that all the periodic orbits of $H$ are contained in a compact set. This may not be the case for tentacular Hamiltonians. Rabinowitz Floer homology is defined for Morse-Bott tentacular Hamiltonians whose orbits are contained in a compact set. Invariance under compact perturbation requires the strongly tentacular condition. This explains why the adjective ``strongly'' appears in Corollary \ref{cor:WC} but not in Theorem \ref{thm:compRFH}. \end{remark} The connection between the definition of strongly tentacular Hamiltonians given here and the one presented in the introduction is given by the following result: \begin{prop}\label{prop:TentEx} Let $H$ be a Hamiltonian of the form \eqref{defH}. Then $H$ belongs to $ \mathcal{H}$, if the Jordan decomposition of $\mathbb{J}A_1$ has $m_i\times m_i$ blocks corresponding to eigenvalues $\lambda_i$, where each pair $(m_i,\lambda_i)$ satisfies one of the following conditions: \begin{enumerate}[label=\roman*)] \item \label{case1} $m_i=1$ and $\operatorname{Re}(\lambda_i)\neq 0$; \item $m_i=2$ and $|\!\operatorname{Re}(\lambda_i)|>\frac{1}{\sqrt{2}}$; \item \label{case3} $m_i>2$ and $|\!\operatorname{Re}(\lambda_i)|>2$. \end{enumerate} \end{prop} \begin{remark} \label{works-for-any-tent} Proposition \ref{prop:TentEx} provides a concrete class of examples for which our main results, Theorem \ref{thm:compRFH} and Theorem \ref{thm:iso} are valid. Note that cases \ref{case1} and \ref{case3} correspond to our ``definition'' of strongly tentacular on page \pageref{thm:compRFH}. We emphasise however that Theorems \ref{thm:compRFH} and \ref{thm:iso} are valid for any tentacular Hamiltonian $H$ of the form \eqref{defH} with $A_0$ positive definite and $\mathbb{J}A_1$ hyperbolic\footnote{That is, $\mathbb{J}A_1$ has no purely imaginary eigenvalues.}. \end{remark} Below we will outline the construction of Rabinowitz Floer homology groups for Hamiltonians $H \in \mathcal{H}$. In the case $H$ satisfies \ref{c1}, this reduces to the original definition presented by Cieliebak and Frauenfelder \cite{CieliebakFrauenfelder2009}, only specialised to $T^*\mathbb{R}^m$. Meanwhile for strongly tentacular $H$, the construction\footnote{ Actually the construction for strongly tentacular Hamiltonians subsumes the compact contact type hypersurfaces as a special case, see Remark \ref{compact-special-case} below.} comes from \cite{pasquotto2018}.\\ \textbf{Complex structures:} Although $T^*\mathbb{R}^m$ comes equipped with a preferred choice $\mathbb{J}$ of complex structure, in order to achieve transversality for the various moduli spaces used in the definition of Rabinowitz Floer homology, we are forced to work with generic data. To this end we now introduce a suitable parameter space of almost complex structures. Let $ \mathcal{J}$ denote the space of all \textit{compatible} almost complex structures $J$ on $T^* \mathbb{R}^m$. Here compatible means that $g_J \coloneqq \omega( \cdot ,J \cdot )$ is a Riemannian metric on $T^*\mathbb{R}^m$. We view $ \mathcal{J}$ as a pointed space with basepoint $ \mathbb{J}$. An easy linear algebra argument (see for example \cite[Prop.\ 13.1]{Silva2001}) shows that $ \mathcal{J}$ is contractible. Fix an open set $V \subset T^*\mathbb{R}^m\times \mathbb{R}$, and let $ \mathcal{J}(V,\mathbb{J})$ denote the set of smooth maps \[ (t,\eta) \mapsto J(\cdot,\eta, t) \in \mathcal{J}, \qquad (t, \eta) \in S^1 \times \mathbb{R}, \] such that \[ J( x , \eta, t) = \mathbb{J}, \qquad \text{whenever}\qquad (x, t) \notin V, \] and such that \begin{equation} \sup_{(t,\eta)\in S^1 \times {\mathbb R}}\|J(\cdot,\eta,t)\|_{C^l}<+\infty, \qquad \forall\ k\in {\mathbb N}. \label{supJ} \end{equation} Here the $C^l$ norm is taken with respect to the standard Riemannian metric $g_{ \mathbb{J}}$ on $T^*\mathbb{R}^m$. Finally we let $\mathcal{J}_{\star}$ denote the union of all spaces $\mathcal{J}(V, \mathbb{J})$ for $V$ of the form $ \operatorname{int} K \times \mathbb{R} {\setminus} [-a,a]$ for $K \subseteq T^*\mathbb{R}^m$ compact and $a >0$, equipped with the colimit topology. We view $ \mathcal{J}_\star$ as another pointed space, with basepoint $ \mathbb{J}$. This space is again easily seen to be contractible. We write $\mathcal{J}_\star^m$, if we have to indicate the dimension of the underlying space $T^*{\mathbb R}^m$.\\ \textbf{The Rabinowitz action functional:} The free period action functional---or \textit{Rabinowitz action functional}---is defined by \begin{align*} \mathcal{A}^{H} & \colon C^{\infty}(S^1, T^*\mathbb{R}^m)\times\mathbb{R}\to\mathbb{R} \\ (v, \eta) & \mapsto \int_{S^1}v^{*}\lambda-\eta\int_{S^1}H(v(t))\,dt. \end{align*} Here $ \lambda$ is any primitive of $ \omega$, for example $\lambda=\frac{1}{2}(pdq-qdp)$. The real number $ \eta$ can be thought of as a Lagrange multiplier version of the area functional from classical mechanics. Thus critical points $ \mathcal{A}^H$ are critical points of the area functional restricted to the space of loops with $H$ mean value zero. Moreover, since $H$ is invariant under its own Hamiltonian flow, the mean value constraint can be upgraded to a pointwise constaint, and we obtain: \begin{lem} A pair $(v, \eta)$ is a critical point of $ \mathcal{A}^H$ if and only if\footnote{For $ \eta = 0$ this should be interpreted as: $t \mapsto v(t)$ is constant.} $t \mapsto v(t/\eta)$ is a closed orbit of $X_H$ contained in $H^{-1}(0)$. \end{lem}~ \textbf{The Morse-Bott condition:} It is not just the complex structure that needs to be chosen generically. Floer theory also requires us to work with a Hamiltonian which satisfies a certain generic non-degeneracy condition. Unlike the case of complex structures however, the non-degeneracy condition admits a direct definition. Throughout the rest of this section, we denote by $ \Sigma$ the level set $H^{-1}(0)$ of a given Hamiltonian $H \in \mathcal{H}$ and we denote by $Y$ an asymptotically regular Liouville vector field such that $dH(Y)|_\Sigma > 0$. \begin{definition} $ \ $ \begin{enumerate}[label=(\roman*)] \item We say that the Rabinowitz action functional ${\mathcal{A}}^H$ is \emph{Morse-Bott} if the critical set of ${\mathcal{A}}^H$ is a discrete union of finite dimensional manifolds and for every connected component $\Lambda\subseteq {\operatorname{Crit}}({\mathcal{A}}^H)$ and every $x\in \Lambda$ \begin{equation}\label{eq:MorseBott} T_x\Lambda=\ker(\nabla^2_x{\mathcal{A}}^H). \end{equation} \item We say that the closed orbits of the flow $\phi^t$ of $X_H$ on $\Sigma$ are of \emph{Morse-Bott type} if $\eta$ is constant on every connected component $\Lambda \subseteq {\operatorname{Crit}}({{\mathcal{A}}^{H}})$, and the image $\mathcal{N}^\eta$ of a connected component $\Lambda$ with period $\eta$ under the projection $(v,\eta) \mapsto v(0)$ is a closed submanifold of $\Sigma$, such that for all $x\in \mathcal{N}^\eta$ we have \begin{equation}\label{def:MBT} T_{p}\mathcal{N}^\eta = \ker (D_{p}\phi^{\eta} - \operatorname{Id}) \cap T_{p} \Sigma. \end{equation} \end{enumerate} \end{definition} \begin{remark} The two Morse-Bott conditions are closely related. If ${\mathcal{A}}^{H}$ is a Morse-Bott functional and $\eta$ is constant on every connected component of ${\operatorname{Crit}}({{\mathcal{A}}^{H}})$, then by \cite[Lem.\ 3.3]{pasquotto2018} all closed orbits of the Hamiltonian flow $\phi^t$ on $\Sigma$ are of Morse-Bott type. Conversely, if $H$ is \textit{defining} for $\Sigma$, i.e.\ if $dH(Y)|_\Sigma\equiv 1$, and if all periodic orbits are of Morse-Bott type then by \cite[Lem.\ 20]{Fauck2016} the corresponding Rabinowitz action functional ${\mathcal{A}}^H$ is Morse-Bott. \end{remark} The Morse-Bott property of the Rabinowitz action functional is typically achieved by perturbing slightly the Hamiltonian function. However in our case we will calculate the Rabinowitz Floer homology of the specific Hamiltonians satisfying \eqref{defH} by hand (so to speak), and therefore in Section \ref{sec:Morse-Bott} we will check directly that these Hamiltonians fulfill the Morse-Bott property.\\ \textbf{The Rabinowitz Floer equation:} Fix $ J \in \mathcal{J}_\star$. The positive $L^2$ gradient equation $ \partial_s u = \nabla_J \mathcal{A}^H$ for $u = (v, \eta)$ is the following Floer equation for $v$ coupled with an ordinary differential equation for $\eta$: \begin{equation} \label{eq-grad-mas2} \left(\begin{array}{c} \partial_{s}v\\ \partial_s \eta \end{array}\right) = \left( \begin{array}{c} -J(v,\eta,t)\bigl[\partial_{t}v-\eta X_{H}(v)\bigr] \\ -{\int_0^1 H(v)\,dt \quad}\end{array} \right). \end{equation} A solution $u$ of \eqref{eq-grad-mas2} with finite $L^2$ energy $\int_{\mathbb R} \|\partial_s u\|^2ds<\infty$, is called a \emph{Floer trajectory}. Given two distinct components $\Lambda^-$ and $\Lambda^+$ of $\operatorname{Crit} (\mathcal{A}^H)$, we denote by $\mathcal{M}(\Lambda^-,\Lambda^+)$ the set of all solutions of \eqref{eq-grad-mas2} with finite energy and ${\lim_{s\to\pm \infty}u(s)\in \Lambda^\pm}$. We define $\operatorname{ev}^\pm \colon \mathcal{M}(\Lambda^-,\Lambda^+)\to\Lambda^\pm$ to be the evaluation maps: \begin{equation} \operatorname{ev}^-(u)\coloneqq \lim_{s\rightarrow -\infty} u(s,t)\quad \textrm{and}\quad \operatorname{ev}^+(u)\coloneqq \lim_{s\rightarrow +\infty} u(s,t). \label{eqn:ev} \end{equation} \begin{definition} \label{def:regular} We say that a couple $(H,J)\in \mathcal{H} \times \mathcal{J}_\star$ is \textit{regular} if it satisfies the following two conditions: \begin{enumerate}[label=\roman*)] \item The Rabinowitz action functional $ \mathcal{A}^H$ is Morse-Bott, and the closed orbits of $X_H$ on $\Sigma$ are of Morse-Bott type; \item For every pair of connected components $\Lambda^{-},\Lambda^{+}\subseteq {\operatorname{Crit}}({{\mathcal{A}}^H})$ the associated moduli space $\mathcal{M}(\Lambda^-, \Lambda^+)$ is a smooth finite dimensional manifold without boundary. \end{enumerate} \end{definition} By \cite[Lem.\ 8.7]{pasquotto2018} the set of such regular couples is comeagre in $\mathcal{H} \times \mathcal{J}_\star$. From now on we assume that $(H,J)$ is regular. Next, we introduce flow lines with cascades following \cite{Frauenfelder2004}: Consider a Morse function $f \colon \operatorname{Crit} (\mathcal{A}^H ) \to \mathbb{R}$ such that $f$ restricts to a coercive\footnote{When $H$ satisfies \ref{c1} this is condition is automatic.} function on $\Sigma$. Fix a Riemannian metric on $\operatorname{Crit} (\mathcal{A}^H)$ having a Morse-Smale gradient flow $\phi^t$. For $z \in \operatorname{Crit} (f)$, we denote by $W^s_f(z)$ and $W^u_f(z)$ the (un)stable manifolds with respect to $\phi^t$. A flow line with $k \geq 1$ cascades between $z^-,z^+\in {\operatorname{Crit}}(f)$ belonging to distinct connected components is a tuple $ (u_{1},...,u_{k}, t_1, ..., t_{k-1})$, where each $u_i$ is a non-stationary Floer trajectory (cf.\ \eqref{eq-grad-mas2}), such that \begin{gather*} \phi^{t_i}\circ \operatorname{ev}^+(u_i)=\operatorname{ev}^-(u_{i+1}),\qquad i=1, ..., k-1, \\ \operatorname{ev}^-(u_1)\in W^u_f(z^-), \qquad \operatorname{ev}^+(u_k)\in W^s_f(z^+). \end{gather*} We denote the set of all flowlines with $k$ cascades from $z^-$ to $z^+$ as $\mathcal{M}_{\operatorname{cas}}^k(z^-,z^+)$. There is a natural ${\mathbb R}^k$ action on $\mathcal{M}_{\operatorname{cas}}^k(z^-,z^+)$ given by $u_i(\cdot) \mapsto u_i(a+\cdot)$ and we define the space of all flow lines with cascades from $z^-$ to $z^+$ by \[ \mathcal{M}(z^-,z^+)\coloneqq\bigcup_{k \geq 1}\left(\mathcal{M}_{\operatorname{cas}}^k(z^-,z^+)\mspace{-5mu}\left/ {\mathbb R}^k\right.\right). \] By taking such a union, we obtain another smooth manifold without boundary, which moreover is compact ``up to breaking''. If $z^-$ and $z^+$ are critical points of $f$ belonging to the same component of $ \operatorname{Crit} (\mathcal{A}^H)$ we set $\mathcal{M}(z^-,z^+)$ to be the quotient $W^u(z^-) {\cap} W^s(z^+)\big/\mathbb{R}$ arising from the natural $ \mathbb{R}$ action by translation.\\ \textbf{Grading:} We use the $ \mathbb{Z}$-grading convention of \cite{CieliebakFrauenfelderOancea2010}, which differs from the $ \mathbb{Z}+ \frac{1}{2}$ grading convention of \cite{CieliebakFrauenfelder2009} by a factor of 1/2. Explicitly, for $z \in \operatorname{Crit} (f)$ we define \begin{equation}\label{muRF} \mu(z) \coloneqq \mu^{\operatorname{tr}}_{\operatorname{CZ}}(z) + \mu_\sigma(z) +\frac{1}{2}, \end{equation} where $\mu^{\operatorname{tr}}_{\operatorname{CZ}}$ is the transverse Conley-Zehnder index and $\mu_\sigma$ is the signature index defined by \begin{equation}\label{musig} \mu_\sigma(x)=\frac{1}{2}\big(\dim W^s_f(x)-\dim W^u_f(x) \big). \end{equation} For a regular pair $(H,J)$, one has \[ \dim \mathcal{M}(z^-,z^+) = \mu(z^+)- \mu(z^-) - 1. \] The compactness up to breaking property alluded to above tells us that when $\mu(z^+)- \mu(z^-) = 1$ the space $ \mathcal{M}(z^-,z^+)$ is compact, and hence a finite set. We denote by $n(z^-,z^+)$ its parity.\\ \textbf{The Rabinowitz Floer complex:} We define the ${\mathbb Z}_2$-vector space $CF(H,f)$ as the set of formal sums of the form $ \sum_{z \in S} z$, where $S \subset \operatorname{Crit}(f)$ is a (possibly infinite) set satisfying the \textit{Novikov finiteness condition} \begin{equation} \#\;\big\{ z\in S\,\big|\,\mathcal{A}^H(z)>a\big\} < \infty\qquad \forall \, a\in\mathbb{R}. \label{novikov} \end{equation} We denote by $CF_k(H,f) \subset CF(H,f)$ those sums $\sum_Sz$ with $ \mu(z) = k$ for all $z \in S$. We turn $CF_*(H,f)$ into a chain complex by defining \[ \partial z^+ \coloneqq \sum n(z^-,z^+) z^-, \] where the sum is taken over all critical points $z^-$ with $ \mu(z^+) =\mu(z^-)+1$, and then extending by linearity. Compactness up to breaking implies that $ \partial^2 = 0$, and a continuation argument tells us that the resulting \textit{Rabinowitz Floer homology} $RFH(H)$ is independent of the auxiliary data used to define it. We refer the reader to \cite{CieliebakFrauenfelder2009} (when $H$ satisfies \ref{c1}) and \cite{pasquotto2018} (when $H$ is strongly tentacular) for details. \begin{remark} \label{rem:onlyonsigma} If $H \in \mathcal{H}$ satisfies condition \ref{c1} then the Rabinowitz Floer homology groups only depend on $H$ through its zero level set $\Sigma$, and thus we could write $RFH_*(\Sigma)$ instead (although we won't). For strongly tentacular $H$ this need not be the case. However for $H$ of the form \eqref{defH} the main result of this article, Theorem \ref{thm:compRFH}, shows that the Rabinowitz homology groups only depend on the ``compact part'' of the zero level set. \end{remark} \begin{remark} \label{compact-special-case} In fact, when $ \Sigma$ is compact, there is considerable freedom in the choice of the Hamiltonian $H$ realising $\Sigma$ as its zero level set. In this section for historical reasons we have concentrated on the case where $dH$ is compactly supported, but one could also use a quadratic Hamiltonian \cite{AbbondandoloSchwarz2010}. In particular, for the hypersurface $\Sigma_0$ from \eqref{Sigma-Sigma0} we can use the Hamiltonian $H_0$ from \eqref{defH} to compute its Rabinowitz Floer homology. This fact will be used in the proof of Theorem \ref{thm:iso}. This also shows that the compact case is subsumed by the strongly tentacular case, i.e.\ if $H \in \mathcal{H}$ satisfies condition \ref{c1} then there exists a strongly tentacular $H' \in \mathcal{H}$ such that $H^{-1}(0) = (H')^{-1}(0)$. \end{remark} \textbf{Positive Rabinowitz Floer homology:} The action functional ${\mathcal{A}}^H$ provides an ${\mathbb R}-$filtration on $CF\left({\mathcal{A}}^H,f\right)$ as follows: For $t\in {\mathbb R}$ denote the complex generated by critical points of action $\leq t$ by \begin{equation} CF^{\leq t}(H,f)\coloneqq \left\lbrace {\textstyle \sum_{z\in S}z}\in CF(H,f) \left|\ \sup_{z\in S}\mathcal{A}^H(z) \leq t\right.\right\rbrace. \label{CFt} \end{equation} The boundary operator does not increase the action, i.e.\ \begin{equation}\label{filtration} \partial\left( CF^{\leq t}_{*+1}(H,f)\right)\subseteq CF^{\leq t}_*(H,f). \end{equation} The positive Rabinowitz Floer homology $RFH^+(H)$ is the homology of the following quotient complex generated by the critical points with positive action: \begin{equation}\label{CF+} \begin{aligned}CF^+(H,f) & \coloneqq CF(H,f)\Big/CF^{\leq 0}(H,f)\\ & \, =\left\lbrace x\in {\operatorname{Crit}}(f)\ \big|\ {\mathcal{A}}^H(x)>0\right\rbrace\otimes {\mathbb Z}_2.\end{aligned} \end{equation} The associated boundary operator $\partial^{\scriptscriptstyle +}$ is induced by $\partial$ on the quotient, which is well-defined as $\partial$ reduces the action (cf.\ (\ref{filtration})). Geometrically, $\partial^+$ is defined by counting flow lines with cascades where both endpoints have strictly positive action. Analogously, one defines $RFH^-(H)$ as the homology of $CF^{<0}(H,f)$. More generally, $CF^+(H,f)$ fits into the following short exact sequence of complexes induced by action filtration: \begin{equation}\label{ActionShortExSeq} 0\rightarrow \equalto{CF^0(H,f)}{CF^{\leq 0}/CF^{<0}}\rightarrow \equalto{CF^{\geq 0}(H,f)}{CF/CF^{<0}}\rightarrow \equalto{CF^+(H,f)}{CF/CF^{\leq 0}}\rightarrow 0, \end{equation} where the boundary operator of each complex is induced by $\partial$ and well-defined due to (\ref{filtration}). We hence obtain the following long exact sequence in homology \begin{equation}\label{ActionLongExSeq} \dots \rightarrow RFH^0_\ast(H)\rightarrow RFH^{\geq 0}_\ast(H)\rightarrow RFH^+_\ast(H)\rightarrow RFH^0_{\ast-1}(H)\rightarrow \dots \end{equation} where $RFH^0_\ast(H)\cong H_{\ast+n-1}(\Sigma)$, as $\partial$ counts in the zero-action window only flow lines with no cascades, i.e.\ Morse flow lines on $\Sigma$. The positive Rabinowitz Floer homology is independent of the auxiliary choices used to define it and invariant under compact perturbations. When $H$ satisfies condition \ref{c1}, these facts follow from \cite[Cor.\ 3.8]{CieliebakFrauenfelder2009}. The proof for strongly tentacular $H$ goes along similar lines, but the argument is slightly more involved, and has not yet appeared in the literature. Therefore in the next section we supply the full details. Similar statements apply to the other variants $RFH^{\ge 0}$, $RFH^-$, etc. \subsection{Bounds}\label{ssec:bounds} One of the crucial steps in constructing the homomorphism between $RFH(H)$ and $RFH(H_0)$ is to establish $L^\infty$-bounds on $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0,\Lambda)$. To formulate the $L^\infty$-bounds in Proposition \ref{prop:hybBound} and Lemma \ref{lem:compact} we introduce the following notation: for a compact subset $N\subseteq \Sigma$ and a connected component $\Lambda_{0} \subseteq {\operatorname{Crit}}({\mathcal{A}}^{H_{0}})$ we denote \begin{align*} \mathcal{C}({{\mathcal{A}}^{H}},N) & \coloneqq \left\lbrace x\in {\operatorname{Crit}}(\mathcal{A}^H)\ \Big|\ |\mathcal{A}^H(x)|>0 \quad \textrm{or}\quad x\in N\times\{0\}\right\rbrace, \label{eqn:CAHY}\\ \mathcal{N}_{\operatorname{hyb}}(\Lambda_0, N) & \coloneqq \left\lbrace (u_0,u) \in \mathcal{M}_{\operatorname{hyb}}(\Lambda_0,\Sigma{\times}\{0\})\ \Big|\ \lim_{s\to +\infty}u(s)\in N \right\rbrace, \end{align*} For a pair of connected components $(\Lambda_{0},\Lambda) \subseteq {\operatorname{Crit}}({\mathcal{A}}^{H_{0}}) \times\left({\operatorname{Crit}}({\mathcal{A}}^H)\big\backslash (\Sigma{\times}\{0\})\right)$ we denote $\mathcal{N}_{\operatorname{hyb}}(\Lambda_0, \Lambda)\coloneqq \mathcal{M}_{\operatorname{hyb}}(\Lambda_0, \Lambda)$. \begin{prop}\label{prop:hybBound} Consider a compact subset $N\subseteq \Sigma$ and a pair of connected components $(\Lambda_{0},\Lambda) \subseteq {\operatorname{Crit}}({\mathcal{A}}^{H_{0}}) \times\mathcal{C}({\mathcal{A}}^{H},N)$, such that $a \leq {\mathcal{A}}^{H_{0}}(\Lambda_0)\leq{\mathcal{A}}^{H}(\Lambda)\leq b$. Then the corresponding moduli space $\mathcal{N}_{\operatorname{hyb}}(\Lambda_0, \Lambda)$ admits uniform $L^\infty$-bounds, which depend only on $a,b$ and $N$. \end{prop} \begin{proof} First observe that by adapting the result in \cite[Prop.\ 6.2]{pasquotto2017} to the hybrid problem we obtain \begin{equation} \sup\left\lbrace \|u^\pm(\pm s)\|_{L^2(S^1)\times{\mathbb R}}\ \Big|\ (u^-,u^+)\in\mathcal{N}_{\operatorname{hyb}}(\Lambda_0, \Lambda),\ s\geq 0\right\rbrace<+\infty.\label{L2bounds} \end{equation} Moreover, there exists $\varepsilon_0>0$, such that \begin{align} \sup\left\lbrace \begin{array}{c|c} & (u^-,u^+)\in\mathcal{N}_{\operatorname{hyb}}(\Lambda_0, \Lambda),\ s\leq 0,\\ {\smash{\raisebox{.5\normalbaselineskip}{ $\|u^-(s)\|_{L^\infty\times{\mathbb R}}$}}} & \|\nabla_{J_0} \mathcal{A}^{H_0}(u^-(s))\|< \varepsilon_0 \end{array} \right\rbrace<+\infty,\label{EpsiBnds1}\\ \sup\left\lbrace \begin{array}{c|c} & (u^-,u^+)\in\mathcal{N}_{\operatorname{hyb}}(\Lambda_0, \Lambda),\ s\geq 0,\\ {\smash{\raisebox{.5\normalbaselineskip}{ $\|u^+(s)\|_{L^\infty\times{\mathbb R}}$}}} & \|\nabla_J \mathcal{A}^{H}(u^+(s))\|< \varepsilon_0 \end{array} \right\rbrace<+\infty. \label{EpsiBnds2} \end{align} and all the bounds depend only on $a,b$ and $N$. Next, we use a maximum principle argument to prove uniform bounds on the fragment of the Floer trajectories, where the action derivation is greater than $\varepsilon_0$. For $(u^-,u^+)=((v^-,\eta^-),(v^+,\eta^+))\in\mathcal{N}_{\operatorname{hyb}}(\Lambda_0, \Lambda)$ define a function \begin{align*} r & \hspace{2pt} \colon (-\infty,0]\times S^1 \to \mathbb{R},\\ r (s,t) & \coloneqq \frac{1}{4}\left( \|v^-(s,t)\|^2+\|v^+(-s,t)\|^2\right). \end{align*} Using the function $F$ defined as $\frac{1}{4}\|\cdot\|^2$ we can rewrite $r$ as \[ r(s,t)= F\circ v^-(s,t)+F \circ v^+(-s,t). \] The function $F$ is plurisubharmonic, which means that $-dd^\mathbb{C}F=\omega$. By \eqref{EpsiBnds1} and \eqref{EpsiBnds2} we know that there exists $c_0>0$, such that for every $(s,t)\in r^{-1}([c_0,+\infty))$ we have \begin{equation} \|\nabla_{J_0} {\mathcal{A}}^{H_0}(u^-(s))\| \ge \varepsilon_0, \qquad \|\nabla_J {\mathcal{A}}^{H}(u^+(-s))\| \geq \varepsilon_0. \label{NablaBound} \end{equation} On the other hand, by Lemma \ref{energy} we have the following bound: \[ b-a\geq E(u^-,u^+)=\int_{-\infty}^0\|\nabla_{J_0} {\mathcal{A}}^{H_0}(u^-(s))\|^2ds+\int_0^{\infty}\|\nabla_J {\mathcal{A}}^{H}(u^+(s))\|^2ds. \] Therefore, for every connected component $\Omega \subseteq r^{-1}([c_0,+\infty))$ there exist $s_0,s_1 \geq 0$, such that \[ \Omega \subseteq [s_0,s_1]\times S^1\quad \textrm{and}\quad |s_1-s_0|\leq \frac{b-a}{2\varepsilon_0^2}. \] Since \eqref{L2bounds} and \eqref{NablaBound} are both satisfied, we can use \cite[Thm.\ 7.1]{pasquotto2017} and conclude that there exists a function $f \colon (-\infty,0]\times S^1 \to \mathbb{R}$, such that $\triangle r \geq f$ and the $L^2$-norm of $f$ is bounded on $\Omega$ and the bound depends only on $a,b$ and $N$. Now, if $\partial \Omega \cap (\{0\}{\times} S^1)=\emptyset$, then we can apply the Aleksandrov Maximum Principle \cite[Thm.\ 9.1]{gilbarg1998} to deduce that there exists $c_1>0$, such that \begin{equation} \sup_\Omega r \leq \sup_{\partial \Omega}r+c_1\|f\|_{L^{2}(\Omega)}=c_0+c_1\|f\|_{L^{2}(\Omega)}<+\infty, \label{limit} \end{equation} and the bound depends only on $a,b$ and $N$. However, if $\partial \Omega \cap \big(\{0\}{\times} S^1\big)\neq\emptyset$ then we need to check an additional assumption. More precisely we would like to show that $\partial_sr \geq 0$ on $\partial \Omega \cap (\{0\}{\times} S^1)$ to be able to apply the Aleksandrov Maximum Principle for half cylinders \cite[Thm.\ 2.8]{Abbon2009} for \eqref{limit}. Denote \[ \sigma(v^+)=: (v_0,v_1)\in C^\infty\left({\mathbb R}\times S^1, T^*{\mathbb R}^k\right)\times C^\infty\left({\mathbb R}\times S^1,T^*{\mathbb R}^{n-k}\right), \] where $\sigma$ is the splitting from \eqref{splitting}. Then (with a slight abuse of notation of $F$) \begin{equation}\label{dRho} \partial_sr= dF(\partial_s v^-)-dF(\partial_sv_0)-dF(\partial_sv_1). \end{equation} By the coupling condition \eqref{coupling} we have $\eta^-(0)=\eta^+(0)$ and $\partial_tv^-(0,t)=\partial_t v_0(0,t)$. Since $J_0\in {\mathcal J}_\star^k$ and $ J\in {\mathcal J}_\star^n$, we can assume without loss of generality that for $(s,t)\in r^{-1}([c_0,+\infty))$, one has \[ J_0(u^-(s,t),t) \equiv \mathbb{J}_k, \qquad J(u^+(-s,t),t) \equiv \mathbb{J}_n. \] Therefore by \eqref{Floer} we have \[ \partial_s v_0(0)=\nabla_{\mathbb{J}_k} {\mathcal{A}}^{H_0}(v_0(0))=\nabla_{\mathbb{J}_k} {\mathcal{A}}^{H_0}(v^-(0))=\partial_s v^-(0). \] As a result, the first and second term in \eqref{dRho} cancel each other. To calculate the last term let us make the following observation: \begin{align} dF(\partial_s v_1(0)) & = dF\left(\nabla {\mathcal{A}}^{H_1}(v_1(0))\right)\nonumber \\ & = - d^{\mathbb{C}} F\left(\partial_t v_1(0)-\eta^+(0)X_{H_1}(v_1(0))\right). \label{dFC} \end{align} By \eqref{coupling} we have that $v_1(0)$ lies in the $0$-section $\chi_0$ and $$ d^{\mathbb{C}}F\big|_{T\chi_0}=\frac{1}{2}\left(qdp -pdq\right)\big|_{T\chi_0}=0, $$ thus the first term in \eqref{dFC} vanishes. For the second term of \eqref{dFC} observe that \[ d^\mathbb{C}F(X_{H_1})=\langle \nabla H_1, \nabla F\rangle = H_1. \] As $H_1$ also vanishes on $\chi_0$, the whole third term in \eqref{dRho} vanishes and we conclude that $\partial_sr=0$ on $\{0\}\times S^1$. This allows us to apply the Aleksandrov Maximum Principle for half cylinders and prove \eqref{limit} also in case where $\partial \Omega \cap (\{0\}\times S^1)\neq\emptyset$. \end{proof} \subsection{Computation} In this section we prove Theorem \ref{thm:compRFH}. In other words, we will calculate the full Rabinowitz Floer homology of $H$ using the isomorphism of the positive Rabinowitz Floer homologies proven in Theorem \ref{thm:iso} and the following long exact sequences (see \eqref{ActionLongExSeq}): \begin{gather} \dots \to H_{*+n-1}(\Sigma) \to RFH_{*}^{\geq 0}(H) \to RFH^+_*(H)\to \dots \label{exact1}\\ \dots \to RFH^-_{*}(H) \to RFH_{*}(H) \to RFH^{\geq 0}_*(H)\to \dots \label{exact2} \end{gather} We begin by collecting the properties of the Rabinowitz Floer homology for the compact hypersurface $ \Sigma_0$ that we need\footnote{ We remind the reader (Remark \ref{rem:onlyonsigma}) that in the compact case the Rabinowitz Floer homology only depends on $H_0$ through its zero level set $ \Sigma_0$. Therefore instead of $RFH_*(H_0)$ we could write $RFH_*(\Sigma_0)$, and similarly for the other variants. For consistency with the non-compact case, however, we will not do this.}. \begin{prop} \label{compact} For the compact hypersurface $ \Sigma_0 \subseteq \mathbb{R}^{2k}$ we have \begin{equation}\label{plusIminus1} RFH^+_*(H_0) = \left\lbrace \begin{array}{c c c} {\mathbb Z}_2 & & *= k+1,\\ 0 & & *\neq k+1. \end{array} \right. \qquad RFH^-_*(H_0)= \left\lbrace \begin{array}{c c c} {\mathbb Z}_2 & & *= -k,\\ 0 & & *\neq -k. \end{array} \right. \end{equation} \end{prop} \begin{proof} Since $\Sigma_0$ is compact, it is displaceable in $\mathbb{R}^{2k}$. Thus by \cite[Thm.\ 1.2]{CieliebakFrauenfelder2009} we have $RFH(H_0)=0$. Thus also the symplectic homology $SH_*(\Sigma_0)$ and cohomology $SH^*(\Sigma_0)$ vanish by \cite[Thm.\ 13.3]{ritter_2013}. Therefore the positive symplectic homology $SH^+_*(\Sigma_0)$ agrees\footnote{This can also easily be proved directly.} with $H^{k-1-*}( \mathbb{R}^{2k})$ by \cite[Lem.\ 2.1]{CieliebakFrauenfelderOancea2010}. Then by \cite[Thm.\ 1.4]{CieliebakFrauenfelderOancea2010} we have $RFH^+_*(H_0) \cong SH^+_*( \Sigma_0)$. Now \eqref{plusIminus1} follows from \eqref{exact1} and \eqref{exact2}. \end{proof} That, together with the isomorphism from Theorem \ref{thm:iso} will allow us to calculate the full Rabinowitz Floer homology of $\Sigma$: \vspace*{0.5cm} \paragraph{\textit{Proof of Theorem \ref{thm:compRFH}:}} Recall from Remark \ref{H2} that $\Sigma \simeq S^{n+k-1}\times{\mathbb R}^{n-k}$, hence \begin{equation}\label{homSigma} H_*(\Sigma) = \begin{cases} {\mathbb Z}_2 & *=0, n+k-1,\\ 0 &\textrm{otherwise.}\end{cases}\quad\Rightarrow\quad H_{*+n-1}(\Sigma)=\begin{cases} {\mathbb Z}_2 & *=1-n, k,\\ 0 &\textrm{otherwise.}\end{cases} \end{equation} We now use the natural map (all squares commute!) between the long exact sequences proven in Theorem \ref{thm:iso}: $$ \xymatrix{ \dots \ar[r] &H_{*+n-1}(\Sigma) \ar[r] \ar[d]_{\Psi^0} & RFH_{*}^{\geq 0}(H) \ar[r] \ar[d] & RFH^+_*(H) \ar[r] \ar[d]_{\Psi^+} & \dots \\ \dots \ar[r] & H_{*+k-1}(\Sigma_0) \ar[r] & RFH_{*}^{\geq 0}(H_0) \ar[r] & RFH^+_*(H_0) \ar[r] & \dots} $$ By Theorem \ref{thm:iso} the map $\Psi^+ \colon RFH^+_*(H) \to RFH^+_*(H_0)$ is an isomorphism. Hence, we obtain from \eqref{plusIminus1} and \eqref{homSigma} that $RFH_{*}^{\geq 0}(H)= 0$ for all $* \notin \{1-n, k+1, k\}$. In case $*= 1-n$ we have \[ \equalto{RFH^+_{ 2-n}(H)}{0}\to \equalto{H_{0}(\Sigma)}{{\mathbb Z}_2} \to RFH_{ 1-n}^{\geq 0}(H) \to \equalto{RFH^+_{ 1-n}(H)}{0}, \] which implies $RFH_{ 1-n}^{\geq 0}(H)={\mathbb Z}_2$. In case $* \in \{ k+1, k\}$ we have $$ \xymatrix{ 0 \rightarrow RFH_{k +1}^{\geq 0}(H) \ar[r] \ar[d] & RFH^+_{k +1}(H) \ar[r] \ar[d]_{\Psi^+} &H_{n+k-1}(\Sigma) \ar[r] \ar[d]_{\Psi^0} & RFH_{k}^{\geq 0}(H) \ar[d] \rightarrow 0\\ 0 \rightarrow \equalto{RFH_{k +1}^{\geq 0}(H_0)}{0} \ar[r] &\equalto{RFH^+_{k +1}(H_0)}{{\mathbb Z}_2} \ar[r] & \equalto{H_{2k-1}(\Sigma_0) }{{\mathbb Z}_2} \ar[r] & \equalto{RFH_k^{\geq 0}(H_0)}{0} \rightarrow 0} $$ Observe that the maps $RFH^+_{k +1}(H_0)\rightarrow H_{2k-1}(\Sigma_0), \Psi^+$ and $\Psi^0$ are isomorphisms (cf.\ Theorem \ref{thm:iso}), implying that the map $RFH^+_{k +1}(H)\rightarrow H_{n+k-1}(\Sigma)$ is also an isomorphism. Consequently, $RFH_*^{\geq 0}(H)=0$ for $* \in \{ k+1, k\}$. We conclude that \[ RFH_*^{\geq 0}(H) \coloneqq \left\lbrace \begin{array}{c c l } {\mathbb Z}_2 & & *= 1-n,\\ 0 & & \textrm{otherwise}. \end{array} \right. \] Having determined $RFH^{\geq 0}_*(H)$ we plug it into \eqref{exact2} to determine $RFH(H)$. Combining it with \eqref{plusIminus1} and Remark \ref{rem:Sigma-} we obtain $RFH_\ast(H)=0$ for $*\notin \{1{-}n, -k\}$. In the other two cases we have the following exact sequences, which depend on the relation between $n$ and $k$. In case $n\neq k{+}1$ we have \[ \equalto{RFH^-_{ 1-n}(H)}{0} \to RFH_{ 1-n}(H) \to \equalto{RFH^{\geq 0}_{ 1-n}(H)}{{\mathbb Z}_2}\to 0, \] and \[ 0 \to \equalto{RFH^-_{-k}(H)}{{\mathbb Z}_2} \to RFH_{-k}(H) \to \equalto{RFH^{\geq 0}_{-k}(H)}{0}, \] which gives $RFH_{-k}(H)=RFH_{1-n}(H)={\mathbb Z}_2$. However, if $n=k{+}1$ we have \[ 0 \to \equalto{RFH^-_{ 1-n}(H)}{{\mathbb Z}_2} \to RFH_{1-n}(H) \to \equalto{RFH^{\geq 0}_{ 1-n}(H)}{{\mathbb Z}_2}\to 0, \] which gives $RFH_{ 1-n}(H)={\mathbb Z}_2\oplus {\mathbb Z}_2$. \hfill $\square$ \section{Tentacular hyperboloids} \subsection{H{\"o}rmander classification} Let $A$ be a non-degenerate, quadratic, symmetric matrix and consider the non-degenerate quadratic Hamiltonian $H$ on $(T^*{\mathbb R}^n,\omega_n)$ \begin{equation} H(x)\coloneqq \frac{1}{2}x^TAx -1.\label{quadHam} \end{equation} The hypersurface $\Sigma\coloneqq H^{-1}(0)$ is diffeomorphic to $S^{l-1}\times {\mathbb R}^{2n-l}$, where $(l,2n-l)$ is the signature of $A$. A hyperboloid is the $0$-level set of a quadratic Hamiltonian $H$ as in \eqref{quadHam} with $1\leq l \leq 2n-1$. \begin{remark} \label{rem:Lioville} Note that every hyperboloid is a hypersurface of contact type, as the radial Liouville vector field $Y=\frac{1}{2}x\partial_x$ satisfies $dH_x(Y)=H(x)+1=1\big|_\Sigma>0$. Moreover, the Hamiltonian vector field $X_H$ coincides with the Reeb vector field corresponding to $\iota_Y\omega_n\big|_\Sigma$, as $X_H\in \ker \omega_n\big|_\Sigma$ and $\iota_Y\omega_n(\cdot,X_H)=dH(Y)=1$ on $\Sigma$. \end{remark} In \cite[Sec.\ 9]{pasquotto2018} the last author together with Pasquotto and Vandervorst introduced the notion of \emph{symplectic hyperboloids}, which are equivalence classes of the set of hyperboloids under the action of the linear symplectic group $\operatorname{Sp}({\mathbb R}^{2n})$. A symplectic hyperboloid is called a \emph{tentacular hyperboloid} if it admits a strongly tentacular representative of the form \eqref{quadHam}. Proposition \ref{prop:TentEx} above provides plenty of examples of tentacular hyperboloids. According to H{\"o}rmander \cite[Thm.\ 3.1]{Hormander1995} each equivalence class is uniquely determined by the eigenvalues of $\mathbb{J}A$. Observe that if $\lambda$ is an eigenvalue of $\mathbb{J}A$ with a corresponding $m\times m$ block in the Jordan decomposition, then its additive inverse and its complex conjugate are also eigenvalues of $\mathbb{J}A$ each with a $m\times m$ block. By H{\"o}rmander classification, $T^*{\mathbb R}^n$ splits into a direct sum of symplectic subspaces $S_i$. In other words, after a symplectic change of coordinates we can assume that the matrix $A$ is a diagonal block matrix consisting of matrices $A_i=A|_{S_i}$. Each matrix $A_i$ corresponds to a $m\times m$ block with an eigenvalue $\lambda$ in the Jordan decomposition of $\mathbb{J}A$ and it is determined as follows: \begin{enumerate}[label=(\alph*)] \item if $\operatorname{Im}(\lambda)=0$, then $S_i\coloneqq T^*{\mathbb R}^m$ and $A_i$ is a $2m \times 2m$ block matrix $\left(\begin{smallmatrix} 0 & B\\ B^T & 0\end{smallmatrix}\right)$ where $B=\{b_{j,k}\}_{j,k=1}^m$ with \[ b_{j,k}\coloneqq \left\lbrace\begin{array}{c l} |\lambda| & \quad \textrm{if}\quad j=k,\\ 1 & \quad \textrm{if}\quad j= k+1,\\ 0 &\quad \textrm{otherwise}. \end{array} \right. \] Thus $B$ is a $m \times m$ matrix with $|\lambda|$'s on the diagonal and with $1$'s under the diagonal for $m>1$. The signature of $A_i$ is $(m,m)$ and the corresponding Hamiltonian $H_i \colon T^*{\mathbb R}^m \to {\mathbb R}$ is given by \[ H_i(q,p)\coloneqq |\lambda|\sum_{j=1}^mq_jp_j+\sum_{j=1}^{m-1}q_{j+1}p_j. \] \item if $\operatorname{Re}(\lambda)\neq 0,\ \operatorname{Im}(\lambda)\neq 0$, then $S_i\coloneqq T^*{\mathbb R}^{2m}$ and $A_i$ is an $4m\times 4m$ block matrix $A_i\coloneqq \left(\begin{smallmatrix} 0 & B\\ B^T & 0\end{smallmatrix}\right)$ where $B=\{b_{j,k}\}_{j,k=1}^{2m}$ with \[ b_{j,k}\coloneqq \left\lbrace\begin{array}{c l} |\operatorname{Re}(\lambda)| &\quad \textrm{if}\quad j=k,\\ |\operatorname{Im}(\lambda)| &\quad \textrm{if}\quad \frac{j}{2} \in \mathbb{N} \quad \textrm{and}\quad k= j-1,\\ -|\operatorname{Im}(\lambda)| &\quad \textrm{if}\quad \frac{k}{2} \in \mathbb{N} \quad \textrm{and}\quad j= k-1,\\ 1 &\quad \textrm{if}\quad k=j+2,\\ 0 &\quad \textrm{otherwise}. \end{array} \right. \] The signature of $A_i$ is $(2m,2m)$ and $H_i \colon T^*{\mathbb R}^{2m} \to {\mathbb R}$ is given by \[ H_i(q,p)\coloneqq \sum_{j=1}^{2m-2}q_jp_{j+2}+|\operatorname{Re}(\lambda)|\sum_{j=1}^{2m}q_jp_j+|\operatorname{Im}(\lambda)|\sum_{j=1}^m \big( q_{2j}p_{2j-1}-q_{2j-1}p_{2j} \big). \] \item if $\operatorname{Re}(\lambda)=0$, then $S_i\coloneqq T^*{\mathbb R}^m$ and for some $\gamma=\pm 1$, $A_i$ is an $2m\times 2m$ block matrix $\left(\begin{smallmatrix} B & 0\\ 0 & B^P\end{smallmatrix}\right)$, where $B=\{b_{j,k}\}_{j,k=1}^{m}$ with \[ b_{j,k}\coloneqq \gamma\left\lbrace\begin{array}{c l r} 2|\operatorname{Im}(\lambda)| &\quad \textrm{if}\quad j=k=\frac{m+1}{2}\in \mathbb{N},\\ -2 &\quad \textrm{if}\quad j=k=\frac{m+2}{2}\in \mathbb{N},\\ |\operatorname{Im}(\lambda)| &\quad \textrm{if}\quad j\neq k\quad \textrm{and}\quad j+k=m+1,\\ -1 &\quad \textrm{if}\quad j\neq k\quad \textrm{and}\quad j+k=m+2,\\ 0 &\quad \textrm{otherwise}. \end{array} \right. \] and $B^P$ is the reflection of $B$ with respect to the anti-diagonal. That is, $B^P=\{b_{\delta(j,k)}\}_{j,k=1}^m$ with $\delta(j,k)=(m{+}1\,{-}j, m{+}1\,{-}k)$. The signature of $A_i$ is $(m,m)$ if $m$ is even and $(m+\gamma,m-\gamma)$ if $m$ is odd, and the corresponding Hamiltonian $H_i \colon T^*{\mathbb R}^m \to {\mathbb R}$ is equal to \[ H_i(q,p)\coloneqq \frac{\gamma}{2}\left(|\operatorname{Im}(\lambda)|\sum_{j=1}^m \big(q_jq_{m+1-j}+ p_jp_{m+1-j} \big)-\sum_{j=1}^{m-1} \big(q_{j+1}q_{m+1-j} +p_jp_{m-j} \big)\right). \] \end{enumerate} The H{\"o}rmander classification determines a unique (up to permutation of the blocks) representative of the equivalence class of non-degenerate matrices under the action of $\operatorname{Sp}({\mathbb R}^{2n})$. In particular, after a linear symplectic change of coordinates, every quadratic Hamiltonian of the form \eqref{quadHam} can be represented as a sum of Hamiltonians $H_i \colon S_i\to{\mathbb R},$ \[ H(x)=\sum_iH_i(x_i)-1, \qquad H_i(x_i)\coloneqq \frac{1}{2} x_i^TA_ix_i, \qquad x_i\in S_i, \] with $A_i$ either of type (a), (b) or (c). \begin{remark} Observe, that the Hamiltonian $H_i(x_i)=\frac{1}{2} x_i^TA_ix_i$ for a matrix $A_i$ either of type (a) or (b) vanishes on the $0$-section $\chi_0={\mathbb R}^{m}\times\{0\}\subseteq T^*{\mathbb R}^m =S_i$. In other words, if a quadratic Hamiltonian $H \colon T^*{\mathbb R}^m\to {\mathbb R}$ as in \eqref{quadHam} comes from a non-degenerate, symmetric matrix $A$ and all the eigenvalues of the matrix $\mathbb{J}_m A$ have non-zero real part, then there exists a Lagrangian subspace of $T^*{\mathbb R}^m$ on which the Hamiltonian $H+1$ vanishes. \end{remark} A classical result \cite[Lem.\ 2.43]{mcduff2005} shows that a positive definite matrix is simplectically diagonalizable. More precisely, by applying a linear symplectic change of coordinates to a positive definite matrix, we can obtain a diagonal matrix with couples of positive real numbers $\mu_1,\mu_1,\dots, \mu_k,\mu_k,\ \mu_j\leq \mu_{j+1}$ on the diagonal. In the words of the H{\"o}rmander classification: a positive definite matrix corresponds to $k$ block matrices of type (c) and dimension $2$. Therefore, we can conclude that if $A$ is a positive definite matrix, then all the eigenvalues of $\mathbb{J}A$ are purely imaginary and equal $\pm i\mu_j,\ j=1,\dots, k$. Given $x \in \mathbb{R}^n$, write $x = (x',x'')$ with respect to the splitting $\mathbb{R}^n = \mathbb{R}^k \oplus \mathbb{R}^{n-k}$. Define the symplectic splitting $T^*{\mathbb R}^n\cong T^*{\mathbb R}^k \times T^*{\mathbb R}^{n-k}$ via the symplectomorphism \begin{equation}\label{splitting} \begin{aligned} \sigma \colon \big( T^*{\mathbb R}^n, \omega_n \big) &\to \big( T^*{\mathbb R}^k \times T^*{\mathbb R}^{n-k}, \omega_k \oplus \omega_{n-k} \big)\\ \sigma (q,p) &\coloneqq \big( (q',p'), (q'',p'') \big). \end{aligned} \end{equation} Then $\sigma(\Sigma)\cap\left(T^*{\mathbb R}^k\times\{0\}\right)=\Sigma_0\times\{0\}$. \begin{remark}\label{H2} From the arguments presented above we can deduce the following properties of the matrices and Hamiltonians satisfying \eqref{defH}: \begin{enumerate}[label=(\roman*)] \item The eigenvalues of $\mathbb{J}_kA_0$ are purely imaginary; \item Without loss of generality we can assume that $A_0$ is a diagonal matrix with couples of positive real numbers $\mu_1,\mu_1,\dots, \mu_k,\mu_k,\ \mu_j\leq \mu_{j+1}$ on the diagonal, which correspond to eigenvalues $\pm i\mu_j$ of $\mathbb{J}_kA_0$; \item The matrix $A_1$ has signature $(n-k,n-k)$; \item Define $\Sigma_0\coloneqq H_0^{-1}(0), \Sigma\coloneqq H^{-1}(0)$ and \begin{equation}\label{Sigma1} \Sigma_1\coloneqq \Sigma \cap \sigma^{-1}(T^*{\mathbb R}^k\times S), \end{equation} where $S$ denotes the $n{-}k$-dimensional subspace of $T^*{\mathbb R}^{n-k}$ spanned by the eigenvectors of $A_1$ corresponding to positive eigenvalues. Then there exist diffeomorphisms $\phi_0 \colon \Sigma_0\rightarrow S^{2k-1}$ and $\phi \colon \Sigma\rightarrow S^{n+k-1}\times {\mathbb R}^{n-k}$, such that $\phi(\Sigma_1)=S^{n+k-1}\times\{0\}$. \item\label{DefnS} Without loss of generality, we can assume that the Hamiltonian $H_1$ satisfies $H_1(x, 0)= 0$ for all $x\in {\mathbb R}^{n-k}$, i.e.\ $H_1$ vanishes on the $0$-section $\chi_0={\mathbb R}^{n-k}\times\{0\}\subseteq T^*{\mathbb R}^{n-k}$. In particular, $$ \sigma^{-1}(\Sigma_0 \times \chi_0) \subseteq \Sigma. $$ \item For $S$ defined as above we have $S\cap \chi_0=\{0\}$. \end{enumerate} \end{remark} \begin{remark} We emphasise (cf. Remark \ref{works-for-any-tent}) that all points of Remark \ref{H2} only use that $H$ is of the form \eqref{defH} with $A_0$ positive definite and $\mathbb{J}A_1$ hyperbolic. \end{remark} The embedding $T^*{\mathbb R}^k\cong T^*{\mathbb R}^k\times \{0\}^{2(n-k)}\hookrightarrow T^*{\mathbb R}^n$ induces an inclusion \begin{equation} \label{eqj} j \colon \Sigma_0 \hookrightarrow \Sigma_1, \end{equation} and a retraction $r \colon \Sigma \to \Sigma_1$. Recall that the Umkehr map $j_! \colon H_*(\Sigma_1) \to H_{* +k-n}( \Sigma_0)$ is defined as the composition \[ j_! \coloneqq ( - \frown [\Sigma_0] ) \circ j^* \circ ( - \frown [\Sigma_1])^{-1}. \] For later purposes, we observe that the composition \begin{equation} \label{umkehr} j_! \circ r_* \colon H_*( \Sigma) \to H_{* + k - n}(\Sigma_0), \end{equation} is an isomorphism for $* = n +k - 1$ and zero otherwise. \section{Computation of the Rabinowitz Floer homology} \subsection{Building the isomorphism} The main goal of this section will be the proof of Theorem \ref{thm:iso}. Throughout this section we will consider the following setting: let $H \colon T^*{\mathbb R}^n\to {\mathbb R}$ and $H_0 \colon T^*{\mathbb R}^k\to {\mathbb R}$ be Hamiltonians satisfying \eqref{defH} and let $J_0 \in \mathcal{J}_\star^k, J\in \mathcal{J}_\star^n$ be two $2$-parameter families of $\omega_0$-compatible almost complex structures, such that the couples $(H_0,J_0)$ and $(H,J)$ are regular in the sense of Definition \ref{def:regular}. By Lemma \ref{lem:orbits}, the embedding $T^*{\mathbb R}^k\cong T^*{\mathbb R}^k\times \{0\}^{2(n-k)}\hookrightarrow T^*{\mathbb R}^n$ induces an inclusion\footnote{This is not to be confused with the inclusion $j$ from \eqref{eqj}.} \begin{equation} \label{eqi} i \colon \operatorname{Crit} (\mathcal{A}^{H_0}) \hookrightarrow \operatorname{Crit} (\mathcal{A}^{H}), \end{equation} such that its restriction to ${\operatorname{Crit}}({\mathcal{A}}^{H_0})\big\backslash (\Sigma_0{\times}\{0\})$ is a diffeomorphism. By Lemma \ref{lem:orbits} and Proposition \ref{prop:muCZ} the inclusion $i \colon {\operatorname{Crit}}({\mathcal{A}}^{H_0}) \hookrightarrow {\operatorname{Crit}}({\mathcal{A}}^H)$ is both action and degree preserving\footnote{with respect to the transverse Conley-Zehnder index.}. By Remark \ref{rem:Sk} for each connected component $\Lambda \subseteq\operatorname{Crit}({\mathcal{A}}^H)\big\backslash (\Sigma{\times}\{0\})$ there exists $m\in \{1, \dots, k\}$, such that $\Lambda$ is diffeomorphic to $S^{2m-1}$. By Remark \ref{H2}, we have that $\Sigma_0\times\{0\}\subseteq {\operatorname{Crit}}({\mathcal{A}}^{H_0})$ is diffeomorphic to $S^{2k-1}$, while $\Sigma\times\{0\}\subseteq {\operatorname{Crit}}({\mathcal{A}}^H)$ is diffeomorphic to $S^{n+k-1}{\times}{\mathbb R}^{n-k}$. Moreover this diffeomorphism can be chosen such that if $ \Sigma_1 \subset \Sigma$ is the sphere of dimension $n+k-1$ corresponding to $ S^{n+k-1} \times \{0\}$ then $\Sigma_0 \subset \Sigma_1$. As in \eqref{eqj} we denote by $j \colon \Sigma_0 \hookrightarrow \Sigma_1$ the inclusion. Thus the inclusion $i$ from \eqref{eqi} satisfies \[ i(x,0) = (j(x),0), \qquad \forall (x,0) \in \Sigma_0 \times \{0 \}. \] Therefore, we can choose a Morse-Smale pair $(f,g)$ on ${\operatorname{Crit}} ({\mathcal{A}}^H)$, such that: \begin{enumerate}[label=\roman*)] \item $f$ is coercive; \item $\operatorname{Crit}(f)\cap\Lambda=\{z^-,z^+\}$ for each connected component $\Lambda\subset{\operatorname{Crit}} ({\mathcal{A}}^H)$; \item \label{cond4} $(f_0,g_0)$ is a Morse-Smale pair on ${\operatorname{Crit}}({\mathcal{A}}^{H_0})$, such that $(f_0,g_0):=(f \circ i, i^*g)$ on ${\operatorname{Crit}}({\mathcal{A}}^{H_0})\big\backslash(\Sigma_0{\times}\{0\})$; \item for $\mathcal{A}^H(z^\pm)=0$ we have $W^s_f(z^\pm) \subseteq \Sigma_1{\times}\{0\}$, $z^+ \in i(\Sigma_0)$ and $z^- \notin i(\Sigma_0)$; \item ${\operatorname{Crit}}(f_0)\cap (\Sigma_0 {\times} \{0\})=\{x^-,x^+\}$ and $i(x^+)=z^+$ and $i(x^-) \notin {\operatorname{Crit}}(f)$. \end{enumerate} We denote by $x^-$ or $z^-$ always the minimum of $f_0$ or $f$ on a connected component $\Lambda_0$ of $\operatorname{Crit}(\mathcal{A}^{H_0})$ or $\Lambda$ of $\operatorname{Crit}(\mathcal{A}^{H})$ respectively. In the following, let $x^\pm$ or $z^\pm$ be the two critical points of $f_0$ or $f$ belonging to the same components $\Lambda_0$ or $\Lambda$ respectively. From the assumptions above, we can conclude the following: \begin{enumerate}[label=\alph*)] \item $\operatorname{Crit}(f_0)\cap\Lambda_0=\{x^\pm\}$ for all connected components $\Lambda_0 \subset \operatorname{Crit}(\mathcal{A}^{H_0})$. \item The restriction $i \colon {\operatorname{Crit}}(f_0)\big\backslash(\Sigma_0 {\times} \{0\}) \to {\operatorname{Crit}}(f)\big\backslash(\Sigma {\times} \{0\})$ is a bijection with $i(x^\pm)=z^\pm$. \item The signature index of $x^{\pm}$ on $\Lambda_0 \cong S^{2m-1}$ is \begin{equation}\label{morse-a} \mu_\sigma(x^-) = - m + \frac{1}{2}, \qquad \mu_{\sigma}(x^+) = m - \frac{1}{2}. \end{equation} \item For $\eta\neq 0$, the signature index of $z^{\pm}$ on $\Lambda \cong S^{2m-1}$ is given by \begin{equation}\label{morse-b} \mu_\sigma(z^-) = - m + \frac{1}{2}, \qquad \mu_{\sigma}(z^+) = m - \frac{1}{2}. \end{equation} \item For $\eta=0$, we have $z^\pm\in\Sigma_1{\times}\{0\}\subset\Lambda=\Sigma{\times}\{0\}$ and $z^+$ is the maximum of $f|_{\Sigma_1}$ on $\Sigma_1\cong S^{n+k-1}$. The signature index of $z^{\pm}$ in this case is given by \begin{equation}\label{morse-c} \mu_\sigma(z^-) = - n + \frac{1}{2}, \qquad \mu_{\sigma}(z^+) = k - \frac{1}{2}. \end{equation} \end{enumerate} We will construct the isomorphism from Theorem \ref{thm:iso} via moduli spaces of cascades with solutions to the hybrid problem \eqref{Floer}-\eqref{coupling} defined as follows: For a pair $(x,z)\in {\operatorname{Crit}}(f_0)\times {\operatorname{Crit}}(f)$ and $m\in{\mathbb N}$ we denote by ${\mathcal{M}}^m_{\operatorname{hyb}}(x,z)$ the set consisting of sequences $\left(\{u_l\}_{l=1}^m,\{t_l\}_{l=1}^{m-1}\right)$, such that exactly one $u_{l_0}$ in the sequence is a solution to the hybrid problem, whereas all other $u_l$ are Floer trajectories of ${\mathcal{A}}^{H_0}$ for $l<l_0$ or of ${\mathcal{A}}^H$ for $l>l_0$. We require \begin{align*} \phi^{t_l}\circ \operatorname{ev}^+(u_l)=\operatorname{ev}^-(u_{l+1})\qquad l=1,...,m-1,\\ {\operatorname{ev}}^-(u_1)\in W^u_{f_0}(x) \qquad \textrm{and}\qquad {\operatorname{ev}}^+(u_m)\in W^s_f(z), \end{align*} where $t_l\geq 0$ are real numbers and $\phi^{t_l}$ is for $l<l_0$ the time $t_l$ gradient flow of $(f_0,g_0)$ on ${\operatorname{Crit}}({\mathcal{A}}^{H_0})$ and for $l\geq l_0$ the time $t_l$ gradient flow of $(f,g)$ on ${\operatorname{Crit}}({\mathcal{A}}^{H})$. \begin{remark}\label{rem:Mmanifold} For $m>1$ the group ${\mathbb R}^{m-1}$ acts by time shift on Floer trajectories of ${\mathcal{M}}_{\operatorname{hyb}}^m(x,z)$. We consider the quotients of ${\mathcal{M}}_{\operatorname{hyb}}^m(x,z)$ by this action and define \[ {\mathcal{M}}_{\operatorname{hyb}}(x,z)\coloneqq {\mathcal{M}}_{\operatorname{hyb}}^1(x,z)\cup \bigcup_{m>1}\left({\mathcal{M}}_{\operatorname{hyb}}^m(x,z)\left/{\mathbb R}^{m-1}\right.\right). \] $\mathcal{M}_{\operatorname{hyb}}(x,z)$ carries the structure of a smooth manifold by Theorem \ref{thm-index} and Proposition \ref{prop:trans} together with the standard Floer-theoretical results (cf.\ \cite[Prop.\ 1b]{Floer1989}, \cite[Thm.\ 9.2.3]{Audin2014}, \cite[Sec.\ 2.4]{Fauck2015}, \cite[Cor.\ A.15]{Frauenfelder2004}, \cite[Thm.\ 4.2]{pasquotto2018}, \cite[Sec.\ 2.3]{AbbonMerry2014}). Its dimension is $\mu(z)-\mu(x)$. \end{remark} If $\mathcal{A}^{H_0}(x)=\eta=\mathcal{A}^H(z)$, $\Lambda\coloneqq \Lambda^\eta$ and $\Lambda_0\coloneqq \Lambda^\eta_0$, we can describe $\mathcal{M}_{\operatorname{hyb}}(x,z)$ more explicitly. As the action decreases along non-trivial Floer trajectories, we find that in this case $\mathcal{M}_{\operatorname{hyb}}^m(x,z)=\emptyset$ for $m>1$. Thus $\mathcal{M}_{\operatorname{hyb}}(x,z)=\mathcal{M}_{\operatorname{hyb}}^1(x,z)$ consists entirely of stationary solutions. More precisely, we find that $\mathcal{M}_{\operatorname{hyb}}(x,z)$ is given by the fibre product \[ \xymatrix{ \mathcal{M}_{\operatorname{hyb}}(x,z) \ar@{.>}[r] \ar@{.>}[d] & \mathcal{M}_{\operatorname{hyb}}( \Lambda_0 , \Lambda) \ar[d]^{\operatorname{ev}} \\ W^u_{f_0}(x) \times W^s_f(z) \ar[r]^{\qquad \iota} & \Lambda_0 \times \Lambda} \] where $\iota$ is the inclusion and $\operatorname{ev} \colon \mathcal{M}_{\operatorname{hyb}}(\Lambda_0,\Lambda)\to\Lambda_0\times\Lambda$ the evaluation map: \[\operatorname{ev}(u_0,u)=\big(\lim_{s\rightarrow-\infty} u_0(s),\lim_{s\rightarrow+\infty} u(s)\big).\] Hence $\mathcal{M}_{\operatorname{hyb}}(x,z)=\operatorname{ev}^{-1}\big(W^u_{f_0}(x) \times W^s_f(z)\big)$ is a manifold of dimension \begin{align} \dim \mathcal{M}_{\operatorname{hyb}}(x,z) & = \dim W^u_{f_0}(x)+\dim W^s_f(z)+\dim \mathcal{M}_{\operatorname{hyb}}( \Lambda_0 , \Lambda)-\dim\Lambda_0-\dim\Lambda\nonumber\\ & = \dim W^u_{f_0}(x)+\dim W^s_f(z)-\frac{1}{2}\left(\dim\Lambda_0+\dim\Lambda\right)\nonumber\\ & = \mu_\sigma(z)-\mu_\sigma(x). \label{dim:Wxz} \end{align} provided the following intersection is transverse in $ \Lambda_0 \times \Lambda$: \begin{equation}\label{eq:transWxz} W^u_{f_0}(x) {\times} W^s_f(z)\cap {\operatorname{ev}}\big(\mathcal{M}_{\operatorname{hyb}}( \Lambda_0 , \Lambda)\big). \end{equation} For $\eta\neq 0$, we have $\Lambda_0\cong \Lambda$, so that ${\operatorname{ev}}\big(\mathcal{M}_{\operatorname{hyb}}( \Lambda_0 , \Lambda)\big)= \Delta$ is the diagonal in $\Lambda_0\times\Lambda_0$ by Lemma \ref{lem:stationary}. On the other hand, by our assumptions on $f_0$ and $f$ we have that $i(W^u_{f_0}(x))=W^u_f(i(x))$ and consequently the transversality of \eqref{eq:transWxz} is equivalent to the transversality of $W^u_f(i(x))\pitchfork W^s_f(z)$, which follows from the Morse-Smale assumption on the flow of $\nabla f$. When $\eta = 0$, we have by Lemma \ref{lem:stationary} that \[ Y \coloneqq \operatorname{ev}\big( \mathcal{M}_{\operatorname{hyb}}(\Lambda_0, \Lambda \big) \cong \Delta \times \chi_0, \] where $ \Delta$ is the diagonal in $\Lambda_0{\times}\Lambda_0\subseteq\Lambda_0{\times}\Lambda$ and $\chi_0$ is the zero section in $T^\ast{\mathbb R}^{n-k}$. In particular the transversality of \eqref{eq:transWxz} is equivalent to the transversality of \begin{equation}\label{transWxz2} \sigma^{-1}\big(W^u_{f_0}(x){\times} \chi_0\big) \cap W^s_f(z), \end{equation} in $\Sigma$. By Remark \ref{H2}, we have \begin{align*} \sigma^{-1}(\Sigma_0{\times} \chi_0) \cap \Sigma_1 & = \sigma^{-1}(\Sigma_0{\times} \chi_0) \cap \Sigma \cap \sigma^{-1}(T^*{\mathbb R}^k{\times} S)\\ & = \Sigma \cap \sigma^{-1}(\Sigma_0{\times} (\chi_0 \cap S)) &&\mspace{-20 mu}=\Sigma \cap \sigma^{-1}(\Sigma_0{\times} \{0\}) =i(\Sigma_0). \end{align*} By assumption $z^- \notin i(\Sigma_0)$ and $W^s_f(z^-)=\{z^-\}$, which in view of the above gives: $$ \sigma^{-1}\big(W^u_{f_0}(x^\pm){\times} \chi_0\big) \cap W^s_f(z^-)=\emptyset\quad \textrm{and} \quad \left(W^u_{f_0}(x^\pm)\times W^s_f(z^-)\right)\cap Y=\emptyset. $$ Thus \eqref{eq:transWxz} is transverse for $(x,z)=(x^\pm,z^-)$. On the other hand, by assumption $W^s_f(z^+)= \Sigma_1\setminus \{z^-\}\supseteq i(\Sigma_0)$. Thus $$ \sigma^{-1}\big(W^u_{f_0}(x^\pm){\times} \chi_0\big) \cap W^s_f(z^+)\supseteq i(W^u_{f_0}(x^\pm))\neq \emptyset. $$ Take $w \in \sigma^{-1}\big(W^u_{f_0}(x^\pm){\times} \chi_0\big) \cap W^s_f(z^+)$ and denote $\sigma(w)=(w_1,w_2)$. Then \begin{align*} T_w W^s_f(z^+) = T_w\Sigma_1 & = T_w\Sigma\cap D\sigma^{-1}(T_{w_1}T^*{\mathbb R}^k \times T_{w_2}S),\\ T_w \sigma^{-1}\big(W^u_{f_0}(x^\pm){\times} \chi_0\big) & = D\sigma^{-1}\big(T_{w_1}W^u_{f_0}(x^\pm)\times T_{w_2}\chi_0\big). \end{align*} By Remark \ref{H2} $\dim S= n-k = \dim \chi_0$ and $S\cap \chi_0=\{0\}$, hence $\operatorname{span}\{S, \chi_0\}={\mathbb R}^{2(n-k)}$ and consequently the intersection $\sigma^{-1}(W^u_{f_0}(x^\pm)\times \chi_0) \cap W^s_f(z^+)$ is transverse. \begin{remark}\label{rem:Mxz=1} In all the above cases for $\mathcal{A}^H(z)=\mathcal{A}^{H_0}(x)$ and $\mu_{\sigma}(z)=\mu_\sigma(x)$, we find that $\mathcal{M}_{\operatorname{hyb}}(x,z)=\{(x,z)\}$ contains exactly one element. \end{remark} In order to use $\mathcal{M}_{\operatorname{hyb}}(x,z)$ for the definition of $\psi$, one has to show that it is compact modulo breaking. This follows mostly by standard techniques via Gromov compactness. However, as we are on a non-compact manifold, we need to assure that all moduli spaces $\mathcal{M}_{\operatorname{hyb}}(x,z)$ are uniformly bounded in the $L^\infty$-norm. \begin{lem}\label{lem:compact} For every pair $(x,z)\in {\operatorname{Crit}}(f_0)\times {\operatorname{Crit}}(f)$ all Floer and hybrid trajectories from the set ${\mathcal{M}}_{\operatorname{hyb}}(x,z)$ are uniformly bounded in the $L^\infty$-norm and the bound depends only on $x$ and $y$. \end{lem} \begin{proof} Let $a\coloneqq {\mathcal{A}}^{H_0}(x)$ and $b\coloneqq {\mathcal{A}}^H(z)$. Denote the moduli spaces of Floer trajectories of ${\mathcal{A}}^{H_0}$ and ${\mathcal{A}}^H$ in the action window $[a,b]$ as follows: \begin{align*} \mathfrak{M}_{0}(a,b) & \coloneqq \bigcup_{\substack{\Lambda^{\pm}\subseteq {\operatorname{Crit}}\left({\mathcal{A}}^{H_{0}}\right)\\ {\mathcal{A}}^{H_{0}}\left(\Lambda^{\pm}\right)\in [a,b]}}\mathcal{M}(\Lambda^{-},\Lambda^{+}),\allowdisplaybreaks\\ \mathfrak{M}_{1}(a,b) & \coloneqq \bigcup_{\substack{\Lambda^{\pm}\subseteq {\operatorname{Crit}}\left({\mathcal{A}}^H\right)\\ {\mathcal{A}}^H\left(\Lambda^{\pm}\right)\in [a,b]}}\mathcal{M}(\Lambda^{-},\Lambda^{+}). \end{align*} By Corollary \ref{cor:CritVal} we know that the set $\operatorname{CritVal}({\mathcal{A}}^H)\cap[a,b]=\operatorname{CritVal}({\mathcal{A}}^{H_0})\cap[a,b]$ is finite. Combined with \cite[Thm. 1]{pasquotto2017} we infer that $\mathfrak{M}_{0}(a,b)$ and $\mathfrak{M}_{1}(a,b)$ are finite unions of sets whose images in ${\mathbb R}^{2k+1}$ and ${\mathbb R}^{2n+1}$ respectively are bounded, thus their images are bounded. Using the notation from section \ref{ssec:bounds} we denote for a compact subset $N\subseteq \Sigma$ the moduli spaces of the solutions to \eqref{Floer} and \eqref{coupling} connecting components of the critical set of ${\mathcal{A}}^{H_{0}}$ in action window $[a,b]$ with components of the critical set of ${\mathcal{A}}^H$ in the same action window as follows: \[ \mathfrak{M}_{2}(a,b)\coloneqq \bigcup_{\substack{\Lambda_0\subseteq {\operatorname{Crit}}\left({\mathcal{A}}^{H_{0}}\right)\\ {\mathcal{A}}^{H_{0}}\left(\Lambda_0\right)\in [a,b]}}\ \bigcup_{\substack{\Lambda \subseteq \mathcal{C}\left({\mathcal{A}}^H,N\right)\\ {\mathcal{A}}^{H}\left(\Lambda\right)\in [a,b]}}\mathcal{N}_{\operatorname{hyb}}(\Lambda_0 , \Lambda). \] Again, the set $\mathfrak{M}_{2}(a,b)$ is a finite union of sets, which by Proposition \ref{prop:hybBound} are all bounded in $L^\infty$-norm, thus its image is also bounded in $L^\infty$-norm and the bound depends only on $a, b$ and $N$. Fix $m\in {\mathbb N}$ and take $\left(\{u_l\}_{l=1}^m,\{t_l\}_{l=1}^{m-1}\right)\in {\mathcal{M}}_{\operatorname{hyb}}^m(x,z)$. Then by definition of ${\mathcal{M}}_{\operatorname{hyb}}^m(x,z)$ there exists $l_0\in \{1,\dots, m\}$, such that $u_{l_0}=(u^-,u^+)$ is a solution to the hybrid problem \eqref{Floer} and \eqref{coupling}. By Lemma \ref{energy} we have that \[ a\leq {\mathcal{A}}^{H_0}\circ {\operatorname{ev}}^-(u^-)\leq {\mathcal{A}}^H\circ {\operatorname{ev}}^+(u^+)\leq b. \] From the above inequality we can conclude that for all $l\in \{1,\dots, l_0-1\}$ the corresponding $u_l$ is a Floer trajectory of ${\mathcal{A}}^{H_0}$, with \[ a\leq {\mathcal{A}}^{H_0}\circ {\operatorname{ev}}^-(u_l)\leq {\mathcal{A}}^{H_0}\circ {\operatorname{ev}}^+(u_l)\leq {\mathcal{A}}^{H_0}\circ {\operatorname{ev}}^-(u^-)\leq b, \] and therefore $u_l\in \mathfrak{M}_{0}(a,b)$, whereas for all $l\in \{l_0+1,\dots, m\}$ we have $u_l\in \mathfrak{M}_{1}(a,b)$ as these $u_l$ are Floer trajectories of ${\mathcal{A}}^H$ with \[ b\geq {\mathcal{A}}^H\circ {\operatorname{ev}}^+(u_l) \geq {\mathcal{A}}^H\circ {\operatorname{ev}}^-(u_l)\geq {\mathcal{A}}^H\circ {\operatorname{ev}}^+(u^+)\geq a. \] Now we consider three cases, choosing the compact set $N$ appropriately to each case: \begin{enumerate}[label=\arabic*.] \item If $0\notin [a,b]$ then none of the cascades passes through $\Sigma$; thus we can choose $N=\emptyset$ and for $u_{l_0}$ to be in $\mathfrak{M}_{2}(a,b)$. \item If $b=0$ then ${\operatorname{ev}}^+(u_m)\in \Sigma{\times}\{0\}$ and ${\operatorname{ev}}^+(u_m)\in W^s_f(z)$. In particular, ${\operatorname{ev}}^+(u_m)\in f^{-1}\big((-\infty,f(z)]\big)$. Therefore, for $b=0$ we take $N\coloneqq f^{-1}\big((-\infty,f(z)]\big)$. Due to coercivity of $f$, this $N$ is compact. That ensures ${\operatorname{ev}}^+(u_{l_0})\in \mathcal{C}\left({\mathcal{A}}^H,N\right)$ and $u_{l_0} \in \mathfrak{M}_{2}(a,b)$. \item If $0 \in [a,b)$ then take $N\coloneqq K(b)$ to be the \emph{shade} (cf.\ \cite[Sec.\ 4.1]{pasquotto2018}), i.e. \begin{align*} \widetilde{K}(b) &\coloneqq \bigcup_{\substack{\Lambda \subseteq {\operatorname{Crit}}({{\mathcal{A}}^{H}}),\\ {{\mathcal{A}}^{H}}(\Lambda)\in (0,b]}}{\operatorname{ev}}^{-}(\mathcal{M}(\Sigma\times\{0\},\Lambda)),\\ K(b) &\coloneqq f^{-1}\Big(\big(-\infty,\,{\textstyle \sup_{\tilde{K}(b)}f}\big] \Big). \end{align*} By \cite[Lem.\ 4.1]{pasquotto2018} the set $K(b)$ is a compact subset of $\Sigma{\times}\{0\}$. Moreover, if ${\operatorname{ev}}^+(u_{l_0})\in \Sigma{\times}\{0\}$, then ${\operatorname{ev}}^-(u_{l_0+1})\in \widetilde{K}(b)$ and consequently ${\operatorname{ev}}^+(u^+)=\phi^{-t_{l_0}}\circ {\operatorname{ev}}^-(u_{l_0+1})\in K(b)$. Thus taking $N\coloneqq K(b)$ ensures $u_{l_0}\in \mathfrak{M}_{2}(a,b)$. \end{enumerate} In all the above cases we have chosen $N$ to be a compact set, such that $u_{l_0}\in \mathfrak{M}_{2}(a,b)$. Consequently all elements of ${\mathcal{M}}_{\operatorname{hyb}}^m(x,z)$ are bounded in the $L^\infty$-norm and the bounds depend only on $x$ and $z$. \end{proof} \paragraph{\textit{Proof of Theorem \ref{thm:iso}:}} Let $H=H_0+H_1$ and $f$ and $f_0$ be as described at the beginning of this section. Let $CF_*(H_0,f_0)$ and $CF_*(H,f)$ be the chain complexes associated to the quadruples $(H_0,J_0,f_0,g_0)$ and $(H,J,f,g)$, respectively, as defined in Section \ref{section_setting}. Now we define the chain map $\psi \colon CF_*({\mathcal{A}}^{H_0},f_0) \to CF_*({\mathcal{A}}^H,f)$. For a given pair of points $(x,z)\in {\operatorname{Crit}}(f_0)\times {\operatorname{Crit}}(f)$ such that $\mu(x)=\mu(z)$ we find by Remark \ref{rem:Mmanifold} that ${\mathcal{M}}_{\operatorname{hyb}}(x,z)$ is a 0-dimensional manifold. It is compact by Lemma \ref{lem:compact}, and hence a finite set. Denote its parity by \begin{equation} n(x,z)\coloneqq \#_2 {\mathcal{M}}_{\operatorname{hyb}}(x,z) \in {\mathbb Z}_2. \label{n(x,z)} \end{equation} Define the homomorphism $\psi \colon CF_*(H,f)\to CF_*(H_0,f_0)$ as the linear extension of: \[ \psi(z)\coloneqq \sum_{\substack{x\in {\operatorname{Crit}}(f_0),\\ \mu(x)=\mu(z)}}n(x,z)x. \] For $\psi$ to be well defined, it has to satisfy the Novikov finiteness condition \eqref{novikov}, i.e.\ that for all $z\in {\operatorname{Crit}}(f)$ and $a\in {\mathbb R}$ holds \begin{equation}\label{Nov} \#\left\lbrace x\in {\operatorname{Crit}}(f_0)\ \big|\ n(x,z)\neq 0 \quad \textrm{and}\quad {\mathcal{A}}^{H_0}(x)\geq a\right\rbrace<+\infty. \end{equation} By Lemma \ref{energy} the condition $n(x,z)\neq 0$ implies ${\mathcal{A}}^{H_0}(x)\leq {\mathcal{A}}^H(z)$. In other words, using the notation from \eqref{CFt}, for every $t\in {\mathbb R}$ \begin{equation}\label{psiCF} \psi\left( CF^{\leq t}_*\left(H,f\right)\right)\subseteq CF^{\leq t}_*\left(H_0,f_0\right). \end{equation} On the other hand, all connected components of ${\operatorname{Crit}}({\mathcal{A}}^{H_0})$ are compact and $f_0$ is Morse, hence ${\operatorname{Crit}}(f_0)\cap \left({\mathcal{A}}^{H_0}\right)^{-1}\left([a,{\mathcal{A}}^H(z)]\right)$ is finite and \eqref{Nov} is satisfied. Lemma \ref{lem:compact} and Theorem \ref{thm-index} together with the standard gluing and compactness arguments (cf.\ \cite[Thm.\ 4.2, Thm.\ 11.1.16]{Audin2014}, \cite[Thm.\ A.11]{Frauenfelder2004}, \cite[Sec.\ 4.2]{AbbonMerry2014}) imply that $\psi$ commutes with the respective boundary operators, i.e.\ $\psi\circ\partial=\partial_0\circ\psi$, and thus induces a homomorphism \[ \Psi \colon RFH_*(H)\to RFH_*(H_0). \] Recall the short exact sequence (\ref{ActionShortExSeq}), which was induced by action filtration: \[0\rightarrow CF^0(H,f)\rightarrow CF^{\geq 0}(H,f)\rightarrow CF^+(H,f)\rightarrow 0.\] Note that there is an analogous sequence for $(H_0,f_0)$. As $\psi$ reduces action (cf.\ \eqref{psiCF}) and commutes with $\partial$ and $\partial_0$, we find that it induces maps on the filtered chain complexes which fit into the following commutative diagram of complexes: \[\xymatrix{0 \ar[r] & CF^0_\ast(H,f)\ar[d]^{\psi^0} \ar[r] & CF^{\geq0}_\ast(H,f)\ar[d] \ar[r] & CF^+_\ast(H,f)\ar[d]^{\psi^+} \ar[r] & 0\\ 0 \ar[r] & CF^0_\ast(H_0,f_0) \ar[r] & CF^{\geq0}_\ast(H_0,f_0) \ar[r] & CF^+_\ast(H_0,f_0) \ar[r] & 0.}\] By naturality (cf.\ \cite[Sec.\ 2.1]{hatcher2000}), we hence obtain the following commutative diagram of long exact sequences in homology: \[\xymatrix{ \longrightarrow H_{\ast+ n-1}(\Sigma) \ar[d]^{\Psi^0} \ar[r] & RFH^{\geq0}_\ast(H) \ar[d]\ar[r] & RFH^+_\ast(H) \ar[d]^{\Psi^+} \ar[r] & H_{\ast+n-2}(\Sigma) \ar[d]^{\Psi^0}\longrightarrow\\ \longrightarrow H_{\ast+ k-1}(\Sigma_0) \ar[r] & RFH^{\geq0}_\ast(H_0) \ar[r] & RFH^+_\ast(H_0) \ar[r] & H_{\ast+k-2}(\Sigma_0) \longrightarrow.}\] It remains to show that $\Psi^+$ is an isomorphism and that $\Psi^0 \colon H_{n+k-1}(\Sigma)\rightarrow H_{2k-1}(\Sigma_0)$ is an isomorphism and vanishes otherwise: Recall that by Lemma \ref{lem:orbits} we have a natural bijection between ${\operatorname{Crit}}^+({\mathcal{A}}^H)$ and ${\operatorname{Crit}}^+({\mathcal{A}}^{H_0})$. Moreover, we defined $f_0$ to be the pullback of $f$ under this bijection, such that their critical points are in $1$-to-$1$ correspondence, i.e.\ $(v,\eta)\in {\operatorname{Crit}}^+(f_0)$ if and only if $(\sigma^{-1}(v,0),\eta)\in {\operatorname{Crit}}^+(f)$. This correspondence allows us to represent the homomorphism $\psi^+$ as an infinite matrix with entries \[ n(x_1,i(x_2))\coloneqq \begin{cases}\#_2 {\mathcal{M}}_{\operatorname{hyb}}(x_1,i(x_2)) & \text{if }\mu(x_1)=\mu(i(x_2))\\ 0 &\text{otherwise}\end{cases} \] defined as in \eqref{n(x,z)} for $x_1,x_2\in {\operatorname{Crit}}({\mathcal{A}}^{H_0})$. In fact by \eqref{psiCF} this matrix is upper triangular. We would like to investigate its diagonal. Fix $x\in {\operatorname{Crit}}(f_0)\cap {\operatorname{Crit}}^+({\mathcal{A}}^{H_0})$. By Proposition \ref{prop:muCZ} we know that the inclusion $i \colon {\operatorname{Crit}}({\mathcal{A}}^{H_0}) \hookrightarrow {\operatorname{Crit}}({\mathcal{A}}^H)$ preserves the Conley-Zehnder index, i.e.\ $\mu_{CZ}(x)=\mu_{CZ}(i(x))$. On the other hand, since ${\operatorname{Crit}}^+({\mathcal{A}}^{H_0})$ is diffeomorphic to ${\operatorname{Crit}}^+({\mathcal{A}}^H)$ with $f_0$ being the pullback of $f$ under this diffeomorphism, we infer that $\mu_\sigma(x)=\mu_\sigma(i(x))$. Consequently, $\mu(x)=\mu(i(x))$ and $n(x, i(x))=\#_2 {\mathcal{M}}_{\operatorname{hyb}}(x,i(x)) =1$ by Remark \ref{rem:Mxz=1}. We can conclude that the matrix representing $\psi^+$ is upper triangular with $1$'s on the diagonal and therefore $\psi^+$ is an isomorphism and induces on homology level the isomorphism $\Psi^+$. For $\Psi^0$ recall from the beginning of this section, that we have four action zero critical points $\{x^\pm\}\in\Lambda^0_0\subseteq{\operatorname{Crit}}({\mathcal{A}}^{H_0})$ and $\{z^\pm\}\in\Lambda^0\subseteq {\operatorname{Crit}}({\mathcal{A}}^H)$. All four points correspond to constant orbits of constant flows. Hence their Conley-Zehnder index is zero. From the calculations of the signature indexes \eqref{morse-a} and \eqref{morse-c}, we infer that \[ \mu(z^+)= \mu(x^+)=k,\quad \mu(z^-)=-n+1,\quad \mu(x^-)=-k+1. \] Thus, we find that $n(x^+,z^+)=\#_2\mathcal{M}_{\operatorname{hyb}}(x^+,i(x^+))=1$ by Remark \ref{rem:Mxz=1} and that for any other pair $(x,z)\in \{(x^-,z^-),(x^-,z^+),(x^+,z^-)\}$ we have $n(x,z)=0$, as $\mu(x)\neq\mu(z)$. Hence, $\Psi^0_k \colon H_{n+k-1}(\Sigma)\rightarrow H_{2k-1}(\Sigma_0)$ is an isomorphism and $\Psi^0_\ast=0$ for $\ast\neq k$. Finally, recall from \eqref{umkehr} that the map $H_*( \Sigma) \to H_{*+k-n}( \Sigma_0)$ given by composing the Umkehr map of the inclusion $ j \colon \Sigma_0 \hookrightarrow \Sigma_1$ together with a retraction $r \colon \Sigma \to \Sigma_1$ is an isomorphism for $\ast= n+k-1$ and $0$ otherwise. Therefore up to a degree shift coming from the difference between the signature index grading and the Morse grading, $\Psi^0$ agrees\footnote{This can also be seen directly from definition of $ \psi^0$, using the Morse-theoretic description of the Umkehr map from \cite[App. B]{Abbon2009} or \cite[App.\ A, p1716-1717]{AbbondandoloSchwarz2010}.} with the $j_! \circ r_*$. \hfill $\square$ \begin{remark}\label{rem:Sigma-} Analogously, we can define $\Psi:RFH^-(H)\rightarrow RFH^-(H_0)$ and show that it gives an isomorphism. \end{remark} \section{The hybrid problem} In the previous section we have shown that there is a $1$-to-$1$, action and degree preserving correspondence between periodic orbits of $X_H$ on $\Sigma$ and of $X_{H_0}$ on $\Sigma_0$, which will allows us to define a chain map \[ \psi \colon CF_*(H,f)\to CF_*(H_0,f_0). \] However, to ensure that $\psi$ induces a homomorphism \[ \Psi \colon RFH_\ast(H)\to RFH_\ast(H_0), \] we need to verify that it commutes with the boundary operators, which is the subject of this section. Let $\Lambda_0\subseteq {\operatorname{Crit}}(\mathcal{A}^{H_0})$ and $\Lambda\subseteq {\operatorname{Crit}}(\mathcal{A}^{H})$ be connected components and fix $J_0\in {\mathcal J}_\star^k$ and $J \in {\mathcal J}_\star^n$, such that the pairs $(H_0,J_0)$ and $(H,J)$ are regular in the sense of Definition \ref{def:regular}. To construct $\psi$, we consider the following moduli spaces of pairs of half Floer trajectories of the Hamiltonians $H$ and $H_0$: \begin{definition} An element of $ \mathcal{M}_{\operatorname{hyb}}(\Lambda_0 , \Lambda)$ is a pair $(u_0,u)$, such that ${u_0 = (v_0, \eta_0)}$ and ${u = (v, \eta)}$ with \begin{align*} v_0 & \colon (- \infty ,0] \times S^1 \to T^*{\mathbb R}^k, && \eta_0 \colon (- \infty ,0] \to \mathbb{R},\\ v & \colon [0, \infty) \times S^1 \to T^*{\mathbb R}^n, && \eta \colon [0, \infty ) \to \mathbb{R}, \end{align*} satisfying the Rabinowitz Floer equations \begin{equation}\label{Floer} \partial_s u_0 - \nabla_{J_0} \mathcal{A}^{H_0}(u_0) = 0,\qquad \partial_s u - \nabla_{J} \mathcal{A}^{H}(u) = 0, \end{equation} together with the limit conditions \begin{equation} \lim_{s\to -\infty}u_0(s)\in \Lambda_0, \qquad \lim_{s\to +\infty}u(s)\in \Lambda, \label{limit1} \end{equation} and the coupling conditions \begin{equation} \sigma ( v(0,t)) = \big(v_0(0,t),(*,0_{n-k}) \big), \qquad \eta(0) = \eta_0(0), \label{coupling} \end{equation} where $\sigma$ is the symplectomorphism defined in \eqref{splitting}. \end{definition} Below we will analyse the moduli space $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0 , \Lambda)$. In subsection \ref{ssec:stationary} we explore what happens when $\mathcal{A}^{H}(\Lambda)=\mathcal{A}^{H_0}(\Lambda_0)$; in subsection \ref{ssec:bounds} we prove uniform $L^\infty$-bounds on the elements of $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0 , \Lambda)$ and in subsection \ref{ssec:index} we show that $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0 , \Lambda)$ has the structure of a smooth manifold. \subsection{Stationary solutions}\label{ssec:stationary} For $(u_0,u)\in \mathcal{M}_{\operatorname{hyb}}(\Lambda_0 , \Lambda)$ we define its energy as \begin{equation}\label{rem:Enabla} E(u_0,u)\coloneqq \int_{-\infty}^0\|\partial_su_0\|^2ds+\int_0^{\infty}\|\partial_su\|^2ds\geq0. \end{equation} \begin{lem} \label{energy} For $(u_0,u)\in \mathcal{M}_{\operatorname{hyb}}(\Lambda_0 , \Lambda)$, its energy satisfies \[E(u_0,u)=\mathcal{A}^{H}(\Lambda)-\mathcal{A}^{H_0}(\Lambda_0).\] In particular, if $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0 , \Lambda)\neq \emptyset$, then $\mathcal{A}^{H}(\Lambda)\geq\mathcal{A}^{H_0}(\Lambda_0)$. \end{lem} \begin{proof} At first, we have by \eqref{Floer} and \eqref{limit1} that \begin{align*} E(u_0,u) &= \int_{-\infty}^0\|\nabla_{J_0} {\mathcal{A}}^{H_0}(u_0(s))\|^2ds+\int_0^{\infty}\|\nabla_J {\mathcal{A}}^{H}(u(s))\|^2ds\\ &=\int_{-\infty}^0 \frac{d}{ds}{\mathcal{A}}^{H_0}(u_0(s)) ds + \int_0^{\infty}\frac{d}{ds}{\mathcal{A}}^{H}(u(s)) ds\\ &=\mathcal{A}^{H_0}(u_0(0))-\mathcal{A}^{H_0}(\Lambda_0)+\mathcal{A}^{H}(\Lambda)-\mathcal{A}^{H}(u(0)). \end{align*} Secondly, we have for $(v_1,\eta)\in C^{\infty}(S^1,\chi_0)\times \mathbb{R}$ that \[ \mathcal{A}^{H_1}(v_1,\eta)= \int_{S^1} \lambda(\partial_t v_1)-\eta \int_{S^1} H_1(v_1)=0. \] The first integral vanishes, as the primitive $\lambda=pdq$ of $\omega_{n-k}$ vanishes on the $0$-section $\chi_0\coloneqq {\mathbb R}^{n-k}\times\{0\}\subseteq T^*{\mathbb R}^{n-k}$. The second integral vanishes, as $H_1$ vanishes on $\chi_0$ by \ref{DefnS} of Remark \ref{H2}. Using \eqref{coupling}, we have $u(0)=(\sigma^{-1}(v_0(0),v_1(0)),\eta)$ and $u_0(0)=(v_0(0),\eta)$ with $v_1(0)\in C^\infty(S^1,\chi_0)$, and therefore we find \[ \mathcal{A}^{H}(u(0)) = \mathcal{A}^{H_0}(u_0(0))\qquad\Longrightarrow\qquad E(u_0,u)=\mathcal{A}^{H}(\Lambda)-\mathcal{A}^{H_0}(\Lambda_0).\qedhere \] \end{proof} We formulate the next lemma using the notation from \eqref{LambdaEta}: \begin{lem}\label{lem:stationary} For $\eta \in \operatorname{CritVal}({\mathcal{A}}^{H_0})= \operatorname{CritVal}({\mathcal{A}}^H)$, $\eta\neq 0$ the moduli space $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0^\eta , \Lambda^\eta)$ consists of stationary solutions, of the form \begin{equation*}\begin{aligned} u_0(s,t) &\coloneqq (v(t), \eta), && \forall\ (s,t)\in (-\infty, 0]\times S^1,\\ u(s,t) & \coloneqq (\sigma^{-1}(v(t), 0), \eta), && \forall\ (s,t)\in [0,+\infty)\times S^1, \end{aligned} \qquad \text{where }(v,\eta)\in \Lambda_0^\eta. \end{equation*} For $\eta=0$, $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0^0 , \Lambda^0)$ consists of stationary solutions of the form \begin{equation*}\begin{aligned} u_0(s,t) & \coloneqq (x, 0), && \forall\ (s,t)\in (-\infty, 0]\times S^1,\\ u(s,t) & \coloneqq (\sigma^{-1}(x,y), 0), && \forall\ (s,t)\in [0,+\infty)\times S^1, \end{aligned} \qquad \text{where } (x,y)\in \Sigma_0 \times \chi_0. \end{equation*} \end{lem} \begin{proof} If $\mathcal{A}^{H}(\Lambda)=\mathcal{A}^{H_0}(\Lambda_0)$, then $E(u_0,u)=0$ by Lemma \ref{energy} for every $(u_0,u)\in\mathcal{M}_{\operatorname{hyb}}(\Lambda_0 , \Lambda)$. As a result $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0 , \Lambda)$ consists of stationary solutions of the form \begin{align*} u_0(s,t) & \coloneqq (v_0(t), \eta), && \forall\ (s,t)\in (-\infty, 0]\times S^1,\\ u(s,t) & \coloneqq (\sigma^{-1}(v_0(t), v_1(t)), \eta), && \forall\ (s,t)\in [0,+\infty)\times S^1, \end{align*} where by \eqref{limit1} and \eqref{coupling} it holds \[ (v_0,\eta) \in \Lambda_0, \qquad (\sigma^{-1}(v_0,v_1),\eta)\in \Lambda, \qquad v_1(t)\in \chi_0 \qquad \forall\ t\in S^1. \] On the other hand, by Lemma \ref{lem:orbits} we know that if $\mathcal{A}^{H}(\Lambda)=\mathcal{A}^{H_0}(\Lambda_0) \neq 0$, then \[ \Lambda= \left\lbrace (\sigma^{-1}(v_0,0),\eta)\ \big|\ (v_0,\eta)\in \Lambda_0\right\rbrace. \] Combining the two facts above proves the first claim. Similarly, we obtain the second claim by observing that $\Sigma_0\times \chi_0\subseteq \Sigma_0\times H^{-1}_1(0)\subseteq \sigma(\Sigma)$. \end{proof} \subsection{The Index Computation}\label{ssec:index} Fix two connected components of the respective critical sets $\Lambda_0 \subseteq {\operatorname{Crit}} (\mathcal{A}^{H_0})$ and $\Lambda \subseteq \operatorname{Crit}( \mathcal{A}^H)$. In this section we establish that the hybrid moduli problem is Fredholm, and compute the virtual dimension of the the moduli space $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0 , \Lambda)$. Let us introduce an anti-symplectic involution on $(T^*{\mathbb R}^k,\omega_k)$ by \begin{equation} \rho \colon T^*{\mathbb R}^k \to T^*{\mathbb R}^k, \qquad (q,p) \mapsto (q,-p). \label{rho} \end{equation} The standard symplectic structure $\mathbb{J}_k$ satisfies \begin{equation}\label{JnRho} - D\rho \circ \mathbb{J}_k \circ D\rho =\mathbb{J}_k. \end{equation} Therefore, we have the associated diffeomorphism: \[ \mathcal{J}_\star^k \ni J \mapsto -D\rho \circ J \circ D\rho \in \mathcal{J}_\star^k. \] Finally, observe that $H_0\circ \rho = H_0$, which gives us \begin{equation} \label{XH0Rho} X_{H_0}(x)= - D\rho[X_{H_0}(\rho (x))]. \end{equation} As a result we obtain an automorphism of $\operatorname{Crit} (\mathcal{A}^{H_0})$ defined by: \begin{equation}\label{Lambda0map} \operatorname{Crit} (\mathcal{A}^{H_0}) \ni (v,\eta) \longmapsto (\rho \circ v, -\eta)\in \operatorname{Crit} (\mathcal{A}^{H_0}). \end{equation} Using the notation from \eqref{LambdaEta}, this automorphism maps $\Lambda_0^\eta$ to $\Lambda_0^{-\eta}$. \begin{theorem} \label{thm-index} The hybrid moduli problem is Fredholm, and the space $ \mathcal{M}_{\operatorname{hyb}}(\Lambda_{0} , \Lambda)$ has virtual dimension \[ \operatorname{vir\,dim} \mathcal{M}_{\operatorname{hyb}}(\Lambda_{0} , \Lambda) = \mu^{\operatorname{tr}}_{\operatorname{CZ}}(\Lambda) - \mu^{\operatorname{tr}}_{\operatorname{CZ}}(\Lambda_0) + \frac{1}{2} \left( \dim \Lambda_0 + \dim \Lambda\right). \] \end{theorem} \begin{proof} We prove the theorem in five steps.\\ \paragraph{\textbf{1.}} Denote by $\mathfrak{y}\coloneqq {\mathcal{A}}^{H_0}(\Lambda_0) \in \operatorname{CritVal}({\mathcal{A}}^{H_0})$, so that by Corollary \ref{cor:CritVal} we have $\Lambda_0=\Lambda_0^{\mathfrak{y}}$. In this first step, we show that $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0^{\mathfrak{y}} , \Lambda)$ is a Fredholm problem. We begin by identifying $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0^{\mathfrak{y}} , \Lambda)$ with a closely related set\footnote{The fact that ``hyb'' is occurs both as a subscript and a superscript is not a typo! They represent formally different spaces.} $\mathcal{M}^{\operatorname{hyb}}(\Lambda_0^{-\mathfrak{y}} , \Lambda)$ defined as follows: Let $L \subseteq T^*{\mathbb R}^k\times T^*{\mathbb R}^n= {\mathbb R}^{2(n+k)}$ denote the set of elements of the form \[ L = \left\{ (a,-b,a,b,c,0_{n-k})\ \Big|\ a,b \in {\mathbb R}^k, c \in \mathbb{R}^{n-k} \right\}. \] In other words, $L$ is the preimage of $\Delta_{T^*{\mathbb R}^k}\times \chi_0$ under $\rho \oplus \sigma^{-1}$, where $\rho$ is the anti-symplectic map defined in \eqref{rho}, $ \sigma$ is the symplectic splitting defined in \eqref{splitting}, $\Delta_{T^*{\mathbb R}^k}$ stands for the diagonal in $(T^*{\mathbb R}^k)^2$ and $\chi_0$ is the $0$-section of $T^*{\mathbb R}^{n-k}$. Then $L$ is a Lagrangian submanifold of $(T^*{\mathbb R}^k\times T^*{\mathbb R}^n,\omega_k\oplus \omega_n)$. For $J_0\in \mathcal{J}_\star^k, J \in \mathcal{J}_\star^n$ we define, using \eqref{JnRho}, an element $\widehat{J}\in \mathcal{J}_\star^{n+k}$ by \begin{equation}\label{J1} \widehat{J} \coloneqq \begin{pmatrix} -D\rho \circ J_0 \circ D\rho & \\ & \;J \end{pmatrix}. \end{equation} An element of $\mathcal{M}^{\operatorname{hyb}}(\Lambda_0^{-\mathfrak{y}} , \Lambda)$ is a pair $(w,\xi)$ with \begin{equation}\label{eq-w-first} w \colon [0,+\infty) \times S^1 \to T^*{\mathbb R}^k\times T^*{\mathbb R}^n, \qquad \xi \colon [0,+\infty) \to {\mathbb R}^2, \end{equation} satisfying the equations \begin{align} \partial_s w + \widehat{J}\partial_t w - \xi \cdot X_1 (w)& = 0, \label{eq-w-third}\\ \partial_s \xi -X_2(w)& = 0, \label{eq-xi-1st} \end{align} where \begin{align} (\xi_0,\xi_1) \cdot X_1(w_0,w_1) & \coloneqq \widehat{J}\begin{pmatrix} \xi_0 X_{H_0}(w_0) \\ \xi_1 X_H(w_1) \end{pmatrix}, \label{eq-w-fourth}\\ X_2(w) & \coloneqq \begin{pmatrix} -\int_{S^1}H_0(w_0) \\ -\int_{S^1} H (w_1)\end{pmatrix}, \label{eq-xi-2nd} \end{align} together with the limit conditions \begin{equation} \lim_{s\to + \infty}w(s)\in \Lambda_0^{-\mathfrak{y}}\times \Lambda, \label{limit2} \end{equation} and the coupling conditions \begin{equation} w(0,t) \in L, \qquad \forall \,t \in S^1,\qquad \textrm{and} \qquad \xi_1(0)=-\xi_0(0).\label{eq-w-second} \end{equation} There is a natural identification of elements $((v_0,\eta_0),(v,\eta))\in\mathcal{M}_{\operatorname{hyb}}(\Lambda_0^{\mathfrak{y}} , \Lambda)$ with elements $(w,\xi)\in\mathcal{M}^{\operatorname{hyb}}(\Lambda_0^{-\mathfrak{y}} , \Lambda)$ given by \begin{equation}\label{bijection} w(s,t)\coloneqq \begin{pmatrix} \rho \circ v_0(-s,t) \\ v(s,t) \end{pmatrix}, \qquad \xi(s)\coloneqq \begin{pmatrix} -\eta_0(-s)\\ \eta(s) \end{pmatrix}. \end{equation} Indeed, under this identification conditions \eqref{limit1} and \eqref{coupling} become conditions \eqref{limit2} and \eqref{eq-w-second}. Furthermore, we compute that \[ \partial_s w = \begin{pmatrix} - D \rho [\partial_s v_0] \\ \partial_s v \\ \end{pmatrix}, \qquad \partial_t w = \begin{pmatrix} D\rho [\partial_t v_0 ]\\ \partial_t v \\ \end{pmatrix}, \qquad \partial_s \xi = \begin{pmatrix} \partial_s \eta_0 \\ \partial_s \eta \\ \end{pmatrix}. \] so that by \eqref{JnRho}, \eqref{XH0Rho}, \eqref{J1}, and \eqref{bijection} we have \begin{align*} \partial_s w + \widehat{J}\partial_t w & = \begin{pmatrix} -D\rho (\partial_s v_0+J_0 \partial_t v_0) \\ \partial_s v+ J \partial_t v \end{pmatrix} =\begin{pmatrix} -\eta_0 D\rho \circ J_0 X_{H_0}(v_0) \\ \eta J X_H (v) \end{pmatrix}\\ & = \begin{pmatrix} \eta_0 D\rho \circ J_0 \circ D\rho [X_{H_0}(w_0)] \\ \eta J X_H (w_1) \end{pmatrix} = \widehat{J}\begin{pmatrix} \xi_0 X_{H_0}(w_0) \\ \xi_1 X_H(w_1) \end{pmatrix}. \end{align*} In this way the Rabinowitz Floer equations \eqref{Floer} become equivalent to \eqref{eq-w-third}--\eqref{eq-xi-2nd}. So $ \mathcal{M}_{\operatorname{hyb}}(\Lambda_0^{\mathfrak{y}} , \Lambda)$ is a Fredholm problem if and only if $\mathcal{M}^{\operatorname{hyb}}(\Lambda_0^{-\mathfrak{y}} , \Lambda)$ is a Fredholm problem. Fix $r >2$. Let $\mathcal{B}(\Lambda_0^{-\mathfrak{y}},\Lambda)$ denote the Banach manifold of pairs $(w,\xi)$ as in \eqref{eq-w-first} satisfying \eqref{limit2} and \eqref{eq-w-second}. For $(w,\xi)\in \mathcal{B}(\Lambda_0^{-\mathfrak{y}},\Lambda)$, we do not require equations \eqref{eq-w-third}--\eqref{eq-xi-2nd} to hold. Instead, $(w,\xi)$ should be locally of class $W^{1,r}$ and converge for $s\rightarrow +\infty$ exponentially to an element $(x_0,x_1) \in \Lambda_0^{-\mathfrak{y}}\times\Lambda$. The tangent space of $\mathcal{B}(\Lambda_0^{-\mathfrak{y}},\Lambda)$ at $(w,\xi)$ can be identified with \begin{align*} T_{(w,\xi)} \mathcal{B}(\Lambda_0^{-\mathfrak{y}},\Lambda)&\cong \mathcal{W}^{1,r}_{\delta,L}\oplus \mathcal{W}^{1,r}_{\delta,\Delta}\oplus T_{ x_0}\Lambda_0\oplus T_{x_1}\Lambda,\\ \text{where }\qquad\qquad\mathcal{W}^{1,r}_{\delta,L} & \coloneqq \left\lbrace z \in W^{1,r}_{\delta} \left([0, \infty) \times S^1 , \mathbb{R}^{2k} \times \mathbb{R}^{2n} \right) \ \Big|\ z(0,t) \in L \right\rbrace,\\ \mathcal{W}^{1,r}_{\delta,\Delta} & \coloneqq \left\lbrace \zeta \in W^{1,r}_{\delta}\left([0,\infty), \mathbb{R}^2\right) \ \Big|\ \zeta_1(0)=-\zeta_0(0) \right\rbrace. \end{align*} Here, $\delta$ indicates that we are working with weighted Sobolev spaces with weight $\gamma(s)=e^{\delta s}$ (as our asymptotic operators will not be bijective). Explicitly, $f\in \mathcal{W}^{1,r}_\delta$ if and only if $f\cdot \gamma\in \mathcal{W}^{1,r}$. Let $\mathcal{E}$ be the Banach bundle over $\mathcal{B}(\Lambda_0^{-\mathfrak{y}},\Lambda)$ whose fiber at $(w,\xi)$ is given by \[\mathcal{E}_{(w,\xi)}\coloneqq L^r_{\delta}\left( [0,\infty) \times S^1, \mathbb{R}^{2k} \times \mathbb{R}^{2n} \right) \times L^r_{ \delta}\left([0,\infty), \mathbb{R}^2\right).\] Define a section \begin{equation} \bar{\partial} \colon \mathcal{B}(\Lambda_0^{-\mathfrak{y}},\Lambda)\to \mathcal{E}, \label{eq:Banach-sec} \end{equation} by the left-hand side of the equations \eqref{eq-w-third} and \eqref{eq-xi-1st}. Then $\mathcal{M}^{\operatorname{hyb}}(\Lambda_0^{-\mathfrak{y}} ; \Lambda)=\bar{\partial}^{-1}(0)$. Since \eqref{eq-w-second} is a Lagrangian boundary condition and \eqref{eq-w-third} is a perturbed Cauchy-Riemann equation on a half-cylinder, coupled with a pair of ordinary differential equations \eqref{eq-xi-1st} for $\xi$, the proof that the linearisation \[ D\bar{\partial} \colon T_{(w,\xi)}\mathcal{B}(\Lambda_0^{-\mathfrak{y}},\Lambda)\to \mathcal{E}_{(w,\xi)}, \] is a Fredholm operator is a routine argument (see for instance \cite[Sec. 5.4]{AbbondandoloSchwarz2010}), and we will not go over the details here. \\ \paragraph{\textbf{2.}} Computing the index however is somewhat less standard, for two reasons: \begin{enumerate}[label=(\roman*)] \item In contrast to standard index computations in Rabinowitz Floer homology, here there are two Lagrange multipliers to worry about. \item We are on a half cylinder, and thus arguments using the spectral flow are not directly applicable. \end{enumerate} This computation is very similar to \cite[Theorem 4.12]{AbbonMerry2014}. In order to keep the exposition reasonably clean, we perform the calculation only in the case where both $ \mathcal{A}^{H_0}(\Lambda_0^{-\mathfrak{y}})$ and $ \mathcal{A}^H(\Lambda)$ are non-zero. The other cases are easier and are left to the reader. In this step, we formulate an appropriate local model for the problem $ \mathcal{M}^{\operatorname{hyb}}(\Lambda_0^{-\mathfrak{y}} , \Lambda)$ by linearising equations \eqref{eq-w-third}--\eqref{eq-xi-2nd} at a solution $(w,\xi) \in \mathcal{M}^{\operatorname{hyb}}(\Lambda_0^{-\mathfrak{y}} , \Lambda)$, and express the virtual dimension of $\mathcal{M}^{\operatorname{hyb}}(\Lambda_0^{-\mathfrak{y}} , \Lambda)$ in terms of the index of this linearised operator. Write $m_0\coloneqq k, m_1\coloneqq n$ and let \[ P_i \in W^{1, \infty}\left( [0,+\infty) \times S^1 , \operatorname{Mat}(2m_i)\right), \] for $i=0,1$ denote two paths of matrices that extend to the compactification $[0, +\infty] \times S^1$ in such a way that for each $i=0,1$ \[ \lim_{s_0 \rightarrow + \infty}\underset{(s,t)\in[s_0,\infty )\times S^1} {\operatorname{ess\, sup}}\Big(\left|\partial_s P_i(s,t)\right|+\left|\partial_t P_i(s,t)-\partial_t P_i(t,\infty)\right|\Big)=0. \] Assume in addition that the limit matrices $S_i(t) \coloneqq P_i(+ \infty, t)$ are symmetric: \begin{equation} \label{eq-limit-S} S_0(t) \in \operatorname{Sym}( \mathbb{R}^{2k}), \qquad S_1(t) \in \operatorname{Sym}( \mathbb{R}^{2n}). \end{equation} Next, for $i=0,1$ let \[ \beta_i \in W^{1, \infty}( [0,\infty) \times S^1 , \mathbb{R}^{2m_i}),\\ \] denote two vector-valued paths which extend to the compactification $[0,+\infty] \times S^1$ in such a way that for each $i = 0,1$, \[ \lim_{s_0 \rightarrow + \infty}\underset{(s,t)\in (s_0,\infty)\times S^1} {\operatorname{ess\,sup}}\Big(\left|\partial_{s}\beta_i(s,t)\right|+\left|\partial_{t}\beta_i(s,t)-\partial_{t}\beta_i(t,+\infty)\right|\Big)=0. \] Abbreviate $b_i(t) \coloneqq \beta_i(+\infty,t)$, and assume that \[ b_i \in W^{1,2}(S^1, \mathbb{R}^{2m_i}) \cap \operatorname{range}(\mathbb{J}_{m_i}\partial_t +S_i), \qquad i = 0,1. \] We are now ready to introduce an appropriate local model. Consider the operator $\mathbf{D} \colon \mathcal{W}^{1,r}_{ \delta, L} \times \mathcal{W}^{1,r}_{\delta,\Delta} \to \mathcal{E}$ defined by\footnote{We somewhat ambiguously switch between row and column notation, favouring whichever is cleaner for any given equation.} \begin{equation}\label{eq-D} \mathbf{D} \begin{pmatrix} z_0 \\ z_1 \\ \zeta_0 \\ \zeta_1 \end{pmatrix} \coloneqq \begin{pmatrix} \partial_s z_0 + \mathbb{J}_k \partial_t z_0 + P_0 z_0 + \zeta_0 \beta_0 \\ \partial_s z_1 + \mathbb{J}_n \partial_t z_1 + P_1 z_1 + \zeta_1 \beta_1 \\ \zeta_0' + \int_{S^1} \langle z_0, \beta_0 \rangle \,dt\\ \zeta_1' + \int_{S^1} \langle z_1, \beta_1 \rangle \,dt \end{pmatrix} \end{equation} Note that $\mathbf{D}$ is the restriction to $\mathcal{W}^{1,r}_{\delta,L}\oplus\mathcal{W}^{1,r}_{\delta,\Delta}$ of the linearisation $D\bar{\partial}$ of the problem \eqref{eq:Banach-sec} at a solution $(w, \xi)\in\mathcal{M}^{\operatorname{hyb}}(\Lambda_0^{-\mathfrak{y}} ; \Lambda)$ of \eqref{eq-w-third}--\eqref{eq-xi-2nd}, when viewed in a suitable symplectic trivialisation. Explicitly, for $H=H_0+H_1$ satisfying \eqref{defH} we have \begin{align} S_0 & = -\eta_0 \mathbb{J}_k D_{v_0}X_{H_0}, && b_0 (t) = -\mathbb{J}_k [ X_{H_0}] (v_0(t)),\label{Sb0}\\ S_1 & = -\eta \mathbb{J}_n D_v X_H, && b_1(t) = - \mathbb{J}_n [X_H] (v(t)),\label{Sb1} \end{align} for some $(v_0,\eta_0)\in \Lambda_0^{-\mathfrak{y}}, (v,\eta)\in \Lambda$. Consequently, we have \begin{equation}\label{dimM} \operatorname{vir\,dim} \mathcal{M}^{\operatorname{hyb}}(\Lambda_0^{-\mathfrak{y}} , \Lambda) = \operatorname{ind} D\bar{\partial}= \operatorname{ind} \mathbf{D} + \dim \Lambda_0 + \dim \Lambda. \end{equation} $\ $ \paragraph{\textbf{3.}} Our aim is to homotope the operator $\mathbf{D}$ from \eqref{eq-D} through Fredholm operators into a new operator of product form \begin{equation}\label{Dnew} \mathbf{D}^{\operatorname{new}} (z, \zeta) = \left( \mathbf{D}_1(z), \mathbf{D}_2( \zeta) \right). \end{equation} The operator $\mathbf{D}^{\operatorname{new}}$ decouples the perturbed Cauchy-Riemann equation satisfied by $z$ and the ordinary differential equation satisfied by $ \zeta$. This will allow us to compute the index of $\mathbf{D}$: \begin{align} \operatorname{ind} \mathbf{D}& = \operatorname{ind} \mathbf{D}^{\operatorname{new}} & &\text{since the index is constant along deformations,} \nonumber \\ & = \operatorname{ind} \mathbf{D}_1 + \operatorname{ind}\mathbf{D}_2 & & \text{by additivity.} \label{eq-index-sum} \end{align} The operator $\mathbf{D}^{\operatorname{new}}$ is constructed using methods from \cite[App.\ C]{CieliebakFrauenfelder2009}. The index of $ \mathbf{D}_1$ can be computed using the methods from \cite{AbbondandoloSchwarz2010}. Meanwhile the index of $ \mathbf{D}_2$ can be computed by hand. In order to construct the homotopy we first need to compute the perturbation term defined in \cite[Def.\ C.3]{CieliebakFrauenfelder2009} as follows: for $i=0,1$ and $\delta>0$ choose $z_i \in W^{1,2}(S^1, \mathbb{R}^{2m_i})$ such that \begin{equation}\label{Av=b} (\mathbb{J}_{m_i}\partial_t +S_i+\delta \operatorname{Id})z_i = b_i, \end{equation} and define \begin{equation} \label{tau1} \tau_i \coloneqq \int_{S^1} \langle z_i(t), b_i(t) \rangle \,dt. \end{equation} Since the operator $\mathbb{J}_{m_i}\partial_t +S_i$ is self-adjoint, the number $\tau_i$ does not depend on the choice of $z_i$. We will show that in our setting, for $\delta>0$ small enough \begin{equation}\label{tau2} \tau_0, \tau_1>0. \end{equation} First observe, that by Lemma \ref{lem:orbits} every periodic orbit $(v,\eta)\in {\operatorname{Crit}}({\mathcal{A}}^H), \eta\neq 0$ is of the form $( \sigma^{-1}(v_1,0),\eta)$ with $(v_1,\eta)\in {\operatorname{Crit}}({\mathcal{A}}^{H_0})$. As a result \[ dH(v)=dH \circ \sigma^{-1} (v_1,0)=dH_0(v_1). \] Therefore, if $(z_0,z)$ is a solution to \eqref{Av=b} and $ (z_1,z_2) \coloneqq \sigma(z) \in W^{1,2}(S^1,T^*{\mathbb R}^k)\times W^{1,2}(S^1,T^*{\mathbb R}^{n-k})$, then by \eqref{Sb1} we get \[ \tau_1 = \int_{S^1}d_v H (z)\,dt =\int_{S^1}d_{v_1}H_0 (z_1)\,dt. \] Therefore, without loss of generality we can assume that $z_2=0$. Consequently, by \eqref{CritEta}, \eqref{Sb0} and \eqref{Sb1}, equation \eqref{Av=b} translates to \begin{equation}\label{Av=b2} (\mathbb{J}_k\partial_t +\eta_i A_0 +\delta \operatorname{Id})z_i = A_0 \exp[t \eta_i \mathbb{J}_k A_0] v_i(0), \end{equation} where $(v_0,\eta_0)\in \Lambda_0^{-\mathfrak{y}}, ( \sigma^{-1}(v_1,0),\eta_1)\in \Lambda \subseteq {\operatorname{Crit}} ({\mathcal{A}}^H)$. It is easy to check that \[ z_i(t)\coloneqq \frac{1}{\delta} A_0 \exp[t \eta_i \mathbb{J}_k A_0] v_i(0), \] solves \eqref{Av=b2} and as a result for $i=0,1$ we have \[ \tau_i = \frac{1}{\delta}\int_{S^1} \left\|A_0 \exp[t \eta_i \mathbb{J}_k A_0] v_i(0)\right\|^2dt>0, \] which proves \eqref{tau2}.\\ \paragraph{\textbf{4.}} In this step we will construct the homotopy between the operator $\mathbf{D}$ from \eqref{eq-D} and a new operator $\mathbf{D}^{\operatorname{new}}$ of the form as in \eqref{Dnew}. If we set \[ Q = \begin{pmatrix} \mathbb{J}_k \partial_t + P_0 & \\ & \mathbb{J}_n \partial_t + P_1 \end{pmatrix}, \qquad \beta = \begin{pmatrix} \beta_0 \\ \beta_1 \end{pmatrix}, \qquad B \begin{pmatrix} z_0 \\ z_1 \end{pmatrix} = \begin{pmatrix} \int_{S^1} \langle z_0, \beta_0 \rangle \,dt\\ \int_{S^1} \langle z_1, \beta_1 \rangle \,dt \end{pmatrix}, \] then the operator $ \mathbf{D}$ can be written as \[ \mathbf{D} = \partial_s + \begin{pmatrix} Q & \beta \\ B & 0 \end{pmatrix}. \] We now consider the homotopy $\{ \mathbf{D}^{\theta }\}_{ \theta \in [0,1]}$ of operators given by \[ \mathbf{D}^{\theta} = \partial_s + \begin{pmatrix} Q & (1 - \theta) \beta \\ (1 - \theta) B & c( \theta) \end{pmatrix}, \] where $c \colon [0, 1] \to \mathbb{R}^2$ is defined by \begin{equation} \label{eq-c} c( \theta) \coloneqq \begin{pmatrix} \theta \tau_0 \\ \theta \tau_1 \end{pmatrix}. \end{equation} By \cite[Thm. C.5]{CieliebakFrauenfelder2009} the operators $\mathbf{D}^{\theta}$ are all Fredholm of the same index. We define \begin{align*} \mathbf{D}^{\operatorname{new}} & \coloneqq \mathbf{D}^1=(\mathbf{D}_1,\mathbf{D}_2), & & \textrm{where} \\ \mathbf{D}_1 & \colon \mathcal{W}^{1,r}_{\delta, L} \to L^r_{\delta} \left( [0,\infty) \times S^1, \mathbb{R}^{2n+2k}\right), & z & \mapsto \partial_s z + Q z,\\ \mathbf{D}_2 & \colon \mathcal{W}^{1,r}_{\delta, \Delta} \to L^r_{ \delta} \left( [0,\infty), \mathbb{R}^2\right), & \begin{pmatrix} \zeta_0 \\ \zeta_1 \end{pmatrix} &\mapsto \begin{pmatrix} \zeta_0' + \tau_0 \zeta_0 \\ \zeta_1' + \tau_1\zeta_1 \end{pmatrix} . \end{align*} \paragraph{\textbf{5.}} In this final step we compute the index of $ \mathbf{D}_1$ and $ \mathbf{D}_2$. For this denote by $ \Psi_i$ for $i=0,1$ the following paths of symplectic matrices: \begin{align*} \Psi_0 & \colon [0,1] \to \operatorname{Symp}( \mathbb{R}^{2k}, \omega_k), && \begin{cases} \Psi'_0(t) = \mathbb{J}_k S_0(t) \Psi_0(t),\\ \Psi_0(0) = \operatorname{Id}_{2k}, \end{cases} \\ \Psi_1 & \colon [0,1] \to \operatorname{Symp}( \mathbb{R}^{2n}, \omega_n), && \begin{cases} \Psi'_1(t) = \mathbb{J}_n S_1(t) \Psi_1(t),\\ \Psi_1(0) = \operatorname{Id}_{2n}, \end{cases} \end{align*} Denote by $\mu_{\operatorname{CZ}}(\Psi_i) \in \frac{1}{2} \mathbb{Z}$ the (full) Conley-Zehnder index of these paths, and let $ \operatorname{null}( \Psi_i) \coloneqq \dim \left( \ker \Psi_i(1) - \operatorname{Id} \right) $ denote the nullity. Then the Fredholm index of $\mathbf{D}_1$ is given by \cite[Theorem 5.25]{AbbondandoloSchwarz2010} as \begin{equation} \label{eq-index-D1} \operatorname{ind} \mathbf{D}_1 = \sum_{i=0}^1 \left( \mu_{\operatorname{CZ}}(\Psi_i) - \frac{1}{2}\operatorname{null}(\Psi_i) \right)+m(L), \end{equation} where $m(L)$ stands for the correction term coming from the boundary conditions. Actually \eqref{eq-index-D1} is much simpler than the general statement in \cite[Thm. 5.25]{AbbondandoloSchwarz2010}, since we only have a single boundary condition (rather than a set of jumping boundary conditions). The correction term $m(L)$ is computed by \cite[Thm. 5.25]{AbbondandoloSchwarz2010} to be \[ m(L)\coloneqq \frac{\dim T^*{\mathbb R}^{n+k}}{2} -\frac{1}{2}\dim \Delta_{T^*{\mathbb R}^{n+k}} - \dim L\\ + \dim \left(\Delta_{T^*{\mathbb R}^{n+k}}\cap(L\times L) \right), \] where $\Delta_{T^*{\mathbb R}^{n+k}}$ is the diagonal in $(T^*{\mathbb R}^{n+k})^2$. In this case, \begin{align*} \dim \Delta_{T^*{\mathbb R}^{n+k}} & =2(n+k), \\ \dim \left(\Delta_{T^*{\mathbb R}^{n+k}}\cap(L\times L) \right) & =\dim L=n+k, \end{align*} hence\footnote{Sanity check: The same computation works for any Lagrangian $L$. Thus the correction term is always $0$ when there is but a single Lagrangian boundary condition. This can also be proved directly, without appealing to the machinery of \cite{AbbondandoloSchwarz2010}.} $m(L)=0$. On the other hand, by Proposition \ref{prop:muCZ} we have \begin{align*} \mu_{\operatorname{CZ}}(\Psi_0) & =\mu_{\operatorname{CZ}}(\Lambda_0^{-\mathfrak{y}})= - \mu_{\operatorname{CZ}}(\Lambda_0^\mathfrak{y})=-\mu^{\operatorname{tr}}_{\operatorname{CZ}}(\Lambda_0),\\ \mu_{\operatorname{CZ}}(\Psi_1) & = \mu_{\operatorname{CZ}}(\Lambda)= \mu^{\operatorname{tr}}_{\operatorname{CZ}}(\Lambda). \end{align*} Moreover, by Lemma \ref{lem:orbits} and \eqref{CritEta} we have \begin{align*} \dim \Lambda_0 & = \dim \Lambda_0^{-\mathfrak{y}}= \dim \left( \ker \left(\Psi_0(1) - \operatorname{Id}\right) \cap \Sigma_0\right) =\operatorname{null}( \Psi_0)-1,\\ \dim \Lambda & = \dim \left(\ker \left( \Psi_1(1) - \operatorname{Id}\right) \cap \left(\Sigma_0\times \{0\}\right)\right) =\operatorname{null}( \Psi_1)-1, \end{align*} which gives \begin{equation}\label{D1} \operatorname{ind} \mathbf{D}_1 = \mu^{\operatorname{tr}}_{\operatorname{CZ}}(\Lambda) - \mu^{\operatorname{tr}}_{\operatorname{CZ}}(\Lambda_0) -\frac{1}{2}\left( \dim \Lambda_0 + \dim \Lambda \right)-1. \end{equation} Now we would like to compute $\operatorname{ind} \mathbf{D}_2$. Note that \[ \operatorname{ind} \mathbf{D}_2 = 2 \operatorname{ind} \widetilde{\mathbf{D}}_2- 1, \] where the $-1$ comes from the boundary condition $\zeta_1(0)=-\zeta_0(0)$ and $\widetilde{\mathbf{D}}_2$ is an operator of the form \begin{gather*} \widetilde{\mathbf{D}}_2 \colon W^{1,r}_{\delta}\left([0,+\infty), {\mathbb R}\right) \to L^r_{ \delta}\left([0,+\infty), {\mathbb R}\right),\\ f \mapsto f'+\tau f. \end{gather*} Note that $\dim \operatorname{coker} \widetilde{\mathbf{D}}_2 =0$. However, since we are working with weighted Sobolev spaces on a positive half-cylinder, the dimension of $\ker \widetilde{\mathbf{D}}_2=1$, since in both cases $\tau>0$ by \eqref{tau1}. Consequently, $\operatorname{ind} \mathbf{D}_2 = 1$. Combining this with \eqref{dimM} and \eqref{D1} we have \begin{align*} \operatorname{vir\,dim} \mathcal{M}_{\operatorname{hyb}}(\Lambda_0 , \Lambda) & = \operatorname{ind} \mathbf{D}^{\operatorname{new}} + \dim \Lambda_0 + \dim \Lambda \\ & = \mu^{\operatorname{tr}}_{\operatorname{CZ}}(\Lambda) - \mu^{\operatorname{tr}}_{\operatorname{CZ}}(\Lambda_0) + \frac{1}{2} \left( \dim \Lambda_0 + \dim \Lambda\right). \end{align*} This completes the proof of Theorem \ref{thm-index}. \end{proof} \section{Introduction} Rabinowitz Floer homology is a homology theory for exact contact hypersurfaces in symplectic manifolds. It has various applications in symplectic and contact geometry: it provides obstructions for exact embeddings of contact manifolds, it can be used to distinguish contact structures, and it gives qualitative information on the Reeb flow on a contact manifold. Rabinowitz Floer homology was originally defined by Cieliebak and Frauenfelder in \cite{CieliebakFrauenfelder2009} for compact contact type hypersurfaces of exact convex symplectic manifolds, and has since been extended to cover more general compact hypersurfaces in more general symplectic manifolds. These include certain stable Hamiltonian structures \cite{CieliebakFrauenfelderPaternain2010}, negative line bundles \cite{AlbersKang2016}, and symplectisations of hypertight contact manifolds \cite{AlbersFuchsMerry2015}. In a different direction, and more relevantly for the present article, the third author constructed in her PhD thesis \cite{Wisniewska2017} a class of so-called \textit{tentacular} Hamiltonians on $ \mathbb{R}^{2n}$ with \textit{non-compact} level sets for which Rabinowitz Floer homology is well defined. In the compact case, Rabinowitz Floer homology is eminently computable. For example, Rabinowitz Floer homology has been completely computed for unit cotangent bundles \cite{CieliebakFrauenfelderOancea2010,Abbon2009}, magnetic cotangent bundles \cite{Merry2011a}, Brieskorn spheres \cite{Fauck2015}, negative line bundles and certain annulus subbundles thereof \cite{AlbersKang2016,Venkatesh}. Many of these computations either rely on -- or can alternatively be proved by -- the intimate relationship of Rabinowitz Floer homology with symplectic homology \cite{CieliebakFrauenfelderOancea2010,CieliebakOancea2018}. The non-compact case is rather less tractable. In \cite{pasquotto2017,pasquotto2018} the class of non-compact hypersurfaces for which the Rabinowitz Floer homology could be defined was extended, and a rather general invariance result was proved. However no explicit computations were presented. The goal of the present article is to remedy this deficit, by providing a complete calculation of the Rabinowitz Floer homology for a class of (deformations of) symplectic hyperboloids. As a byproduct, using the aforementioned invariance result we establish the validity of the Weinstein Conjecture for all such non-compact hypersurfaces. Here are the details. Consider a quadratic Hamiltonian $H$ on $T^*\mathbb{R}^n$ of the form $H(z)\coloneqq \frac{1}{2}z^TAz -1$, where $A$ is a non-degenerate symmetric matrix. The H\"ormander classification of symplectic forms \cite{Hormander1995} tells us that by performing a linear symplectic change of coordinates, $H$ can be brought into a certain standard form, and moreover that these standard forms are classified by the eigenvalues of the Jordan decomposition\footnote{Here $\mathbb{J}$ stands for the standard complex structure on $\mathbb{C}^n \simeq T^*{\mathbb R}^n$.} of $\mathbb{J}A$. We are interested in the case where this linear symplectic change of coordinates yields a decomposition \begin{equation} \label{defH} H(x,y) = \underset{\coloneqq H_0(x)}{\underbrace{\frac{1}{2}x^TA_0 x - 1}} + \underset{ \coloneqq H_1(y)}{\underbrace{\frac{1}{2}y^TA_1 y}}, \end{equation} for $(x,y) \in T^\ast\mathbb{R}^k\times T^\ast\mathbb{R}^{n-k}$, where $A_0$ is positive definite and $\mathbb{J}A_1$ is hyperbolic. Here and throughout this paper, we implicitly assume that $1 \le k \le n-1$ (see Remark \ref{k0n} for the cases $k=0,n$). This implies that $A_1$ has signature $(n-k,n-k)$. If we denote the regular level sets \begin{equation} \label{Sigma-Sigma0} \Sigma\coloneqq H^{-1}(0)\qquad\textrm{and}\qquad \Sigma_0\coloneqq H_0^{-1}(0), \end{equation} then $\Sigma$ is a hyperboloid diffeomorphic to $S^{n+k-1}\times{\mathbb R}^{n-k}$, whereas $\Sigma_0$ is an ellipsoid diffeomorphic to $S^{2k-1}$. Note that $ \Sigma$ is never compact. We say that $H$ is \textit{tentacular} if it satisfies a number of carefully chosen growth conditions at infinity (see Definition \ref{def:TentHam}). For the reader not familiar with these conditions\footnote{The authors are aware the complement of this set of readers may consist solely of the authors.}, for the purposes of this Introduction they may regard ``tentacular'' to mean: either $A_1$ is symplectically diagonalisable or all eigenvalues $ \lambda_i$ of $\mathbb{J}A_1$ have $|\! \operatorname{Re} (\lambda_i)|>2$. In this case we call $ \Sigma$ a \textit{tentacular hyperboloid}. \begin{theorem}\label{thm:compRFH} Let $H$ be a tentacular quadratic Hamiltonian of the form \eqref{defH}. Then the Rabinowitz Floer homology of $H$ is given by:\footnote{For $k=n-1, RFH_{1-n}(H)={\mathbb Z}_2\oplus {\mathbb Z}_2$.} \[ RFH_*(H) \coloneqq \left\lbrace \begin{array}{c c c} {\mathbb Z}_2 & & *=1-n,-k,\\ 0 & & \textrm{otherwise.} \end{array} \right. \] In particular $RFH_*(H)\neq 0$ and $RFH_*(H)\neq H_{*+n-1}(\Sigma)$. \end{theorem} The Weinstein Conjecture is obvious for the hyperboloids contained in Theorem \ref{thm:compRFH}. One of the strengths of Floer theoretical calculations, however, is that they are invariant under controlled perturbations. Therefore as an immediate corollary to Theorem \ref{thm:compRFH}, we obtain: \begin{cor} \label{cor:WC} If $H$ is a Hamiltonian as in Theorem \ref{thm:compRFH} and $\{\Sigma_s\}_{s\in [0,1]}$ is a smooth $1$-parameter family of compact perturbations of $\Sigma\coloneqq H^{-1}(0)$ through strongly tentacular hypersurfaces, then each $\Sigma_s$ carries a closed characteristics. \end{cor} \begin{remark} \label{k0n} \textbf{The cases $k = 0$ and $k = n$:} We assume throughout this paper that $1 \le k \le n-1$. Let us briefly comment on the two other cases. For $k=0$, the Hamiltonian $H$ from \eqref{defH} is of the form $H=H_1-1$, and the proof of Lemma \ref{lem:orbits} below shows that the Hamiltonian vector field of $H_1$ on $ \Sigma$ has no closed orbits. Thus Theorem \ref{thm:compRFH} holds trivially as $RFH(H)$ agrees by definition with the Morse homology of $\Sigma$ (with shifted degree). Meanwhile if $k = n$ then $H = H_0$, and the hypersurface is compact. The Rabinowitz Floer homology for such hypersurfaces vanishes by \cite[Thm.\ 1.2]{CieliebakFrauenfelder2009}. The Weinstein Conjecture is trivially false for $k =0$, while it holds true for $k=n$, as proved by Viterbo in \cite{viterbo_1987} for compact contact type hypersurfaces in $T^* \mathbb{R}^n$. \end{remark} \begin{remark} Symplectic homology has also recently been extended to the non-compact setting. In \cite{cieliebak_eliashberg_polterovich_2017}, Cieliebak, Eliashberg and Polterovich define and compute the symplectic homology for a certain subclass of the symplectic hyperboloids we consider here. Their computations are consistent with ours, and we conjecture that the long exact sequence relating symplectic homology and Rabinowitz Floer homology \cite{CieliebakFrauenfelderOancea2010} extends to the non-compact setting. In a slightly different direction, Ganatra, Pardon and Shende \cite{ganatra_pardon_shende_2019} have defined the symplectic homology for a class of Liouville manifolds with boundary -- Liouville sectors -- using the compactness methods of Groman \cite{groman_2020}. It seems likely that the hypersurfaces we consider here can also be fitted into this framework. We hope to discuss this elsewhere. \end{remark} \textsc{Outlook:} In the compact world, both Rabinowitz Floer homology and symplectic homology have been profitably used to study orderability problems for compact contact manifolds \cite{FraserPolterovichRosen2012,AlbersFuchsMerry2015, albers_fuchs_merry_2017,albers_merry_2018,chantraine}. Cieliebak, Eliashberg and Polterovich initiated the study of orderability problems for non-compact contact manifolds in \cite{cieliebak_eliashberg_polterovich_2017} using symplectic homology. Our companion computation shows that Rabinowitz Floer homology is also well suited to this problem. We will return to these questions in a sequel to the present paper. In another direction, we note that our results are consistent (as they should be!) with van den Berg, Pasquotto and Vandervorst's earlier Weinstein Conjecture \cite{BergPasq2009} results for non-compact hypersurfaces in $T^*\mathbb{R}^n$, which were based on variational methods. These results were later extended to cover unit cotangent bundles of Riemannian manifolds with flat ends \cite{berg_pasquotto_rot_vandervorst_2016,suhr_zehmisch_2016}. It is an interesting -- albeit, formidable -- problem to try and generalise the Floer-theoretical methods used in the present article to cover this setting. Finally, Miranda and Oms \cite{miranda_oms_2020} have very recently used the methods from $b$-symplectic and contact geometry to study the Weinstein Conjecture for certain non-compact hypersurfaces, including examples in the planar restricted circular three-body problem.\\ \textsc{Sketch of the proof of Theorem \ref{thm:compRFH}:} The \textit{Rabinowitz action functional} for a Hamiltonian $H\colon T^*{\mathbb R}^n\rightarrow\mathbb{R}$ associates to a pair $(v,\eta)$ of a loop $v\colon S^1 \to T^*{\mathbb R}^n$ and a real number $\eta$ its action by \[ \mathcal{A}^H(v, \eta) \coloneqq \int_{S^1}v^{*}\lambda-\eta\int_{S^1}H(v(t))\,dt. \] Here, $\lambda$ is a primitive of $\omega = d p \wedge d q$. The critical set ${\operatorname{Crit}}({\mathcal{A}}^H)$ of ${\mathcal{A}}^H$ consists of pairs $(v,\eta)$, such that $v(S^1)\subset H^{-1}(0)$ and $\partial_t v= \eta X_H(v)$, where $X_H$ is the Hamiltonian vector field of $H$. The positive $L^2$ gradient equation for this functional, which we call the Rabinowitz Floer equations for $H$, is the following Floer equation for $v\colon {\mathbb R} \times S^1 \rightarrow T^*\mathbb{R}^n$ coupled with an ODE for $\eta\colon {\mathbb R} \rightarrow {\mathbb R}$: \begin{equation*} \left(\begin{array}{c} \partial_{s}v\\ \partial_s \eta \end{array}\right) = \left( \begin{array}{c} -J(v,\eta,t)\bigl[\partial_{t}v-\eta X_{H}(v)\bigr] \\ -{\int_0^1 H(v) \,dt \quad}\end{array} \right). \end{equation*} The standard counting of rigid solutions of this equation defines a boundary operator \[ \partial \colon CF_*(H,f) \rightarrow CF_{*-1}(H,f), \] on a graded ${\mathbb Z}_2$-vector space $ CF_*(H,f)$ generated by critical points of an auxiliary coercive Morse function $f$ on ${\operatorname{Crit}}({\mathcal{A}}^H)$, which generically is a countable union of finite dimensional manifolds. The ${\mathbb Z}$-grading of $CF_*(H,f)$ is defined by the transverse Conley-Zehnder index of periodic orbits plus the signature index of critical points of $f$. We use the $ \mathbb{Z}$-grading convention of \cite{CieliebakFrauenfelderOancea2010}, which differs from the $ \mathbb{Z}+ \frac{1}{2}$ grading convention of \cite{CieliebakFrauenfelder2009} by a factor of $1/2$. The homology of the chain complex $(CF_*(H,f),\partial)$ is called the \textit{Rabinowitz Floer homology} of $H$ and is denoted by $ RFH_*(H)$. For the Hamiltonians $H$ that we consider in Theorem \ref{thm:compRFH}, the fact that $ RFH_*(H)$ is well defined and independent of the auxiliary data used to construct it is proved in \cite{pasquotto2017, pasquotto2018}. One can also play the same game with the Hamiltonian $H_0$ on $T^*\mathbb{R}^k$, thus yielding another Rabinowitz Floer homology $ RFH_*(H_0)$. This construction is rather easier as $ \Sigma_0$ is compact (and falls under the remit of the setup originally conceived in \cite{cieliebak2009}). However as $ \Sigma_0$ is displaceable in $ T^*\mathbb{R}^k$, by \cite[Thm.\ 1.3]{cieliebak2009} the Rabinowitz Floer homology of $H_0$ is not particularly interesting \[ RFH_*(H_0) = 0. \] All is not lost though: if one restricts to the subcomplex generated by orbits $(v,\eta)$ with $ \eta > 0$ -- a gadget we refer to as the \textit{positive Rabinowitz Floer homology} and denote by $RFH_*^+(H_0)$ -- then we obtain something non-zero: \[ RFH^+_*(H_0) = \begin{cases} \mathbb{Z}_2, & * = k,\\ 0, & \text{otherwise.} \end{cases} \] The proof of Theorem \ref{thm:compRFH} uses the ``hybrid problem'' technique pioneered by Abbondandolo and Schwarz in their seminal paper \cite{AbbondandoloSchwarz2010}. The starting observation is that any periodic orbit of $X_H$ on $ \Sigma$ takes the form \[ \gamma(t) = ( \gamma_0(t), 0), \] where $ \gamma_0$ is a periodic orbit of $X_{H_0}$ on $ \Sigma_0$. This sets up an inclusion \[ i \colon {\operatorname{Crit}}({\mathcal{A}}^{H_0}) \hookrightarrow {\operatorname{Crit}}({\mathcal{A}}^H), \] which restricted to the non-constant orbits gives a bijection between ${\operatorname{Crit}}({\mathcal{A}}^{H_0})\setminus (\Sigma_0{\times}\{0\})$ and ${\operatorname{Crit}}({\mathcal{A}}^H)\setminus (\Sigma{\times}\{0\})$. Despite this relationship between their critical points, there is no obvious relation between the space of negative gradient flow lines for these two functionals, and hence no reason to hope that $i$ induces a chain map. Nevertheless, we prove that for a particular choice of Morse functions $f$ and $f_0$: \begin{theorem} \label{thm:iso} There exists a chain map \[ \psi \colon CF_*(H,f) \to CF_*(H_0,f_0), \] which induces a sequence of homomorphisms $\Psi$, such that the following diagram of two long exact sequences commutes: \[ \xymatrix{ \dots \ar[r] &H_{*+n -1}(\Sigma) \ar[r] \ar[d]_{\Psi^0} & RFH_{*}^{\geq 0}(H) \ar[r] \ar[d] & RFH^+_*(H) \ar[r] \ar[d]^{\Psi^+} & \dots \\ \dots \ar[r] & H_{*+k -1}(\Sigma_0) \ar[r] & RFH_{*}^{\geq 0}(H_0) \ar[r] & RFH^+_*(H_0) \ar[r] & \dots \\ } \] Moreover $\Psi^+$ is an isomorphism, whereas $\Psi^0$ is a composition of an isomorphism coming from the retraction $\Sigma\cong S^{n+k-1}\times\mathbb{R}^{n-k}\rightarrow S^{n+k-1}$ and an Umkehr map. \end{theorem} The construction of $\psi$ is based on counting solutions of the following hybrid problem: we consider tuples $(v^-,\eta^-,v^+,\eta^+)$ where \begin{align*} v^+ \colon [0,\infty) \times S^1 &\rightarrow T^*\mathbb{R}^n,& \eta^+ \colon [0, \infty) &\to {\mathbb R},\\ v^- \colon (-\infty,0] \times S^1 &\rightarrow T^*\mathbb{R}^k,& \eta^- \colon (- \infty, 0] &\to {\mathbb R}, \end{align*} are solutions of the Rabinowitz Floer equations, $(v^+,\eta^+)$ for $H$ and $(v^-,\eta^-)$ for $H_0$, with prescribed asymptotics at $\pm\infty$ and satisfying the following coupling condition at $s=0$: identifying $T^*\mathbb{R}^n \cong T^*\mathbb{R}^k \times \mathbb{R}^{n-k} \times \mathbb{R}^{n-k}$, we require \[ v^+(0,t) = (v^-(0,t), *, 0), \qquad \eta^-(0) = \eta^+(0). \] This coupling condition can be seen as a Lagrangian boundary condition for $\mathbb{R}^{2n+2k}$-valued maps on a half-cylinder, from which it follows that the hybrid problem is Fredholm. Precompactness of the moduli spaces of solutions $(v^-,\eta^-,v^+,\eta^+)$ with fixed asymptotes is established in Section \ref{ssec:bounds}. The chain map $ \psi$ is then defined by counting rigid solutions of the hybrid problem. To prove the remaining statements of Theorem \ref{thm:iso}, we show that automatic transversality holds at stationary solutions of the hybrid problem. Combining this with sharp energy estimates implies that if we order the critical points of $\mathcal{A}^H$ and $ \mathcal{A}^{H_0}$ by increasing action, then the matrix representation of $ \psi$ is upper triangular, and moreover the diagonal entries are all equal to 1, except for a single 0 coming from the minimum of $f$ on $ \Sigma$. From this, Theorem \ref{thm:iso} follows, and hence so does Theorem \ref{thm:compRFH}. \\ \textit{Acknowledgements:} The first and third authors are supported by the SNF grant \href{http://p3.snf.ch/project-182564}{Periodic orbits on non-compact hypersurfaces}. We thank Kai Cieliebak for pointing out \cite{cieliebak_eliashberg_polterovich_2017} to us, and for helpful remarks during the preparation of this article. \subsection{Morse-Bott property}\label{sec:Morse-Bott} In this section we show that the Morse-Bott conditions \eqref{eq:MorseBott} and \eqref{def:MBT} are satisfied for Hamiltonians $H$ and $H_0$ as in \eqref{defH}. \begin{lem} For Hamiltonians $H_0$ and $H$ on $(T^\ast{\mathbb R}^k,\omega_k)$ or $(T^\ast{\mathbb R}^n,\omega_n)$ as in \eqref{defH} the periodic orbits of $X_{H_0}$ and $X_H$ are of Morse-Bott type and the Rabinowitz action functionals ${\mathcal{A}}^{H_0}$ and $\mathcal{A}^H$ are Morse-Bott. \end{lem} \begin{proof} We only give the proof for $H$, the proof for $H_0$ is analogous. First, we show that ${\operatorname{Crit}}({\mathcal{A}}^H)$ is a discrete union of connected manifolds $\Lambda$. Let $A=\big(\begin{smallmatrix}A_0 &\\ & A_1\end{smallmatrix}\big)$ be the block matrix such that $H(x,y)=\big(\begin{smallmatrix}x\{\mathfrak y}\end{smallmatrix}\big)^TA\big(\begin{smallmatrix}x\{\mathfrak y}\end{smallmatrix}\big)-1$. Let $\mu_j$ be the eigenvalues of the matrix $\mathbb{J}_kA_0$ and let $\Lambda^\eta$ be the set of pairs $(v,\eta)$ such that $v$ is an $\eta$-periodic orbit of $X_H$ (see \eqref{LambdaEta}). Recall that $\Lambda^\eta$ is diffeomorphic to a sphere $S^{2m-1}$ or $\Sigma$ and that we have by Corollary \ref{cor:CritVal} and Remark \ref{rem:orbits} that $$ {\operatorname{Crit}}\left({\mathcal{A}}^H\right)= \bigcup_{\eta \in \bigcup_{j=1}^k\frac{2\pi}{\mu_j}{\mathbb Z}} \Lambda^\eta. $$ Next, recall from Remark \ref{rem:Lioville} that quadratic Hamiltonians $H$ are defining for the hypersurface $\Sigma=H^{-1}(0)$, as the Liouville vector field $Y=\frac{1}{2}x\partial_x$ satisfies $dH(Y)|_\Sigma=1$. This allows us to apply \cite[Lem.\ 20]{Fauck2016} and conclude that ${\mathcal{A}}^H$ is Morse-Bott if the periodic orbits of $X_H$ are of Morse-Bott type. To prove this last property consider the projection $(v,\eta)\mapsto v(0)$ and for $\eta\in {\operatorname{Crit}}({\mathcal{A}}^H)$ denote by $\mathcal{N}^\eta$ the image of $\Lambda^\eta$ under this projection. It suffices to show for all $\eta$ that $\mathcal{N}^\eta\subseteq\Sigma$ is a closed submanifold and that for $p\in\mathcal{N}^\eta$ it holds that \[T_p\mathcal{N}^\eta=\ker\big(d_p H\big)\cap\ker \! \big(D_p\phi^\eta-\operatorname{Id} \! \big),\] where $\phi^\eta$ denotes the time $\eta$ flow of $X_H$. Both conditions follow from \eqref{CritEta}: \begin{align*} \mathcal{N}^\eta =\pi_{\mathcal{A}^H}(\Lambda^\eta) &= \equalto{\Sigma}{H^{-1}(0)}\cap\ker\big(\underbrace{\exp(\eta \mathbb{J}_nA)}_{=D\phi^\eta}-\operatorname{Id} \! \big)\\ \Longrightarrow\qquad T_p\mathcal{N}^\eta &=\ker (d_pH)\cap\ker \! \big( D_p\phi^\eta-\operatorname{Id} \! \big).\qedhere \end{align*} \end{proof} \subsection{Periodic orbits} In this subsection we discuss the properties of non-degenerate periodic orbits of quadratic Hamiltonians $H(x,y)=H_0(x)+H_1(y)$ on $T^\ast{\mathbb R}^n=T^\ast{\mathbb R}^k\oplus T^\ast{\mathbb R}^{n-k}$ satisfying \eqref{defH}. In particular, we establish an action and degree-preserving 1-to-1 correspondence between periodic orbits of $X_H$ on $\Sigma=H^{-1}(0)$ and periodic orbits of $X_{H_0}$ on $\Sigma_0=H^{-1}_0(0)$. \begin{lem}\label{lem:orbits} There is an action preserving $1$-to-$1$ correspondence of the periodic orbits of $X_{H}$ on $\Sigma$ with the periodic orbits of $X_{H_0}$ on $\Sigma_0$. Explicitly, for $\eta\neq 0$ \[ v\colon S^1\to \Sigma,\qquad \partial_t v=\eta X_H(v), \] if and only if $ \sigma(v)=(v_0,0)$, where \[ v_0\colon S^1 \to \Sigma_0, \qquad \partial_t v_0=\eta X_{H_0}(v_0). \] Moreover $\mathcal{A}^H(v)=\mathcal{A}^{H_0}(v_0)=\eta$, for the Rabinowitz action functionals of $H$ on $(T^*{\mathbb R}^n,\omega_n)$ and $H_0$ on $(T^*{\mathbb R}^k,\omega_k)$ respectively. \end{lem} \begin{proof} For a Hamiltonian $H$ as in \eqref{quadHam} the Hamiltonian flow of $X_H$ is given by \[ \phi^t (x)=\exp(t \mathbb{J}_n A)x. \] Consequently, $(v,\eta)\in {\operatorname{Crit}}({\mathcal{A}}^H)$ if and only if $v(0)\in \Sigma$ and $\phi^\eta(v(0))=v(0)$ or, equivalently, $v(0)\in \ker \! \big( \! \exp(\eta \mathbb{J}_n A)-\operatorname{Id} \! \big)$. By assumption the matrix $A$ can be presented with respect to the symplectic splitting \eqref{splitting} as a block matrix: \[ A\coloneqq \left(\begin{array}{c c} A_0 & 0\\ 0 & A_1 \end{array} \right), \] where $A_0$ and $A_1$ are as in \eqref{defH}. As a result, \[ \ker \! \big(\! \exp(\eta \mathbb{J}_n A)-\operatorname{Id}\!\big)=\ker\!\big(\!\exp(\eta \mathbb{J}_k A_0)-\operatorname{Id}\!\big)\oplus \ker \! \big( \! \exp(\eta \mathbb{J}_{n-k} A_1)-\operatorname{Id} \! \big). \] A simple calculation shows that $\det\! \big( \! \exp(\eta \mathbb{J}_{n-k} A_1)-\operatorname{Id}\!\big)=0$ if and only if $e^{\eta\mu}=1$ for some eigenvalue $\mu$ of $\mathbb{J}_{n-k}A_1$. However, by assumption all the eigenvalues of $\mathbb{J}_{n-k}A_1$ have non-zero real parts, hence $e^{\eta\mu}\neq 1$ for all $\eta\neq 0$. Consequently, $(v,\eta)\in {\operatorname{Crit}}({\mathcal{A}}^H)$ and $\eta\neq 0$ if and only if $v(0)\in \Sigma$ and $\sigma \circ v(0)=(w_0,0)$ for some $w_0\in \ker\! \big( \! \exp(\eta \mathbb{J}_k A_0)-\operatorname{Id}\! \big)$. If we define $v_0(t)\coloneqq \phi^{\eta t}(w_0)$ then $(v_0,\eta)\in {\operatorname{Crit}}({\mathcal{A}}^{H_0})$, as $\sigma(\Sigma)\cap\left(T^*{\mathbb R}^{k}{\times}\{0\}\right)=\Sigma_0\times\{0\}$. Finally, recall from Remark \ref{rem:Lioville} that $Y=\frac{1}{2}x\partial_x$ is a Liouville vector field for $\omega_n$ and satisfies $dH_x(Y)=1$ for all $x\in\Sigma$. Hence, we have for $(v,\eta)\in {\operatorname{Crit}}\left({\mathcal{A}}^H\right)$ \begin{equation}\label{action} {\mathcal{A}}^{H}(v,\eta)=\int \lambda_n(\partial_tv)=\eta\int\omega_n(Y,X_H)=\eta\int dH(Y)=\eta, \end{equation} where $\lambda_n\coloneqq \iota_Y\omega_n$ is the Liouville form for $Y$. The same arguments for $Y_0=\frac{1}{2}x\partial_x$ on $T^\ast {\mathbb R}^k$ show that ${\mathcal{A}}^{H_0}(v_0,\eta)=\eta$. This concludes the proof. \end{proof} \begin{cor}\label{cor:CritVal} Denote by $\{\pm i \mu_l\}_{l=1}^k,\ \mu_l>0$ the eigenvalues of $\mathbb{J}_k A_0$. Then \[ \operatorname{CritVal}\left({\mathcal{A}}^{H}\right)= \operatorname{CritVal}\left({\mathcal{A}}^{H_0}\right)=\bigcup_{l=1}^k \frac{2\pi }{\mu_l}{\mathbb Z} . \] \end{cor} \begin{proof} By Lemma \ref{lem:orbits} it suffices to prove the second equality. By the proof of Lemma \ref{lem:orbits}, we know that $(v_0,\eta)\in {\operatorname{Crit}}\left({\mathcal{A}}^{H_0}\right)$ if and only if \begin{equation}\label{CritEta} v_0(t)=\exp(t\eta \mathbb{J}_kA_0)w_0\quad \textrm{and}\quad w_0\in \Sigma_0\cap \ker \! \big(\! \exp(\eta \mathbb{J}_kA_0)-\operatorname{Id} \! \big). \end{equation} As $\ker\big(\exp(\eta \mathbb{J}_kA_0)-\operatorname{Id}\big)\neq \{0\}$ if and only if there exists an eigenvalue $\pm i \mu_l$ of $\mathbb{J}_kA_0$, such that $\eta \mu_l \in 2\pi {\mathbb Z}$, and as $\mathcal{A}^{H_0}(v_0,\eta)=\eta$, the corollary follows. \end{proof} \begin{remark}\label{rem:orbits} \label{rem:Sk} We define the following subspaces of the critical sets \begin{equation}\begin{aligned} \Lambda_0^\eta &\coloneqq \left\lbrace (v,\mathfrak{y})\in {\operatorname{Crit}}\left({\mathcal{A}}^{H_0}\right)\ \big|\ \mathfrak{y}=\eta\right\rbrace,\\ \Lambda^\eta &\coloneqq \left\lbrace (v,\mathfrak{y})\in {\operatorname{Crit}}\left({\mathcal{A}}^{H}\right)\ \big|\ \mathfrak{y}=\eta\right\rbrace. \end{aligned} \label{LambdaEta} \end{equation} In particular $\Lambda_0^0= \Sigma_0\times\{0\}$ and $\Lambda^0=\Sigma\times\{0\}$. Meanwhile for $\eta \neq 0$, we have by Lemma \ref{lem:orbits} ${\mathcal{A}}^H(\Lambda^\eta)={\mathcal{A}}^{H_0}(\Lambda_0^\eta)=\eta$ and \[ \Lambda^\eta= \left\lbrace (\sigma^{-1}(v_0,0), \eta)\ \big|\ (v_0, \eta) \in \Lambda_0^\eta\right\rbrace\cong \Lambda_0^\eta. \] As $\Sigma_0$ is diffeomorphic to $S^{2k-1}$, we obtain from \eqref{CritEta} for $\eta \in \operatorname{CritVal} ({\mathcal{A}}^{H_0})$ that $\Lambda_0^\eta$ is diffeomorphic to $S^{2m-1}$, where $m\coloneqq \frac{1}{2}\dim \ker \! \big( \! \exp(\eta \mathbb{J}_kA_0)-\operatorname{Id} \! \big)$. \end{remark} Next, we show that the correspondence between the periodic orbits of $X_H$ on $\Sigma$ and the periodic orbits of $X_{H_0}$ on $\Sigma_0$ is not only action- but also degree-preserving. \begin{prop}\label{prop:muCZ} If $(v,\eta), \eta\neq 0$ is a periodic orbit of $X_{H}$ on $\Sigma\subseteq T^*{\mathbb R}^n$ with $\sigma(v)=(v_0,0)$ and $(v_0,\eta)$ a periodic orbit of $X_{H_0}$ on $\Sigma_0\subseteq T^*{\mathbb R}^n$, then \[ \mu^{\operatorname{tr}}_{\operatorname{CZ}}(v,\eta)=\mu^{\operatorname{tr}}_{\operatorname{CZ}} (v_0,\eta). \] \end{prop} Here $\mu^{\operatorname{tr}}_{\operatorname{CZ}}$ denotes the transverse Conley-Zehnder index, which we will denote in the following proof by $\mu_{\operatorname{CZ}}^\xi$, as it is only evaluated on the contact structure $\xi$. \begin{proof} Let $H$ be a quadratic Hamiltonian as in \eqref{quadHam} and $H^{-1}(0)=\Sigma$. The radial Liouville vector field $Y=\frac{1}{2}x\partial_x$ defines a contact structure $\xi=\ker\left( \iota_{Y}\omega\big|_{T\Sigma}\right)$ on $\Sigma$ by Remark \ref{rem:Lioville}. Writing $L^\omega$ for the symplectic complement of a subspace $L$, we have for $x \in \Sigma $: \begin{align*} \xi_x & =\left\lbrace v\in T_x\Sigma\, |\, \omega_n(Y, v)=0 \right\rbrace\\ & = \left\lbrace v\in T_xT^\ast{\mathbb R}^n\, |\, \omega_n(Y, v)=0, dH(v)=0 \right\rbrace = \left( \operatorname{span}\{ X_H,Y\}\right)^{\omega}. \end{align*} Consequently, $\xi^{\omega}=\operatorname{span}\{ X_H,Y\}$. If $\mathcal{L}_{X_H}$ denotes the Lie-derivative along $X_H$, we obtain by Cartan's formula and Remark \ref{rem:Lioville} that \[ \mathcal{L}_{X_H} \iota_Y \omega = d(\iota_{X_H} \iota_Y \omega_n)+\iota_{X_H} d(\iota_Y \omega_n) =d(dH(Y))+\iota_{X_H}\omega_n = d(H{+}1)-dH=0. \] Consequently, the Hamiltonian flow $\phi^t$ of $X_H$ preserves $\iota_Y \omega_n$. As $\phi^t$ preserves also $dH$ and $\omega_n$, we find that the vector fields $X_H, Y$, the bundles $\xi, \xi^\omega$ and the splitting $T(T^*{\mathbb R}^n)=T\mathbb{R}^{2n}=\xi\oplus\xi^\omega$ over $\Sigma$ are also preserved by $\phi^t$. Let $\gamma$ be a closed characteristic on $\Sigma$. Then we have \[ \gamma^*T\mathbb{R}^{2n}=\gamma^*\xi \oplus \gamma^*\xi^{\omega}. \] As the Hamiltonian flow preserves this splitting, it follows by the product property \cite{Robbin1993} that the Conley-Zehnder index of $\gamma$ is the sum: \[ \mu_{\operatorname{CZ}}^{T\mathbb{R}^{2n}}(\gamma)=\mu_{\operatorname{CZ}}^{\xi}(\gamma)+\mu_{\operatorname{CZ}}^{\xi^{\omega}}(\gamma). \] As $(X_H,Y)\circ \gamma$ provides a trivialisation of $\gamma^*\xi^{\omega}$ and as $\phi^t$ preserves $(X_H,Y)$, we find that $D\phi^t|_{\xi^\omega}$ expressed in this trivialisation is a path of identity matrices and hence \[ \mu_{\operatorname{CZ}}^{\xi^{\omega}}(\gamma)=\mu_{\operatorname{CZ}}(\operatorname{Id})=0\qquad \Longrightarrow\qquad \mu_{\operatorname{CZ}}^\xi(\gamma)=\mu_{\operatorname{CZ}}^{T{\mathbb R}^{2n}}(\gamma). \] The Hamiltonian flow of a Hamiltonian as in \eqref{quadHam} is given by \[ \phi^t (x)=\exp(t \mathbb{J}_n A)x\quad\textrm{and}\quad D\phi^t=\exp(t \mathbb{J}_n A). \] For a closed characteristic $\gamma$ with period $\eta$ we can take $\Phi(t)=\operatorname{Id}$ for all $t$ as the trivialization $\Phi\colon [0,\eta]\times {\mathbb R}^{2n}\to \gamma^* (T{\mathbb R}^{2n})$. With respect to this trivialization \[ \mu_{\operatorname{CZ}}^\xi(\gamma)=\mu_{\operatorname{CZ}}^{T{\mathbb R}^{2n}}(\gamma)=\mu_{\operatorname{CZ}}(\exp(t \mathbb{J}_n A)). \] Naturally, $\mathbb{R}^{2n}=\mathbb{R}^{2k}\oplus\mathbb{R}^{2(n-k)}$ is a splitting into symplectic subspaces. By assumption, the matrix $A$ can be written as a block matrix with respect to this splitting: \[ A\coloneqq \left(\begin{array}{c c} A_0 & 0\\ 0 & A_1 \end{array} \right), \] where $A_0$ and $A_1$ are as in \eqref{defH}. This way the Conley-Zehnder index of $\gamma$ is a sum: \[ \mu_{\operatorname{CZ}}^\xi(\gamma)=\mu_{\operatorname{CZ}} \big(\! \exp(t \mathbb{J}_k A_0) \big)+\mu_{\operatorname{CZ}} \big(\! \exp(t \mathbb{J}_{n-k} A_1) \big). \] By Lemma \ref{lem:orbits}, $\gamma$ is also a characteristic on $\Sigma_0\coloneqq H_0^{-1}(0)$. Repeating the arguments presented above yields that $\xi_0\coloneqq \ker(\iota_Y\omega_k)$ is a contact structure on $\Sigma_0$ and that \[ \mu_{\operatorname{CZ}}^{\xi_0}(\gamma)=\mu_{\operatorname{CZ}}\big(\!\exp(t \mathbb{J}_k A_0) \big). \] Thus it suffices to show that $\mu_{\operatorname{CZ}}\big(\! \exp(t \mathbb{J}_{n-k} A_1)\big)=0$. The Conley-Zehnder index of the path of matrices $\exp(t \mathbb{J}_{n-k} A_1), t\in[0, \eta]$ is by definition \begin{gather} \mu_{\operatorname{CZ}} \big(\! \exp(t \mathbb{J}_{n-k} A_1) \big) =\frac{1}{2}\operatorname{sgn}(A_1)+\frac{1}{2}\operatorname{sgn}\!\left(A_1\Big|_{\ker \! \big(\! \! \exp(\eta \mathbb{J}_{n-k} A_1)-\operatorname{Id}\! \big)}\right)\nonumber\\ +\sum_{\substack{t\in(0,\eta) ,\\ \det(\exp(t\mathbb{J}_{n-k}A)-\operatorname{Id})=0}}\operatorname{sgn}\!\left(A_1\Big|_{\ker \! \big( \! \exp(t\mathbb{J}_{n-k}A_1)-\operatorname{Id} \! \big)}\right)\label{CZwzor} \end{gather} First observe that the first term vanishes, since by assumption $A_1$ has signature $0$. To analyse the rest of the terms, we will calculate the \emph{crossings}, i.e. those $t\in {\mathbb R}$, such that $\det \! \big(\! \exp(t\mathbb{J}_{n-k}A_1)-\operatorname{Id} \! \big)=0$. A simple calculation shows that $t$ is a crossing of $\exp(t\mathbb{J}_{n-k}A_1)$ if and only if $e^{t\mu}=1$ for some eigenvalue $\mu$ of $\mathbb{J}_{n-k}A_1$. However, by assumption all the eigenvalues of $\mathbb{J}_{n-k}A_1$ have non-zero real parts, hence $e^{t\mu}\neq 1$ for all $t\neq 0$. Therefore, $\exp(t\mathbb{J}_{n-k}A_1)$ has no other crossings than $0$ and all terms in \eqref{CZwzor} vanish giving $\mu_{\operatorname{CZ}}\big(\! \exp(t \mathbb{J}_{n-k} A_1) \big)=0$. \end{proof} \section{Invariance of the positive Rabinowitz Floer homology} The goal of this section is to show the following invariance of $RFH^+(H)$: \begin{theorem} \label{thm:posRFHtent} For a strongly tentacular Hamiltonian $H$ the positive Rabinowitz Floer homology $RFH^+(H)$ does not depend on the almost complex structure $J$ or on the Morse-Smale pair $(f,g)$ on $\operatorname{Crit} (\mathcal{A}^H )$. Moreover if $\{H_s\}$ is a $1$-parameter family of Hamiltonians in the affine space of compactly supported perturbations of $H$, then $RFH^+(H_s)$ is constant along $\{H_s\}$. \end{theorem} As seen above, the positive Rabinowitz Floer homology $RFH^+(H)$ is generated by non-constant periodic orbits and thus vanishes in the absence of closed characteristics. Throughout this section we will denote by $(M, \omega)$ any exact symplectic manifold. In order to prove Theorem \ref{thm:posRFHtent}, we need compactness results for homotopies of Hamiltonians and almost complex structures, which are stronger than the ones proved in \cite{pasquotto2017}. To obtain these results, we recall the notion of \emph{uniform continuity of \emph{(PO)}}, as introduced in \cite{pasquotto2018}: \begin{definition} We say that $H$ satisfies property (PO) if for any fixed action window, all non-degenerate periodic orbits are contained in a compact subset of $M$. Moreover, we say that property (PO) is \emph{uniformly continuous} at $H$ if there exists an open neighbourhood $\mathcal{O}(H)$ of $0$ in $C^{\infty}_{c}(M)$ and an exhaustion of $M$ by compact sets $\{K_{n}\}_{n\in\mathbb{N}}$, such that for every $n\in \mathbb{N}$ and every $h\in \mathcal{O}(K_{n})=\mathcal{O}(H)\cap C^{\infty}_{0}(K_{n})$, whenever \[ (v,\eta)\in {\operatorname{Crit}}({\mathcal{A}}^{H+h})\quad\textrm{and}\quad 0<\Big|{\mathcal{A}}^{H+h}(v,\eta)\Big|\leq n, \] then $v(S^{1})\subseteq K_{n} \cap (H{+}h)^{-1}(0)$. \end{definition} \begin{remark} By \cite[Lem.\ 8.4]{pasquotto2018} every strongly tentacular Hamiltonian satisfies the axiom of uniform continuity of (PO). \end{remark} Define: $\displaystyle\qquad {\operatorname{Crit}}^+({\mathcal{A}}^H) \coloneqq {\operatorname{Crit}}({\mathcal{A}}^H )\cap \left({\mathcal{A}}^H\right)^{-1}((0,+\infty)).$ \begin{remark}\label{rem:C2small} Let $H \colon T^*{\mathbb R}^n\to {\mathbb R}$ be a Hamiltonian on $(T^*{\mathbb R}^n,\omega_n)$. If $(v,\eta)\in {\operatorname{Crit}}^+({\mathcal{A}}^H)$, then the following adaptation of \cite[Lem.\ 2.2]{laudenbach2004} to the Rabinowitz Floer framework holds: \[ |\eta| \sup_{v(S^1)}\|DX_H\|\geq 2\pi. \] \end{remark} \begin{lem}\label{lem:delta1} Let $H$ be a Hamiltonian on an exact symplectic manifold $(M,\omega)$, such that $\Sigma \coloneqq H^{-1}(0)$ is of contact type. If property (PO) is uniformly continuous at $H$ then there exists an open neighbourhood $\mathcal{O}(H)$ of $0$ in $C^\infty_c(M)$, such that for every compact set $K\subseteq M$ there exists a constant $\delta>0$, such that for all $h\in \mathcal{O}(H)\cap C_c^\infty(K)$ \[ \inf \left\lbrace {\mathcal{A}}^{H+h}(v,\eta)\ \Big| \ (v,\eta)\in {\operatorname{Crit}}^+({\mathcal{A}}^{H+h})\right\rbrace>\delta. \] \end{lem} \begin{proof} We argue by contradiction. Let $\widetilde{\mathcal{O}}(H)$ be the open neighbourhood from property (PO). Without loss of generality, we can assume that $K=K_n$ for some $K_n$ in the exhaustion of $M$. Suppose that there exists a sequence $h_n\in \widetilde{\mathcal{O}}(H)\cap C_c^\infty(K)$ and a sequence $(v_n,\eta_n)\in {\operatorname{Crit}}^+({\mathcal{A}}^{H+h_n})$, such that $\lim_{n\to\infty}h_n= 0$ and \begin{equation}\label{A->0} \lim_{n\to\infty}{\mathcal{A}}^{H+h_n}(v_n,\eta_n)= 0. \end{equation} Property (PO) is uniformly continuous at $H$, hence all the periodic orbits $v_n$ are contained in the compact set $K$. By requiring certain bounds on the derivatives for $h\in\widetilde{\mathcal{O}}(H)$, we can find an open subset $\mathcal{O}(H)\subset\widetilde{\mathcal{O}}(H)$ where the following uniform bounds are satisfied: \begin{equation}\label{DX_(H+h)} \sup_{h\in \mathcal{O}(H)\cap C_c^\infty(K)}\sup_{K}\|DX_{H+h}\|<+\infty. \end{equation} As $\Sigma$ is of contact type there exists a Liouville vector field $Y$, such that $dH(Y)>0$ on $\Sigma$. In particular, we can assume the existence of an open neighbourhood $\mathcal{U}$ of $\Sigma$ and of a constant $\delta'>0$, such that \[ \inf_{U\cap K} dH(Y)>\delta'>0. \] By possibly shrinking $\mathcal{O}(H)$, we can assume that for all $h\in \mathcal{O}(H)\cap C_c^\infty(K)$ we have $(H{+}h)^{-1}(0)\cap K \,\subseteq\, U\cap K$ and \[ \inf_{U\cap K} d(H{+}h)(Y)>\frac{\delta'}{2}. \] Thus we obtain $\displaystyle \qquad{\mathcal{A}}^{H+h_n}(v_n,\eta_n)=\eta_n\int_{S^1} d_{v_n}(H{+}h_n)(Y)>\frac{\eta_n \delta'}{2}$.\medskip\\ With (\ref{A->0}), we conclude that $\lim_{n\to \infty}\eta_n=0$. On the other hand, as $(v_n,\eta_n)\in {\operatorname{Crit}}^+({\mathcal{A}}^{H+h_n})$, we get uniform bounds on the derivative of $v_n$ \[ v_n(t)\in K, \qquad \|\partial_tv_n(t)\|\leq |\eta_n|\sup_{K}\|X_{H+h_n}\|\quad \forall\ n\in {\mathbb N},\ t\in S^1. \] This allows us to use the Arzel{\'a}-Ascoli theorem, which yields a convergent subsequence (which we denote the same) \[ \lim_{n\to\infty}(v_n,\eta_n)=(x,0)\in \Sigma{\times}\{0\}. \] Let $x\in\mathcal{V} \subseteq M,\; \varphi \,\colon \mathcal{V}\to{\mathbb R}^{2m}$ be a coordinate chart around $x$. For $n$ big enough we can assume $v_n(S^1)\subseteq \mathcal{V}$. Then $x_n \coloneqq \varphi \circ v_n$ satisfies the respective Hamiltonian equation $\partial_tx_n=\eta_n D\varphi^{-1}(X_{H+h_n})(x_n)$. Hence $\partial_{tt}x_n=\eta_n D\big(D\varphi^{-1}(X_{H+h_n})\big)(\partial_tx_n)$. However, from Remark \ref{rem:C2small} we can infer that \[ \eta_n \big\|D\left(D\varphi^{-1}(X_{H+h_n})\right)\big\|\geq 2\pi, \] which together with \eqref{DX_(H+h)} contradicts $\lim_{n\to \infty}\eta_n= 0$. \end{proof} Fix a strongly tentacular Hamiltonian $H \colon T^*\mathbb{R}^n\to \mathbb{R}$ and let $\mathcal{O}(H)$ be an open neighbourhood of $0$ in $C_c^\infty(T^*{\mathbb R}^n)$, such that all Hamiltonians from $H+\mathcal{O}(H)$ are strongly tentacular and $\mathcal{O}(H)$ is as in Lemma \ref{lem:delta1}. Fix sets $K\subseteq \mathcal{V}\subseteq T^*{\mathbb R}^n$, such that $K\neq \emptyset$ is compact and $\mathcal{V}$ is open and precompact. Let $\delta>0$ be a constant as in Lemma \ref{lem:delta1}; let ${\mathfrak y}\in (0,\delta)$ and let $0<\varepsilon_{0},\, \tilde{c}<\infty$ be constants as in \cite[Lem.\ 2.1]{pasquotto2017} depending only on $H$. Finally, fix $h_\pm\in \mathcal{O}(H)\cap C^\infty_c(K)$ and let $$ \mathbb{R}\ni s\longmapsto (H_s,J_s)\in \big(H+\mathcal{O}(H)\big)\times \mathcal{J}(\mathcal{V}{\times}({\mathbb R} \setminus [-{\mathfrak y},{\mathfrak y}]), \mathbb{J}), $$ be a smooth homotopy of Hamiltonians and $\omega$-compatible almost complex structures, constant outside of $[0,1]$, such that $H_s=H+h_-$ for $s\leq 0$ and $H_s=H+h_+$ for $s\geq 1$. In this setting we formulate the following lemma: \begin{lem}\label{lem:delta2} Let $(v^\pm,\eta^\pm)$ be a pair of critical points of ${\mathcal{A}}^{H+h_\pm}$. If the homotopy $\{H_s,J_s\}_{s\in{\mathbb R}}$ satisfies \begin{equation} \|\partial_{s}H_{s}\|_{L^{\infty}}<\min \left\lbrace \frac{\varepsilon_{0}}{8\big(\tilde{c}\varepsilon_0+\|J\|_{L^{\infty}}^{3/2}\big)},\frac{7\delta}{16\tilde{c}(1+\delta)}\right\rbrace, \label{Hs} \end{equation} and if $u$ is a solution to the equation $\partial_s u=\nabla_{J_s}{\mathcal{A}}^{H_s}(u)$ with $\displaystyle\lim_{s\to\pm\infty}u(s)=(v^\pm,\eta^\pm)$, then ${\mathcal{A}}^{H+h_-}(v^-,\eta^-)>\delta$ implies ${\mathcal{A}}^{H+h_+}(v^+,\eta^+)>\delta$. \end{lem} \begin{proof} The following proof is an adjustment of the proof of \cite[Cor.\ 3.8]{CieliebakFrauenfelder2009} to the setting of strongly tentacular Hamiltonians and is based on the results proven in \cite[Prop.\ 3.3]{pasquotto2017}. Abbreviate \[ a \coloneqq {\mathcal{A}}^{H+h_-}(v^-,\eta^-),\qquad b \coloneqq {\mathcal{A}}^{H+h_+}(v^+,\eta^+). \] By assumption $a\geq \delta$. Let $u=(v,\eta)\in C^{\infty}\big(\mathbb{R}, C^{\infty}(S^{1}, T^*{\mathbb R}^n) {\times} \mathbb{R}\big)$ be a solution to the equation $\partial_s u=\nabla_{J_s}{\mathcal{A}}^{H_s}(u)$ with $\lim_{s\to\pm\infty}u(s)=(v^\pm,\eta^\pm)$. Then our setting satisfies the assumptions of \cite[Prop. 3.3]{pasquotto2017}. First assume additionally $|b|\leq a$. Then $b-a\leq 0$ and \cite[Prop.\ 3.3, eq.\ (3.7)]{pasquotto2017} gives \begin{align} \|\eta\|_{L^{\infty}(\mathbb{R})} & \leq \frac{8}{7} \left(\tilde{c}\Big(\max\{|a|, |b|\}+1\Big)+\frac{b-a}{\varepsilon_{0}}\|J\|_{L^{\infty}}^{\frac{3}{2}}\right)\nonumber\\ & \leq \frac{8}{7} \tilde{c}(a+1)\leq a \tilde{c}\frac{8}{7}\left(1+\frac{1}{\delta}\right)\label{eta} \end{align} On the other hand, by equation (3.5) from the proof of \cite[Prop. 3.3]{pasquotto2017}, we have that \begin{equation} \|\partial_{s}u\|_{L^{2}(\mathbb{R}\times S^{1})}^{2} \leq \|J\|_{L^{\infty}} (b-a + \|\eta\|_{L^{\infty}}\|\partial_{s}H_{s}\|_{L^{\infty}}). \label{partialU} \end{equation} Combined with \eqref{eta} and \eqref{Hs}, we obtain the following estimate: \[ b\geq a - \|\eta\|_{L^{\infty}(\mathbb{R})}\|\partial_{s}H_{s}\|_{L^{\infty}}\geq a \left(1- \tilde{c}\frac{8}{7}\Big(1+\frac{1}{\delta}\Big)\|\partial_{s}H_{s}\|_{L^{\infty}}\right)\geq \frac{1}{2}a. \] In particular, ${\mathcal{A}}^{H+h_-}(v^-,\eta^-)=b>0$. By assumption $h_-\in \mathcal{O}(H)\cap C_c^\infty(K)$, hence by Lemma \ref{lem:delta1} we can conclude that ${\mathcal{A}}^{H+h_-}(v^-,\eta^-)\geq \delta$. This implies the result provided $|b|\leq a$. Now assume $b<-a$. Then $b-a\leq 0$ and by \cite[Prop.\ 3.3, eq.\ (3.7)]{pasquotto2017} we have \begin{align} \|\eta\|_{L^{\infty}(\mathbb{R})} & \leq \frac{8}{7} \left(\tilde{c}\Big(\max\{|a|, |b|\}+1\Big)+\frac{b-a}{\varepsilon_{0}}\|J\|_{L^{\infty}}^{\frac{3}{2}}\right)\nonumber\\ & \leq \frac{8}{7} \tilde{c}(1-b) \leq -b \tilde{c}\frac{8}{7}\left(1+\frac{1}{\delta}\right), \end{align} where the last inequality comes from the assumption $-b\geq a\geq \delta$. Combining it with \eqref{partialU} and \eqref{Hs}, we obtain the following inequality: \begin{align*} a \leq b + \|\eta\|_{L^{\infty}(\mathbb{R})}\|\partial_{s}H_{s}\|_{L^{\infty}} \leq b\left( 1- \tilde{c}\frac{8}{7}\Big(1+\frac{1}{\delta}\Big)\|\partial_{s}H_{s}\|_{L^{\infty}}\right)\leq \frac{1}{2}b< -\frac{1}{2}a, \end{align*} which contradicts the assumption $a>\delta>0$. That excludes $b<-a$ and proves the lemma. \end{proof} \begin{proof}[Proof of Theorem \ref{thm:posRFHtent}:] Let us fix a Hamiltonian $H \in \mathcal{H}$. By \cite[Lem.\ 8.8]{pasquotto2018} and \cite[Lem.\ 8.9]{pasquotto2018} for every two close enough regular couples $(H{+}h_1,J_1)$, $(H{+}h_2,J_2)$ with $h_1,h_2\in C_c^\infty(T^*{\mathbb R}^n),\ J_1,J_2\in {\mathcal J}_\star$ and a homotopy $\Gamma=\{H{+}h_s,J_s\}_{s\in{\mathbb R}}$ of compactly perturbations $h_s$ of Hamiltonian $H$ and almost complex structures $J_s\in {\mathcal J}_\star$ one can construct a homomorphism \[ \phi^\Gamma \colon CF_*\left(H+h_1,f_1\right)\to CF_*\left(H+h_2,f_2\right), \] which is defined by counting the perturbed flow lines with cascades (cf.\ \cite[Sec.\ 11.1]{Audin2014}, \cite[Lem.\ 7.2]{pasquotto2018}). Moreover, $\phi^\Gamma$ satisfies $\phi^\Gamma\circ \partial_1= \partial_2 \circ \phi^\Gamma$, thus induces a homomorphism on the homology level \[ \Phi^\Gamma \colon RFH(H+h_1,J_1)\to RFH(H+h_2,J_2). \] Moreover, by Lemma \ref{lem:delta2} we know that if the two regular couples $(H{+}h_1,J_1),\linebreak[1](H{+}h_2,J_2)$ are close enough, then the preimage of $CF_*^+(H{+}h_2,f_2)$ under $\phi^\Gamma$ lies in $CF_*^+(H{+}h_1,f_1)$. In other words \begin{equation}\label{phiGamma} \phi^\Gamma\left(CF^{\leq 0}\left(H+h_1,f_1\right)\right)\subseteq CF^{\leq 0}\left(H+h_2,f_2\right). \end{equation} This together with \eqref{filtration} allows us to infer that the restriction $\phi^\Gamma_+$ of $\phi^\Gamma$ to\linebreak[4] $CF_*^+\left(H{+}h_1,f_1\right)$ constructed by counting the perturbed flow lines with cascades between critical points with positive action, commutes with the respective boundary operators $\partial^{\scriptscriptstyle +}_1$ and $\partial^{\scriptscriptstyle +}_2$ and thus induces a homomorphism $\Phi^\Gamma_+ \colon RFH^+(H{+}h_1,J_1)\to RFH^+(H{+}h_2,J_2)$. Now, we show that $\Phi^\Gamma_+$ is an isomorphism, using the fact that $\Phi^\Gamma$ is an isomorphism by \cite[Prop.\ 11.2.9]{Audin2014}. Via the inverse homotopy $\Gamma^{-1}=\{H{+}h_{1-s},J_{1-s}\}_{s\in{\mathbb R}}$, one can construct analogously a homomorphism \[ \phi^{\Gamma^{-1}} \colon CF_*\left(H+h_2,f_2\right)\to CF_*\left(H+h_1,f_1\right). \] As this homomorphism also satisfies $\phi^{\Gamma^{-1}}\circ \partial_2 = \partial_1 \circ \phi^{\Gamma^{-1}}$ and \begin{equation} \phi^{\Gamma^{-1}}\left(CF^{\leq 0}\left(H+h_2,f_2\right)\right) \subseteq CF^{\leq 0}\left(H+h_1,f_1\right),\label{phiGamma-1} \end{equation} it induces a homomorphism $\Phi^{\Gamma^{-1}}_+ \colon RFH^+(H{+}h_2,J_2)\to RFH^+(H{+}h_1,J_1)$. Finally, by \cite[Prop.\ 11.2.9]{Audin2014} there exists a homomorphism \begin{fleqn} \begin{align} S \colon CF_*\left(H+h_1,f_1\right) &\to CF_{*+1}\left(H+h_1,f_1\right),\notag\\ \text{satisfying}\mspace{100mu} \phi^{\Gamma^{-1}}\circ \phi^\Gamma- \operatorname{Id} & = S\circ \partial_1+\partial_1\circ S\label{S1}\\ \text{and} \mspace{80 mu} S \left(CF^{\leq 0}\left(H+h_1,f_1\right)\right) & \subseteq CF^{\leq 0}\left(H+h_1,f_1\right),\label{S2} \end{align} \end{fleqn} where \eqref{S2} comes from applying Lemma \ref{lem:delta2} once again this time to the flowlines with cascades coming from a homotopy of homotopies (cf.\ \cite[Thm.\ 11.3.11]{Audin2014}). By combining \eqref{filtration}, \eqref{phiGamma}, \eqref{phiGamma-1} and \eqref{S2} we infer that the restriction of $S$ to $CF^+\left(H{+}h_1,f_1\right)$ also satisfies \eqref{S1} with $\phi^\Gamma_+$ and $\phi^{\Gamma^{-1}}_+$, thus establishing that $\Phi^\Gamma_+$ and $\Phi^{\Gamma^{-1}}_+$ are also isomorphisms on the homology level. This proves that $RFH^+(H)$ is invariant under small enough\footnote{The invariance for any compact perturbation follows by splitting a given perturbation into a sequence of smaller perturbations (see \cite{CieliebakFrauenfelder2009}, p.\ 275)} compactly supported perturbations of $H$ and (via $h_1{=}h_2{=}0$) is invariant of $J$ or $(f,g)$. \end{proof} \subsection{Automatic transversality.}\label{sec:trans} If the space $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0 ,\Lambda)$ contains no stationary solutions, transversality can be achieved for generic choices of almost complex structures. This is a standard -- albeit, difficult -- argument, which involves no new ideas not already present in the proof that the moduli spaces defining the Rabinowitz Floer complex are generically transverse (see for instance \cite[Thm.\ 4.11]{AbbonMerry2014} or \cite[Thm.\ 2]{Wisniewska2017} for the non-compact case). We therefore omit the proof. The case where $\mathcal{M}_{\operatorname{hyb}}(\Lambda_0 ,\Lambda)$ admits stationary solutions is somewhat less standard, however. In the presence of stationary solutions it is not possible to obtain regularity by perturbing $J$, and one must therefore prove transversality ``by hand''. This is the content of the following section. Fix $\eta\in \operatorname{CritVal}({\mathcal{A}}^{H_0})=\operatorname{CritVal}({\mathcal{A}}^H)$ and let $\Lambda_0^\eta \subseteq {\operatorname{Crit}}({\mathcal{A}}^{H_0})$ and $\Lambda^\eta \subseteq {\operatorname{Crit}}({\mathcal{A}}^H)$ be the corresponding connected components of the respective critical sets. Then $\mathcal{M}_{\operatorname{hyb}}( \Lambda_0^\eta , \Lambda^\eta)$ consists entirely of stationary solutions by Lemma \ref{lem:stationary} and \begin{equation}\label{eq:LambdaLambda} \begin{aligned} \text{for }\eta\neq 0 \colon \qquad \mathcal{M}_{\operatorname{hyb}}(\Lambda_0^\eta,\Lambda^\eta)&\cong \Lambda_0^\eta\cong \Lambda^\eta,\\ \text{for }\eta= 0 \colon \qquad \mathcal{M}_{\operatorname{hyb}}(\Lambda_0^\eta,\Lambda^\eta)&\cong \Sigma_0\times\chi_0, \end{aligned} \end{equation} where $\chi_0\subset T^\ast{\mathbb R}^{n-k}$ denotes the 0-section. \begin{prop}\label{prop:trans}~ \begin{enumerate}[label=\emph{(\roman*)}] \item \label{at2} The problem $ \mathcal{M}_{\operatorname{hyb}}( \Lambda_0^\eta,\Lambda^\eta )$ is always transversly cut out. \item \label{at1} The kernel of the linearisation $D\bar{\partial}$ of the problem $ \mathcal{M}^{\operatorname{hyb}}( \Lambda_0^{-\eta},\Lambda^\eta)$ (see \eqref{eq:Banach-sec}) at a stationary solution $(w,\xi)\in\mathcal{M}^{\operatorname{hyb}}( \Lambda_0^{-\eta},\Lambda^\eta)$ has dimension $\frac{1}{2}(\dim\Lambda+\dim\Lambda_0)$. \end{enumerate} \end{prop} \begin{proof}[Proof of Proposition \ref{prop:trans}] The proof presented below is an adjustment of \cite[Lem. 4.14]{AbbonMerry2014} to our setting. Note that part \emph{\ref{at2}} is an immediate corollary of part \emph{\ref{at1}}. Indeed, by the correspondence \eqref{bijection}, we have that $\mathcal{M}_{\operatorname{hyb}}( \Lambda_0^\eta,\Lambda^\eta)$ is transversely cut out if and only if $\mathcal{M}^{\operatorname{hyb}}( \Lambda_0^{-\eta},\Lambda^\eta)$ is transversely cut out. The latter holds if and only if the operator $D\bar{\partial}$ is surjective at $(w,\xi)$. Now, $D\bar{\partial}$ is a Fredholm operator of index $\frac{1}{2}(\dim\Lambda+\dim\Lambda_0)$ by Theorem \ref{thm-index} (see also \eqref{dimM}), as $\mu^{\operatorname{tr}}_{\operatorname{CZ}}(\Lambda_0)=\mu^{\operatorname{tr}}_{\operatorname{CZ}}(\Lambda)$ by Proposition \ref{prop:muCZ}. Part \emph{\ref{at1}} tells us that $ \dim \ker D\bar{\partial} = \frac{1}{2}(\dim\Lambda+\dim\Lambda_0)$. Thus $D\bar{\partial}$ is surjective, as required. Fix $(w,\xi) \in \mathcal{M}^{\operatorname{hyb}}( \Lambda_0^{-\eta},\Lambda^\eta)$ and let $(z, \zeta)\in \ker\big(D_{(w,\xi)}\bar{\partial}\big)$ be arbitrary, i.e.\ $(z,\zeta)$ is a solution to the linearised equation $D_{(w,\xi)}\bar{\partial}(z,\zeta)=0$. In the following, we write $w=(w_0,w_1,w_2)$ and $z=(z_0,z_1,z_2)$ with respect to the splitting $T^\ast{\mathbb R}^k\times T^\ast{\mathbb R}^n=T^\ast{\mathbb R}^k\times T^\ast{\mathbb R}^k\times T^\ast{\mathbb R}^{n-k}$. Denote $(x_0,x_1)\coloneqq \lim_{s\to+\infty}(w, \xi)(s)\in \Lambda_0^{-\eta}\times\Lambda^\eta$. Then $(z,\zeta)\in\mathcal{W}^{1,r}_{ \delta, L} \oplus W^{1,r}_{\delta, \Delta}\oplus T_{x_0}\Lambda_0^{-\eta} \oplus T_{x_1}\Lambda^\eta$ and satisfies explicitly \begin{equation} \label{b} \frac{d}{ds}(z_0,\zeta_0) + \nabla^2_{(w_0,\xi_0)} \mathcal{A}^{H_0}(z_0,\zeta_0) = 0, \qquad \frac{d}{ds}(z_1,z_2,\zeta_1) + \nabla^2_{(w_1,w_2,\xi_1)} \mathcal{A}^{H}(z_1,z_2,\zeta_1) = 0, \end{equation} the coupling conditions \begin{equation} \label{c} \zeta_1(0)=-\zeta_0(0), \qquad \forall\ t \in S^1 \colon \quad z_0(0,t)= D\rho[ z_1(0,t)],\quad z_2(0,t) \in T\chi_0, \end{equation} and the asymptotic conditions \begin{equation} \label{d} \lim_{s \to + \infty } (z, \zeta)(s) =(y_0,y_1)\in T_{x_0}\Lambda_0^{-\eta} \times T_{x_1}\Lambda^\eta. \end{equation} To prove part \emph{\ref{at1}}, we show that any solution $(z,\zeta)$ of $D_{(w,\xi)}\bar{\partial}(z,\zeta)=0$ is constant. Then, we have by \eqref{d} that $(z,\zeta)=(y_0,y_1)\in T_{x_0}\Lambda_0^{-\eta} \oplus T_{x_1}\Lambda^\eta$, which implies with the coupling condition \eqref{c} and with \eqref{eq:LambdaLambda} that the space of such $(z,\zeta)$ has dimension $\frac{1}{2}(\dim\Lambda+\dim\Lambda_0)$. First recall that the second derivative of the functional $\mathcal{A}^{H}$ at a loop $(v,\eta)$, is a symmetric, bilinear operator on $W^{1,2}(S^{1},v^*T^*{\mathbb R}^n)\times \mathbb{R})$ given by: \begin{equation}\label{d2AH} d^2_{(v,\eta)}\mathcal{A}^{H} ((\xi, \sigma),(\xi, \sigma)) = \int \omega(\xi,\partial_{t}\xi) - \eta\int \operatorname{Hess}_{v} H(\xi,\xi) -2\sigma\int dH(\xi). \end{equation} We define a function $\varphi \colon [0,+\infty)\to {\mathbb R}$ in the following way: \[ \varphi(s)\coloneqq \big\|\big(z(s, \cdot),\zeta(s)\big)-(y_0,y_1)\big\|^2_{L^2(S^1)}. \] By assumption $\varphi \in L^r_\delta([0,+\infty),{\mathbb R})$. As $\mathcal{A}^H$ and $\mathcal{A}^{H_0}$ are Morse-Bott (cf.\ \eqref{eq:MorseBott}), we have $(y_0,y_1)\in T_{x_0}\Lambda_0^{-\eta} \times T_{x_1}\Lambda^\eta=\ker \nabla^2_{x_0}\mathcal{A}^{H_0}\oplus\ker\nabla^2_{x_1}\mathcal{A}^H$ and hence\footnote{Observe that $(w_0,\xi_0)\equiv x_0$ and $(w_1,w_2,\xi_1)\equiv x_1$ for all $s\in [0,\infty)$.} \begin{align*} \varphi'(s) & = 2 \left( d^2_{(w_0,\xi_0)}\mathcal{A}^{H_0} ((z_0, \zeta_0),(z_0, \zeta_0)) + d^2_{(w_1,w_2,\xi_1)}\mathcal{A}^H ((z_1, z_2, \zeta_1),(z_1, z_2, \zeta_1)) \right), \\ \varphi''(s) & = 4 \left(\left\|\nabla^2_{(w_0,\xi_0)} {\mathcal{A}}^{H_0}(z_0, \zeta_0)\right\|^2 + \left\|\nabla^2_{(w_1,w_2,\xi_1)} {\mathcal{A}}^H(z_1,z_2, \zeta_1)\right\|^2\right)\geq 0. \end{align*} Thus on one hand $\varphi''(s)\geq 0$ and $\varphi$ is convex and on the other hand $\lim_{s\rightarrow\infty}\varphi (s)=0$. That implies that either $\varphi'(0)<0$ or $\varphi'(0)=0$ and $\varphi$ is constant, equal to 0 everywhere. We will show that $\varphi'(0)=0$, which implies that $(z,\zeta)$ is constantly equal to $(y_0,y_1)$. First, we show that \begin{equation}\label{d2AH1=0} d^2_{(w_2,\xi_1)}\mathcal{A}^{H_1} (( z_2, \zeta_1),(z_2, \zeta_1))\big|_{s=0}=0. \end{equation} Recall from the coupling conditions \eqref{eq-w-second} and \eqref{c} that $w_2(0,t)\in\chi_0$ and $z_2(0,t)\in T\chi_0$ for all $t\in S^1$. Writing \eqref{d2AH1=0} in the form \eqref{d2AH} as 3 integrals, we find that the first integral vanishes, as $\chi_0$ is a Lagrangian submanifold of $\left(T^*\mathbb{R}^{n-k},\omega_{n-k}\right)$. On the other hand, for every $x\in \chi_0$ we can identify $T_x\chi_0$ with $\mathbb{R}^{n-k}\times\{0\}$ and therefore by \eqref{defH} for every $y\in T_x\chi_0$ we have \[ \operatorname{Hess}_x H_1(y,y)=y^TA_1y=2 H_1(y)=0, \] since $\chi_0 \subseteq H_1^{-1}(0)$ by Remark \ref{H2}. Consequently, the second integral in \eqref{d2AH} vanishes. Analogously, $T\chi_0\subseteq TH_1^{-1}(0)=\ker(dH_1)$, hence the third integral in \eqref{d2AH} also is $0$. This proves \eqref{d2AH1=0}. Next we will show that \[ \left( d^2_{(w_0,\xi_0)} \mathcal{A}^{H_0} ((z_0, \zeta_0),(z_0, \zeta_0)) +d^2_{(w_1,\xi_1)}\mathcal{A}^H ((z_1, \zeta_1),(z_1, \zeta_1))\right)\Big|_{s=0}=0. \] Observe that by the coupling conditions \eqref{eq-w-second} and \eqref{c} we have for all $t\in S^1$ that $w_0(0,t) = \rho \circ w_1(0,t)$ and $z_0(0,t) = D\rho[ z_1(0,t)]$ and hence \[ d^2_{(w_0,\xi_0)} \mathcal{A}^{H_0} ((z_0, \zeta_0),(z_0, \zeta_0))\Big|_{s=0} = d^2_{(\rho \circ w_1,-\xi_1)}\mathcal{A}^H ((D\rho[z_1], -\zeta_1),(D\rho[z_1], -\zeta_1))\Big|_{s=0} \] Thus, the first corresponding integrals in \eqref{d2AH} have opposite signs, since $\rho$ is anti-symplectic. The second integrals in \eqref{d2AH} have opposite signs, since $\xi_0(0)=-\xi_1(0)$ and $H_0 \circ \rho = H_0$ and thus $\operatorname{Hess} H_0(D\rho\, \cdot\,, D\rho\, \cdot\, )= \operatorname{Hess} H_0$. The third integrals in \eqref{d2AH} have opposite signs, since $\zeta_0(0)=-\zeta_1(0)$ and for every $(x,y)\in T{\mathbb R}^k, \ dH_{\rho (x)}(D\rho[y])=dH_x(y)$. Consequently $\varphi'(0)=0$. \end{proof}
\section{Introduction} Flash floods are among the most destructive surface processes around the world, especially in mountainous areas \citep{au1998,borga2011,gomez2005a,jonkman2005}. They are mainly initiated by rapid and intense rainfall, often discharged in few hours \citep[e.g.,][]{borga2007,Bout2018,he2018,loczy2012}, and by complex interactions of the climatic conditions with topography and hydrology \citep[e.g.,][]{hatheway2005}. Because of the very rapid raise in water levels caused by flash floods, it is challenging to take timely and effective actions to contain the associated damage. Flash flood disasters are essentially flash floods that have caused losses either in terms of human lives or economy, or both \citep{gaume2009,jonkman2005analysis,kelman2004}. In China, approximately 70\% of the total area is covered by mountains and hills, which exposes a substantial surface of the national territory to flash flood disasters' risk \citep{liu2018}. Additionally, the more frequent extreme precipitation associated with climate change has increased the number of flash flood disasters in recent decades \citep{sampson2015}. Historical inventories of flash flood disasters are a precious source of information allowing to investigate their spatiotemporal pattern distribution and evolution. Furthermore, this information can be related with the geomorphological setting of the area and the climatic/meteorological conditions to detect triggering factor, highlight the more vulnerable areas, and to prevent and forecast their effects in the future. The susceptibility to hydro-geomorphological processes is commonly assessed by considering only the spatial distribution of observed events \citep{cama2015predicting,cama2017improving,santangelo2012,zaharia2017}. However, this is purely a convenient assumption from the modeling perspective. Recently, a growing amount of evidence indicates that these events tend to aggregate in space conditioned by the temporal variability, attesting for an interaction between space and time on event frequency and distribution \citep{GARIANO2016227,kouli_landslide_2010,nhess-15-2127-2015,merz2016, tonini2019}. In other words, when an event occurs at a specific location, a temporary increase in the probability that other events will cluster at nearby locations should be accounted for. This increase in probability can be captured through clustering analyses and various examples already exist in literature where this has been done at different spatial and temporal scales and via different analytical approaches. Notably, this type of application spans in many areas of natural hazards and have become mainstream in case of seismicity \citep[e.g.,][]{fischer2003,GEORGOULAS20134183, varga2012,woodward2018, yang_spatial-temporal_2019}, joint sets and their orientation in rock outcrops \citep[e.g.,][]{tokhmechi2011,zhan2017comprehensive}, groundwater monitoring \citep{chambers2015}, wildfires \citep[e.g.,][]{orozco2012, costafreda2016,fuentes2013,tonini2017}, and landslides \citep[e.g.,][]{Lombardo.etal:2018,lombardo2019geostatistical,tonini2019}. In the specific case of flooding, \citet{zhao2014} used the projection pursuit theory to cluster spatial data and to build a dynamic risk assessment model for flood disasters. Moreover, \citet{renard2017} detected flood vulnerability accounting for clustering effects in key areas with high flood risk. \citet{pappada2018} also investigated the flood risks in a given region and identified clusters where the floods show a similar behavior with respect to multivariate criteria. Another example can be found in \citet{merz2016} where the authors analyzed the inter-annual and intra-annual flood clustering in Germany. All these examples confirm a substantial scientific interest in recent years dedicated to investigate the clustering behaviors of flash floods and the associated risk; and, more generally, to concurrently analyze their spatial and temporal persistence. However, despite the scientific efforts, detecting flash flood patterns at long temporal scale is still scarce in literature, mainly because of technical limitations. In fact, limited information and records are available in digital form reporting locations and dates of flash flood (and flash flood disasters), especially over long periods. Nevertheless, very recent advances in data collection and sharing techniques are gradually filling this gap, and an increasing number of databases are being published and made available to the scientific community with the records of historical and hydro-geomorphological disasters at the global, continental, or regional scale over long periods \citep{archer2019,de2019,gourley2013,haigh2017,nowicki2020,vennari2016,wood2020}. Typically, flash flood disasters (as many other hydro-geomorphological disasters) can be considered as a stochastic point processes \citep{stoyan2006} acting in both spatial and temporal dimensions \citep[e.g.,][]{lombardo2019space}. Point patterns can be analyzed in terms of their random distribution, dispersion and clustering behaviour \citep{merz2016,tonini2019}. Several methods can be implemented to deal with stochastic properties. Some classic models, such as Moran’s I \citep{moran1950}, Ripley’s K-function \citep{ripley1977}, fractal dimension \citep{lovejoy1986}, and Allan factor \citep{allan1966}, have been used to detect clustering behaviour in space and in time. Representative models for local clustering analysis (i.e. allowing to detect clusters and their specific location) include Geographical Analysis Machine \citep[GAM,][]{openshaw1987}, Turnbull’s Cluster Evaluation Permutation Procedure \citep[CEPP,][]{turnbull1990}, Scan Statistics \citep{kulldorff1997}, and DBSCAN \citep{ester1996}. For flash floods, which are triggered by storms, the temporal dependency among persistent events is mainly driven by climatic and meteorological conditions. However, global cluster indicators only take into consideration one dimension, disregarding the interaction between space and time. In this sense, spatiotemporal Scan Statistics is a good tool to detect clusters since it allows to identify statistically significant excess of observations thanks to a moving cylindrical window that scans all locations both in space and time \citep{kulldorff_evaluating_1998}. Therefore, it is especially useful to investigate hydro-geomorphological processes such as flash floods. For such phenomena, the detection of events aggregated over a given region and in a specific period, generally yields more informative results than the purely spatial or temporal analyses. Furthermore, understanding the magnitude of the persistence for flash floods is an important requirement to predict where, when and how their highest probability to occur distributes in the future. In this study, we explored the spatiotemporal pattern distribution of flash flood disasters which have caused either or both life and economic losses in China over the period 1950-2015. Firstly, the deviation of flash flood disasters from a spatiotemporal random process is explored by applying the spatiotemporal Ripley's K-function. Then, the Scan Statistics was applied to detect statistically significant spatiotemporal clusters. Finally, the possible relationship between the detected clusters and local climatic proxy factors is discussed. To the best of our knowledge, it is the first time that such a long-term inventory is analysed to explore the spatiotemporal patterns of flash flood disasters, especially in China. This study provide useful insights on flood dynamics over a large spatiotemporal domain. Moreover, because of the long time-span, results can be useful to indicate how flash flood disasters have evolved in response to climate changes. \section{Material and methods} \subsection{Data description} \subsubsection{Study area} China lies between latitudes 18$^\circ$ and 54$^\circ$ N, and longitudes 73$^\circ$ and 135$^\circ$ E. With an area of about 9.6 million square kilometers, it is the world's third-largest country. The landscape varies significantly across this vast area, ranging from the Gobi and Taklamakan deserts in the north to the subtropical forests in the wetter south. The eastern plains and southern coasts are the location of most of China's agricultural land and settlements. The southern areas consist of hilly and mountainous terrain. The west and north of the country are dominated by sunken basins (such as the Gobi and the Taklamakan desert), towering massifs and rolling plateaus, including part of the highest tableland on earth, the Tibetan Plateau. Based on its topography, China can be divided into six homogeneous geomorphological macro-regions \citep{wang2020geomorphological}: eastern plain, southeastern hills, southwestern mountains, north-central plains, northwestern basins and Tibetan Plateau. Mountains (33\% of the territory), plateaus (26\%) and hills (10\%) account together for nearly 70\% of the entire surface. Influenced by the East Asian summer monsoon and the geomorfologic settings, the climatic condition across the whole country varies considerably. In general, the wet season in China lasts from May to September \citep{song2011rain}. In the Eastern area, the annual rainfall decreases from south to north with an average annual precipitation that ranges from 250 to 750 $mm$ \citep{zhang2007climate}. In the west and central part of North China, due to its far distance away from ocean, the climate tends to be more arid and the landscape transitions to large deserts. The Tibetan plateau is characterized by wet and humid summers with cool and dry winters. More than 60–90\% of the annual total precipitation falls between June and September \citep{xu2008decadal}. \begin{figure}[t!] \centering \includegraphics[width=\linewidth]{FIGURE1.jpg} \caption{Distribution of flash flood disasters and background setting of China.} \label{Figure1} \end{figure} \subsubsection{Flash flood disasters inventory} The dataset used in this study has been collated and made accessible for the present research as part of a national effort carried out by the Chinese Institute of Water Resources and Hydropower Research \citep{liu2018}. It reports flash flood occurrences in China since 1950 until 2015 together with available information, namely longitude and latitude, date, fatalities and economic losses. Due to the lack of specific terminology and/or detailed descriptions of the disaster process in the database, the data does not differentiate the initial mechanism, be it water floods or debris floods/flows \citep[e.g.,][]{fernandez2010,gartner2014}. The only common information is that for each specific case, a large amount of overland flows, mixed with an unspecified solid fraction, rapidly flooded a given area with disastrous effects \citep[e.g.,][]{chang2011,pierson1987}. To better understand the spatiotemporal dynamics of flash flood and associated disasters, as well as the relationship with the triggering factors, the date of occurrence is of vital importance. Therefore, for consistency reasons, we considered only the records whose metadata contained a full temporal description (year-month-day) resulting in a subset of 32,473 flash flood disasters (accounting for 68\% of the entire dataset) precisely located in space and time (Figure \ref{Figure1}). We further defined the impact of flash flood disasters as the combination of fatalities and economic losses (see Table \ref{Table1}), and we refer to this classification throughout the manuscript. \begin{table}[H] \centering \caption{Impact of flash flood disasters (RMB = renminbi, the official currency of China).} \includegraphics[width=0.7\linewidth]{Table1.pdf} \label{Table1} \end{table} \subsection{Methodological overview}\label{methods} \subsubsection{Spatiotemporal K-function} The Ripley’s K-function ($K_{(s)}$) is largely applied in environmental studies to analyse the pattern distribution of spatial point processes and to detect deviation from spatial randomness. $K_{(s)}$ allows to determine if a set of mapped punctual events show a random, dispersed or cluster distribution pattern over increasing distance values \citep{ripley1977}. It is computed as the ratio between the expected number of events falling at a distance $r$ from an arbitrary event and the average number of points per unit area, corresponding to the intensity of the spatial point process ($\lambda$). In the same way, it is possible to define the temporal K-function ($K_{(t)}$) allowing to asses for the randomness of events in time. The spatiotemporal K-function ($K_{(s,t)}$) is a generalization of the univariate Repley’s K-function which allows to test for the independence between two variables, space ($s$) and time ($t$). Therefore, the $K_{(s,t)}$ is a suitable tool to investigate the clustering behaviour of a set of events occurred in a given area at a given time. For a point process $X$ with intensity $\lambda$, according to equation \ref{eq:EQ1}, it is defined as the number of expected further events ($E$) occurring within a distance $r$ and time $t$ from an arbitrary event $u$, where $a$ define the contouring circle. \begin{equation}\label{eq:EQ1} K_{(s,t)} = 1/\lambda \times E[n(X \cap a(u,r,t){u})| u \in X] \end{equation} To illustrate the interaction between space and time, it can be useful to evaluate the value $D_{(s,t)}$, defining the difference between the spatiotemporal K-function and the product of the purely spatial and the purely temporal K-function (see equation \ref{eq:EQ2}). \begin{equation}\label{eq:EQ2} D_{(s,t)} = K_{(s,t)} - K_{(s)} \times K_{(t)} \end{equation} If space and time are independent variables, this value equals to zero. Otherwise, positive values of $D_{(s,t)}$ indicates the interaction among events in space and in time. In other words, events closer in space are more likely to occur in a closer time. On the contrary, the negative values means a dispersed pattern. In this study, spatiotemporal K-function analyses were performed with the package ``Spatial and Space-Time Point Pattern Analysis'' \citep[splancs,][]{rowlingson2017} in R \citep{team2019r}. \subsubsection{Spatiotemporal scan statistics} Scan statistic was originally developed by \citet{naus_clustering_1965,naus_distribution_1965} to detect cluster in a one-dimensional point process. Subsequently \citet{kulldorff1997} extended this approach to multi-dimensional point process, introducing the use of scanning windows. The procedure was implemented into a free software, SaTScan\textsuperscript{TM} (\href{satscan.org}{satscan.org}) which can handle a purely spatial, purely temporal or spatiotemporal datasets and includes different probability models depending on the nature of the data and the scope of the research (e.g. for prospective or retrospective cluster detection). In the purely spatial case, the aim of scan statistics is the early detection of clusters, allowing one to map them and to assess their statistical significance. Moving windows scan the region increasing their radius up to a fixed limit ($R_{max}$) and count the number of events falling inside and outside the area. The probability that a window contains more observations than expected is assessed via the likelihood ratio, by comparing with the background population. Then, the null hypothesis of randomness is tested by Monte Carlo experiments, based on repeated random sampling. The spatiotemporal scan statistic use cylinders instead of circular windows, where the height of the cylinder account for the temporal dimension. In order to deal with flash foods, the retrospective spatiotemporal permutation scan statistics \citep[STPSS,][]{kulldorff_spacetime_2005} seems to be the most adequate model. Indeed, for environmental processes, the definition of the background population at risk needed for the statistical significance assessment of the detected clusters is quite problematic. STPSS assesses the expected number of cases using only the observed cases by permutation, supposing that each event has the same probability for all the times. Computationally, if $C$ is the total number of observer cases and $c_{zd}$ the number of cases observed in a zone $z$ and a day $d$, the expected number of cases per zone and day ($\mu_{zd}$) is: \begin{equation}\label{eq:mu_zd} \mu_{zd} = \frac1C\left(\sum_z c_{zd}\right) \left(\sum_d c_{zd}\right) \end{equation} It follows that, for a spatiotemporal cylinder $A$, the expected number of cases $\mu_A$ can be estimated as the sum of each $\mu_{zd}$ inside the cylinder $A$: \begin{equation}\label{eq:muA} \mu_A = \sum_{z\,,d\in A} \mu_{zd} \end{equation} If $C_A$ is the number of observed cases in $A$, considered as Poisson-distributed with mean $\mu_A$, the Poisson generalized likelihood ratio ($GLR$) can be computed as: \begin{equation}\label{eq:GLR} GLR = \left(\frac{c_{A}}{\mu_{A}}\right)^{c_{A}}\left(\frac{C - c_{A}}{C - \mu_{A}}\right)^{C - c_{A}} \end{equation} This ratio is calculated and maximized for every possible scanning cylinder. Then, the Monte Carlo simulations are performed and the statistical significance of the detected clusters is assigned by ranking the clusters according to their $GLR$-value. \section{Results} \subsection{Deviation from a random process} In the present study the spatiotemporal K-function is used to assess the interaction between the two variables, space and time, in generating clusters at increasing distances. Figure \ref{Figure2} (panel a) shows the 3D-plot of $D_{(s,t)}$ with a zoom up to 2000 $km$ (panel b). Positive values indicate that space and time interact in generating clusters: in other words, events closer in space are also closer in time. This is the case at any increasing distance, from hundred meters to thousands meters and from few years to decades. In addition, we computed the spatiotemporal K-function separately for the eastern and western side of China (Figure \ref{Figure3}). We did this because the southeastern area, which is the rainiest part of the country, is highly affected by flash floods, while the northwestern area is predominantly desert and flash floods are less frequent. It results that, although events are clustered in both the areas, in the southeastern area (panel a) clusters arise at a shorter spatial distance and closer in time than in the northwestern area (panel b). More specifically, in the southeast China the spatiotemporal interaction generates clusters starting from 200 $km$ and a plateau is reached at about 1800 $km$. In Northwest China the global cluster behaviour is more evident from about 1000 $km$ to higher distances. As regards the temporal dimension, the two part of the country show a similar cluster behaviour, with a strong attraction among events during the first 20 years lasting in time with a more relaxed clustering behaviour. To summarize, the spatiotemporal K-function reveals a deviation of flash flood disasters and associated spatiotemporal pattern distribution from a random process at specific scales, measured and quantified both in space, as distances-values, and in time, as yearly periods. These values can provide a useful indication to set up the parameters for further clustering algorithms, acting at local scale such as, for example, the spatiotemporal scan statistics. \begin{figure}[t!] \centering \includegraphics[width=\linewidth]{FIGURE2.jpg} \caption{Three dimensional summary of flash flood disasters in China during 1950-2015.} \label{Figure2} \end{figure} \begin{figure}[t!] \centering \includegraphics[width=\linewidth]{FIGURE3.jpg} \caption{Three dimensional summary of flash flood disasters in China, separated between two eastern and western sectors and with a maximum spatial bandwidth of 2000 $km$.} \label{Figure3} \end{figure} \subsection{Spatiotemporal clusters} \subsubsection{Cluster detection and spatial distribution}\label{Sec3.2.1} Scan statistics was performed to detect spatiotemporal clusters of flash flood disasters. The size and the duration of the detected clusters are influenced by the input parameters of the scanning windows, namely the maximum radius ($R_{max}$), the maximum temporal duration ($T_{max}$), and the time aggregation ($T_{agg}$). Indeed, values of $R_{max}$ exceeding the 50\% of the total area or, for $T_{max}$, the 50\% of the entire study period, can result in an exceptionally low rate outside the scanning window rather than detecting an exceptionally high rate inside. $T_{agg}$ is used to adjust the aggregation of the data over time and allows adjusting for cyclic temporal trends: for example, a time aggregation of one year automatically adjusts for the seasonal variability, while the contrary happen with monthly aggregations. Moreover, both spatial and temporal aggregations can highly reduce the computer processing time. Following the results obtained by the spatiotemporal K-function and discussed above, few radii for each area (southeast and northwest China) were tested. Performed analyses indicated that the effect onto the detected clusters were negligible and finally we considered the spatiotemporal distribution of flash flood disasters as a whole rather than splitting the Chinese territory in two areas. We opted for a set of possible combinations of $R_{max}$ and $T_{max}$, keeping $T_{agg}$ fixed to one year. More specifically, to compare the combination of these parameters, and to obtain reasonable clusters, we tested three $R_{max}$ values equal to 100, 200 and 300$km$, and three $T_{max}$ values equal to 1, 3 and 5 years. The choice for $R_{max}$ is corroborated by \citet{zhang2010} who report measurements constantly less than 500 $km$ for the radius of typical convective storms in the Chinese mainland, which can trigger flash floods. Results of STPSS for each of the nine combinations of these parameters are shown in Figure \ref{Figure4}. \begin{figure}[t!] \centering \includegraphics[width=\linewidth]{FIGURE4.jpg} \caption{Significant (p$<$0.005) spatiotemporal clusters of flash flood disasters in China during 1950-2015. } \label{Figure4} \end{figure} \begin{table}[H] \centering \caption{Number of detected spatiotemporal clusters of flash flood disasters in China during 1950-2015 using different parameters.} \includegraphics[width=0.4\linewidth]{Table2.pdf} \label{Table2} \end{table} The largest variation in the number of detected clusters is mainly associated with $R_{max}$ -- as $R_{max}$ increases, the detected flash flood disaster clusters exhibit a clear decrease -- rather than with $T_{max}$. This result is summarized in Table \ref{Table2}. More specifically, large $R_{max}$ values affect the detection of clusters acting at a fine scale, which tend to be missed or merged into larger ones; conversely, very large clusters, acting at a coarse spatial scale, are still detected. This is geographically visible in the south-easternmost sector of China (Figure \ref{Figure4}). Changes on $T_{max}$ have almost no effect on the number of clusters since, even allowing for a maximum duration of 5 years, almost all the clusters do not exceed one year. As complementary information, Table \ref{Table3} presents the temporal duration, expresses as start and end date, for the first ten clusters of flash flood disasters using $T_{max}$ equals to 3 years and for increasing values of $R_{max}$, equal to 100, 200 and 300 $km$. Results confirm that the cluster duration does not exceed one year. The most significant cluster was detected in 1975, while the rating for the following clusters can change in the three cases. Nevertheless, it is important to notice that the top-ten clusters are well distributed over the entire study period, with the oldest one detected between 1963 and 1969. \begin{table}[!htbp] \centering \caption{Temporal duration of the first 10 clusters of flash flood disasters detected via three different models (left: $R_{max}=100 km$; center: $R_{max} = 200 km$; right: $R_{max} = 300 km$)} \includegraphics[width=1\linewidth]{Table3.pdf} \label{Table3} \end{table} \subsubsection{Clusters characterization} Detected clusters where further analyzed by considering the impact of flash flood disasters. To this end, we examined only clusters detected by using $R_{max}=200 km$ and $T_{max}=3 years$. The choice of a $T_{agg}=1 year$ was originally meant to focus our analyses on effects that may exhibit a yearly cycle. However, this would have smoothed nested effects acting at the seasonal scale. For this reason, we opted to carry out additional analyses using a $T_{agg}$ of three months (hereafter referred as \emph{monthly model}). Results are shown in Figure \ref{Figure5} where information on the spatial distribution of the detected clusters is combined with the impact related to the single flash flood events (see Table \ref{Table1}). Overall, the clusters chiefly appear along the main river systems in China, namely the Yangtze, the Yellow, the Pearl and the Yarlung Zangbo Rivers. In addition, some clusters stand out on high mountains such as the Qinling-Daba and the Changbai Mountains. \begin{figure}[!htbp] \centering \includegraphics[width=\linewidth]{FIGURE5.jpg} \caption{Significant (p$<$0.005) spatiotemporal clusters of flash flood disasters in China during 1950-2015 ($R_{max}=200 km$, $T_{max}=3 years$, $T_{agg}=3 months$). Each event belonging to a single cluster is further resized as a function of its impact, in accordance to Table \ref{Table1}.} \label{Figure5} \end{figure} \begin{table}[!htbp] \centering \caption{Temporal duration of the first 10 clusters of flash flood disasters during 1950-2015 ($R_{max}=200km$, $T_{max}=1 year$, $T_{agg} = 3 months$).} \includegraphics[width=0.5\linewidth]{Table4.pdf} \label{Table4} \end{table} Forcing the model parameterization to aggregate the time over a fraction of the year (three months) allows us to investigate potential seasonal effects. Indeed, even if the maximum temporal duration is still of one year, looking at the ten most significant clusters detected under the \emph{monthly model} (Table \ref{Table4}), it results that all of them have a duration of three (six clusters) or six (four clusters) months. Notably, almost every cluster (nine clusters) encompass the period from July to September, with an earlier start date (in April) for the ones which have a longer duration. \subsubsection{Temporal duration of detected clusters} The temporal variation in the duration of the detected clusters could have been driven by the precipitation regime. In additional, space-time dependency may have been induced by the geomorphological setting of the area and by anthropogenic pressures, but these last factors should have a minor effect compared to the rainfall pattern, which acts as the primary triggering factor of flash floods. Therefore, in the present study we assume the precipitation as the main driver for flash floods detected clusters, and results are interpreted and discussed on the basis of this hypothesis. Allowing for $T_{max}=3 years$ in the parameterization of the \emph{yearly models}, the temporal duration of the detected clusters ranges from one to three years (see Figure \ref{Figure6}). The cluster detection pattern appears quite clear and well defined. However, since 1980 some clusters partially overlap. This can lead to two separate interpretations. Firstly, the relative small number of clusters detected between 1950 and 1980 may imply that the data acquisition and report in the Chinese database of hydro-morphological disasters was not fully operational at the time. Conversely, from 1980 to present days the Chinese database has evolved into a mature and detailed geographic information system. Secondly, the same pattern can be justified as a result of climatic changes. In fact, overlapping clusters of one, two and three years duration essentially appear only after 1980. These concurrent clusters may reflect similar synchronous variations of the climate settings and rainfall regimes across China in the recent period. \begin{figure}[H] \centering \includegraphics[width=\linewidth]{FIGURE6.jpg} \caption{Temporal duration of flash flood disasters clusters in China during 1950-2015 ($R_{max}=200km$, $T_{agg}=1 year$, $T_{max}=3 years$).} \label{Figure6} \end{figure} We summarized the same results for the \emph{monthly model} in Figure \ref{Figure7}. To better visualize the seasonality trend, we opted for a cyclic representation of the detected clusters, plotting their pattern in four temporal duration classes of 3, 6 and 9 months as well as one year. Most clusters show a 3-months duration, concentrated in the period between July and October, and an increasing density after 1980. Furthermore, clusters of 6-months temporal duration are most likely to occur from January to July or from April to October. As for clusters with 9-months temporal duration, these mostly cover the period of July-August-September, irrespective of the starting month. Ultimately, as noticed for the \emph{yearly model}, also in the \emph{monthly model} much more clusters were detected in the late period, mainly from 2000. Moreover, the vast majority of flash flood disasters clusters happened between July and October, a period coinciding with the wet season in China. \begin{figure}[t!] \centering \includegraphics[width=0.6\linewidth]{FIGURE7.jpg} \caption{Seasonal effect of flash flood disasters clusters in China during 1950-2015 ($R_{max} = 200km$, $T_{max} = 1 year$, $T_{agg} = 3 months$).} \label{Figure7} \end{figure} \subsubsection{Recurrence of clusters at decades-scale} The analyses run in the previous sections were all voted to search for clusters in a relatively small temporal window. However, environmental changes, and especially those related to climate change, usually act on a longer time span. To better investigate this effect, we considered a temporal subdivision of the dataset into six subsets, each one lasting ten years (starting from 1956). For each decade (1956-1965, 1966-1975, 1976-1985, 1986-1995, 1996-2005, 2006-2015) the following parameter for the scanning widows were imposed: $R_{max} = 200km$, $T_{max}= 2 years$ and $T_{agg} = 1 year$. As shown in Figure \ref{Figure8}, the number of detected clusters increases from the early to recent periods. These are compared with the rainfall distribution, derived from the daily rainfall data provided by the China Meteorological Administration (\href{http://data.cma.cn/}{http://data.cma.cn/}). In the present study, only the weather stations (a total of 699 rain gauges) with complete data for the period 1955-2015 were considered. The mean monthly and annual rainfall were computed for each station and this data were then regionalized on a 2$km$ $\times$ 2$km$ lattice, via Ordinary Kriging interpolator. It results that flash floods detected clusters are mainly located in the southeastern most humid regions in every period. However, in the last two decades, clusters appear also in the northwestern arid regions. Even if the rainfall distribution, averaged over each decades, does not allow to discover clear changes along the subsequent periods, these newly detected clusters can be due to the intensification of the extreme rainfall events occurring in the area in recent periods. This assumption is confirmed by the statistics on clusters duration (Figure \ref{Figure9}). From the boxplot summarizing the descriptive statistics it is evident that the median values of clusters duration tends to slightly decrease from 46 days (1956-1965), to 17 days (1986-1995), to stabilise at a value around 20 days in the two last decades. At the same time, the overall duration, measured as difference between the maximum and the minimum value, is higher in the late periods (140 days in 1956-1965, and 93 and 74 days respectively in the two following decades) than in the early periods (about 65 days for the last two decades). This is even more evident looking at the interquantile ranges, which decrease with time. To resume, from these analyses, the number of detected clusters globally increase in time, but their duration drastically decreases in the recent period, indicating a possible activation induced by short-duration extreme rainfall events. \begin{figure}[t!] \centering \includegraphics[width=\linewidth]{FIGURE8.jpg} \caption{Significant (p $<$ 0.005) spatiotemporal clusters of flash flood disasters in China every ten years. The size of the circles indicates the impact of flash flood disasters according to the classification proposed in Table \ref{Table1}.} \label{Figure8} \end{figure} \begin{figure}[!htbp] \centering \includegraphics[width=0.6\linewidth]{FIGURE9.jpg} \caption{Boxplots summarizing the descriptive statistics of the duration of clusters reported on Figure \ref{Figure8}.} \label{Figure9} \end{figure} We further explored how many times the clusters detected from the previous investigation overlap, considering the catchment level. Results provide an useful information on the recurrence of clusters of flash flood disasters every ten years. To perform this analysis, the centroid of each cluster (with reference to Figure \ref{Figure8}) was extracted and intersected with the catchment boundaries. In a second step, the number of repeated clusters per catchment was computed and their distribution investigated through the time. Results are shown in Figure \ref{Figure10}, where panel (a) reports the number of repeated clusters and panel (b) reports the information on their relative occurrence across time (similarly to the concept of return time but in the context of spatiotemporal clustering). Figure \ref{Figure10}a shows that, as for the spatial trends of the detected clusters, the catchments with recurrent clusters are mainly located in the southeast sector and essentially in the coastal mountains. From Figure \ref{Figure10}b it emerges that, on average, most of the repeated cluster occur with an interval between 10-20 and 20-50 years. \begin{figure}[t!] \centering \includegraphics[width=\linewidth]{FIGURE10.jpg} \caption{Catchments with clusters detected more than once (a) and return period for the clusters (b).} \label{Figure10} \end{figure} \section{Discussions}\label{Discuss} The present study aims at exploring the spatiotemporal clustering characteristics of flash flood disasters in China. For this purpose, we analyzed the official historical inventory, which covers a very long period (from 1950 to 2015). Results are interpreted with a particular regard to the rainfall distribution, being these two processes highly related \citep{wei_rainfall_2018}. The spatiotemporal K-function was fist computed to assess the deviation of flash flood pattern distribution from a random process. This revealed a clustering behavior at specific spatial distances and yearly periods. Scan Statistics, the spatiotemporal permutation model we adopted, was then performed to identify statistically significant clusters together with their duration (start and end date). This allowed us to detect areas and periods more susceptible to flash flood disasters. We opted for a set of possible combinations for the maximum spatial and temporal extension of the scanning windows, while the data were aggregated both at yearly and at seasonal scale. More specifically, we tested three $R_{max}$ values equal to 100, 200 and 300 $km$, and three $T_{max}$ values equal to 1, 3 and 5 years for the \emph{yearly model}, with an aggregation of three months for the \emph{monthly model}. The most significant cluster resulting from the yearly model was detected in 1975, while the rating for the following clusters can change by varying $R_{max}$; nevertheless, it is important to note that the top-ten clusters are well distributed over the entire study period, with the oldest one detected in 1963-1969. Results of the monthly model show that the top-ten detected clusters have a duration of three (six clusters) or six (four clusters) months. Notably, almost every cluster encompasses the period from July to September, a period coinciding with the wet season in China, with an earlier start date (in April) for the ones which have a longer duration. Globally, much more clusters were detected in the late period, mainly from 2000. Overall, clusters are chiefly located along the main river systems in China (the Yangtze, the Yellow, the Pearl and the Yarlung Zangbo Rivers). In addition, some clusters stand out on high mountains such as the Qinling-Daba and the Changbai Mountains. Finally, to detect changes acting at a larger temporal scale, dates were grouped each ten years over the last six decades (from 1956 to 2015). As for the previous analyses, detected clusters are mainly located in the southeastern most humid regions in every period. However, in the last two decades, clusters appear also in the northwestern arid regions. These newly detected clusters can be due to the intensification the extreme rainfall events occurring in the area in recent periods, as a consequence of climate changes \citep{Song_2011}. This important fact is confirmed by checking the descriptive statistics of the duration of clusters: globally, the number of detected clusters increases in time, but the duration drastically decreases in recent periods, indicating a possible activation induced by short-duration extreme rainfall events. Our analyses reveled that the catchments with recurrent clusters are mainly located in the southeast sector and essentially in the coastal mountains. We can assume these catchments to be exposed at the highest potential risk across the whole Chinese territory also in the short to long term future. Nevertheless, catchments with repeated clusters in a shorter timespan (5 to 10 years) may also pose a relevant threat, especially in the near future. In the present study spatiotemporal clusters of flash floods were detected chiefly on the basis of two parameters ($R_{max}$ and $T_{max}$), without featuring terrain attributes, precipitation regimes and anthropogenic pressure. However, these factors may have played and still play a significant role to explain the distribution of flash flood disasters. For instance, the approach we adopted may over-rely on spatial distances to detect clusters. In fact, the natural landscape has mountain belts that can act as orographic barriers to the incoming cloudbursts, effectively limiting the rainfall distribution -- hence flash flood occurrences -- on one or the other side of a catchment divide (at various scales). As for the temporal scale, due to the large timespan, the detected temporal patterns may reflect more information due to long-term climatic variations rather than specific conditions. For this reason, we are planning to extend our spatiotemporal cluster analyses to more complex models, which can concurrently capture multivariate contributions featuring environmental effects, even at the latent level \citep{Lombardo.etal:2018,lombardo2019geostatistical}. \section{Conclusion} In this work, we explore the national archive of flash flood disasters in China from 1950 to 2015. The term disaster is meant to describe the destructiveness of the flash floods, since each record in this archive has produced economic, life losses, or both. The clustering procedure highlighted distinct spatial and temporal patterns at different scales. For instance, flash flood disasters cluster in specific regions and closely follow the mean rainfall distribution. Additionally, we were also able to distinguish seasonal, yearly and even long-term flash flood persisting behaviors. The persistence of disasters is a crucial information because it indicates the risk that a community may undergo in response to a flash flood. Moreover, we studied the cycle of such disasters with particular emphasis on their repeated occurrence per catchment. This complementary information can be further used in relation to engineering and structural design. In fact, infrastructure is usually built to sustain the damage of an event of certain return time. In our analyses, we show that the very same area has been hit and incurred losses up to six times in the last 66 years. This may suggest locally-tailored structural improvements which may lengthen the life expectancy of specific infrastructure as well as reduce the number of victims. We would like to stress that, as advanced as it may be, our clustering framework is essentially a descriptive tool. And yet, the amount of information one can draw from a descriptive tool can be extremely valuable. Nowadays, the hazard community's effort is mainly dedicated to predictive modeling of various natures and purposes, thus leaving under-explored or even unexplored some basic concepts and interpretative conclusions that data description and visualization can provide. Long time series of national hazard phenomena are one of these examples where studying variations over space and time can highlight very important environmental dynamics, even in the direction of climate change and its implications. \section*{Acknowledgement} This work was supported by the China National Flash Flood Disasters Prevention and Control Project. The authors are grateful for financial support from the China Institute of Water Resources and Hydropower Research (IWHR), grant number No. SHZH-IWHR-57 and National Natural Science Foundation of China, grant number No. 41571388. \newpage \bibliographystyle{CUP}
\section{Introduction} The epoch of reionization (EoR) leaves footprints in the observed cosmic microwave background (CMB) as the photons Thomson scatter off free electrons. These include damping the primary temperature anisotropies, inducing secondary anisotropies from the bulk motion of ionized gas (i.e. the kinetic Sunyaev–Zel'dovich effect), and prompting curl-less (i.e. E-mode) polarization from the CMB quadrupole (e.g. \citealt{Sunyaev1980MNRAS.190..413S,Vishniac1987ApJ...322..597V,Hu2000ApJ...529...12H,Hu2002ARA&A..40..171H,McQuinn05,Dvorkin2009PhRvD..79j7302D}). Of these, the large-scale E-mode polarization anisotropies are a particularly powerful probe of the EoR as they are less plagued by degeneracies and systematics (e.g. \citealt{Reichardt_2016}). Reionization models can therefore constrain their largely uncertain parameters that describe the ionizing emissivity of the early Universe, through forward-modelling the EE autocorrelation power spectra (PS) and comparing against measurements from the {\it Planck} satellite (\citealt{Planck2016A&A...596A.108P,Planck2019arXiv190712875P}; e.g. \citealt{Hu2003PhRvD..68b3001H, Mortonson2008ApJ...672..737M, Miranda2017MNRAS.467.4050M, Hazra19}). Nevertheless, most reionization models do not directly use the CMB PS to constrain their parameters. Instead, they use a summary statistic which has become one of the de-facto standard cosmological parameters -- the direction-averaged Thomson scattering optical depth, $\tau_e$. In going from the observed PS to $\tau_e$, one needs to adopt a basis set for the EoR history -- a parametrization of the redshift evolution of the comoving number density of free electrons ($n_{e}$). Early works adopted a simple step function reionization at a given redshift $z_{\rm re}$ \citep{Page2007ApJS..170..335P,Spergel2007ApJS..170..377S}. Currently, the most common choice has a hyperbolic tangent functional form ({\it Tanh}; \citealt{Lewis_2008}) parametrized by a reionization midpoint ($z_{\rm re}$) and a redshift duration ($\Delta_{\rm re}$; see equation \ref{eq:tanh}). For example, the latest constraints on $\tau_e$ published by {\it Planck}, $\tau_e = 0.0522\pm0.0080$ (the {\it TT+lowE} reconstruction in \citealt{Planck2018arXiv180706209P}), were generated by fixing a width of $\Delta_{\rm re}=0.5$, sampling a flat prior over $z_{\rm re}$, and comparing against the observed large-scale E-mode PS (and also the temperature autocorrelation). However, the redshift-symmetric evolution given by {\it Tanh} differs in shape from both physical and empirical models of EoR history, based on the growth of cosmic structure and/or fit to observed galaxy luminosity functions (LFs; e.g. \citealt{Choudhury2006MNRAS.371L..55C,Raskutti2012,Koh2016,Greig2017,Qin2017a,Kulkarni2018,Gorce2018A&A...616A.113G,Roy2018JCAP...05..014R,Qin2020arXiv200304442Q}). Therefore, {\it computing a likelihood using the $\tau_e$ summary statistic instead of directly forward-modelling the CMB PS can bias EoR model constraints} (e.g. \citealt{Douspis2015A&A...580L...4D,Planck2016A&A...596A.108P,Miranda2017MNRAS.467.4050M, Hazra19}). For example, \citet{Miranda2017MNRAS.467.4050M} and \citet{Heinrich_2018} claimed (though see \citealt{Millea2018A&A...617A..96M} and \citealt{Planck2018arXiv180706209P}) that the {\it Planck} 2015 E-mode PS prefers reionization histories with an extended tail of partial reionization towards very high redshifts ($z{>}15$). This would have significant implications for our understanding of the very first galaxies. However, quantifying such claims is difficult without directly performing inference on galaxy model parameters. In this work, we use a physically-motivated EoR model to quantify how inference using the $\tau_e$ summary statistic (instead of directly forward-modelling the E-mode PS) impacts the resulting constraints on galaxy properties and EoR histories. Using the last {\it Planck} data release, we show that the marginalized constraints on the EoR history are far more sensitive to the choice of the basis set ({\it Tanh} vs physical model) than to the CMB likelihood statistic ($\tau_e$ vs PS). Specifically, we use the latest v3.0.0 release\footnote{\url{https://github.com/21cmfast/21cmFAST}} (Murray et al. in prep.) of {{21\textsc{cmFAST}}} \citep{Mesinger2007ApJ...669..663M,Mesinger2011MNRAS.411..955M}, whose parametrization for galaxy properties is informed by high-redshift UV LFs \citep{Park2019MNRAS.484..933P}. To calculate the CMB PS for a given reionization history and compute the corresponding likelihood, we add the Cosmic Linear Anisotropy Solving System (\textsc{class}\footnote{\url{https://github.com/lesgourg/class_public}}; \citealt{Lesgourgues2011arXiv1104.2932L}) Boltzmann solver and the {\it Planck} likelihood codes (\textsc{plc}\footnote{\url{http://pla.esac.esa.int/pla}}; \citealt{Planck2016A&A...594A..11P,Planck2019arXiv190712875P}) to the upcoming v1.0.0 release\footnote{\url{https://github.com/21cmfast/21CMMC}} of the public {21\textsc{CMMC}} Markov chain Monte Carlo (MCMC) framework \citep{Greig2015MNRAS.449.4246G,Greig2017MNRAS.472.2651G}. All codes developed here are publicly available. This paper is organized as follows. We present our analysis of the {\it Planck} data and discuss the difference between the 2015 and 2018 results in Section \ref{sec:model_cmb}. In Section \ref{sec:model_eor}, we briefly introduce our EoR model (Sec. \ref{subsec:21cmfast}) and show the resulting constraints inferred from CMB and other observations. We quantify the bias from the choice of basis set for EoR histories in Sec. \ref{subsec:tanhvs21cmfast} and the choice of likelihood statistics in Sec. \ref{subsec:tauvsps}. We summarize our results and conclusions in Section \ref{sec:conclusion}. \section{Modelling CMB observables}\label{sec:model_cmb} \textsc{class} \citep{Lesgourgues2011arXiv1104.2932L} computes CMB anisotropies including temperature and polarization, and calculates their autocorrelation and cross-correlation PS. In its default configuration, \textsc{class} computes the ionization history from $z{=}10^4$ and throughout recombination (e.g. via the code \textsc{recfast}; \citealt{Seager1999ApJ...523L...1S,Chluba2010MNRAS.402.1195C}), and includes a parametrized function for the EoR history. The EoR is assumed to have the {\it Tanh} form as follows \begin{equation}\label{eq:tanh} n_e {=} \frac{n_{\rm H}{+}n_{\rm He}}{2} \left\{1{+}\tanh\left[\left(1{-}\left(\frac{1{+}z}{1{+}z_{\rm re}}\right)^{1.5}\right)\frac{1{+}z_{\rm re}}{1.5\Delta_{\rm re}}\right]\right\} \end{equation} with ${n}_{\rm H}$ and ${n}_{\rm He}$ representing the average comoving number density of hydrogen and helium, respectively. Instead of using the default {\it Tanh} parametrization, here we forward-model the CMB observables by passing any given ionization history directly to \textsc{class}. We then compare the theoretical PS against observations using the {\it Planck} likelihood codes (\citealt{Planck2016A&A...594A..11P,Planck2019arXiv190712875P}; see more in Table \ref{tab:planck}). On the other hand, the integrated history of reionization can also be summarized using the Thomson scattering optical depth \begin{equation}\label{eq:tau_e} \tau_e = \int_{0}^{z_{\rm d}} c H^{-1}\left(1{+}z\right)^2 n_e\sigma_{\rm T}, \end{equation} where $z_{\rm d}{\sim}1100$, $c$, $H(z)$ and $\sigma_{\rm T}{=}6.65\times10^{-25}{\rm cm^2}$ are the redshift of the last scattering surface at recombination, the speed of light, the Hubble constant at redshift $z$, and Thomson scattering cross-section, respectively. Below we also perform EoR inference with a Gaussian likelihood ($\mathscr{L}$) computed using $\tau_e$ from {\it Planck} \citep{Planck2016A&A...594A..16P,Planck2018arXiv180706209P}. This allows us to compare the resulting EoR parameter constraints to those obtained from using directly the EE PS for the likelihood. \subsection{Preference for an early reionization?} The mapping of CMB PS to the $\tau_e$ summary statistic depends on the chosen basis set and corresponding priors for the EoR history. The sensitivity of the resulting $\tau_e$ constraints to this choice has been debated extensively in the literature (e.g. \citealt{Douspis2015A&A...580L...4D, Planck2016A&A...596A.108P, Heinrich2016,Reichardt_2016,Planck2018arXiv180706209P, Millea2018A&A...617A..96M, Hazra19}). As mentioned in the introduction, using different EoR basis sets to infer $\tau_e$ from the CMB PS and then from $\tau_e$ to astrophysical parameters could result in biases. Constraining astrophysics directly using the CMB PS bypasses this issue. For instance, \citet{Miranda2017MNRAS.467.4050M} adopted a simple EoR galaxy model, parametrized by the ionizing efficiencies of Pop-II or Pop-III dominated galaxies, and constrained their model parameters directly from the {\it Planck} 2015 \citep{Planck2016A&A...596A.108P} PS observations (see also \citealt{Hazra19}). The top panel of Fig. \ref{fig:miranda} shows their best-fit models, where \begin{enumerate} \item \textit{Pop-II} only considers UV ionizing photons from Pop-II star-dominated galaxies; \item \textit{Pop-III} considers UV ionizing photons from both Pop-II and Pop-III star-dominated galaxies; and \item \textit{Pop-III, self-regulated} is similar to the previous model but assumes a significant contribution from Pop-III stars in the early universe ($z{\sim20}$) before their formation becomes completely quenched when $n_e/n_{\rm H}$ reaches 0.2. \end{enumerate} Also shown is a \textit{Tanh} model that assumes a fairly sharp transition at $z_{\rm re}{\sim}10$ (see equation \ref{eq:tanh}). Comparing the corresponding large-scale E-mode polarization PS of these models against the {\it Planck} 2015 measurement \citep{Planck2016A&A...596A.108P}, \citet{Miranda2017MNRAS.467.4050M} concluded {\it Planck} 2015 might favour a significant UV ionizing photon contribution from Pop-III star-dominated galaxies in the early Universe and the resulting optical depth is much higher than what the default {\it Tanh} parametrization suggests. This example illustrates how a reionization model informed only by the CMB optical depth could result in biased constraints, compared to using the PS directly in the inference. \subsubsection{From Planck 2015 to 2018}\label{subsubsec:planck} From their 2015 to 2018 data release, the {\it Planck} collaboration has made tremendous efforts in improving the characterization and removal of systematic uncertainties affecting the polarization data of the {\it Planck} High Frequency Instrument (HFI) on large angular scales \citep{Planck2016A&A...596A.107P}. With such improvements, the {\it Planck} collaboration has shown that the mean value and uncertainties of the optical depth deduced from the low-$\ell$ data assuming the {\it Tanh} EoR model have significantly decreased from $\tau =0.078 \pm 0.010$ (the {\it TT+lowP} reconstruction in \citealt{Planck2016A&A...594A..13P}) to $\tau=0.0522\pm0.0080$ ({\it TT+lowE} in \citealt{Planck2018arXiv180706209P}). Before discussing the difference between EoR inference from the CMB optical depth and PS, we revisit the 4 best-fit models from \citet{Miranda2017MNRAS.467.4050M} mentioned above, using the updated measurement from {\it Planck} 2018 \citep{Planck2019arXiv190712875P} to see if the latest data still supports an earlier reionization and larger optical depths. \begin{figure} \begin{minipage}{\columnwidth} \begin{center} \includegraphics[width=0.97\textwidth]{figs/Miranda.pdf}\vspace*{-2mm} \end{center} \end{minipage} \caption{\label{fig:miranda} Reanalysing models from \citet{Miranda2017MNRAS.467.4050M} with cosmological parameters given by the {\it TT+lowP} reconstruction in \citet{Planck2018arXiv180706209P}. \textit{Top panel:} the best-fit EoR models from \citet{Miranda2017MNRAS.467.4050M}. \textit{Bottom panel:} corresponding PS of the E-mode polarization anisotropies with {\it Planck} 2015 and 2018 measurements shown as squares and circles, respectively. Only the large-scale ($2{\le} \ell{\le}29$) PS is considered when evaluating the likelihoods as these scales are most relevant for the EoR.} \end{figure} \begin{table} \caption{Revisiting the models from \citet{Miranda2017MNRAS.467.4050M}, using both {\it Planck} 2015 and 2018 data. The models correspond to those shown in Fig. \ref{fig:miranda}; the parameters are fixed and are not allowed to vary so as to better fit the 2018 data. For each model, we list the optical depth and the difference in the reduced $\chi^2$ with respect to the {\it Pop-II} model (computed using the {\it Planck} likelihood code). } \vspace{-3mm} \begin{threeparttable} \label{tab:planck} \begin{tabular}{l|cc|cc} \hline \hline \multirow{2}{*}{Model} & \multicolumn{2}{c|}{{\it Planck} 2015\tnote{a}}& \multicolumn{2}{c}{{\it Planck} 2018\tnote{b}}\\\cline{2-5} & $\tau_e$&$\chi^2-\chi^2_{\rm PopII}$& $\tau_e$\tnote{c}&$\chi^2-\chi^2_{\rm PopII}$\\\hline Tanh&0.0792&1.13&0.0788&-1.14\\%\hline Pop-II\tnote{d}&0.0832&0&0.0827&0\\%\hline Pop-III&0.0926&-0.96&0.0921&5.47\\%\hline Pop-III,self-&\multirow{2}{*}{0.1049}&\multirow{2}{*}{-2.27}&\multirow{2}{*}{0.1043}&\multirow{2}{*}{16.10}\\ regulated&&&&\\%\hline \hline \end{tabular} \begin{tablenotes} \item[a] This column assumes cosmological parameters (i.e. the density and Hubble constant) from the {\it TT+lowP} reconstruction in \citet{Planck2016A&A...594A..13P} and calculates $\chi^2$ using the {\it \scriptsize low\_l/bflike/lowl\_SMW\_70\_dx11d\_2014\_10\_03\_v5c\_Ap} likelihood in \textsc{plc} 2.0 \citep{Planck2016A&A...594A..11P}. This likelihood considers both EE, TT, TE and BB components. \item[b] Results in this column, similarly to the {\it Planck} 2015 column, assume cosmological parameters from the {\it TT+lowE} reconstruction in \citet{Planck2018arXiv180706209P}, and use the {\it \scriptsize low\_l/simall/simall\_100x143\_offlike5\_EE\_Aplanck\_B} likelihood in \textsc{plc} 3.0 \citep{Planck2019arXiv190712875P}. This likelihood allows users to consider only the EE PS, which is used in this work. \item[c] For each model, there are slight changes in the resulting optical depth when comparing the {\it Planck} 2015 and 2018 columns. This is due to the variation in the Hubble constant (see equation \ref{eq:tau_e}) when different cosmological parameters are adopted. \item[d] $\chi^2_{\rm PopII} {=} 10492.45$ (407.50) for {\it Planck} 2015 (2018). \end{tablenotes} \end{threeparttable} \end{table} We show the PS of the E-mode polarization anisotropies using the \citet{Miranda2017MNRAS.467.4050M} EoR models in the bottom panel of Fig. \ref{fig:miranda} assuming {\it Planck} 2018 {\it TT+lowE} cosmology ($\Omega_{\mathrm{m}}, \Omega_{\mathrm{b}}, \Omega_{\mathrm{\Lambda}}, h, \sigma_8$ = 0.321, 0.04952, 0.679, 0.6688, 0.8118; \citealt{Planck2018arXiv180706209P}). We present the relative $\chi^2{\equiv}-2\ln \mathscr{L}$ and the corresponding optical depth\footnote{Note that the updated optical depths from the 4 models presented in Fig. \ref{fig:miranda} using {\it Planck} 2018 cosmology are all higher than the reported value ($0.0522\pm0.0080$; \citealt{Planck2018arXiv180706209P}). This is due to the fact that the model parameters were chosen to fit the 2015 data, not the 2018. Here we do not vary the parameters of the \citet{Miranda2017MNRAS.467.4050M} models but instead use a different parametrization introduced below.} in Table \ref{tab:planck}, together with the results using {\it Planck} 2015 {\it TT+lowP} cosmology ($\Omega_{\mathrm{m}}, \Omega_{\mathrm{b}}, \Omega_{\mathrm{\Lambda}}, h, \sigma_8$ = 0.315, 0.04904, 0.685, 0.6731, 0.829; \citealt{Planck2016A&A...594A..13P}) for comparison. We conclude that, unlike {\it Planck} 2015, the 2018 measurement no longer prefers an earlier reionization or a significant contribution from Pop-III stars to early reionization -- the likelihood decreases when ionization starts at earlier times (see also, e.g. \citealt{Millea2018A&A...617A..96M}). This is mainly driven by the reduced amplitude at multipole $\ell{\sim}10 - 20$ in the updated {\it Planck} E-mode PS (see the bottom panel of Fig. \ref{fig:miranda}). Consequently, models with a better fit to the updated PS measurement also return an optical depth closer to the reported value from \citet{Planck2018arXiv180706209P}, indicating that EoR inference biases from using the CMB optical depth might be insignificant in {\it Planck} 2018 (see also v2 of \citealt{Hazra19}). For the remainder of the paper, we focus only on the {\it Planck} 2018 data. Using a flexible, physical EoR model, we forward-model the EE PS, and quantify the bias from using the $\tau_e$ summary statistic instead of the PS. \section{EoR inference from the CMB}\label{sec:model_eor} To compute the impact of realistic reionization histories on the CMB PS, we connect {{21\textsc{cmFAST}}} (\citealt{Mesinger2007ApJ...669..663M,Mesinger2011MNRAS.411..955M}; Murray et al. in prep) to \textsc{class} \citep{Lesgourgues2011arXiv1104.2932L}. Specifically, for a given set of cosmological and astrophysical parameters, {{21\textsc{cmFAST}}} performs a 3D EoR simulation\footnote{We do not explicitly model helium reionization. Instead we assume helium to be singly ionized following the same rate as hydrogen before becoming fully ionized at $z{=}3$ \citep{Hogan1997AJ....113.1495H,Worseck2011ApJ...733L..24W,Worseck2016ApJ...825..144W}.}. The volume-averaged EoR history of that simulation is passed to \textsc{class}, which then computes the corresponding CMB PS. With this interface, we use the MCMC driver {21\textsc{CMMC}} \citep{Greig2015MNRAS.449.4246G, Greig2017MNRAS.472.2651G} to sample two EoR models: (i) the astrophysical galaxy-based parametrization native to {{21\textsc{cmFAST}}} (see below); and (ii) the commonly used, two-parameter {\it Tanh} model (see equation \ref{eq:tanh}). In addition to varying the EoR parameterization, we also check how the inference is affected by the choice of likelihood statistic: (i) $\tau_e$; or (ii) the EE PS. Specifically, for (i) we use $\tau_e=0.0522\pm0.0080$ from the {\it TT+lowE} result in \citet{Planck2018arXiv180706209P}; for (ii) we use the large-scale ($2{\le} \ell {\le} 29$) E-mode polarization measurements and the likelihood from \citet{Planck2019arXiv190712875P}. \subsection{Modelling the EoR}\label{subsec:21cmfast} Our EoR model describes galaxy properties mostly using power-law scaling relations with respect to their host halo masses \citep{Park2019MNRAS.484..933P} and calculates the 3D reionization evolution following an excursion-set approach based on the cumulative number density of ionizing photons and recombinations (e.g. \citealt{Furlanetto2004ApJ...613....1F, Sobacchi2014MNRAS.440.1662S}). We introduce some basic characteristics of our model below and refer interested readers to the aforementioned references for more details. We start from an initial Gaussian realization of the density and velocity fields \citep{Mesinger2007ApJ...669..663M} in a large-volume (250Mpc), grid-based, high-resolution (${\sim}$0.65Mpc; i.e 250Mpc/384) simulation box assuming periodic boundary conditions. These fields are then evolved according to second-order Lagrangian perturbation theory \citep{Scoccimarro1998MNRAS.299.1097S}, and re-gridded to a lower resolution (${\sim}$1.95Mpc; i.e. 250Mpc/128) for the sake of computing efficiency. Then, for each cell centred at a spatial position and redshift of $({\bf r}, z)$, we compare the cumulative number per baryon of ionizing photons\footnote{In this work, we do not consider ionization by X-ray photons or earlier objects such as minihalo-hosted galaxies, and their corresponding parameters. Although efficient at heating the IGM before reionization, X-rays and minihalos are expected to have a very minor contribution to the EoR for reasonable galaxy models (e.g. \citealt{RO04, McQuinn12, Mesinger2013MNRAS.431..621M, Ross17, Eide18,Qin2020arXiv200304442Q}).} ($\bar{n}_{\rm ion}$) to that of recombinations ($\bar{n}_{\rm rec}$) in spheres with decreasing radii \citep{Furlanetto2004ApJ...613....1F, Sobacchi2014MNRAS.440.1662S}. A cell is ionized if at any radius $R$, \begin{equation}\label{eq:ionization} \bar{n}_{\rm ion} \ge (1+\bar{n}_{\rm rec}). \end{equation} Unresolved $\mathrm{H}\textsc{ii}$ regions (smaller than the cell size) are accounted for according to \citet{Zahn2011MNRAS.414..727Z}. The cumulative number of ionizing photons per baryon is obtained with \begin{equation}\label{eq:n_ion} \bar{n}_{\rm ion}\left({\bf r},z|R,\delta_{\rm R|_{{\bf r},z}}\right) {=} \int {\rm d}M_{\rm vir} {\phi}f_{\rm duty} f_* \frac{\Omega_{\mathrm{b}}}{\Omega_{\mathrm{m}}}\frac{M_{\rm vir}}{\rho_{\rm b}}n_{\gamma} f_{\rm esc} \end{equation} where $\delta_{\rm R|_{{\bf r},z}}{\equiv}\rho_{\rm b}/\bar{\rho}_{\rm b} {-}1 $ is the average overdensity within the spherical region, $\rho_{\rm b}$ and $\bar{\rho}_{\rm b}$ represent the baryonic density and its cosmic mean. In equation (\ref{eq:n_ion}) \begin{enumerate} \item $M_{\rm vir}$ and $\phi\left(M_{\rm vir},z|R, \delta_{\rm R|_{{\bf r},z}}\right)$ are the halo mass and halo mass function; \item $f_{\rm duty}\left(M_{\rm vir}\right) {=} \exp\left(-{M_{\rm turn}}/{M_{\rm vir}}\right)$, with a characteristic mass ($M_{\rm turn}$) as a free parameter, accounts for a decreasing occupation fraction of star forming galaxies inside smaller halos due to inefficient cooling, photo-heating feedback \citep{Efstathiou1992MNRAS.256P..43E,Shapiro1994ApJ...427...25S,Thoul1996ApJ...465..608T,Hui1997MNRAS.292...27H,Sobacchi2013MNRAS.432L..51S,Sobacchi2014MNRAS.440.1662S} or supernovae feedback \citep{Hopkins2014MNRAS.445..581H, Hopkins2017, Wyithe2013MNRAS.428.2741W,Sun2015,Mutch2016}; \item $f_*\left(M_{\rm vir}\right) {=} \min\left[1, f_{*,10} \left({M_{\rm vir}}/{10^{10}{{\rm M}_\odot}}\right)^{\alpha_*}\right]$ is the fraction of galactic gas in stars and is assumed to scale with the host halo mass \citep{Moster2013MNRAS.428.3121M,Sun2015,Mutch2016,Tacchella2018ApJ...868...92T,Behroozi2019MNRAS.488.3143B,Yung2019MNRAS.490.2855Y} according to the two free parameters, $f_{*,10}$ and $\alpha_*$, representing the normalization and power-law index; \item $n_\gamma$ is the number of ionizing photons intrinsically emitted per stellar baryon; and \item $f_{\rm esc}\left(M_{\rm vir}\right) = \min\left[1, f_{{\rm esc},10} \left(\frac{M_{\rm vir}}{10^{10}{{\rm M}_\odot}}\right)^{\alpha_{\rm esc}}\right]$ is the ionizing escape fraction defined as the number ratio of photons reaching the IGM to those emitted in the galaxy, and is also assumed to scale with the halo mass \citep{Ferrara2013MNRAS.431.2826F,Kimm2014,Paardekooper2015MNRAS.451.2544P,Xu2016ApJ...833...84X}. \end{enumerate} Inside the $\mathrm{H}\textsc{ii}$ regions, we estimate the local, average photoionization rate with \citep{Sobacchi2014MNRAS.440.1662S}: \begin{equation}\label{eq:gamma} {\bar{\Gamma}_{\rm ion}\left({\bf r},z\right)} = \left(1+z\right)^2 R\sigma_{\rm H}\frac{\alpha_{\rm UVB}}{\beta_{\rm H}+\alpha_{\rm UVB}}\frac{\bar{\rho}_{\rm b}}{m_{\rm p}}{\dot{\bar{n}}_{\rm ion}}, \end{equation} where $\sigma_{\rm H}=6.3\times10^{-18}{\rm cm}^2$ and $\beta_{\rm H}{\sim}2.75$ are the photoionization cross-section at Lyman limit and its spectral dependence; $\alpha_{\rm UVB}{\sim}5$, $m_{\rm p}$ and $\dot{\bar{n}}_{\rm ion}$ are the spectral indices of a stellar-driven UV ionizing background \citep{Thoul1996ApJ...465..608T}, the mass of a proton, and the local production rate of ionizing photons. Assuming the typical star formation time-scale is $t_*H^{-1}\left(z\right)$, with $t_*$ being a free parameter, we calculate the average star formation rate (SFR) of galaxies in halos of a given mass at a given redshift by \begin{equation}\label{eq:sfr} {\rm SFR}\left(M_{\rm vir},z\right) = \frac{M_*}{t_* H(z)^{-1}}, \end{equation} convert it to the non-ionizing UV luminosity via $L_{1500}/{\rm SFR}=8.7\times10^{27}{\rm erg\ s^{-1}Hz^{-1}{{\rm M}_\odot}^{-1}yr}$ \citep{Madau2014ARA&A..52..415M}, and estimate $\dot{\bar{n}}_{\rm ion}$ using equation (\ref{eq:n_ion}) with $M_*$ being replaced by the SFR. We follow \citet{Sobacchi2014MNRAS.440.1662S} and estimate the recombination rate in each cell with a spatial position and redshift of ({\bf r, $z^\prime$}) as well as an overdensity of $\Delta_{\rm cell}$ by \begin{equation} \dot{n}_{\rm rec}\left({\bf r},z^\prime \right){=}\int{\rm d}\Delta_{\rm sub}\phi_{\rm sub}\alpha_{\rm B}f_{\rm H} \frac{\bar{\rho}_{\rm b}}{m_{\rm p}} \frac{\Delta_{\rm sub}^2}{\Delta_{\rm cell}} \left(1{-}x_{\rm \mathrm{H}\textsc{i}, sub}\right)^2. \end{equation} Here $\Delta_{\rm sub}$, $\phi_{\rm sub}\left(z^\prime, \Delta_{\rm sub}| \Delta_{\rm cell}\right)$, $\alpha_{\rm B}$, $f_{\rm H}$ and $x_{\mathrm{H}\textsc{i}, {\rm sub}}\left(z^\prime, \Delta_{\rm sub}, T_{\rm g}, \bar{\Gamma}_{\rm ion}\right)$ are the sub-grid (unresolved) overdensity, its probability distribution function (PDF; e.g. \citealt{Miralda2000ApJ...530....1M}) within our large-scale simulation cell (${\sim}2$Mpc), case-B recombination coefficient evaluated at $10^4{\rm K}$, number fraction of hydrogen in the Universe, and the neutral hydrogen fraction of the sub-grid gas element, respectively. We assume photoionization equilibrium in the ionized IGM, accounting for the attenuation of the local photoionization rate, $\bar{\Gamma}_{\rm ion}$, according to the radiative transfer simulations from \citet{Rahmati2013MNRAS.430.2427R}. We then compute the cumulative number of recombinations for each cell (see equation \ref{eq:ionization}) by integrating $\dot{n}_{\rm rec}$ from the time the cell was ionized to the redshift of interest. In summary, our model consists of the following six astrophysical parameters that we sample within the MCMC: \begin{itemize} \item $f_{*,10}$, the normalisation of the stellar-to-galactic gas mass relation at $M_{\rm vir}=10^{10}{{\rm M}_\odot}$, sampled with a flat prior in log space between $10^{-3}$ and 1; \item $\alpha_*$, the power-law index of the stellar-to-galactic gas mass relation, sampled with a flat prior between -0.5 and 1; \item $f_{\rm esc,10}$, the normalisation of the ionizing escape fraction to halo mass relation at $M_{\rm vir}=10^{10}{{\rm M}_\odot}$, sampled with a flat prior in log space between $10^{-3}$ and 1; \item $\alpha_{\rm esc}$, the power-law index of the ionising escape fraction to halo mass relation, sampled with a flat prior between -1 and 0.5; \item $M_{\rm turn}$, the turnover halo mass below which the number density of halos hosting star-forming galaxies drops exponentially, sampled with a flat prior in log space between $10^8$ and $10^{10}{{\rm M}_\odot}$; \item $t_*$, the star-formation timescale as a fraction of the Hubble time, sampled with a flat prior between 0 and 1. \end{itemize} These prior ranges are chosen based on the physical meaning of the parameters. For example, fractions must range from 0 to 1, and we observe galaxies inside halos with masses around $10^{10}{{\rm M}_\odot}$ thus setting an upper limit on $M_{\rm turn}$. More detailed discussion on the parameters and corresponding observational constraints can be found in \citet{Park2019MNRAS.484..933P}. We stress that our EoR model is both {\it flexible} and {\it physical}; both properties are important for useful inference. It is {\it flexible} in that it is capable of reproducing (see e.g. \citealt{Park2019MNRAS.484..933P}) the bulk properties and scalings of high-redshift galaxy observations (e.g. \citealt{Bouwens2015a,Bouwens2016,Oesch2018ApJ...855..105O}), as well as results from more sophisticated semi-numerical models and hydrodynamic simulations (e.g. \citealt{Mutch2016,Xu2016ApJ...833...84X,Tacchella2018ApJ...868...92T,Behroozi2019MNRAS.488.3143B,Yung2019MNRAS.490.2855Y}). It is {\it physical} in that the equations and parameters have a straightforward interpretation in terms of galaxy evolution, allowing us to set physically-motivated priors for the free parameters. For computational convenience, we fix the cosmology to the best-fit values of {\it Planck} 2018 {\it TT+lowE} ($\Omega_{\mathrm{m}}, \Omega_{\mathrm{b}}, \Omega_{\mathrm{\Lambda}}, h, \sigma_8$ = 0.321, 0.04952, 0.679, 0.6688, 0.8118). In practice, one should co-vary astrophysical and cosmological parameters when performing inference. Fixing cosmological parameters effectively assumes that they are mostly constrained by the temperature and higher-$\ell$ polarization PS {\color{black}(which are not considered in the likelihoods in this work)}, while the $\ell\le29$ E-mode PS constrains the EoR. {\color{black} There are less than 5 percent differences ($<$ 1/3 $\sigma$) in the recovered optical depth from ignoring the temperature component in the likelihood.} However, the most important degeneracy affecting the determination of $\tau_e$ is the known ``$A_s\exp(-2\tau_e)$'' degeneracy \citep{Planck2016A&A...596A.107P}. Using the {\it Tanh} model, we show in Appendix \ref{sec:appendix} that co-varying $\sigma_8$ following that degeneracy has no impact on the reconstructed EoR history. \subsection{Hyperbolic tangent vs. physically motivated EoR model}\label{subsec:tanhvs21cmfast} We perform MCMC simulations for the two different EoR models ({\it Tanh} and {{21\textsc{cmFAST}}}), both constrained using the low-$\ell$ EE PS. As an additional constraint, we also include the model-independent upper limit on the neutral hydrogen fraction at $z\sim5.9$, $\bar{x}_{\mathrm{H}\textsc{i}}<0.06{+}0.05(1\sigma)$, measured from the dark fraction in QSO spectra \citep{McGreer2015MNRAS.447..499M} and modelling the associated likelihood as a one-sided Gaussian \citep{Greig2017}. In Fig. \ref{fig:MCMC_tanh}, we show the resulting posterior for the {\it Tanh} model using orange shaded regions, while the posterior corresponding to the astrophysical model is denoted with purple lines ([14, 86] and [2.3, 97.7] percentiles). The recovered EE PS, $\tau_e$, and EoR history are shown clockwise from the top panel. In the top panel, we see that the differences in the recovered PS are negligible between the two models. Neither model is able to recover the excess power at $20\lsim \ell \lsim 30$. However, the probability-to-exceed of these data as computed in \cite{Planck2019arXiv190712875P} points to a statistical fluctuation rather than a residual systematic error (or new physics not captured by our EoR modelling). \begin{figure*} \begin{minipage}{\textwidth} \begin{center} \includegraphics[width=0.90\textwidth]{./figs/posterior_tanh.pdf \end{center} \end{minipage} \caption{\label{fig:MCMC_tanh} Posteriors of our astrophysical EoR model ({\it purple}) and the {\it Tanh} EoR model ({\it orange}), recovered from the E-mode polarization PS on large scales ($2\le \ell \le 29$; \citealt{Planck2019arXiv190712875P}; grey circles shown in panel 1) and the upper limit on the neutral hydrogen fraction at $z\sim5.9$ (\citealt{McGreer2015MNRAS.447..499M}; grey shaded regions shown in panel 2a). The 14 to 86 (2.3 to 97.7) percentiles of (1) the E-mode polarization PS and (2) the mean neutral hydrogen fraction evolution in the posteriors are presented using thick (thin) lines or dark (light) shaded regions. PDFs of (2a) the neutral hydrogen fraction at $z=5.9$ and (3) the Thompson optical depth are also shown for the two MCMC results. Although the recovered PS and $\tau_e$ are comparable between the two models, the astrophysical model (based on the hierarchical structural growth) results in asymmetric EoR histories with tails towards high redshifts. } \end{figure*} In the bottom right panel, we see that the distributions of $\tau_e$ peak on similar scales, though the shape of the PDFs are qualitatively different. The recovered median and [14,86] percentiles are comparable (i.e. $\tau_e = 0.0533^{+0.0078}_{-0.0068}$ for {\it Tanh}; $\tau_e = 0.0556^{+0.0080}_{-0.0064}$ for the astrophysical model). However, we note that the astrophysical model results in an asymmetric PDF of $\tau_e$, with a tail extending towards high values. The reason for this is apparent looking at the recovered EoR histories in the bottom left panel. The two distributions are comparable around the midpoint of reionization, where a large fraction of the EE power is imprinted. However, the astrophysical model (based on the growth of structure) results in asymmetric EoR histories with a tail towards higher redshifts. For example, at $z=10$, the astrophysical model recovers $\bar{x}_{\mathrm{H}\textsc{i}} \gsim 0.849 (1 \sigma)$, while the {\it Tanh} model recovers $\bar{x}_{\mathrm{H}\textsc{i}} \gsim 0.925 (1 \sigma)$. Thus, although the preference for a higher median optical depth is reduced in {\it Planck} 2018 compared to the 2015 data (see section \ref{subsubsec:planck}), the {\it natural shape} of the EoR history implied by the growth of structure does result in a (modest) high-redshift tail. \subsection{Optical depth vs. power spectra}\label{subsec:tauvsps} In the previous section we discussed how inference from the {\it Planck} 2018 E-mode PS is affected by the choice of EoR models -- {\it Tanh} and astrophysical. In this section, we only use the astrophysical EoR model, and instead investigate the impact of the choice of likelihood statistic -- using the EE PS directly vs using the $\tau_e$ summary statistic. In addition to the choice of CMB statistics, we also account for the (model independent) upper limit on the neutral hydrogen fraction at $z\sim5.9$ from the dark fraction in QSO spectra \citep{McGreer2015MNRAS.447..499M} as well as the galaxy UV luminosity functions (LFs) at $z{=}6{-}10$ from \citet{Bouwens2015a,Bouwens2016,Oesch2018ApJ...855..105O}; both of these independent data sets are included as priors in the total likelihood, as described in \citet{Park2019MNRAS.484..933P}. In Fig. \ref{fig:MCMC}, we show the marginalized posteriors for the astrophysical parameters (panels in {\it lower left corner}), together with the corresponding: (1) EE PS; (2) EoR history; and (3) $\tau_e$ ({\it upper right}). We run three different MCMC simulations corresponding to different combinations of observational data sets used for the likelihood: \begin{enumerate} \item \textit{DarkFraction\_LF}, including high-redshift LFs and the QSO dark fraction upper limit on $\bar{x}_{\mathrm{H}\textsc{i}}(z=5.9)$. This run does not consider any CMB observations; \item \textit{DarkFraction\_tau\_LF}, based on \textit{DarkFraction\_LF}, but including an additional constraint on $\tau_e = 0.0522\pm0.0080$, which is taken from the {\it TT+lowE} reconstruction in {\it Planck} 2018 \citep{Planck2018arXiv180706209P} and was generated using a {\it Tanh} basis set; and \item \textit{DarkFraction\_EE\_LF}, based on \textit{DarkFraction\_LF}, but also forward-modelling the low-$\ell$ E-mode PS using \textsc{class} \citep{Lesgourgues2011arXiv1104.2932L} and includes {\color{black}the low-$\ell$ EE likelihood from {\it Planck} 2018} \citep{Planck2019arXiv190712875P}. These are our ``flagship'' constraints. \end{enumerate} \begin{figure*} \begin{minipage}{\textwidth} \begin{center} \includegraphics[width=\textwidth]{./figs/posterior.pdf \end{center} \end{minipage} \caption{\label{fig:MCMC}Marginalized posterior distributions of the astrophysical model parameters with different observational constraints: (i) \textit{DarkFraction\_LF} (brown shaded regions) uses high-redshift LFs and the QSO dark fraction measurements; (ii) \textit{DarkFraction\_tau\_LF} (red dashed lines) uses high-redshift LFs, the QSO dark fraction measurements and $\tau_e$ derived using a {\it Tanh} EoR model; and (iii) \textit{DarkFraction\_EE\_LF} (blue solid lines) uses high-redshift LFs, the QSO dark fraction measurements, and the low-$\ell$ EE PS. The 2D distributions correspond to 68th (dark regions or thick lines) and 95th (light regions or thin lines) percentiles. The upper-right three sub-panels present the [14, 86] (and [2.3, 97.7]) percentiles of (1) the E-mode polarization PS and (2) evolution of the mean neutral hydrogen fraction ($\bar{x}_{\mathrm{H}\textsc{i}}$), as well as the PDFs of (2a) $x_{\mathrm{H}\textsc{i}}$ at $z{=}5.9$ and (3) the Thompson scattering optical depth. The median and [14, 86] percentiles of the inferred optical depth are presented in the lower right box (4). Observational constraints are indicated in grey. Overall, we see {\it insignificant difference} in the posteriors between \textit{DarkFraction\_tau\_LF} and \textit{DarkFraction\_EE\_LF}, indicating a negligible bias in inference when using the $\tau_e$ summary statistic generated with a different EoR basis set (instead of directly forward-modelling the EE PS).} \end{figure*} Looking at the posterior of \textit{DarkFraction\_LF}, we see that some of our astrophysical parameters are already constrained by galaxy and QSO observations. As pointed out in \citet{Park2019MNRAS.484..933P} (see also e.g. \citealt{Tacchella2018ApJ...868...92T,Behroozi2019MNRAS.488.3143B,Yung2019MNRAS.490.2855Y}), the observed high-redshift UV LFs already constrain the SFR-to-halo mass relation to within factors of ${\sim}2$ (i.e. $f_{*, 10}/t_\ast$ and $\alpha_\ast$) and provide an upper limit on the characteristic halo mass below which the galaxy occupancy fraction starts decreasing ($M_{\rm turn}\lsim 10^{9.5} {{\rm M}_\odot}$; 2$\sigma$). Additionally, the dark fraction measurement of QSO spectra sets a lower limit for the ionizing escape fraction normalization ($f_{\rm esc, 10} > 0.02$; 2$\sigma$), requiring the bulk of reionization to occur before $z\sim6$ (panel 2) and setting a lower limit on $\tau_e$ (panel 3). However, without the CMB, the early stages of reionization are unconstrained (c.f. \citealt{Greig2017}). This is evident from the broad range of EoR histories allowed beyond $z\gtrsim8$ (panel 2), as well as the broad distributions of $\tau_e$ (panel 3) and the PS (panel 1). These early EoR models generally correspond to the high $f_{\rm esc}$ + low $\alpha_{\rm esc}$ corner of astrophysical parameter space.\footnote{We note that if our prior ranges were extended even further, reionization would be allowed at even higher redshifts. However, an important benefit of using an astrophysical EoR model is that it allows us to place physically-motivated priors on the parameters. For example, an ionizing escape fraction cannot be higher than unity, nor can star formation occur efficiently inside halos whose virial temperature is smaller than available gas cooling channels. This is not the case for non-physical or so-called model-independent constraints, for which it can be difficult to choose reasonable priors on the model parameters.} Including CMB observations rules out early reionizing models. Both \textit{DarkFraction\_tau\_LF} and \textit{DarkFraction\_EE\_LF} posteriors disfavour the high $f_{\rm esc}$ and low $\alpha_{\rm esc}$ corner of parameter space. The EE PS, EoR history and $\tau_e$ distributions all shrink. Comparing the \textit{DarkFraction\_tau\_LF} and \textit{DarkFraction\_EE\_LF} posteriors in Fig. \ref{fig:MCMC} quantifies the bias of using the $\tau_e$ summary statistic, generated with a different EoR model, instead of directly forward-modelling the CMB PS. There is a small difference in the EE PS with \textit{DarkFraction\_EE\_LF} allowing for a slightly earlier EoR. In general however the two posteriors are nearly identical. This indicates that, with the {\it Planck} 2018 data, the bias in using $\tau_e$ for the likelihood instead of the EE PS directly is negligible. {\color{black} Finally, Fig. \ref{fig:gamma} presents the constrained photonionization rate ($\Gamma_{\rm ion}$; see equation \ref{eq:gamma}). This serves to further illustrate how a physical model allows us to predict additional IGM properties. We only show {\it DarkFraction\_tau\_LF}, as {\it DarkFraction\_EE\_LF} is nearly identical, while not including the CMB observations allows $\Gamma_{\rm ion}$ to become unrealistically large. The rise in $\Gamma_{\rm ion}$ with redshift is determined by the formation of structure in our galaxy model, with the ``flattening'' seen at $z\lsim$6--7 being due to photo-heating suppression of gas accretion onto galaxies following reionization (e.g. \citealt{Sobacchi2013MNRAS.432L..51S}). We see that while our prediction is consistent with the measured UV ionizing background at $z\sim 5$ to 6 \citep{Bolton2007MNRAS.382..325B,Calverley2011MNRAS.412.2543C,Wyithe2011MNRAS.412.1926W}, observational data lies on the lower boundary. Additionally including $z\sim5$--6 Ly$\alpha$ transmission statistics constrains the upper envelope of $\Gamma_{\rm ion}$ significantly, though the results are more model dependent than those presented here (Qin et al. in prep). } \begin{figure} \begin{minipage}{\columnwidth} \begin{center} \includegraphics[width=\textwidth]{./figs/gamma.pdf \end{center} \end{minipage} \caption{\label{fig:gamma}{\color{black}The [14, 86] (and [2.3, 97.7]) percentiles of the photonionization rate from models used in the {\it DarkFraction\_tau\_LF} posterior in Fig. \ref{fig:MCMC}. Observational constraints \citep{Bolton2007MNRAS.382..325B,Wyithe2011MNRAS.412.1926W,Calverley2011MNRAS.412.2543C} are indicated in grey.} } \end{figure} We should caution however that our findings here are valid in the context of a flat $\Lambda$CDM Universe. An important follow-up to this study will be to generalize these trends to alternative cosmologies (e.g. \citealt{Paoletti2020arXiv200512222P}). It is possible that in some exotic cosmologies, the correlation between parameters describing exotic physics and reionization exist at the level of $\tau_e$ but are broken once the full power of the CMB PS is included, rendering the necessity of joint analysis of reionization data and CMB observations. \section{Conclusions}\label{sec:conclusion} In this work, we develop an interface between {{21\textsc{cmFAST}}} and \textsc{class}, allowing us to forward-model the large-scale E-mode polarization power spectra inside the {21\textsc{CMMC}} sampler. With this setup, we study how the choice of (i) EoR model (astrophysical vs. a {\it Tanh}), and (ii) likelihood statistic ($\tau_e$ vs EE PS), impacts EoR parameter inference. The marginalized posteriors of $\tau_e$ for the {\it Planck} 2018 data \citep{Planck2019arXiv190712875P} are fairly insensitive to the parametrization of the EoR history: {\it Tanh} vs a galaxy model. This is contrary to claims based on the earlier 2015 release (e.g. \citealt{Miranda2017MNRAS.467.4050M,Planck2018arXiv180706209P,Millea2018A&A...617A..96M,Hazra19}). However, the galaxy model (based on standard hierarchical growth of structure) results in asymmetric EoR histories, with the early stages extending to higher redshifts (see also \citealt{Choudhury2006MNRAS.371L..55C,Wise2014,Price2016,Qin2017a,Gorce2018A&A...616A.113G,Kulkarni2018}). As a result, the lower limit on the volume averaged neutral hydrogen fraction at $z=10$ changes from $\bar{x}_{\mathrm{H}\textsc{i}} \gsim 0.93 (1 \sigma)$ using the {\it Tanh} model to $\bar{x}_{\mathrm{H}\textsc{i}} \gsim 0.85 (1 \sigma)$ using an astrophysical model. Using our galaxy EoR model, we quantify the bias in inference when the likelihood is computed from the $\tau_e$ summary statistic, compared with directly using the the measured E-mode polarization PS. We perform MCMC simulations taking into account the current observational constraints from high-redshift galaxy UV LFs \citep{Bouwens2015a,Bouwens2016,Oesch2018ApJ...855..105O} and the model-independent constraints from the dark fraction in QSO spectra \citep{McGreer2015MNRAS.447..499M}. Additionally including either CMB statistic helps constrain the posterior, ruling out models that have a high escape fraction for faint galaxies and hence an early reionization. However, the difference between using $\tau_e$ for the likelihood, compared with the EE PS, is negligible. Our flagship constraints, based on the QSO dark fraction + UV LFs + EE PS, result in an optical depth of $\tau_e = 0.0569_{-0.0066}^{+0.0081} (1\sigma)$, with asymmetric EoR histories. \section*{Acknowledgements} The authors thank V. Miranda for providing data from \citet{Miranda2017MNRAS.467.4050M}. This work was supported by the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (AIDA -- \#638809). The results presented here reflect the authors’ views; the ERC is not responsible for their use. Parts of this research were supported by the Australian Research Council Centre of Excellence for All Sky Astrophysics in 3 Dimensions (ASTRO 3D), through project \#CE170100013. \section*{Data availability} The data underlying this article will be shared on reasonable request to the corresponding author. \bibliographystyle{mn2e}
\section{{Introduction}} Nonlinear time-dependent Schr\"{o}dinger equations contain, by definition, Hamiltonians that depend on the quantum state. Such state-dependent effective Hamiltonians appear in many areas of physics and chemistry. Examples include various nonlinear Schr\"{o}dinger equations generated by the Dirac-Frenkel time-dependent variational principle, \cite{book_Frenkel:1934, Dirac:1930, Broeckhove_Lathouwers:1988, book_Lubich:2008} e.g., the equations of the multi-configurational time-dependent Hartree method,\cite{Meyer_Cederbaum:1990, Manthe_Cederbaum:1992, Beck_Jackle:2000} and some numerical methods such as the short-iterative Lanczos algorithm.\cite{Lanczos:1950, Leforestier_Kosloff:1991, Park_Light:1986} Probably the best known nonlinear Schr\"{o}dinger equations, however, are approximate equations for Bose-Einstein condensates,\cite{Anderson_Cornell:1995, Dalfovo_Stringari:1999} in which the Hamiltonian depends on the probability density of the quantum state. The dynamics of a Bose-Einstein condensate is often modeled by solving the celebrated Gross-Pitaevskii equation with a cubic nonlinearity.\cite{Gross:1961, Pitaevskii:1961, Carles:2002, Carles_Sparber:2008,Minguzzi_Vignolo:2004} To solve this equation, several numerical schemes, such as the explicit split-operator algorithm or the time and spatial finite difference methods have been employed.\cite{Bao_Markowich:2003,Chang_Sun:1999} These methods are of low accuracy (in time and/or space) and do not always preserve the geometric properties of the exact solution.\cite{Antoine_Besse:2013} For example, the Crank--Nicolson finite difference method is geometric but exhibits only second-order convergence with respect to the spatial discretization. To remedy this, the explicit second-order split-operator algorithm,\cite{Feit_Steiger:1982,Kosloff_Kosloff:1983, Kosloff_Kosloff:1983b, book_Tannor:2007} commonly used for the linear time-dependent Schr\"{o}dinger equation, is a great alternative, as it conserves, in some cases, the geometric properties of the exact solution and has spectral accuracy in space. Unfortunately, this algorithm cannot be used for all types of nonlinear time-dependent Schr\"{o}dinger equations. Indeed, in the case of the Gross-Pitaevskii equation, the algorithm is symmetric and, therefore, time-reversible only because the ordinary differential equation that must be solved when propagating the molecular state with the potential part of the Hamiltonian leaves the nonlinear term invariant in time.\cite{Bao_Markowich:2003} We show here that for nonlinear terms of more general form, this algorithm becomes implicit. If this implicit nature is not taken into account and the explicit version is used, the algorithm loses its time reversibility and efficiency due to its low accuracy that is only of the first order in the time step. An example of a situation, where a more general nonlinearity appears, is provided by local control theory (LCT). Introduced by Kosloff \textit{et al.},\cite{Kosloff_Tannor:1989} LCT is a widely used approach to coherent control. In LCT, the pulse is computed on the fly, based on the instantaneous molecular state, in order to increase (or decrease) an expectation value of a specified operator. LCT has been successfully used to control various processes such as energy and population transfer,\cite{Kosloff_Tannor:1989, Kosloff_Tannor:1992, Marquetand_Engel:2006a, Engel_Tannor:2009} dissociation and association dynamics,\cite{Marquetand_Engel:2006b, Marquetand_Engel:2007,Bomble_Desouter-Lecomte:2011,Vranckx_Desouter-Lecomte:2015} direction of rotation in molecular rotors\cite{Yamaki_Fujimura:2005}, and electron transfer.\cite{Vindel-Zandbergen_Sola:2016} Controlling quantum systems using LCT changes the nature of the time-dependent Schr\"{o}dinger equation. Because the time dependence of the pulse is determined exclusively by the molecular state, the time-dependent Schr\"{o}dinger equation becomes autonomous but nonlinear. The nonlinear nature of LCT is often not acknowledged and the standard explicit split-operator algorithm\cite{Feit_Steiger:1982} for linear time-dependent Schr\"{o}dinger equations is used,\cite{Marquetand_Engel:2006b, Marquetand_Engel:2007,Bomble_Desouter-Lecomte:2011,Vranckx_Desouter-Lecomte:2015,Vindel-Zandbergen_Sola:2016} instead of its time-reversible, second-order, but implicit alternative. Most previous studies used LCT for applications that required neither high accuracy nor time reversibility, and therefore could rely on this approximate explicit integrator, which, as we show below, in the context of LCT, indeed has only first-order accuracy in the time step and is time-irreversible. Such an algorithm, however, would be very inefficient for highly accurate calculations, and could not be used at all if exact time reversibility were important. Because this failure of the explicit splitting algorithm in LCT is generic, while its success in the Gross-Pitaevskii equation is rather an exception, it is desirable to develop efficient high-order geometric integrators suitable for a general nonlinear time-dependent Schr\"{o}dinger equation. Recently, we presented high-order time-reversible geometric integrators for the nonadiabatic quantum dynamics driven by the linear time-dependent Schr\"{o}dinger equation with both separable\cite{Roulet_Vanicek:2019} and nonseparable\cite{Choi_Vanicek:2019} Hamiltonians. Here, we extend this work to the general nonlinear Schr\"{o}dinger equation, in order to address the slow convergence and time irreversibility of the explicit split-operator algorithm. The remainder of the study is organized as follows: In Sec.~\ref{sec:theory_lct}, we define the nonlinear time-dependent Schr\"{o}dinger equation, discuss its geometric properties, and explain how LCT leads to a nonlinear Schr\"{o}dinger equation. In Sec.~\ref{sec:geometic_integrators_NLTDSE}, after demonstrating the loss of geometric properties by Euler methods, we describe how these geometric properties are recovered and accuracy increased to an arbitrary even order by symmetrically composing the implicit and explicit Euler methods. Then, we describe a general procedure to perform the implicit propagation and derive explicit expressions for the case of LCT. We also show the derivation of the approximate explicit split-operator algorithm for the nonlinear Schr\"{o}dinger equation, explain how it loses time reversibility and briefly describe the dynamic Fourier method. Finally, in Sec.~\ref{sec:numerical_examples} we numerically verify the convergence and geometric properties of the integrators by controlling, using LCT, either the population or energy transfer in a two-state two-dimensional model of retinal.\cite{Hahn_Stock:2000} \section{Nonlinear Schr\"{o}dinger equation} \label{sec:theory_lct} {The \emph{nonlinear time-dependent Schr\"{o}dinger equation} is the differential equation \begin{equation} i\hbar\frac{d}{dt}|\psi_{t}\rangle=\hat{H}(\psi_{t})|\psi_{t}\rangle, \label{eq:nl_TDSE}% \end{equation} describing the time evolution of the state $\psi_{t}$ driven by the nonlinear Hamiltonian operator $\hat{H}(\psi_{t})$, which depends on the state of the system. This dependence on $\psi_{t}$ is what distinguishes the equation from the linear Schr\"{o}dinger equation. As the notation in Eq.~(\ref{eq:nl_TDSE}) suggests, we shall always assume that while the operator $\hat{H}:\psi \mapsto\hat{H}(\psi)\psi$ is nonlinear, for each $\psi$ th{e operator $\hat {H}(\psi):\phi\mapsto\hat{H}(\psi)\phi$ is linear. We will also assume that $\hat{H}(\psi)$ has real expectation {values} $\langle\hat{H}(\psi)\rangle_{\phi }:=\langle\phi|\hat{H}(\psi)\phi\rangle$ in any state $\phi$, which for a linear operator implies that it is Hermitian, i.e., $\hat{H}(\psi)^{\dag}% =\hat{H}(\psi)$, or, more precisely, that for every $\psi$, $\phi$, $\chi$,% \begin{equation} \langle\phi|\hat{H}(\psi)\chi\rangle=\langle\hat{H}(\psi)\phi|\chi\rangle. \label{eq:hermiticity}% \end{equation} } } { A paradigm of a nonlinear Schr\"{o}dinger equation is the Gross-Pitaevskii equation,\cite{Gross:1961, Pitaevskii:1961, Minguzzi_Vignolo:2004} in position representation expressed as% \[ i\hbar\partial_{t}\psi_{t}(q)=-\frac{\hbar^{2}}{2m}\nabla^{2}\psi _{t}(q)+V(q)\psi_{t}(q)+C|\psi_{t}(q)|^{2}\psi_{t}(q), \] where the real coefficient $C$ is positive for a repulsive interaction and negative for an attractive\ interaction. This equation has a cubic nonlinearity and is useful, e.g., for approximate modeling of the dynamics of a Bose-Einstein condensate.{\cite{Antoine_Besse:2013}} Many other examples are provided by the Dirac-Frenkel variational principle,\cite{Dirac:1930, book_Frenkel:1934} which approximates the exact solution of a linear Schr\"{o}dinger equation with Hamiltonian $\hat{H}$ by an optimal solution of a predefined, restricted form within a certain subset (called the approximation manifold) of the Hilbert space. This optimal solution $\psi_{t}$ satisfies the equation% \begin{equation} \langle\delta\psi_{t}|(i\hbar d/dt-\hat{H})|\psi_{t}\rangle=0, \label{eq:DFVP}% \end{equation} where $\delta\psi_{t}$ is an arbitrary variation in the approximation manifold. Equation (\ref{eq:DFVP})\ is equivalent to the nonlinear Eq.~(\ref{eq:nl_TDSE}) with an effective state-dependent Hamiltonian% \[ \hat{H}(\psi_{t})=\hat{P}(\psi_{t})\hat{H}, \] where $\hat{P}(\psi_{t})$ is the projection operator on the tangent space to the approximation manifold at the point $\psi_{t}$% .\cite{book_Lubich:2008,Lasser_Lubich:2020} (Note that in the very special case, where the projector does not depend on $\psi_{t}$, the resulting Schr\"{o}dinger equation remains linear. This happens in the Galerkin method, in which $\psi_{t}$ is expanded in a finite, time-independent basis and the approximation manifold is a vector space.\cite{book_Lubich:2008})} \subsection{Geometric properties of the exact evolution operator} With initial condition $|\psi_{t_{0}}\rangle$ {and assuming that $t\geq t_{0}$}, Eq.~(\ref{eq:nl_TDSE}) has the formal solution $|\psi _{t}\rangle=\hat{U}(t,t_{0};\psi)|\psi_{t_{0}}\rangle$ with the exact evolution operator given by \begin{equation} \hat{U}(t,t_{0};\psi):=\mathcal{T}\exp\left[ -\frac{i}{\hbar}\int_{t_{0}}% ^{t}dt^{\prime}\hat{H}(\psi_{t^{\prime}})\right] , \label{eq:evol_oper_ex_LCT}% \end{equation} where the dependence of $\hat{U}$ on $\psi$ was added as an argument to emphasize the nonlinear character of Eq.~(\ref{eq:nl_TDSE}). {Expression (\ref{eq:evol_oper_ex_LCT}) is obtained by solving the differential equation% \[ i\hbar\frac{\partial}{\partial t}\hat{U}(t,t_{0};\psi)=\hat{H}(\psi_{t}% )\hat{U}(t,t_{0};\psi) \] with initial condition $\hat{U}(t_{0},t_{0};\psi)=1$.{ The \emph{Hermitian adjoint} of $\hat{U}(t,t_{0};\psi)$ is the operator% \begin{equation} \hat{U}(t,t_{0};\psi)^{\dag}=\mathcal{\bar{T}}\exp\left[ \frac{i}{\hbar}% \int_{t_{0}}^{t}dt^{\prime}\hat{H}(\psi_{t^{\prime}})\right] =\hat{U}% (t,t_{0};\psi)^{-1}, \label{eq:U_adj}% \end{equation} where $\mathcal{\bar{T}}$ denotes the reverse time-ordering operator.} } The nonlinearity of $\hat{H}$ leads to the loss of some geometric properties, even if Eq.~(\ref{eq:nl_TDSE}) is solved exactly. Indeed, since the Hamiltonian is nonlinear, the exact evolution operator is also nonlinear. { An operator $\hat{U}$ is said to \emph{preserve the inner product} (or to be \emph{unitary}) if $\langle\hat{U}\psi|\hat{U}\phi\rangle=\langle\psi |\phi\rangle$. The exact evolution operator does not preserve the inner product because% \begin{align} \langle\psi_{t}|\phi_{t}\rangle & =\langle\hat{U}(t,t_{0};\psi)\psi_{t_{0}% }|\hat{U}(t,t_{0};\phi)\phi_{t_{0}}\rangle\nonumber\\ & =\langle\psi_{t_{0}}|\hat{U}(t,t_{0};\psi)^{\dagger}\hat{U}(t,t_{0}% ;\phi)\phi_{t_{0}}\rangle\nonumber\\ & =\langle\psi_{t_{0}}|\hat{U}(t,t_{0};\psi)^{-1}\hat{U}(t,t_{0};\phi )\phi_{t_{0}}\rangle\nonumber\\ & \neq\langle\psi_{t_{0}}|\phi_{t_{0}}\rangle \end{align} if $\psi_{t_{0}}\neq\phi_{t_{0}}${, where we used the property (\ref{eq:U_adj}) of the Hermitian adjoint of $\hat{U}$ to obtain the third line}. The exact nonlinear evolution operator is, therefore, not \emph{symplectic} because it does not preserve the associated symplectic two-form\cite{book_Lubich:2008} \begin{equation} \omega(\psi,\phi):=-2\hbar\operatorname{Im}\langle\psi|\phi\rangle. \label{eq:two_form}% \end{equation} The nonlinear evolution does not conserve \emph{energy}% \[ E_{t}:=\langle\hat{H}\left( \psi_{t}\right) \rangle_{\psi_{t}}=\langle \psi_{t}|\hat{H}(\psi_{t})\psi_{t}\rangle, \] since% \begin{align} \frac{dE_{t}}{dt} & =\langle\dot{\psi}_{t}|\hat{H}(\psi_{t})|\psi_{t}% \rangle+\langle\psi_{t}|\frac{d}{dt}\hat{H}(\psi_{t})|\psi_{t}\rangle \nonumber\\ & \qquad+\langle\psi_{t}|\hat{H}(\psi_{t})|\dot{\psi}_{t}\rangle\nonumber\\ & =\langle d\hat{H}(\psi_{t})/dt\rangle_{\psi_{t}}\neq0, \label{eq:exact_energy}% \end{align} where the first and third terms in the intermediate step cancel each other because $\psi_{t}$ satisfies the nonlinear Schr\"{o}dinger equation (\ref{eq:nl_TDSE}). Note, however, that in special cases, such as the Gross-Pitaevskii equation, there exist modified energy functionals that are conserved.{\cite{Antoine_Besse:2013}} An operator $\hat{U}$ is said to \emph{conserve the norm} $\Vert\psi \Vert:=\langle\psi|\psi\rangle^{1/2}$ if $\Vert\hat{U}\psi\Vert=\Vert\psi \Vert$. The exact nonlinear evolution operator $\hat{U}\equiv\hat{U}% (t,t_{0};\psi)$ conserves the norm because% \begin{align} \Vert\psi_{t}\Vert^{2} & =\Vert\hat{U}\psi_{t_{0}}\Vert^{2}=\langle\hat {U}\psi_{t_{0}}|\hat{U}\psi_{t_{0}}\rangle\nonumber\\ & =\langle\psi_{t_{0}}|\hat{U}^{\dagger}\hat{U}\psi_{t_{0}}\rangle =\langle\psi_{t_{0}}|\psi_{t_{0}}\rangle=\Vert\psi_{t_{0}}\Vert^{2}, \label{eq:exact_norm}% \end{align} where we used relation (\ref{eq:U_adj}). { In the theory of dynamical systems, an \emph{adjoint} $\hat{U}(t,t_{0};\psi)^{\ast}$} of $\hat{U}(t,t_{0};\psi)$ is defined as the inverse of the evolution operator taken {[in contrast to the Hermitian adjoint (\ref{eq:U_adj})]} with a reversed time flow: \begin{equation} \hat{U}(t,t_{0};\psi)^{\ast}:=\hat{U}(t_{0},t;\psi)^{-1}. \end{equation} An operator $\hat{U}(t,t_{0};\psi)$ is called \emph{symmetric} if it is equal to its adjoint, i.e., if $\hat{U}(t,t_{0};\psi)=\hat{U}(t,t_{0};\psi)^{\ast}$. A symmetric operator is also \emph{time-reversible} because propagating a molecular state $\psi_{t_{0}}$ forward to time $t$ and then backward to time $t_{0}$ yields $\psi_{t_{0}}$ again, i.e., \begin{align} & \hat{U}(t_{0},t;\psi)\hat{U}(t,t_{0};\psi)\psi_{t_{0}}\nonumber\\ & =\hat{U}(t_{0},t;\psi)\hat{U}(t,t_{0};\psi)^{\ast}\psi_{t_{0}}\nonumber\\ & =\hat{U}(t_{0},t;\psi)\hat{U}(t_{0},t;\psi)^{-1}\psi_{t_{0}}=\psi_{t_{0}}. \label{eq:forward_backward}% \end{align} For the operator (\ref{eq:evol_oper_ex_LCT}), the reverse evolution operator is given by the anti-time-ordered exponential \begin{equation} \hat{U}(t_{0},t;\psi):=\bar{\mathcal{T}}\exp\left[ -\frac{i}{\hbar}\int% _{t}^{t_{0}}dt^{\prime}\hat{H}(\psi_{t^{\prime}})\right] \end{equation} and, therefore, the adjoint is \begin{align} \hat{U}(t,t_{0};\psi)^{\ast} & =\left\{ \bar{\mathcal{T}}\exp\left[ -\frac{i}{\hbar}\int_{t}^{t_{0}}dt^{\prime}\hat{H}(\psi_{t^{\prime}})\right] \right\} ^{-1}\nonumber\\ & =\mathcal{T}\exp\left[ \frac{i}{\hbar}\int_{t}^{t_{0}}dt^{\prime}\hat {H}(\psi_{t^{\prime}})\right] \nonumber\\ & =\mathcal{T}\exp\left[ -\frac{i}{\hbar}\int_{t_{0}}^{t}dt^{\prime}\hat {H}(\psi_{t^{\prime}})\right] =\hat{U}(t,t_{0};\psi). \end{align} This shows that the exact evolution operator (\ref{eq:evol_oper_ex_LCT}) is symmetric and time-reversible. Finally, a time evolution is said to be \emph{stable} if for every $\epsilon>0$ there is a $\delta>0$ such that the distance between two states satisfies the condition \begin{equation} \Vert\psi_{t_{0}}-\phi_{t_{0}}\Vert<\delta\implies\Vert\psi_{t}-\phi_{t}% \Vert<\epsilon\text{ for all }t>t_{0}. \end{equation} Although the exact evolution conserves the norm, because it does not conserve the inner product, we cannot, in general, say anything about preserving the distance: \begin{align} \Vert\psi_{t}-\phi_{t}\Vert^{2} & =\Vert\psi_{t}\Vert^{2}+\Vert\phi_{t}% \Vert^{2}-2\operatorname{Re}\langle\psi_{t}|\phi_{t}\rangle\nonumber\\ & =\Vert\psi_{t_{0}}\Vert^{2}+\Vert\phi_{t_{0}}\Vert^{2}-2\operatorname{Re}% \langle\psi_{t}|\phi_{t}\rangle\nonumber\\ & =\Vert\psi_{t_{0}}-\phi_{t_{0}}\Vert^{2}+2\operatorname{Re}\left( \langle\psi_{t_{0}}|\phi_{t_{0}}\rangle-\langle\psi_{t}|\phi_{t}\rangle\right) \nonumber\\ & \neq\Vert\psi_{t_{0}}-\phi_{t_{0}}\Vert^{2}. \label{eq:exact_stability}% \end{align} Moreover, since the sign of the real part of the difference of the inner products can be arbitrary, we cannot deduce anything about stability.} \subsection{Nonlinear character of local control theory} \label{subsec:lct} {We now show that the local coherent control of the time evolution of a quantum system with an electric field provides another example of a nonlinear Schr\"{o}dinger equation. The} quantum state $|\psi_{t}\rangle$ of a system interacting with an external time-dependent electric field $\vec{E}(t)$ evolves according to the linear time-dependent Schr\"{o}dinger equation \begin{equation} i\hbar\frac{d}{dt}|\psi_{t}\rangle=\hat{H}(t)|\psi_{t}\rangle\label{eq:TDSE}% \end{equation} with a time-dependent Hamiltonian \begin{equation} \hat{H}(t):=\hat{H}_{0}+\hat{V}_{\text{int}}(t), \label{eq:TD-ham}% \end{equation} equal to the sum of the Hamiltonian $\hat{H}_{0}$ of the system in the absence of the field and the interaction potential $\hat{V}_{\text{int}}(t)$. {Within the electric-dipole approximation}% ,\cite{Schatz_Ratner_book:2002} the interaction potential is \begin{equation} \hat{V}_{\text{int}}(t):=-\vec{\mu}(\hat{q})\cdot\vec{E}(t), \label{eq:int_pot}% \end{equation} where the vector function $\vec{\mu}(\hat{q})$ { of the position operator $\hat{q}$} denotes the electric-dipole operator of the system. Direct integration of Eq.~(\ref{eq:TDSE}) with initial condition $|\psi_{t_{0}% }\rangle$ leads to the formal solution $|\psi_{t}\rangle=\hat{U}(t,t_{0}% )|\psi_{t_{0}}\rangle$ with the exact evolution operator given by the time-ordered exponential \begin{equation} \hat{U}(t,t_{0}):=\mathcal{T}\exp\left[ -\frac{i}{\hbar}\int_{t_{0}}% ^{t}dt^{\prime}\hat{H}(t^{\prime})\right] . \label{eq:evol_oper_ex}% \end{equation} This exact evolution operator has many important geometric properties: it is linear, unitary, symmetric, time-reversible, and stable.\cite{book_Halmos:1942, book_Leimkuhler_Reich:2004, book_Lubich:2008, book_Hairer_Wanner:2006} Because it is unitary, the evolution operator conserves the norm as well as the inner product and symplectic structure.\cite{book_Lubich:2008} However, since the Hamiltonian is time-dependent, the Schr\"{o}dinger equation~(\ref{eq:TDSE}) is a nonautonomous differential equation,\cite{book_Hairer_Wanner:2006} and as a consequence, does not conserve energy. For a more detailed presentation and discussion of the above properties, we refer the reader to Ref.~\onlinecite{Choi_Vanicek:2019}. Contrary to Eq.~(\ref{eq:int_pot}), the electric field used in LCT, called control field and denoted by $\vec{E}_{\text{LCT}}(t)$, is not known explicitly as a function of time. Instead, it is chosen \textquotedblleft on the fly\textquotedblright\ according to the current state $|\psi_{t}\rangle$ of the system, in order to increase or decrease the expectation value $\langle\hat{O}\rangle_{{\psi}_{t}}:=\langle\psi_{t}|\hat{O}|\psi_{t}\rangle$ of a particular operator $\hat{O}$ in the state $|\psi_{t}\rangle$. More precisely, the control field is computed so that the time derivative of the expectation value, \begin{align} \frac{d\langle\hat{O}\rangle_{\psi_{t}}}{dt} & =\frac{i}{\hbar}% \langle\lbrack\hat{H}(t),\hat{O}]\rangle_{\psi_{t}}\nonumber\\ & =\frac{i}{\hbar}\left\{ \langle\lbrack\hat{H}_{0},\hat{O}]\rangle _{\psi_{t}}-\vec{E}_{\text{LCT}}(t)\cdot\langle\lbrack\hat{\vec{\mu}},\hat {O}]\rangle_{\psi_{t}}\right\} , \label{eq:O_derivative}% \end{align} remains positive or negative at all times. If the operator $\hat{O}$ commutes with the system's Hamiltonian $\hat{H}_{0}$, this goal is achieved by using the field \begin{equation} \vec{E}_{\text{LCT}}(t)\equiv\vec{E}_{\text{LCT}}(\psi_{t}):=\pm\lambda i\langle\lbrack\hat{\vec{\mu}},\hat{O}]\rangle_{\psi_{t}}^{\ast}=\mp\lambda i\langle\lbrack\hat{\vec{\mu}},\hat{O}]\rangle_{\psi_{t}}, \label{eq:LCT_field}% \end{equation} where $\lambda>0$ is a parameter which scales the intensity of the control field and the sign in Eq.~(\ref{eq:LCT_field}) is chosen according to whether one wants to increase or decrease $\langle\hat{O}\rangle_{\psi_{t}}$. This claim is proven by inserting the definition~(\ref{eq:LCT_field}) of $\vec {E}_{\text{LCT}}(t)$ into Eq.~(\ref{eq:O_derivative}), which yields \begin{equation} \frac{d\langle\hat{O}\rangle_{\psi_{t}}}{dt}=\frac{i}{\hbar}\langle\lbrack \hat{H}_{0},\hat{O}]\rangle_{\psi_{t}}\pm\frac{\lambda}{\hbar}\Vert \langle\lbrack\hat{\vec{\mu}},\hat{O}]\rangle_{\psi_{t}}\Vert^{2} \label{eq:O_derivative_simplified}% \end{equation} for the derivative of the expectation value. This equation confirms that a strictly increasing or strictly decreasing evolution of $\langle\hat{O}% \rangle_{\psi_{t}}$ is guaranteed only if $[\hat{H}_{0},\hat{O}]=0$, largely reducing the choice of operators $\hat{O}$ whose expectation values we can control monotonically. The left-hand side of Eq.~(\ref{eq:LCT_field}) suggests that the control field can be either viewed as a function of time or a function of the molecular state [i.e., $\vec{E}_{\text{LCT}}(t)\equiv\vec{E}_{\text{LCT}}(\psi_{t})$]. More precisely, the control field does not depend on time explicitly but only implicitly through the dependence on $\psi_{t}$. Therefore, the time-dependent Schr\"{o}dinger equation changes from a nonautonomous linear to an autonomous nonlinear differential equation.\cite{book_Hairer_Wanner:2006} By acknowledging this nonlinear character, the interaction potential from Eq.~(\ref{eq:int_pot}) becomes \begin{equation} \hat{V}_{\text{LCT}}(\psi_{t}):=-\hat{\vec{\mu}}\cdot\vec{E}_{\text{LCT}}% (\psi_{t}) \label{eq:nl_int_pot}% \end{equation} and Eq.~(\ref{eq:TDSE}) becomes an example of a nonlinear time-dependent Schr\"{o}dinger equation (\ref{eq:nl_TDSE}) with Hamiltonian operator $\hat {H}(\psi):=\hat{H}_{0}+\hat{V}_{\text{LCT}}(\psi)$. \section{Geometric integrators for the nonlinear Schr\"{o}dinger equation} \label{sec:geometic_integrators_NLTDSE} Numerical propagation methods for solving the nonlinear equation (\ref{eq:nl_TDSE}) obtain the state at time $t+\Delta t$ from the state at time $t$ by using the relation \begin{equation} |\psi_{t+\Delta t}\rangle=\hat{U}_{\text{appr}}(t+\Delta t,t;\psi)|\psi _{t}\rangle, \end{equation} where $\Delta t$ denotes the numerical time step and $\hat{U}_{\text{appr}% }(t+\Delta t,t;\psi)$ is an approximate nonlinear evolution operator depending on $\psi$. { By construction, all propagation methods converge to the exact solution in the limit $\Delta t\rightarrow0$. As the exact operator, these approximate evolution operators $\hat{U}_{\text{appr}}(t+\Delta t,t;\psi)$ are, therefore, nonlinear and conserve neither the inner product nor the symplectic form. Moreover, nothing can be said about their stability in general. However, some integrators may lose even the remaining geometric properties of the exact evolution: norm conservation, symmetry, and time reversibility. In this section, we simply state the properties that are lost by different methods; detailed proofs are provided in Appendix \ref{sec:proof_geometric_prop}. } \subsection{Loss of geometric properties by Euler methods} \label{subsec:lct_euler_methods} The simplest methods, applicable to both separable and nonseparable and both linear and nonlinear Hamiltonian operators, are the \emph{explicit} and \emph{implicit} Euler\cite{book_Lubich:2008, book_Leimkuhler_Reich:2004} methods which approximate the exact evolution operator, respectively, as \begin{align} \hat{U}_{\text{expl}}(t+\Delta t,t;\psi_{t}) & :=1-i\hat{H}(\psi_{t})\Delta t/\hbar,\label{eq:expl}\\ \hat{U}_{\text{impl}}(t+\Delta t,t;\psi_{t+\Delta t}) & :=[1+i\hat{H}% (\psi_{t+\Delta t})\Delta t/\hbar]^{-1}. \label{eq:impl}% \end{align} Both methods are only first-order in the time step and, therefore, very inefficient. { Moreover, both Euler methods lose the norm conservation, symmetry, and time reversibility of the exact evolution operator.} \subsection{Recovery of geometric properties and increasing accuracy by composition} \label{subsec:lct_geom_methods} Composing the implicit and explicit Euler methods yields, {depending on the order of composition,} either the \emph{implicit midpoint} method \begin{multline} \hat{U}_{\text{mid}}(t+\Delta t,t;\psi_{t+\Delta t/2})\label{eq:mid}\\ :=\hat{U}_{\text{expl}}(t+\Delta t,t+\Delta t/2;\psi_{t+\Delta t/2})\\ \times\hat{U}_{\text{impl}}(t+\Delta t/2,t;\psi_{t+\Delta t/2}) \end{multline} {or the \emph{trapezoidal rule} (or \emph{Crank--Nicolson} method) } \begin{multline} \hat{U}_{\text{trap}}(t+\Delta t,t;\psi)\label{eq:trap}\\ :=\hat{U}_{\text{impl}}(t+\Delta t,t+\Delta t/2;\psi_{t+\Delta t})\\ \times\hat{U}_{\text{expl}}(t+\Delta t/2,t;\psi_{t}). \end{multline} {Both methods are second-order, symmetric, and time-reversible regardless of the size of the time step.\cite{book_Hairer_Wanner:2006,Choi_Vanicek:2019} Although the trapezoidal rule conserves the norm of a state evolved with a time-independent linear Hamiltonian,\cite{Choi_Vanicek:2019} it loses this property when the Hamiltonian is time-dependent or nonlinear (which results, as we have seen, in an implicit time dependence). In contrast, the implicit midpoint method remains norm-conserving in all cases.} Because they are symmetric, both methods can be further composed using symmetric composition schemes\cite{book_Lubich:2008, book_Hairer_Wanner:2006, Yoshida:1990, Suzuki:1990, Kahan_Li:1997, Sofroniou_Spaletta:2005,Choi_Vanicek:2019} in order to obtain integrators of arbitrary even order of accuracy in the time step. Indeed, every symmetric method $\hat{U}_{p}$ of an even order $p$ generates a method $\hat{U}_{p+2}$ of order $p+2$ if it is symmetrically composed as \begin{multline} \hat{U}_{p+2}(t+\Delta t,t;\psi):=\hat{U}_{p}(t+\gamma_{M}\Delta t,t+\gamma_{M-1}\Delta t;\psi)\nonumber\\ \quad\cdots\hat{U}_{p}(t+\gamma_{1}\Delta t,t;\psi), \end{multline} where $M$ is the number of composition steps, $\gamma_{1},\dots,\gamma_{M}$ are real composition coefficients which satisfy the relations $\sum_{n=1}% ^{M}\gamma_{n}=1$, $\gamma_{M+1-n}=\gamma_{n},$ and a more-involved third condition\cite{book_Hairer_Wanner:2006} guaranteeing the increase in the order of accuracy. {The simplest composition methods that are used here are the triple-jump~\cite{Yoshida:1990} and Suzuki's fractal\cite{Suzuki:1990} with $M=3$ and $M=5$, respectively. Both are recursive and able to generate integrators of arbitrary even orders of accuracy. Sixth, eighth, and tenth-order integrators can also be obtained with nonrecursive composition methods\cite{Kahan_Li:1997, Sofroniou_Spaletta:2005} which require fewer composition steps and also minimize their magnitude. These composition methods are therefore more efficient than the triple-jump and Suzuki's fractal and will be referred to as \textquotedblleft optimal\textquotedblright% \ compositions. For more details on symmetric compositions, see % Ref.~\onlinecite{Choi_Vanicek:2019}, where they were applied to a linear Schr\"{o}dinger equation.} \subsection{Solving the implicit step in a general nonlinear Schr\"{o}dinger equation} \label{subsec:implicit_step} The implicit Euler method requires implicit propagation because its integrator [see Eq.~(\ref{eq:impl})] depends on the result of the propagation, i.e., $\psi_{t+\Delta t}$. In the implicit Euler method, $\psi_{t+\Delta t}$ is obtained by solving the nonlinear system \begin{equation} \hat{U}_{\text{impl}}(t+\Delta t,t;\psi_{t+\Delta t})^{-1}|\psi_{t+\Delta t}\rangle=|\psi_{t}\rangle, \end{equation} which can be written as $f(\psi_{t+\Delta t})=0$ with the nonlinear functional \begin{align} f(\psi): & =\hat{U}_{\text{impl}}(\psi)^{-1}\psi-\psi_{t}\nonumber\\ & =[\hat{1}+i\hat{H}(\psi)\Delta t/\hbar]\psi-\psi_{t}. \label{eq:nl_system}% \end{align} A nonlinear system $f(\psi)=0$ can be solved with the iterative Newton-Raphson method, which computes, until convergence is obtained, the solution $\psi^{(k+1)}$ at iteration $k+1$ from $\psi^{(k)}$ using the relation% \begin{equation} \psi^{(k+1)}=\psi^{(k)}-\hat{J}(\psi^{(k)})^{-1}f(\psi^{(k)}), \label{eq:newton-raphson}% \end{equation} where $\hat{J}:=\frac{\delta}{\delta\psi}f(\psi)$ is the Jacobian of the nonlinear functional $f(\psi)$. If the initial guess $\psi^{(0)}$ is close enough to the exact solution of the implicit propagation, the Newton-Raphson iteration~(\ref{eq:newton-raphson}) is a contraction mapping and by the fixed-point theorem is guaranteed to converge. We use as the initial guess the result of propagating $\psi_{t}$ with the explicit Euler method [Eq.~(\ref{eq:expl})]. Note that this initial guess is sufficiently close to the implicit solution only if the time step is small. If the time step is too large, the difference between the explicit and implicit propagations becomes too large for the algorithm to converge and no solution can be obtained. Equation (\ref{eq:newton-raphson}) requires computing the inverse of the Jacobian which is an expensive task. It is preferable to avoid this inversion by computing each iteration as \begin{equation} \psi^{(k+1)}=\psi^{(k)}+\delta\psi^{(k)} \label{eq:iteration}% \end{equation} where $\delta\psi^{(k)}$ solves the linear system \begin{equation} \hat{J}(\psi^{(k)})\delta\psi^{(k)}=-f(\psi^{(k)}). \label{eq:linear_system}% \end{equation} We solve this linear system by the generalized minimal residual method~\cite{book_Press_Flannery:1992, Saad_Schultz:1986, book_Saad:2003}, an iterative method based on the Arnoldi process\cite{Arnoldi:1951,Saad:1980} {(see Sec.~I of the supplementary material for a detailed presentation of this algorithm).} The procedure presented for solving the implicit propagation is applicable to any nonlinear system whose Jacobian is known analytically. Therefore, the integrators proposed in Secs.~\ref{subsec:lct_euler_methods} and \ref{subsec:lct_geom_methods} can be employed for solving any nonlinear time-dependent Schr\"{o}dinger equation of the form of Eq.~(\ref{eq:nl_TDSE}), i.e., with a Hamiltonian $\hat{H}(\psi_{t})$ depending on the state of the system. {To sum up, each implicit propagation step, given by the evolution operator (\ref{eq:impl}), is performed as follows:} \begin{enumerate} \item {Compute the initial guess $\psi^{(0)}$ using the explicit Euler method [see Eq.~(\ref{eq:expl})]. Choose an error threshold $\varepsilon$ and a maximum iteration number $m$.} \item {For $k=0,1,\dots,m-1$, Do:} {\setlength\itemindent{2em}} \item {Compute $\delta\psi^{(k)}$ by solving the linear system shown in Eq.~(\ref{eq:linear_system}).\label{item:solve_linear}} {\setlength\itemindent{2em}} \item {Compute a new approximate solution $\psi^{(k+1)}$ using Eq.~(\ref{eq:iteration}).} {\setlength\itemindent{2em} } \item {If $\Vert f(\psi^{(k+1)})\Vert\leq\varepsilon$, take $\psi^{(k+1)}$ as the solution of the implicit step.} \item {End Do. The algorithm fails when $k=m$ and no approximate solution has been found.} \end{enumerate} \subsection{Solving the implicit step in LCT} In the case of LCT, \[ \hat{U}_{\text{LCT,impl}}(\psi)^{-1}=\hat{1}+i\Delta t[\hat{H}_{0}+\hat {V}_{\text{LCT}}(\psi)]/\hbar, \] and the Jacobian of the nonlinear functional (\ref{eq:nl_system}) is% \begin{align} \hat{J}(\psi) & =\frac{\delta}{\delta\psi}\left[ \hat{U}_{\text{LCT,impl}% }(\psi)^{-1}\right] \psi+\hat{U}_{\text{LCT,impl}}(\psi)^{-1}\hat {1}\nonumber\\ & =\frac{i}{\hbar}\Delta t\frac{\delta}{\delta\psi}\left[ \hat {V}_{\text{LCT}}(\psi)\right] \psi+\hat{U}_{\text{LCT,impl}}(\psi )^{-1}\nonumber\\ & =\frac{i}{\hbar}\Delta t\hat{V}_{\text{LCT}}(\psi)+\hat{1}+\frac{i}{\hbar }\Delta t\left[ \hat{H}_{0}+\hat{V}_{\text{LCT}}(\psi)\right] \nonumber\\ & =\hat{1}+i\Delta t[\hat{H}_{0}+2\hat{V}_{\text{LCT}}(\psi)]/\hbar. \label{eq:Jacobian_impl}% \end{align} To obtain the third row of Eq.~(\ref{eq:Jacobian_impl}), we used $\frac {\delta}{\delta\psi}[\hat{V}_{\text{LCT}}(\psi)]\psi=\hat{V}_{\text{LCT}}% (\psi)$, where the generalized complex derivative\cite{Petersen_Pedersen:2012} of the interaction potential is given by {the bra vector} \begin{equation} \frac{\delta}{\delta\psi}\hat{V}_{\text{LCT}}(\psi)=-\hat{\vec{\mu}}\cdot \frac{\delta}{\delta\psi}\vec{E}_{\text{LCT}}(\psi)=\mp\lambda i\hat{\vec{\mu }}\cdot\langle\psi|[\hat{\vec{\mu}},\hat{O}]. \end{equation} \subsection{Approximate application of the explicit split-operator algorithm to the nonlinear Schr\"{o}dinger equation} \label{subsec:naive_so} The algorithms that we described above apply to Hamiltonians that are not only nonlinear but also nonseparable, i.e., to Hamiltonians $\hat{H}$ which cannot be written as a sum $\hat{H}=T(\hat{p})+V(\hat{q})$ of a momentum-dependent kinetic term and position-dependent potential term. If the time-dependent Schr\"{o}dinger equation is linear and its Hamiltonian is separable, the midpoint method remains implicit, but the split-operator algorithms and their compositions yield explicit high-order integrators satisfying most geometric properties (except for the conservation of energy). In the case of LCT, if $\hat{H}_{0}$ is separable, so is the total Hamiltonian, which can be written as $\hat{H}(\psi)=\hat{T}+\hat{V}_{\text{tot}}(\psi)$, where $\hat {V}_{\text{tot}}(\psi):=\hat{V}_{0}+\hat{V}_{\text{LCT}}(\psi)$ is the sum of the system's and interaction potential energy operators. It is, therefore, tempting to use the split-operator algorithm, with the hope of obtaining an efficient explicit integrator. More generally, let us assume that the Hamiltonian operator in the general nonlinear Schr\"{o}dinger equation (\ref{eq:nl_TDSE}) can be separated as% \[ \hat{H}(\psi)=T(\hat{p})+V_{\text{tot}}(\hat{q},\psi). \] The approximate evolution operator is given by \begin{equation} \hat{U}_{\text{TV}}(t+\Delta t;t,\psi_{t}):=e^{-i\hat{T}\Delta t/\hbar }e^{-i\hat{V}_{\text{tot}}(\psi_{t})\Delta t/\hbar} \label{eq:TV}% \end{equation} in the \emph{TV} split-operator algorithm and by \begin{equation} \hat{U}_{\text{VT}}(t+\Delta t;t,\psi_{t+\Delta t}):=e^{-i\hat{V}_{\text{tot}% }(\psi_{t+\Delta t})\Delta t/\hbar}e^{-i\hat{T}\Delta t/\hbar} \label{eq:VT}% \end{equation} in the \emph{VT} split-operator algorithm. These integrators are norm-conserving but only first-order and time-irreversible. From their definitions (\ref{eq:TV}) and (\ref{eq:VT}), it follows immediately that the TV and VT algorithms are adjoints\cite{Roulet_Vanicek:2019} of each other and require, respectively, explicit and implicit propagations. In analogy to the implicit midpoint algorithm from Sec.~\ref{subsec:lct_geom_methods}, a second-order method is obtained by composing the two adjoint methods to obtain the \emph{TVT }split-operator algorithm \begin{multline} \hat{U}_{\text{TVT}}(t+\Delta t;t,\psi_{t+\Delta t/2})\label{eq:TVT}\\ :=\hat{U}_{\text{TV}}(t+\Delta t;t+\Delta t/2,\psi_{t+\Delta t/2})\\ \times\hat{U}_{\text{VT}}(t+\Delta t/2;t,\psi_{t+\Delta t/2}), \end{multline} or the \emph{VTV} split-operator algorithm if the order of composition is reversed. Both TVT and VTV algorithms are norm-conserving, symmetric, and time-reversible. However, these geometric properties are only acquired if the implicit part, i.e., the propagation with the VT algorithm~(\ref{eq:TVT}) is performed exactly. This requires solving a nonlinear system, which can be performed using the Newton-Raphson method, as described in Sec.~\ref{subsec:implicit_step}. This, however, implies abandoning the explicit nature of the split-operator algorithm, which is one of its main advantages over implicit methods for solving linear Schr\"{o}dinger equations. {The nonlinearity of Eq.~(\ref{eq:nl_TDSE}) is often not acknowledged. As a consequence, the implicit character of Eqs.~(\ref{eq:VT}% )-(\ref{eq:TVT}) is not taken into account and explicit alternatives of these algorithms are used. For example, instead of using $\psi_{t+\Delta t}$ in the VT algorithm (i.e., performing the implicit propagation exactly), the state $\psi_{t,\hat{T}\Delta t}:=e^{-i\hat{T}\Delta t/\hbar}\psi_{t}$ obtained after the kinetic propagation is often used to perform the potential propagation.After composition with the TV algorithm, it yields the \emph{approximate explicit} TVT split-operator algorithm} \begin{multline} \hat{U}_{\text{expl TVT}}(t+\Delta t;t,{\psi_{t,\hat{T}\Delta t/2}% })\label{eq:TVT_naive}\\ :=\hat{U}_{\text{TV}}(t+\Delta t;t+\Delta t/2,{\psi_{t,\hat{T}\Delta t/2}})\\ \times\hat{U}_{\text{VT}}(t+\Delta t/2;t,{\psi_{t,\hat{T}\Delta t/2}}). \end{multline} {This approximate explicit integrator can be used to successfully perform LCT but, because it depends on $\psi_{t,\hat{T}\Delta t/2}$ instead of $\psi_{t+\Delta t/2}$, it is not time-reversible and achieves only first-order accuracy. Like the approximate explicit TVT algorithm, any other explicit algorithm cannot perform the implicit step of the $\hat{U}_{VT}$ algorithm exactly and, therefore, cannot be time-reversible. Yet, the approximate explicit algorithm does conserve norm (see Appendix \ref{sec:proof_geometric_prop} for proofs of the geometric properties).} \subsection{{Dynamic Fourier method}} To propagate the molecular state using the algorithms presented in Sec.~\ref{sec:geometic_integrators_NLTDSE}, an efficient way of evaluating the action of an operator on the molecular state $\psi_{t}$ is needed. For this, we use the dynamic Fourier method,\cite{Feit_Steiger:1982, book_Tannor:2007,Kosloff_Kosloff:1983, Kosloff_Kosloff:1983b} which is applicable to operators that are sums of products of operators of the form $f(\hat{x})$, where $\hat{x}$ denotes either the momentum operator $\hat{p}$ or position operator $\hat{q}$. The computation of $f(\hat{x})\psi_{t}$ is then performed easily, by pointwise multiplication, in the $x$-representation, in which $\hat{x}$ is diagonal. Whenever required, the representation of $\psi_{t}$ is changed by Fourier transform. In the numerical examples below, we used the Fastest Fourier Transform in the West 3 (FFTW3) library~\cite{Frigo_Johnson:2005} to perform all of the Fourier transforms. Unlike finite difference methods, the Fourier method shows exponential convergence with respect to the number of grid points (see Figs.~S1 and S2 of the supplementary material). \section{Numerical examples} \label{sec:numerical_examples}We tested the general integrators for the nonlinear Schr\"{o}dinger equation, presented in Sec.~\ref{sec:geometic_integrators_NLTDSE}, by using them for the local control of a two-dimensional two-state diabatic model of retinal taken from Ref.~\onlinecite{Hahn_Stock:2000}. The model describes the cis-trans photo-induced isomerization of retinal---an ultrafast reaction mediated by a conical intersection and the first event occurring in the biological process of vision. The two vibrational modes of the model are the reaction coordinate $\theta$, an angle describing the torsional motion of the retinal molecule, and a vibronically active coupling mode $q_{c}$. In the diabatic representation, the Hamiltonian of the system in the absence of the field, \begin{equation} \hat{\mathbf{H}}_{0}=\hat{T}\mathbf{1}+% \begin{pmatrix} V_{11}(\hat{q}_{c},\hat{\theta}) & V_{12}(\hat{q}_{c})\\ V_{21}(\hat{q}_{c}) & V_{22}(\hat{q}_{c},\hat{\theta}) \end{pmatrix} , \end{equation} is separable into a sum of the kinetic energy operator \begin{equation} \hat{T}=-\frac{1}{2}\omega\frac{\partial^{2}}{\partial q_{c}^{2}}-\frac{1}% {2}m^{-1}\frac{\partial^{2}}{\partial\theta^{2}}% \end{equation} and potential energy operator with components% \begin{align} V_{11}(q_{c},\theta) & =\frac{1}{2}\omega q_{c}^{2}+\frac{1}{2}W_{1}\left[ 1-\cos(\theta)\right] ,\label{eq:pot_11}\\ V_{22}(q_{c},\theta) & =\frac{1}{2}\omega q_{c}^{2}+\chi_{2}q_{c}% +E_{2}-\frac{1}{2}W_{2}\left[ 1-\cos(\theta)\right] ,\label{eq:pot_22}\\ V_{12}(q_{c}) & =V_{21}(q_{c})=\xi q_{c}. \label{eq:couplings}% \end{align} Here (all parameters are in eV units), $\omega=0.19$ is the vibrational frequency of the coupling mode, $m^{-1}=4.84\cdot10^{-4}$ is the inverse mass of the reaction coordinate, $W_{1}=3.6$ and $W_{2}=1.09$ determine the depth of the well in the reaction coordinate for the ground and excited electronic states, respectively, $\chi_{2}=0.1$ is the gradient of the linear perturbation in the excited electronic state, $E_{2}=2.48$ determines the maximum of the excited electronic state in the reaction coordinate, and $\xi=0.19$ is the gradient of the linear coupling between the two electronic states. {The two diabatic potential energy surfaces (\ref{eq:pot_11}) and (\ref{eq:pot_22}) are displayed in Fig.~S3 of the supplementary material.} {Note that, to distinguish nuclear, electronic, and molecular operators, in this section} the \textbf{bold} face denotes electronic operators expressed as $S\times S$ matrices in the basis of $S$ electronic states and the hat $\hat{}$ denotes nuclear operators acting on the Hilbert space of nuclear wavefunctions, i.e., square-integrable functions of $D$ continuous dimensions. { In the simulations, the reaction and coupling coordinates are represented on regular grids consisting of 128 points between $\theta=-\pi/2$~a.u. and $\theta=\pi/2$~a.u. and 64 points between $q_{c}=-9~$a.u. and $q_{c}=9~$a.u. Figure~S1 of the supplementary material confirms that this grid is sufficient by showing that the grid representation of the wavepacket is converged even at the final time $t_{f}$. We assume the coordinate independence of the electric dipole moment operator (Condon approximation) and, therefore, can write $\hat{\vec{\bm{\mu}}}=\vec{\bm{\mu}}\hat{1}=\vec{\epsilon}% \bm{\mu}\hat{1}$, where $\vec{\epsilon}$ is a constant unit vector in the direction of $\vec{\bm{\mu}}$. In this case, the LCT electric field is aligned with $\vec{\bm{\mu}}$ and we can write it as $\vec{E}_{\text{LCT}}% =\vec{\epsilon}E_{\text{LCT}}$. As a consequence, we can drop the vector symbol $\vec{}$ from $\hat{\vec{\bm{\mu}}}$ and $\vec{E}_{\text{LCT}}$ in Eqs.~(\ref{eq:LCT_field}) and (\ref{eq:nl_int_pot}) and consider only the analogous scalar equations satisfied by $\hat{\bm{\mu}}$ and $E_{\text{LCT}}$. In addition, we assume the electric dipole moment operator to have unit transition elements ($\hat{\mu}_{12}=\hat{\mu}_{21}=\hat{\mu}=1$~a.u.) and zero diagonal elements ($\hat{\mu}_{11}=\hat{\mu}_{22}=0$).} The calculations presented below aim to simulate the photo-excitation step of the photo-isomerization of the retinal molecule. We therefore use as initial state $\psi_{0}$ the ground vibrational state of the harmonic fit of the ground potential energy surface [i.e., a two-dimensional Gaussian wavepacket with $q_{0}=p_{0}=(0,0)$, and $\sigma_{0}=(0.128,1)$~a.u.] with initial populations $P_{1}(0)=0.999$ and $P_{2}(0)=0.001$ of the ground and excited electronic states, respectively. The tiny initial seed population of the excited state is essential for the control because it ensures that Eq.~(\ref{eq:LCT_field}) does not stay zero at all times. Two ways of populating the excited state based on LCT were investigated: the former used as the target observable the population of the excited state described by the projection operator onto the excited state (i.e., $\hat{\mathbf{O}}=\hat{\mathbf{P}}_{2}=\mathbf{P}_{2}\hat{1}=\mathbf{P}_{2}$), while the latter employed as the target observable the molecular energy described by the unperturbed molecular Hamiltonian (i.e., $\hat{\mathbf{O}% }=\hat{\mathbf{H}}_{0}$). {To show that the monotonic evolution of the target observable $\langle\mathbf{\hat{O}}\rangle_{\psi_{t}}$ is guaranteed only if $[\mathbf{\hat{O}},\mathbf{\hat{H}}_{0}]=0$, we also compare the results obtained from control calculations in the presence of nonadiabatic couplings (where $[\hat{\mathbf{P}}_{2},\hat{\mathbf{H}}_{0}% ]\neq0$ and $[\hat{\mathbf{H}}_{0},\hat{\mathbf{H}}_{0}]=0$) and in the absence of nonadiabatic couplings (where both target operators % $\hat{\mathbf{P}}_{2}$ and {$\mathbf{\hat{H}}_{0}$ commute with $\mathbf{\hat {H}}_{0}$).}} The control calculations were performed by solving the nonlinear time-dependent Schr\"{o}dinger equation~(\ref{eq:nl_TDSE}) with the implicit midpoint algorithm combined with the dynamic Fourier method\cite{Feit_Steiger:1982, book_Tannor:2007, Kosloff_Kosloff:1983, Kosloff_Kosloff:1983b} for a total time $t_{f}=256$~a.u. with a time step $\Delta t=2^{-3}$~a.u. In addition, intensity parameters $\lambda =1.430\times10^{-2}$ and $\lambda=1.534\times10^{-1}$ were used for the control of excited-state population $P_{2}(t)=\langle\mathbf{P}_{2}% \rangle_{\psi_{t}}$ and molecular energy $E_{0}(t)=\langle\mathbf{\hat{H}}% _{0}\rangle_{\psi_{t}}$, respectively. These parameters were chosen so that the electric fields of the obtained control pulses were similar during the first period. \begin{figure} [htb]\centering\includegraphics[width=\linewidth]{ potential_population_retinal_v3} \caption{Local control calculations whose goal is increasing either the population $P_{2}:=\langle \mathbf{P}_{2}\rangle_{\psi_{t}}$ of the excited state (left panels, $\lambda=1.430 \times 10^{-2}$) or the molecular energy $E_{0}(t):=\langle\mathbf{\hat{H}}_{0}\rangle_{\psi_{t}}$ (right panels, $\lambda = 1.534\times 10^{-1}$). As expected, the local control theory applied to these closely related objectives yields very similar results. {Top: Excited state population. Middle: Molecular energy. Bottom: Pulse obtained by local control theory. }} \label{fig:retinal_control} \end{figure} {Figure~\ref{fig:retinal_control} shows the excited-state population, molecular energy, and obtained control pulse for the control of either the excited-state population (left panels) or molecular energy (right panels).} In the figure, the results obtained in the presence and in the absence of nonadiabatic couplings are also compared for each target. The population and energy control schemes result in similar population dynamics and in both schemes, the population of the excited state reaches $0.99$ at time $t_{f}$. { The carrier frequencies of the obtained control pulses are, as expected, similar and correspond to the electronic transition between the two electronic states of the model.} As predicted, when controlling the excited-state population $\langle\mathbf{P}_{2}\rangle _{\psi_{t}}$ in the presence of nonadiabatic couplings { given by Eq.~(\ref{eq:couplings})}, the evolution of the population is not monotonic {(see the solid line in the inset of the top left panel of Fig.~\ref{fig:retinal_control})} because the control operator does not commute with the molecular Hamiltonian. { Compare this with the monotonic increase of the population when the nonadiabatic couplings are zero [dotted line in the same inset; $\hat{V}_{12}(q_{c})=\hat{V}_{21}(q_{c})=0$] and the target operator commutes with the molecular Hamiltonian. In contrast, when controlling the molecular energy $\langle\hat{\mathbf{H}}_{0}\rangle_{\psi _{t}}$, its time evolution is always monotonic because the molecular Hamiltonian commutes with itself, whether the nonadiabatic couplings are included or not (see the inset of the middle right-hand panel of Fig.~\ref{fig:retinal_control})}. Because increasing the population of the excited state has almost the same effect as increasing the molecular energy, very similar dynamics and control pulses are obtained. Yet, the energy and population controls do not always yield similar results. In the retinal model, when performing energy control, no vibrational energy is pumped into the system because the diagonal terms of the electric-dipole moment operator are all zero by construction (hence $\langle\lbrack\hat{\boldsymbol{\mu}}% ,\hat{\mathbf{T}}]\rangle_{\psi_{t}}=0$). Consequently, only electronic potential energy is added to the system, and the corresponding control pulse is similar to the one obtained from the population control. \begin{figure*} [htb]% \centering\includegraphics[width=0.95\linewidth]{ error_vs_dt_retinal_nacs_el_states_v3}\caption{Convergence of the molecular wavefunction at the final time $t_{f}$ achieved by the local population control in the presence of nonadiabatic couplings. Top: All studied methods, i.e., explicit and implicit Euler methods, {approximate explicit TVT split-operator algorithm, {trapezoidal rule}}, implicit midpoint method and its symmetric compositions. Bottom-left: Methods obtained with the Suzuki composition. Bottom-right: Sixth-order methods obtained with different composition schemes.}\label{fig:error_vs_dt_retinal_nacs_el_states} \end{figure*} \begin{figure} [htb]% \centering\includegraphics[width=0.95\linewidth]{ error_vs_CPU_time_retinal_nacs_el_states_v3} \caption{Efficiency of the integrators used for the local population control of retinal in the presence of nonadiabatic couplings. Efficiency is measured by plotting the convergence error as a function of the computational (CPU) cost. Line labels are the same as in Fig.~\ref{fig:error_vs_dt_retinal_nacs_el_states}.} \label{fig:error_vs_CPU_time_retinal_nacs_el_states} \end{figure} To verify the orders of convergence predicted in Sec.~\ref{subsec:lct_geom_methods}, we performed convergence analysis of control simulations using various integrators. Simulations with each integrator were repeated with different time steps and the resulting wavefunctions at the final time $t_{f}$ were compared. As a measure of the convergence error, we used the $L_{2}$-norm $\Vert\psi_{t_{f}}(\Delta t)-\psi_{t_{f}}(\Delta t/2)\Vert$, where $\psi_{t}(\Delta t)$ denotes the state at time $t$ obtained after propagation with time step $\Delta t$. Figure~\ref{fig:error_vs_dt_retinal_nacs_el_states} displays the convergence behavior of both Euler methods, {approximate explicit} TVT split-operator algorithm, { trapezoidal rule}, and the proposed implicit midpoint method as well as its symmetric compositions, when controlling the excited state population. Notice that all integrators have their predicted orders of convergence. The {approximate explicit} TVT split-operator algorithm is, for the reasons mentioned in Sec.~\ref{subsec:naive_so}, only first-order and not second-order as one might na\"{\i}vely expect. For the convergence of other simulations, we refer the reader to Figs.~S4-S6 of the supplementary material. Together, these results confirm that both population and energy control follow the predicted order of convergence regardless of the presence of nonadiabatic couplings. \begin{figure} [htb]% \centering\includegraphics[width=0.95\linewidth]{ geometric_properties_retinal_nacs_el_states_v3}\caption{{Norm conservation (left) and time reversibility (right) of various integrators at the final time $t_{f}$ as a function of the time step $\Delta t$ used for the local control of population in the presence of nonadiabatic couplings. Time reversibility is measured by the distance between the initial state $\psi_{0}$ and a ``forward-backward'' propagated state $\tilde{\psi}_{0}:=\hat{U}(0,t)\hat{U}(t,0)\psi_{0}$ [Eq.~(\ref{eq:forward_backward})] and line labels are the same as in Fig.~\ref{fig:error_vs_dt_retinal_nacs_el_states}.}}\label{fig:geometric_properties_retinal_nacs_el_states}% \end{figure} \begin{figure} [htb]% \centering\includegraphics[width=0.95\linewidth]{ nonconserved_geometric_properties_retinal_nacs_el_states_v3}\caption{{Geometric properties of various integrators used for the local population control in the presence of nonadiabatic couplings. Panel~(a) shows that only the implicit midpoint and approximate explicit split-operator methods conserve the norm, while panel~(b) demonstrates that only the implicit midpoint {method and the trapezoidal rule} are time-reversible. (Reversibility is measured as in Fig.~\ref{fig:geometric_properties_retinal_nacs_el_states}). Bottom three panels show that no method conserves (c) the inner product, (d) distance between two states (which would imply stability), or (e) total energy $E_{\text{tot}}(t):=E_{0}(t) + \langle\hat{\mathbf{V}}_{\text{LCT}}(\psi_{t})\rangle_{\psi_{t}}$ because even the exact evolution operator does not preserve these properties. State $\phi_{0}$ is $\psi_{0}$ displaced along the reaction coordinate, i.e., a Gaussian wavepacket with parameters $q_{0}=(0.1,0)$, $p_{0}=(0,0)$, and $\sigma_{0}= (0.128,0)$ a.u. The time step $\Delta t= 2^{-2}$~a.u. was used for all calculations and line labels are the same as in Fig.~\ref{fig:error_vs_dt_retinal_nacs_el_states}. Note that only a few points of the Euler methods are visible in some of the plots because the results of the Euler methods leave the range of these plots very rapidly. }}\label{fig:geometric_properties}% \end{figure} Because the higher-order methods require more work to perform each step, a higher order of convergence may not guarantee higher efficiency. Therefore, we evaluated the efficiency of each method directly by measuring the computational cost needed to reach a prescribed convergence error. Figure~\ref{fig:error_vs_CPU_time_retinal_nacs_el_states} shows the convergence error as a function of the central processing unit (CPU) time and confirms that, except for very crude calculations, higher-order integrators are more efficient than any of the first- and second-order methods. For example, to reach errors below a rather high threshold of {$3\times 10^{-4}$}, the fourth-order integrator obtained with the Suzuki composition scheme is \emph{already} more efficient than any of the first- or second-order algorithms. The efficiency gain increases further when highly accurate results are desired. Indeed, for an error of $10^{-9}$, the eighth-order optimal method is {$48$} times faster than the basic, second-order implicit midpoint method and {approximately $400000$ times faster than the approximate explicit TVT split-operator algorithm (for which, due to its inefficiency, the speedup had to be estimated by linear extrapolation).} {High accuracy is hard to achieve with the explicit methods because both the explicit Euler and approximate explicit TVT split-operator algorithms have only first-order convergence.} Notice also that the cost of implicit methods is not a monotonous function of the error because the Newton-Raphson method needs more iterations to converge for larger than for smaller time steps. Indeed, for time steps (or errors) larger than a critical value, the CPU time might in fact increase with further increasing time step (or error). The efficiency plots of other control simulations (see Figs. S7-S9 of the supplementary material) confirm that the increase in efficiency persists regardless of the control target (energy or population)\ and presence or absence of nonadiabatic couplings. {Figure~\ref{fig:geometric_properties_retinal_nacs_el_states} analyzes how the time reversibility and norm conservation depend on the time step. The figure confirms that all proposed integrators are exactly time-reversible and norm-conserving regardless of the time step (the slow increase of the error with decreasing time step is due to the accumulation of numerical roundoff errors because a smaller time steps requires a larger number of steps to reach the same final time $t_{f}$). In contrast, the figure shows that an unrealistically small time step would be required for the {trapezoidal rule} and both Euler methods to conserve norm exactly and for the explicit split-operator algorithm to be exactly time-reversible. Figures~S10-S12 of the supplementary material confirm that neither the chosen control objective nor the nonadiabatic couplings influence the geometric properties of the integrators.} {We also checked how the conservation of geometric properties by the integrators depend on time $t$ for a fixed time step. For these simulations, we used a greater final time $t_{f}=2048$~a.u. and an intentionally large time step $\Delta t=2^{-2}$~a.u. The grid was modified to 256 points between $\theta=\pm3\pi/2$~a.u. and 64 points between $q_{c}=\pm 9$~a.u., ensuring that the grid representation of the wavefunction at the final time $t_{f}$ was converged (see Fig.~S2 of the supplementary material). Figure \ref{fig:geometric_properties} displays the time evolution of the geometric properties for the elementary integrators (i.e., {the trapezoidal rule, implicit midpoint,} approximate explicit split-operator, and both Euler methods). The top panel confirms that the implicit midpoint method and the approximate explicit TVT split-operator algorithm conserve the norm exactly (i.e., to machine precision) even though a large time step was used. In contrast, the {trapezoidal rule} and both Euler methods do not conserve the norm. The second panel shows that only the { trapezoidal rule} and the implicit midpoint method are time-reversible.} {However, due to the nonlinearity of the Schr\"{o}dinger equation (\ref{eq:nl_TDSE}) and the accumulation of roundoff errors, the time reversibility of these integrators slowly deteriorates as time increases. (For a more detailed analysis of this gradual loss of time reversibility, we refer the reader to Sec.~V of the supplementary material.) The bottom three panels of Fig.~\ref{fig:geometric_properties} confirm that even the implicit midpoint method does not conserve the inner product, distance between two states, and total energy; this is not surprising because, due to nonlinearity, the exact solution does not conserve these properties either. Figures S13-S15 of the supplementary material also confirm that neither the chosen control objective nor the nonadiabatic couplings influence the time evolution of the geometric properties of these integrators.} \section{Conclusion} We presented high-order time-reversible integrators for the nonlinear time-dependent Schr\"{o}dinger equation and demonstrated their efficiency and geometric properties on the problem of local control of quantum systems. The basic time-reversible integrator is an adaptation of the implicit midpoint method to the nonlinear Schr\"{o}dinger equation and is obtained by composing the explicit and implicit Euler methods. It is norm-conserving, symmetric, time-reversible, and of second order of accuracy in the time step. Because it is symmetric, the implicit midpoint method can be composed using symmetric composition methods to obtain integrators of an arbitrary even order of accuracy. These higher-order integrators conserve all of the properties of the original second-order method. In contrast, the {explicit} TVT split-operator algorithm is generally only an approximate adaptation of the standard second-order TVT split-operator algorithm to the nonlinear Schr\"{o}dinger equation {which results from LCT.} Because this integrator {is not implicit}, it is only of first order accuracy in the time step and loses time reversibility while still conserving the norm. {The { trapezoidal rule}, another popular algorithm for solving the Schr\"{o}dinger equation, remains symmetric and time-reversible, but does not conserve the norm of the wavefunction propagated with a nonlinear Schr\"{o}dinger equation.} {Although we applied the proposed algorithms only to the special case of LCT, they should be useful for any nonlinear time-dependent Schr\"{o}dinger equation if high accuracy, norm conservation, and time reversibility of the solution are desired.} The data that support the findings of this study are contained in the paper and supplementary material. \section*{{Supplementary material}} See the supplementary material for a detailed description of the generalized minimal residual method, convergence of the wavefunction with respect to the grid density, a plot of the potential energy surfaces, an additional analysis of the convergence, efficiency, and geometric properties of various integrators, and a detailed analysis of the gradual loss of time reversibility of the implicit midpoint method. \begin{acknowledgments} The authors thank Seonghoon Choi for useful discussions and acknowledge the financial support from the Swiss National Science Foundation within the National Center of Competence in Research \textquotedblleft Molecular Ultrafast Science and Technology\textquotedblright\ (MUST) and from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement No. 683069 -- MOLEQULE). \end{acknowledgments} \section{{The generalized minimal residual method}} \label{sec:GMRES} The generalized minimal residual method is an iterative method for solving linear systems \begin{equation} Ax=b, \end{equation} such as the one encountered in Eq.~(33), with $A\equiv J(\psi^{(k)})$, $x\equiv\delta\psi^{(k)}$, and $b\equiv-f(\psi^{(k)})$. Here, we used the restart version of the algorithm. Following Refs.~\onlinecite{book_Saad:2003} and \onlinecite{Saad_Schultz:1986}, the algorithm can be summarized in four steps: \begin{enumerate} \item Initialization \item Arnoldi's method for constructing an orthonormal basis of the Krylov subspace \item Forming the solution\label{item:form_solution} \item Restart \end{enumerate} Each step is described in more detail below. \subsection{Initialization} The initialization is performed as follows: Choose an initial guess $x_{0}$, an error threshold $\epsilon$, a maximal number of iterations $m$, and compute the initial residue $r_{0}=b-Ax_{0}$, $\beta:=\Vert r_{0}\Vert$, and $v_{1}:=r_{0}/\beta$. \subsection{Arnoldi's method} Arnoldi's method obtains an orthonormal basis of the Krylov subspace\cite{Arnoldi:1951,Saad:1980}% \[ {\mathcal{K}_{m}:=\text{span}\{v_{1},Av_{1},\dots,A^{m-1}v_{1}\}.}% \] {The orthonormal vectors, which span the Krylov subspace, are obtained using the modified Gram-Schmidt process. The algorithm is: } \begin{enumerate} \item For $j=1,2,\dots,m$ Do: {\setlength\itemindent{2em} } \item Compute $w_{j}:=Av_{j}$ {\setlength\itemindent{2em}} \item For $i=1,\dots j$ Do: {\setlength\itemindent{4em}} \item $h_{ij}:=\langle v_{i}|w_{j}\rangle$\label{item:h_ij} {\setlength\itemindent{4em}} \item $w_{j}:=w_{j}-h_{ij}v_{i}$ {\setlength\itemindent{2em} } \item End Do {\setlength\itemindent{2em}} \item $h_{j+1,j} = \|w_{j}\|$. If $h_{j+1,j} =0$, set $m=j$ and stop \label{item:h_jj+1} {\setlength\itemindent{2em}} \item $v_{j+1}= w_{j}/h_{j+1,j}$ \item End Do \end{enumerate} \subsection{Forming the solution} Here, the goal is to find the solution which minimizes the norm of the residue after $m$ iterations of Arnoldi's method. Now that the orthogonal basis is constructed, we know that the solution lies in the affine subspace $x_{0}+\mathcal{K}_{m}$. Thus, any vector $x$ in that space can be written as \begin{equation} x=x_{0}+V_{m}y, \end{equation} where $V_{m}:=\{v_{1},\dots,v_{m}\}$ is the matrix constructed from the orthonormal vectors $v_{j}$ and $y$ is an arbitrary vector of size $m$. The problem translates to the minimization of the function \begin{align} M(y) & =\Vert b-A(x_{0}+V_{m}y)\Vert\nonumber\\ & =\Vert r_{0}-AV_{m}y\Vert\nonumber\\ & =\Vert\beta v_{1}-V_{m+1}\bar{H}_{m}y\Vert\nonumber\\ & =\Vert V_{m+1}(\beta e_{1}-\bar{H}_{m}y)\Vert\nonumber\\ & =\Vert(\beta e_{1}-\bar{H}_{m}y)\Vert, \label{eq:min_problem}% \end{align} where $\bar{H}_{m}=\{h_{ij}\}_{1\leq i\leq m+1,1\leq j\leq m}$ is the the $(m+1)\times m$ Hessenberg matrix constructed from the elements $h_{ij}$ obtained in Arnoldi's method and where $e_{1}=(1,0,\dots,0)^{T}$ is the first vector in the standard basis of $\mathbb{R}^{m+1}$. The third line of Eq.~(\ref{eq:min_problem}) was obtained using $AV_{m}=V_{m+1}\bar{H}_{m}$, while the last line follows because the columns of $V_{m+1}$ are orthonormal. This step of the generalized minimal residual algorithm can be summarized as: \begin{enumerate} \item Construct the Hessenberg matrix $\bar{H}_{m}$\label{item:hessenberg} \item Compute $y_{m}$, the vector of dimension $m$ minimizing $M(y)$ \item Compute the solution $x_{m}= x_{0}+V_{m}y_{m}$ \end{enumerate} \subsection{Restart} This last step of the generalized minimal residual algorithm determines whether the solution $x_{m}$, obtained at the previous step, is sufficiently accurate. If the condition $\Vert r_{m}\Vert:=\Vert b-Ax_{m}% \Vert\leq\epsilon$ holds, $x_{m}$ is taken as the solution. If $\Vert r_{m}\Vert>\epsilon$, we set $x_{0}=x_{m}$ and restart the algorithm. \subsection{Practical implementation} In practice, it is difficult to compute the vector $y_{m}$ minimizing $M(y)$. For this, it is preferable to use the decomposition \begin{equation} \bar{R}_{m}=Q_{m}\bar{H}_{m}, \label{eq:QR}% \end{equation} where $Q_{m}$ is an $(m+1)\times(m+1)$ orthogonal matrix and $\bar{R}_{m}$ is an upper triangular matrix of dimension $(m+1)\times m$ with a bottom row consisting only of zeroes, i.e., it can be decomposed as \begin{equation} \bar{R}_{m}=% \begin{pmatrix} R_{m}\\ 0 \end{pmatrix} , \end{equation} where $R_{m}$ is an $m\times m$ upper triangular matrix. Once this factorization is performed, the minimization problem simplifies to \begin{equation} y_{m}=\operatorname{argmin}_{y}\Vert\beta e_{1}-\bar{H}_{m}y\Vert =\operatorname{argmin}_{y}\Vert\bar{g}_{m}-\bar{R}_{m}y\Vert, \end{equation} where $\bar{g}_{m}:=Q_{m}\beta\epsilon_{1}=(\gamma_{1},\dots,\gamma_{m+1}% )^{T}$ and can be decomposed as $\bar{g}_{m}=(g_{m},\gamma_{m+1})^{T}$. The solution of the minimization problem is now trivially obtained by solving the linear triangular system $R_{m}y_{m}=g_{m}$, which yields \begin{equation} y_{m}=R_{m}^{-1}g_{m}. \end{equation} Note that it can be proven that the residue after $m$ iterations of the algorithm is given by the last element of $\bar{g}_{m}$, i.e., $r_{m}% =|\gamma_{m+1}|$.\cite{book_Saad:2003} Instead of constructing $\bar{H}_{m}$ and computing its decomposition (\ref{eq:QR}) after $m$ iterations of Arnoldi's method, both can be performed in an iterative manner, at each iteration $j$ of Arnoldi's method. This makes it possible to obtain $\bar{g}_{j}$ and therefore to check if $r_{j}% \leq\epsilon$ at each iteration step $j$, without even solving the minimization problem. To do so, $\bar{H}_{j+1}$ is obtained by concatenation of $\bar{H}_{j}$ and the elements obtained in steps \ref{item:h_ij} and \ref{item:h_jj+1} of Arnoldi's method, i.e., \begin{equation} \bar{H}_{j+1}=% \begin{pmatrix} & h_{1,j+1}\\ \bar{H}_{j} & \vdots\\ & h_{j+1,j+1}\\ 0 & h_{j+2,j+1}% \end{pmatrix} . \end{equation} Then, multiplying $\bar{H}_{j+1}$ on the left by the orthogonal matrix obtained at the previous iteration yields an almost upper triangular matrix% \begin{equation} \tilde{R}_{j+1}=% \begin{pmatrix} Q_{j} & 0\\ 0 & 1 \end{pmatrix} \bar{H}_{j+1}=% \begin{pmatrix} & r_{1,j+1}\\ R_{j} & \vdots\\ & r_{j,j+1}\\ 0 & \eta\\ 0 & \nu \end{pmatrix} \end{equation} of dimension $(j+2)\times(j+1)$. Note that $\eta$ and $\nu$ denote the arbitrary elements $j+1,j+1$ and $j+2,j+1$ of the matrix $\tilde{R}_{j+1}% $. From there, $\bar{R}_{j+1}$, which is upper triangular, is obtained by rotating $\tilde{R}_{j+1}$: \begin{equation} \bar{R}_{j+1}=Q_{j+1}\bar{H}_{j+1}=\Omega_{j}\tilde{R}_{j+1}=% \begin{pmatrix} & r_{1,j+1}\\ R_{j} & \vdots\\ 0 & r_{j+1,j+1}\\ 0 & 0 \end{pmatrix} , \label{eq:R_j_plus_one}% \end{equation} where \begin{equation} \Omega_{j}=% \begin{pmatrix} 1 & & & & \\ & \ddots & & & \\ & & 1 & & \\ & & & c_{j}^{\ast} & s_{j}^{\ast}\\ & & & -s_{j} & c_{j}% \end{pmatrix} \label{eq:givens_rot}% \end{equation} is a rotation matrix of dimension $(j+2)\times(j+2)$. The complex coefficients \begin{equation} c_{j}:=\frac{\eta}{\sqrt{|\eta|^{2}+\left\vert \nu\right\vert ^{2}}}% \quad\text{ and }\quad s_{j}:=\frac{\nu}{\sqrt{|\eta|^{2}+\left\vert \nu\right\vert ^{2}}}% \end{equation} of $\Omega_{j}$ are selected so that multiplying $\Omega_{j}$ with $\tilde {R}_{j+1}$ yields the upper triangular matrix $\bar{R}_{j+1}$. From Eq.~(\ref{eq:R_j_plus_one}), $Q_{j+1}$ is obtained by applying the rotation matrix $\Omega_{j}$ to $Q_{j}$ as \begin{equation} Q_{j+1}=\Omega_{j}% \begin{pmatrix} Q_{j} & 0\\ 0 & 1 \end{pmatrix} . \end{equation} \section{Exponential convergence of the wavefunction with respect to the grid density} \begin{figure} [htb!]\centering \includegraphics[width=0.7\linewidth]{grid_convergence_retinal_256} \caption{ Error of the wavefunction at the final time $t_{f}=256$ a.u. as a function of the number of grid points. The figure indicates that the numerical grids consisting of $N_{1}=128$ points between $\theta=\pm \pi/2$ a.u. and $N_{2}=64$ points between $q_{c} = \pm 9.0$ a.u. are converged. All calculations were performed using the approximate explicit TVT split-operator algorithm with time step $\Delta t=2^{-1}$ a.u. } \label{fig:grid_conv_256} \end{figure} \begin{figure} [htb!]\centering\includegraphics[width=0.7\linewidth]{ grid_convergence_retinal_2048} \caption{Error of the wavefunction at the final time $t_{f}=2048$ a.u. as a function of the number of grid points. The figure indicates that the numerical grids consisting of $N_{1}=256$ points between $\theta=\pm 3\pi/2$ a.u. and $N_{2}=64$ points between $q_{c} = \pm 9.0$ a.u. are converged. All calculations were performed using the approximate explicit TVT split-operator algorithm with time step $\Delta t=2^{-1}$ a.u.} \label{fig:grid_conv_2048} \end{figure} Figures \ref{fig:grid_conv_256} and \ref{fig:grid_conv_2048} show the convergence of the wavefunction with respect to the grid density at the final times $t_{f}=256$ a.u. and $t_{f}=2048$ a.u., respectively. For both figures, the goal of the calculation was to increase the population of the excited state in the presence of nonadiabatic couplings and the approximate explicit TVT split-operator algorithm was used with a time step $\Delta t=2^{-1}$ a.u. The grid convergence was obtained by fixing the number of grid points of one of the two dimensions and repeating the calculation with a varying number of grid points for the other dimension. For each increase in the number of points by a factor of $k\approx\sqrt{2}$ in the varying dimension, the position and momentum ranges as well as densities in that dimension were increased by a factor $\sqrt{k}\approx2^{1/4}$. Then, the error was measured by the distance $\Vert\psi_{t_{f}}(N_{1},Y)-\psi_{t_{f}}(\sqrt{2}% N_{1},Y)\Vert$ and $\Vert\psi_{t_{f}}(X,N_{2})-\psi_{t_{f}}(X,\sqrt{2}% N_{2})\Vert$ for the grid convergence of the first and second dimension, respectively, with $\psi_{t_{f}}(N_{1},N_{2})$ denoting the wavefunction at the final time $t_{f}$, obtained using grids consisting of $N_{1}$ and $N_{2}$ points in the first and second dimension, respectively. Note also that $X$ and $Y$ are the fixed numbers of grid points of the first and second dimensions, respectively. The comparison of wavefunctions that are represented on different grids was performed by trigonometric interpolation of the wavefunction represented on the sparser grid. In both figures, exponential convergence with respect to the grid density of each dimension is observed. \section{Potential energy surfaces} Figure~\ref{fig:PES} displays the two diabatic potential energy surfaces. \begin{figure} [htb!]\centering \includegraphics[width=0.5\linewidth]{PES_mathematica} \caption{Diabatic potential energy surfaces of the model. Orange: Ground electronic state [Eq.~(42)]. Blue: Excited electronic state [Eq.~(43)].} \label{fig:PES} \end{figure} \section{Convergence, efficiency, and geometric properties of the integrators for the other simulations} We present here the results obtained when controlling the population (in the absence of nonadiabatic couplings) as well as the energy (in the presence and the absence of nonadiabatic couplings). Figures~\ref{fig:error_vs_dt_nonacs_el_states}% -\ref{fig:error_vs_dt_nonacs_energy} show the {convergence with respect to the time step }$\Delta t$ of the wavefunction at the final time $t_{f}$ for the different simulations and {Figs.}% ~\ref{fig:error_vs_CPU_time_nonacs_el_states}% -\ref{fig:error_vs_CPU_time_nonacs_energy} {show the efficiency of various algorithms}. {The geometric} properties are displayed in Figs.~\ref{fig:geometric_properties_nonacs_el_states}% -\ref{fig:nonconserved_geometric_properties_nonacs_energy}. \begin{figure} [htb!]\centering \includegraphics[width=0.9\linewidth]{error_vs_dt_retinal_nonacs_el_states_v3} \caption{Convergence of the molecular wavefunction at the final time $t_{f}$ achieved by the local population control in the absence of nonadiabatic couplings. Top: All studied methods, i.e., explicit and implicit Euler methods, approximate explicit TVT split-operator algorithm, {trapezoidal rule}, implicit midpoint method and its symmetric compositions. Bottom-left: Methods obtained with the Suzuki composition. Bottom-right: Sixth-order methods obtained with different composition schemes.} \label{fig:error_vs_dt_nonacs_el_states} \end{figure} \begin{figure} [htb!]\centering \includegraphics[width=0.9\linewidth]{error_vs_dt_retinal_nacs_energy_v3} \caption{Same as Fig.~\ref{fig:error_vs_dt_nonacs_el_states}, but for energy control with nonadiabatic couplings. }\label{fig:error_vs_dt_nacs_energy}% \end{figure} \begin{figure} [htb!]\centering \includegraphics[width=0.9\linewidth]{error_vs_dt_retinal_nonacs_energy_v3} \caption{Same as Fig.~\ref{fig:error_vs_dt_nonacs_el_states}, but for energy control without nonadiabatic couplings.}\label{fig:error_vs_dt_nonacs_energy}% \end{figure} \begin{figure} [htb!]\centering \includegraphics[width=0.5\linewidth]{error_vs_CPU_time_retinal_nonacs_el_states_v3} \caption{Efficiency of the integrators used for the local population control of retinal in the absence of nonadiabatic couplings. Efficiency is measured by plotting the convergence error as a function of the computational (CPU) cost.} \label{fig:error_vs_CPU_time_nonacs_el_states} \end{figure} \begin{figure} [htb!]\centering \includegraphics[width=0.5\linewidth]{error_vs_CPU_time_retinal_nacs_energy_v3} \caption{Same as Fig.~\ref{fig:error_vs_CPU_time_nonacs_el_states}, but for energy control with nonadiabatic couplings.}\label{fig:error_vs_CPU_time_nacs_energy}% \end{figure} \begin{figure} [htb!]\centering \includegraphics[width=0.5\linewidth]{error_vs_CPU_time_retinal_nonacs_energy_v3} \caption{Same as Fig.~\ref{fig:error_vs_CPU_time_nonacs_el_states}, but for energy control without nonadiabatic couplings.}\label{fig:error_vs_CPU_time_nonacs_energy}% \end{figure} \begin{figure} [htb!]\centering \includegraphics[width=0.5\linewidth]{geometric_properties_retinal_nonacs_el_states_v3} \caption{Norm conservation (left) and time reversibility (right) of various integrators at the final time $t_{f}$ as a function of the time step $\Delta t$ used for the local population control in the absence of nonadiabatic couplings. Time reversibility is measured by the distance between the initial state $\psi_{0}^{\Delta t}$ and a ``forward-backward'' propagated state $\tilde{\psi}_{0}^{\Delta t}:=\hat{U}(0,t)\hat{U}(t,0)\psi_{0}^{\Delta t}$ [Eq.~(19)].} \label{fig:geometric_properties_nonacs_el_states} \end{figure} \begin{figure} [htb!]\centering \includegraphics[width=0.5\linewidth]{geometric_properties_retinal_nacs_energy_v3} \caption{Same as Fig~\ref{fig:geometric_properties_nonacs_el_states}, but for energy control in the presence of nonadiabatic couplings.}\label{fig:geometric_properties_nacs_energy}% \end{figure} \begin{figure} [htb!]\centering \includegraphics[width=0.5\linewidth]{geometric_properties_retinal_nonacs_energy_v3} \caption{Same as Fig~\ref{fig:geometric_properties_nonacs_el_states}, but for energy control in the absence of nonadiabatic couplings.}\label{fig:geometric_properties_nonacs_energy}% \end{figure} \begin{figure} [htb!]\centering \includegraphics[width=0.5\linewidth]{nonconserved_geometric_properties_retinal_nonacs_el_states_v3} \caption{Geometric properties of various integrators used for the local population control in the absence of nonadiabatic couplings. Panel~(a) shows that only the implicit midpoint and approximate explicit split-operator methods conserve the norm, while panel~(b) demonstrates that only the implicit midpoint {method and the trapezoidal rule} are time-reversible. (Reversibility is measured as in Fig.~\ref{fig:geometric_properties_nonacs_el_states}). Bottom three panels show that no method conserves (c) the inner product, (d) distance between two states (which would imply stability), or (e) total energy $E_{\text{tot}}(t):=E_{0}(t) + \langle\hat{\mathbf{V}}_{\text{LCT}}(\psi_{t})\rangle_{\psi_{t}}$ because even the exact evolution operator does not preserve these properties. State $\phi_{0}$ is $\psi_{0}$ displaced along the reaction coordinate, i.e., a Gaussian wavepacket with parameters $q_{0}=(0.1,0)$, $p_{0}=(0,0)$, and $\sigma_{0}= (0.128,0)$ a.u. The time step $\Delta t= 2^{-2}$~a.u. was used for all calculations and line labels are the same as in Fig.~\ref{fig:error_vs_dt_nonacs_el_states}. Note that only a few points of the Euler methods are visible in some of the plots because the results of the Euler methods leave the range of these plots very rapidly.} \label{fig:nonconserved_geometric_properties_nonacs_el_states} \end{figure} \begin{figure} [htb!]\centering \includegraphics[width=0.5\linewidth]{nonconserved_geometric_properties_retinal_nacs_energy_v3} \caption{Same as Fig. \ref{fig:nonconserved_geometric_properties_nonacs_el_states}, but for energy control with nonadiabatic couplings.} \label{fig:nonconserved_geometric_properties_nacs_energy} \end{figure} \begin{figure} [htb!]\centering \includegraphics[width=0.5\linewidth]{nonconserved_geometric_properties_retinal_nonacs_energy_v3} \caption{Same as Fig. \ref{fig:nonconserved_geometric_properties_nonacs_el_states}, but for energy control without nonadiabatic couplings.} \label{fig:nonconserved_geometric_properties_nonacs_energy} \end{figure} \section{Loss of time reversibility due to roundoff errors} Figure \ref{fig:influence_of_parameters_on_tr} displays, for the population control in the presence of nonadiabatic couplings, the influence of various parameters on the time reversibility of the implicit midpoint method. This figure aims at demonstrating that the loss of time reversibility at longer times is due to the combination of nonlinearity and accumulation of roundoff errors and errors due to the approximate solution of the nonlinear system described by Eq.~(30) of the main text. Indeed, when using the implicit midpoint method, this nonlinear system is only solved up to a limited accuracy $\varepsilon$ (i.e., the nonlinear system is considered solved if $\Vert f(\psi^{(k+1)})\Vert\leq\varepsilon$). Panel~(a) shows the influence of the time step on the time reversibility of the implicit midpoint method. For this, we propagated the wavefunction to the final time $t_{f}=2048$~a.u. with different time steps and kept the same error threshold $\varepsilon$ for solving the nonlinear system. We observe that decreasing the time step decreases the time reversibility of the implicit midpoint method. This is due to a faster accumulation of roundoff errors caused by the greater number of steps performed when using a smaller time step. Panel~(b) depicts the influence of the error threshold $\varepsilon$ on the time reversibility. Here, we propagated the wavefunction using the implicit midpoint method using the same parameters but only changed the error threshold $\varepsilon$. As expected, a larger error threshold results in a faster loss of time reversibility as the time increases. Finally, panel (c) shows the influence of the floating-point format precision. We compare the single and double precision floating-point formats for the implicit midpoint method and the approximate explicit TVT split-operator algorithm. The results indicate that decreasing the floating-point format from double to single precision, while keeping other parameters fixed, decreases the time reversibility of the implicit midpoint method while it does not affect the approximate explicit TVT split-operator algorithm. Because the implicit midpoint method is by construction time-reversible, decreasing the floating-point format has the same effect as increasing the threshold $\varepsilon$, namely increasing the roundoff error when solving the nonlinear system, hence decreasing its time reversibility. In contrast, the approximate explicit TVT split-operator algorithm is not affected by the change of precision because it is, by construction, time-irreversible and would remain irreversible even if infinite precision were available. \begin{figure} [htb!]\centering\includegraphics[width=0.5\linewidth]{influence_of_parameters_on_tr} \caption{Influence of various parameters on the time reversibility of the implicit midpoint method. The three panels show that the time reversibility of the implicit midpoint method deteriorates (a) if the time step $\Delta t$ is decreased, leading to a faster accumulation of roundoff errors, (b) if the error $\varepsilon$ threshold of the nonlinear solver is increased, and (c) if the precision of the floating-point arithmetic is decreased. Note that decreasing the floating-point precision does not have a visible influence on the approximate explicit split-operator algorithm, which is irreversible by construction. Time reversibility is measured as in Fig.~\ref{fig:geometric_properties_nonacs_el_states}.} \label{fig:influence_of_parameters_on_tr} \end{figure} \FloatBarrier \bibliographystyle{aipnum4-1}
\section{Introduction} \label{sec:intro} Despite decades of tremendous experimental and theoretical efforts, the nature of dark matter (DM) is still elusive. Among the different possibilities, the idea that small collapsed structures, or primordial black holes (PBH) could account for all or part of the lacking mass is half-century old \cite{1966AZh....43..758Z,1971MNRAS.152...75H,Chapline:1975ojl}. While constraints on this hypothesis are strengthening for PBH with large masses, for relatively low PBH masses an interesting mass window $[10^{-16},10^{-10}]M_\odot$ is still presently unconstrained by lensing observation~\cite{2018JCAP...12..005K, 2019NatAs...3..524N, 2019arXiv190605950M}. It is widely thought that interactions of PBH with compact stars are a promising avenue to shed light in that mass range, possibly via high-energy signatures. For example, it was proposed that a PBH crossing a white dwarf would trigger thermonuclear reaction of heavy elements and cause a runaway explosion leading to Type Ia supernova \cite{2015PhRvD..92f3007G}. In the case of a NS, the dense neutron medium is favourable for capture. Once trapped, the PBH grows and eventually swallows its host, transmuting it into a black hole (BH). The observation of old NS in DM-rich environments have already been used to set constraints on the PBH content of DM~\cite{2013PhRvD..87l3524C}. Furthermore, the transmutation process could lead to signatures in various messengers and wavelengths, such as radio burst \cite{2015MNRAS.450L..71F,2018ApJ...868...17A}, kilonovae \cite{2018PhRvD..97e5016B}, positrons~\cite{Takhistov:2017nmt}, gamma-ray burst \cite{Takhistov:2017nmt,Chirenti:2019sxw}, and gravitational waves \cite{Takhistov:2017bpt,2018ApJ...868...17A,2016PhRvD..93b3508K,2007CQGra..24S.187B}. These different scenarios crucially depend on the dynamics of the seed BH growth, which ultimately impacts the amount of matter and energy expelled in this cataclysmic event. It was argued in \cite{2014PhRvD..90d3512K} that at early stage, the trapped PBH would smoothly accrete the NS material, evacuating the angular momentum through viscous dissipation. The final stages of the collapse on which the observational signatures critically depends on are however strongly uncertain. While realistic simulations coupling magneto-hydrodynamic and general relativity are probably the unique way to investigate the final signatures (see e.g. \cite{2019arXiv190907968E}), the details of the interactions of the PBH with the NS dense medium is of prime importance to assess the capture rate and set the initial conditions of the simulations. In this paper we revisit and refine the different interaction mechanisms, with a main focus on the capture and the post-capture dynamics and their observational consequences, as well as the role of gravitational wave (GW) emissions. The paper is organized as follows: In Sec.~\ref{sec:int_mech} we review the different energy-loss processes and discuss their velocity dependence. This includes, in Sec.~\ref{sec:int_gw}, the process due to gravitational wave (GW) losses, considered for the first time in this context. In Sec.~\ref{sec:capture}, we discuss the relative relevance of the different mechanisms for the capture, also assessing the role played by GW emission. In Sec.~\ref{eq:postcapture} we discuss the post-capture dynamics, which is remarkably simple and amenable to a description in terms of an adiabatic invariant (Eq.~(\ref{eq:conservation})) which leads us to establish a prescription for future numerical simulations, see Eq.~(\ref{initcond}). In Sec.~\ref{sec:signatures} we discuss a number of phenomenological consequences, with particular emphasis on the GW signatures of both the encounter and the post-capture dynamics, for individual events as well as the stochastic background. Finally, in Sec.~\ref{concl} we discuss our results and conclude. In what follows we assume PBH masses $10^{-17}\,M_\odot \ll m\ll M_\odot$, so that: i) we can neglect Hawking radiation (and associated mass evaporation) in the whole evolution of the PBH, which thus behave, in the absence of accretion, as stable objects. ii) The mass and size of the PBH is negligible with respect to the NS mass and size. This is anyway a very interesting mass range, where current upper limits~\cite{Carr:2020gox} on the fraction of DM in the form of PBH, $f_{\rm PBH}$, are typically not better than 1\%, and often closer to the 10\% level. In the range $[10^{-16},10^{-10}]M_\odot$, bounds are absent or dependent on questionable assumptions, and PBH may also constitute the totality of the DM. \section{Interaction mechanisms}\label{sec:int_mech} By passing through (even close to) a NS, a PBH experiences several drag forces. While most of them have already been discussed in the literature, hereafter we review them, with a main focus on their velocity dependence. However, the content of Sec.~\ref{sec:int_coll} and especially the treatment of GW energy-losses (Sec.~\ref{sec:int_gw}) are novel considerations in the context of the problem at hand. Note that, if the drag force ${\bold F}$ is known, the energy-loss can be promptly computed as the work of the force along the trajectory ${\cal C}$: \begin{equation} |\Delta E|= \int_{\cal C} {\bold F}\cdot {\rm d}{\bold l}\;. \end{equation} \subsection{Dynamical friction in a collisionless medium}\label{sec:int_dynfric} As a PBH of mass $m$ passes through a collisionless medium, the gravitational pull from the wake of the PBH slows it down. This force is called dynamical friction, and can be accounted for by the following formula \cite{RevModPhys.21.383,1987gady.book.....B}: \begin{equation} {\bf F}_{\rm dyn}=-4\pi G^2 m^2\rho \ln{\Lambda_{\rm dyn} }(v) \frac{\boldsymbol{v} }{v^3}\;,\label{eq:df} \end{equation} where $G$ is Netwon's gravitational constant, $\rho$ the density of the medium and $\ln{\Lambda}_{\rm dyn}$ the so-called Coulomb logarithm, which depends on the ratio of extreme impact parameters. Notice that in our case, following \cite{2013PhRvD..87l3524C}, the Coulomb logarithm does depend on the velocity to account for the degenerate nature of the neutron fluid: neutrons contributing to the drag force are actually those for which the momentum transferred in the gravitational scattering is sufficient to extract them from the Fermi sea. The Coulomb logarithm writes~\cite{2013PhRvD..87l3524C} \begin{equation} \ln \Lambda_{\rm dyn} (v)= v^4 \gamma^2 \frac{2}{R_g^2}\int_{d_{\rm crit }}^{d_{\rm max}}{\rm d} x \,x (1-\cos \varphi(x))\;,\label{eq:ln_dyn} \end{equation} where $R_g=2\,G\,m$ is the Schwarzschild radius of the PBH, $\varphi$ is the deviation angle of the neutron scattered by the PBH, $v$ its speed in the PBH reference frame and $\gamma$ is the Lorentz factor. Below the critical PBH-neutron impact parameter $d_{\rm crit }$, the neutrons are accreted onto the PBH, while $d_{\rm max}$ is set by the requirement that the scattered neutron must find an energy level not already occupied by another neutron, or simply be ejected from the Fermi sea. Since the typical chemical potential of neutrons in a NS is $\mu_F \approx 0.3$~GeV, the effect of the degenerate matter reduces $\ln{ \Lambda}_{\rm dyn}$ by a factor $\approx 10$ at a speed $v = 0.8$. In summary, the typical energy-losses scales as: \begin{equation}\label{Edyn} |\Delta E|_{\rm dyn} \sim \frac{R_g^2 M_\star}{R_\star^2} \frac{\ln \Lambda}{ v_\star^2}\;, \end{equation} with $R_\star$ and $M_\star$ the stellar radius and mass, respectively, $v_\star^2=GM_\star/R_\star$ the typical PBH velocity, and the numerical pre-factor in Eq.~(\ref{Edyn}) is determined by the actual integration along the trajectory. \subsection{Dynamical friction in a collisional medium}\label{sec:int_coll} Eqs.~(\ref{eq:df},\ref{eq:ln_dyn}) strictly apply to a collisionless medium. This clearly may not be the case for the strongly interacting neutron fluid. However, the results must still be correct if the gravitational interaction timescale is much shorter than the causal time for the neutron-neutron interaction, set by the sound speed of the medium, $c_s$. We expect thus that Eqs.~(\ref{eq:df},\ref{eq:ln_dyn}) are valid for a PBH moving at {\it supersonic speed} in the neutron fluid. This is confirmed by the study of friction in a collisional medium developed in \cite{1999ApJ...513..252O}. Its results can be summarized as follows: i) At ${\cal M}\equiv v/c_s\gtrsim 2$, the collisionless result is reproduced. ii) At $1\lesssim{\cal M}\lesssim 2$, the friction force is resonantly enhanced. iii) For speeds smaller than the sound speed, for a transient of the order of $R_\star/c_s$, the PBH feels a force given by Eq.~(\ref{eq:df}) with $\ln \Lambda_{\rm dyn}$ replaced by \begin{equation} \ln{\Lambda}_{\rm coll}=\frac{1}{2}\ln\left( \frac{1+{\cal M}}{1- {\cal M}}\right)-{\cal M}\simeq \frac{{\cal M}^3}{3} \:{\rm for}\: {\cal M}\ll 1\;.\label{eq:ln_dyn_sub} \end{equation} Eventually, however, the friction force tends to zero when the system settles closer and closer to the steady state limit. \subsection{Accretion}\label{sec:int_accr} From Newton's laws, the accretion of matter with a rate $\dot m$ and zero momentum causes a drag force in the opposite direction of the motion: \begin{equation} {\bf F}_{\rm acc}= -\;\dot m \;\boldsymbol{v}\;.\label{eq:facc} \end{equation} In the supersonic regime, as argued in \cite{2013PhRvD..87b3507C}, this force can be written as Eq.~(\ref{eq:df}), with $\ln \Lambda_{\rm dyn}$ replaced by \begin{equation} \ln \Lambda_{\rm acc}(v)= v^4 \gamma^2 \frac{d_{\rm crit}^2}{R_g^2}\;, \label{eq:ln_acc_p} \end{equation} with the same notation as used in Eq.~(\ref{eq:ln_dyn}). In the subsonic regime, an analytical theory only exists rigorously for a body accreting at rest, assumed to apply for very small speeds $v \ll c$. In this case, the accretion rate $\dot m$ tends to the spherical Bondi accretion rate \cite{1952MNRAS.112..195B} \begin{equation} \dot m=\frac{{\rm d}m}{{\rm d }t} =\frac{4\pi\,\lambda\, \rho \,G^2 m^2}{c_s^3}\;,\label{eq:bondi} \end{equation} with $\lambda$ depending on the medium properties, equal to 0.707 for a polytropic equation of state with index $\Gamma=4/3$~\cite{Kouvaris:2013kra}. Although some expressions valid for finite $v$, such as \begin{equation} \dot m=\frac{{\rm d}m}{{\rm d }t} =\frac{4\pi\,\lambda\, \rho \,G^2 m^2}{(v^2 + c_s^2)^{3/2}}\;,\label{eq:bondi_v} \end{equation} have been proposed already in~\cite{1952MNRAS.112..195B} and roughly confirmed by simulations \cite{1985MNRAS.217..367S}, the correction to Eq.~(\ref{eq:bondi}) is expected to be small in the deeply sub-sonic regime of major interest in our paper, and we will neglect it in the following. It is worth noting that the accretion force can be written as Eq.~(\ref{eq:df}), with $\ln \Lambda_{\rm dyn}$ replaced by \begin{equation} \ln \Lambda_{\rm sub}(v)=\lambda \,{\cal M}^3\,\label{eq:ln_acc_m}. \end{equation} \subsection{Surface waves}\label{sec:int_surf} A PBH crossing the neutron star excites waves on its surface. These surface waves --- essentially, tidal deformations of the NS --- are different from the sound waves; in particular, they have a different dispersion relation. For this reason we discuss them separately. The total energy dissipated by the BH into production of surface waves has been estimated in Ref.~\cite{2014PhRvD..90j3522D} by making use of a simple analytical model, an incompressible fluid in a uniform gravitational field. The result, Eq.~(13) of Ref.~\cite{2014PhRvD..90j3522D}, up to a numerical coefficient leads to the following estimate for the energy-loss in a NS \begin{equation} |\Delta E|_{\rm surf} \sim \frac{G\,m^2}{R_\star}\;.\label{eq:swel} \end{equation} Keeping in mind that $G\,M_\star/R_\star\gtrsim 0.2$ for a NS, this is parametrically similar to the energy-loss due to the dynamical friction, Eq.~(\ref{Edyn}), however {\em without the enhancement associated to the Coulomb logarithm}. It is easy to understand this result intuitively in terms of the dynamical friction calculation. In the case of an infinite medium, the energy-loss from dynamical friction gets contributions from all distances, hence the logarithmic divergence of the sum. When applied to the star, the star radius $R_\star$ imposes a cutoff, which essentially means retaining only leading-log contributions. Changing the shape of the star would change the subleading constant term. Similar features are shared by surface waves. Such arguments suggest that the contribution to the energy-loss due to the {\it tidal deformations} induced by PBH passing near NS {\em (without actually crossing its surface)} is also subleading. One may view this process as dynamical friction in an infinite medium, in which contributions of all volumes are switched off except the one actually occupied by the star. The Coulomb log now becomes $\log{[r_{\rm min} / (r_{\rm min} - R_\star )]}$, $r_{\rm min}$ being the periastron of the PBH orbit. Clearly this logarithm becomes subleading to the original $\log{(R_\star/R_g)}$ way before $r_{\rm min} - R_\star$ becomes comparable to $R_\star$. The fact that only the part of the volume actually occupied by the star is filled with matter reduces further this contribution, resulting in the suppression by some power of the ratio $R_\star/r_{\rm min}$. The actual calculation yields a series of the type \begin{equation} |\Delta E|_{\rm tidal} \sim \frac{G m^2}{R_\star} \sum_{l=2}^\infty \left( {R_\star\over r_{\rm min}} \right)^{2\ell+2} T_\ell, \;.\label{eq:tidal} \end{equation} where each term is suppressed by $[R_\star/r_{\rm min}]^{2\ell+2}$ \cite{1977ApJ...213..183P}, with $\ell$ the multipole number of the tidal deformation, and $T_\ell$ are dimensionless coefficients $\lesssim {\cal O}(1)$ that depend on the star properties and $R_\star/ r_{\rm min}$. Clearly, this expression is greatly suppressed for $R_\star/ r_{\rm min}\ll 1$, while for $R_\star/ r_{\rm min} \to 1 $ it must turn into the energy-loss due to surface wave emission. \subsection{Gravitational waves}\label{sec:int_gw} The encounter of the relativistically moving PBH with the compact star produces gravitational waves (GW), which is the only energy-loss mechanism we take into account in some detail which does not strictly require contact to be operational. For hyperbolic encounters, analytical calculations for generic configurations have been performed in~\cite{Capozziello:2008ra} and~\cite{DeVittori:2012da}. In the context of pairs of PBH of stellar masses, this process has been considered in~\cite{2017PDU....18..123G,2018PDU....21...61G}. Here, we illustrate the results of these calculations, applying them to the case of interest, but also {\it generalize the calculation to the case of a PBH crossing the NS}, with the latter reported in Sec.~\ref{sec:gw}. The power in GW is \begin{equation} \frac{{\rm d}E}{{\rm d}t}=\frac{G}{5\,c^5}\langle \dddot{Q}_{ij} \dddot{Q}_{ij}\rangle\,,\label{PowGW} \end{equation} where we introduced the quadrupole \begin{equation} Q_{ij}\equiv\int \rho(\boldsymbol{r}) (r_ir_j-\frac{1}{3} r^2 \delta_{ij})\,d^3 r\;. \end{equation} We actually re-express the energy-loss in terms of the distance $d$ to the source and the gravitational strain $h_{ij}$, defined as: \begin{equation} h_{ij}=\frac{2}{c^4}\frac{G}{d}\ddot{Q}_{ij}\,. \end{equation} We compute the typical gravitational strain in cartesian coordinates, expressing it as \begin{equation} h_{0}=(h_{xx}^2+h_{yy}^2+2h_{xy}^2)^{1/2}=\frac{R_g v_i^2}{c^4\,d}\, g(\phi,e)\;,\label{eq:gw_general} \end{equation} with $g(\phi,e)$ a complicated function that depends on the eccentricity $e$ and the phase angle $\phi=\phi(t)$. Its expression can be found in Appendix~\ref{app:pbh_motion}, where we give the detailed description of the orbit of the PBH depending on the initial PBH speed $v_i$ and impact parameter $b$. The contribution to the energy radiated in GW can be split in two pieces, respectively accounting for the motion inside and outside the NS, \begin{equation} |\Delta E|_{\rm gw}= \Delta E_{\rm gw}^{\rm in} + \Delta E_{\rm gw}^{\rm out} \; \label{eq:gwel}. \end{equation} For the purpose of the capture, in the case when the PBH crosses the NS surface $\Delta E_{\rm gw}$ (and hence $\Delta E^{\rm in}_{\rm gw}$) is never important compared to the other contributions previously described. On the other hand, for larger impact parameters $\Delta E_{\rm gw}^{\rm out}$ may be relevant. One can borrow directly Eq.~(3.13) from \cite{DeVittori:2012da}. Rewriting it in terms of the eccentricity $e$ and the periastron distance $p(e)$, and denoting $M\equiv m+M_\star$, we have \begin{equation} \Delta E_{\rm gw}=\frac{8}{15}\frac{m^2M_*^2}{M^3}v_i^7\frac{p(e)}{(e-1)^{7/2}}\,. \label{DeltaEGW} \end{equation} Here the eccentricity $e$ of the orbit is related to the relevant independent parameters $b,v_i, m, M_\star$ via \begin{equation} e=\sqrt{1+\frac{b^2}{a^2}}=\sqrt{1+\frac{b^2v_i^4}{G^2M^2}} \,,\label{eccentricity} \end{equation} where we also introduced the semi-major axis $a=\sqrt{G^2M^2/v_i^4}$. For completeness, the function $p(e)$ is given by \[ p(e) = (e+1)^{-7/2} \Biggl\{ \arccos\left(-\frac{1}{e}\right)\left(24+73\,e^2+\frac{37}{4}e^4\right) \] \begin{equation} +\frac{\sqrt{e^2-1}}{12}(602+673\,e^2)\Biggr\} \,\nonumber. \end{equation} It is straightforward to derive the scaling $\Delta E_{\rm gw}\propto v_i^{-7}$ in the regime of physical interest here ($e\approx 1$), which suggests a growing relative importance of this energy-loss channel for low velocity dispersion systems. \section{Capture} \label{sec:capture} A PBH gets captured by a NS, i.e. becomes gravitationally bound to it, if it loses enough kinetic energy so that its total energy becomes negative. The capture condition of a PBH of mass $m$ thus writes: \begin{equation} |\Delta E|>E_i=\frac{1}{2}m v_i^2 \;, \label{eq:cap_condition} \end{equation} with $v_i$ the PBH velocity at infinity and $\Delta E$ the energy-losses coming from the different interaction mechanisms reviewed. Based on the previous discussion, it is important to assess if the PBH is moving supersonically or subsonically when it interacts. We anticipate that, for a broad range of NS models, the first interaction (hence the possible capture) of the PBH with the NS material happens at supersonic or transonic velocities, i.e. ${\cal M}\gtrsim 1$. To reach this conclusion, we took several benchmark models from the literature \cite{2013A&A...560A..48P} (BSK-20 and BSK-21) spanning equations of state of varying stiffness, with a low and a high mass model which are in agreement with the LIGO/VIRGO data from a binary neutron star merger~\cite{Abbott:2018exr}. For the sake of clarity we define the typical velocity $v_\star$, associated angular velocity $\omega_\star$, frequency $f_\star$, period $T_\star$, \begin{equation} v_\star=\sqrt{\frac{GM_\star}{R_\star}}, \: \: \omega_\star=\frac{v_\star}{R_\star}, \: \: f_\star=\frac{1}{T_\star}=\frac{\omega_\star}{2\pi}\: \end{equation} that we will use throughout our calculations. These scales are summarized in Tab.~\ref{tab:numbers} for the profiles considered; we also report the sound speed ($c_s$) and the chemical potential of neutrons ($\mu_n$) in the NS core. Unless written otherwise, the numerical estimates given in the paper are based on the values of the BSK-20-1 NS model, and assume that the NS is an homogeneous sphere of matter. \begin{table}[h!] \begin{center} \begin{tabular}{l c c c c} \hline\hline Model & BSK-20-1 & BSK-20-2 & BSK 21-1 & BSK 21-2 \\ \hline Radius $R_\star$ [km] & 11.6 & 10.7 & 12.5 & 12.0\\ Mass $M_\star$ [$\rm M_{\odot}$] & 1.52 & 2.12 & 1.54 & 2.11\\ $v_\star$ [$c$] & 0.44 & 0.54 & 0.43 & 0.50 \\ $f_\star=1/T_\star$ [kHz] & 1.8 & 2.4 & 1.6 & 2.0\\ $c_s$ (core) [$c$] & 0.68 & 0.97 & 0.64 & 0.81 \\ $\mu_n$ (core) [GeV] & 0.27 & 0.81 & 0.24 & 0.51 \\ \hline \end{tabular} \caption{Relevant parameters for the benchmark NS models considered.} \label{tab:numbers} \end{center} \end{table} To discuss if capture happens in the subsonic or supersonic regime, one should compare the speed of the PBH travelling through the NS with the sound speed of the NS medium along its trajectory. The trajectory of the PBH in the NS is presented in Appendix~\ref{app:pbh_motion}. In the limit $v_i \ll v_\star$, the arrival speed of a PBH as a function of $r$ is given by the following expression in terms of the gravitational potential $\Phi$, \begin{equation} v(r)=\sqrt{1-e^{2(\Phi(\infty)-\Phi(r))}}\simeq v_\star\,\sqrt{3-r^2/R_\star^2}\;, \label{eq:vesc} \end{equation} where the first expression at the RHS takes into account GR effects, and the second approximate equality holds in the Newtonian limit, being accurate to within 5\%. In Fig.~\ref{fig:sound_speed} we show the sound speed of the chosen NS benchmark models as a function of $r$ (thick lines), as well as the velocity Eq.~(\ref{eq:vesc}) (thin lines of corresponding style and color). For all models except BSK-20-2, the PBH speed is always larger than the sound speed at any given $r$. For BSK-20-2, the velocity can drop slightly below (few percent) the speed of sound if the PBH enters within the inner third of the star. Using the expressions valid in the {\it supersonic regime} for the mechanisms summarized in Sec.~\ref{sec:int_mech}, we compute the different energy-losses as a function of the impact parameter. To this goal, we define $b_c$ as the critical impact parameter, such that a PBH having $b=b_c$ will eventually graze the NS of radius $R_\star$, reaching in its orbit a minimal distance from the center $r_{\rm min}=R_\star$. In terms of the initial velocity $v_i$, one has: \begin{equation} b_c=R_\star \sqrt{1+2\frac{v_\star^2}{v_i^2}} \;.\label{eq:bc} \end{equation} As an example, in the model BSK-20-1 we obtain $\tilde{b}_c\equiv b_c/R_\star\approx 624$. Our results are reported in Fig.~\ref{fig:energy_losses} for the initial velocity value $v_i=10^{-3}$. It is clear that the dominant process for capture is dynamical friction whatever the impact parameter $b<b_c$. For all but the GW term, the vertical axis scales roughly as $1/E_i\propto (10^{-3}/v_i)^2$. For initial velocities $v_i<2\times 10^{-4}$, GW capture for $b>b_c$ becomes important. Note that, had we used expressions for the transonic regime, the impact of the dynamical friction would have been enhanced thanks to the resonant effect mentioned in Sec.~\ref{sec:int_coll}, while the accretion mechanism would have been comparatively suppressed. We conclude, consistently with the common lore, that dynamical friction is the dominant mechanism for energy-loss by the PBH passing through the NS. However, it is not always a dominant {\it capture} mechanism, as we will argue in Sec.~\ref{sec:signatures}. \begin{figure}[h!] \centering \includegraphics[width=\columnwidth]{sound_speed_vesc.pdf} \caption{Sound speed (thick line) and PBH speed (thin line) as a function of the radius for the NS reference profiles considered.\label{fig:sound_speed}} \end{figure} \begin{figure}[h!] \centering \includegraphics[width=\columnwidth]{Energy_losses_capture.pdf} \caption{Comparison of the contribution of the different processes of energy-losses to capture as a function of the impact parameter ratio $b/b_c$, for the benchmark $v_i=10^{-3}$. \label{fig:energy_losses}} \end{figure} A naive look at Fig.~\ref{fig:energy_losses} would suggest no capture for the typical velocity dispersion in the Milky Way halo. However, this would be incorrect, given the broad distribution of velocities. To be more quantitative, we assume that the PBHs follow a Maxwellian distribution in velocities with the dispersion $\bar{v}$, \begin{equation} {\rm d}^3n=n_\text{PBH}\left(\frac{3}{2\pi \bar{v}^2}\right)^{3/2} \exp\left\{\frac{-3v^2}{2\bar{v}^2}\right\} {\rm d}^3v, \end{equation} where $n_\text{PBH}=\rho_\text{PBH}/m$, $\rho_\text{BH}$ is the density of PBHs at the star location, and $m$ their mass. It can be expressed in terms of the local DM density $\rho_\text{DM}$ as follows, \begin{equation} \rho_\text{PBH} = f_{\rm PBH} \rho_\text{DM}, \label{eq:rhoBH} \end{equation} with $ f_{\rm PBH}$ that can observationally attain values as large as 1 for $10^{-16}\,M_\odot \lesssim m\lesssim 10^{-10}\,M_\odot$, while being limited to $f_{\rm PBH}\lesssim{\cal O}$(0.01-0.1) for $10^{-10}\,M_\odot\lesssim m\lesssim 0.1\,M_\odot$. In the following we always assume that $\bar{v}\ll v_\star$. The rate of NS-PBH encounter leading to capture is: \begin{equation} {\cal G}_{\star}=\int \frac{{\rm d}^3 n}{{\rm d}v^3}\; {\cal S}(v) \; v\; {\rm d}^3v\;, \end{equation} where ${\cal S}(v)=\pi\; b_{\cal G}^2$ is the effective cross-section of the star which leads to capture\footnote{Note that a more precise GR treatment accounting for the Schwarzschild metric of the NS would lead to an enhanced capture rate by a factor $1/(1-R_\star^s/R_\star)\approx 1.6$~\cite{2008PhRvD..77b3006K}, where $R_\star^s$ is the Schwarzschild radius of the NS.}. This is defined by the condition in Eq.~\ref{eq:cap_condition}: In practice, $b_{\cal G}(v)$ is the {\it largest} $b$ solving the implicit equation $\Delta E(b,v,m,M_\star)=m v^2/2$, where $\Delta E$ includes all energy-losses. Considering all the processes discussed above, and using the typical PBH velocity dispersion $\bar{v}=10^{-3}$, we find numerically: \begin{equation} {\cal G}_{\star}\simeq 2.1\times 10^{-17} \; \left( \frac{\rho_\text{PBH}}{\rm GeV\,cm^{-3}}\right) \left( \frac{10^{-3}}{\bar v}\right)^3 {\cal C}\left[X \right] \rm yr^{-1}\;,\label{eq:cap_rate} \end{equation} with, \begin{equation} X=X(m,{\bar v})\equiv \left( \frac{m}{10^{25}\rm g}\right)\left( \frac{10^{-3}}{\bar v}\right)^2\;\label{eq:defX}\,, \end{equation} and the function ${\cal C} [X]$ is displayed with a dashed-black line in Fig.~\ref{fig:CX_scaling}. Because of the form of ${\cal S}(v)$, the dependence on ${\bar{v}}$ and $m$ is not trivial. The contribution of GW to ${\cal C} [X]$ is shown with a blue line in Fig.~\ref{fig:CX_scaling}, whereas the dashed-gray curve displays the behaviour of $\cal C$ without accounting for gravitational capture. For $X<10$, ${\cal C} [X]$ is constant; for $10<X<10^3$ it declines as $X^{-1}$; when $X>10^3$, the decline follows the milder behaviour $\propto X^{-5/7}$, because capture by GW emission kicks in and dominates at large impact parameters. Note that, although at large $X$ the capture is suppressed, the GW capture becomes comparatively more important. If fixing the mass at $10^{25}\rm g$, at $\bar{ v}=10^{-3}$, $10^{-4}$ and $10^{-5}$ the GW capture is responsible for 1.1\%, 6.0\% and 99\% of the captures, respectively. In obtaining the above results, we have considered only interactions between the PBH and an {\it isolated} NS. While a detailed account of {\it multi-body effects} goes beyond our goals, let us mention the current understanding of these processes. If the NS is in a tight binary, it has been shown in~\cite{2012PhRvL.109f1301B} that the capture can be enhanced by a factor up to 3-4, due to the energy-loss of the PBH (or any ``test particle'', for what matters) resulting from its gravitational scattering off the NS moving companion. More frequently, the PBH falling onto the NS will also experience tidal effects by the stellar clusters or even by the Galactic disk in which the NS is embedded. For the Milky Way disk, this effect (which in general may either enhance or deplete the capture probability) has been estimated to become important in the capture process for $m\lesssim {\rm few}\times 10^{-13}\,M_\odot$~\cite{2019arXiv190605950M}. For comparison, we also define the rate of encounters which involve interaction with matter, but does not always lead to capture: \begin{align} \Gamma_{\star}&=\int \frac{{\rm d}^3 n}{{\rm d}v^3}\; \pi b_c^2(v) \; v\; {\rm d}^3v=\nonumber\;\\ &\simeq 3.8\times 10^{-16} \; \left( \frac{\rho_\text{BH}}{1 \rm GeV\, cm^{-3}}\right)\left( \frac{10^{25}\rm g}{m}\right) \left( \frac{10^{-3}}{\bar v}\right)\rm yr^{-1}\;,\label{encontTOT} \end{align} where $b_c$ is defined in Eq.~(\ref{eq:bc}). Further comments on these capture rates and potentially observable consequences are reported in Sec.~\ref{sec:signatures}. \begin{figure}[h!] \centering \includegraphics[width=\columnwidth]{CX_scaling.pdf} \caption{Evolution of the function ${\cal C}$ (black-dashed line) of Eq.~(\ref{eq:cap_rate}) as a function of $X$ defined in Eq.~(\ref{eq:defX}). The sole contribution of GW capture is displayed in blue and the difference with the total is shown with a dashed gray line.\label{fig:CX_scaling}} \end{figure} \section{Post-capture} \label{eq:postcapture} If the PBH first interaction leads to its capture, it starts orbiting on a bounded trajectory, typically with large eccentricity. We can distinguish two cases, according if it was captured with an interaction outside or inside the NS. In the former case, the GW emission makes the PBH to settle on a meta-stable elliptical orbit around the NS, for a timescale \begin{equation} t_{\rm settle}^{\rm GW}\simeq 16\; \left(\frac{m}{10^{22}\,{\rm g}}\right)^{-3/2} \left(\frac{b}{b_c} \right)^{21/2}\left(\frac{v_\star}{0.44}\right)^{-19} \rm Myr\;.\label{tgwsettl} \end{equation} This time is estimated from the coalescence time of high eccentricity binaries from Ref.~\cite{PhysRev.136.B1224}, taking the same periastron for the elliptical trajectory as the hyperbolic one along which the PBH is captured, and choosing a binding energy of order $\Delta E_{\rm gw}$. This timescale is quite sensitive to the values of $v_\star$; for the reference values chosen, it becomes shorter than the age of the Universe $t_U$ for $m>1.4\times 10^{20}\,{\rm g}\simeq 7\times10^{-14}\,M_\odot$. In the latter case, when the capture happens via an interaction inside the NS, or once the PBH drops inside the NS via GW losses, the energy-loss timescale is much shorter. The PBH mostly loses energy each time it passes through the NS, eventually settling on a fully contained orbit around the star center in a timescale~\cite{2013PhRvD..87l3524C} \begin{equation} t_{\rm settle}\lesssim 4\times 10^4\,\left(\frac{m}{10^{22}\,{\rm g}}\right)^{-3/2}\,{\rm yr}.\label{tsettl} \end{equation} This is shorter than $t_U$ for $m>2\times 10^{18}\,{\rm g}\simeq 10^{-15}\,M_\odot$. While during the first passage the PBH crosses the NS with a supersonic velocity, at later stages when the orbit size becomes smaller than $r\lesssim R_\star c_s/v_\star$ the PBH motion becomes subsonic. From this moment onward one may neglect all the contributions to the drag force except the one due to accretion of ambient matter, so that \begin{equation} {\bf F}_{\rm drag} = - \dot m \boldsymbol{v} = -4\pi G^2 m^2\rho \frac{\boldsymbol{v} }{c_s^3}\;\label{pcdrag} \end{equation} where $\boldsymbol{v}$ is the {\em relative} velocity of the PBH and the ambient matter. The equation of motion of the PBH in this case takes the following form: \begin{equation} \ddot{\boldsymbol{r}} +{\cal D}(t) \left[ \dot {\boldsymbol{r}} - \boldsymbol{\Omega}\times \boldsymbol{r} \right] + \omega_\star^2 {\boldsymbol{r}}=0\; \label{eq:motion}, \end{equation} where the PBH position $\boldsymbol{r}$ is defined with respect to the star center, ${\cal D}(t) = \dot m/m$ (cf. Eq.~(\ref{pcdrag})), $\omega_\star = \sqrt{4\pi G\rho/3} \sim 1.1\times 10^4\,$s$^{-1}$ is the angular velocity around the NS center, and we have included the possibility that the NS rotates with angular velocity $\boldsymbol{\Omega}$. This equation factorizes into three independent damped harmonic oscillator equations: one for the motion $r_3(t)$ parallel to $\boldsymbol{\Omega}$, and two equations for a co-rotating and counter-rotating modes $r_\pm (t)= r_1(t)\pm i r_2(t) $ in the plane orthogonal to $\boldsymbol{\Omega}$. The damping term in these equations is small, \begin{equation} {{\cal D}\over \omega_\star} \sim 2.8\times 10^{-12} \left( { m \over 10^{22} {\rm g}}\right) \ll 1, \label{eq:oscillation_cond} \end{equation} and slowly varying with time. The approximate solution is then written in the form \begin{equation} r_\pm \propto \exp \left\{ - {1\over 2} \left( 1\mp {\Omega\over\omega_\star}\right) \ln m + i\omega_\star t\right\}. \label{eq:oscillations-solution} \end{equation} The same solution with $\Omega=0$ is valid for $r_3(t)$. For most of the observed NS the ratio $\Omega/\omega_\star$ is much smaller than 1, reaching about $1/4$ for the fastest millisecond pulsar. Thus, the correction due to NS rotation in Eq.~(\ref{eq:oscillations-solution}) can be neglected in most of the cases. Then all three solutions have the same behavior which implies \begin{equation} m\;r^2\;=\; {\rm const.}\label{eq:conservation} \end{equation} Note that this (approximate) conservation law does not depend on the accretion regime, as long as ${\cal D}\ll \omega_\star$. Making use of this relation, one may readily estimate a typical displacement of the oscillating PBH form the star center at a time when its mass has grown to a fraction $f\ll 1$ of the star mass, $m=f M_\star$. Assuming initial mass $m_i$ and initial orbital radius $r_i\sim R_\star$, the final orbital radius is \begin{equation} R_f=R_\star \sqrt{\frac{m_i}{f\,M_\star}}\,.\label{initcond} \end{equation} To conclude this section, let us estimate the time it would take a PBH of mass $m$ settled within the NS to accrete the whole star. For the rough estimate we approximate the star as a medium of constant density $\rho_\star=3M_\star/(4\pi R_\star^3)$. This is a reasonable approximation in the center of a NS, whose typical profile goes as $\rho_\star \propto (1-(r/R_\star)^2)^{1/2}$ \cite{2013A&A...560A..48P}. Assuming the Bondi accretion rate, Eq.~(\ref{eq:bondi}), we obtain \begin{equation} m(t)=\frac{m}{1-t/t_B}\,, \end{equation} where \begin{equation} t_{B}= \frac{ c_s^3\, R_\star^3}{3 \,G^2 \,M_\star\, m}\simeq 1\left( \frac{10^{22}\rm g}{m}\right) \rm yr \end{equation} is the typical time needed for the PBH to consume the whole NS. Actually, as discussed in Ref.~\cite{2014PhRvD..90d3512K}, the Bondi regime may fail before than the whole star is consumed and $m(t)\simeq M_\star$, the reason being the angular momentum conservation. In this case the Bondi regime is probably replaced by Eddington-like accretion during the last stages, slightly prolonging the life of the star. \section{Signatures}\label{sec:signatures} The dynamics outlined in the previous sections has a number of phenomenological consequences, which we discuss in this section. \subsection{GW bursts from typical PBH-NS encounters}\label{sec:gw} In a hyperbolic encounter between two massive objects, a characteristic ``tear drop'' burst signal is emitted, according the LIGO nomenclature~\cite{2017CQGra..34c4002P}. A similar signature for PBH has been considered in encounters between pairs of PBH in~\cite{2018PDU....21...61G,2017PDU....18..123G}. Apart for the masses of the two bodies, the motion depends on the impact parameter $b$ and the initial speed $v_i$ or, equivalently, the eccentricity $e$ given by Eq.~(\ref{eccentricity}). The GW signal can then be computed as explained in Sec.~\ref{sec:int_gw}, provided that the orbital function $g(e,\phi(t))$ is known. In the limit of monochromatic emission and for $m\ll M_\star$ one can describe the strain due to a hyperbolic encounter as producing a typical GW burst of amplitude $h_c(b,v_i,d)$ and characteristic frequency $f_c(b,v_i)$ as in Refs.~\cite{2017PDU....18..123G, 2018PDU....21...61G} \footnote{Note that a factor $1/3$ is missing in their definition of $h$, given the expression they take for the quadrupole. }: \begin{align} h_c(b,v_i,d)&=\frac{2Gm}{3\; d\; c^2}\beta_i^2 \frac{2}{e-1}\sqrt{18(e+1)+5e^2}\\ f_c(b,v_i)&=\frac{1}{2\pi}\frac{v_i}{b}\frac{e+1}{e-1}\,, \end{align} where $d$ denotes the distance of the observer from the encounter. For $b=b_c$, $v_i=10^{-3}$, $d=1\,$kpc and $m=10^{25}$g, typical values are $h_c\approx 4\times 10^{-25}$ and $f\approx 3\;$kHz. Note that these functions diverge for small impact parameter, i.e. $b \to 0$. Hence in the following, we generalize the calculation to the case where the PBH passes within the NS. We consider a perturbative approach in which the GW emission is computed along the unperturbed trajectory. Outside the NS, both before entering and after exiting the star, the motion is hyperbolic with parameters determined as from Eq.~(\ref{eccentricity}). Inside the NS, in the approximation of constant density, the gravitational potential is a harmonic potential. Hence, within the star, the PBH follows an elliptical orbit centered on the NS center, with semi-minor axis $\alpha_-$ and semi-major axis $\alpha_+$ given by \begin{equation} \frac{\alpha_\pm}{R_\star}= \sqrt{{\cal V}} \left(1 \pm \sqrt{1 -\left(\frac{v_i \tilde{b}}{v_\star {\cal V}}\right)^2}\right) \end{equation} where ${\cal V}=3/2+v_i^2/(2 v_\star^2)\simeq 3/2$. These expressions are obtained by equating the effective potential (including the angular momentum) to zero. The eccentricity $\varepsilon$ is defined as \begin{equation} \varepsilon=\sqrt{1-\left(\frac{\alpha_-}{\alpha_+}\right)^2}\;. \end{equation} A representation of the trajectory can be found in Fig.~\ref{fig:motion} for different impact parameters. For $b=b_c/2$ the two hyperbolas followed by the PBH outside the star (whose border is the red circle) are drawn in blue and green, while the arc of ellipse followed inside the star is shown in dashed orange. Further details on the parameterization of the trajectory with respect to time are given in Appendix~\ref{app:pbh_motion}. The typical GW strain as a function of time for the same trajectories is described by Eq.~(\ref{eq:gwel}) and Appendix~\ref{app:GW} and plotted in Fig.~\ref{fig:gwte}. One can see that the typical gravitational strain and frequency saturate to $h_c = 4\sqrt{5}v_\star^4 R_\star m /(M_\star\,d)$ and $f_c = f_\star$ corresponding to taking the limit $\varepsilon\to 0$ in Eq.~(\ref{eq:gwin}). \begin{figure}[h!] \centering \includegraphics[width=\columnwidth]{Hybrid_motion.png} \caption{Examples of PBH trajectories (black lines) for impact parameters $\leq b_c$. The star is displayed in red, the construction of this trajectory (black) from two hyperboles (green and blue) and one ellipse (dashed orange) is shown with dashed lines. The radial scale is in units of $R_{\star}$.}\label{fig:motion} \end{figure} \begin{figure}[h!] \centering \includegraphics[width=\columnwidth]{Hybrid_GW_strain.png} \caption{Evolution of the gravitational strain for the trajectories shown Fig.~\ref{fig:motion}. $h_c$ is in units of $10^{-25}$, assuming $v_i=10^{-3}$, $d=1\,$kpc and $m=10^{25}\,$g.}\label{fig:gwte} \end{figure} Assuming $N_\star=10^{9}$ NS in the Galaxy, Eq.~(\ref{encontTOT}) yields a total event rate of \begin{align} \Gamma_\star\,{\cal N}_{\star}\simeq 0.38 \;\left( \frac{\rho_\text{BH}}{{\rm GeV\, cm}^{-3}}\right) \left( \frac{10^{25}\rm g}{m}\right) \left( \frac{10^{-3}}{\bar v}\right){\rm Myr}^{-1}\;, \end{align} which, for $m\lesssim 10^{25}\rm g $, is not dissimilar from the estimated GRB rate in the Galaxy. Not surprisingly, this rate of encounters is large for very low $m$: at constant mass density, lighter PBH are more numerous and thus lend to more frequent encounters. On the other hand, the amplitude is proportional to $m$, hence louder encounters require heavier PBH and are correspondingly more rare. \subsection{GW background from PBH-NS encounters}\label{sec:gwback} In the previous section, we focused on the single GW emission from a possibly ``loud'' but rare encounter event. However, if PBH constitute a sizable fraction of the DM, for sub-stellar mass PBH there are many PBH traveling near NS at distances below the typical inter-stellar distances, $b_{\rm max}$. It may be therefore interesting to compute the overall GW signal due to these frequent but soft events. We will start by considering the signal for a single NS, then generalizing the calculation to a population of $N_\star$ NS, spread out in the Galactic disk of radius $R_{G}$. In order to talk of a stochastic background, the frequency of hyperbolic encounters must be larger than the typical frequency of a single encounter merger. This sets a lower distance, $b_{\rm min}$ (of the order 1 AU for $v=10^{-3}$), for the encounter to contribute to the background. To set the relevant scales, let us estimate an order of magnitude of the number of encounters contributing to the extremely low GW frequency of $f=10^{-10}$Hz, corresponding to a typical impact parameter of $b=0.1\,$pc. Thus, considering a PBH density $\rho_{\rm PBH}=1\,$GeV/cm$^3$, there are $N_\star\times\pi\,b^2\, v_i \,\rho_{\rm PBH}/(m\,f)\approx10^4$ events at the same time in the Galaxy, for $N_\star=10^9$, $v_i=10^{-3}$, and $m={10^{25}\rm g}$. This number scales roughly as $1/f^3$, and becomes ${\cal O}(1)$ for frequencies higher than $\sim 10^{-7}\,$Hz, so that computing the GW background above this limit becomes irrelevant. In the monochromatic approximation~\footnote{More correctly, the emission should be determined via an integral over the trajectory. Given the rather pessimistic conclusions on the detectability of this signal, we deem the monochromatic approximation sufficient.}, the energy released in a single encounter is given by $E_{\rm enc}(b,v_i,d)=P_{\rm gw}/f_c=\kappa \;h_c^2(b,v_i,d)/f_c(b,v_i)$ with $\kappa$ a proportionality constant. In differential terms in frequency space, \begin{equation} \frac{{\rm d}E_{\rm enc}}{{\rm d}f}=\kappa\frac{h_c^2(d,b,v)}{f_c(b,v)}\delta\left(f-f_c(b,v_i)\right)\,. \end{equation} The total signal in the limit of incoherent sum can be written as: \begin{eqnarray} && \left\langle \frac{{\rm d}E_{\rm diff}}{{\rm d} f}\right\rangle= \kappa\int_{V_{\rm MW}}{\rm d}V_{\rm MW}\,n_\star\times \nonumber \\ && \int {\rm d}^3v\int_{b_{\rm min}}^{b_{\rm max}}{\rm d}b\;2\pi b\,v\frac{{\rm d}^3 n_{\rm BH}}{{\rm d}v^3}\; \frac{h_c^2(d,b,v)}{f_c(b,v)}\delta(f-f_c(b,v))\nonumber \end{eqnarray} where $n_\star$ is the density of stars as a function of the coordinates, and $V_{MW}$ the Milky Way volume considered. Once the integration over $b$ is performed, the delta function fixes the function $b(f,v)$. Computing the integral over $v$ then leads to the following value for the effective strain: \begin{eqnarray} \sqrt{\left\langle h_c^2 \right\rangle}&&\simeq 3\times 10^{-20}\left(\frac{10^{-10}\,\rm Hz}{f}\right)^2\times\nonumber\\ && \sqrt{\frac{N_\star}{10^9}\,\frac{m}{10^{25}\rm g}\,\frac{\rho_{\rm PBH}}{\rm GeV\,cm^{-3}}\,\ln\left(\frac{R_G}{20\rm \;kpc}\cdot\frac{\rm pc}{r_p}\right)} \end{eqnarray} where $r_p$ is the distance to the closest pulsar. This number is far below the SKA sensitivity~\cite{2015aska.confE..37J} expected to reach $10^{-16}$ for the effective strain measured at around $10^{-8}\,$Hz. Note that this estimate can be extended to the population of ordinary stars in the Galaxy, since the encounters considered here occur at distances larger than $b_{\rm min}\approx 1\,$AU. However, even taking $N_\star$ two orders of magnitude larger is not sufficient to reach the sensitivity of forthcoming low-frequency GW detectors. \subsection{GW signature of a trapped PBH}\label{trapped} In the relatively rare cases where the encounter leads to a capture, the PBH motion is also associated to a GW emission. If captured via GW emission in a highly eccentric orbit outside the NS, the GW emission consists of a few bursts at each periastron passage (the period being a fraction of Eq.~(\ref{tgwsettl}) of strain and frequency similar to what computed in Sec.~\ref{sec:gw}. Once orbiting inside the NS, the GW signal is characterized by Eq.~(\ref{eq:conservation}). Interestingly, the expected emission is {\it monochromatic} with frequency $f_\star\sim$kHz and with a {\it constant amplitude} estimated as \begin{equation} h_0= \frac{4\sqrt{2}G}{d c^4}m r^2 \omega_\star^2 \approx 2.5\times 10^{-25} \left( \frac{m}{10^{25}\rm g}\right) \left( \frac{1\; \rm kpc}{d}\right)\;. \end{equation} This GW strain is sustained during the all accretion process, lasting: \begin{equation} t_{B}= \frac{ c_s^3\, R_\star^3}{3 \,G^2 \,M_\star\, m}\approx 9 \left( \frac{10^{25}\rm g}{m}\right) \rm hours\;. \end{equation} If accounting for rotation (see Sec.~\ref{eq:postcapture}), the GW strain is enhanced or reduced (depending on the sign of $\Omega$) in the last stages of accretion, according to: \begin{equation} h_0^R(t) = h_0 \,\left( \frac{m(t)}{m} \right)^{\Omega/\omega_\star} = h_0 \, \left( \frac{1}{1-t/t_B} \right)^{\Omega/\omega_\star} \,. \end{equation} Assuming $N_\star=10^{9}$ neutron stars in the Galaxy, Eq.~(\ref{eq:cap_rate}) yields an event rate of \begin{equation} {\cal G}_{\star}N_\star\simeq 2.1\times 10^{-8} \; \left( \frac{\rho_\text{PBH}}{ \rm GeV\,cm^{-3}}\right) \left( \frac{10^{-3}}{\bar v}\right)^3 {\cal C}\left[X \right] \rm yr^{-1}\,.\label{eq:cap_rate_MW} \end{equation} For typical Milky Way values of ($\rho_{\rm PBH},m,\bar{v}$), within the age of the Galaxy ($\approx 10^{10}\,$\rm yr) one would expect up to a few hundreds cases of NS transmuted in BH. Note, however, that provided that $X$ is in the range where ${\cal C}\left[X \right] $ is constant, the capture rate is maximized in environments with large $\rho_{\rm PBH}$ and low velocity dispersion, singling out DM dominated dwarf spheroidals as comparatively more promising targets. Typical such objects (see for instance~\cite{Read:2018fxs}) have a velocity dispersion one order of magnitude or more below the Milky Way value and DM densities one order of magnitude higher than in the solar neighborhood, hence we expect that ${\cal G}_{\star}$ can be enhanced by 10$^4$ or more compared to the Milky Way value. Since each of these objects contains $\sim 10^{-4}$ of the stars of the Milky Way, the overall numbers of NS transmuted in BH may be thus comparable. \subsection{Final stages} If a PBH is trapped inside the NS, eventually it will swallow the entire NS, causing a so-called {\it transmutation} of the NS into a BH. This phenomenon is expected to be associated with both electromagnetic (EM) and gravitational wave signals. The reason why some EM burst is expected boils down to the no-hair theorem and the fact that NS are magnetized objects: The newly formed BH must expel its magnetic field energy, liberating at least an energy~\cite{Chirenti:2019sxw} \begin{equation} E_B=\frac{B^2}{8\pi}\frac{4\pi}{3}R_\star^3 \simeq 2\times 10^{41}\left(\frac{B}{10^{12} {\rm G}}\right)^2 \left(\frac{R_\star}{10\, {\rm km}}\right)^3{\rm erg}\; \end{equation} into EM form. For some more details, see \cite{2015MNRAS.450L..71F,2018ApJ...868...17A,Chirenti:2019sxw}. It is unclear if further signatures are associated to the ejecta, if present in non-negligible amounts. Also, a fast change of the quadrupole will lead to some GW signature. These signals have been estimated to be rather unpromising for detection~\cite{2019arXiv190907968E} (see also~\cite{2011PhRvD..83h3512K,2019JCAP...05..035G}). However, current simulations have set the PBH exactly at the center, forcing a symmetry which definitely suppresses both the GW emission and other signatures (e.g. ejecta), and realistic magnetic fields are not accounted for. Our study (and notably Eq.~(\ref{initcond})) suggests some degree of asymmetry in the final phase of the PBH mass growth, which is more and more pronounced for a heavier and heavier PBH. For instance, a PBH of initial mass $\simeq 10^{-3}\,M_\odot$ will have reached a mass of 10\% of the NS (which one may consider at the onset of the final transmutation) at a distance of about 10\% of the NS center (about 3-4 times larger than its Schwarzschild radius). Although we cannot compute reliably the signatures associated to the final stages, a relation like Eq.~(\ref{initcond}) can be used to provide a more realistic initial condition in future simulations. \section{Conclusion} \label{concl} In this article, we have revisited the interaction processes between primordial black holes (PBH) and neutron stars (NS) and discussed their consequences for the dynamical evolution of the system. In particular, we have argued that dynamical friction, the major player in the PBH capture (which happens typically with the PBH hitting the NS at supersonic velocities), is negligible in the post-capture dynamics, when the PBH is orbiting within the star at subsonic speed. Also, we have shown that (Bondi-like) accretion dominates the post-capture phase, and is responsible for an approximate conservation law, valid until the final stages, when the transmutation of the NS into a BH takes place. This also implies that the onset of the final catastrophic event is expected with the BH seed in slight off-center position: While the actual consequences of this fact must be investigated via numerical simulations, one can expect enhanced electromagnetic and gravitational wave signatures compared to current estimates. For the first time, we also assessed the importance of GW losses in this context, notably for captures at large impact parameters in low velocity dispersion systems. Finally, we discussed GW signals associated to different phases of the PBH-stellar interaction. In particular, we extended the hyperbolic encounter ``tear drop'' signal calculation to the case where the PBH enters the NS in its trajectory, and estimated the (small) GW background from frequent soft encounters. Unfortunately, for the single encouter case the signal rate and strength are anticorrelated: We expect sufficiently loud events (associated to massive PBH) to be rare, while frequent events (for light PBH) are below current or foreseen GW sensitivity. Barring some luck, the still uncertain emission associated to the transmutation event appears the most promising opportunity for a discovery of these exotics. It is interesting however to point out that as the result of cumulative transmutation events over the cosmic history, a population of low-mass BH (with mass $\sim 1\div \, M_\odot$) will build up. It has been speculated that up to a few percent of the NS-NS coalescence events may in fact involve such a transmuted low-mass BH~\cite{2018ApJ...868...17A}. This promising alternative diagnostics will however require high GW event statistics and a good measurement of the merger/ringdown part of the waveform, for which one will have to wait for third-generation GW detectors~\cite{Yang:2017gfb}. \begin{acknowledgments} Y.G warmly thanks Nicolas Chamel for providing him the equations of state for old neutron stars and for discussions. The work of Y.G. is supported by Villum Fonden under project no.~18994. PDS acknowledges support from IDEX Univ. Grenoble Alpes, under the program {\it Initiatives de Recherche Strat{\'e}giques}, project ``Multimessenger avenues in gravitational waves'' (PI: PDS). The work of P.T. is supported in part by the IISN grant 4.4503.15. \end{acknowledgments} \begin{appendix} \section{Details on PBH trajectory}\label{app:pbh_motion} \subsection{Parameterization of the PBH motion} In this appendix we give the parameterization of the PBH trajectory for impact parameter $b<b_c$ (see Eq.~\ref{eq:bc}) for which the PBH crosses the NS. The case $b>b_c$ can readily be deduced for example from Refs.~\cite{2018PDU....21...61G,2017PDU....18..123G}. In the following we consider the classical trajectory of a PBH of mass $m\ll M_\star$ crossing a NS of constant density $\rho_\star=3M_\star/(4\pi R_\star^3)$. Using the polar coordinates ($r,\phi$), with $r=0$ corresponding to the NS center, the trajectory is parameterized by a hyperbola (I), an ellipse (II) and a hyperbola (III): \begin{equation} r(\phi)= \begin{cases} r_{\rm \tiny I}(\phi)=\displaystyle\frac{a (e^2-1)}{1+e\cos(\phi-\psi_0)}, &\phi\leqslant\phi_0\\[10pt] r_{\rm \tiny II}(\phi)=\displaystyle\frac{\alpha_-}{\sqrt{1-\varepsilon^2\cos^2(\phi-\psi_1)}}, &\phi_0<\phi<\phi_1\\[10pt] r_{\rm \tiny III}(\phi)=\displaystyle\frac{a (e^2-1)}{1+e\cos(\phi-\psi_2)}, &\phi_1\leqslant\phi\;,\\ \end{cases} \end{equation} For the hyperbolic motion ($r_{\rm I}$ and $r_{\rm III}$), the eccentricity is given by: \begin{equation} e=\sqrt{1+\frac{b^2}{a^2}}=\sqrt{1+\tilde{b}^2\left(\frac{v_i}{v_\star}\right)^4}\;. \end{equation} with semi-major axis $a_h$ such that: \begin{equation} \left(\frac{a}{R_\star}\right)^2 = \left(\frac{v_\star}{v_i}\right)^4\;. \end{equation} For the ellipsoid motion ($r_{\rm II }$), as recall in the main text, the eccentricity is given by: \begin{equation} \varepsilon=\sqrt{1-\left(\frac{\alpha_-}{\alpha_+}\right)^2}\;, \end{equation} with the semi-major and semi-minor axis $\alpha_\pm$ such that, \begin{equation} \tilde{\alpha}_\pm\equiv \frac{\alpha_\pm}{R_\star}= \sqrt{{\cal V}} \left(1 \pm \sqrt{1 -\left(\frac{v_i \tilde{b}}{v_\star {\cal V}}\right)^2}\right)\,, \end{equation} where ${\cal V}=3/2+v_i^2/(2 v_\star^2)\simeq 3/2$. Concerning the angles of the problem, while $\psi_0$ is commonly defined as: \begin{equation} \psi_0 = \arccos[-1/e]\;, \end{equation} the other angles are obtained requiring the continuity of the trajectory: \begin{align} [r_{\rm I}(\phi_0)=R] \Rightarrow \phi_0 &= \psi_0 - \arccos\left[\frac{1}{e} \left(\tilde{b}\sqrt{e^2 - 1} - 1\right)\right] \\ [r_{\rm II}(\phi_0)=R] \Rightarrow \psi_1 &= \phi_0 - \arccos\left[\frac{1}{\varepsilon} \sqrt{1 - \tilde{\alpha}_-^2}\right]\;, \end{align} and by symmetries, \begin{align} \phi_1 &= \pi - \phi_0 + 2\psi_1 \, \\ \psi_2 &= 2\psi_1 - \psi_0 + \pi\;. \end{align} The time evolution $\tau=t(\phi)/T_\star$ can also be split in the same $\phi$ intervals such that, \begin{equation} \tau(\phi)= \begin{cases} \tau_{\rm \tiny I}(\phi), &\phi\leqslant\phi_0\\[10pt] \tau_{\rm \tiny II}(\phi), &\phi_0<\phi<\phi_1\\[10pt] \tau_{\rm \tiny III}(\phi), &\phi_1\leqslant\phi\;,\\ \end{cases} \end{equation} with the recursive definitions, \begin{align} \tau_{\rm \tiny I}(\phi) &= {\cal T}_{\rm \tiny out}(\phi - \psi_0)-{\cal T}_{\rm \tiny out}(\phi_0 - \psi_0)\\ \tau_{\rm \tiny II}(\phi) &= {\cal T}_{\rm \tiny in}(\phi-\psi_1)-{\cal T}_{\rm \tiny in}(\phi_0-\psi_1)+\tau_{\rm \tiny I}(\phi_0)\\ \tau_{\rm \tiny III}(\phi) &= {\cal T}_{\rm \tiny out}(\phi - \psi_2)-{\cal T}_{\rm \tiny out}(\phi_1 - \psi_2) + \tau_{\rm \tiny II}(\phi_1)\;, \end{align} where we have introduced the functions: \begin{align} {\cal T}_{\rm \tiny out}(u)= \frac{\tilde{b}}{2 \pi}\frac{v_\star}{v_i}\, &\Bigg(\;\frac{e\,\sin u}{1 + e\,\cos u} \\ &- \frac{2}{\sqrt{e^2 -1}} \tanh^{-1}\left[\sqrt{\frac{e - 1}{e + 1}} \tan{\frac{u}{2}}\right]\Bigg)\;, \end{align} and, \begin{equation} {\cal T}_{\rm \tiny in}(u)= \; \frac{\alpha_-^2}{2\pi\,b\,R_\star}\frac{v_\star}{v_i}\frac{1}{\sqrt{1-\varepsilon^2}} \tan^{-1}\left[\frac{1}{\sqrt{1-\varepsilon^2}} \tan{u}\right]\;.\\ \end{equation} \subsection{Gravitational wave emission}\label{app:GW} The function used to compute the GW strain $h_0$ Eq.~(\ref{eq:gw_general}) is a piecewise function depending on the regime of the motion: \begin{equation} g(\phi)= \begin{cases} g_{\rm \tiny out}(\phi-\psi_0), &\phi\leqslant\phi_0\\[10pt] g_{\rm \tiny in}(\phi-\psi_1), &\phi_0<\phi<\phi_1\\[10pt] g_{\rm \tiny out}(\phi-\psi_2), &\phi_1\leqslant\phi\;,\\ \end{cases} \end{equation} with, \begin{equation} \begin{aligned} g_{\rm \tiny out}(\phi)&= \frac{\sqrt{2}}{3}\frac{1}{e^2-1}\left[36+59 \,e^2+10 \,e^4 \right.\\ & \left. +(108 + 47 \,e^2)\,e\cos{\phi}+59\,e^2\cos{2\phi}+9\,e^3\cos{3\phi}\right]^{1/2} \end{aligned} \end{equation} and, \begin{equation} \begin{aligned} g_{\rm \tiny in}(\phi)= & \frac{{2}}{3}\left(\frac{b}{\alpha_-}\right)^2 \big[ 38\,(1-\varepsilon^2) +5\,\varepsilon^4 \\ & +80 (1-\varepsilon^2)^2 \left(2-\varepsilon^2(1+\cos{ 2\phi} \right)^{-2} \\ & +40 (2-3\,\varepsilon^2 + \varepsilon^4)\left(2-\varepsilon^2(1+\cos{2\phi})\right)^{-1} \big]^{1/2}\;. \label{eq:gwin} \end{aligned} \end{equation} The power radiated in gravitational waves can be computed from \cite{1918SPAW.......154E}, as: \begin{equation} P_{\rm gw}=\frac{d E_{\rm gw}}{dt}=-\frac{G}{5 c^5}\langle \dddot Q_{ij} \dddot Q^{ij} \rangle \end{equation} We define the differential energy radiated by unit angle $p^\phi_{\rm gw}$ as: \begin{equation} p^\phi_{\rm gw}=\;\frac{d E_{\rm gw}}{d\phi} \;=\frac{1}{\dot \phi}\;P_{\rm gw}\;. \end{equation} We compute this quantity for the PBH travelling in or out of the star: \begin{equation} p^\phi_{\rm gw}(\phi,\tilde b)= \frac{2}{45} E_i \frac{v_\star^2 v_i^3}{c^5 } \frac{m}{M_\star} \begin{cases} f_{\rm \tiny out}(\phi-\psi_0), &\phi\leqslant\phi_0\\[10pt] f_{\rm \tiny in}(\phi-\psi_1), &\phi_0<\phi<\phi_1\\[10pt] f_{\rm \tiny out}(\phi-\psi_2), &\phi_1\leqslant\phi\;,\\ \end{cases} \end{equation} with, \begin{align} f_{\rm out} (\phi, \tilde b)= \frac{2}{\tilde b}\frac{(1 + e \cos\phi )^2}{(e^2 -1)^3} &(\,144 + 288 \,e\, \cos\phi \nonumber \\ & + 77 \,e^2 + 67\, e^2 \cos 2 \phi\, ) \;, \end{align} and, \begin{align} f_{\rm in} (\phi, \tilde b)= 4 \frac{\tilde b^5}{\tilde{\alpha}_-^6}& \frac{(1 - \varepsilon^2)^2}{(1 - \varepsilon^2\cos^2 \phi)^3} (\,72\,(1- \varepsilon^2) + 37 \,\varepsilon^4 \nonumber \\ & + 36\, \varepsilon^2\, (\varepsilon^2-2 ) \,\cos 2\phi - \varepsilon^4 \cos 4 \phi \,)\;. \end{align} From these expressions on can compute the gravitational energy radiated outside the NS, \begin{equation} |\Delta E|_{\rm gw}^{\rm out} (\tilde b) = \int^{\phi_0}_0 p^\phi_{\rm gw}(\phi,\tilde b) \, d\phi +\int_{\phi_1}^{\phi_{dev}} p^\phi_{\rm gw}(\phi,\tilde b) \, d\phi\;, \end{equation} with $\phi_{dev}=2\psi_1$ the total deflection angle, and inside the NS, \begin{equation} |\Delta E|_{\rm gw}^{\rm in} (\tilde b) =\int^{\phi_1}_{\phi_0} p^\phi_{\rm gw}(\phi,\tilde b) \, d\phi\;. \end{equation} \end{appendix} \bibliographystyle{apsrev4-1}
\section{Introduction} It is a corollary of a renowned theorem of Scott \cite{Scott} that every closed curve on a hyperbolic surface $S$ lifts to a simple closed curve on some finite cover of $S$. This result was made effective by Patel \cite{Patel}, and more work has been done since then to improve the bound on the degree of the required cover, as well as to study the connection between this degree and the self intersection number of the curve (see Gupta--Kapovich \cite{Gupta}, Gaster \cite{Gaster}, and Aougab--Gaster--Patel--Sapir \cite{GAPS}). In the spirit of this work, it is natural to ask the following question, which motivates the main result of this paper. \begin{question} \label{simple-lifting} What information about $p: X \to S$ and $q: Y \to S$ can be derived from understanding how curves on $S$ \emph{lift simply} to $X$ and $Y$? \end{question} Our first result addresses this question in the setting of regular finite covers of a closed surface $S$ with genus at least $2$. In particular, we characterize when two regular finite covers are equivalent in terms of which closed curves have simple elevations, where an {\it elevation} of a closed curve $\alpha \subset S$ along a covering map $f: \Sigma \to S$ is a closed curve on $\Sigma$ that projects to $\alpha$ under $f$. \begin{theorem} \label{thm:regular} If $p:X \to S$ and $q: Y \to S$ are two regular covers so that given any closed curve $\gamma \subset S$, there exists simple elevations of $\gamma$ to $X$ if and only if there exists simple elevations of $\gamma$ to $Y$, then $p$ and $q$ are equivalent covers. \end{theorem} We prove a generalization of Theorem~\ref{thm:regular} to non-simple curves, which is stated precisely at the end of Section \ref{motivation} (see Theorem~\ref{thm:nonsimple}). Another variation of Question \ref{simple-lifting} would be to consider lifts of simple curves rather than curves that lift simply. This leads us to ask the following. \begin{question} \label{lifts-of-simple} What information about $p:X \to S$ and $q:Y \to S$ can be derived from understanding how \emph{simple} curves on $S$ lift to $X$ and $Y$? \end{question} Our second result answers this question in the setting of abelian covers. Given a cover $f: \Sigma \to S$ and a simple closed curve $ \gamma \subset S $, we let $n_f(\gamma)$ denote the minimum positive integer $k$ such that $\gamma$ admits an elevation of degree $k$ along $f$. \begin{theorem} \label{thm:abelian} Let $p: X\to S$ and $q: Y \to S$ be finite-degree abelian covers of $S$. If $n_p(\gamma) = n_q(\gamma)$ for all simple closed curves $\gamma \subset S$, then $p$ and $q$ are equivalent covers. \end{theorem} \subsection{Motivation, Sunada's construction, and non-simple curves} \label{motivation} The authors arrived at Theorems \ref{thm:regular} and \ref{thm:abelian} while studying \textit{isospectral} hyperbolic surfaces: hyperbolic surfaces that have the same unmarked length spectra but which are not necessarily isometric. Almost all known examples of isospectral pairs come from a construction (or some variant thereof) due to Sunada \cite{Sunada} which we briefly summarize here. See \cite{Buser} for a more in depth introduction. Let $G$ be a finite group containing a pair of \textit{almost conjugate} subgroups $H, K$, meaning that the cardinality of the intersection of $ H $ with any conjugacy class $ [ g ] $ in $ G $ agrees with that of $ K $: \[ |H \cap [g]| = |K \cap [g]|. \] Let $S$ be an orientable surface of finite type so that $\pi_1(S)$ admits a surjective homomorphism $\rho: \pi_1(S) \rightarrow G$. Then if one equips $S$ with a hyperbolic metric, the pullbacks of that metric to the covers corresponding to the subgroups $\rho^{-1}(K), \rho^{-1}(H) < \pi_1(S)$ will be isospectral. So long as $H,K$ are not conjugate in $G$, for a generic choice of the initial metric, these hyperbolic surfaces will not be isometric. An interesting open question is whether or not there exist non-isometric surfaces which are \textit{simple length isospectral}, meaning that the multi-set of lengths corresponding only to simple closed geodesics coincide. Sunada's construction provides a natural way to test this question. Indeed, letting $S_H$ and $S_K$ denote the isospectral covers associated to $\rho^{-1}(H)$ and $ \rho^{-1}(K)$ as above, Sunada's construction yields a length-preserving bijection $\phi$ between the sets of closed geodesics on $S_H$ and $S_K$. If for any such $S_H $ and $ S_K$ where $H$ and $K$ are not conjugate, $\phi$ happens to send the lengths corresponding to \textit{simple} closed geodesics on one surface to the simple closed geodesics on the other, one immediately obtains an answer to the question: such an example would imply that simple length isospectrality need not imply an isometry. Along these lines, Maungchang \cite{Maungchang} explored the example $ G= (\mathbb{Z}/8\mathbb{Z})^{\times} \ltimes \mathbb{Z}/8\mathbb{Z} $, where the semi-direct product is with respect to the standard action of the group of multiplicative units, and where \begin{align*} H & = \{(1,0), (3,0), (5,0), (7,0)\}, & K &= \{(1,0), (3,4), (5,4), (7,0)\} \end{align*} Letting $S$ be the closed surface of genus $2$ and $ \pi_1(S) = \langle a,b,c,d \mid [a,b][c,d] =1 \rangle $ be the standard presentation of its fundamental group, one obtains the homomorphism $\rho: \pi_1(S) \rightarrow G$ defined by \begin{align*} \rho ( a ) & = ( 3 , 0 ) & \rho ( b ) & = ( 5 , 0 ) & \rho ( c ) & = ( 1 , 0 ) & \rho ( d ) & = ( 1 , 1 ) \end{align*} Then Maungchang directly demonstrates that for a generic choice of initial metric on the genus $2$ surface, the hyperbolic surfaces $S_H, S_K$ are \textit{not} simple length isospectral. His strategy is as follows: \begin{enumerate} \item Exhibit a closed curve $\gamma$ on $S$ that admits a different number of simple elevations to $S_H$ than it does to $S_K$. The length-preserving bijection $\phi$ coming from Sunada's construction has the property that for any closed curve on $S$, $\phi$ relates its set of elevations on $S_H$ to those on $S_K$. Thus, the existence of $\gamma$ implies that if $S_H$ and $S_K$ are simple length isospectral, then any length-preserving bijection between the sets of simple closed geodesics is not induced by $\phi$. \item A bound on the degree of the covering spaces precludes all but finitely many curves on $S$ from having simple elevations that could possibly make up for the discrepancy coming from simple elevations of $\gamma$ established by (1). By checking these finitely many possibilities and verifying for a fixed hyperbolic metric that the lengths do not make up for this discrepancy, Maungchang obtains the desired result by appealing to real-analyticity of length functions over Teichm{\"u}ller space (if lengths disagree on one metric, they disagree for almost all metrics). \end{enumerate} The authors conjecture that simple length isospectrality implies isometry for hyperbolic surfaces: \begin{conjecture} \label{conj:simple} Hyperbolic surfaces with the same multi-set of simple lengths are isometric. \end{conjecture} A reasonable approach to Conjecture \ref{conj:simple} would be to first establish it for pairs of isospectral surfaces arising from Sunada's construction, since these pairs are natural candidates for counterexamples. One could hope that Maungchang's strategy outlined above is generalizable to any pair of isospectral surfaces arising from Sunada's construction. A first step towards achieving such a generalization would be to address step $(1)$ above, and to show that if two covers of a surface are not equivalent, there is some closed curve $\gamma$ on the base surface admitting a different number of simple elevations to the two covers. In the setting where the covers are regular, if one elevation is simple, all must be. This motivates Theorem \ref{thm:regular}, since ``admitting a different number of simple elevations to the two covers" reduces to ``admitting a simple elevation to one cover but not the other". Unfortunately, the covering spaces that arise in Sunada's construction are necessarily never regular, as almost conjugate subgroups must be conjugate (and in fact, equal) when one is normal. The authors conjecture that the assumption of regularity can be dropped in Theorem \ref{thm:regular}. \begin{conjecture} \label{conj:notregular} Theorem \ref{thm:regular} holds without the assumption that the covers are regular. \end{conjecture} While it is not yet clear how our arguments can be promoted to prove Conjecture \ref{conj:notregular}, we note that they can be used to show the following generalization of Theorem \ref{thm:regular}: \begin{theorem} \label{thm:nonsimple} Let $N, M \in \mathbb{N}$ and let $p:X \rightarrow S, q:Y \rightarrow S$ be regular finite covers of a closed orientable surface $S$ with genus at least $2$. Suppose that for any essential closed curve $\gamma \subset S$, $\gamma$ admits an elevation to $X$ with at most $N$ self intersections if and only if it admits an elevation to $Y$ with at most $M$ self intersections. Then $p$ and $q$ are equivalent covers. \end{theorem} \subsection*{Acknowledgment} Aougab is supported by NSF grant DMS 1807319. Loving is supported by an NSF Postdoctoral Research Fellowship under Grant No. DMS 1902729. \section{Preliminaries} We devote this section to recalling concepts and results that are used in the proof of Theorem~\ref{thm:regular}. \subsection{Hyperbolic spaces and Gromov boundaries} \label{hyp} Let $(X,d)$ be a (not necessarily proper) geodesic metric space. Then for some $\delta>0$, $X$ is said to be $\delta$-\textit{hyperbolic} if for any geodesic triangle in $X$, the $\delta$-neighborhood of the union of any two sides contains the third side. Any $\delta$-hyperbolic space admits a \textit{Gromov boundary}, $\partial_{\infty}X$, generalizing the boundary sphere at infinity of hyperbolic space. To define $\partial_{\infty}X$, one first fixes a basepoint $p \in X$; then given two points $x,y \in X $, their \textit{Gromov product} with respect to $p$ is \[ ( x , y )_{ p } = \frac{ d ( x , p ) + d ( y , p ) - d ( x , y ) }{ 2 } . \] A sequence of points ${x_i} \subset X$ is said to be \textit{admissible} if $ \lim_{ i , j \to \infty }{ ( x_{ i } , x_{ j } )_{ p } } = \infty $, and two admissible sequences ${x_i}, {y_i}$ are said to be equivalent if $\lim_{i \rightarrow \infty}(x_i, y_i)_p = \infty.$ Then as a set, $\partial_{\infty}X$ is the set of equivalence classes of admissible sequences. Given $K>0$ and $b \in \partial_{\infty}X$, define \[ U_{ K } ( b ) = \left \{ \left[ \left( x_{ i } \right) \right] \in \partial_{ \infty } X \:\middle |\: \liminf_{ i , j \to \infty }{ \left( x_{ i } , y_{ j } \right )_{ p } } \geq K \textrm{ for some } \left( y_{ j } \right ) \in b \right \} . \] These subsets form a basis for a topology on $\partial_{\infty}X$ with respect to which isometries of $X$ induce homeomorphisms. Moreover, a quasi-isometric embedding $\varphi: X \to Y$ between two $\delta$-hyperbolic spaces induces a continuous embedding $\widehat{\varphi}: \partial X \to \partial Y$. We briefly describe the map $\widehat{\varphi}$. Given a point $z \in \partial X$, choose a geodesic ray $\gamma \subset X$ whose endpoint on $\partial X$ is $z$ (which is to say that any unbounded sequence of points along $\gamma$ is in the class of $z$). Then the image of $\gamma$ under $\varphi$ is a quasi-geodesic ray $\gamma'$ in $Y,$ which implies that any unbounded sequence of points along $\gamma'$ is admissible and that therefore $\gamma'$ is naturally associated to some point in $\partial Y$ which we call $z'$. The map $\widehat \varphi$ sends $z$ to $z'$. It is straightforward to show that $\widehat \varphi$ is well-defined. \subsection{Teichm{\"u}ller space and geodesic laminations} Let $S$ be a connected surface with negative Euler characteristic. The \textit{Teichm\"uller space} of $S$, denoted $\mathcal T(S)$, can be defined as the space of equivalence classes of marked hyperbolic structures on $S$, where two hyperbolic structures $f:S \to X$ and $g:S \to Y$ are said to be equivalent if $f \circ g^{-1}$ is isotopic to an isometry. An equivalent characterization of $\mathcal T(S)$ is as the space of $\text{PGL}(2, \mathbb R)$ conjugacy classes of discrete faithful representations of $\pi_1(S)$ into $\text{PSL}(2, \mathbb R)$. We will make use of both of these perspectives throughout Section \ref{section:regular}. Abusing notation slightly, let $S$ now be a complete hyperbolic surface of finite type and without boundary. A \textit{geodesic lamination} of $S$ is a compact subset of $S$ consisting of a disjoint union of simple geodesics. A geodesic lamination $\lambda$ is said to be \textit{minimal} if every leaf is dense in $\lambda$, and \textit{filling} if it intersects every simple closed geodesic. Laminations with both of these properties are called \textit{ending laminations}. A \textit{measured geodesic lamination} is a geodesic lamination $\lambda$ equipped with a positive Borel measure $\mu$ on the set of arcs transverse to $\lambda$, which is invariant under transverse homotopy. The set of all measured geodesic laminations, denoted $\mathcal{ML}(S)$, admits a natural topology for which two points are close together if they induce approximately the same measure on sets of finitely many transverse arcs. This topology does not depend on the initial choice of hyperbolic metric and thus we can associate $\mathcal{ML}(S)$ to the underlying topological surface. Two measured geodesic laminations are \textit{projectively equivalent} if they have the same underlying geodesic lamination and the transverse measures differ only by a scaling. Thurston showed that the space of projective measured laminations, denoted $\mathcal{PML}(S)$ (equipped with the quotient topology) yields a compactification of $\mathcal{T}(S)$ and is homeomorphic to a sphere of dimension $\mbox{dim}(\mathcal{T}(S))-1$. By $\mathcal{PMEL}(S)$, we will mean the subset of $\mathcal{PML}(S)$ consisting of points whose underlying lamination is ending, and we will denote by $\mathcal{EL}(S)$ the image of $\mathcal{PMEL}(S)$ under the quotient map sending a projective measured lamination to its underlying geodesic lamination. A geodesic lamination $\lambda$ is called \textit{uniquely ergodic} if there is only one projective equivalence class of transverse measures it supports. We conclude this subsection with several useful results about $\mathcal{T}(S), \mathcal{ML}(S)$, and their behaviors under covering maps between surfaces. The first such result can be applied to show that the set of uniquely ergodic ending laminations are dense in the space of measured laminations. \begin{theorem}[Lindenstrauss-Mirzakhani, Theorem $1.2$ in \cite{LM}] \label{LM-thick} A measured lamination $\lambda\in \mathcal{ML}(S)$ has a dense orbit in $\mathcal{ML}(S)$ if and only if its support does not contain any simple closed curves. \end{theorem} The next result states that covering maps induce isometric embeddings between Teichm\"uller spaces. A proof of Theorem \ref{thm:folklore} can be found on page 2153 of \cite{RafiSchleimer-covers}. \begin{theorem}[Folklore] \label{thm:folklore} A finite covering map $p: X \to S$ induces an isometric embedding $\widetilde{p}: \mathcal{T}(S) \to \mathcal T(X)$. \end{theorem} Building on Theorem \ref{thm:folklore}, the following result of Biswas--Mj--Nag allows for the extension of any map between Teichm\"uller spaces induced by a finite cover to a map between spaces of projective measured laminations, interpreted as boundaries at infinity $\partial \mathcal{T}(S)$ of the corresponding Teichm\"uller spaces. In particular, given a finite covering map $p: X \to S$ there is a natural map $\partial \mathcal{T}(S) \to \partial \mathcal T(X)$. \begin{theorem}[Biswas--Mj--Nag, \cite{Mj}] \label{thm:Mj} A finite covering map $p: X \to S$ between closed, oriented hyperbolic surfaces induces a natural continuous injection $\widetilde{p}: \overline{\mathcal{T}(S)} \to \overline{\mathcal{T}(X)}$ between the corresponding Thurston compactified Teichm\"uller spaces. Furthermore, this map is the continuous extension of the holomorphic embedding from $\mathcal T(S) \to \mathcal T(X)$ induced by $p$. \end{theorem} A consequence of Theorem \ref{thm:Mj} is that $\widetilde p$ is defined on $\partial \mathcal{T}(S)$ as follows: given a measured geodesic lamination $\lambda$ on $S$ its image under $\widetilde p$ is simply the measured geodesic lamination $p^{-1}(\lambda)$ on $X$ obtained as the inverse image of $\lambda$ under $p$. There is a Finsler metric on $\mathcal{T}(S)$, called the \textit{Teichm\"uller metric}, in which the distance between two points is the logarithm of the infimal dilatation of quasiconformal homeomorphisms from one marked surface to the other, taken over all such homeomorphisms isotopic to the identity. A result of Masur demonstrates the abundance of geodesic rays in the Teichm\"uller metric with endpoints on $\partial \mathcal{T}(S)$. \begin{theorem}[Masur, \cite{Masur1982}] \label{MasurBoundary} At every point $x \in \mathcal T(S)$ and in almost every direction, a Teichm\"uller geodesic ray based at $x$ has a limit on the Thurston boundary of $\mathcal T(S)$. \end{theorem} \subsection{The Complex of Curves} Given an orientable surface $S$ with negative Euler characteristic, the \textit{curve complex}, $\mathcal C(S)$, is a flag simplicial complex whose vertices correspond to isotopy classes of essential simple closed curves and whose edges represent pairs of such classes that can be realized disjointly on $S$. By identifying each simplex with a standard simplex with unit length edges in the appropriate Euclidean space, $\mathcal{C}(S)$ becomes a metric space. A germinal result of Masur--Minsky \cite{MasurMinskyHyperbolic} states that the curve complex is $\delta$-hyperbolic. It follows that $\mathcal{C}(S)$ admits a Gromov boundary, which was characterized by Klarreich, as follows. Define $\mbox{sys}: \mathcal{T}(S) \rightarrow \mathcal{C}(S)$ by sending $X \in \mathcal{T}(S)$ to its \textit{systole}, the simple closed curve admitting the shortest geodesic representative on $X$. \begin{remark} \label{coarse} Note that $\mbox{sys}$ is technically not well-defined since the systole need not be unique. However, if two simple closed geodesics are simultaneously shortest, they can intersect at most once. It follows that the set of systoles for any $X \in \mathcal{T}(S)$ represents a subset of $\mathcal{C}(S)$ with diameter at most $2$. Thus, $\mbox{sys}$ is said to be \emph{coarsely well-defined}. \end{remark} Klarreich shows that $\mbox{sys}$ induces a map between $\mathcal{PMEL}(S)$ and $\partial_{\infty}\mathcal{C}(S)$ which allows for a characterization of the latter in terms of the former: \begin{theorem}[Klarreich, \cite{Klarreich}] \label{thm:ending-laminations} The map $\mbox{sys}$ extends to a continuous map \[ \mbox{sys}_{\ast}: \mathcal{PMEL}(S) \rightarrow \partial_{\infty}\mathcal{C}(S), \] factoring through the quotient map between $\mathcal{PMEL}(S)$ and $\mathcal{EL}(S)$, and inducing a homeomorphism between $\mathcal{EL}(S)$ and $\partial_{\infty}\mathcal{C}(S)$. \end{theorem} We will need the following two important results regarding the coarse geometry of the curve complex. The first result gives a relation between the curve complex of a surface $S$ and the curve complex of a regular cover $\Sigma$ of $S$. \begin{theorem}[Rafi--Schleimer, \cite{RafiSchleimer-covers}] \label{thm:RS-curvecomplex} Let $P: \Sigma \to S$ be a covering map and $\Pi: \mathcal C(S) \to \mathcal C(\Sigma)$ be the covering relation where $b \in \mathcal C(S)$ is related to $\beta \in \mathcal C(\Sigma)$, if $P(\beta) = b$. The map $\Pi: \mathcal C(S) \to \mathcal C(\Sigma)$ is a $Q$-quasi-isometric embedding, with $Q$ depending only on the topology of $ S $ and the degree of $ P $. \end{theorem} Note that $\Pi$ is not well-defined since the pre-image of a simple closed curve may very well be a multi-curve, but it is coarsely well-defined. The second result establishes the relationship between the topology of two surfaces based on the coarse geometry of their respective curve complexes. \begin{theorem}[Rafi-Schleimer, \cite{RafiSchleimer-rigid}] \label{thm:RS-quasi} Let $S$ and $\Sigma$ be orientable, connected, compact surfaces of genus at least $2$. A quasi-isometry $ \Psi \colon \mathcal C ( S ) \to \mathcal C ( \Sigma ) $ is induced by a homeomorphism $\psi: S \to \Sigma$. \end{theorem} \section{Regular Covers and Simple Curves} \label{section:regular} Throughout this section, fix finite regular covers $p: X \to S$ and $q: Y \to S$ of $S$. The only place in the proof of Theorem \ref{thm:regular} where we will invoke the regularity of $p$ and $q$ is in establishing the following lemma. \begin{lemma} \label{lemma:qi-curve-cx} Suppose that for any closed curve $\gamma \subset S$, there exists a simple elevation of $\gamma$ to $X$ if and only if there exists a simple elevation of $\gamma$ to $Y$. Then $ \mathcal{ C } ( X ) $ and $ \mathcal{ C } ( Y ) $ are quasi-isometric, and hence $ X $ and $ Y $ are homeomorphic. \end{lemma} \begin{proof} Let $W$ be the regular cover of $X, Y,$ and $S$ that corresponds to $\pi_1(X) \cap \pi_1(Y) \subset \pi_1(S)$. This gives a diamond of regular covers of $S$, which is shown on the left of Figure \ref{fig:diamond}. In particular, we have $\pi = p\circ p' = q \circ q'$. We will use $W$ to define a quasi-isometry from $\mathcal C (X)$ to $\mathcal C (Y)$. Let $\alpha_{X} \subset X$ be an essential simple closed curve and let $A_W$ be the multi-curve consisting of all elevations of $\alpha_{X}$ to $W$. Now consider the image $ A_{ Y } := q' ( A_W ) $ of $A_W$ on $Y$ under the regular cover $q': W \to Y$ shown in Figure \ref{fig:diamond}. We claim that $ A_{ Y } $ is a union of simple closed curves on $Y$. To see this, let $\alpha_Y = q'(\alpha_W)$ for some simple closed curve $\alpha_W \subset A_W$. Let $\alpha_S \subset S$ denote the projection of $\alpha_W$ to $S$ under the regular cover $\pi: W \to S$. By the assumptions, \[ p(\alpha_{X}) = p \left( p'(\alpha_W ) \right) =\pi(\alpha_W) = \alpha_{ S } = \pi ( \alpha_{W } ) = q \left ( q' ( \alpha_{ W } ) \right ) = q ( \alpha_{Y } ) . \] Hence $ \alpha_{ X } $ and $ \alpha_{ Y } $ are elevations of $ \alpha_{ S } $. Since $ \alpha_{ X } $ is simple, our assumptions imply that $ \alpha_{ S } $ has some simple elevation to $ Y $. Since $ q \colon Y \to S $ is regular, this implies that all elevations of $ \alpha_{ S } $ to $ Y $ are simple, and so $ \alpha_{ Y } $ is simple.\footnote{Notice our use of the regularity of $q$.} It follows that $ A_{ Y } $ is a union of simple closed curves, though not necessarily pairwise disjoint ones. We next claim that the curves in $A_Y$ constitute a bounded diameter subset of $\mathcal C(Y)$, with the bound depending only on the covering maps $p,q$ and not on $\alpha_{X}$. Consider the elevations $\Gamma$ of all curves in $A_{ Y }$ to $W$, which contains $A_{ W } $. Note that $\Gamma$ is the union of all multicurves $\widetilde{\gamma}$ that arise as the set of elevations of some $\gamma \in A_{ Y } $. Moreover, $\widetilde{\gamma}\cap \alpha_W \neq \emptyset$ for any $\gamma \in A_{ Y } $. Using this fact we argue that $\Gamma$ has diameter at most $3$ in $\mathcal{C} (W)$: given any two distinct simple closed curves $\beta_1, \beta_2 \in \Gamma$, they each belong to some multicurve $\widetilde{\gamma_i}$ coming from the elevations of $\gamma_i \in A_{ Y }$, where $i=1, 2$. If $\widetilde{\gamma_1}= \widetilde{\gamma_2}$, then $\beta_1$ and $\beta_2$ are distance $1$ apart. Otherwise, there exists $\alpha_i\in \widetilde{\gamma_i}\cap \alpha_W$ for $i=1,2$ such that $\{\beta_1, \alpha_1, \alpha_2, \beta_2\}$ is a path of length at most $3$ in $\mathcal{C} (W)$. By Theorem \ref{thm:RS-curvecomplex}, $\Pi:\mathcal C(Y) \to \mathcal C(W)$ is a quasi-isometric embedding. Since $\Pi(A_Y) = \Gamma$, the curves in $A_{ Y }$ give a bounded diameter subset of $\mathcal C(Y)$. Thus the assignment $\alpha_{X} \mapsto A_{ Y } $ gives a coarsely well-defined map $\Psi: \mathcal C(X) \to \mathcal C(Y)$. In fact, $\Psi$ is coarsely Lipschitz by the same argument: given two disjoint simple closed curves on $X$, the union of their pre-images will be a multi-curve on $W$. By symmetry, there exists a coarsely well-defined Lipschitz map $\Phi: \mathcal C(Y) \to \mathcal C(X)$. We now show that $\Phi$ is a coarse inverse to $\Psi$. It is clear that $\Phi(\Psi(\alpha_{ X })) = \Phi(A_{ Y })$. Letting $A_{YW}$ denote the full pre-image of $A_Y$ under $q'$, we have that $ \Phi(\Psi(\alpha_{ X })) = p'(A_{ Y W } ) $. Since $\Psi(\alpha_{ X })= A_{ Y } $ has bounded diameter in $\mathcal{C}(Y)$ (bounded independently of $\alpha_{ X }$) and $\Phi$ is coarsely Lipschitz, then $p'(A_{ Y W })$ has bounded diameter (also independent of $\alpha_{ X }$) in $\mathcal{C}(X)$, and it contains $\alpha_{ X }$. It follows that $\Phi \circ \Psi$ is quasi-isometric to the identity on $\mathcal{C}(X)$, and a completely analogous argument proves the same for $\Psi \circ \Phi$ on $\mathcal{C}(Y)$. Thus, $\mathcal C(X)$ and $\mathcal C(Y)$ are quasi-isometric and by Theorem \ref{thm:RS-quasi}, $X$ and $Y$ are homeomorphic. \end{proof} Note that Theorem \ref{thm:RS-curvecomplex} gives us quasi-isometric embeddings of $\mathcal C(S)$ into both $\mathcal C(X)$ and $\mathcal C(Y)$. Thus, we have two different quasi-isometric embeddings of $\mathcal C(S)$ into $\mathcal C(Y)$. The first comes directly from Theorem \ref{thm:RS-curvecomplex} and we will call it $q^{*}: \mathcal C(S) \to \mathcal C(Y)$. The second comes from the composition of the quasi-isometry $\mathcal C(X) \to \mathcal C(Y)$ constructed in Lemma \ref{lemma:qi-curve-cx} with the quasi-isometric embedding $\mathcal C(S) \to \mathcal C(X)$ from Theorem \ref{thm:RS-curvecomplex}, and we will call it $g^{*}: \mathcal C(S) \to \mathcal C(Y)$. \begin{lemma}\label{BoundaryCurveComplex} The quasi-isometric embeddings $q^{*}, g^{*}: \mathcal C(S) \to \mathcal C(Y)$ induce the same map on $\partial \mathcal C(S) \to \partial \mathcal C(Y)$.\end{lemma} \begin{proof} It suffices to show that $q^{*}$ and $g^{*}$ are within bounded distance of each other; the lemma will then follow by the basic properties of hyperbolicity and Gromov boundaries outlined in Section \ref{hyp}. Let $\alpha \in \mathcal C(S)$ and let $A_{X}, A_Y,$ and $A_W$ be the collections of elevations of $\alpha$ to $X$, $Y$, and $W$, respectively (note that $A_{Y}$ is defined slightly differently here than in Lemma \ref{lemma:qi-curve-cx}). We will show that $q^{*}(\alpha)$ and $g^{*}(\alpha)$ are contained in $A_Y$. Recall from Theorem \ref{thm:RS-curvecomplex} that $q^{*}(\alpha) \in A_Y$ by definition. Let $p^{*}:\mathcal C(S) \to \mathcal C(X)$ be the map induced by $p: X \to S$ given by Theorem \ref{thm:RS-curvecomplex}. Then $g^{*}:\mathcal C(S) \to \mathcal C(Y) $ is the composition of $p^{*}$ with the map $\Psi: \mathcal C(X) \to \mathcal C(Y)$ from the proof of Lemma \ref{lemma:qi-curve-cx}. Note that the elevations of $A_{X}$ (resp. $A_Y$) to $W$ under the cover $W \to X$ (resp. $W \to Y$) is exactly $A_W$. Since $\Psi: \mathcal C(X) \to \mathcal C(Y)$ factors through $\mathcal C(W)$ in its definition, we have $\Psi(A_{X}) = A_{ Y }$. It follows that $g^{*}(\alpha) = \Psi(p^{*}(\alpha))\in \Psi(A_{X}) = A_Y$. Since $A_Y$ is a diameter one subset of $\mathcal C(Y)$, the claim follows immediately. \end{proof} \begin{figure} \begin{tikzcd}[column sep={6em,between origins}, row sep=huge] & W \arrow [dl, "p'", swap] \arrow[dr, "q'"] \arrow[dd, "\pi"] & \\ X \arrow[dr, "p", swap] & & Y \arrow[dl, "q"] \\ & S & \end{tikzcd} \qquad \begin{tikzcd}[column sep={6em,between origins}, row sep=huge] & \mathcal C(S) \arrow[dl, "p^{*}", swap] \arrow[dr, "q^{*}"] & \\ \mathcal C(X) \arrow[dr] \arrow[rr, "\Psi"] & & \mathcal C(Y) \arrow[dl] \\ & \mathcal C(W) & \end{tikzcd} \caption{} \label{fig:diamond} \end{figure} With Lemmas \ref{lemma:qi-curve-cx} and \ref{BoundaryCurveComplex} in hand, we are now ready to prove Theorem \ref{thm:regular}, which we restate here for convenience. \vspace{2 mm} \noindent \textbf{Theorem \ref{thm:regular}. }\textit{If $p: X \to S$ and $q: Y \to S$ are two regular covers so that given any closed curve $\gamma \subset S$, there exists simple elevations of $\gamma$ to $X$ if and only if there exists simple elevations of $\gamma$ to $Y$, then $p$ and $q$ are equivalent covers.} \vspace{2 mm} Before beginning the proof, we will give a brief overview of our strategy. First we show that the map on $\partial \mathcal{C}(S)$ induced by the quasi-isometric embeddings $q^{*}, g^{*}$ commutes with the maps on $\partial \mathcal T(S)$ induced by the isometric embeddings $\tilde{q}, \tilde{g}$ coming from Theorem \ref{thm:folklore}, with respect to the natural projection from $\mathcal{PMEL}(S)$ to $\partial \mathcal{C}(S)$. We then show that $\widetilde q$ and $\widetilde g$ agree on $\partial \mathcal T(S)$, which allows us to argue that $\widetilde{q}, \widetilde g$ agree on $\mathcal T(S)$ setwise. Finally, we leverage the description of $\mathcal T(S)$ as the space of conjugacy classes of discrete, faithful representations $[\rho]: \pi_1(S) \to \text{PSL}_{2}(\mathbb R)$ to conclude that $p$ and $q$ are equivalent covers. \begin{proof} By Lemma \ref{BoundaryCurveComplex}, the quasi-isometric embeddings $q^{*}, g^{*}: \mathcal C(S) \to \mathcal C(Y)$ defined above induce the same map from $\partial C(S) \to \partial C(Y)$. Thus, by Theorem \ref{thm:ending-laminations}, $q^{*}$ and $g^{*}$ induce the same map from the space of ending laminations of $S$ to those of $Y$. We have two covering maps from $Y$ to $S$: one is the regular covering map $q: Y \to S$; the other one comes from the composition of $p: X \to S$ with the homeomorphism between $X$ and $Y$ coming from Lemma \ref{lemma:qi-curve-cx} and Theorem \ref{thm:RS-quasi}, which we name as $g$. By Theorem \ref{thm:folklore}, the covering maps induce two isometric embeddings $\widetilde{q}, \widetilde{g}: \mathcal T(S) \to \mathcal T(Y)$ which by Theorem \ref{thm:Mj} admit natural extensions to the Thurston boundary. Consider the diagram in Figure \ref{fig:diagram}, where $\pi_S$ is the natural projection (given by forgetting the measure) from $\mathcal{PMEL}(S)$ to $\mathcal{EL}(S)$; $\pi_{Y}$ is defined similarly. \begin{figure} \begin{tikzcd}[column sep=huge, row sep = huge] \mathcal{PMEL}(S) \ar[ d , " \pi_{ S } " swap ] \ar[ r , " \widetilde{ q } " ] & \mathcal{PMEL} ( Y ) \ar[ d , " \pi_{ Y } " swap ] & \mathcal{PMEL} ( S ) \ar[ l , " \widetilde{ g } " swap ] \ar[ d , " \pi_{ S } " ] \\ \partial \mathcal{ C } ( S ) \ar[ r , " q^{ * } " swap ] & \partial \mathcal{ C } ( Y ) & \partial \mathcal{ C } ( S ) \ar[ l , " g^{ * } " ] \end{tikzcd} \caption{} \label{fig:diagram} \end{figure} \begin{proposition} \label{commuting} The diagram in Figure~\ref{fig:diagram} commutes. \end{proposition} \begin{proof} Let $[ \lambda] \in \mathcal{PMEL}(S)$ be a projective measured ending lamination with $\lambda$ as a representative. Consider the pullback $q^{-1}(\lambda)$ of $\lambda$ to $Y$ under the covering map $q: Y \to S$. Note that the projective measured lamination $[q^{-1}(\lambda)]$ is precisely the image of $[\lambda]$ under $\widetilde{q}$ by Theorem \ref{thm:Mj}. Subsequently, $\pi_{Y}(\tilde{q}([\lambda])) =\pi_{Y}([q^{-1}(\lambda)])$ is the underlying geodesic lamination $q^{-1}(\lambda)_{top}$ of $[q^{-1}(\lambda)]$ obtained by forgetting the measure. On the other hand, $\pi_S([\lambda]) = \lambda_{top}$ is the underlying geodesic lamination of $[\lambda]$. Fix an arbitrary hyperbolic metric on $S$. Since $\lambda_{top}\in \mathcal{EL}(S) = \partial \mathcal{C}(S)$, we may choose a quasi-geodesic ray $\{\alpha_i\}_{i\in \mathbb{N}}$ of simple closed geodesics on $S$ such that $\{\alpha_i\}$ converge to $\lambda_{top}$ as laminations. Consider the sequence of simple closed multigeodesics $\{q^{*}(\alpha_i)\}$ in $Y$ equipped with the hyperbolic metric induced by $q: Y \rightarrow S$. Since $q^{*}$ is a quasi-isometry that extends continuously to the boundary of $\mathcal{C}(S)$, $\{q^{*}(\alpha_i)\}$ is a quasi-geodesic ray in $\mathcal{C}(Y)$ and therefore converges to some (minimal) geodesic lamination $q^{*}(\lambda_{top}) = z \in \partial \mathcal{C}(Y)$. We claim that this limit is exactly $q^{-1}(\lambda_{top})$. To see this, note that the image of $q^{*}(\alpha_i)$ under $(q^{*})^{-1}$ is $q(q^{*}(\alpha_i))= \alpha_i$. Since $\{\alpha_i\}$ converges to $\lambda_{top}$, by continuity, $q(q^{*}(\lambda_{top})) = q(z)$ must be $\lambda_{top}$. Hence $z$ is contained in the pre-image $q^{-1}(\lambda_{top})$. Since $z$ and $q^{-1}(\lambda_{top})$ are both minimal geodesic laminations on $Y$, they must be equal. Therefore $q^{*}(\pi_S([\lambda])) = q^{-1}(\lambda_{top})$. Finally, observe that $q^{-1}(\lambda_{top})= q^{-1}(\lambda)_{top}$ since the lifting map $q^{-1}$ commutes with the measure-forgetting map. A similar argument holds for $\widetilde{g}$ and $g^{*}$. This concludes the proof of the proposition. \end{proof} It follows from Theorem \ref{LM-thick} that the set of uniquely ergodic ending measured laminations $\mathcal{EL}_{ue}$ are dense in the space of measured laminations $\mathcal{ML}$. By unique ergodicity, each $\lambda \in \mathcal{EL}_{ue}$ has a unique lift to $\mathcal{PML}$ under the natural projection $\pi: \partial \mathcal{T} \to \partial \mathcal{C}$. So the preimage $\pi_S^{-1}(\mathcal{EL}_{ue}(S))$ is dense in $\mathcal{PML}(S)$. Since $q^{*}$ and $g^{*}$ induce the same map from $\mathcal{EL}(S) \to \mathcal{EL}(Y)$ and the diagram in Figure~\ref{fig:diagram} commutes, $\widetilde{q}$ and $\widetilde{g}$ agree on $\pi_S^{-1}(\mathcal{EL}_{ue}(S))$ pointwise and hence on $\mathcal{PML}(S)$ pointwise by continuity. Therefore $\widetilde{q}|_{\partial \mathcal T(S)} = \widetilde{g}|_{\partial \mathcal T(S)}$. Next we will show that $ \widetilde{ q } $ and $ \widetilde{ g } $ have the same image in $ \mathcal{ T } ( Y ) $. Let $y \in \widetilde{q} (\mathcal T(S)) \subset \mathcal T(Y)$, and consider its preimage $x = \widetilde{q}^{-1}(y) \in {\mathcal T}(S)$. Then $x$ lies on a bi-infinite Teichm\"uller geodesic $\gamma_{x}$ which has endpoints in $\partial \mathcal T(S)$, by Theorem \ref{MasurBoundary}. By Theorems \ref{thm:folklore} and \ref{thm:Mj}, the images $\widetilde{q}(\gamma_x)$ and $\widetilde{g}(\gamma_x)$ are also bi-infinite Teichm\"uller geodesics with well-defined endpoints in $\partial \mathcal T(Y)$. Since $\widetilde{q}$ and $\widetilde{g}$ agree pointwise on $\partial \mathcal T(S)$ and any two distinct points in the boundary of Teichm\"uller space determine a unique Teichm\"uller geodesic, we have $\widetilde{q}(\gamma_x)= \widetilde{g}(\gamma_x)$. Therefore $y \in \widetilde{g}(\gamma_x) \subset \widetilde{g}(\mathcal T(S))$, which completes the proof that $\tilde{g}$ and $\tilde{q}$ have the same image. It follows that $\widetilde g^{-1} \circ \widetilde q$ is an isometry of $\mathcal T(S)$, fixing $\partial \mathcal{T}(S)$. This implies that $\widetilde g^{-1} \circ \widetilde q$ is the identity on $\mathcal T(S)$ and thus that $\widetilde q$ and $\widetilde g$ agree pointwise on $\mathcal T(S)$. Recall that $x \in \mathcal T(S)$ can be interpreted as a conjugacy class of a discrete, faithful representation $\rho: \pi_1(S) \to \text{PSL}_2(\mathbb R)$. Consider $\widetilde{q}([\rho]), \widetilde{g}([\rho]) \in \mathcal T(Y)$, which (up to conjugacy) are the following: \[\widetilde q([\rho]): \pi_1(Y) \xrightarrow{q_*} \pi_1(S) \xrightarrow{\rho} \text{PSL}(2, \mathbb R),\] \[ \widetilde g([\rho]): \pi_1(Y) \xrightarrow{\varphi_*} \pi_1(X) \xrightarrow{p_*} \pi_1(S) \xrightarrow{\rho} \text{PSL}(2, \mathbb R).\] Here $\varphi_*$ is the isomorphism between $\pi_1(X)$ and $\pi_1(Y)$ induced by the homeomorphism between $X$ and $Y$ given by Lemma \ref{lemma:qi-curve-cx}. Since $\widetilde q$ and $\widetilde g$ agree on $\mathcal T(S)$, $\widetilde q([\rho]) = \widetilde g([\rho])$. This combined with the injectivity of $\rho$ imply that $q_*(\pi_1(Y)) = p_*(\pi_1(X))$. So $p$ and $q$ are equivalent covers. \end{proof} \section{Regular Covers and Non-simple Curves} We now address Theorem \ref{thm:nonsimple}. Let $k = \max(N,M)$, and given $j \in \mathbb{N}$, define $\Gamma_{k,j}(S)$ to be the graph whose vertices correspond to isotopy classes of closed curves $\gamma$ on $S$ with self intersection number at most $k$, and so that two such vertices are connected by an edge exactly when the corresponding curves have geometric intersection at most $j$. Given a fixed $k$, there exists $r \in \mathbb{N}$ so that for all $j \geq r$, every vertex of $\Gamma_{k,j}(S)$ is adjacent to a simple closed curve (and thus in particular, the graph is connected since $\mathcal{C}(S)$ is connected). Choose $j$ so that \[ j \geq r \cdot [\pi_{1}(S): \pi_{1}(X)] \cdot [\pi_{1}(S) : \pi_{1}(Y)].\] \begin{proposition} \label{prop:totallygeo} Let $\mathcal{C}_{j}(S)$ be the graph whose vertices are isotopy classes of simple closed curves and so that two curves are connected by an edge if they intersect at most $j$ times. Then $\mathcal{C}_{j}(S)$ is totally geodesic inside $\Gamma_{k,j}(S)$ and $\Gamma_{k,j}(S)$ lies in its one-neighborhood (and hence also in the one-neighborhood of $\mathcal{C}(S)$). \end{proposition} \begin{proof} The fact that $\Gamma_{k,j}(S)$ lies in the one-neighborhood of $\mathcal{C}(S)$ follows immediately from the choice of $j$. To see that $\mathcal{C}_{j}(S)$ is totally geodesic, consider the map \[ \tau: \Gamma_{k,j}(S) \rightarrow \mathcal{C}_{j}(S), \] defined as follows. For each vertex $v \in \Gamma_{k,j}(S)$, choose a preferred minimal position representative in that isotopy class (which by abuse of notation we refer to as $v$), a choice of orientation, and a choice of starting point which we will denote by $i(v)$. Starting at $i(v)$, traverse $v$ in the forward direction until first reaching a point that has already been visited. This defines a sub-curve $v_{s}$ (which may not necessarily contain $i(v)$) which is necessarily simple and which is essential since $v$ was in minimal position. Note that we are using the fact that $S$ is closed here. Then define $\tau$ by $\tau(v)= v_{s}$. Note that $v_{1}, v_{2} \in \Gamma_{k,j}(S)$ are adjacent if and only if they intersect at most $j$ times. If this occurs, we obviously also have that $(v_{1})_{s}, (v_{2})_{s}$ intersect at most $j$ times and so it follows that $\tau$ is a $1$-Lipschitz retraction of $\Gamma_{k,j}(S)$ on to $\mathcal{C}_{j}(S)$. \end{proof} \begin{corollary} \label{cor:QI} The inclusion of $\mathcal{C}(S)$ into $\Gamma_{k,j}(S)$ is a quasi-isometry. \end{corollary} \begin{proof} It suffices to show that $\mathcal{C}(S) \hookrightarrow \mathcal{C}_{j}(S)$ is a quasi-isometry. This follows from standard arguments; in particular, if $\alpha, \beta$ are simple closed curves intersecting at most $j$ times, their distance in $\mathcal{C}(S)$ can be at most $2\log_{2}(j)+ 2$. \end{proof} \begin{proof}[Proof of Theorem~\ref{thm:nonsimple}] We will begin by establishing a quasi-isometry $\Omega: \Gamma_{k,j}(X) \rightarrow \Gamma_{k,j}(Y)$ which is defined in precisely the same way as $\Phi$ in the proof of Theorem \ref{thm:regular}: given $\alpha \in \Gamma_{k,j}(X)$ a closed curve, first take its pre-image under the cover from $W$ to obtain the curve collection $A_{W}$ and then project to $Y$ under $q': W \rightarrow Y$. This yields a collection of curves $\alpha_{1},..., \alpha_{n}$ on $Y$ satisfying $i(\alpha_{l}, \alpha_{l}) \leq M \leq k$, $ 1 \leq l \leq n$. The value of $j$ was chosen to ensure that $A_{W}$ has diameter $1$ in $\Gamma_{k,j}(W)$, and so it follows by the same argument used in the proof of Theorem \ref{thm:regular} that $\left\{\alpha_{1},..., \alpha_{n}\right\}$ has diameter bounded above independent of $\alpha$ in $\Gamma_{k,j}(Y)$. Just as in Theorem \ref{thm:regular}, this establishes the well-definedness of $\Omega$ and that it is coarsely Lipschitz; interchanging the roles of $Y$ and $X$ give that $\Omega$ is a quasi-isometry. Pre- and post-composing $\Omega$ with the quasi-isometries $\mathcal{C}(X) \hookrightarrow \Gamma_{k,j}(X)$ and $\Gamma_{k,j}(Y) \rightarrow \mathcal{C}(Y)$ from Corollary \ref{cor:QI} yields a quasi-isometry $\Phi: \mathcal{C}(X) \rightarrow \mathcal{C}(Y)$. Once $\Psi: \mathcal C(X) \to \mathcal C(Y)$ is replaced with $\Phi: \mathcal C(X) \to \mathcal C(Y)$ (just defined) in the proof of Lemma \ref{BoundaryCurveComplex}, then the remainder of the argument is identical to the proof of Theorem \ref{thm:regular}. \end{proof} \section{Abelian Covers and Simple Curves} \label{section:abelian} Let $p: X \to S$ be a finite cover. A curve $\widetilde{\alpha} \subset X$ is an elevation of a curve $\alpha \subset S$ of degree $k$ if $\widetilde{\alpha}$ covers $\alpha$ with degree $k$. We will consider the (integral) simple curve homology $\Hom(X) = \Hom(X; \mathbb Z)$, which is the subgroup of $H_{1}(X; \mathbb Z)$ generated by the (integral homology classes of) elevations of simple closed curves on $S$. Fixing basepoints $(X, x_0)$ and $(S, s_0)$ such that $p(x_0) = s_0$, we can find a generating set $G_p$ for $\Hom(X)$ in terms of the fundamental groups of $X$ and $S$. Specifically, call an element of $\pi_1(S, s_0)$ simple if it is represented by a curve which is freely homotopic to a simple closed curve on $S$. We will denote the collection of all powers of simple elements by $P \subset \pi_1(S, s_0).$ Observe that \[G_p \coloneqq \{[\alpha]\in \text{H}_1(X;\mathbb Z) \mid \alpha \in \pi_1(X, x_0) \text{ and } p_*\alpha \in P\}\] is a generating set for $\Hom(X)$. \begin{proposition}[Looijenga, \cite{Looijenga}] \label{thm:looijenga} $\Hom(X) = \text{H}_1(X)$ for a finite-degree abelian cover $p: X \to S$.\end{proposition} Given two finite-degree abelian covers $p: X \to S$ and $q: Y \to S$ and a curve $\gamma \subset S$, we will let $n_p(\gamma)$ (resp. $n_q(\gamma)$) denote the minimum positive integer $k$ such that $\gamma$ admits an elevation of degree $k$ along $p$ to $X$ (resp. along $q$ to $Y$). \vspace{2 mm} \noindent \textbf{Theorem \ref{thm:abelian}. }\textit{Let $p: X \to S$ and $q: Y \to S$ be finite-degree abelian covers of $S$. If $n_p(\gamma) = n_q(\gamma)$ for all simple closed curves $\gamma \subset S$, then $p$ and $q$ are equivalent covers.} \vspace{2 mm} \begin{proof} Fix basepoints $x_0, y_0$, and $s_0$ of $X, Y$, and $S$, respectively, such that $p(x_0) = q(y_0) = s_0$. By Proposition~\ref{thm:looijenga}, $G_p$ and $G_q$ are generating sets for $\Hom(X) = \text{H}_1(X)$ and $\Hom(Y) = \text{H}_1(Y)$, respectively, and so $p_*G_p$ and $q_*G_q$ are generating sets for $p_*\text{H}_1(X)$ and $q_*\text{H}_1(Y)$. Moreover, we have that \begin{align*} p_*G_p &= \{p_*[\alpha] \in \text{H}_1(S) \mid \alpha \in \pi_1(X,x_0) \text{ and } p_*\alpha \in P\} \\ &= \{[\gamma] \in \text{H}_1(S) \mid \gamma \in P \cap p_* \pi_1(X, x_0)\} \\ &= \{[\gamma] \in \text{H}_1(S) \mid \gamma \in P \cap p_* \pi_1(Y, y_0)\} \\ &= \{q_*[\beta] \in \text{H}_1(S) \mid \beta \in \pi_1(Y, y_0) \text{ and } q_* \beta \in P\} = q_* G_q, \\ \end{align*} and so $p_*\text{H}_1(X) = q_* \text{H}_1(Y).$ Since $p$ and $q$ are abelian covers, they must be equivalent. \end{proof} \bibliographystyle{plain}
\section{social system} \section{Introduction} \label{sec:introduction} Mobile cyber-physical systems involve humans utilizing mobile services in their social contexts. This inclusion of human actors extends the classical cyber-physical systems paradigm \cite{chakraborty2016automotive} to cyber-physical-\textit{social} systems (CPSS) \cite{dautov2018data}. These systems integrate both, social and physical systems by intelligent human-machine interactions in cyber-physical space \cite{zhang2018cyber}. Knowledge graphs store information in a graph structure that are often utilized in these CPSS to improve services such as route navigation~\cite{dudas2009onalin}, health recommendations~\cite{hu2016personal} \cite{wiesner2010adapting} or question answering \cite{hao2017end}. In particular, knowledge graphs improve the performance of learning algorithms at predicting unobserved relationships between entities in an application domain~\cite{caragea2009ontology, cui2019infer}. Nevertheless, manually building knowledge graphs may be impractical and unscalable~\cite{alani2003automatic}. Hence systems utilizing link prediction methods are proposed to automate the building of knowledge graphs~\cite{wang2013boosting}. These CPSSs are designed either explicitly or implicitly for values such as usability \cite{schafer2017towards}, autonomy \cite{dussell1999position}, or privacy \cite{asikis2020value}. The sucessful implementation of these values into CPSSs can determine their adoption by humans \cite{zhou2011effect} \cite{belanger2008trust, nahavandi2017trusted} and thus should be explicitly accounted for in the design phase~\cite{friedman1997software}. Hence, this work applies a value-sensitive design methodology~\cite{van2008moral, van2010use, friedman1997software, hill1991autonomy, friedman2003human} that explicitly considers values such as privacy and accountability to design a CPSS in the form of a knowledge graph builder that constructs a knowledge graph by adding links. By utilizing a novel link prediction methodology, the knowledge graph building is automated. In particular, users are assisted to identify missing relationships in a knowledge graph via a link prediction method. By following a privacy-by-design approach, both the knowledge graph as well as the link prediction method are deployed locally on users' mobile phones without access from a third-party. The automated knowledge graph building remains accountable-by-design to humans by letting users supervise the accuracy of recommendations via accepting or rejecting recommended links. Moreover, as this feedback is then in turn utilized to train the link prediction method, users can control the calibration of their machine intelligence. This value-sensitive design approach builds a trustworthy domain-specific knowledge graph about users' reality that can improve services provided by CPSS such as privacy-preserving recommenders. The contributions of this work are the following: \begin{itemize} \item An automated knowledge graph builder for CPSSs that is accountable via human-supervision, preserves the privacy of its users and runs locally on smart phones. In particular, the novel approach connects expert knowledge, automation and crowd-sourcing to collaboratively build a trustworthy and personalized knowledge graph. \item The extension of an existing link prediction methodology \cite{bliss2014evolutionary} with structural semantic and temporal information. \item Extended and novel similarity metrics that measure the probability of link formation between two nodes of a knowledge graph. \item Identification of dominant metric ensembles that guide link prediction in knowledge graphs in a smart city application scenario. \end{itemize} This paper is organized as follows: In Section \ref{sec:related_work}, content-based recommenders and knowledge graph building via link prediction are discussed. A data model for knowledge graphs and its applications for digital assistance is introduced in Section \ref{sec:data_model}, while the automated and privacy-preserving knowledge graph builder is then outlined in Section \ref{sec:decision_support_system}. Thereafter, Section \ref{sec:methodology} illustrates the methodology of the conducted experiment and Section \ref{sec:evaluation} presents the evaluation. Section \ref{sec:summary_of_findings} summarizes the findings and Section \ref{sec:conclusion} draws a conclusion and gives an outlook on future work. \section{Background and literature review} \label{sec:related_work} Intelligent CPSSs in the form of recommenders are studied to sort through information and to make personalized recommendations to individual users~\cite{pazzani1999framework}. Two types of methods are applied in these recommender systems~ \cite{van2000using}: User-based collaborative and content-based filtering. The former is often not privacy-preserving as it relies on collecting sensitive information from users~\cite{basilico2004unifying,isinkaye2015recommendation,friedman2015privacy}. In contrast, the latter relies on informative content descriptors \cite{basilico2004unifying} in the form of a common and transparent information source that can be constructed by expert knowledge \cite{asikis2020value}, crowd-sourced information \cite{carlier2011combining, goeau2011visual}, or automation \cite{ferman2002content}. Often this approach does not rely on sensitive user information and thus can better preserve their privacy. In particular, this approach optimizes recommendations by matching users' preferences (e.g. watched products) with product information. A novel approach in content-based recommender systems that follows a value-sensitive design improves product recommendations while shopping by matching local user personalization with a centrally maintained information source in the form of a knowledge graph \cite{asikis2020value}, which has been shown to improve recommender systems \cite{yu2014personalized}. By performing this matching on the users' phone, the accuracy of recommendations is improved while users' privacy is preserved. Nevertheless, as knowledge graphs are often static and incomplete \cite{shi2016discriminative, melo2017approach}, this approach misses the opportunity to improve recommendations by letting users build the utilized knowledge graph \cite{cui2019infer}. In general, such knowledge graph building can either be performed by (i)~human experts (ii)~crowd-sourcing, or (iii)~automation \cite{nickel2015review}. Utilizing human experts results in highly accurate knowledge graphs, but lacks scalability due to the limited available human resources \cite{wang2019research}. Crowd-sourcing information scales better but may result in less accurate knowledge graphs \cite{west2014knowledge}. Additionally, the scalability of that approach, though increased, can also become saturated as the slow down of Wikipedia growth indicates \cite{suh2009singularity}. Hence, automating knowledge graph building is promising to increase its scalability. Nevertheless, it is a challenge to determine the accuracy of automatically constructed knowledge graphs which reduces their trustworthiness \cite{nickel2015review}. Two tasks in knowledge graph building are identified~\cite{paulheim2017knowledge}: Knowledge graph completion and error detection. The former focuses on adding new instances (e.g. links) to the knowledge graph whereas the latter identifies and removes erroneous information from the knowledge graph. To tackle these challenges with automation and thus scale up the knowledge graph building, two types of methods are utilized~\cite{nickel2015review}: latent feature and graph feature-based methods. Latent feature-based methods often lack the capability to account for new entities entering the knowledge graph as those are not considered in the latent feature calculations~\cite{amador2019ontology}. Moreover, these methods utilize the whole knowledge graph in their calculation which can result in limited scalability and privacy concerns~\cite{cui2019infer}. In contrast, graph-based methods utilize the knowledge graph directly to calculate features. Three types of methods are identified that utilize graph-based information~\cite{nickel2015review}: Similarity measures, rule mining and inductive logic programming, and path rank algorithms. Similarity-based methods is the most commonly used approach in link prediction \cite{chen2016fast}. In this approach, a score is assigned to new candidate links, and the top-k links with the highest score are recommended \cite{haghani2019systemic}. These algorithms require no domain knowledge to compute the similarity scores \cite{lichtenwalter2010new} and can identify homophily patterns in knowledge graphs~\cite{haghani2019systemic}. Depending on the structural information utilized in the calculations, similarity measures can be clustered into three groups \cite{martinez2016survey}: local, quasi-local, and global similarity metrics. When compared to the computations of global metrics, local similarity metrics computations are more efficient and parallelizable but are restricted on distance-two nodes (neighbors of neighbors)~\cite{martinez2016survey}. Quasi-local similarity metrics are less efficient when compared to local metrics but can in contrast to those assign similarity scores to further apart nodes~\cite{martinez2016survey}. Recently, knowledge graphs grew to networks consisting of thousands of different object and link types \citep{cao2016link}. These networks are often incomplete and change dynamically, which makes mining and analysis challenging \cite{friemel:dynamics_of_social_networks,wang2015link}. In particular, link prediction in such networks has to model topological as well as temporal and semantic influences between various types of relationships and to identify the underlying mechanisms that drive the formation of new relationships \cite{davis2013supervised}. Extensive reviews of link prediction are outlined in Wang et al. \cite{wang2015link} for social networks, in Shi~et~al.~\cite{shi2017survey} for networks with more than one relationship type and in Martinez~et~al.~\cite{martinez2016survey} for complex networks. In the following, an overview of the link prediction literature that is important for this work is illustrated. Tylenda et. al \cite{tylenda2009towards} find that temporal information about changes in knowledge graphs are a dominant feature in link prediction. This has been confirmed by Yang et al. \cite{yang2012predicting} by introducing supervised and unsupervised methods for link prediction in knowledge graphs. Moreover, the authors introduce the multi-relational influence propagation metric for heterogeneous networks. Likewise, other researchers developed measures and algorithms utilizing the ontology of knowledge graphs. For instance, Maedche et al. \cite{maedche2002clustering} introduce relation and taxonomy similarity metrics to measure the similarity between any two objects in a knowledge graph by analyzing ontological information. It was shown that these measures perform well for cluster analysis \cite{grimnes2008instance}. Likewise, Opuszko et. al \cite{opuszko2012classification} predict links between actors using ontology-based similarity measures. They show that including these measures can improve the prediction performance. Nonetheless, they also show, that their results are often not easily interpretable and that it is not obvious how to weight the different measures when combined. In particular, this often requires domain knowledge and manual effort~\cite{ma2019jointly}. This is confirmed by Brando et. al \cite{brandao2013using} who state that the weighting of different metrics is a grant challenge in the context of link prediction. Bliss et. al \cite{bliss2014evolutionary} address this problem by utilizing a genetic algorithm for link prediction \citep{bliss2014evolutionary}, which adjusts the weights of the similarity measures by optimization. They use local similarity measures to estimate the likelihood of an unobserved link existence. The strength of this approach compared to other link prediction algorithms is that it neither requires the assumption of network classes nor prior knowledge about the analyzed knowledge graph as the weights are calculated by the optimization strategy \citep{ozcan2019multivariate}. It is shown that this approach produces comparable results to other link prediction approaches while enabling researchers to analyze the networks driving mechanisms. In particular, the change of weights of different similarity measures during a period of time or for different networks can be analyzed \citep{bliss2014evolutionary}. Often neither a single metric is dominant for predictions \cite{vani2015investigating} nor is the combination of metrics stable over different application domains. Thus identification of dominant metric weights in novel application domains is required. Nevertheless, Bliss et. al \cite{bliss2014evolutionary} primarily focus on topological information of a homogenous network \cite{ozcan2019multivariate} and thus they neither investigate the performance of temporal and ontology-based similarity metrics nor the applicability of their method on heterogeneous\footnote{Network consisting of more than one entity type, as defined in Section \ref{sec:linked_graph}} or multi-dimensional\footnote{Networks consisting of more than one relationship type, as defined in Section \ref{sec:linked_graph}} networks consisting of a multitude of link and node types. In summary, current approaches in recommender systems often lack privacy-preservation and rely on a centralized completion of global knowledge graphs which does not scale well when applied in a smartphone setting. The identification of dominant combinations of similarity metrics for an application domain is challenging and the approach of Bliss et al. \cite{bliss2014evolutionary} does not consider temporal and ontological similarity metrics which might improve prediction accuracy. In order to solve these identified gaps, this work extends the method of Bliss et. al \cite{bliss2014evolutionary} with temporal, ontology-based, local, and quasi-local similarity measures that are applied to a multi-dimensional and heterogeneous knowledge graph to identify the dominant similarity metrics in a smart city application scenario. The method is then utilized in a human-supervised and privacy-preserving knowledge graph builder to enable users to build a personalized knowledge graph in a given application scenario that collaboratively combines experts' knowledge, crowd-sourced information, and automation \section{Automated knowledge graph building via link prediction} \label{sec:data_model} This article focuses on knowledge graphs that are modeled as an ontology. Such a structure enhances machines/ algorithms capability to analyze and interpret information \cite{maedche2002clustering}. In the following the concept of an ontology is introduced (Section \ref{sec:ontology}) and its data model is defined (Section \ref{sec:linked_graph}). Moreover, applications of knowledge graphs are illustrated (Section \ref{sec:application_ontology}). \subsection{Ontology} \label{sec:ontology} \begin{figure}[!t] \centering \includegraphics[width=1.0\columnwidth]{images/metadata.pdf} \caption{Example knowledge graph consisting of an ontology and metadata structure that construct a knowledge graph. } \label{fig:ontology} \end{figure} Ontologies formally define types, properties, and relationships between entities that are applied to a concrete domain and enable the construction of knowledge graphs \cite{amador2019ontology}. Ontologies and all related concepts are rigorously defined in Maedche et. al \citep{maedche2002clustering}. In the following, those terms and terminologies are introduced that are relevant for this work. An example of an ontology and an instance of it - a metadata structure, which together construct a knowledge graph, are depicted in Figure~\ref{fig:ontology}. An ontology consists of concepts (e.g. \textit{human} in Figure \ref{fig:ontology}) and relation identifiers (e.g. \textit{waited at} in Figure~\ref{fig:ontology}). The concepts are structured in a concept hierarchy (e.g. human is a \textit{sub concept} of root). Concepts are instantiated by instances (e.g. Albert Einstein is an instance of a human in Figure \ref{fig:ontology}). Moreover, a \textit{concrete relationship} is an instantiation of a relationship between two instances (e.g. Albert Einstein- \textit{born in} - Germany is a concrete relationship in Figure \ref{fig:ontology}). \begin{table} \caption{Symbols and expressions utilized in this work.} \label{tab:link_pred_comparison} \centering \resizebox{1.0\columnwidth}{!}{ \begin{tabular}{ ll} \toprule \textbf{Symbol} &\textbf{Explanation} \\ \midrule $V_i$ & set of nodes of concept $i$ \\ $V$ & $(V_1 \cup V_2 \cup ... \cup V_N)$\\ $E_j$ & set of realized triplets of link type $j$ \\ $E$ & $(E_1 \cup E_2 \cup ... \cup E_M)$\\ $G(V,E)$ & graph consisting of nodes in $V$ and links in $E$\\ $ \Gamma(u,j)$ &neighborhood of $u$ for link type $j: \{v \in V | \exists (u,v,j) \in E_j \}$ \\ $\Gamma(u)$& neighborhood of $u: \cup_{j\in M} \Gamma(u,j)$\\ $k_u$ & degree of node $u$ \\ $P_n$ & path of length $n$ between $u$ and $v$\\ $J(u) $& set of all links in which $u$ is subject: \\ &$\{ j \in M| \exists v \in V: (u,v,j) \in E \}$ \\ $J(u,v)$& set of realized links in which $u$ is the subject \\ & and $v$ the object node: $\{ j \in M| u,v \in V: (u,v,j) \in E \}$ \\ $E(j)$& set of node pairs that are connected via a relation identifier $j$.\\ & $\{(u,v)| \exists (u,v,j) \in E \}$ \\ $N(j)$ & set of subject nodes:$ \{u \in V| \exists (u,v,j) \in E \}$ \\ \bottomrule \end{tabular} } \end{table} \subsection{Directed graphs as a data model for knowledge representations} \label{sec:linked_graph} As depicted in Figure \ref{fig:ontology}, an instance of a knowledge graph can be modeled as a graph. In the following necessary definitions are given. Let $i \in \{1,...,N\}$ be a concept (i.e. human, country, bus stop) and $N$ the number of different concepts, then $V_i$ is the set of nodes of the same concept $i$ and $V = (V_1 \cup V_2 \cup ... \cup V_N)$ is the set of all nodes. An instance of a concept $i$ can be denoted as $u_i$ or as $u\in V_i$. A relation identifier~$j~\in~\{1,..,M\} := S_M$ (e.g. waited at, born, etc.) can connect two nodes $u,v$ ; $M$ being the number of different relation identifiers. A concrete relationship is denoted as a triplet $(u,v,j)$, where $u,v \in V$ and $j$ denote the relation identifier. These links are directed, where $u$ is the subject and $v$ the object. The set of realized triplets of link type $j$ is then denoted as $\gls{symb:realized_link_of_type_gloss}$ and $E=(E_1 \cup E_2 \cup ... \cup E_M)$ is the set of all realized links. $e \in E$ is referred to as concrete relationship or link in the following. The graph or network with nodes in $V$ and links in $E$ is then denoted as $G(V,E)$. If $N>1$ the graph $G$ is called heterogeneous and if $M > 1$ the graph is called multi-dimensional. On such a multi-dimensional and heterogeneous network a similarity measure $s_i$ can be defined rigorously as in Chen et. al \cite{chen:similarity_metric}. Each $s_i$ measures how similar two nodes $u,v$ are. The linear combination of such metrics \begin{equation} \label{eq:linear_combined_similarity_metrics} \begin{aligned} s(u,v) =& \sum_{i} a_i s_i(u,v), \\ &\sum_i a_i =1. \end{aligned} \end{equation} is also a similarity metric \cite{chen:similarity_metric}. A similarity measure can be normalized onto the range $[0,1]$. \subsection{Automated knowledge graph building via link prediction} \label{sec:application_ontology} In this work, link prediction is utilized to automate the completion of a knowledge graph by predicting links between existing instances. In the following, the link prediction problem is introduced (Section \ref{sec:problem_formulation}). A method is then proposed in Section \ref{sec:decision_support_system}. \subsubsection{Problem formulation} \label{sec:problem_formulation} The link prediction task on a multidimensional and heterogeneous graph $G$ (Section \ref{sec:linked_graph}) can be stated as follow: Let $G_p(V,E_p) \subset G(V,E)$ be a sub graph such that $E_p \subset E$. The task of link prediction is to identify those $j \in E$ that are currently not observed in $E_p$. Let $u,v \in V$, $j \in S_M$ and $s_1: s_1(V,V,S_M) \rightarrow [0,1]$ and $s_2: s_2(V,V) \rightarrow [0,1]$ being normalized similarity measures. A similarity measure models the probability of an unobserved link to be established between the nodes. Two types of predictions are considered in this work: \begin{itemize} \item \textbf{Existence prediction} is utilized in one-dimensional knowledge graphs ($M=1$) and predicts if any link exists between the two nodes $u$ and $v$ ($\exists j \in S_M s.t. (u,v,j) \in E \land (u,v,j) \notin E_p $), thus without specifying the relation identifier. The probability of such a link formation is defined as the normalized similarity measure $s_2(u,v)$ between the two nodes. \item \textbf{Semantic prediction: } is utilized in multi-dimensional knowledge graphs ($M>1$) and predicts what relation identifier connects the two nodes $u$ and $v$. The probability of a link $j \in S_M$ to be formed is defined as the similarity measure $s_1(u,v,j)$ between these two nodes along the candidate link. \end{itemize} This work distinguishes between these two types of predictions because of computational considerations: Heterogeneous and multi-dimensional knowledge graphs have complex dependency structures \cite{davis2013supervised}. Computing the semantic type of a link between two nodes requires distinguishing the formation mechanism for each link type \cite{davis2013supervised} which is computationally costly. Hence this work predicts the semantic type of relationship only between nodes where it is known that already a link exists. Existence prediction is utilized for nodes that are not connected yet. \section{A human-supervised and privacy-preserving knowledge graph builder} \label{sec:decision_support_system} In this section, the knowledge-graph builder is introduced. It performs link prediction (Section \ref{sec:problem_formulation}) on a heterogeneous and multi-dimensional knowledge graph (Section \ref{sec:linked_graph}) utilizing an optimization mechanism in form of genetic programming (Section \ref{sec:genetic_algorithm}) to optimize the weights of various similarity metrics (Section \ref{sec:utilized_metrics}). These weighted metrics then facilitate the recommendation of missing links (Section \ref{sec:problem_formulation}) in a knowledge graph (Section \ref{sec:ontology}). Moreover, the builder is supervised by the user and preserves their privacy. In the following, a background on genetic programming is given (Section \ref{sec:genetic_algorithm}) before the link prediction method is introduced (Section \ref{sec:algorithm}). Finally, the knowledge graph builder is illustrated (Section \ref{sec:decision_support_system}). \subsection{Background: genetic programming} \label{sec:genetic_algorithm} Genetic programming is an optimization method that is utilized in symbolic regression to identify underlying functions to given data points that explain their dependencies \cite{koza:genetic}. Compared to other optimization strategies, genetic programming provides solutions for large, poorly defined search spaces that are high-dimensional, multi-modal, and noisy \cite{sastry2019survey}. Due to its flexibility in adjusting to diverse problems \cite{espejo2009survey}, genetic programming has gained an increased interest in diverse research communities such as software improvement \cite{petke2017genetic}, image processing~\cite{khan2019recent}, production scheduling~\cite{nguyen2017genetic}, and machine learning \cite{agapitos2019survey}. \subsection{Link prediction method} \label{sec:algorithm} The method is an extension of the link prediction algorithm found in Bliss et. al \cite{bliss2014evolutionary} with temporal and ontology-based metrics added: The core idea of the prediction algorithm is to measure topological, temporal and semantic similarity metrics~$s_i$ between a target node $u$ and candidate node $v$ on a multi-dimensional and heterogeneous graph $G$ and then to predict based on a weighted combination of these metrics if a link $j$ between these nodes exists (existence prediction, Section~ \ref{sec:problem_formulation}), resp. what type of link should be formed (semantic prediction, Section \ref{sec:problem_formulation}). The link prediction method consists of two main steps and is depicted in Algorithm \ref{eq:netti_algorithm}. In the first step, the weights $a_i$ are obtained via genetic programming (Section \ref{sec:genetic_algorithm}). Then, Equation \ref{eq:linear_combined_similarity_metrics} is utilized to predict which links are unobserved in a given candidate set that was obtained by a baseline heuristic. In both steps, it is distinguished between semantic and existence prediction, as formulated in Section~\ref{sec:problem_formulation}. \begin{algorithm} \caption{Link Prediction Algorithm}\label{eq:netti_algorithm} \begin{algorithmic}[1] \Procedure{predict}{$u$}\Comment{obtain link existence or type information} \State $\vec{a} \gets \text{getWeights}()$ \Comment{see section \ref{sec:obtaining_weights}} \State $r \gets $ predictType($u,a$) or predictExistence($u,a$) \Comment{see section \ref{sec:prediction}} \State \textbf{return} $\vec{r}$\Comment{List of links (semantic prediction) or nodes (existence prediction) with assigned similarity values as calculated by Equation \ref{eq:linear_combined_similarity_metrics}.} \EndProcedure \end{algorithmic} \end{algorithm} \subsubsection{Training - Obtaining weights $a_i$} \label{sec:obtaining_weights} Algorithm \ref{eq:obtain_weights} depicts the weight calculation algorithm: It first calculates a training set and then uses this training set as an input for the genetic programming algorithm, which after termination returns the weight vector. \begin{algorithm} \caption{Obtain Weights}\label{eq:obtain_weights} \begin{algorithmic}[1] \Procedure{getWeights}{ }\Comment{obtain weights for similarity measures} \State $\text{List$<$TrainingInstance$> l$ } \gets \text{getTrainingInstances()}$ \State $\vec{a} \gets \text{calcGenetic($l$)}$ \State \textbf{return} $\vec{a}$ \EndProcedure \end{algorithmic} \end{algorithm} The training set generation algorithm creates training sets consisting of positive and negative training instances. In link existence prediction, an instance consists of: $(u,v,\{0,1\})$, $u,v \in V$. In case of semantic prediction it has the following form: $(u,v,j,\{0,1\})$, $u,v \in V$, $j \in M$. For both types, $1$ indicates that a link (of type $j$) exists between node $u$ and $v$ and $0$ that no link exists. The training set consists of $50 \%$ positive (1) and $50 \%$ negative (0) instances. Depending on the available information, the algorithm operates in two modes for the generation of negative instances: (i) Knowledge of non-existent links: It is known that specific links of type $j$ are not existent between some nodes $u,v \in V$. This often requires manual work but is considered as the gold standard in method evaluation \cite{paulheim2017knowledge}. (ii) \textit{No} knowledge of non-existing links: It is assumed that all \textit{unobserved} links in the network are non-existent. Due to the incompleteness of knowledge graphs \cite{shi2016discriminative, melo2017approach}, this approach is considered as the silver standard in evaluation \cite{paulheim2017knowledge}. The details of how genetic programming is implemented in this work can be found in Appendix \ref{ap:training}. \begin{figure*}[] \includegraphics[width=1\textwidth]{images/transparent_link_prediction_2.pdf} \caption{Example illustrating the baseline and genetic link prediction methods: For the given target node Max Frisch, the baseline methods (Algorithms \ref{eq:candidate_set_existence} and \ref{eq:candidate_set_type}) calculate a candidate set of unobserved existing links. The genetic link prediction method utilizes these candidate sets and creates ranked suggestions via the trained and weighted similarity metrics (Equation \ref{eq:linear_combined_similarity_metrics}).} \label{fig:transparent_link_prediction} \end{figure*} \subsubsection{Prediction} \label{sec:prediction} \begin{algorithm} \caption{Existence baseline method}\label{eq:candidate_set_existence} \begin{algorithmic}[1] \Procedure{getExistanceCandidate}{$u,N$b}\Comment{Existence Candidate Set} \State $t\gets \text{getNeighbors}(u)$ \State $s$ $\gets$ getNeighborsForEach($t$) \State $s$.remove($t$) \State $result$.add(random($s,N/2$)) \State $s \gets $ getAllNodes() \State $s$.remove($t$) \State $result$.add(random($s,N/2$)) \State \textbf{return} $result$\Comment{Candidate set of nodes} \EndProcedure \end{algorithmic} \end{algorithm} Figure \ref{fig:transparent_link_prediction} illustrates the utilized link prediction method: In a first step, for a given target node $u$ (e.g. Max Frisch in Figure \ref{fig:transparent_link_prediction}) a candidate set $c$ is calculated by a baseline method. This method returns a set consisting of candidate nodes $v_i$ (existence prediction) or of candidate node-relationship pairs ($v_i,j$) (semantic prediction), $j\in S_M$. Then, in a second step, Equation \ref{eq:linear_combined_similarity_metrics} is applied on the candidate set to obtain a similarity score for each candidate $(u,v_i)$, respectively $(u,v_i,j)$. The set is ordered based on these scores and the top entries are utilized for link prediction. In the evaluation (Section \ref{sec:evaluation}), the accuracy of these predictions are compared to the accuracy of taking randomly instances from the baseline's candidate set. Two baseline methods are utilized for comparison, one for the existence and one for the semantic prediction. The existence baseline method (Algorithm~\ref{eq:candidate_set_existence}) for a target node $u$ considers both, exploitation and exploration of the existing knowledge graph: In order to exploit topological information, $50 \%$ of the candidate set consists of neighbors of existing neighbors of $u$ that are not already connected to $u$. The other half is constructed by exploring the remaining knowledge graph and thus to include not connected nodes randomly with an equal probability. Because instances in knowledge graphs are often linked by more than one relation identifier, the semantic baseline method (Algorithm \ref{eq:candidate_set_type}) exclusively exploits topological information: The candidate set is constructed by the neighbors of $u$, which are included in the candidate set with an equal probability. Hence, in contrast to the existence baseline, the full knowledge graph is not explored to decrease the computational complexity as outlined in Section \ref{sec:problem_formulation}. Each of the selected nodes is then accompanied with possible relationship identifiers of links that still can be formed between the selected node and~$u$. \begin{algorithm} \caption{Semantic baseline method}\label{eq:candidate_set_type} \begin{algorithmic}[1] \Procedure{getSemanticCandidate}{$u,N$}\Comment{Type Candidate Set generation} \State $s\gets \text{getNeighbors}(u)$ \For{Node c : s}\Comment{for each candidate} \State rel $\gets$ chooseNonExistingRelationship($u,c$) \State $l$.add($c$,rel) \If{$l$.size()$>N$} \State break \EndIf \EndFor\label{euclidendwhile} \State \textbf{return} $l$\Comment{Candidate set of pairs (node,link)} \EndProcedure \end{algorithmic} \end{algorithm} \subsubsection{Utilized similarity metrics} \label{sec:utilized_metrics} The utilized metrics are clustered in three groups, characterized by their applicability in existence prediction, semantic prediction or both predictions. Moreover, the metrics are normalized to take values in the interval~$[0,1]$. In the following, additional notation to illustrate the metrics is introduced (Section \ref{sec:additional_notation}) before the utilized metrics are illustrated in greater detail (Section \ref{sec:metric_description}). \paragraph{Additional notation} \label{sec:additional_notation} Besides the notation introduced in Section \ref{sec:linked_graph}, the following is required to define the utilized similarity metrics: The neighborhood of $u$ for link type $j$ is defined as $ \Gamma(u,j) = \{v \in V | \exists (u,v,j) \in E_j \}$. The neighborhood of $u$ is defined as $\Gamma(u)= \cup_{j\in M} \Gamma(u,j)$. In addition, $k_u$ is the degree of node~$u$. A path of length $n$ between $u$ and $v$ is denoted as $P_n$. $J(u) = \{ j \in M| \exists v \in V: (u,v,j) \in E \}$ is the set of all links in which $u$ is the subject node. $J(u,v) = \{ j \in M| u,v \in V: (u,v,j) \in E \}$ is the set of realized links in which $u$ is the subject and $v$ the object node. Moreover, $E(j) = \{(u,v)| \exists (u,v,j) \in E \}$ is the set of node pairs that are connected via a relation identifier $j$ and $N(j) = \{u \in V| \exists (u,v,j) \in E \}$ is the set of subject nodes. \begin{table*} \caption{Utilized metrics in the knowledge builder.} \label{tab:classical_metrics} \resizebox{1.0\textwidth}{!}{ \begin{tabular}{ lllcclc} \toprule \textbf{ID} &\textbf{ Metric name}& \textbf{\begin{tabular}[c]{@{}c@{}}Equation \\ \end{tabular}} & \multicolumn{2}{c}{\textbf{Prediction}}&\textbf{Type}& \textbf{\begin{tabular}[c]{@{}c@{}}Normalized/ \\ \end{tabular} }\\ & & &Existence&Semantic& &\textbf{Novel }\\ \midrule 1 &Jaccard Index (J) \cite{jaccard1901bulletin} & $ \frac{|\Gamma (u) \cap \Gamma(v)|}{|\Gamma(u) \cup \Gamma(v)|}$ &X&X& topological &\\ 2&Adamic Adar (AA) \cite{adamic2003friends} & $ \Big(\sum_{z\in \Gamma (u) \cap \Gamma(v)} \frac{1}{log(|\Gamma(z)|)} \Big)$ $\frac{1}{|\Gamma(u)\cap \Gamma(v)|\frac{1}{log(2)}}$ & X& X& topological&X\\ 3& Resource Allocation (R) \cite{zhou2009predicting} & $ \Big( \sum_{z \in \Gamma(u) \cap \Gamma(v)} \frac{1}{|\Gamma(z)|} \Big)$ $\frac{1}{|\Gamma(u)\cap \Gamma(v)|\frac{1}{2}}$ &X&X& topological&X \\ 4 & Hub promoted (Hp) \cite{ravasz2002hierarchical}& $\frac{|\Gamma(u) \cap \Gamma(v)|}{max \{ k_u,k_v\}}$ & X & X& topological& \\ 5&Hub depressed (Hd) \cite{ravasz2002hierarchical} &$\frac{|\Gamma(u) \cap \Gamma(v)|}{max \{ k_u,k_v\}}$ &X& X& topological& \\ 6&Leicht-Holme-New. (L) \cite{leicht2006vertex} &$ \frac{|\Gamma(u) \cap \Gamma(v)|}{k_u k_v}$ & X& X& topological&\\ 7&Salton (Sa) \cite{mcgill1983introduction} & $ \frac{|\Gamma(u) \cap \Gamma(v)|}{\sqrt{k_u k_v}}$ &X&X& topological & \\ 8&Sorenson index (So) \cite{sorensen1948method}& $\frac{2 |\Gamma(u) \cap \Gamma(v)|}{k_u + k_v}$ & X & X& topological& \\ 9&Shortest path (SP)&$max \Big(0, 1- \frac{\underset{n}{min}P_n(u,v)-1}{5}\Big) $ &X& X&topological&X \\ 10&Time score (TS) \cite{munasinghe2012time} &$\sum_{c_i \in \Gamma(u) \cap \Gamma(v)} \frac{H_m^i \beta^{k_i}}{|t_1^i - t_2^i|+1}$ & X& X&time&X\\ 11&Euler Time Metric (ET) & $e^{- \text{lastlink}(v)/d}, d = \text{discounting factor}$ & X & X &time & \\ 12&Focci distance (FD)\cite{jahanbakhsh2012predicting}& $\underset{j\in J(u)\cap J(v)}{max}\underset{z\in \Gamma(u,j)\cap \Gamma(v,j)}{max} \frac{1}{|\Gamma(z,\text{inverse}(j))|}$ &X&& topological, semantic&X\\ 13&Conditional Prob. (CP) \cite{yang2012predicting} & $ \underset{j\in M\setminus i}{max} \frac{| E(i) \cap E(j)| }{|E(i)|}$ & &X&semantic& \\ 14&Taxonomy Sim. (OR) \cite{maedche2002clustering}&$\frac{\sum_{a \in A_s(P,I_1)} max \{ sim(a,b)|b \in A_s(P,I_2)\}}{|A_s(P,I_1)|}$&X&&semantic&\\ 15&Relational Sim. (RS) \cite{maedche2002clustering}& $\big(\sum_{p\in P_{co-I}}OR(I_1,I_2,p) + $ $ \sum_{p\in P_{co-O}} OR(I_1,I_2,p)\big)\frac{1}{|P_{co-I}+|P_{co-O}|}$ &X&&semantic, topological& \\ 16& AR Relation (ARR) & $ \frac{J(u) \cap J(v)}{J(u)}$ &X&& semantic &X \\ 17&AO Relation (AOR) &$\frac{|\text{type}(u)== \text{type}(\Gamma(v))|}{|\Gamma(v)|}$ & X& & semantic & X\\ 18&AO Relation Reversed (AORR)& AOR(v,u) & X&& semantic & X\\ 19&AO Relation Combined (AORC)& $\frac{AOR(u,v)+AORR(u,v)}{2}$ & X &&semantic& X\\ 20&Node Dimension Conn. (NDC) \cite{rossetti2011scalable} & $ \frac{|\{ u\in V | \exists v \in V: (u,v,i) \in E\}|}{|V|}$ &&X& topological & \\ 21&Edge Dimension Conn. (EDC) \cite{rossetti2011scalable}& $\frac{|\{(u,v,i)\in E | u, v \in V\}|}{|E|}$ & & X&topological & \\ 22 & Multi Relational Link propagation \cite{yang2012predicting}&$score(v)\beta \frac{weight(v,u,i)}{degree(v,i)}+score(v)\beta \sum_{j\neq i}^K\big(\sigma(i,j) \frac{weight(v,u,j)}{degree(v,j)}/ (|E(v,u)|-1)\big)$&&X&topological, semantic\\ \bottomrule \end{tabular} } \end{table*} \paragraph{Metric description} \label{sec:metric_description} Table \ref{tab:classical_metrics} depicts the 27 utilized metrics. As illustrated in Section \ref{sec:problem_formulation}, this article distinguishes between semantic and existence prediction. Not all metrics can be utilized in both of these types of predictions (Columns 4 and 5 in Table \ref{tab:classical_metrics}). 19 metrics are topological metrics that utilize the metadata structure of the knowledge graph (Section \ref{sec:ontology}), two are time-based and 14 utilize semantic information of the knowledge graph by using its ontology (Column 6 in Table \ref{tab:classical_metrics}). Four metrics are introduced in this paper (ID 16-19 in Table \ref{tab:classical_metrics}), two metrics found in literature are modified such that they are normalized to take values in the range $[0,1]$ (ID $2, 3$ in Table \ref{tab:classical_metrics}) and three metrics are adjusted such that they can be utilized with the information model ((ID $9-11$) in Table \ref{tab:classical_metrics}). These novel and modified metrics are illustrated in greater detail in the Appendix. \subsection{knowledge graph builder for cyber-physical systems} \label{sec:knowledge_graph_builder} \begin{figure}[!htb] \includegraphics[width=\columnwidth]{images/12_system_layout.pdf} \caption{Privacy-preserving and human-supervised knowledge graph builder for crowd-sourcing knowledge graphs in cyber-physical systems. It consists of a link prediction method, knowledge graph visualisations, a feedback mechanism, and metric dashboard.} \label{fig:system_layout} \end{figure} The knowledge graph builder consists of the link prediction method, a feedback mechanism called tinder view, knowledge graph visualizations, and a metric weight dashboard. They are integrated into users' daily life by deploying the builder as a mobile application on users' phones, as depicted in Figure \ref{fig:system_layout}. The user can supervise the link prediction method by giving feedback via the tinder view as depicted in Figure \ref{fig:tinder}. In this way the completion of the knowledge graph happens in a supervised way: links are recommended by the algorithm and final decisions for their acceptance or rejection are performed by the users which is a necessary condition for users' autonomy \cite{crisp1987persuasive}. Based on this supervision (information about existing and non-existing links), weights of the link prediction methods are updated, as illustrated in Section~\ref{sec:algorithm}. In particular, by utilizing this evaluation strategy that is considered as the \textit{gold standard} in validation \cite{paulheim2017knowledge}, the builder continuously collects information about non-existing links that are utilized in the training set construction of the genetic programming. The obtained weights are presented to the users in the metric dashboard. Moreover, users can adjust the metric weights in the dashboard and thus control the link prediction mechanism. Moreover, they can learn how the algorithm is configured and thus reason about link predictions. Finally, as the data and algorithms are deployed locally without the requirement to communicate with a centralized server, the privacy of the users is preserved. In particular, no information about the metric weights or the knowledge graph are revealed to third parties. \begin{figure}[!htb] \includegraphics[width=\columnwidth]{images/8_tinder.png} \caption{Illustration of the feedback mechanism, as presented to the experiment participants. Links can be rejected or accepted by swipes. In the example, the user is asked if the contact Alex Bachler is connected with Cathy Zelkowsk. Any instance of the knowledge base such as bus stops or cities could be presented instead of a contact.} \label{fig:tinder} \end{figure} \section{Experiment Methodology} \label{sec:methodology} The knowledge graph builder is evaluated by a social experiment. Additionally, the system is utilized to investigate the performance of various similarity metrics to predict links. In the following, the methodology of the experiment is illustrated. In particular, hypotheses are introduced (Section \ref{sec:hypotheses}), the data schema is illustrated (Section \ref{sec:schema_utilized}) and the experiment execution is illustrated (Section \ref{sec:experiment_methodology}). \subsection{Hypotheses and Operationalisation} \label{sec:hypotheses} \subsubsection{Knowledge graph builder} \label{sec:hyp_decision_support} The usability of the knowledge graph builder and its accuracy in predicting unobserved links in a knowledge graph is investigated by the following hypotheses: \paragraph{The knowledge graph builder improves the accuracy of link prediction compared to the baseline heuristic} The knowledge graph builder utilizes a genetic programming approach to estimate the weights of various similarity measures (Table \ref{tab:classical_metrics}). These weights are then utilized to improve the accuracy in link prediction of the baseline method (Figure \ref{fig:transparent_link_prediction} and Algorithms \ref{eq:candidate_set_existence} - \ref{eq:candidate_set_type}) Both methods are evaluated in the following way: Users rate link suggestions (true/ false) via the feedback mechanism (Section \ref{sec:knowledge_graph_builder}) of the knowledge graph builder. One-third of these suggested links are drawn randomly from the baselines candidate set and two-third are taken from the highest-ranked results of the link prediction method (Figure \ref{fig:transparent_link_prediction}). The accuracy in the form of true positives is then evaluated. \paragraph{The knowledge graph builder is usable measured in terms of user interaction} As reasoned in Section \ref{sec:introduction}, the success of CPSS is dependent on its usability for humans. The usability of the knowledge graph builder is measured by analyzing the frequency with which users utilize the feedback mechanism of the knowledge graph builder to train the link prediction method. \subsubsection{Metric weights} \label{sec:hyp_metric_weights} The dominance of different metric weights is investigated by the following hypothesis. \paragraph{A combination of metrics compared to a single metric increases the accuracy of link predictions} It is known from link prediction in energy grids that not all metrics show the same performance. Moreover, often the combination of several metrics outperforms a single metric \cite{mei2011power}. Hence, likewise, it is assumed that also in knowledge graph completion a combination of metrics increases the accuracy of predictions compared to single metrics. The hypothesis is evaluated by analyzing the final metric weights obtained from genetic programming. Assuming that genetic programming maximizes accuracy, a single metric is dominant if its weight is close to one and those of all other metrics are zero. \paragraph{Semantic and temporal metrics improve the link prediction performance} Leveraging semantic and temporal information increase link prediction performance compared to a scenario that utilizes only topological information (Section \ref{sec:related_work}). This is evaluated by analyzing the metric weights obtained by the genetic programming algorithm. In particular, the weights of temporal and semantic metrics are compared to those of topological metrics. \subsection{Knowledge graph instantiation: Model and schemas} \label{sec:schema_utilized} \begin{figure*}[!t] \centering \includegraphics[width=1.0\textwidth]{images/Data_process.pdf} \caption{Instantiation flow of knowledge graph utilized in the mobile application for the experiment. } \label{fig:data_flow} \end{figure*} The data model of the knowledge graph is a directed graph, as illustrated in Section \ref{sec:linked_graph}. Figure~\ref{fig:data_flow} depicts the instantiation flow of the data model: In a first step existing ontologies such as friends of a friend\footnote{Ontology that defines people related terms suitable for storing generalized user profile data, as well as social friendship relations \cite{friedman2015privacy}: http://www.foaf-project.org/ (last accessed: May 2020).} are merged in Protege\footnote{A free, open-source ontology editor and framework for building intelligent systems that uses the owl schema and is developed by the University of Stanford: http://protege.stanford.edu/.} and extended with relation identifiers and concepts illustrating a city. In particular, in order to support users completing their existing knowledge graph within the cyber-physical system of a smart city, relation identifiers (e.g. the visit relation), and concepts (e.g. bus stops) illustrating a city are added. In order to automate the process of storing information on an android mobile phone that utilizes SQLite\footnote{C-language library implementing a SQL database: https://www.sqlite.org/index.html (last accessed: May 2020).}, a relational data schema in MySQL workbench is created that is populated with the data from Protege. This data is extended with information from Open data Zurich illustrating tram and bus stops in Zurich (e.g., the geo-locations). Finally, this data is exported to users' phones where the data is extended with personal contact book information of each user resulting in a personalized knowledge graph illustrating the users' social contacts in the city of Zurich. This approach preserves a user's privacy as all personal information is stored locally on users' phones. \subsection{Setup} \label{sec:experiment_methodology} \begin{figure}[!htb] \includegraphics[width=\columnwidth]{images/1_experiment_setup_2.png} \caption{Three phases of the conducted experiment in which the users participated.} \label{fig:experiment_phases} \end{figure} \label{sec:process} The experiment has an execution time of one week (17.08.2017 - 23.08.2017) and consists of three phases as depicted in Figure \ref{fig:experiment_phases}. The eleven participants are recruited by convenience sampling. In the initialization phase, users obtain a welcome email that contains detailed experiment instructions and which can be found in the Supplementary material. In the experiment phase, the users utilize the feedback mechanism and knowledge graph view of the knowledge builder (Figure \ref{fig:system_layout}) to complete their knowledge graph and to supervise the link prediction method. In the exit phase, users export their knowledge graph via an export button and send it by mail to the instructors of the experiment. During the export process, all personal data of the users are anonymized. \section{Experimental Evaluation} \label{sec:evaluation} By investigating the Hypotheses of Section \ref{sec:hypotheses}, both, the accuracy and usability of the knowledge builder (Section \ref{sec:eval_knowledge_builder}) as well as the capability of metrics to recommended unobserved links are analyzed (Section \ref{sec:eval_metric_weights}) in the following sections. \subsection{Knowledge graph builder} \label{sec:eval_knowledge_builder} \begin{table} \caption{True and false positives of the genetic and baseline prediction methods.} \label{tab:link_pred_comparison} \centering \begin{tabular}{ lll} \toprule positive &\textbf{genetic} & \textbf{baseline}\\ \midrule true & 0.2788 & 0.1220 \\ false & 0.7212 & 0.8780 \\ \bottomrule \end{tabular} \end{table} Table \ref{tab:link_pred_comparison} depicts the true (TP) and false (FP) positives of the genetic link prediction method compared to the baseline. The accuracy of the method is $27.9 \%$\footnote{In contrast to typical application scenarios in which recommender search spaces are small (e.g. types of pasta in a supermarket), the search space of the experiment is large consisting of every possible link between any two nodes in the knowledge graph. Hence, this larger search space size could explain the lower TP probability of the applied method when compared to the performance of recommender systems in other typical scenarios. Also, a cold start of the algorithm is applied which initially can lower the TP probability and which could be analyzed in future work by extending the study period of the experiment.} and of the baseline is $12.20 \%$. \begin{table} \caption{The table depicts the amount of feedback a user provided via the feedback mechanism of the knowledge graph builder, the true positives of the genetic approach, the true positives of the baseline method and the fraction of true positives.} \label{tab:link_pred_comparison_detailed} \centering \begin{tabular}{ lllll} \toprule \textbf{user} &\textbf{\#feedback}& \multicolumn{2}{c}{\textbf{true positives}}& \textbf{fraction}\\ &&genetic & baseline& \\ \midrule ex10 & 614 & 0.2822 & 0.1852 & 1.5420 \\ ex2 & 675 & 0.2109 & 0.1259 & 1.6756 \\ ex6 & 983 & 0.1913 & 0.0787 & 2.4312 \\ ex5 & 1053 & 0.1554 & 0.0772 & 2.0123 \\ ex14 & 1081 & 0.1837 & 0.1338 & 1.3727 \\ ex13 & 1364 & 0.1987 & 0.1561 & 1.2728 \\ ex4 & 2573 & 0.3392 & 0.1240 & 2.7350 \\ ex3 & 2668 & 0.1458 & 0.0451 & 3.2336 \\ ex11 & 4450 & 0.2154 & 0.0833 & 2.5867 \\ ex7 & 6342 & 0.3533 & 0.1436 & 2.4599 \\ ex9 & 7091 & 0.3247 & 0.1508 & 2.1536 \\ \midrule \textbf{Average} & 2627 & 0.2364 & 0.1185 & 2.1325 \\ \bottomrule \end{tabular} \end{table} Table \ref{tab:link_pred_comparison_detailed} depicts the true positives on user level. For all users, the genetic link prediction method outperforms the baseline heuristic. On average, the link prediction method outperforms the baseline overall experiment participants by a factor of $2.13$. Moreover, the figure also depicts the number of evaluated links per user. On average, a user evaluates 2627 links. Assuming a time of five seconds for a user to evaluate a link, users spent on average $3.6$ hours evaluating links which indicates, considering that the utilization of the feedback mechanism is not incentivized, that the feedback mechanism is practical. \begin{figure}[!htb] \centering \subfigure[CDF of existing and non-existing links illustrating the attained larger similarity values of existing links when compared to non-existing links.]{ \includegraphics[width=0.48\columnwidth]{images/4_cumulative_existing_non_exisiting.pdf}\label{fig:4_density_similarity_per_feedback}} \subfigure[Average time required to calculate the weights of Equation \ref{eq:linear_combined_similarity_metrics} by genetic programming algorithm (Algorithm \ref{eq:geneticProgramming})]{ \includegraphics[width=0.48\columnwidth]{images/5_average_calculation_time.png}\label{fig:average_calculation_time}} \caption{} \label{fig:metric_top_error} \end{figure} Figure \ref{fig:4_density_similarity_per_feedback} illustrates the cumulative distribution function~(CDF) for similarity values of links that have been evaluated as existing~(1) and non-existing~(0) by the users. One notices, that an existing link has a higher probability of having a high similarity value than a non-existing link and that in turn, non-existing links have a higher probability for low similarity values. Thus, the knowledge builder assigns higher similarity values to existing links than to non-existing links which indicates that the knowledge builder distinguishes between existing and non-existing links. In the experiment, always the top-ranked results of the candidate set are recommended to the user. In particular, no threshold in the form of a specific similarity value is utilized that would prevent recommendations of links in case the candidate set consists entirely of non-existing links having low similarity values. In future work, such a threshold could be introduced to achieve higher true positives probabilities by removing those links automatically from the recommendations that have a low similarity value. Figure \ref{fig:average_calculation_time} depicts the average time genetic programming requires to recalculate the weights for the existence and semantic prediction on users' phones (Equation \ref{eq:linear_combined_similarity_metrics}, Section \ref{sec:obtaining_weights}). The weight calculation for the existence prediction takes on average 7.5 minutes and for semantic 17.5 minutes. As the weights are recalculated on average every two hours to account for new user feedback, it is concluded that the deployment of the knowledge graph builder on users' phones is feasible. \subsection{Metric weights} \label{sec:eval_metric_weights} \begin{figure}[!htb] \includegraphics[width=\columnwidth]{images/7_heat_map_all_metric_similarity.pdf} \caption{Weights of utilized similarity averaged over all experiment participants, the top 4 and top 2 participants by amount of collected feedback at the end of the experiment phase} \label{fig:heat_map_all_metric} \end{figure} Figure \ref{fig:heat_map_all_metric} depicts the utilized metrics, their weights averaged over all experiment participants, and by total amount of collected feedback the top 4 and top 2 participants. In the case of existence prediction, a combination of topological (Shortest path), semantical (AORelation), and temporal (OneDayEps) metrics are dominant to predict links. In semantic prediction, shortest path dominates the ensemble of deciding metrics. Nevertheless, also other topological metrics (hub promoted, Edge dimension connectivity), semantic (Conditional probability), and temporal (Oneday eps, half day eps) metrics contribute significantly to the predictions. In none of the scenarios (top 2, top 4, all users) a single metric is found to determine alone the link prediction. Nevertheless, in both types of predictions, the shortest path shows a large dominance when compared to the other metrics. In particular, for both ensembles, a hierarchy can be observed in the dominance of the metric weights: Temporal metrics have lower weights. An explanation for this is that due to the short time period of the experiment (seven days) temporal patterns could not be sufficiently observed and learned. Moreover, in the case of existence prediction, an increase in the number of supervisions results in lower dominance of the shortest path and an increase in importance of semantic and temporal metrics. Both observations indicate that the algorithm is challenged by the cold start and that its performance could be improved when the study period is extended. \section{Summary of findings} \label{sec:summary_of_findings} The key findings of the performed experiment are summarized as follow: \begin{itemize} \item The knowledge graph builder is practical. In particular, its usability is indicated by the large number of supervision actions performed by users and its feasibility to run locally on users' phones. \item Optimizing the weighting of diverse similarity metrics for link prediction with genetic programming outperforms a baseline heuristic with regard to accuracy. In particular, links with a higher similarity value are recommended to the user which improves the acceptance of predicted links. \item An ensemble of semantic and temporal metrics are identified that dominate link prediction in a smart city application domain. This confirms findings from the literature that an ensemble of metrics can outperform a single metric. \item The novel metric AOrelation is dominant in the evaluated link existence prediction scenario. \end{itemize} In a nutshell, the findings demonstrate that the contributions of this paper support the domain-independent building of scalable and trustworthy knowledge graphs. In particular, the automation scales up the building process by suggesting links of high similarity accurately to users. The local human-supervision, which is considered as the gold standard in knowledge graph evaluation \cite{paulheim2017knowledge}, facilitates trust in the constructed knowledge graph. And the learning of underlying mechanisms that guide link formation in knowledge graph in the form of dominant metric weight ensembles indicates that the knowledge graph builder can be applied domain-independently to novel applications. \section{Conclusion and Future Work} \label{sec:conclusion} This paper argues that an accurate and automated knowledge graph builder for cyber-physical-social systems can be constructed that accounts for values such as privacy-preservation and accountability. By applying a value-sensitive design approach a system is designed that builds knowledge graphs automatically while remaining accountable to humans via local human supervision and thus can be applied effectively to novel application domains such as smart cities. In particular, localized supervision is considered as the gold standard in knowledge graph evaluation and thus increases the trust in the constructed graph, while the automation facilitates the scalability of the building process. This is evaluated by a methodology that integrates the constructed system into users' daily lives. The results point to various avenues for future research. First, the identification of dominant similarity metrics in a smart city application scenario suggests to further investigate these metrics in varying application domains. In particular, the domain-independence of the knowledge graph builder could be further demonstrated. Second, several machine learning models utilized in automation are not explainable~\cite{ribeiro2016should} which limits users' trust \cite{friedman1997software}. The transparent display of metric weights in the metric dashboard of the knowledge graph builder could be a basis for the explainability of recommended links. In particular, a user could reason why a link was recommended based on the observed metric weights. Third, the participant field of the user study and the time frame of the experiment could be enlarged to add significance to the identified findings, reduce the cold start problem and identify further temporal patterns which could improve the recommendation accuracy. Finally, the parameters of the knowledge graph builder could be fine-tuned by a meta-optimization strategy to improve the prediction accuracy. \section{social system} \section{Experiment instructions} \label{sec:instructions} In the following the instructions as received by experiment participants is displayed. \cleartooddpage \includepdf[pages=1-, scale=0.9]{resources/Instructions_t_final.pdf} \end{document}
\section{Introduction} The demand for medical and healthcare professionals continue to rise as the overall world population continues to increase. This demand is further increased when pandemics such as the SARS-CoV-2 outbreak, also known as the coronavirus disease COVID-19, occurs. The problem is that there is and may always be a shortage of especially medical practitioners due to challenges and barriers that exist to make it difficult for individuals to become physicians or surgeons. Even if there were sufficient medical practitioners, the other problem is the lack of resources that hospitals and institutions alike possess. Given that resources are already a problem for hospitals, having sufficient clinicians would only make that worse. With recent advances in neuroscience and neurotechnology paving ways to innovative applications that cognitively augment and enhance humans in a variety of contexts, a solution to this would be to use neurotechnology to augment the cognition and senses of medical practitioners to then augment their actions [13]. In doing so, this will allow them to make optimal decisions and actions in less time, enabling them to treat more patients. As such, this makes the solution along with the research and discussions pertaining to it highly important as not only does the solution impact directly impact physicians and surgeons, but it also directly impacts patients as well. Additionally, as with any technological intervention, it is important that not only are the technical aspects of the intervention are analyzed and discussed, but the ethical aspects are as well. In approaching this technological intervention, we performed an ethical analysis on the application of neurotechnology for human augmentation in physicians and surgeons, and found that even in the best-case scenario, applying neurotechnology for human augmentation in physicians and surgeons has a significant negative impact on individuals, communities and countries. \\ \\ In this paper, we argue that applying neurotechnology for human augmentation to augment physicians and surgeons, and can cause personal identity, discrimination and financial issues for physicians and surgeons, and lead to patients being harmed. The way that the paper is structured is as followed: we first describe the augmentations and neurotechnologies that can be used to achieve the relevant augmentations for physicians and surgeons, then review selected ethical concerns discussed within literature particularly focusing on human rights, human-computer interaction, data, brain-computer interface, global bioethics and drug development, and discuss the neuroengineering behind using neurotechnology for augmentation purposes. We then conclude with an analysis on outcomes and ethical issues of implementing human augmentation via neurotechnology in medical and surgical practice. The ethical analysis specifically focuses on social issues, global health inequality and health migration, and patient harm, and includes an assessment on personhood with respect to the neurotechnology users (i.e. the physicians and surgeons). In this paper, we assume that all neurotechnologies mentioned always succeeds in providing a person with augmentations, but the type of augmentation provided by a neurotechnology is based on what its capable of. The motivation behind this assumption is to allow the paper to address a possible best-case scenario with neurotechnology and human augmentation in physicians and surgeons, and focus on ethical issues that arise with this scenario. \section{Human Augmentation and Neurotechnology} \subsection{Types of Augmentations} Human augmentation can be formally defined as an interdisciplinary field that addresses methods, technologies and their application for enhancing cognitive abilities, senses and actions of humans [32]. In enhancing these leads us to augmented cognition, augmented senses, and augmented actions. Augmented senses focus on enhancing one’s ability to see, hear, smell, taste and touch. Augmented cognition focuses on enhancing one’s memory (short-term and long-term), attention, learning capabilities, awareness, and knowledge. Augmented action can be broken down to two parts: motion augmentation and gesture augmentation. Motion augmentation would simply be improving one’s ability to move, enabling them to take actions that they may not normally be able to do such as carry very heavy objects or run at a faster speed. Gesture augmentation is similar to motion augmentation, except that it focuses more movement and positioning of one’s hand and head. For instance, being able to keep your hand in a specific position for a long amount of time without fatigue and shaking would be considered augmented gesture and not motion augmentation. The end goal of both augmentations is that the augmentation should allow the person to perform an action optimally. From all the augmentations mentioned, we will only focus on augmented senses (specifically augmented vision and augmented touch), augmented cognition, and augmented action (specifically augmented gesture). The motivation behind these augmentations in particular is because these augmentations best allow physicians and surgeons to better diagnose and treat diseases and disorders. \subsection{Augmentations Through Neurotechnology} From current technologies that are being developed, one such technology that can be used to obtain these augmentations is neurotechnology. Neurotechnology can be formally defined as an interdisciplinary field that combines neuroscience, engineering and technology to create technical devices that are interfaces with human nervous system. Within literature on neurotechnology, there has been a considerable amount of work carried out on neurotechnologies for cognitive enhancement, specifically focusing on brain-computer interface (BCI), also known as neuroelectronic interface [2], applications. Based on previous studies, neurostimulation techniques, such as transcranial electric stimulation (tES) and transcranial magnetic stimulation (TMS), can be used to improve performance in different cognitive domains; these cognitive domains include perception, learning and memory, attention, and decision-making [13]. Accordingly, this can be used to accomplish augmented vision and part of augmented cognition. Neuromodulation techniques, such as transcranial direct current stimulation (tDCS), can also be used for memory, learning and attention [13]. Specifically, for tDCS, studies have shown that it could improve performance in verbal problem-solving task and other areas within complex problem solving [13]. This allows for further enhancement of specific cognitive domains, as desired. \\ \\ To address augmented touch while also addressing augmented action, a combination of tactile sensors and neuroprosthetics. Tactile sensors allow for perceiving the location of the point of contact, discerns surface properties, and detection for eventual slippage phenomena during the grasping and handling of an object [11]. Neuroprosthetics are devices that can enhance the input and output of a neural system [5]. Combined together, they can allow for augmented gesture through enhancing the person’s dexterous interaction with objects by ensuring that there is a correct application of forces between the contact surfaces of the person’s hand and fingers and those of the object, and having the neuroprosthetic distinguish brain activity patterns corresponding to the intention to act from control signals of the hand itself [38]. To summarize, the neurotechnology that can be used to accomplish the augmentations of interest is neurostimulation, neuromodulation, tactile sensors and neuroprosthetics. How each of these neurotechnologies accomplish augmentations will be discussed later in the paper when We discuss how neurotechnology can be applied in medical practice. \section{Ethics in Neurotechnology and Human Enhancement} \subsection{Human Rights in Neurotechnology} While neurotechnology has the can help achieve human augmentation, it also has the potential to impact human rights [22]. Three of the areas which neurotechnology is said to impact is the right to mental integrity, freedom of thought, and freedom from discrimination. The right to mental integrity is a concern with neurotechnology due to the problem of malicious brain-hacking. Malicious brain-hacking is defined as the neuro-criminal activities that directly influence neural computation in the users of neurotechnological devices in a manner that resembles how computers are hacked in computer crimes [22]. For BCI applications, malicious brain-hacking can take place within BCI through having the malicious agent (e.g. hacker) attack the level of measurement or decoding and feedback of the BCI, or through the malicious agent manipulating the person’s neural computation through the BCI application. In such cases, the malicious agent can add noise or override the signals sent to the neurotechnological device with the objective of reducing or removing the control of the user over the BCI application [22]. Furthermore, the malicious agent can also hijack the BCI user’s voluntary control. For instance, a malicious agent can override the signals sent from a BCI user, then hijack a BCI-controlled device (e.g. smartphone) without the BCI user’s consent [22]. Ultimately, what results from malicious brain-hacking is both the user’s mental privacy and their brain data being at risk due from the loss of right to mental integrity. The loss of right to mental integrity leads to the loss of freedom of thought as when malicious brain-hacking occurs, the BCI user is no longer able to freely think of things due to the restraint placed by the malicious agent. \\ \\ One other human rights issue with neurotechnology is one that overlaps with a health rights issue from human enhancement. The ethical issue from human enhancement pertains to how the ability to augment one’s physical or mental performance raises several issues about fairness and justice regarding how augmenting technologies, such as neurotechnologies, should be accessed or regulated [20]. What follows from this is the question of whether they are intended for mass consumption or restricted to humans with identifiable impairments and disabilities. In the case where neurotechnologies are intended for mass consumption and becomes commercialized, as with any other technology, it will likely be expensive at the beginning [20]. Consequently, this could generate and even exacerbate societal divisions among the population or among inhabitants of different countries [20]. Those of a low socio-economic status would not be able to afford to purchase neurotechnologies. Subsequently, a digital divide is created between those that can afford neurotechnology, and those that cannot. This leads to health right issue as the digital divide creates an injustice to those of low socio-economic status that cannot afford neurotechnology; they are indirectly being deprived of something that is needed for their health and wellbeing. With the relationship between poor mental health and the experience of poverty and deprivation being well studied and an association between the two factors being established, communities deprived of neurotechnology can cause those communities to experience higher levels of deprivation and unemployment rates, leading to them experiencing higher rates of psychiatric admissions for psychotic as well as non-psychotic conditions and suicidal behavior [27]. \subsection{Discrimination from Augmentation} The ongoing human rights concern regarding neurotechnology an freedom from discrimination is that the use of neurotechnology will lead to discrimination among individuals and groups. This concern is not only one that is valid, but also strong evidence to support it. Throughout history, humans have shown that existing moral code is often broken in practice, and that observable differences between people, such as differences in race, gender, ethnicity, religion, sexual orientation and/or ability, tend to lead to moral and social inequalities [7]. Given that there will be a clear difference between those that adopt augmentation technologies and those that do not and the actions that humans have taken in the past and continue to take to this day, it is very likely that human augmentation will lead to new, unjustified inequalities, and may even undermined the core notion of moral equality used in Western societies [7]. Expanding on the unjustified inequality, there is a growing concern regarding how new human augmentation technologies can weigh more than personal experiences and benefits [32]. Due to the cognitive enhancement that augmentation technologies provide, those that utilize them will have a stronger say on matters than those that rely solely on their personal experiences and benefits. Also, there is a concern that neglecting potential negative effects of such technologies to daily life and society can create problematic scenarios for the future [32]. One such potential negative side effect comes from the pressure in adopting augmentation technologies. For a long time and even now, people frequently experience prejudice if their bodies or brain function differently from those around them [40]. With the integration of augmentation technologies such as neurotechnology within society, this will lead to people feeling pressure to adopt those technologies, and is likely to lead to change societal norms. In turn, this will lead to issues of equitable access and generate new forms of discrimination [40]. \\ \\ To describe the forms of discrimination, we refer to self-identity, industry practice, and history. In self-identity, moral and social importance plays a crucial role in how one people feel about themselves, and it plays a strong role in determining people’s intentions, attitudes and behaviors [7]. Consequently, a poorly developed self-concept could bring about low self-esteem, level of confidence, purpose and reason to live, and level of motivation. With groups and communities determining collectively how one is treated by others, poorly formed self-concept could make one subject to discrimination. Within industries, the discrimination can take place as earlier as the job application process to later while the person is employed with the company. In industry practice, it is common for companies to hire the person that they think are best for the position. With neurotechnology providing its users with augmentations, a complaint regarding this is that this provides those people with an unfair advantage that will allow them to secure jobs more easily, and that those that are augmented may view those that are not augmented as inferior. This unfair advantage can lead to discrimination within industries through employment. \\ \\ The unfair advantage from augmentations can have serious implications in the workplace especially once employers, administrators and decision-makers realize that those with augmentation perform better than those without them [10]. The realization will likely lead to them having a preference for those with augmentations and a bias against those that do not have any augmentations, leading to things such as them inquiring beforehand (or on the job for current employees) whether an applicant has undergone an augmentation or utilizes neurotechnology, and making decisions simply based on this information along with selected other pieces of information from the applicant (or employee). This can lead to prejudice, resulting in non-augmented people being discriminated against, creating justice and equity issues. Note that this type of discrimination is not limited to employment settings, and extends as far as in areas such as families and academic institutions. Between children, parents will give preference to the child that performs best academically and professionally. Similarly, with academic institutions, the institutions will prefer and reward those that perform best academically, and treat those that perform best academically better than those that perform worse regardless of whether they have undergone any sort of augmentation or not. We know this as in many academic institutions, if students do not perform well enough academically, they are either removed from their program, suspended or both, and those that perform well academically are rewarded awards, research and other opportunities, and scholarships. As a result, in the long-term and possibly even in the short-term, the implications from the unfair advantage from augmentations can lead to a collapse in the social process of education, care, interactions, relationships and more as impartiality, open-mindedness, nondiscrimination, acceptance, and unbiasedness would be minimized or lost completely in some groups and societies. \\ \\ With neurotechnology and human enhancement possibly being enjoyed by the already privileged, if this possibility is realized, then this will lead to a failure of distributive justice [18]. Of all communities, marginalized communities will suffer the most from this failure. A major challenge experienced by underprivileged communities comes from the fact that not only are they are often excluded from opportunities, health services, development programs, resources and more, but they often struggle to raise their voice in public discussions due to the lack of access and autonomy [4]. As a result, underprivileged communities, including women, LGBTQ groups, refugees, people with physical or mental disabilities, people of low socio-economic status, and those that are less educated are often ignored, deprived, or discriminated [4]. Among them, marginalized groups in those communities are even more deprived, which this deprivation are sometimes due to their physical or economic vulnerabilities, or various social and cultural practices [4]. For example, in multiple places in the Indian subcontinent, women are not allowed to use mobile phones due to social and cultural reasons [4]. Consequently, this deprivation prevents them from obtaining the benefits from it - one of them being that it can be used to cope with everyday stress [28]. In the case where the group of Indian women were members of the LGBTQ group, this deprivation of technological device can further negatively impact their mental health. LGBTQ people have and continue to experience various forms of oppression and discrimination worldwide [21]. The oppression is in the form of harassment and violence while the discrimination is experienced in areas such as employment, housing, access to education and human services, and the law. This oppressions and discrimination along with rejection, violence and harassment have been shown to have negative physical and mental health effects on both LGBTQ people [21]. Combining the primary societal stressors that many LGBT people experience, that lead to “minority stress” [21], with deprivation of mobile phones leads to those Indian women having less effective coping mechanism options which are needed to deal with both everyday stress and minority stress. Consequently, this results to there being major mental health disparities between those Indian women within the LGBTQ population and other individuals. From just the transgender individuals alone, the mental health disparities can be severe enough to the point where the difference is that those individuals have higher odds of depression symptoms and attempted suicides [39]. What the failure of distributive justice will likely do is aggravate the everyday stress and minority stress experienced by this marginalized group and others to an extent where the majority of of the marginalized population will show depression symptoms, and a substantial amount of them may even commit suicide. As such, the already marginalized communities will suffer more than they already are. The repercussions of this will have negative impacts on both a local and global level. \subsection{Autonomy and Brain Data} Neurotechnology not only has the potential to impact human rights, but is can also impact autonomy, confidentiality and protection. Note that it is possible to obtain information through BCIs that can be extracted to reveal security breaches [26]. Neurotechnology such as BCI relies on multiple types of probabilistic inference to be operationalized, for one to use any sort of probabilistic inference requires a large amount of data [19]. This data, consisting of neural information, is of high value to companies and individuals as neurotechnology produces raw data in a way that enables a more direct detection pathway of the neural correlates of mental processes, such as interests, intentions, mood and preferences [23]. Additionally, the neural data includes rich and personally identifiable sources of information that could be aggregated by data handlers to apprehend or predict parts of health status, preferences and behavior [23]. An example of where neural information would be very useful is marketing and advertising. The field of marketing has been interested in BCI research as they are interested in utilizing a neuromarketing-based approach to marketing and advertising [3]. Algorithms that are designed and used to target advertising can better calculate things like insurance premiums through using neural information [40]. Accordingly, investment in neural data (and computer scientists) is something that marketing firms are striving to acquire, heavily investing time, effort and money to obtain it. \\ \\ Given the value of neural information, these motivate malicious agents, companies and corporations to perform malicious brain-hacking, or retrieve, aggregate disseminate and use the information of the neurotechnology users without their informed consent. In the case of malicious brain-hacking, after a malicious agent has successfully hacked a device, rather than changing signals or taking control, they can instead extract the data from the device, then abuse to them to as they desire. Similarly, for companies and corporations behind a neurotechnological application, they can either take the data collected from the neurotechnology users as hostage of the users or sell the data to another entity or individual, with the purpose of making more money. This has several consequences, including loss of ownership of one’s own data, loss of privacy, increase in level of distrust, data used against them (e.g. for insurance purposes), Furthermore, with the malicious hacker or entities not getting the consent from the users to take and sell their data, the autonomy of the users is not respected. \subsection{Global Bioethics and Drug Development} The aftermath from a situation of malicious brain-hacking, neural data hostage, or neural data sharing does not just impact an individual, but it impacts society altogether. However, of the three, We will focus on neural data sharing, continuing the discussion from the point where what can occur after an individual, corporation, or organization has obtained neural data as this is one of the biggest concerns expressed within literature due to the impact that neural data sharing has on society at large. What a person or entity will do with the neural data is difficult to determine. However, it is easier for us to get a sense on what some individuals and companies will do with the data compared to others. With the advances in artificial intelligence and machine learning, when combining learning algorithms with brain data obtained through BCI or other neurotechnologies, they can lead to fruitful results for things such as drug development. However, using BCI for drug development is not a simple task. Contemporary drug discovery strategies rely on the identification of molecular targets associated with a specific pathway and subsequently probe the role of a given gene product in disease progression [6]. Subsequent to the identification of a relevant bioactive compound, further compound screening can be achieved through phenotypic screens. With phenotypic screens, they are capable of capturing complex cellular level behaviors that are physiologically relevant and central to a pathology without relying on the identification of a specific drug target or a corresponding hypothesis concerning its pathological role [6]. For that reason, phenotypic screens are gradually becoming more utilized in drug discovery as using a phenotypic approach can generate novel treatments for diseases and disorders which have either complex or unknown mechanisms [6]. When using a phenotypic approach onto a nervous system, it provides a way to find compounds and genes active in a nervous system without assumptions about relevant molecular targets, which can possibly lead to new therapeutic targets, new disease biology, and new compounds or genes [14]. The challenge is that phenotypic screens require a quantifiable phenotypic alteration, such as neuronal survival or changes in fluorescently tagged protein expression in order to generate a usable output [14]. Conveniently, BCIs can provide brain data containing neuronal survival [2]. With BCIs being able to extract quantifiable phenotypic alteration and classification algorithms being able to understand BCI’s messages, we can conclude that pharmaceutical companies that purchased neural data will most likely use it with a phenotypic approach to discover, develop and patent new generic drugs. The problems that follow this are societal and global health issues. \\ \\ In the past, pharmaceutical companies have consistently argued that high prices and multilateral patent protection afforded by Trade-Related Aspects of Intellectual Property Rights are reasonable rewards for highly expensive and often fruitless research and development of pharmaceutical products, which are ultimately of benefit to society [9]. Furthermore, with pharmaceutical research and development costs being substantial and given the low success rates, pharmaceutical companies argued that profits from the few successful products are essential [9]. Consequently, the problem with pharmaceutical companies researching and developing drugs using neural data and phenotypic approach is that it will likely be very expensive as not only will the companies have to pay a price for conducting and developing the drug, but they also have to pay a price for neural data based on the price set by the third party. For them to generate the data can be even more costly for them as on top of cost associated with conducting data collection, hardware costs from neurotechnologies and costs associated with data preprocessing and augmentation will need to be included in the total cost. Furthermore, with patented drugs preventing others from making or using the generic drug without obtaining a license from the patent holder, most pharmaceutical companies refuse to grant licenses so they can benefit from having a limited monopoly on the drug [33]. As a result, not only will they likely enforce their patents on those generic drugs, but there is a chance that they will also charge a hefty amount for those interested in purchasing the license for it for therapeutic purposes. In turn, this will lead to affordability, accessibility and health issues experienced by the portion of the population unable to afford the drugs. On a global level, with the pharmaceutical companies enforcing their patents, this will prevent developing countries from manufacturing the generic versions of those drugs, creating affordability, accessibility and health issues experienced by those countries [8]. \\ \\ While it was easy to attempt to determine how pharmaceutical companies will neural data, in the case of the military, for example, is not as obvious. The US Department of Defense, for instance, is currently exploring the use of neurotechnologies and neural data [26]. It is said that in pursuing neurotechnology, they are using it with the goal of restoring function following trauma from war and to develop programs involving improving human training and performance [26]. From a first glance, it seems that they are doing it to help better those within the military recover or become a better version of themselves. However, from a closer look, this can be seen as the military trying to get an advantage over other countries [26]. To make neurotechnologies’ use more extreme, yet more effective for the military and even politicians and corporations such as those that sell firearms, exploration of neurotechnologies such as brain implants by the military can be used in a way that create a potential for terrorism [32], leading to beneficence issues. This is an issue as this indirectly promotes warfare between countries, which the consequences from any sort of warfare which neurotechnology contributed to includes an increase in casualties, environmental damage, loss of resources and infrastructure, psychological and neurological disorder cases, loss of talent, and more. These casualties and other losses are a major injustice to the innocent civilians caught in the middle of the warfare [31]. \section{Augmentation of Physicians and Surgeons} \subsection{Neuroengineering for Augmentations} Before moving onto how neurotechnology can be applied to medical practice, it is important to have a foundational understanding of how the neurotechnologies that were mentioned earlier accomplish their respective augmentations. How neurostimulation techniques accomplishes enhancing perception, learning and memory, attention, and decision-making within a person is by using invasive or non-invasive electrical stimulation systems on the person [17], to then apply electricity to affect the person’s central nervous system [37]. Similarly, how neuromodulation accomplishes enhancing memory, learning, attention and complex problem solving within a person is by sending electrical or pharmaceutical agents to a target area of the person’s brain to alter nerve activities [24]. While there are several types of tactile sensors, the tactile sensor that would be best for achieving augmented touch and augmented action is a tactile sensor using CNT-based nanocomposites because not only are they mechanically flexible, robust and chemically resistant needed to achieve the flexibility of human skin, but they also require lower conductive phase concentration, which leads to better mechanical properties of the composite [12]. The tactile sensors would be placed onto a sensor glove, then worn by the user. \\ \\ The way they work in achieving augmented touch is through optimizing the use volume changes in sensitive materials to detect pressure [12], in a way that allows the tactile sensors to be capable of [11]: (1) evaluating mechanical compliance and surface texture properties of objects; (2) sensing an applied force by evaluating the magnitude and direction; (3) spatially discriminating the point of application of a force; and (4) Emulating the dynamic behavior of human mechanoreceptors while tracking tactile stimuli overtime. Furthermore, the design criteria for the tactile sensors must consider spatial resolution and range of applied force in order to properly achieve augmented touch [12]. Accordingly, neuroprosthetics accomplishes augmented gesture and augmented touch by utilizing tactile sensors with the BCI to receive relevant sensory information concurrently with letting the user directly control the output behavior of the prosthesis (e.g. artificial arm movement); in doing so, this recreates the control-feedback loop [1]. The signals produced by the loop provide output for controlled muscle contractions, input and feedback from sensory organs (e.g. position), creating a bidirectional pathway through which we explore and manipulate our environment [1], enabling for augmented gesture and augmented touch to take place. Figure 1 illustrates the process of augmented gesture. The approach used in the figure incorporates the neurofeedback approach – an approach that is promising for enhancing the performance of the brain [3]. \begin{figure} \includegraphics[width=\linewidth]{figure_1.jpg} \caption{Diagram displaying the steps taken to obtain augmented gesture. First, the tactile sensors that are places on the hands or fingers of the surgeon. Once measurements are obtained, then they are sent to a controller (e.g. BCI) that evaluates, refines and translates the measurements into stimulations that neurons can react to. Upon receiving the stimulations, the neural circuits within the neurons reorganize themselves in a way that allows the surgeon’s brain to update itself on how to better perform the gesture. The gesture is then realized through neuroprosthetics combined with either a prosthetic or the surgeon’s hand. } \label{fig:figure1} \end{figure} \subsection{Augmentations in Surgery} Knowing how neurotechnology can realize augmentations within humans enables us to address how such technology and augmentations will impact medical practice. For this section, we will specifically focus on the practice of surgery. In this case, the users of the neurotechnology are surgeons. Within surgical settings, augmented vision, augmented touch and augmented gesture will enable surgeons to perform surgeries with a higher level of precision and accuracy by allowing them to see details more clearly, utilize surgical tools and methods better, and perform surgical procedures and operations better. As a result, the success rate of surgeries performed by surgeons utilizing neurotechnology will increase, which is good for multiple reasons; the main reason being that successful surgery will enable the patient to live longer and healthier life, which is helpful for the individual, their family and society. Augmented cognition for surgeons enables surgeons to be able to learn new surgical procedures that are less invasive, shorten operative times, lessens costs and reduce the likelihood of complications. Furthermore, it will allow surgeons to be more knowledgeable in surgical techniques and competent in the ability to recognize the limits of their professional competence [36]. The benefits of these can best be understood through a bioethics perspective, with specifically using the principle of beneficence, non-maleficence and justice, In terms of beneficence, in neurotechnology and the augmentations empowering surgeons, they enable surgeons to take actions, make suitable surgical judgements to assess the risks, burdens and benefits, and approach surgeries in a way that that respects and is in the best the interest of their patients. In addition, their improved cognitive abilities will allow them to stay up to date with activities and update their knowledgebase as required. \\ \\ With having surgeons keeping themselves professionally and educationally advanced, this will help ensure that they will provide the highest standards of patient care and the lowest rates of complications [36]. This leads to non-maleficence as higher standards of patient care is accompanied with better communication and improvement in the type of care being offered (e.g. palliative care), and lower rates of complications leads to a decrease in the likelihood of a medical error occurring and minimization of harm caused to the patient. Lastly, with the surgeons being able to perform tasks better, this will decrease the time needed for surgeries, and can decrease the time of the patient’s stay in the hospital. From a justice standpoint, this is crucial as just as much as health burden is an issue for patients, so is economic burden. With surgeons successfully performing surgeries on their patients, patients will not need to stay in the hospital for long, enabling them to be able to live back their normal life and do their regular activities, such as working and spending time with their family. \subsection{Augmentations in Medical Practice} For this section, we will focus on medical practice that do not involve surgery. In this case, the users of the neurotechnology would be physicians. Within non-surgical settings, augmented vision and augmented cognition will allow physicians to better perform diagnoses. For instance, given that the physician will have enhanced vision and cognitive abilities, analysis of scans from diagnostic radiology exams such as computed tomography (CT) and fluoroscopy would be better performed as physician will be able to see details more clearly and better spot indicators on the scans. As such, this will allow physicians to make more accurate diagnoses, which can result in better understanding assessment, planning and execution of treatment, communication between the physician and the patient, maintain of the physicians’ fidelity and responsibilities, and care for the patient. These help with achieving non-maleficence as effective diagnosis and communication significantly reduces the amount of harm within patients on both a physical and mental level. Good diagnosis helps with increasing the chances that a correct treatment will be used, and prevents moral distress in patients and their family. Additionally, and most importantly, with neurotechnology, augmented vision and augmented cognition enhancing physicians’ diagnoses performance, this leads to a major step towards justice. Specifically, improvement in diagnosis will lead to reduction in discrimination, misclassification and prejudice experienced by patients, and better provide freedom from misdiagnosis to patients. \\ \\ Augmented cognition, augmented gesture and augmented touch from neurotechnology will allow physicians to perform treatments and therapy in a more efficient and effective manner. The benefits of performing successful treatments and therapy are similar to those of performing a successful surgery or diagnosis. Just as in performing a successful surgery provides justice to the patient by allowing them to leave the hospital and get back to their routinely activities, performing a successful treatment is no different. However, given the difference in nature of surgeries and treatments in terms of activities and procedures, there are particular benefits that neurotechnology and augmentations provides that applies more for physicians than for surgeons. One of these benefits is how they help physicians with meeting their fiduciary duty to their patients during treatment through enabling physicians to properly implement precision medicine within the treatment itself. What makes precision medicine desirable for treatments is that its approach consists of utilizing the patient’s genes, environment, and lifestyle. This is especially of interest for patients as they would much rather have a treatment that is personalized for them than a one-size-fits-all treatment. \section{Ethical Analysis} \subsection{Personhood Assessment} In the ethical evaluation of technological interventions, integrity and dignity of a person are the most relevant criteria [29]. Within philosophical literature, a portion of ethical questions raised in regard to neurotechnology are associated with what we call our “self” or “Soul”, which the debate itself usually draws on the concept of personhood as a modern notion that includes core aspects that we typically ascribe to our self or soul; these aspects include planning of the individual future and responsibility [29]. The concept of personhood always has normative implications due to the fact that we describe certain attributes and capabilities of a person, and want to have that person recognized, acknowledged and guaranteed [29]. Just as patients must consciously authorize a neurotechnological intervention before it is conducted, physicians and surgeons must also consciously provide authorization as well. As such, the concept of a person can provide an ethical benchmark applicable to persons such as physicians and surgeons, assuming that we do not want to impair the personal capabilities, such as autonomy and responsibility interventions in the brain [29]. With that being said, neurotechnological interventions are ethically unacceptable if remaining a person is at risk. \\ \\ This statement poses major problems for neurotechnology and human augmentation for physicians and surgeons for two reasons. To best understand those reasons, we will provide two cases. Note that the concept of personal identity refers to the query to which degree and under which circumstances a person remains the same over time, above and beyond physical identity [29]. In investigating and evaluating for the “sameness” for a person, we need to consider both the interaction that the person has with others and the appreciation of moral capabilities, such as the ability to make a promise and keep it [29]. This, especially, is important for the physicians and surgeons as both of them have a fiduciary responsibility to their patients. Consider the simple case where all physicians and surgeons provide authorization for augmentation via neurotechnology and neurotechnology successfully accomplishes its augmentations on them without any interference (i.e. no hackers or third parties involved). An undesired outcome that can be produced from this comes from the augmented cognition. The increase in knowledge does not guaranteed consistency or improvement in morality within a person. As such, there is a chance that the cognitive enhancement that they have undergone changes the way that they appreciate moral capabilities. A physician with increase in knowledge on the importance of using a specific biomedical approach to treating patients with a specific condition can reinforce their current belief that biomedical approaches are better than holistic approaches. In turn, this can lead to a lack of openness for alternative approaches such as a holistic approach, and empathy needed to understand why approaches like the holistic approach is needed for the treatment of those kinds of patients. This will lead to disputes and disagreements between the physician or surgeon and other physicians and surgeons, and with medical practitioners such as nurses and clinical social workers. Overtime, this will lead to the interaction that they have with each other as well as with those medical professionals to change. By the end of it, at the cost of wanting to improve their cognitive abilities for the sake of their patients, the physician or surgeon will have lost their personal identity. This possible loss of personal identity makes it problematic for neurotechnological interventions as the physician or surgeon is at risk of not remaining the person that he or she was prior to the augmentation. \\ \\ For the second case, consider the instance where simple case where all physicians and surgeons provide authorization for augmentation via neurotechnology and neurotechnology successfully accomplishes its augmentations on them, but an interference by a third party, by say a malicious brain-hacker, occurs later. After such an instance occurs, assuming that the negotiation with the malicious brain-hacker was successful resulting in no changes made to the BCI and brain of the physician or surgeon, it is pretty much guaranteed that the physician or surgeon will not remain after the incident. The physician or surgeon will likely suffer from sort of paranoia, trust issues, and/or psychological trauma. This is not surprising as often when an individual’s mental integrity and dignity has been compromised, they end up suffering mentally from it to some degree. Furthermore, with the advancement of technologies and areas within computer science, specifically artificial intelligence, machine learning and quantum computing, it is justified for them to have fears and worries as there is no guarantee that the same issue will not be experienced again. What that degree is heavily depends on the person’s mental strength, willpower and self-control, the amount of support provided to them after the incident has occurred, and the environment where the person is situated after the occurrence of the incident. Regardless, their interaction with physicians, surgeons and others will likely change and their appreciation of moral capabilities will be altered as their view on them will be called into question. In worst case scenario, they become diagnosed with a psychological or neurological disorder as an aftermath or have their brain altered by the malicious brain-hacker, guaranteeing that their interaction with others and their appreciation of moral capabilities will change. This unintentional or intentional loss of personal identity makes it problematic for neurotechnological interventions as the physician or surgeon is at risk of becoming a new person that he or she was not prior to the augmentation. \subsection{Social Issues} What can be noticed in the previous section is a third reason, or case as we can call it, which is the case where some physicians and surgeons decides to either not provide authorization to the neurotechnological intervention altogether or to provide authorization to the neurotechnological intervention but not to undergo at least one type of augmentation. The types of groups and a possible distribution of these groups is shown in Figure 2. This case leads to one of the previously raised concerns stemming from the consequence of human augmentation. As discussed earlier, there is a chance that augmentations can lead to a divide between humans, where the population of humans with augmentations will feel that they are more superior to those without augmentation, leading to different types of social issues. In our case with the physician or surgeon not \begin{figure} \includegraphics[width=\linewidth]{figure_2.jpg} \caption{ Diagram displaying the types of groups that would exist in the case where undergo types of augmentations for physicians and surgeons are optional, and a possible distribution of each group. To avoid providing false information, population percentages were omitted. } \label{fig:figure2} \end{figure} providing authorization to neurotechnological intervention, this divide can occur in three different divides: \begin{enumerate} \item Division among physicians and surgeons domestically. \item Division between physicians and surgeons, and healthcare professionals. \item Division between physicians, surgeons and healthcare professionals. \item Division among physicians and surgeons internationally. \end{enumerate} For our case, we will only mainly focus on (1) and (4) as (2) and (3) are more distant to the scope of the paper. However, those are areas that can and should be further investigated. With there being four different groups, there is the change that those that physicians and surgeons that are fully augmented (i.e. have successfully undergone all augmentation via neurotechnology) mistreat those that do not have the augmentations that they have. This possibility is not farfetched and is very likely to happen. In every industry, including healthcare and medicine, we see prejudice and workers being mistreated due to their title, lack of experience or the lack of knowledge that (at least according to the administration or management within their organization). With those physicians and surgeons that do not have a particular augmentation, such as and especially augmented vision, cognition and touch, fully and semi augmented physicians and surgeons can take advantage of that to enforce their agendas and ideologies and bypassing arguments and statements made by them on the grounds that given their inferiors cognitive abilities or senses, what they say and their opinions should not be weighted equally to those that are fully augmented, or things along those lines. As such, augmentations increase the chance of prejudice and mistreatment occurring among physicians and surgeons, reinforcing existing beneficence, non-maleficence and justice issues within healthcare and medicine. Overtime, this can lead to alteration of personality among physicians and surgeons. Furthermore, this can lead to moral distress, trust issues, and other psychological issues experienced by those doctors that are mistreated, resulting in a loss of personal identity. This is dangerous as this shift in personality and personal identity will not only impact the performance of those physicians and surgeons and the lives of patients, but can create or further contribute to suicidal thoughts within them. Depending on the profile, involvements, commitments and types of patients that the doctor was treating, the impact that their suicide can have can be one that is negatively impacts individuals on a one-to-one, domestic, and/or international level. \\ \\ The other way in which physicians or surgeons can be discriminated is in an instance where either malicious brain-hacking or a data hostage leading, with either of them leading to data sharing occurs. What makes doctors neural data valuable is that the doctors are known for being very well off financially. With proper preprocessing of the neural data and correct use of data mining and machine learning algorithms, health status, preferences and behavior of physicians and surgeons, physicians and surgeons can be exploited financially by companies such as insurance companies. Note that data records are stored electronically, which the highly personalized nature of neural data – much like genomic data – may increase the identifiability of individuals [25]. With that being said, the neural data obtained from malicious brain-hacking or data sharing could be used for discrimination purposes against a particular physician or surgeon, or to blackmail them into doing something. The severity of the consequences from the blackmail will depend on what is being asked and whether the doctor carries out the act. Regardless of what is produced from this scenario, as the risk of psychological harms depends directly on the presence of other risks [16], it is guaranteed that the doctor will experience distress, anxiety and other psychological issues, which can lead decreased performance in completing medical and non-medical tasks. This decrease in performance increases the chances that they harm the patient. \subsection{Global Health Inequality and Health Migration} Given that there are major economical, technological, and infrastructural disparities among countries, it is inevitable that some countries will not be able to provide their physicians and surgeons with the neurotechnological interventions needed to obtain augmentations. As computing technologies can greatly contribute to the growth and development of countries [4], countries such as the United States, Germany and China that have the manpower, infrastructure and resources to realize computing technologies for economic, social and medical development will be able to provide their doctors with the augmentations quicker and with guarantees compared to countries that are struggling due to poverty, warfare and humanitarian crises such as Libya, Syria and Myanmar. Consequently, if only doctors in developed countries are augmented, then this will create a global health inequality. Patients in countries with augmented physicians and surgeons will receive better treatment than those with regular physicians and surgeons. Furthermore, in times where doctors from different countries have to collaborate together on medical and healthcare issues, conflicts will likely arise between augmented doctors from one country (i.e. developed country) versus regular doctors from another (i.e. underdeveloped country). With augmented doctors possibly having a lack of openness for alternative approaches and empathy towards patients from different countries, this will lead to disputes and disagreements between the doctors from the different countries. The disputes and disagreements can lead to physicians and surgeons experiencing distress, anxiety and other psychological issues, resulting in decreased performance in completing medical and non-medical tasks. This decrease in performance increases the chances that they harm their patients and patients internationally depending on the case. \\ \\ With developed and high-income countries being able to provide not just augmentations to physicians and surgeons but also better employment opportunities, education, safety and security for them and their families, these will push physicians and surgeons to migrate to those countries [34]. Their migration will further contribute to the current disparity in the health workforce between high- and low/middle-income countries [35]. In Serour’s work, which was done back in 2009, she stated that Africa needs 1 million health workers, which includes physicians and surgeons, for Sub-Saharan Africa alone. This number has likely increased due to the SARS-CoV-2 outbreak that has and continues to take place in 2020. With countries like the United States, United Kingdom, Canada and Australia already benefitting considerably from the migration of nurses and doctors [30], the implementation of neurotechnology for human augmentation will further benefit those countries as well as other developed countries, leaving the underdeveloped countries to suffer more. What results from this is an increase in harm experienced by the patients and an increase in mortalities in the underdeveloped countries’ population. \subsection{Patient Harm} Whether it is data hostage situation of the data from a TMS or malicious brain-hacking of a neuroprosthetic, given the risks associated with physicians and surgeons using neurotechnology for augmentations along with the impact that augmentation has on people in general, there is no doubt that there is a chance that the change in self-concept, personal identity or the discrimination, psychological and other issues experienced by physicians and surgeons will influence doctor-patient relationships. One of the reasons for why the relationship will likely become worse is because the voices of the patients will either be ignored or be of less value to their physicians and surgeons. For fully or semi augmented physicians and surgeons, especially those with augmented cognition, there is a higher chance that they will think that whatever decision they make will be the right decision for the patient. Consequently, when patients of theirs voice their concern to them, they will either ignore or listen only selected parts of the concern. In turn, this will make the patient feel as if their doctor does not care for them, leading to feelings of sadness, distress, and pain. This is problematic because even in the case where the patient is successfully treated, they would leave the hospital or clinic feeling mentally hurt. While the degree in which the mental pain from the experienced differs from one patient to the other, it is still a problem because the physician or surgeon did not accomplish non-maleficence. During times when they could have prevented the patient from experiencing mental harm, they did not prevent it. As a result, the physician or surgeon did not ensure to inflict the least amount of harm possible to reach a beneficial outcome. Rather, they inflicted an amount of harm onto the patient that either they were not aware of or did not care about enough to reach a beneficial outcome. \\ \\ The other reason for why doctor-patient relationships will likely worsen is because of the side effects experienced by physicians and surgeons from either undergoing all augmentations or selected few augmentations, and/or from being mistreated and discriminated by their colleagues [15]. For fully or semi augmented physicians and surgeons, in the case where they lose their personal identity, this can make it difficult for patients to communicate their concerns as the new personality developed by their physician or surgeon can be one that makes it difficult to communicate with them, and vice-versa. Consequently, in the physician or surgeon having difficulty communicating with their patients, this increases the chances of and eventually lead them harm their patients either by accident or on purpose. In the case of harm occurring due to an accident, this accident could be due to the physician or surgeon making a wrong assumption based on the limited information verbally provided by their patients. Alternatively, this can also be due to after using tES to increase the physician or surgeon memory, rather than the memory being used for remembering details about the patients, the memory retrieval within the physician or surgeon’s brain retrieves unrelated information or even problematic information such as details of a traumatic event; in retrieving the wrong information, the physician or surgeon’s attention is not adequately concentrated on the patient, making it difficult for them to communicate with the patient, and eventually leading to them accidentally harming the patient. In the case of harm occurring on purpose, this could be due to first the personal identity change resulting in the physician or surgeon not being able to properly control their anger, then the patient criticizing the physician or surgeon, infuriating the doctor in a way that made them feel that the patient is attacking their expertise, experiences and augmentations. \\ \\ The problem of the voices of patients being ignored extends to issues of justice. What results from the patient’s voice being partially or fully ignored is unequal and unfair treatment by the fully or semi augmented physicians and surgeons to their patients. The way that they approached the medical intervention was not the same across all of their patients. Some received more care from the physicians or surgeons while others received less. Consequently, this unequal level of care is unfair to those that do not receive the same amount of care from the physicians or surgeons. This unequal treatment to patients can not only be experienced while undergoing the medical intervention, but it can be experienced prior to it as well. Especially with augmented cognition, augmented vision and BCIs, those make it possible for physicians and surgeons to easily take advantage of their patients during the diagnosis and consent phase prior to the treatment. With tDCS providing physicians and surgeons the ability to better solve complex problems, they can find ways to trick patients into providing their “informed” consent to treatments that are either costly, ineffective, harmful or all three combined. Consequently, this will lead to the patient further suffering from the disease and any complications that arise during the medical intervention, financial loss, and increased levels of distress from spending a larger than expected time in the hospital and from the worry of either dying or possibly not being able to live a regular life again or anytime soon. \section{Conclusion} A limitation with our work is that there were no medical professionals that directly contributed to the paper. As such, there are some notable ethical issues that were not included in this paper. Additionally, as our work did not include any discussions on health policy and cyber security, we were not able to discuss solutions that could be used to address the ethical and health issues. Future work can ethically analyze the impact of neurotechnology for human augmentation on physicians and surgeons with respect to the division between physicians, surgeons and healthcare professionals, and should focus on health policy and cyber security needed to address those ethical and health issues. Even with the best-case scenario where neurotechnology always succeeds in providing people with augmentations, in applying it on physicians and surgeons to augment them, there are high risk associated with it. This makes it challenging when it comes to doing a cost benefit analysis of it, especially because when doing such an analysis, we cannot make the big assumption that we made in this paper. A way to reduce the risks associated with the neuroengineering component of augmenting physicians and surgeons is to design and program the tactile sensors and neuroprosthetics so that in a worse case where a malicious brain-hacker takes over a surgeon’s BCI and tries to make the surgeon harm their patient, the neuroprosthetic detects the abnormality then communicates with the tactile sensors, activating the emergency magnet mechanism in the glove, forcing the gloves to tighten together like handcuffs. This will prevent the surgeon from harming the patient and medical practitioners in the room, and give the surgical team time to figure out what to do next. It is important that such safety mechanisms like these and others are rigorously tested prior to using them in clinical settings, and have them ready for use once they are ready to be used. Furthermore, after augmentations have been embedded within physicians and surgeons, have a designated medical and bioethics combined team dedicated to supporting them mentally to ensure that the transition is smooth and the physicians and surgeons’ personal identity and other crucial aspects of them are preserved. In doing so, this can help reduce and prevent the occurences of harm and ethical, medical, and personhood issues experienced by physicians, surgeons and patients.
\subsection{Philipp's Bluetooth section} \subsection{Link Layer Operation} \label{sec:bluetooth} Our proposed approach uses Bluetooth Low Energy (BLE) for detecting devices in range. The procedure using which two wireless devices establish a first contact in a wireless network is called neighbor discovery. In BLE, devices periodically broadcast packets with an interval $T_a$ for neighbor discovery. For reducing the probability that multiple consecutive packets of different devices are sent at the same point in time and hence collide, a random delay between $0$ and $\SI{10}{ms}$ is added to each instance of $T_a$. In addition, devices listen to the channel for a time window of length $d_s$ every $T_s$ time-units. A device has successfully discovered another one, once a beacon from the opposite device coincides with one of its reception windows. We have estimated the performance when two smartphones discover each other (cf. \cite{kindt:20} for details). The choices of $T_a$, $T_s$ and $d_s$ supported by the Android operating system are not officially documented. We have therefore looked them up in the source code of the Android operating system. Due to scheduling conflicts, the values actually used could differ during runtime. We nevertheless found that for certain configurations, the latency measured from the point in time at which two devices come into range until discovery is successful is below $\SI{5}{s}$ during normal operation, i.e., when no scheduling conflicts occur. Such latencies are practical for contact tracing. We also found that continuous contact tracing has no significant impact on the smartphone battery runtime. We expect that the battery is drained by no more than $\SI{5}{\percent}$ by contact tracing, while the energy demand is even significantly below that in most cases. Finally, we investigated the behavior in crowded situations, where a large number of devices are in range of reception. Here, the packets from multiple devices could potentially collide. We found that even in situations with $100$ devices being close to each other, the probability that all devices discover each other successfully within $\SI{10}{s}$ is close to $\SI{100}{\percent}$. In our approach, we chose the most beneficial parameters for BLE based on this evaluation. We thereby ensure that contact tracing is carried out with the highest possible reliability and the lowest possible energy consumption. Distance estimation is done by evaluating the received signal strength indicator (RSSI) provided for each received packet. This estimation is known to be error-prone. In our approach, we eliminate as many sources of error as possible, while classifying a contact as significant by jointly considering the RSSI and contact duration. This reduces the rate of false positives and negatives. \section{Attack scenarios}\label{sec:attacks} We evaluate possible attack scenarios in this section. These attack scenarios are not theoretical. Reports form South Korea \cite{SouthCoreaNature2020}\cite{SouthCoreaGuardian2020} show that attacks are done against users and that a state adversary is using the data to invade users' privacy. This emphasizes the importance of an approach, which collects minimal data and where such attacks are prevented by design. More attack scenarios will follow in a second draft of this document. \subsection{Reveal identity of infected person}\label{sec:id_infected_person} A possible attacker could get the identity of infected people if they can directly access the TCNs of the infected people on the server (see \cref{sec:direct_download}). The attacker can install the app on a device and install the device somewhere together with a video camera. The camera records the people passing by and the device records the peoples' advertised TCNs together with the time. After some days, one of the people who passed the device and the camera finds out that they have been infected and uploads their TCNs to the server. The attacker can now download them and compare them with the TCNs on their device. The app detects a match. Now the attacker can check the matching TCNs and access the time on the database. Then, the attacker checks the video feed at that time and can possibly identify the infected individuals. \bigbreak \noindent \textit{Defense:} The use of private set intersection cardinality protects further the identity of infected people. The attacker can still query the server multiple times to find out which of their contact TCNs was infected. Thus, a rate of queries needs to be limited to make these attacks more expensive. This type of linkage attack is in general possible with any proximity tracing app, which exchanges TCNs and notifies users. Any tech-savvy user can either use several devices, register their app mulitple times, modify the app and record the identities of other users. With PSI-cardinality and a rate limit, this attack becomes difficult and expensive. \subsection{Rebroadcasting of TCNs} Attackers can use received contact TCNs and rebroadcast them as their own. Thus, people could get notifications of exposure triggered by falsely broadcasted TCNs even though they have not been at risk. In case of an infected attacker, the users would not get any notification, because the wrong TCNs, not the attackers' own TCNs, have been advertised. \bigbreak \noindent \textit{Defense:} Each TCN is concatenated with the time interval number. This time interval number is valid for ten minutes. If an attacker received a TCN from a neighbouring phone, they could rebroadcast this TCN to other users. In case this TCN is later marked as infected, only users who received this TCN from the attacker within the ten minute time interval will get a notification. The introduction of the time interval number reduces the validity of each TCN and thus puts a limit on this rebroadcasting attack. In the case of an infected attacker, the users would indeed never get notified of their possible exposure, since the attacker uploads their own TCNs. This would be the same if a person had their Bluetooth switched off, refused to upload their TCNs, or if they had not installed the app at all. \subsection{Upload of somebody else's TCNs} An attacker could try to upload somebody else's TCNs in order to mark them as infectious. \bigbreak \noindent \textit{Defense:} When receiving TCNs, the key needed for TCN generation is not transmitted. Thus, if the user is asked to upload their pseudo random TCNs, they need to provide the key they used for generating these TCNs. The server or the medical personels directly generates the TCNs with the keys, such that the TCNs are verified and the attacker cannot simply exchange TCNs. The attacker could of course try to provide fake keys, in which case the uploaded TCNs would not lead to any encounter notification, because the TCNs were never broadcasted. \subsection{Forcing someone else to quarantine by self-reporting} If an attacker wants to force someone to quarantine (e.g. manipulating sport events or annoying a neighbour), they can get into close proximity to this person and then try to self-report themselves as infected. \bigbreak \noindent \textit{Defense:} The server is not directly accessible for the user. A user can only connect to the server if they have been granted access by medical personnel (by e.g. a TAN or a QR code). Medical personnel only grant access if the user has tested positive for COVID-19. The only case where self reporting is possible, is if the user has been exposed to an infected user, got the notification and can prove to the server with a zero-knowledge proof that they know an infected TCN. This knowledge serves as authorization to the server and allows the user to upload their own keys for TCN generation. These can be marked as second order TCNs and enable second order tracing of contacts as described in \cref{sec:2ndorder}. \section{Digital contact tracing via a Bluetooth app -- Concept}\label{sec:DCTS_concept} In this section, we outline the general concept of DCTS. Details for the technical implementation are covered in \cref{sec:technical_details}. We propose a mobile Bluetooth application (app) to introduce DCTS in the society. Our proposed app permits the registration of relative encounters while preserving the privacy of its users by design. The concept is based on the following principle: Each mobile phone equipped with the DCTS app advertises temporary contact numbers (TCNs) to other phones. At the same time, it records and stores the TCNs advertised by other phones. Phones continuously advertise their random TCNs and store the observed random TCNs of neighboring devices, while users can simply follow their daily routine activities (such as office, school, theater, etc.). In case users are infected, they can agree to an upload of their advertised TCNs to a server after approval from medical authorities. Every app user continuously checks the server and gets information on the TCNs related to people tested positive for the virus. A matching operation done on the user's device reveals them to the user only if a potentially infectious contact has happened. In this way, each user is informed about potential infectious contact without revealing so to another party. The identity of the infectious person and their social graph remains protected. \subsection{Generation and advertising of random TCNs} The user installs the DCTS app. The app activates Bluetooth and generates a key, which it uses to generate a random TCN. The phone then proceeds to advertise the random TCN via Bluetooth, such that other devices in the vicinity of the user can see the TCN. This TCN is updated after a certain time in order to minimize re-identification of the user. The app stores the advertised TCNs for a period of two or three weeks, depending on what is sensible for the infectious period of the virus. The key for TCN generation is updated every day and is stored on the phone. This ensures that key compromising can not deanonymize users' past movements \subsection{Scanning and storing TCNs of neighboring phones} In parallel to the advertising operation, the Bluetooth activated on the device continuously scans for other devices in its vicinity. When neighboring devices are detected, the app stores the observed TCNs, the time, and signal strength on the phone. The period of exposure can be calculated using the saved timestamps and the proximity can be evaluated based on the received signal strength. We only store encountered TCNs for a time period of two or three weeks. We show a sketch of the TCN exchange between different phones in \cref{fig:id_exchange}. \begin{figure} \centering \includegraphics[width=\textwidth,page=1]{figures/BluetoothFigures.pdf} \caption{Phones in each others' vicinity exchange their random TCNs via Bluetooth. All TCNs are updated after a certain time period.} \label{fig:id_exchange} \end{figure} \subsection{Uploading TCNs to the server} If a user is tested positive for the virus, the patient is encouraged by medical authorities to provide the TCNs advertised over a period of two or three weeks. The patient is informed about how their identity is protected, including the description of the risk of identification via possible attacks (see \cref{sec:id_infected_person}). If the patient agrees, their advertised TCNs are uploaded to a server where they are verified and encrypted before being made available. \begin{itemize} \item \textbf{Scenario 1: Patient uploads advertised TCNs and keys} \\ The patient gets the permission by a medical authority to upload the generated TCNs, and keys to a server. This permission can be granted in various ways (see \cref{sec:technical_details}). The patient then proceeds to upload the keys. The server regenerates and verifies the patient's TCNs with the provided keys. This verification prevents impersonation of other users. The server deletes the keys after the verification. This scenario is shown in \cref{fig:id_upload}.\\ \item \textbf{Scenario 2: Doctor uploads advertised TCNs} \\ The patient provides the keys used for TCN generation to the medical personnel, e.g. by showing a QR code with the keys to an authorized person. The medical personnel then verifies the TCNs by regenerating them and uploads the TCNs to the server following an authentication procedure (e.g. username and password of medical authority). The medical personnel deletes the keys after the upload. \end{itemize} \begin{figure} \centering \includegraphics[width=\textwidth,page=2]{figures/BluetoothFigures.pdf} \caption{Scenario 1: When a user receives a positive test result, they get the permission to upload their random TCNs from the past two or three weeks to the server.} \label{fig:id_upload} \end{figure} Scenario 2 ensures the user's anonymity towards the server and does not require to use mobile data or WiFi. The app generates a new key for future TCN generation after the upload. \subsection{Collecting TCNs on the server} The server collects newly uploaded TCNs for a predefined period of time, e.g. one hour, and shuffles their order to avoid the association of several TCNs to a single user. Then, the server stores the shuffled batch of TCNs to its main database. This enables users' apps to check whether they were in contact with the patient. TCNs are only stored for two/three weeks and are then automatically deleted. \subsection{Discovering potentially infectious contacts and slowing down the pandemic} Users in their daily life have the app working on their devices. In parallel to the continued advertisement of TCNs, the app checks regularly, e.g., once per hour, for new TCNs on the server. If new TCNs are present, the app retrieves information about them from the server. The patients' TCNs are then matched against the encountered TCNs registered on the device of the user during a period of two/three weeks. This matching is done on the user's phone. If the app detects a match, the user receives a notification that a potentially infectious encounter has been detected (\cref{fig:notification}). \begin{figure} \centering \includegraphics[width=\textwidth,page=3]{figures/BluetoothFigures.pdf} \caption{Every device can check its recorded TCNs against the reported TCNs on the server. If a device finds a match, it notifies the user.} \label{fig:notification} \end{figure} This notification includes recommended actions, such as self-quarantining and calling a number or visiting a website with contact details for medical authorities. The notified user can also be asked to proceed and provide his/her TCNs to allow a recursive tracing. We recommend consulting psychologists about the exact wording and information of this notification in order to achieve the desired effect. We present two approaches on how to detect encounters in the following. \subsubsection{Direct download of TCNs}\label{sec:direct_download} In order to check whether the user has been in contact with an infected person, they download all unchecked TCNs stored on the server and check for matches within their own list of observed TCNs. When encountering matches, the app can perform a risk assessment based on exposure time period and proximity. The risk assessment can be included in the notification. This approach is vulnerable to an attack described in \cref{sec:id_infected_person}. A possible solution for this vulnerability is described in the following section. \subsubsection{Checking for overlap of scanned TCNs and infected TCNs} The previous scenario is vulnerable to the attack scenario described in \cref{sec:id_infected_person}. An attacker can put a device with the app together with a video camera at a public place, record the broadcasted TCNs and can later check for infected TCNs on the server. If the attacker has recorded an infected person, they can potentially assign infected TCNs to people on the camera. In order to avoid this attack, we can check for the number of TCNs that are both in our set of encountered TCNs and in the set of infected TCNs. An algorithm determining the private set intersection cardinality with low communication cost (see for example \cite{private_set_2018}) is a valuable strategy in order to discover the exposure to infectious contacts without risking the identification of the patient (details are described in \cref{sec:private_set_intersection}). If intersection cardinality is used, the risk assessment can still be done by e.g. introducing three categories: high exposure, medium exposure, and low exposure. The encountered TCNs are sorted into these categories, depending on the contact period and the proximity. Then the number of overlapping TCNs in each category can be checked, which provides a measure for user exposure. \subsection{Second order contact tracing: tracing contacts of traced contacts} Several studies have confirmed that COVTID-19 is infectious before people develop symptoms \cite{incubationPeriod, Rothe2020}. This leads to a spread of the virus before people get diagnosed and can isolate. For example, person A gets infected. Before developing symptoms, person A infects person B. Person A still shows no symptoms and B continues living normally and infects person C. Now A develops symptoms. After A got the diagnosis, person B is notified, but person C is still oblivious. Thus, it is possible for the virus to spread much faster than direct contacts can be traced. In \cite{contactumodel}, it is shown that infection chains can only be stopped if indirect contacts are traced as well. We enable person B to upload their TCNs to the server as soon as B gets the notification of having been exposed. If B uploads their TCNs, person C gets a notification before infecting anybody else. For more details see \cref{sec:2ndorder}. \section{Conclusion}\label{sec:conclusion} We present an improved decentralized, privacy preserving approach of a digital contact tracing service. We protect the users' identities and their personal data and focus on privacy and IT-security concerns. We incorporate legal principles and requirements, such as the GDPR or the Council of Europe’s Convention 108, into the very design of our solution. In the decentralized approach, each infected user has the choice to contribute to fighting the pandemic and provide their advertised random IDs. This information concerns the user themselves and nothing can be inferred about other people. The worst case scenario of a potential security breach is the identification of infected users. In the centralized approach, each infected user can upload their observed IDs. This information is not only concerning the infected user who is revealing their social graph. This information concerns also every person the infected user has met in the past two/three weeks, as at least parts of their social graphs are revealed as well. The worst case scenario of a potential security breach now spans an entirely different magnitude. A variety of information can be obtained from a social graph with severe consequences for the individual. Social graphs of people can lead to identification of members belonging to groups of minorities (religious or otherwise) or even uncovering and endangering e.g., journalistic sources, whistle-blowers or political activists. They might reveal educational and social status, political circles and opinions, religious believes, and further sensitive information about people. The tracing of infectious contacts, digital or not, is an epidemiological tool that works effectively only if coupled with the ability to test potentially infected people quickly. Besides, the impact of tracking on epidemic containment depends on many factors that can also change over time. For this reason, the appropriate use of contact tracing must be permanently monitored and optimized through the use of proper epidemiological models. We improve existing concepts through the use of private set intersection which provides better privacy for the infected users. Additionally we show a way to trace second order contacts in a decentralized system while protecting the privacy of the user. This approach also prevents attackers from uploading contacts without prior contact to an infected person. \section{Introduction}\label{sec:introduction} The current COVID-19 pandemic poses challenges to our society on a scale unheard of in recent times. While the direct consequences of the pandemic are felt in healthcare and medical sectors, the quarantining and isolation measures required to slow the outbreak have a major impact on the psychological and economic welfare of people. One measure that has been applied in a digital and analogue manner is the tracing of contacts. State authorities resorted to this measure in order to find out about new infectious persons and prevent further spreading of the disease by quarantining them. Many of the analogue solutions are problematic because state authorities might not have the capacity to question and pursue contacts and when they do, they touch upon the privacy of citizens. A first wave of governmental apps have been criticized on the basis that they could be used for surveilling citizens. As a reaction, more privacy friendly approaches have been proposed. The experiences with existing apps have shown that potential loopholes are exploited even by citizens in order to identify infected persons and e.g. shame them on social media \cite{SouthCoreaNature2020} \cite{SouthCoreaGuardian2020}. Hence, the issue arose whether there is an effective digital solution that also takes into account ethical, legal, and societal concerns. Therefore, our concept puts forward ideas to improve the decentralised concept. Our current proposal aims at fighting infectious diseases in an effective manner while safeguarding and realizing the citizens’ rights, freedoms and legitimate interests. We focus on privacy and IT-security concerns. In the spirit of a privacy by design solution, we incorporated legal principles and requirements into the very design of our solution. While our first point of reference was the European Union’s General Data Protection Regulation (GDPR) 2016/679, there exist similar and equivalent principles and requirements in many legal orders, including the Council of Europe’s Convention 108. These include: \begin{itemize} \item lawfulness, fairness and transparency (Art. 5 Sec. 1 Subsec a. GDPR) \item purpose limitation: data shall be \enquote{collected for specified, explicit and legitimate purposes and not further processed in a manner that is incompatible with those purposes} (Art. 5 Sec. 1 Subsec b. GDPR) \item data minimization: data shall be \enquote{adequate, relevant and limited to what is necessary in relation to the purposes for which they are processed} (Art. 5 Sec. 1 Subsec c. GDPR) \item accuracy: data shall be \enquote{accurate and, where necessary, kept up to date; every reasonable step must be taken to ensure that personal data that are inaccurate, having regard to the purposes for which they are processed, are erased or rectified without delay} (Art. 5 Sec. 1 Subsec d. GDPR) \item storage limitation: data shall be “kept in a form which permits identification of data subjects for no longer than is necessary for the purposes for which the personal data are processed” (Art. 5 Sec. 1 Subsec e. GDPR) \item integrity and confidentiality: \enquote{processed in a manner that ensures appropriate security of the personal data, including protection against unauthorised or unlawful processing and against accidental loss, destruction or damage, using appropriate technical or organisational measures} (Art. 5 Sec. 1 Subsec f. GDPR) \end{itemize} While the concept laid out here addresses many principles and requirements, its actual implementation will contain further technical and organizational measures in order to mitigate risks and further issues. This is particularly true for data subjects rights like the right to rectification and the right to erasure. A further development of the application will also have to look into other issues like inclusion, fairness, transparency and effective governance of the application. \\ We present a secure solution for a digital contact tracing service (DCTS) that protects the users' privacy, identity and personal data from attackers. Encounters, their proximity, and duration are required in order to properly track contacts of people and infection chains. We propose the use of Bluetoot , a short range wireless communication protocol, as a means to measure these quantities. Bluetooth detects only real encounters and works indoors as well as outdoors (e.g. underground in subways or in buildings), where location (e.g. by GPS) and mobile network data is not reliable anymore. Bluetooth is a technology standard available on every mobile phone and thus provides the ideal global instrument to register encounters on local devices. We present the general concept of DCTS in \cref{sec:DCTS_concept}, the technical details and implementation aspects in \cref{sec:technical_details}, and consider possible attack scenarios in \cref{sec:attacks}. We cover related work in \cref{sec:related_work}, and provide a legal perspective in \cref{sec:legal_aspects} and conclude in \cref{sec:conclusion}. \section[Data protection assessment]{Data protection assessment\protect\footnote{Disclaimer: This assessment is preliminary and requires further elaboration and coordination on individual points.}}\label{sec:legal_aspects} This section covers legal aspects, in particular the regulations in accordance with data protection law\footnote{It should be noted that apart from the strictly legal perspective, ethical and social implications will also have to be observed in the design of any digital contact tracing system.}. Insofar as the use of the DCTS app involves the processing of personal data, it must be compliant with the strict requirements of the GDPR.\footnote{The GDPR entered into force on 25 May 2018. It is directly binding and applicable to any entity that is processing the personal information of data subjects inside the European Economic Area (EEA), regardless of its statutory location and the data subjects' citizenship or residence.} This applies regardless of whether the app is operated by a public authority (at federal or state level) or a private institution. Essentially, the following questions arise: \subsection{Applicability of GDPR} The GDPR only applies to the processing of personal data, Art. 1 Sec. 1 GDPR. Conversely, the GDPR does not apply to purely factual or anonymous data. Art. 4 Sec. 1 GDPR defines personal data as \textit{\enquote{any information relating to an identified or identifiable natural person (‘data subject’); an identifiable natural person is one who can be identified, directly or indirectly, in particular by reference to an identifier such as a name, an identification number, location data, an online identifier or to one or more factors specific to the physical, physiological, genetic, mental, economic, cultural or social identity of that natural person}}. It follows that the key threshold for determining whether data should be considered as personal data is not identification but rather identifiability of a specific natural person. Recital 26 GDPR stipulates that \textit{\enquote{[p]ersonal data which have undergone pseudonymisation, which could be attributed to a natural person by the use of additional information should be considered to be information on an identifiable natural person. […] The principles of data protection should therefore not apply to anonymous information, namely information which does not relate to an identified or identifiable natural person or to personal data rendered anonymous in such a manner that the data subject is not or no longer identifiable. This Regulation does not therefore concern the processing of such anonymous information, including for statistical or research purposes.}}. Against this background, there is a strong indication that the GDPR would be applicable to the DCTS app. It cannot be ruled out that individual pieces of information in the processing chain will be personally identifiable by the use of additional information. This applies both to the advertised TCNs (which could in principle be attributed to a natural person by the use of the respective keys), the keys themselves, the -- implicit -- attribute \enquote{tested positive} as well as the determination of the \enquote{contact}. In addition, IP addresses \footnote{As online identifiers, see \cite{GDPR_art4_lit1, GDPR_Recital_30}.} as well as mac addresses\footnote{As device identifiers, see \cite{duesseldorfer_kreis}. } are typically considered as information on an identifiable natural person. This personal data will be processed, i.e. stored, uploaded and matched, at various stages during the operation of the DCTS app. \footnote{In addition, the transmission of personal data within the framework of the Bluetooth connection may also occur, see \cite{zdnet}. } Conclusion: Personal data are processed and the GDPR is applicable. \subsection{Lawfulness of data processing} Pursuant to Article 6 GDPR, any processing of personal data requires an explicit authorisation. Art. 6 GDPR provides a whole range of possible justifications: from the consent of the data subject (i.e. the affected person) to a specific statutory regulation or a balancing of interests test. To the extent that health data are concerned (as would be the case with the -- implicit -- attribute \enquote{tested positive}), even stricter requirements must be met under Art. 9 GDPR. However, parallel with Art. 6 Sec. 1 Subsec. a. GDPR, Art. 9 Sec. 2 Subsec. a. GDPR provides a justification if the effective consent of all those affected is obtained. As laid out above in Section 2, the DCTS app is conceived to function on a voluntary basis. This means that there should neither be a statutory obligation to use the app nor an automated implementation of the app on all end devices. In fact, the voluntary nature is a crucial factor for achieving widespread acceptance and trust among the population for any digital contact tracing system. It should be noted that some commentators have raised doubts whether a DCTS app can realistically be regarded as strictly voluntary because it may at least foster some form of indirect compulsion if the use of the DCTS app becomes a de-facto condition for taking part in public and social life.\cite{greenpeace} It is true that it cannot be ruled out that a private individual (e.g. a restaurateur) may practically \enquote{compel} its contractual partners to use the DCTS app. Therefore, it is all the more important that the non-use of the DCTS must not effectuate any weakening of an individual’s legal position vis-à-vis the state. Against this background, the European Data Protection Board\footnote{The European Data Protection Board (EDPB) is an independent European body, which contributes to the consistent application of data protection rules throughout the European Union, and promotes cooperation between the EU’s data protection authorities. The EDPB is composed of representatives of the national data protection authorities, and the European Data Protection Supervisor (EDPS). For further information see \cite{edpb}.} has already made clear that \textit{\enquote{[t]he use of such an application […] may not condition the access to any rights guaranteed by law.}}\cite{edpd_covid} This means that, in principle, the DCTS app’s processing of personal data may be justified through formal consent of each and every individual app user pursuant to 6 Sec. 1 Subsec. a. GDPR, Art. 9 Sec. 2 Subsec. a. GDPR. However, it should be born in mind that the declaration consent must meet certain requirements. These are set out in Art. 7 GDPR (general conditions) and additionally in Art. 8 GDPR (particular conditions as regards minors) and Art. 12 GDPR (transparency conditions). These provisions in particular stipulate that \begin{itemize} \item the declaration of consent must be explicit (\enquote{opt-in} in the context of the installation of the app on the smartphone); \\ \item the declaration of consent must be free of any kind of compulsion (despite the urgency, no psychological pressure must be created, which leaves the individual hardly any real choice); \\ \item sufficient, very comprehensible information is provided in an easy language that is appropriate for the addressee, based on which the addressee can form their decision (\enquote{informed consent}). This requirement is not at all trivial because, on the one hand, precise information must be provided about the purpose, means and all processing steps and circumstances, and, on the other hand, the addressee must not be overburdened.\\ \end{itemize} Conclusion: If the requirements laid out above (and a few formalities not explicitly mentioned here\footnote{Cf. in detail Heckmann/Paschke, in\cite{GDPR_Ehmann}}) are complied with, the DCTS app’s processing of personal data may be justified under the GDPR. \subsection{Further requirements under GDPR} In addition, a whole range of procedural precautions must be observed in the process of developing the DCTS app. These include in particular \begin{itemize} \item fulfilling certain information obligations (Art. 13 ff. GDPR), in particular with regard to the rights of data subjects, such as the right to information, the right to revoke consent, the right to deletion, the right to correction (e.g. when a \enquote{false-positive} test result is entered into the system); \\ \item ensuring data protection through technology design and data protection-friendly default settings (Art. 25 GDPR); \\ \item ensuring IT security (Art. 32 GDPR); \\ \item providing proper information in case of data breach (Art. 33 GDPR); \\ \item carry out a data protection impact assessment (Art. 35 GDPR); \\ \item and several mores.\cite{ccc} \\ \end{itemize}{} Conclusion: None of these requirements stand in the way of developing the DCTS app, but need to be incorporated from the outset of the design process to guarantee a compliant and thus sustainable use. \subsection{Principle of proportionality} In principle, the processing of personal data constitutes an encroachment on the fundamental right to informational self-determination. Even if this invasion can be justified (in this case: by consent, Art. 6 Sec. 1 Subsec. a. GDPR, Art. 9 Sec. 2 Subsec. a. GDPR), it is nonetheless subject to the principle of proportionality. This means that a legitimate purpose must be pursued through the use of the DCTS app and that the means used must be suitable, necessary and appropriate for achieving the purpose. The principle of proportionality must equally be observed in the case of \enquote{voluntary} (i.e. consented) app use, especially since the boundaries between voluntariness and compulsion may become blurred in the case of \enquote{urgent recommendations} on the part of the federal government as well as state governments and affiliated public institutions. The purpose of this app is identifying chains of contacts to contribute to slowing down the spread of the virus (\enquote{flatten the curve}) in order to avoid overburdening the healthcare system while easing exit and contact restrictions. In this way, a balance between health protection and restrictions on fundamental rights should be achieved. At present, we still\footnote{Some EU member states have started a process of gradually easing some of the restrictions imposed. Nevertheless, the restrictions remain fairly unparalleled, both in terms of their range and comprehensiveness.} live under considerable restrictions on our fundamental rights (freedom of occupation, property, freedom of assembly, freedom of movement, freedom of religion, etc.).\footnote{In several recent decisions, the German Constitutional Court has made clear that under the current pandemic the scale will typically tilt in favor of the protection of public health when balancing the competing protected legal interests, see BVerfG, 7 April 2020, 1 BvR 755/20; BVerfG, 10 April 2020, 1 BvQ 28/20; slightly more in favor of the freedom of assembly BVerfG, 15 April 2020, 1 BvR 828/20.} The app is intended to help to reduce these restrictions, but at the same time provide sufficient health protection. This is undoubtedly a legitimate, and from a fundamental rights point of view, even welcome purpose. The means used is a warning and protection system based on a disclosure of the fact of positively tested contacts, in order to give the persons affected the opportunity to take protective measures for themselves and third parties. In principle, this means is suitable to fulfil the purpose. Because of the voluntary nature of the system, it is currently unclear whether the DCTS app will ultimately be successful. From a constitutional point of view, the principle of proportionality is only violated if a proposed means is \enquote{utterly unsuitable} (according to the German Federal Constitutional Court in its settled case law). Since it cannot be ruled out that the DCTS app will fulfil its purpose, it currently meets the suitability threshold. Nevertheless, further evaluating the efficiency of digital contact tracing by refining the statistic models is a key component of the ContacTUM group’s DCTS research efforts, not least in order to further inform the dynamic proportionality assessment. The next step is to assess whether the concrete setup of the DCTS app is necessary to achieve its purpose. This would not be the case if there were milder means that would be equally suitable to fulfill the purpose. Such a milder means is not immediately apparent:\footnote{There seems to be widespread consensus that processing location and/or movement data is not necessary to fulfill the purpose of digital contact tracing systems, i.e. identifying chains of contacts to contribute to slowing down the virus.} Continuing the lockdown would make the app unnecessary, but would prolong the considerable restrictions on other fundamental rights and is therefore not a preferable alternative. Relaxing the current contact and exit restrictions without installing a digital contact tracing system seems equally risky, because it is to be feared that people are not sufficiently sensitive to necessary self-restrictions. However, in terms of necessity, there may be a crucial distinction between the two fundamental approaches to digital contact tracing, i.e. centralized and decentralized data reconciliation: \begin{itemize} \item The decentralized approach (as chosen in our proposed DCTS app) could be viewed as a milder remedy compared to the centralized approach. This is because with central data reconciliation, all advertised TCNs would regularly be uploaded and stored together on the authentication server, at least for a short time. Thus, the risk of re-identification of affected persons may be greater. This central server would create a special attack vector, which raises questions of IT security. \\ \item In the same vein, the decentralized approach seems more in line with the aforementioned principle of data minimization \cite{GDPR_art_5_sec_1} – which is, in essence, a materialization of the principle of proportionality. In the decentralized approach, only the positive cases are stored on the central server, while the actual data reconciliation takes place on the app on the end device. From the perspective of an app user, this aspect could increase the willingness to participate in a digital contact tracing system. \\ \item Although there are currently no plans to combine the use of the DCTS app with compulsory protective measures, such as home quarantine or testing, some people may fear that the fact that they have tested positive could become known to third parties. In the decentralized approach, this fact would only be visible on the smartphone of the person concerned, i.e. it would be \enquote{in their hands}. From a necessity point of view, this could also speak in favour of the decentralized variant. \\ \item Achieving widespread acceptance and trust among the population is the key factor for any digital contact tracing systems’s success. Only if the potential users trust in the app’s privacy architecture, they will actually use and follow the app in their daily lives. Against this background, it is crucial to obtain the endorsement of trustworthy institutions like the data protection agencies. In their letter to the European Commision of 14 April 2020, the EDPB has made clear that \textit{\enquote{[i]n any case, the EDPB wants to underline that the decentralised solution is more in line with the minimisation principle.}}\cite{edpb_guidance}\\ \end{itemize} Conclusion: Assuming that centralized and decentralized approaches to designing a digital contact tracing system are equally suitable to contribute to slowing down the spread of the virus, there are good arguments that a decentralized approach (as chosen in the present case with the DCTS app) is the preferable approach both from a proportionality and data minimization point of view. \subsection{Supplementary consideration: Does the DCTS app require a statutory basis?} On 3 May 2020, a group of data protection experts published a legislative proposal for a German \enquote{Law on the introduction and operation of an app-based tracing of infection risks with the SARS-CoV-2 (Corona) virus}\cite{netzpolitik_vorschlag} (the DCTS Law Proposal). The DCTS Law Proposal covers the requirements, framework and limits for the installation, use and operation of a DCTS app (Sec. 1 Subsec. 1). With regard to Germany, the authors argue that such a statutory basis is required for any digital contact tracing system.\cite{netzpolitik_warum} \subsection{The main provisions of the DCTS Law Proposal} The DCTS Law Proposal lays out that the purpose of any DCTS app is to foster contact tracing within the framework of the German Federal Infection Protection Act and to enable earlier infection warnings (Sec. 1 Subsec. 2). In addition, users shall be enabled to take additional measures to limit further spreading of the pandemic and thereby prevent an overburdening of the of the healthcare system capacities (Sec. 1 Subsec. 3). Sec. 3 stipulates the voluntary nature of the app. The installation or use of the app may not be brought about either directly or indirectly by any form of compulsion. It is also forbidden to link any direct or indirect advantages or disadvantages to the use or non-use of the app. In the event of a notification of a potentially infectious encounter, there is no obligation to enter into (self-)quarantine, to undergo a medical test for COVID-19 or to notify third parties. In addition, users must be able to deactivate, terminate or delete the app at any time. Pursuant to Sec. 4, the app as well as the server infrastructure necessary for its operation are provided and operated by the Robert Koch Institute.\footnote{The Robert Koch Institute (RKI) is the government’s central scientific institution in the field of biomedicine; see \url{https://www.rki.de/}. } Sec. 5 specifies the technical details for establishing potentially infectious encounters as well as for the data storing and processing. Sec. 7 stipulates that any data (TCNs, keys as well as any meta data) created, advertised or received by the DCTS app must not be used for any purposes other than those specified in the DCTS Law Proposal. Sec. 8 requires a data protection impact assessment (cf. Art. 35 GDPR), Sec. 9 requires that the source code of the app be published. Sec. 10 prescribes that any user notified of a potentially infectious encounter the user shall be entitled to an immediate medical test for COVID-19. Sec. 11 prevents potential DCTS app operators from blocking the development of alternative DCTS apps by third parties. In case a medical test for COVID-19 is carried out, Sec. 12 provides the users with the additional option of transmitting their test results to the DCTS app operator for research purposes. The data transmitted may only be used by the operator to analyse and improve the accuracy of the matching process. Finally, the DCTS Law Proposal shall cease to have effect when the German Bundestag finds that an \textit{\enquote{epidemic situation of national significance}}\cite{infection_protection} no longer exists, but no later than one year after its entry into force (Sec. 14 Subsec. 2). \subsection{Preliminary assessment} The DCTS Law Proposal enhances the evolving academic discussion around digital contact tracing systems. Whether such legislation should actually be passed remains to be discussed. Many of the provisions have a merely declaratory value and are somewhat characterized by a lack of trust in public institutions. This lack of trust may be attributable to the (perceived) political contention of the last weeks (centralized vs. decentralized approach, voluntary nature vs. compulsion, confusion surrounding the parallel release of a data donation app, etc.). However, it is questionable whether such contention is sufficient to require legislative action. As regards the DCTS Law Proposal, four dimensions should be distinguished: \begin{itemize} \item Provisions such as Sec. 3 (voluntary nature) have a merely confirmatory and declaratory character. Even without such a provision, the processing of personal data would require a justification under the GDPR. Art. 6 Sec. 1 Subsec. a. GDPR, Art. 9 Sec. 2 Subsec. a. GDPR provides for such a justification if the effective consent of all those affected is obtained (see above under 7.2). Such consent must, in accordance with Art. 7 Subsec. 1 GDPR, not only be voluntary, but revocable at any time. The same goes for the provisions on deletion, purpose limitation and data protection impact assessment (Secs. 6-8), which can equally be derived from the GDPR. \\ \item The specification of the technical procedure (Sec. 5) is redundant in the sense that it adopts a preliminary consensus reached in the scientific and political debate. Putting such a (temporary) consensus into law may make it difficult to adapt the technological standard to new findings. \\ \item Provisions such as Sec. 4 (assigning the Robert Koch Institute as operator) have more than declaratory effect, as such organizational determination is typically not provided for by law. \\ \item Secs. 9-11 clearly go beyond applicable law: Neither the obligation to publish the source code nor the right to an immediate medical test for COVID-19 nor the requirement to approve alternative apps result from previous legislation. From a legal policy perspective, it remains to be discussed whether these regulations are desirable.\\ \end{itemize} However, one aspect of the DCTS Law Proposal indeed seems counterproductive: the proposed statute’s automatic expiry after one year (Sec. 14 Subsec. 2) will not prevent the app itself from being continuously used (for example on the basis of consent, see above). On the contrary: only the restrictive regulations, such as those on rigorous earmarking, would then no longer apply. Conclusion: All in all, the DCTS Law Proposal is an important contribution to the academic discussion and could contribute to the overall acceptance of a digital contact tracing system. However, there is a risk that initiating a legislative process at this stage may further delay the introduction of the DCTS app. Alternatively, similar effects may be achieved by other public trust-building measures (such as the publication of \enquote{best practices} by the federal government): \enquote{law in action} instead of \enquote{law in books}. An overarching, general legal framework for similar applications aiming at nationwide risk prevention could then be created in a next step. Such an approach could also counteract the criticism that the DCTS Law Proposal constitutes an impermissible \enquote{single case} legislation. At any rate, parliamentary involvement in this complex matter is certainly to be welcomed. \section{Legal review} \section{Open Questions \label{sec:questions}} \subsection{Is there a better protocol, which enables second order tracing?} \subsection{How to avoid rebroadcasting of already uploaded IDs?} \subsection{For private set intersections: how computationally expensive is it? What are good values for $k, m$ (and what is a proper hash) of the Bloom filter in order to have a low false positive rate?} \section{Related work and comparison}\label{sec:related_work} We present a summary of current suggested methods and protocols in this section. We also highlight major differences to our approach and where we improve privacy and security aspects. All approaches, except the last one in \cref{sec:pepppt}, are similar to our desing of DCTS. A broader overview of current efforts (including location based approaches) can be found in \cite{TCNresearchdoc}. \subsection{TCN coalition}\label{sec:tcn} We present the TCN protocol \cite{TCNProtocol} of the TCN Coalition, which we are also part of, in this section. Smartphones generate periodically changing TCNs and advertise them via Bluetooth. Neighboring devices store observed TCNs. An infected user uploads the generated TCNs to a server together with an additional memo field where report data can be written. All users then download the list of reported TCNs and check whether they have been exposed. This proposal provides server privacy and receiver privacy, however it does not provide source integrity and is vulnerable to linkage attacks. The TCN generation uses two report keys, a report authorization key $rak$, and a report verification key $rvk$, which are used to compute an initial temporary contact key (TCK): \begin{equation} tck_0 \leftarrow \mathrm{H}_{\mathrm{tck}}(rak), \end{equation} \begin{equation} tck_i \leftarrow \mathrm{H}_{\mathrm{tck}}(rvk ~||~ tck{i-1}), \end{equation} with H$_{\mathrm{tck}}$ as a domain-separated hash function with an output of 256 bit, and $i \geq 1$. The TCN is then generated with \begin{equation} tcn_i \leftarrow \text{H}_{\text{tcn}} (\text{le}_{\text{u16}}(i) ~||~ tck_i), \end{equation} with $H_{\mathrm{tcn}}$ as a domain-separated hash function with and output of 128 bit. In this scenario, everyone who knows $rvk$ and $tck_i$ can generate all subsequent $tcn_j$. In case of infection a user can generate a report for the period of $j1$ to $j2$: \begin{equation} report \leftarrow rvk ~||~ tck_{j1-1} ~||~ \text{le}_{\text{u16}}(j1) ~||~ \text{le}_{\text{u16}}(j2) ~||~ memo, \end{equation} with $memo$ as byte string (2-257 bytes). The memo field can contain any messages, for example self-reported symptoms. Then the user produces a signature $sig$ (using $rak$) for the $report$ and provides $report~ ||~ sig$ to the backend. Users can then verify source integrity by checking the signature $sig$ over $report$ using the patient's $rvk$. The $rak$ needs to be changed frequently in order to protect better against linkage attacks; a maximal report time span of 6 hours or less is suggested. In this approach, each user can access the clear text of the patients' TCNs. This makes this design vulnerable against linkage attacks as described in \cref{sec:attacks} and also against replay attacks, where an attacker re-advertises someone else's TCNs. In our approach, private set intersection cardinality (as suggested in \cref{sec:private_set_intersection}) complicates linkage attacks even further and provides additional protection of the patient's identity and privacy. \subsection{DP-3T}\label{sec:dp3t} Another decentralized approach is presented in \cite{DP3Twhitepaper} from the DP-3T group. DP-3T presents two approaches, one with lower-cost and another one with increased privacy. We summarize both approaches in the following. \begin{itemize} \item \textbf{Low-cost decentralized proximity tracing:} Smartphones locally generate ephemeral identifiers $EphIDs$ (corresponds to TCNs in our approach), change them frequently and broadcast them via Bluetooth. Neighbouring smartphones store the observed $EphIDs$ together with duration and coarse time indication. A diagnosed patient gets authorization by health authorities and uploads a representation of their $EphIDs$. User query the server and get the patients' $EphIDs$. The smartphone then computes the risk score and in case notifies the user. The secret key $SK_t$ used for $EphID$ generation is rotated every day with \begin{equation} SK_t = H(SK_{t-1}), \end{equation} with $H$ as a cryptographic hash function. The $EphIDs$ are generated with $SK_t$ at the beginning of each day $t$: \begin{equation} EphID_1 = || ... || EphID_n = PRG( PRF(SK_t, broadcast Key) ), \end{equation} using a pseudo-random function $PRF$ (e.g. HMAC-SHA256), a fixed public string $broadcast Key$, and a stream cipher $PRG$. Each $EphID$ is then broadcasted for one minute. When infected, the backend collects the patients' $SK_t$ and $t$ and provides the data to users. Each smartphone then reconstructs the $EphIDs$ of infected users and checks whether the user has been exposed. This check is limited to a single day, in oder to increase efficiency for lookups and also to limit relay attacks (attacker redistributes captured $EphIds$). The smartphone then determines the user's risk score and notifies the user in case the score exceeds a threshold. This approach also offers various additional functions, e.g., storing the country a user has visited to ensure interoperability between countries. Also, the user can opt-in to share data with epidemiologists to support research. Location data or precise timing information will not be shared. The fact that the user receives a list of all the patients' $EphIDs$ makes this approach vulnerable e.g., against linkage attacks, where patient's $EphIDs$ could be linked to the patient's identity. \item \textbf{Unlinkable decentralized proximity tracing:} A second design provides better privacy properties, however it requires the users to download larger volumes of data. The patients' $EphIDs$ are not revealed to the users, instead the $EphIDs$ on the backend are hashed and stored in a Cuckoo filter. This also allows infected users to not upload their data for sensitive locations or times. The general approach remains the same. Smartphones generate and broadcast $EphIDs$. The $EphIDs$ are generated for each epoch broadcasted time period $i$: \begin{equation} EphID_i = \text{TRUNCATE128}( H ( seed_i )), \end{equation} with $H$ as a cryptographic hash function truncated to 128 bit (TRUNCATE128). Neighbouring smartphones observe the $EphID$ and store it as $H (EphID || i )$, with $H$ as a crpytographic hash function. The proximity, duration of encounter and a coarse time indication (e.g. day) is stored as well. When diagnosed, patients upload ${(i, seed_i)}$ and can also choose for which epochs they want to reveal their $EphIDs$. The backend then computes \begin{equation} H ( \text{TRUNCATE128} (H (seed_i )) || i ) \end{equation} and inserts the result into a Cuckoo filter. The filter is then sent to all users. The users' smartphones then applies the Cuckoo filter to their stored observed $H (EphIDs || i )$ and can then determine whether the user has been in contact. The risk score and notification remain the same as in the previous low-cost approach. This design also offers the possibility to opt-in to share data with epidemiologists to support research. Location data or precise timing information will not be shared. This design offers better protection of the infected users' identities. However, it requires the download of more data compared to the first low cost approach. Still, the user has the cuckoo filter of all the patients' $EphIDs$ locally on their phone. A tech-savvy attacker can also determine which specific entries of their observed $EphIDs$ belong to infected users, e.g. by applying the Cuckoo filter to each entry individually and checking for overlaps. Our approach using private set intersection cardinality presented in \cref{sec:private_set_intersection} provides additional protection of the users' identities. \end{itemize} An approach to protect from short-term and remote eavesdropping is also presented in \cite{DP3Twhitepaper}. They propose the use of Secret Sharing, where each $EphID$ is spread across $n$ beacons. Another user needs to receive at least $k$ shares in order to properly reconstruct the advertised $EphID$. Thus an attacker would need to be close to the user for a certain period of time in order to receive $k$ shares of the $EphID$. \subsection{Apple \& Google}\label{sec:appleandgoogle} Apple 's and Google's protocol is presented for example in \cite{appleGoogleTracing2020}\cite{appleAPI2020}\cite{googlecrypto2020}\cite{googleAPI2020}. Each phone generates a Temporary Exposure Key (TEK) valid for 24 hours. The key generation uses a cryptographic random number generator. With the TEK the phone generates a Rolling Proximity Identifier Key (RPIK). The Rolling Proximity Identifiers (RPI) are then derived with the RPIK. For this, each device calculates an interval number (ENIN): \begin{equation} ENIN(timestamp) \leftarrow \dfrac{timestamp}{60 \cdot 10}, \end{equation} which provides a number for each ten minute time window. In this protocol, the interval number depends on when the key was first generated. Each key is valid for 24 hours, corresponding to 144 time intervals. We define $i$ as the number of ten minutes intervals since key generation: \begin{equation} i \leftarrow \dfrac{ENIN(time At Key Generation)}{144} \cdot 144. \end{equation} The RPI for a time $j$ where the identifier is calculated (Unix Epoch Time) is calculated with: \begin{equation} \text{RPI}_{i,j} \leftarrow AES_{128} (RPIK_i, \text{PaddedData}_j). \end{equation} The PaddedData is a sequence of 16 bytes: \begin{itemize} \item PaddedData$_j$[0..5] = UTF8(\enquote{EN-RPI}) \\ \item PaddedData$_j$[6..11] = 0x000000000000 \\ \item PaddedData$_j$[12..15] = ENIN$_j$ \end{itemize} They also offer the possibility to encrypt additional metadata along with the RPI. This metadata can then only be encrypted if the broadcasting has been infected and revealed their TEK. A user that was infected and tests positive uploads their TEKs and the ENIN $i$ where the key validity started to a server. This upload can only be allowed by an official public health authority. The server distributes the keys and distributes them to the users. Each user then derives the infected person's RPI with the TEK and $i$. Afterwards, they match each of the infected RPIs with the encounteres identifiers. They allow for a two hour tolerance between when the RPI was supposed to be broadcasted and the actual scan time. If the exposure succeeds a threshold (based on exposure time and proximity), the user receives a notification. In the current design, users have no direct access to the encountered RPI and the infected RPI. Only a user with root access to the phone could possibly access this information and perform a linkage attack. Rebroadcasting other users' RPIs (if accessible with root access) would be possible within two hours time. This provides better protection than allowing attackers to directly access the patients RPIs and the encountered RPIs. Nonetheless, for effectively containing epidemic spread second order contact tracing (see \cref{sec:2ndorder}) needs to be introduced. Only then an infection chain can actually be interrupted. \subsection{Epione}\label{sec:coepi} In \cite{CoEpi} a decentralized approach is presented, which is also exchanging TCN via Bluetooth. In case of infection, the patient uploads their seed with which the advertised TCNs were computed to a server. There, the patient's TCNs are regenerated. They include private set intersection cardinality based on Diffie-Hellmann private set intersection as means to avoid linkage attacks, similar to our proposed solution in \cref{sec:private_set_intersection}. However, to actually stop the spread of SARS-CoV-2, second order tracing needs to be realized as well (see \cref{sec:2ndorder}). \subsection{ROBERT}\label{sec:pepppt} ROBERT\cite{Pepp-robert} (ROBust and privacy-presERving proxmity Tracing) is the protocol suggested by Pan-European Privacy-Preserving Proximity Tracing (PEPP-PT). It is the only centralized protocol that we summarize in this paper. In this approach, the server keeps a record in a database for each registered app belonging to each user. For user $A$, this record comprises amongst other data a permanent identifier $ID_A$, which is assigned for each registered app only known to the server, a shared key $K_A$, and a list of exposed epochs. With ROBERT, the TCNs are generated by the server and sent to the app. The ephemeral Bluetooth identifier for A $EBID_{A,i}$ for epoch i are generated as: \begin{equation} EBID_{A,i} = ENC(K_S, i | ID_A ), \end{equation} with $K_S$ as a server key stored by the server, and $ENC$ as a block-cipher with 64-bit block size. Additional to the $EBID$, each user also adds an encrypted country code $ECC$ and the time the message $M$ is broadcasted: $M_{A,i} = [ ECC_{A,i} | time_A]$. The advertised data $D$ consists of \begin{equation} D_A = [M_{A,i} | \text{MAC}_{A,i}], \end{equation} with MAC as an HMAC-SHA256($K_{A, c_1} | M_{A,i}$) where $c_1$ is the prefix \enquote{01}. Upon receiving $D_A$, another app $B$ retrieves $time_A$ from $D_A$ and obtains a timestamp $time_{A, B}$. The app then verifies that \begin{equation} | time_A - TRUNC_{16} (time_{A,B})| < \delta, \end{equation} with $\delta$ as time tolerance (e.g. some seconds). If this is correct, the app stores $(D_A, time_{A, B})$ in its proximity list. If a user is infected, they can upload their proximity list for the time period where they have been infected to a server \cite{Pepp-app}, \cite{Pepp-robert}. The server verifies the uploaded data and checks whether a user is at risk to have been infected. It calculates a \enquote{risk score} depending on how long and how close a user has been with another infected person. User query status requests from the server regularly and get thus notified if their risk score exceeds a threshold. In this centralized approach, both server and user know whether they have had been in contact with an infected person. The tool is designed to work for different countries. If a server collects data with an country code from another country, it forwards the data to the respective server. The server can link back the temporary identifiers to the permanent unique identifier linked to each user. The deanonymization of each user and also tracing users over time is thus trivial \cite{kuhn2020covid}. The users' contacts and social graphs are revealed to the server and an attacker with access to the server can exploit this sensitive information. Several other attacks are possible, such as linkability of contacts. A detailed security analysis can be found for example in \cite{DP3TRiskEvalPEPPPT}, and \cite{DP3TRiskEvalROBERT}. They conclude that this approach reveals many opportunities for exploitation and systematic misuse. \section{Technical details}\label{sec:technical_details} We explain the details of implementation and protocols in this section. A more general overview of the concept is provided in \cref{sec:DCTS_concept}. \input{Bluetooth} \subsection{Generating TCNs and advertising} Our approach is similar to the contact tracing suggested by Apple and Google\cite{appleGoogleTracing2020} in this aspect. We suggest modifying their approach by using a completely random daily key ($rdKey$) everyday to ensure forward secrecy. In the original approach, a leak of the private key allows an attacker to reproduce all past and future daily tracing keys. From \cite{appleGoogleTracing2020} the pseudo random TCN ($prTCN$) generation looks as follows: \begin{equation} \label{eq:pseudoRandomID} prTCN \leftarrow \text{Truncate}(\text{HMAC}(rdKey, \text{UTF8}(\text{"CT-RPI"}) || TIN)),16), \end{equation} where, $TIN$ is the time interval number, the n-th 10 minute of the day (e.g. 0:22 would be in the second time interval, thus $TIN=2$). This time interval number prevents rebroadcasting the TCNs of other users in other time intervals. Bluetooth also advertises the MAC-address of the device. According to our observations, this address changes after a certain time and is also changed when Bluetooth is activated. We were able to observe this behaviour in our tests on Android 8 and 9 as well as iOS 12. We stop and restart advertising immediately when updating the TCN, such that the advertised MAC-addresses change at the same time as the TCNs. This prevents any malicious association of a MAC-address to several TCNs. These changing TCNs keep the user anonymous and complicate tracking. The DCTS app stores the keys and the generated TCNs in a database (e.g., SQLite encrypted with SQLCipher \cite{SQLCipher}) that is physically present on the device. The maximal length of advertising data for Bluetooth is 31 byte (for Bluetooth 4.x). The advertisement includes a service universally unique identifier (UUID) of 16 bit. This UUID identifies the advertisement as a DCTS advertisement to other devices. The pseudo random TCNs are then advertised as additional data with a size of 16 bytes. Another method for random TCN generation is presented in \cite{DP3Twhitepaper}. Their described technique is similar and we are currently evaluating which approach is the most secure and privacy preserving and offers the most protection to the user. \subsection{Scanning and storing of encountered TCNs} The app registers only DCTS-advertisements of devices in the vicinity, using a filter for the service UUID in the Bluetooth scans. Simultaneously, the app advertises the user's TCNs with a size of 16 byte. For Android, advertised TCNs can be read out by the scan-callback and saved into the SQLite database. When a pseudo random TCN is seen, the app calculates a contactEventTCN ($ceTCN$): \begin{equation} \label{eq:contactId} ceTCN \leftarrow \text{SHA256}(receivedTCN || \text{ISO-Date}(today) || TIN), \end{equation} where $TIN$ is the time interval number of the contact time. Additionally, the app saves the contact time and the received signal strength indicator (RSSI) of the advertisement. The proximity can be estimated using the RSSI. The contact time period can be calculated if a TCN is registered several times. Both time period and proximity can then be combined to a degree of exposure to the virus. We note here that RSSI is a relative quantity and can differ for different chips. A possibility to calibrate RSSI could be to evaluate the range of RSSI within the first days of taking data. Within these days the user most probably has had close and distant encounters with people. This reveals an estimate of the highest and lowest range of RSSI. We could then estimate the proximity with RSSI calibrated on its maximal and minimal value. However, RSSI also depends on many factors, such as for example the orientation of the devices' antennas, whether the line-of-sight is obstructed, potentially humidity, and the channel on which a packet is sent. We will rule out these errors whenever possible. The remaining error then impacts the required contact time. If e.g. the estimated distance is lower than the actual distance, the devices would need to be longer in their vicinity in order to count as relevant contact. \subsection{Uploading of pseudoRandomTCNs} Only medical personnel have access or can grant access to the server to perform the upload. This minimises the misuse of reported TCNs of patients who are tested positive for the virus. The app offers an interface allowing medical personnel to either upload data to the server or to grant access to the server. In order to ensure correct use of the app, a short instruction or training for the use of the app needs to be provided. Also, we need to identify medical personnel in order to provide them with credentials for the server upload. This can be done by either contacting test centers directly or by getting the relevant contacts from the health office, to which the infected individuals are reported to. Doctors and institutions authorized to report people as infected can then be contacted and provided with the credentials and the instruction for the use of this app. \subsubsection{User uploads data} Patients are asked to upload their pseudo random TCNs after consultation with the medical personnel. The permission is provided via a token or an access code or a TAN at the doctor's office or the test center. A QR code or a TAN are provided by the doctor to the patient. Alternatively, the access code or TAN is provided via letter together with the test result (for recursive tracing). The code or TAN is then only valid for a single use for a restricted period of time. Inserting the TAN or scanning the QR code triggers the upload of the keys used for generating the random TCNs for the past two/three weeks. An IP anonymization protocol such as TOR \cite{dingledine2004tor} can be used to avoid revealing the patient's IP-address to the server during the upload of the TCNs. Once the keys are on the server, the server then verifies the TCNs by regenerating them with the keys for each day and all possible time interval numbers. The server then calculates for each pseudoRandomTCN the corresponding contactEventTCN (see \cref{eq:contactId}) with the respective time interval number and date. After TCN verification, the server deletes the keys. This verification ensures that patients can not simply upload observed TCNs of other people to mark them as infected. If the user does not have access to WiFi, the upload of the TCNs can be done in the test center or doctor's office or over mobile data. \subsubsection{Medical personnel uploads data} The user hands their keys to the doctor providing a QR code. The medical personnel receives the keys via the DCTS app and regenerates the user's pseudoRandomTCNs with the fixed time interval numbers. The pseudoRandomTCNs are then hashed together with their respective time interval numbers and date (as shown in \cref{eq:contactId}) to generate the contactEventTCNs. The medical authority then proceed to upload the user's TCNs to the server using their credentials to access the server. \subsection{Server} The server collects all verified TCNs for a short period of time, for example one hour. The collected TCNs get sorted or shuffled and saved into a database (for example as SQLite database encrypted using SQLCipher \cite{SQLCipher}). For the private set intersection cardinality protocol, the server computes $BF(Enc_{pk_S}(TCN_S))$ for all shuffled TCNs (see \cref{sec:private_set_intersection}). The server allows the DCTS users to download the database (or the bloom filter) of the encrypted TCNs. These hourly releases assure that a set of TCNs cannot be linked to one person, because the TCNs of several people are combined and their order is changed by either shuffling or sorting. Sorting the TCNs makes sense if the user directly downloads the TCNs, such that they can do a binary search for their contactEventTCNs. The user can then do hourly queries to get timely notifications in case of a contact. If the user queries the server more sporadically, they get the newly added data since their last query. \subsection{Private set intersection cardinality}\label{sec:private_set_intersection} To prevent attacks that might identify the patients, the DCTS app can use private set intersection cardinality to determine the number of infectious contacts. Several possible methods to determine the private set intersection cardinality exist, for example \cite{PrivateContactDiscovery} or the protocol described in \cite{private_set_2018}. We have not yet decided which specific protocol to use, but we present the working principle of the latter protocol. The server $S$ has a set of infected TCNs ($TCN_S$), and the user $U$ has a set of encountered contactEventTCNs ($TCN_U$). Both user and server have locally a set of public and secret keys (user: $pk_U, sk_U$; server: $pk_S, sk_S$). The user now shuffles their $TCN_U$ and encrypts them ($Enc_{pk_U}(TCN_U)$). They then send $Enc_{pk_U}(TCN_U)$ to the server. The server also shuffles and encrypts $Enc_{pk_U}(TCN_U)$, such that the server sends $Enc_{pk_S}(Enc_{pk_U}(TCN_U))$ back to the user. We use a commutative encryption scheme, such that $Enc_{pk_A}(Enc_{pk_B}(data)) = Enc_{pk_B}(Enc_{pk_A}(data))$. The user now decrypts $Enc_{pk_S}(Enc_{pk_U}(TCN_U))$ and gets $Enc_{pk_S}(TCN_U)$. A commutative encryption scheme is for example Pohlig-Hellmann \cite{PohligHellmann} or SRA \cite{SRA1981}. On the server side, the server encrypts its $TCN_S$ and applies a bloom filter ($BF$) on $Enc_{pk_S}(TCN_S)$. This step can be precomputed for all uploaded TCNs. The server then sends $BF(Enc_{pk_S}(TCN_S))$ to the user. The user also applies a bloom filter on $Enc_{pk_S}(TCN_U)$ for each of their encountered TCNs. Eventually, the user then checks whether $BF(Enc_{pk_S}(TCN_U))$ occurs in $BF(Enc_{pk_S}(TCN_S))$ for each of their encountered TCNs. The steps of the protocol are displayed in \cref{fig:private_set_scheme}. \begin{figure} \centering \includegraphics[width=\textwidth]{./figures/set_intersection_cardinality_scheme} \caption{Scheme of the private set intersection cardinality algorithm described in \cite{private_set_2018}. With this protocol users determine how many of their observed TCNs have been marked as infected on the server. The matching happens on the users' phones, the server can not infer the number of intersections.} \label{fig:private_set_scheme} \end{figure}{} This reveals to the app how many observed TCNs are in the set of patients' TCNs saved on the server. This information is only obtained on the user's device itself, no such information is leaked to the server. The user does not know which contactEventTCN belongs to an infected person and thus we ensure the patient's anonymity. This of course makes it impossible to assign the remaining stored data, such as exposure time period or proximity, to a single direct contact. However, private set intersection cardinality does not prevent the possibility to provide a risk assessment determined on the time period and signal strength of the encounter to the user. In order to provide such a service, the app can check for an encounter first. Then, the contactEventTCNs are divided into sub categories, for example high exposure, medium exposure, and low exposure. The set intersections can be checked for each category and allow for a risk assessment of the user. It is sufficient to receive $Enc_{pk_S}(Enc_{pk_U}(TCN_U))$ from the server and do the set intersection with the previously received $BF(Enc_{pk_S}(TCN_S))$ for this second query step. If there was no encounter, random TCNs are picked from the observed TCNs to simulate the second query step to the server, such that the server does not know whether the users have been in actual contact with an infected person or not. For preventing the server from recognizing the same TCNs, a new key-pair needs to be used every time the mobile device queries the server. The server requires a minimum number of TCNs to be queried in order to prevent the user querying single TCNs and potentially identifying infected users. If users only have one received contactEventTCN, the list of encountered TCNs is padded with randomly generated TCNs, such that they can still query the server. This increases the chance of a false positive result. We introduce a limit on the query rate, such that the app can only send a limited number of requests to the server at a time in order to prevent brute force attacks. Then users have to wait a certain period of time until they can query the server anew. The server's public key $pk_S$ can additionally change for each combined hourly uploaded patient TCN set. This complicates a brute force attack further, because the attacker needs a different bloom filter of their encountered TCNs for each hourly dataset. Using this approach to private set intersection cardinality might reveal the number of encounterered TCNs to the server. This is not the case if we allow the user to directly download all TCNs of infected people and check for matches on their phone. Using the latter method, the server gets no information whatsover about non-infected app users (except maybe their IP-address), however the user could identify infected people using an attack as described in \cref{sec:id_infected_person}. As an update to this protocol the bloom filter can be replaced with a cuckoo filter, which has the benefit of having lower error probabilities for the same size. This is also what is used in \cite{PrivateContactDiscovery}. \subsection{Second-order contact tracing: tracing contacts of traced contacts}\label{sec:2ndorder} The ContacTUM group is evaluating the efficiency of DCTS together with different intervention strategies. The results are being crosschecked using both deterministic and Monte Carlo based model approaches \cite{contactumodel}. The modeling substantiates the following prerequisites of a DCTS. First of all, the DCTS needs a broad acceptance among the population of more than 70\% in order to have an impact to control an outbreak. We believe this can only be achieved by a decentralized, secure, and privacy preserving design where the users own their data. Our goal is to contribute to slow down and eventually to stop the spread of the pandemic using the means of contact tracing complying with privacy laws, IT-security standards and the protection of human rights. Second of all, tracing of people who were in direct contact with a confirmed infectious person might not be sufficient. SARS-CoV-2 can be transmitted pre-symptomatic \cite{Mizumoto2020}\cite{Rothe2020} and a significant fraction of cases is asymptomatic \cite{Mizumoto2020}\cite{Corman2020}\cite{Nishiura2020}. To illustrate the pre-symptomatic transmission we consider the following case: person A has been infected with SARS-CoV-2. A can spread the virus to person B already up to 2-3 days before symptom onset. B is now a first order contact of A. With a non-negligible likelihood, person B can expose person C to the virus (which had no contact to Person A) before person A develops symptoms. C is thus a first order contact of B and a second order contact of A. Once person A develops symptoms and is positively tested, person B is notified after having already spread the virus to person C. This emphasizes the need for digital contact tracing and the necessity to not only notify Person B promptly, but also person C. We want to enable first order contact tracing (in the previous example: A's contacts: e.g. B), and additionally second order contact tracing (e.g. all of B's contacts, in our example: C). A user who receives a notification that there has been a contact with an infected person can then contact medical authorities and get the permission to upload their random TCNs to the server. Another possibility to proof contact with an infected person is using a so called zero-knowledge proof. A zero-knowledge proof allows person B to proof that the server and B share a secret value without revealing any information aside the fact that they both know the value. In our case, B can prove knowledge of an infected TCN to the server without revealing the infected TCN. This can then authenticate B to upload their TCNs to the server. These TCNs can be marked separately, such that the user can get different notifications, depending if there was a direct confirmed exposure or an indirect exposure. Tracing second order contacts increases significantly the number of traced potentially infected people. If every direct and indirect contact stayed in quarantine, a huge percentage of the population would be affected. Thus, tracing indirect contacts requires rapid testing of potentially infected people. For example, if person B in the above mentioned example is tested negative, person C does not require to stay in quarantine as the likelihood that person C has been infected by person B is small. Based on the rapid test results, health authorities can then decide who needs to isolate and who can continue with everyday life as usual. This avoids quarantining large fraction of the population during advanced stages of an epidemic. \section{Sample for first level head}\label{sec1} xLorem ipsum dolor sit amet, consectetuer adipiscing elit.\cite{Hirt1974} Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum. \begin{eqnarray} s(nT_{s}) &= &s(t)\times \sum\limits_{n=0}^{N-1} \delta (t-nT_{s}) \xleftrightarrow{\mathrm{DFT}} S \left(\frac{m}{NT_{s}}\right) \nonumber\\ &= &\frac{1}{N} \sum\limits_{n=0}^{N-1} \sum\limits_{k=-N/2}^{N/2-1} s_{k} e^{\mathrm{j}2\pi k\Delta fnT_{s}} e^{-j\frac{2\pi}{N}mn} \end{eqnarray} \section{Sample for another first level head}\label{sec2} Nulla malesuada porttitor diam. Donec felis erat, congue non, volutpat at, tincidunt tristique, libero. Vivamus viverra fermentum felis. Donec nonummy pellentesque ante. Phasellus adipiscing semper elit. Proin fermentum massa ac quam. Sed diam turpis, molestie vitae, placerat a, molestie nec, leo.\cite{Liska2010} Maecenas lacinia. Nam ipsum ligula, eleifend at, accumsan nec, suscipit a, ipsum. Morbi blandit ligula feugiat magna. Nunc eleifend consequat lorem. Sed lacinia nulla vitae enim. Pellentesque tincidunt purus vel magna. Integer non enim. Praesent euismod nunc eu purus. Donec bibendum quam in tellus. Nullam cursus pulvinar lectus. Donec et mi. Nam vulputate metus eu enim. Vestibulum pellentesque felis eu massa. Example for bibliography citations cite\cite{Taylor1937}, cites\cite{Knupp1999,Kamm2000} Quisque ullamcorper placerat ipsum. Cras nibh.\cite{Kucharik2003,Blanchard2015} Morbi vel justo vitae lacus tincidunt ultrices. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In hac habitasse platea dictumst. Integer tempus convallis augue. Etiam facilisis. Nunc elementum fermentum wisi. Aenean placerat. Ut imperdiet, enim sed gravida sollicitudin, felis odio placerat quam, ac pulvinar elit purus eget enim. Nunc vitae tortor. Proin tempus nibh sit amet nisl. Vivamus quis tortor vitae risus porta vehicula. Fusce mauris. Vestibulum luctus nibh at lectus. Sed bibendum, nulla a faucibus semper, leo velit ultricies tellus, ac venenatis arcu wisi vel nisl. Vestibulum diam. Aliquam pellentesque, augue quis sagittis posuere, turpis lacus congue quam, in hendrerit risus eros eget felis. Maecenas eget erat in sapien mattis porttitor. Vestibulum porttitor. Nulla facilisi. Sed a turpis eu lacus commodo facilisis. Morbi fringilla, wisi in dignissim interdum, justo lectus sagittis dui, et vehicula libero dui cursus dui. Mauris tempor ligula sed lacus. Duis cursus enim ut augue. Cras ac magna. Cras nulla. Nulla egestas. Curabitur a leo. Quisque egestas wisi eget nunc. Nam feugiat lacus vel est. Curabitur consectetuer. \begin{figure}[t] \centerline{\includegraphics[width=342pt,height=9pc,draft]{empty}} \caption{This is the sample figure caption.\label{fig1}} \end{figure} Suspendisse vel felis. Ut lorem lorem, interdum eu, tincidunt sit amet, laoreet vitae, arcu. Aenean faucibus pede eu ante. Praesent enim elit, rutrum at, molestie non, nonummy vel, nisl. Ut lectus eros, malesuada sit amet, fermentum eu, sodales cursus, magna. Donec eu purus. Quisque vehicula, urna sed ultricies auctor, pede lorem egestas dui, et convallis elit erat sed nulla. Donec luctus. Curabitur et nunc. Aliquam dolor odio, commodo pretium, ultricies non, pharetra in, velit. Integer arcu est, nonummy in, fermentum faucibus, egestas vel, odio. Sed commodo posuere pede. Mauris ut est. Ut quis purus. Sed ac odio. Sed vehicula hendrerit sem. Duis non odio. Morbi ut dui. Sed accumsan risus eget odio. In hac habitasse platea dictumst. Pellentesque non elit. Fusce sed justo eu urna porta tincidunt. Mauris felis odio, sollicitudin sed, volutpat a, ornare ac, erat. Morbi quis dolor. Donec pellentesque, erat ac sagittis semper, nunc dui lobortis purus, quis congue purus metus ultricies tellus. Proin et quam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Praesent sapien turpis, fermentum vel, eleifend faucibus, vehicula eu, lacus. \begin{figure*} \centerline{\includegraphics[width=342pt,height=9pc,draft]{empty}} \caption{This is the sample figure caption.\label{fig2}} \end{figure*} \subsection{Example for second level head} Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit amet, egestas sed, leo. Praesent feugiat sapien aliquet odio. Integer vitae justo. Aliquam vestibulum fringilla lorem. Sed neque lectus, consectetuer at, consectetuer sed, eleifend ac, lectus. Nulla facilisi. Pellentesque eget lectus. Proin eu metus. Sed porttitor. In hac habitasse platea dictumst. Suspendisse eu lectus. Ut mi mi, lacinia sit amet, placerat et, mollis vitae, dui. Sed ante tellus, tristique ut, iaculis eu, malesuada ac, dui. Mauris nibh leo, facilisis non, adipiscing quis, ultrices a, dui. Morbi luctus, wisi viverra faucibus pretium, nibh est placerat odio, nec commodo wisi enim eget quam. Quisque libero justo, consectetuer a, feugiat vitae, porttitor eu, libero. Suspendisse sed mauris vitae elit sollicitudin malesuada. Maecenas ultricies eros sit amet ante. Ut venenatis velit. Maecenas sed mi eget dui varius euismod. Phasellus aliquet volutpat odio. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque sit amet pede ac sem eleifend consectetuer. Nullam elementum, urna vel imperdiet sodales, elit ipsum pharetra ligula, ac pretium ante justo a nulla. Curabitur tristique arcu eu metus. Vestibulum lectus. Proin mauris. Proin eu nunc eu urna hendrerit faucibus. Aliquam auctor, pede consequat laoreet varius, eros tellus scelerisque quam, pellentesque hendrerit ipsum dolor sed augue. Nulla nec lacus. \begin{quote} This is an example\cite{Burton2013,Berndt2011,Kucharik2012} for quote text. This is an example for quote text. This is an example for quote text. This is an example for quote text.\cite{Breil2015} This is an example for quote text. This is an example for quote text. This is an example for quote text. This is an example for quote text. This is an example for quote text. This is an example for quote text.\cite{Barth1997} This is an example for quote text. This is an example for quote text. This is an example for quote text. \end{quote} \section{Sample for next first level head}\label{sec3} \subsection{Example for another second level head} Suspendisse vitae elit. Aliquam arcu neque, ornare in, ullamcorper quis, commodo eu, libero. Fusce sagittis erat at erat tristique mollis. Maecenas sapien libero, molestie et, lobortis in, sodales eget, dui. Morbi ultrices rutrum lorem. Nam elementum ullamcorper leo. Morbi dui. Aliquam sagittis. Nunc placerat. Pellentesque tristique sodales est. Maecenas imperdiet lacinia velit. Cras non urna. Morbi eros pede, suscipit ac, varius vel, egestas non, eros. Praesent malesuada, diam id pretium elementum, eros sem dictum tortor, vel consectetuer odio sem sed wisi. Sed feugiat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Ut pellentesque augue sed urna. Vestibulum diam eros, fringilla et, consectetuer eu, nonummy id, sapien. Nullam at lectus. In sagittis ultrices mauris. Curabitur malesuada erat sit amet massa. Fusce blandit. Aliquam erat volutpat. Aliquam euismod. Aenean vel lectus. Nunc imperdiet justo nec dolor. \subsection{Second level head text} Etiam euismod. Fusce facilisis lacinia dui. Suspendisse potenti. In mi erat, cursus id, nonummy sed, ullamcorper eget, sapien. Praesent pretium, magna in eleifend egestas, pede pede pretium lorem, quis consectetuer tortor sapien facilisis magna. Mauris quis magna varius nulla scelerisque imperdiet. Aliquam non quam. Aliquam porttitor quam a lacus. Praesent vel arcu ut tortor cursus volutpat. In vitae pede quis diam bibendum placerat. Fusce elementum convallis neque. Sed dolor orci, scelerisque ac, dapibus nec, ultricies ut, mi. Duis nec dui quis leo sagittis commodo. \subsubsection{Third level head text} Aliquam lectus. Vivamus leo. Quisque ornare tellus ullamcorper nulla. Mauris porttitor pharetra tortor. Sed fringilla justo sed mauris. Mauris tellus. Sed non leo. Nullam elementum, magna in cursus sodales, augue est scelerisque sapien, venenatis congue nulla arcu et pede. Ut suscipit enim vel sapien. Donec congue. Maecenas urna mi, suscipit in, placerat ut, vestibulum ut, massa. Fusce ultrices nulla et nisl. Etiam ac leo a risus tristique nonummy. Donec dignissim tincidunt nulla. Vestibulum rhoncus molestie odio. Sed lobortis, justo et pretium lobortis, mauris turpis condimentum augue, nec ultricies nibh arcu pretium enim. Nunc purus neque, placerat id, imperdiet sed, pellentesque nec, nisl. Vestibulum imperdiet neque non sem accumsan laoreet. In hac habitasse platea dictumst. Etiam condimentum facilisis libero. Suspendisse in elit quis nisl aliquam dapibus. Pellentesque auctor sapien. Sed egestas sapien nec lectus. Pellentesque vel dui vel neque bibendum viverra. Aliquam porttitor nisl nec pede. Proin mattis libero vel turpis. Donec rutrum mauris et libero. Proin euismod porta felis. Nam lobortis, metus quis elementum commodo, nunc lectus elementum mauris, eget vulputate ligula tellus eu neque. Vivamus eu dolor. Nulla in ipsum. Praesent eros nulla, congue vitae, euismod ut, commodo a, wisi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean nonummy magna non leo. Sed felis erat, ullamcorper in, dictum non, ultricies ut, lectus. Proin vel arcu a odio lobortis euismod. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Proin ut est. Aliquam odio. Pellentesque massa turpis, cursus eu, euismod nec, tempor congue, nulla. Duis viverra gravida mauris. Cras tincidunt. Curabitur eros ligula, varius ut, pulvinar in, cursus faucibus, augue. \begin{boxtext} \section*{Example of Boxtext}% This is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext this is sample for boxtext. \end{boxtext} \paragraph{Fourth level head text} Sed feugiat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Ut pellentesque augue sed urna. Vestibulum diam eros, fringilla et, consectetuer eu, nonummy id, sapien. Nullam at lectus. In sagittis ultrices mauris. Curabitur malesuada erat sit amet massa. Fusce blandit. Aliquam erat volutpat. Aliquam euismod. Aenean vel lectus. Nunc imperdiet justo nec dolor. Etiam euismod. Fusce facilisis lacinia dui. Suspendisse potenti. In mi erat, cursus id, nonummy sed, ullamcorper eget, sapien. Praesent pretium, magna in eleifend egestas, pede pede pretium lorem, quis consectetuer tortor sapien facilisis magna. Mauris quis magna varius nulla scelerisque imperdiet. Aliquam non quam. Aliquam porttitor quam a lacus. Praesent vel arcu ut tortor cursus volutpat. In vitae pede quis diam bibendum placerat. Fusce elementum convallis neque. Sed dolor orci, scelerisque ac, dapibus nec, ultricies ut, mi. Duis nec dui quis leo sagittis commodo. \subparagraph{Fifth level head text} Aliquam lectus. Vivamus leo. Quisque ornare tellus ullamcorper nulla. Mauris porttitor pharetra tortor. Sed fringilla justo sed mauris. Mauris tellus. Sed non leo. Nullam elementum, magna in cursus sodales, augue est scelerisque sapien, venenatis congue nulla arcu et pede. Ut suscipit enim vel sapien. Donec congue. Maecenas urna mi, suscipit in, placerat ut, vestibulum ut, massa. Fusce ultrices nulla et nisl. Etiam ac leo a risus tristique nonummy. Donec dignissim tincidunt nulla. Vestibulum rhoncus molestie odio. Sed lobortis, justo et pretium lobortis, mauris turpis condimentum augue, nec ultricies nibh arcu pretium enim. Nunc purus neque, placerat id, imperdiet sed, pellentesque nec, nisl. Vestibulum imperdiet neque non sem accumsan laoreet. In hac habitasse platea dictumst. Etiam condimentum facilisis libero. Suspendisse in elit quis nisl aliquam dapibus. Pellentesque auctor sapien. Sed egestas sapien nec lectus. Pellentesque vel dui vel neque bibendum viverra. Aliquam porttitor nisl nec pede. Proin mattis libero vel turpis. Donec rutrum mauris et libero. Proin euismod porta felis. Nam lobortis, metus quis elementum commodo, nunc lectus elementum mauris, eget vulputate ligula tellus eu neque. Vivamus eu dolor. in faucibus orci luctus et ultrices posuere cubilia Curae; Proin ut est. Aliquam odio. Pellentesque massa turpis, cursus eu, euismod nec, tempor congue, nulla. Duis viverra gravida mauris. Cras tincidunt. Curabitur eros ligula, varius ut, pulvinar in, cursus faucibus, augue. Curabitur tellus magna, porttitor a, commodo a, commodo in, tortor. Donec interdum. Praesent scelerisque. Mae- cenas posuere sodales odio. Vivamus metus lacus, varius quis, imperdiet quis, rhoncus a, turpis. Etiam ligula arcu, elementum a, venenatis quis, sollicitudin sed, metus. Donec nunc pede, tincidunt in, venenatis vitae, faucibus vel, nibh. Pellentesque wisi. Nullam malesuada. Morbi ut tellus ut pede tincidunt porta. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam congue neque id dolor. Donec et nisl at wisi luctus bibendum. Nam interdum tellus ac libero. Sed sem justo, laoreet vitae, fringilla at, adipiscing ut, nibh. Maecenas non sem quis tortor eleifend fermentum. Etiam id tortor ac mauris porta vulputate. Integer porta neque vitae massa. Maecenas tempus libero a libero posuere dictum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean quis mauris sed elit commodo placerat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Vivamus rhoncus tincidunt libero. Etiam elementum pretium justo. Vivamus est. Morbi a tellus eget pede tristique commodo. Nulla nisl. Vestibulum sed nisl eu sapien cursus rutrum. Nulla non mauris vitae wisi posuere convallis. Sed eu nulla nec eros scelerisque pharetra. Nullam varius. Etiam dignissim elementum metus. Vestibulum faucibus, metus sit amet mattis rhoncus, sapien dui laoreet odio, nec ultricies nibh augue a enim. Fusce in ligula. Quisque at magna et nulla commodo consequat. Proin accumsan imperdiet sem. Nunc porta. Donec feugiat mi at justo. Phasellus facilisis ipsum quis ante. In ac elit eget ipsum pharetra faucibus. Maecenas viverra nulla in massa. Nulla in ipsum. Praesent eros nulla, congue vitae, euismod ut, commodo a, wisi. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean nonummy magna non leo. Sed felis erat, ullamcorper in, dictum non, ultricies ut, lectus. Proin vel arcu a odio lobortis euismod. Vestibulum ante ipsum primis \begin{center} \begin{table*}[t]% \caption{This is sample table caption.\label{tab1}} \centering \begin{tabular*}{500pt}{@{\extracolsep\fill}lccD{.}{.}{3}c@{\extracolsep\fill}} \toprule &\multicolumn{2}{@{}c@{}}{\textbf{Spanned heading\tnote{1}}} & \multicolumn{2}{@{}c@{}}{\textbf{Spanned heading\tnote{2}}} \\\cmidrule{2-3}\cmidrule{4-5} \textbf{col1 head} & \textbf{col2 head} & \textbf{col3 head} & \multicolumn{1}{@{}l@{}}{\textbf{col4 head}} & \textbf{col5 head} \\ \midrule col1 text & col2 text & col3 text & 12.34 & col5 text\tnote{1} \\ col1 text & col2 text & col3 text & 1.62 & col5 text\tnote{2} \\ col1 text & col2 text & col3 text & 51.809 & col5 text \\ \bottomrule \end{tabular*} \begin{tablenotes \item Source: Example for table source text. \item[1] Example for a first table footnote. \item[2] Example for a second table footnote. \end{tablenotes} \end{table*} \end{center} Fusce mauris. Vestibulum luctus nibh at lectus. Sed bibendum, nulla a faucibus semper, leo velit ultricies tellus, ac venenatis arcu wisi vel nisl. Vestibulum diam. Aliquam pellentesque, augue quis sagittis posuere, turpis lacus congue quam, in hendrerit risus eros eget felis. Maecenas eget erat in sapien mattis porttitor. Vestibulum porttitor. Nulla facilisi. Sed a turpis eu lacus commodo facilisis. Morbi fringilla, wisi in dignissim interdum, justo lectus sagittis dui, et vehicula libero dui cursus dui. Mauris tempor ligula sed lacus. Duis cursus enim ut augue. Cras ac magna. Cras nulla. Nulla egestas. Curabitur a leo. Quisque egestas wisi eget nunc. Nam feugiat lacus vel est. Curabitur consectetuer. \begin{center} \begin{table}[t]% \centering \caption{This is sample table caption.\label{tab2}}% \begin{tabular*}{500pt}{@{\extracolsep\fill}lcccc@{\extracolsep\fill}} \toprule \textbf{col1 head} & \textbf{col2 head} & \textbf{col3 head} & \textbf{col4 head} & \textbf{col5 head} \\ \midrule col1 text & col2 text & col3 text & col4 text & col5 text\tnote{$\dagger$} \\ col1 text & col2 text & col3 text & col4 text & col5 text \\ col1 text & col2 text & col3 text & col4 text & col5 text\tnote{$\ddagger$} \\ \bottomrule \end{tabular*} \begin{tablenotes} \item Source: Example for table source text. \item[$\dagger$] Example for a first table footnote. \item[$\ddagger$] Example for a second table footnote. \end{tablenotes} \end{table} \end{center} Below is the example\cite{Liska2010,Kucharik2003,Blanchard2015} for bulleted list. Below is the example for bulleted list. Below is the example for bulleted list. Below is the example for bulleted list. Below is the example for bulleted list. Below is the example for bulleted list\footnote{This is an example for footnote.}: \begin{itemize} \item bulleted list entry sample bulleted list entry.\cite{Lauritzen2011} sample list entry text. \item bulleted list entry sample bulleted list entry. bulleted list entry sample bulleted list entry. bulleted list entry sample bulleted list entry. \item bulleted list entry sample bulleted list entry.\cite{Klima2017} bulleted list entry sample bulleted list entry.\cite{Dukowicz2000} sample list entry text. bulleted list entry sample bulleted list entry. \item sample list entry text. sample list entry text. \end{itemize} Suspendisse vel felis. Ut lorem lorem, interdum eu, tincidunt sit amet, laoreet vitae, arcu. Aenean faucibus pede eu ante. Praesent enim elit, rutrum at, molestie non, nonummy vel, nisl. Ut lectus eros, malesuada sit amet, fermentum eu, sodales cursus, magna. Donec eu purus. Quisque vehicula, urna sed ultricies auctor, pede lorem egestas dui, et convallis elit erat sed nulla. Donec luctus. Curabitur et nunc. Aliquam dolor odio, commodo pretium, ultricies non, pharetra in, velit. Integer arcu est, nonummy in, fermentum faucibus, egestas vel, odio. Sed commodo posuere pede. Mauris ut est. Ut quis purus. Sed ac odio. Sed vehicula hendrerit sem. Duis non odio. Morbi ut dui. Sed accumsan risus eget odio. In hac habitasse platea dictumst. Pellentesque non elit. Fusce sed justo eu urna porta tincidunt. Mauris felis odio, sollicitudin sed, volutpat a, ornare ac, erat. Morbi quis dolor. Donec pellentesque, erat ac sagittis semper, nunc dui lobortis purus, quis congue purus metus ultricies tellus. Proin et quam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Praesent sapien turpis, fermentum vel, eleifend faucibus, vehicula eu, lacus. Below is the sample for description list. Below is the example for description list. Below is the example for description list. Below is the example for description list. Below is the example for description list. Below is the example for description list:\\[12pt] \noindent\textbf{Description sample:} \begin{description} \item[first entry] description text. description text.\cite{Kucharik2011,Kucharik2014,Loubere2005} description text. description text. description text. description text. description text. \item[second long entry] description text. description text. description text. description text. description text. description text. description text. \item[third entry] description text. description text. description text. description text. description text. \item[fourth entry] description text. description text. \end{description} \noindent\textbf{Numbered list items sample:} \begin{enumerate}[1.] \item First level numbered list entry. sample numbered list entry. \item First numbered list entry. sample numbered list entry. Numbered list entry.\cite{Caramana1998} sample numbered list entry. Numbered list entry. sample numbered list entry. \begin{enumerate}[a.] \item Second level alpabetical list entry. Second level alpabetical list entry. Second level alpabetical list entry.\cite{Hoch2009} Second level alpabetical list entry. \item Second level alpabetical list entry. Second level alpabetical list entry.\cite{Shashkov1996,Knupp1999,Knupp1999} \begin{enumerate}[ii.] \item Third level lowercase roman numeral list entry. Third level lowercase roman numeral list entry. Third level lowercase roman numeral list entry. \item Third level lowercase roman numeral list entry. Third level lowercase roman numeral list entry.\cite{Kamm2000} \end{enumerate} \item Second level alpabetical list entry. Second level alpabetical list entry.\cite{Taylor1937} \end{enumerate} \item First level numbered list entry. sample numbered list entry. Numbered list entry. sample numbered list entry. Numbered list entry. \item Another first level numbered list entry. sample numbered list entry. Numbered list entry. sample numbered list entry. Numbered list entry. \end{enumerate} \noindent\textbf{un-numbered list items sample:} \begin{enumerate}[] \item Sample unnumberd list text.. \item Sample unnumberd list text. \item sample unnumberd list text. \item Sample unnumberd list text. \end{enumerate} \section{Examples for enunciations}\label{sec4} \begin{theorem}[Theorem subhead]\label{thm1} Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. Example theorem text. \end{theorem} Quisque ullamcorper placerat ipsum. Cras nibh. Morbi vel justo vitae lacus tincidunt ultrices. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In hac habitasse platea dictumst. Integer tempus convallis augue. Etiam facilisis. Nunc elementum fermentum wisi. Aenean placerat. Ut imperdiet, enim sed gravida sollicitudin, felis odio placerat quam, ac pulvinar elit purus eget enim. Nunc vitae tortor. Proin tempus nibh sit amet nisl. Vivamus quis tortor vitae risus porta vehicula. Fusce mauris. Vestibulum luctus nibh at lectus. Sed bibendum, nulla a faucibus semper, leo velit ultricies tellus, ac venenatis arcu wisi vel nisl. Vestibulum diam. Aliquam pellentesque, augue quis sagittis posuere, turpis lacus congue quam, in hendrerit risus eros eget felis. Maecenas eget erat in sapien mattis porttitor. Vestibulum porttitor. Nulla facilisi. Sed a turpis eu lacus commodo facilisis. Morbi fringilla, wisi in dignissim interdum, justo lectus sagittis dui, et vehicula libero dui cursus dui. Mauris tempor ligula sed lacus. Duis cursus enim ut augue. Cras ac magna. Cras nulla. Nulla egestas. Curabitur a leo. Quisque egestas wisi eget nunc. Nam feugiat lacus vel est. Curabitur consectetuer. \begin{proposition} Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. Example proposition text. \end{proposition} Nulla malesuada porttitor diam. Donec felis erat, congue non, volutpat at, tincidunt tristique, libero. Vivamus viverra fermentum felis. Donec nonummy pellentesque ante. Phasellus adipiscing semper elit. Proin fermentum massa ac quam. Sed diam turpis, molestie vitae, placerat a, molestie nec, leo. Maecenas lacinia. Nam ipsum ligula, eleifend at, accumsan nec, suscipit a, ipsum. Morbi blandit ligula feugiat magna. Nunc eleifend consequat lorem. Sed lacinia nulla vitae enim. Pellentesque tincidunt purus vel magna. Integer non enim. Praesent euismod nunc eu purus. Donec bibendum quam in tellus. Nullam cursus pulvinar lectus. Donec et mi. Nam vulputate metus eu enim. Vestibulum pellentesque felis eu massa. Quisque ullamcorper placerat ipsum. Cras nibh. Morbi vel justo vitae lacus tincidunt ultrices. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In hac habitasse platea dictumst. Integer tempus convallis augue. Etiam facilisis. Nunc elementum fermentum wisi. Aenean placerat. Ut imperdiet, enim sed gravida sollicitudin, felis odio placerat quam, ac pulvinar elit purus eget enim. Nunc vitae tortor. Proin tempus nibh sit amet nisl. Vivamus quis tortor vitae risus porta vehicula. \begin{definition}[Definition sub head] Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. Example definition text. \end{definition} Sed commodo posuere pede. Mauris ut est. Ut quis purus. Sed ac odio. Sed vehicula hendrerit sem. Duis non odio. Morbi ut dui. Sed accumsan risus eget odio. In hac habitasse platea dictumst. Pellentesque non elit. Fusce sed justo eu urna porta tincidunt. Mauris felis odio, sollicitudin sed, volutpat a, ornare ac, erat. Morbi quis dolor. Donec pellentesque, erat ac sagittis semper, nunc dui lobortis purus, quis congue purus metus ultricies tellus. Proin et quam. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Praesent sapien turpis, fermentum vel, eleifend faucibus, vehicula eu, lacus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit amet, egestas sed, leo. Praesent feugiat sapien aliquet odio. Integer vitae justo. Aliquam vestibulum fringilla lorem. Sed neque lectus, consectetuer at, consectetuer sed, eleifend ac, lectus. Nulla facilisi. Pellentesque eget lectus. Proin eu metus. Sed porttitor. In hac habitasse platea dictumst. Suspendisse eu lectus. Ut mi mi, lacinia sit amet, placerat et, mollis vitae, dui. Sed ante tellus, tristique ut, iaculis eu, malesuada ac, dui. Mauris nibh leo, facilisis non, adipiscing quis, ultrices a, dui. \begin{proof} Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. \end{proof} Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac orci et nisl hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a nulla. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis. Pellentesque cursus luctus mauris. Nulla malesuada porttitor diam. Donec felis erat, congue non, volutpat at, tincidunt tristique, libero. Vivamus viverra fermentum felis. Donec nonummy pellentesque ante. Phasellus adipiscing semper elit. Proin fermentum massa ac quam. Sed diam turpis, molestie vitae, placerat a, molestie nec, leo. Maecenas lacinia. Nam ipsum ligula, eleifend at, accumsan nec, suscipit a, ipsum. Morbi blandit ligula feugiat magna. Nunc eleifend consequat lorem. Sed lacinia nulla vitae enim. Pellentesque tincidunt purus vel magna. Integer non enim. Praesent euismod nunc eu purus. Donec bibendum quam in tellus. Nullam cursus pulvinar lectus. Donec et mi. Nam vulputate metus eu enim. Vestibulum pellentesque felis eu massa. \begin{proof}[Proof of Theorem~\ref{thm1}] Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. Example for proof text. \end{proof} Etiam euismod. Fusce facilisis lacinia dui. Suspendisse potenti. In mi erat, cursus id, nonummy sed, ullamcorper eget, sapien. Praesent pretium, magna in eleifend egestas, pede pede pretium lorem, quis consectetuer tortor sapien facilisis magna. Mauris quis magna varius nulla scelerisque imperdiet. Aliquam non quam. Aliquam porttitor quam a lacus. Praesent vel arcu ut tortor cursus volutpat. In vitae pede quis diam bibendum placerat. Fusce elementum convallis neque. Sed dolor orci, scelerisque ac, dapibus nec, ultricies ut, mi. Duis nec dui quis leo sagittis commodo. Aliquam lectus. Vivamus leo. Quisque ornare tellus ullamcorper nulla. Mauris porttitor pharetra tortor. Sed fringilla justo sed mauris. Mauris tellus. Sed non leo. Nullam elementum, magna in cursus sodales, augue est scelerisque sapien, venenatis congue nulla arcu et pede. Ut suscipit enim vel sapien. Donec congue. Maecenas urna mi, suscipit in, placerat ut, vestibulum ut, massa. Fusce ultrices nulla et nisl. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec odio elit, dictum in, hendrerit sit amet, egestas sed, leo. Praesent feugiat sapien aliquet odio. Integer vitae justo. Aliquam vestibulum fringilla lorem. Sed neque lectus, consectetuer at, consectetuer sed, eleifend ac, lectus. Nulla facilisi. Pellentesque eget lectus. Proin eu metus. Sed porttitor. In hac habitasse platea dictumst. Suspendisse eu lectus. Ut Curabitur tellus magna, porttitor a, commodo a, commodo in, tortor. Donec interdum. Praesent scelerisque. Mae- cenas posuere sodales odio. Vivamus metus lacus, varius quis, imperdiet quis, rhoncus a, turpis. Etiam ligula arcu, elementum a, venenatis quis, sollicitudin sed, metus. Donec nunc pede, tincidunt in, venenatis vitae, faucibus vel, \begin{sidewaystable \caption{Sideways table caption. For decimal alignment refer column 4 to 9 in tabular* preamble.\label{tab3}}% \begin{tabular*}{\textheight}{@{\extracolsep\fill}lccD{.}{.}{4}D{.}{.}{4}D{.}{.}{4}D{.}{.}{4}D{.}{.}{4}D{.}{.}{4}@{\extracolsep\fill}}% \toprule & \textbf{col2 head} & \textbf{col3 head} & \multicolumn{1}{c}{\textbf{10}} &\multicolumn{1}{c}{\textbf{20}} &\multicolumn{1}{c}{\textbf{30}} &\multicolumn{1}{c}{\textbf{10}} &\multicolumn{1}{c}{\textbf{20}} &\multicolumn{1}{c}{\textbf{30}} \\ \midrule &col2 text &col3 text &0.7568&1.0530&1.2642&0.9919&1.3541&1.6108 \\ & &col2 text &12.5701 &19.6603&25.6809&18.0689&28.4865&37.3011 \\ 3 &col2 text & col3 text &0.7426&1.0393&1.2507&0.9095&1.2524&1.4958 \\ & &col3 text &12.8008&19.9620&26.0324&16.6347&26.0843&34.0765 \\ & col2 text & col3 text &0.7285&1.0257&1.2374&0.8195&1.1407&1.3691\tnote{*} \\ & & col3 text &13.0360&20.2690&26.3895&15.0812&23.4932&30.6060\tnote{\dagger} \\ \bottomrule \end{tabular*} \begin{tablenotes \item[*] First sideways table footnote. Sideways table footnote. Sideways table footnote. Sideways table footnote. \item[$\dagger$] Second sideways table footnote. Sideways table footnote. Sideways table footnote. Sideways table footnote. \end{tablenotes} \end{sidewaystable} \begin{sidewaysfigure} \centerline{\includegraphics[width=542pt,height=9pc,draft]{empty}} \caption{Sideways figure caption. Sideways figure caption. Sideways figure caption. Sideways figure caption. Sideways figure caption. Sideways figure caption.\label{fig3}} \end{sidewaysfigure} nibh. Pellentesque wisi.\cite{Kucharik2012} Nullam malesuada. Morbi ut tellus ut pede tincidunt porta. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam congue neque id dolor. \begin{algorithm} \caption{Pseudocode for our algorithm}\label{alg1} \begin{algorithmic} \For each frame \For water particles $f_{i}$ \State compute fluid flow\cite{Hirt1974} \State compute fluid--solid interaction\cite{Benson1992} \State apply adhesion and surface tension\cite{Margolin2003} \EndFor \For solid particles $s_{i}$ \For neighboring water particles $f_{j}$ \State compute virtual water film \\(see Section~\ref{sec3}) \EndFor \EndFor \For solid particles $s_{i}$ \For neighboring water particles $f_{j}$ \State compute growth direction vector \\(see Section~\ref{sec2}) \EndFor \EndFor \For solid particles $s_{i}$ \For neighboring water particles $f_{j}$ \State compute $F_{\theta}$ (see Section~\ref{sec1}) \State compute $CE(s_{i},f_{j})$ \\(see Section~\ref{sec3}) \If $CE(b_{i}, f_{j})$ $>$ glaze threshold \State $j$th water particle's phase $\Leftarrow$ ICE \EndIf \If $CE(c_{i}, f_{j})$ $>$ icicle threshold \State $j$th water particle's phase $\Leftarrow$ ICE \EndIf \EndFor \EndFor \EndFor \end{algorithmic} \end{algorithm} Donec et nisl at wisi luctus bibendum. Nam interdum tellus ac libero. Sed sem justo, laoreet vitae, fringilla at, adipiscing ut, nibh. Maecenas non sem quis tortor eleifend fermentum. Etiam id tortor ac mauris porta vulputate. Integer porta neque vitae massa.\cite{Hirt1974,Benson1992} Maecenas tempus libero a libero posuere dictum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean quis mauris sed elit commodo placerat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Vivamus rhoncus tincidunt libero. Etiam elementum pretium justo. Vivamus est. Morbi a tellus eget pede tristique commodo.\cite{Benson1992} Nulla nisl. Vestibulum sed nisl eu sapien cursus rutrum. Pellentesque wisi. Nullam malesuada. Morbi ut tellus ut pede tincidunt porta. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam congue neque id dolor. Donec et nisl at wisi luctus bibendum. Nam interdum tellus ac libero. Sed sem justo, laoreet vitae, fringilla at, adipiscing ut, nibh. Maecenas non sem quis tortor eleifend fermentum. Etiam id tortor ac mauris porta vulputate. Integer porta neque vitae massa. Maecenas tempus libero a libero posuere dictum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean quis mauris sed elit commodo placerat. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos hymenaeos. Vivamus rhoncus tincidunt libero. Etiam elementum pretium justo. Vivamus est. Morbi a tellus eget pede tristique commodo. Nulla nisl. Vestibulum sed nisl eu sapien cursus rutrum. \begin{equation}\label{eq23} \|\tilde{X}(k)\|^2 =\frac{\left\|\sum\limits_{i=1}^{p}\tilde{Y}_i(k)+\sum\limits_{j=1}^{q}\tilde{Z}_j(k) \right\|^2}{(p+q)^2} \leq\frac{\sum\limits_{i=1}^{p}\left\|\tilde{Y}_i(k)\right\|^2+\sum\limits_{j=1}^{q}\left\|\tilde{Z}_j(k)\right\|^2 }{p+q}. \end{equation} Sed feugiat. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Ut pellentesque augue sed urna. Vestibulum diam eros, fringilla et, consectetuer eu, nonummy id, sapien. Nullam at lectus. In sagittis ultrices mauris. Curabitur malesuada erat sit amet massa. Fusce blandit. Aliquam erat volutpat. Aliquam euismod. Aenean vel lectus. Nunc imperdiet justo nec dolor. Etiam euismod. Fusce facilisis lacinia dui. Suspendisse potenti. In mi erat, cursus id, nonummy sed, ullamcorper eget, sapien. Praesent pretium, magna in eleifend egestas, pede pede pretium lorem, quis consectetuer tortor sapien facilisis magna. Mauris quis magna varius nulla scelerisque imperdiet. Aliquam non quam. Aliquam porttitor quam a lacus. Praesent vel arcu ut tortor cursus volutpat. In vitae pede quis diam bibendum placerat. Fusce elementum convallis neque. Sed dolor orci, scelerisque ac, dapibus nec, ultricies ut, mi. Duis nec dui quis leo sagittis commodo. \begin{equation}\label{eq24} \|\tilde{X}(k)\|^2 =\frac{\left\|\sum\limits_{i=1}^{p}\tilde{Y}_i(k)+\sum\limits_{j=1}^{q}\tilde{Z}_j(k) \right\|^2}{(p+q)^2} \leq\frac{\sum\limits_{i=1}^{p}\left\|\tilde{Y}_i(k)\right\|^2+\sum\limits_{j=1}^{q}\left\|\tilde{Z}_j(k)\right\|^2 }{p+q}. \end{equation} Aliquam lectus. Vivamus leo. Quisque ornare tellus ullamcorper nulla. Mauris porttitor pharetra tortor. Sed fringilla justo sed mauris. Mauris tellus. Sed non leo. Nullam elementum, magna in cursus sodales, augue est scelerisque sapien, venenatis congue nulla arcu et pede. Ut suscipit enim vel sapien. Donec congue. Maecenas urna mi, suscipit in, placerat ut, vestibulum ut, massa. Fusce ultrices nulla et nisl. Etiam ac leo a risus tristique nonummy. Donec dignissim tincidunt nulla. Vestibulum rhoncus molestie odio. Sed lobortis, justo et pretium lobortis, mauris turpis condimentum augue, nec ultricies nibh arcu pretium enim. Nunc purus neque, placerat id, imperdiet sed, pellentesque nec, nisl. Vestibulum imperdiet neque non sem accumsan laoreet. In hac habitasse platea dictumst. Etiam condimentum facilisis libero. Suspendisse in elit quis nisl aliquam dapibus. Pellentesque auctor sapien. Sed egestas sapien nec lectus. Pellentesque vel dui vel neque bibendum viverra. Aliquam porttitor nisl nec pede. Proin mattis libero vel turpis. Donec rutrum mauris et libero. Proin euismod porta felis. Nam lobortis, metus quis elementum commodo, nunc lectus elementum mauris, eget vulputate ligula tellus eu neque. Vivamus eu dolor. \section{Conclusions}\label{sec5} Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit, vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a, magna. Donec vehicula augue eu neque. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Mauris ut leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna fringilla ultrices. Phasellus eu tellus sit amet tortor gravida placerat. Integer sapien est, iaculis in, pretium quis, viverra ac, nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus. Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla. Curabitur auctor semper nulla. Donec varius orci eget risus. Duis nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis eget orci sit amet orci dignissim rutrum. Nam dui ligula, fringilla a, euismod sodales, sollicitudin vel, wisi. Morbi auctor lorem non justo. Nam lacus libero, pretium at, lobortis vitae, ultricies et, tellus. Donec aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna, vitae ornare odio metus a mi. Morbi ac orci et nisl hendrerit mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a nulla. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper vestibulum turpis. Pellentesque cursus luctus mauris. \section*{Acknowledgments} This is acknowledgment text.\cite{Kenamond2013} Provide text here. This is acknowledgment text. Provide text here. This is acknowledgment text. Provide text here. This is acknowledgment text. Provide text here. This is acknowledgment text. Provide text here. This is acknowledgment text. Provide text here. This is acknowledgment text. Provide text here. This is acknowledgment text. Provide text here. This is acknowledgment text. Provide text here. \subsection*{Author contributions} This is an author contribution text. This is an author contribution text. This is an author contribution text. This is an author contribution text. This is an author contribution text. \subsection*{Financial disclosure} None reported. \subsection*{Conflict of interest} The authors declare no potential conflict of interests. \section*{Supporting information} The following supporting information is available as part of the online article: \noindent \textbf{Figure S1.} {500{\uns}hPa geopotential anomalies for GC2C calculated against the ERA Interim reanalysis. The period is 1989--2008.} \noindent \textbf{Figure S2.} {The SST anomalies for GC2C calculated against the observations (OIsst).}
\section{Introduction} ``How did you go bankrupt?!'' Bill asked. ``Two ways,'' Mike said. ``Gradually and then suddenly'' -- Hemmingway \cite{hemingway1926sun}. This oft referenced phrase aptly describes how substantial changes that take a long time to develop can appear to happen all at once. The extrajudicial killings of George Floyd, Breanna Taylor, Ahmed Arbrey, Tony McDade, and others, in combination with a poorly-managed pandemic that is disproportionately damaging the Black community, has poured gas on a growing blaze, calling on us to truly address the extent of anti-Black systemic racism in the United States and abroad. Through this lens, many in the AI community are asking: ``What can I do to combat systemic racial injustice?". The aim of this work is to help community members better identify and understand the scale and scope of anti-Black bias within our AI community and illustrate some concrete steps that members can take to help mitigate these issues and build a more just community. To summarize our contributions we first establish the necessity of recognizing the scale and scope of anti-Blackness and how it permeates all of our institutions. We then identify areas within academia where anti-Blackness is magnified or reinforced and propose actions for faculty, graduate students, and conferences to take to minimize these deficiencies. \section{Background} Students of optimization go through a stage where they see every problem as an optimization problem. Similarly, students of racism must go through a stage where they realize that anti-Black racism impacts every aspect of our society. This acknowledgement is not sufficient to dismantle systems of racism; however, it is a necessary first step and allows one to better appreciate the scope of the issues that we are trying to solve. Issues such as access to healthcare\cite{feagin2014systemic}, clean air \cite{bravo2016racial}, quality education \cite{harper2009access}, credit \cite{blanchflower2003discrimination}, clean water \cite{pulido2016flint}, housing \cite{williams2005changing}, public transit \cite{williams2005changing}, voter suppression \cite{bentele2013jim}, fair wages \cite{coleman2003job}, and criminality \cite{brewer2008racialization} all have roots in anti-Blackness. \par We restrict our focus to the AI community and ways in which we contribute to anti-Black racism. While the focus of recent protests have been centered around anti-Black bias in the criminal justice system, we will expand our scope to include more ways in which we propagate systemic harm: in our sources of funding, in who we allow to participate in our community, in what problems we address or exacerbate through our research and applications, and in what set of principles we allow to guide us. \section{Examining Systems of Racism} We propose a simplifying model for examining the sources of systemic racism that permeate our communities. The first source of systemic racism that we explore are discrepancies in physical resources. This includes differences in wealth, income, access to computing resources, access to clean air or water, healthcare, and transportation, amongst other areas. Included in this list, though perhaps more abstract, is time; time spent dealing with all other issues of race is also time not explicitly spent improving skills that are more greatly valued than "the ability to navigate racism." The second source that we will explore is social resources. Who we know and who knows us are tremendous factors in explaining the opportunities presented in our life \cite{calvo2004effects}. Large percentages of open roles in technology companies are filled via referrals; the compensation structures in CS/AI are hidden and structured in such a way that you have to know someone to know what is fair. Projects are rarely, if ever, completed with one individual and who you know informs what you work on, what opportunities you are aware of, who can vouch for you, and what social structures accept you as a member. Jones et al.(2013) \cite{jones20132013, jones2014self} observe that $75\%$ of White people have entirely White social networks, while the average White persons social network is only $1\%$ Black. This remarkable racial stratification of social networks combined with the prominent role that social networks play in our successes, lead to further racial inequity. Lastly, we look at racial discrepancies in ``measures'', i.e., anything that is used to evaluate, punish, or reward individuals. At this moment, the most prominent example of measures are discrepancies in policing. While Black and White people use drugs at similar rates, those arrested and convicted for drug offenses are disproportionately Black. Measures of aptitude, such as the SAT or GRE, have also shown racial bias. The same can be said for teacher evaluations, coding interviews, open-source project contributions, company promotion cycles, and in-school suspension rates. A overwhelming number of measures of quality have been shown to exhibit or allow for racial biases. These three categories of systemic bias--physical resources, social resources, and measures--are not all encompassing and many overlap (e.g., credit may be viewed as a measure of quality or a physical resource), but they serve as a good starting point to dissect systems of systemic bias. \section{Academia} When examining systems, whether they be systems of injustice and otherwise, the importance of feedback mechanisms cannot be understated. Since Academia serves as both the touchstone of the AI community as well as the developmental environment for new AI talent, any biases or discrepancies within Academia will be propagated to other places that AI touches and feed back into the next generations of Academia where it may further enhance systemic biases. As such, Academia is not only obligated to halt practices that disproportionately impact the Black community, but also to repair the damage that has been done through generations of neglect. \subsection{Faculty} Our faculty set the tone for our community. If our community is to ever achieve equity, it will inevitably require buy-in and focused effort from our faculty. Our professors decide which topics and prior research are highlighted in courses, who is admitted into our programs, and what criteria is required to attain a degree. They are tasked with simultaneously advancing the state of our field and training the next generation of leaders. Consequently, it is pertinent for AI faculty to fully understand all the ways that systemic racism pervades our field and help identify ways to address it. \begin{itemize} \item Who is admitted? \par We assert that there is no objective way to determine research potential, and we believe that this is the primary goal of the admissions process. Grade point averages, letters of recommendation, research publications, and GRE scores are some of the major factors used in determining who will be admitted to a graduate program. Studies have shown that GRE scores are racially biased \cite{miller2014test}. Publications and letters of recommendation are largely influenced by the physical resources that are available to you and the researchers that exist in your social network. Research is seldom a task done in isolation and modern AI research frequently requires access to substantial computational resources. For these reasons, measures of research output and letters of recommendations systemically disadvantage Black applicants and also feed back into the applicant pool in a way that amplifies existing bias. These components help to produce a system where it is hard to make meaningful changes along the lines of racial diversity and inclusion. \par What can we do? The shortest answer is ``take risks.'' Right now, we screen for students that are similar to previous successful students in some manner. Admitting students whose experiences and achievements look differently than previous cohorts may seem risky; however, years of studying explore-exploit trade-offs should help us to more confidently take risks. If we continue to wait for a flood of Black candidates whose paper applications look identical to students that have been admitted for the last $K$ years, we are misunderstanding the fundamentals of systemic racism and how it contributes to what opportunities and achievements candidates with similar potentials and different backgrounds have access to. \item Who is mentored? \par If the goal of admissions is to select based upon research potential, the goal of mentorship is to develop research potential. We use mentorship as a catch-all term for early-career researchers (graduate and undergraduate) whom we help to train. A useful exercise may be to examine who you have written letters of recommendation for within the last $~5$ years. Does the diversity of this list reflect the diversity you would hope to see in the field? Unless we are very intentional, it is likely that our mentorship list is even less diverse than the department in which we work. The reasons for this are varied and may range from potential mentees' awareness of research opportunities, comfort reaching out to faculty, availability of research funding/ability to self-fund, and social connections with students within our labs. Ways to change this number may include actively reaching out to promising underrepresented students in our classrooms, participating in targeted summer REU programs, and publicizing transparent protocols on how interested students may get involved with our labs. If our campuses are not diverse enough to generate a robust pool of diverse students, we may establish closer relationships with other campuses. There are several reasons why the number of students we mentor may not reflect the diversity we seek to achieve, many of which have nothing to do with the qualification or talents of diverse students. Sometimes the work of allies is to put in extra effort to make themselves as accessible as possible. \item Who are your collaborators? \par Current students should be your primary source of collaboration, yet who you work with at other institutions matters greatly. While collaborating with familiar faces and institutions has its benefits, it also means that you are less likely to encounter diverse people through the course of your research. This affects not only whose work you are familiar with, but also who is familiar with your work. \item What topics are emphasized and de-emphasized? \par What topics are valued in our community? Our community has done a tremendous job of simultaneously being driven by empirical performance of applications and avoiding consequential discussions on the implications of the applications that we focus on. \par We write this piece in the midst of an intense international spotlight on anti-Black violence enacted and enabled through our policing systems. Artificial Intelligence systems have enabled more efficient and pervasive tracking, monitoring, criminalization, and repression of Black people. Historically, law enforcement organizations have deployed intense and technologically sophisticated surveillance campaigns with the goals of dismantling movements for the civil rights of Black people. We mention all of this to illustrate that while the AI community has been reticent to proffer regulations or even guidance on how AI technology should be ethically used, it has already been adapted and applied in various settings to exacerbate existing inequalities within our society. Diversifying our field will not remedy the harms that our systems have been agents in causing, but not addressing these harms may further drive marginalized groups from our community. This can reasonably be seen as being complicit in the harms our systems produce. \par While work on fairness and ethical Artificial Intelligence exists, it has not received the same attention as more popular and controversial works such as facial recognition. The most-cited example o3f ethical AI that I have found has $ \sim1300$ citations \cite{barocas2016big}, while several facial recognition works, e.g., FaceNet, from the same time period have $\geq 3000$ \cite{parkhi2015deep, taigman2014deepface, schroff2015facenet}. Emphasising and centering research which deals with the societal implications of Artificial Intelligence is necessary to ensure that Artificial Intelligence has a positive impact on our societies. \item What schools/labs are feeders? \par Analyses of professors of Computer Science programs\cite{Huang:2014} indicate that 10 Computer Science programs are responsible for producing more than 50 percent of all CS faculty across the United States. Disproportionate representation in these programs produces cascading effects that influence all other departments in the U.S. Sourcing graduate students or lab visitors primarily from institutions that have issues with retaining or attracting Black students to their programs further compounds the problem of under-representation because it allows these issues to spread to other schools. It is tempting to assume our problem with representation stems from a lack of suitable candidates. However, Black students making up $\geq 4\%$ of CS undergraduate degrees yet $\leq 1\%$ of PhDs, indicates that PhD programs suffer from a distinct drop-off that undergraduate diversity issues fail to explain. The reasons for this drop off are complex, but we believe one of them might be based on which schools serve as feeder schools into these PhD programs. Despite having $1/10^\text{th}$ the students, the 101 HBCUs produce more Black Computer Science Bachelor's degrees than the 115 R1 institutions in the U.S. PhD applications are designed to favor research experiences thus, the fact that such a large portion of Black CS undergraduates stem from institutions where research is not funded and/or prioritized as much as it is at R1 institutions puts Black applicants at a fundamental disadvantage. To conduct a quick self audit, you may look at the 11 HBCUs listed below, which graduate the largest numbers of Black CS students, and see how connected they are to your department \cite{Women:2018, Hbcu:2016}. \par \begin{itemize} \item North Carolina A \& T \item Southern University \item Norfolk State University \item Johnson C. Smith University \item Florida A \& M \item Alabama A \& M \item South Carolina State University \item Lane College \item Rust College \item University of Arkansas Pine Bluff \item Virginia State University \item Morehouse College \end{itemize} \item What companies are students recruited from/funneled into? \par Despite the aspirational nature of Artificial Intelligence's ideals, applications of AI have inflicted real harm on Black people. How you engage with companies that profit from anti-Black policies matters. Who do you take funding from? Who do you allow to recruit on campus? Who do you have informal relationships with? Where do your students end up working? I offer these as provocative questions and do not purport to offer prescriptive answers. However, I think it is important for our organizations to have these conversations and work on deciding our own ethical lines, if for no other reason than to mitigate the risk of scandal for money that we have accepted from nefarious sources. \item Who is hired? \par As we climb the ladder of academia, institutions become more and more risk-averse. Whereas there might be a willingness to take a chance on an undergraduate or summer visitor, this willingness drops when it comes to graduate students, post-docs, and especially faculty. If we want to truly move the needle on anti-Blackness in our community, the hiring and retention of Black professors must be addressed. The first stage of a research project is establishing relationships and, historically speaking, Black faculty have done a much better job of establishing relationships with Black students than other faculty. Fixing this discrepancy is not just about who is visible at the top, but about who is better positioned to succeed at all levels of your pipeline. \par Producing an equitable hiring process will require evaluating all aspects of the procedure with an eye for where biases may manifest. Are diversity efforts \textit{appropriately} valued with sufficient rigor and weighting? Are we drawing from representative pipelines and accounting for discrepancies in physical and social resources? \item How much do you pay? \par Systems that require financial ``sacrifice" in order to attain professional advancement are extremely effective at removing high achieving Black people from the leadership pipeline. The length of sacrifice and the drastic difference in earning potential and realized compensation of Computer Science PhD students makes this community one of the worst known examples of this discriminatory mechanism. \par While discrepancies in graduate student pay affect all students, the 10x difference in median wealth between Black and White families means that Black students or potential students will be disproportionately impacted by a drop in income. This design choice, which has gone unaddressed for generations, creates a scenario in which a large number of qualified and interested Black students simply cannot afford to attend graduate school. Some schools and programs are aware that this opportunity cost is driving talented researchers away from academia and have developed quasi-official corporate partnerships that provide AI graduate students with supplemental incomes. However, these relationships are often opaque and invisible to students and communities without close insider connections. The unfortunate impact of this is that even if your program happens to be one that has made significant improvements to the compensation and quality of life of expected graduate students, potential Black students who would benefit the most from these changes are likely unaware of any improvements that you have made in this arena. \item What is the campus environment? \par Are the Black students on your campus adequately supported? This is a complicated question to answer and perhaps the best method of answering this question is by talking to your current and former Black students. A lot of students make it through graduate programs with traumatic experiences and unless there are Black professors, may not trust any faculty members enough to be candid about the problems in their environment. If and when you hear complaints from Black students, recognize that sharing these issues often constitutes a risk for these students and it is imperative to listen without becoming defensive. \item What programs and resources are in-place? \par Systems that perpetuate anti-Black bias exist within the AI community just as strongly as they do in most other spaces. What resources have you committed to combating them? How has your lab, your department, your university, and larger community organizations in which you are a member addressed issues related to systemic anti-Blackness? Instead of proclaiming your beliefs and convictions, demonstrate them through investments and actions. Making significant changes in racial equity in our institutions is achievable but will require tangible effort from people other than those who are discriminated against. \end{itemize} \subsection{Graduate Students} \begin{itemize} \item Who benefits from diversity? \par While substantial research has shown that diverse teams achieve better performance\cite{hunt2015diversity}, we reject this predatory view of diversity in which the worth of underrepresented people is tied to their value add to in-group members. We argue for combating anti-Blackness through the lens of justice. As such, all members of the community should be invested in developing a more inclusive and less discriminatory environment. \item Who works towards diversity? \par Black graduate students (and faculty) shoulder an extraordinary amount of the burden of "diversifying" university campuses. One of the most impactful actions an ally can take is help to do this work. This participation will not only help to create a more diverse campus, but will also allow your Black peers to spend more time on their research and help them to attain successful graduate school careers. Understanding how to best assist in anti-Racism efforts may seem challenging or intimidating at first, but many of the necessary tasks are relatively simple and do not require an advanced degree in Black studies to result in meaningful contributions. Show up early, ask what you can do to support, volunteer to take over a non-leadership role. For example: "Hey, I would like to help secure food for all the NSBE meetings this semester." While the current levels of attention on anti-racism might be fleeting, the magnitude of effort required for change is not; show up consistently and be willing to be lead. \item Who collaborates or studies with whom? \par Lack of social integration is a significant factor in disparate outcomes and experiences Black graduate students face in Academia. Lunches, dinners, happy hours, and game nights are activities that bear no direct relationship with technical merits but significantly contribute to the sense of safety and belonging that Black students in your program seek. As with most professions, social interactions often lead to professional opportunities. Within graduate school, study groups, research collaborations, and workshop organizers are often selected through a mix of social and academic ties. Reforming our social networks, as well as those of our entire community, is a formidable task, but while we are in the process of doing that we can actively acknowledge when biased social ties are influencing professional advancement and do our best to mitigate this. To state it frankly, put in the extra effort to know your Black colleagues' skills and interests and when opportunities present themselves that might align well with these students be sure that they are given fair consideration and not excluded because they are not in the right social groups. \item Which undergrads do you mentor? \par Who we invest our time in matters. The undergraduates that we mentor today will likely constitute the next generation of graduate students so it is imperative that we intentionally invest our time and mentorship capacity in diverse student populations. Oftentimes, the mechanisms of how to become involved in undergraduate research are hidden and subjective. One of the biggest levers we have to increase diversity in graduate school is to increase diversity in undergraduate research. To do this well, we should focus on both encouraging more underrepresented minorities to participate in undergraduate research and recruiting more graduate students to serve as mentors. \par Additionally, it is necessary that we focus on finding funding for undergraduate researchers. Unpaid internships have a long history in the U.S. and one of their functions is to reinforce racial inequalities. We must work diligently at prohibiting this practice at our institutions. The ability to perform unpaid labor is often a privilege only afforded to those of substantial financial means. The following framing may help others more fully understand the role that compensation for undergraduate researchers plays in amplifying socio-economic inequality in our field. Let $C = U + P$ represent the total capacity for undergraduate mentorship within a department. While $U$ and $P$ represent the unpaid and paid researchers. The unpaid research slots, $U$, are reserved exclusively for high socio-economic students and the paid slots $P$ are to be split between students of all socio-economic backgrounds. Ignoring all other sources of systemic bias, this arrangement alone produce a system that significantly disadvantages Black students while serving as the primary pool for future graduate students. Calculating the true numbers for $P$ and $U$ in your institution should be a relatively straightforward process that can effectively illustrate just how skewed some of our current systems are. \item Who does the "devil's advocate" serve? \par Racism exists. It exists in our neighborhoods, in our departments, and in our labs. Conversations that question its existence are either intellectually lazy or conducted with ill intent. To have productive conversations and institute changes, we must avoid continually rehashing whether this well-documented phenomenon is a well-documented phenomenon. Just as a budget meeting filled with constant debate about the existence of currency is unproductive, so too is a discussion around anti-Blackness in which we refuse to name it or engage in meaningless debate over its existence. To address anti-Blackness, we cannot continue to indulge the whims of misinformed individuals or bad actors and offer them as much space as those working through active solutions. \end{itemize} \section{Discussion} Through this work, we discuss several areas within the Artificial Intelligence community where systems perpetuate Anti-Blackness. This work falls woefully short of being comprehensive and intentionally does not discuss systems of racism within industry, conferences, or pipelines of capital. This work also does not address issues of sexism within our community, whose effects are compounded with racism to disproportionately impact Black women. The ultimate goal of this work is to assist in creating a more equitable Artificial Intelligence community whose broader impact includes reducing Anti-Blackness in our society. While not simple, we wholeheartedly believe that this is a tractable task and call upon our community to help make this happen. \bibliographystyle{plain}
\section*{Abstract} {\bf We propose a technique called Optimal Analysis-Specific Importance Sampling (OASIS) to reduce the number of simulated events required for a high-energy experimental analysis to reach a target sensitivity. We provide recipes to obtain the optimal sampling distributions which preferentially focus the event generation on the regions of phase space with high utility to the experimental analyses. OASIS leads to a conservation of resources at all stages of the Monte Carlo pipeline, including full-detector simulation, and is complementary to approaches which seek to speed-up the simulation pipeline. } \vspace{10pt} \noindent\rule{\textwidth}{1pt} \tableofcontents\thispagestyle{fancy} \noindent\rule{\textwidth}{1pt} \vspace{10pt} \section{Introduction} \subsection{Background} Numerical simulations play a key role in collider physics. Since typically there are no closed form expressions for the distribution of reconstructed collider events under various theory models, Monte Carlo (MC) methods \cite{James:1980yn} are needed to simulate the experimental outcomes predicted by competing theory models (or by different model parameters for the same theory model). Inferences about the underlying model and its parameters can then be made by comparing the observed data against the simulations. The sensitivity of such an inferential analysis depends both on the number of \emph{real} events $N_r$ in the experimental data and on the number of \emph{simulated} events $N_s$ available---the finiteness of the real and simulated samples introduces statistical uncertainties in the estimation of the true and theory-model distributions, respectively. In general, these uncertainties reduce with increasing volume of data; and while the available statistics for $N_r$ is determined by the integrated luminosity of the experiment, the amount of simulated data is in principle under our control. That is why it is desirable to have a sufficient volume of simulated data, i.e., $N_s\ggN_r$, so that the statistical uncertainty from its finiteness is not a dominant source of uncertainty in the analysis. However, the pipeline for simulating reconstructed collider events is computationally expensive, and this poses an immense challenge to the high energy physics (HEP) community in terms of computational and storage resources. As a result, much too often experiments are forced to settle on an acceptable, but perhaps not ideal, value of $N_s$, which leads to additional limitations on the sensitivity \cite{Barlow:1993dm}. This problem is expected to be exacerbated in the high-luminosity phase of the Large Hadron Collider (LHC) \cite{Adamova:2017wfe,Alves:2017she,Charpentier:2019enj,Buckley:2019wov,Valassi:2020ueh}. For this reason, many interesting ideas have been recently proposed to speed up individual stages of the simulation pipeline, as well as the entire pipeline \cite{deOliveira:2017pjk,Paganini:2017hrr,Paganini:2017dwg, Musella:2018rdi, Erdmann:2018jxd, Monk:2018zsb, Bothmann:2018trh, Carminati:2018khv Otten:2019hhl,Hashemi:2019fkn,Provasoli:2019tzz,DiSipio:2019imz,Bauer:2019qxa,Maevskiy:2019vwj,Butter:2019cae,Carrazza:2019cnt, Vlimant:2019tkb,Vallecorsa:2019ked Lancierini:2019imq Farrell:2019fsm Cheong:2019upg,Martinez:2019jlu,Belayneh:2019vyx, Buhmann:2020pmy}. The full detector simulation is the most resource-intensive aspect in this problem. In this paper we shall provide a parton-level optimization which, as we will discuss, would nevertheless result in resource conservation at all stages of the simulation pipeline. While motivated by the specific problem arising in HEP, we believe that our ideas are of more general mathematical interest and could potentially be usefully applied in other fields as well. The first step of the simulation pipeline is the parton-level event generation \cite{Buckley:2011ms,Buckley:2019kjt}. The distribution of parton-level events can be computed from the relevant matrix-elements and parton distribution functions (pdfs). However, it is not straightforward to sample events according to a given multi-dimensional distribution, except in special cases (e.g., when the distribution is specifically engineered to be easy to sample from). This difficulty is typically handled as follows. Let the multi-dimensional random variable ${\bm{x}}$ represent a parton-level event and let $f({\bm{x}})$ be the differential cross-section (unnormalized distribution) of ${\bm{x}}$ for a given process under a given theory model. The integral of $f$ over the domain gives the cross-section of the process under consideration. With this backdrop, the goal of the MC simulation is twofold: \begin{itemize} \item \textit{Event generation.} On the one hand, to obtain a sample of events distributed throughout the phase space as-per $f$: \begin{equation} \frac{dn}{d{\bm{x}}} \propto f({\bm{x}})~. \label{eq:dndxsimf} \end{equation} \item \textit{Cross-section estimation.} At the same time, to compute the integral of $f$ \begin{equation} F \equiv \int d{\bm{x}}~f({\bm{x}})~, \label{eqn:Fintegral} \end{equation} which can be used to properly normalize \eqref{eq:dndxsimf}, e.g., to scale the simulations to match the available statistics in the real data. \end{itemize} In order to accomplish these goals, one makes use of an alternative normalized distribution $g({\bm{x}})$, referred to as the sampling distribution, which is easy to sample from. Then, as an alternative to generating events as-per $f({\bm{x}})$, we can generate events according to $g({\bm{x}})$ and weight each sampled event ${\bm{x}}$ by \begin{equation} w({\bm{x}})\equiv \frac{f({\bm{x}})}{g({\bm{x}})}~. \label{eqn:wdef} \end{equation} The mean weight of the sampled events can serve as an estimate of the integral $F$, since \begin{equation} F = \int d{\bm{x}}~f({\bm{x}})~\frac{g({\bm{x}})}{g({\bm{x}})} = \int d{\bm{x}}~g({\bm{x}})\;w({\bm{x}}) \equiv E_g[w({\bm{x}})]~, \label{eqn:avgweight} \end{equation} where $E_g[\,\cdots]$ is the expected value of $\,\cdots$ under the sampling distribution $g$. This technique is referred to as ``importance sampling'' (IS) \cite{Press:1992zz}. The only requirements for the technique to work are: \begin{itemize} \item we can efficiently sample events ${\bm{x}}$ as-per the distribution $g({\bm{x}})$, \item we can compute $g({\bm{x}})$ for every sampled event ${\bm{x}}$, so that $w$ is exactly computable from \eqref{eqn:wdef}, \item $f({\bm{x}}) \neq 0 \implies g({\bm{x}}) \neq 0$, i.e., the support of the distribution $g$ contains the support of the distribution $f$.\footnote{It is sufficient for this condition to be satisfied \emph{almost everywhere}.} \end{itemize} A key observation at this point is that the quality of the simulated dataset (with regards to a given objective) depends on the sampling distribution $g$. We can then use the freedom of choosing $g({\bm{x}})$ to match a specific goal. For example, if the distribution $f$ is highly singular, and we want to properly map out the peak and to obtain a reliable estimate of $F$, $g$ needs to match the singularity structure of $f$ well enough to adequately sample the different regions of the phase space. More concretely, if $N_s$ simulated events $\{{\bm{x}}_1,{\bm{x}}_2,\dots{\bm{x}}_{N_s}\}$ are used to estimate\footnote{In what follows, we use a hat symbol to indicate an estimate of some quantity.} $F$ as \begin{equation} \hat{F} = \frac{1}{N_s} \sum_{i=1}^{N_s} w({\bm{x}}_i)~, \end{equation} then the variance of the estimate will be given by \begin{align} \var_g\left[\hat{F}\right] = \frac{1}{N_s^2} \var_g\left[\sum_{i=1}^{N_s} w({\bm{x}}_i)\right] = \frac{\var_g\left[w({\bm{x}})\right]}{N_s}~, \end{align} where $\var_g[\,\cdots]$ represents the variance of $\cdots$ under the sampling distribution $g$. This means that the quality of the estimation of $F$ will be better if the variance of $w$ is lower. The ideal situation is when $w({\bm{x}})$ is constant\footnote{This condition needs to only be satisfied \emph{almost everywhere} for optimal estimation of $F$.} and equal to $F$ for all ${\bm{x}}$, or equivalently, if $g({\bm{x}}) = f({\bm{x}})/F$. In other words, the closer the shape of the sampling distribution $g$ is to the shape of the underlying (unnormalized) theory distribution $f$, the better the estimation of $F$. Instead of minimizing the variance of $w$, an alternative procedure often found in the literature is the minimization of the maximum weight $w_\mathrm{max}$, which improves the so called unweighting efficiency $\langle w\rangle / w_\mathrm{max}$, whose inverse is the average number of weighted events needed in order to generate one unweighted event distributed as per $f$. This approach also seeks to reduce the distance between the distributions $f$ and $g$, albeit captured by a different measure $w_\mathrm{max}$. This has been the guiding principle for previous importance sampling approaches including the \texttt{VEGAS} algorithm \cite{PETERLEPAGE1978192,Lepage:1980dq}, \texttt{Foam} \cite{Jadach:1999sf,Jadach:2002kn,Jadach:2002ce,Jadach:2005ex}, and more recent machine learning based approaches \cite{Bendavid:2017zhk,Klimek:2018mza,10.1145/3341156,Gao:2020vdv,Gao:2020zvv,Bothmann:2020ywa}. All these methods implement event sampling strategies that attempt to reduce the distance between the sampling distribution $g$ and the theory distribution $f$.\footnote{An alternative approach, motivated by recent advances in Machine Learning (ML), replaces the exact distribution $f$ with an (approximate) ML regressor trained on a small sample of events produced from $f$ \cite{Otten:2018kum,Bishara:2019iwh,Badger:2020uow}, leading to an increase in the \emph{rate} but not necessarily the \emph{precision} of the simulation \cite{Matchev:2020tbw}. These methods use points in the phase space for which $f$ is computed, and not events sampled from $f$.} \subsection{Optimal Analysis-Specific Importance Sampling (OASIS)} The estimation of $F$ (the cross-section in a HEP setting) is related to the estimation of the expected number of events produced in an experiment from a given process under a given theory model. While this estimation is important, data analysis in HEP has come a long way from the simple counting experiments of the 20th century. In the LHC era, due to the large volume of experimental data available, most analyses study the \emph{distributions} of (possibly multi-dimensional) event variables. The choice of setting $g$ close to $f/F$, as we will discuss, is not optimal for the purposes of these analyses, namely to increase the sensitivity to a) the presence of a signal, or b) the value of a parameter. In fact, minimizing the variance of $w$ is not even optimal for the sensitivity of a simple counting experiment that involves some form of event selection prior to counting. By undersampling the regions of parton-level phase space that tend to fail the event selection cuts, and oversampling the rest of the phase space, one can get a better estimate of the expected number of events passing the event selection criteria using the same number of total simulated events \cite{Alves:2017she}. This, of course, is only one consideration that can influence the choice of the sampling distribution $g$, and can encourage a deviation of $g$ from $f$. The traditional viewpoint sees importance sampling as just a technique to allow sampling from the distribution $f$, and the weighted nature of the event sample is considered as an associated nuisance to be either controlled (via variance minimization) or efficiently eliminated (via unweighting). However, weighted events allow us to not only recycle existing simulated samples for different theory models \cite{Gainer:2014bta,Mattelaer:2016gcx} but also to preferentially focus event sampling in different parts of the phase space \cite{Madgraph,Pythia,Sherpa}, in line with the goals of the particular analysis at hand. Nature is constrained to produce (unweighted) events as-per the true underlying distribution $f$, whereas weighted simulations of a given theory model are not---in principle, one could use any sampling distribution $g$ satisfying the minimum requirements listed above. With this paper, we hope to kick-start efforts within the HEP community to leverage this freedom in order to produce simulated datasets that offer experimental analyses the opportunity to achieve \textbf{better sensitivity per simulated event , or equivalently, to approach the sensitivity floor (set by other sources of uncertainty) with fewer simulated events. This suggests a unique approach to mitigate the computational resource crunch in HEP. Complementary to ideas that seek to speed up the simulation pipeline, here we propose to reduce the simulation requirements of HEP experiments in the first place, by a) committing to weighted events and b) using a judicious choice of the parton-level phase space sampling distribution $g$. This is very important, because a reduction in the simulation requirements of an experiment represents \textbf{a conservation of resources at all stages of the simulation pipeline} including its computational bottleneck, the full detector simulation. We name this approach to importance sampling as Optimal Analysis-Specific Importance Sampling (OASIS). The key ideas of OASIS are the following: \begin{enumerate} \item Event weighting allows us to sample events according to a distribution $g$ which is \emph{different} from the theory distribution $f$ under consideration. \item The better sampled a given region of phase space is, the lower the uncertainty on the estimated differential cross-section in that region under the theory distribution $f$. \item Different regions of phase space are sensitive to different extents to the presence of a signal or to the value of a parameter. Consequently, different regions of phase space offer different levels of utility to the experimental analysis per simulated event, for the same value of $w$ (the ratio between $f$ and the sampling distribution $g$). \item Adding nuance (and complexity) to the previous point, collider analyses are performed on reconstructed events, typically reduced to low-dimensional event variables, after some event selection and/or categorization. As a result, different parts of the parton-level phase space will be mixed together (probabilistically) before being analyzed, say using histograms or parameterized fits. This means that the quality of inference from events from a particular region of the parton-level phase space depends not just on the sampling distribution in that region, but also on all other regions and other datasets\footnote{The MC datasets for a given analysis could be composed of several background and signal subsamples.} it will be mixed with \end{enumerate} In the rest of the paper, we will use these considerations to derive expressions that quantify the relationship between the sampling distribution $g$ and the sensitivity of the analysis that will use the (weighted) simulated dataset. We will also see how to use these expressions to optimally choose the sampling distribution $g$ that \textbf{maximizes the sensitivity of the experiment}, for a given computational budget for simulations---this is the optimality alluded to in the name of the technique. \section{OASIS at the parton-level} \label{sec:parton_level} To warm up, in this section we first tackle the case where the analysis is performed directly on the parton-level event ${\bm{x}}$, in its full dimensionality, i.e., without accounting for the complexities mentioned in point 4 above. We will restrict our attention to parameter measurement analyses---note that signal search analyses can be viewed as signal cross-section measurement analyses. \subsection{Groundwork} Let $\theta$ be the model parameter being measured in an analysis. The parton-level event distribution $f$, and hence the event weights $w$ will now be parameterized by $\theta$ as indicated by $f({\bm{x}}\,;\,\theta)$ and $w({\bm{x}}\,;\,\theta)$. In this section, we will deal with two kinds of uncertainties: \begin{itemize} \item \textbf{Statistical uncertainties in experimental data:} these are uncertainties originating from the finiteness of the experimental dataset ($N_r<\infty$). \item \textbf{Statistical uncertainties in simulated data:} these are uncertainties originating from the finiteness of the simulated datasets ($N_s<\infty$). When reporting experimental results they are usually listed under the broader category of ``systematic uncertainties''. \end{itemize} The sensitivity of the analysis to the value of $\theta$ near $\theta=\theta_0$ can interpreted as the extent to which values of $\theta$ near $\theta_0$ can be distinguished from each other based on the available data. This is captured by the Fisher information \cite{Cover2006} $\mathcal{I}(\theta_0)$ given by \begin{subequations} \label{eqn:FIboth} \begin{align} \mathcal{I}(\theta_0) &= L\;\int d{\bm{x}}~\frac{1}{f({\bm{x}}\,;\,\theta_0)}~\left.\left[\frac{\partial f({\bm{x}}\,;\,\theta)}{\partial\theta}\right]^2\right|_{\theta=\theta_0}\label{eqn:FIv0}\\ &=\int d{\bm{x}}~\frac{1}{L\,f({\bm{x}}\,;\,\theta_0)}~\left.\left[L\,\frac{\partial f({\bm{x}}\,;\,\theta)}{\partial\theta}\right]^2\right|_{\theta=\theta_0}~, \label{eqn:FI} \end{align} \end{subequations} where $L$ is the integrated luminosity of the experiment. Note that this is the Fisher information contained in the entire dataset treated as a random variable, and not just a single event, hence the presence of $L$ in the expression. We derive this expression for the Fisher information for the case when the total number of events is a Poisson distributed random variable (with $\theta$ dependent mean) in \aref{appendix:Fisher_derive}. If the true value of the parameter is $\theta_0$, $[\mathcal{I}(\theta_0)]^{-1}$ sets the lower limit on the variance of any unbiased estimator $\hat{\theta}$ for $\theta$ constructed out of the experimental data, according to the Cram\'er--Rao bound \cite{Cover2006}. Furthermore, this lower bound is achieved in the asymptotic limit by the Maximum Likelihood Estimator (MLE), provided the estimation is performed using the exact functional form for the true distribution $f$ \cite{NEWEY19942111}. In our case, however, this bound cannot be achieved since we do not know the exact functional form of $f$ and are only using a MC estimate for it. The expression for the Fisher information accounts only for the statistical uncertainties in experimental data. However, here we want to additionally account for the fact that realistic analyses rely on finite simulations to perform the parameter estimation---in particular $N_s$ events sampled as per a given sampling distribution $g({\bm{x}})$ and weighted accordingly. To incorporate the uncertainty due to the finiteness of the simulated sample, let us first intuitively understand the expression for the Fisher information in \eqref{eqn:FI}. Let $n_r$ be the number of events in a small bin of size $\Delta{\bm{x}}$ at a given value of ${\bm{x}}$, for a given value of $\theta=\theta_0$. Since $n_r$ is a Poisson distributed random variable, its mean and variance are both given by \begin{equation} E_f[n_r] = \var_f[n_r] = L\,f({\bm{x}}\,;\,\theta_0)\,\Delta{\bm{x}}~, \label{eqn:var_real} \end{equation} and the corresponding standard deviation is \begin{equation} \stddev_f[n_r] = \sqrt{L\,f({\bm{x}}\,;\,\theta_0)\,\Delta{\bm{x}}}~. \label{eqn:stddev_real} \end{equation} The difference in the expected counts under two different values of $\theta$ near $\theta_0$ that differ by a small value $\delta\theta$ is given by: \begin{equation} \delta\,E_f[n_r] \equiv L~\delta f~\Delta {\bm{x}} = \left.\left[L\,\displaystyle\frac{\partial f({\bm{x}}\,;\,\theta)}{\partial\theta}\right]\right|_{\theta=\theta_0}\,\Delta{\bm{x}}\,\delta\theta~. \end{equation} The statistical significance of this difference depends on its relative size with respect to the standard deviation of $n_r$ given by \eqref{eqn:stddev_real}. Now, \eqref{eqn:FI} can be seen as an analogue of the familiar ``(deviation over standard deviation) summed over bins in quadrature'' per unit $(\delta \theta)^2$. This line of reasoning lets us see why a higher value of $\mathcal{I}(\theta_0)$ corresponds to a greater distinguishability between neighboring values of $\theta$. Armed with this intuitive understanding, we can now introduce the statistical uncertainty from the simulated data into the expression for the Fisher information. Let the random variable $\nsim$ be the number of simulated events in a small bin of size $\Delta{\bm{x}}$ at a given value of ${\bm{x}}$, for a given value of $\theta=\theta_0$. The mean and variance of $\nsim$ are both given by \begin{equation} E_g[\nsim] = \var_g[\nsim] = N_s\,g({\bm{x}})\,\Delta{\bm{x}}~. \label{eq:Egnsim} \end{equation} Recall that the main purpose of doing the MC simulations was to construct an estimate for $E_f[n_r]$, say $n_\mathrm{est}$, out of $\nsim$. This can be done by scaling $\nsim$ by appropriate factors to account for a) the actual integrated luminosity in the experiment and b) the difference between the sampling distribution $g$ and the true distribution $f$: \begin{equation} n_\mathrm{est} \equiv \nsim \times \frac{L}{N_s} \times w({\bm{x}}\,;\,\theta_0)~. \end{equation} The expected value of this estimate $n_\mathrm{est}$ under $g$ (for a given value of ${\bm{x}}$) equals $E_f[n_r]$ as it should: \begin{subequations} \begin{align} E_g\left[n_\mathrm{est}\right] &= E_g[\nsim] \times \frac{L\,w({\bm{x}}\,;\,\theta_0)}{N_s}\\ &= N_s\,g({\bm{x}})\,\Delta{\bm{x}} \times \frac{L\,w({\bm{x}}\,;\,\theta_0)}{N_s} = L\,f({\bm{x}}\,;\,\theta_0)\,\Delta{\bm{x}} = E_f[n_r]~, \end{align} \end{subequations} where we have used \eqref{eqn:wdef}, \eqref{eqn:var_real}, and \eqref{eq:Egnsim}. The variance of the estimate $n_\mathrm{est}$ is given by: \begin{subequations} \begin{align} \var_g{[n_\mathrm{est}]} &= \var_g{[\nsim]} \times \left[\frac{L\,w({\bm{x}}\,;\,\theta_0)}{N_s}\right]^2\\ &= N_s\,g({\bm{x}})\,\Delta{\bm{x}}~\frac{L^2\,w^2({\bm{x}}\,;\,\theta_0)}{N_s^2}\\ &= \frac{L}{N_s}\,w({\bm{x}}\,;\,\theta_0) \times L\,f({\bm{x}}\,;\,\theta_0)\,\Delta{\bm{x}}~. \label{eqn:var_sim} \end{align} \end{subequations} Now, using \eqref{eqn:var_real} and \eqref{eqn:var_sim}, we can add the statistical uncertainty from the real data to the statistical uncertainty from the simulated data in quadrature\footnote{A subtle point is that these are not the uncertainties \emph{estimated} from the real or simulated datasets, but rather the uncertainties \emph{expected} in them under the true and sampling distributions $f$ and $g$.} as \begin{equation} \var_f[n_r] + \var_g[n_\mathrm{est}] = L\,f({\bm{x}}\,;\,\theta_0) \left[1 + \displaystyle\frac{L}{N_s}\,w({\bm{x}}\,;\,\theta_0)\right]~\Delta {\bm{x}}~, \label{eq:combinedvariance} \end{equation} which allows us to modify the expression for the Fisher information in \eqref{eqn:FI} as \begin{equation} \mathcal{I}_\mathrm{MC}(\theta_0) = \int d{\bm{x}}~\frac{\left.\left[L\,\displaystyle\frac{\partial f({\bm{x}}\,;\,\theta)}{\partial\theta}\right]^2\right|_{\theta=\theta_0}}{L\,f({\bm{x}}\,;\,\theta_0)~\left[1 + \displaystyle\frac{L}{N_s}\,w({\bm{x}}\,;\,\theta_0)\right]}~,\label{eqn:IOASIS1} \end{equation} where we have replaced the denominator in \eqref{eqn:FI} with the corresponding expression from \eqref{eq:combinedvariance} and the subscript ``MC'' indicates that this version of the Fisher information incorporates the uncertainty from the MC simulation \cite{Barlow:1993dm}. By construction, $\mathcal{I}_\mathrm{MC}$ captures the sensitivity of the experiment to the value of a parameter, when the analysis is performed by comparing the real dataset against simulations (likelihood-free inference). Since $\mathcal{I}_\mathrm{MC}$ scales linearly with the integrated luminosity (for a given value of $L/N_s$), we can factor it out and rewrite \eqref{eqn:IOASIS1} as \begin{subequations} \label{eqn:toyIMCboth} \begin{align} \Rightarrow \frac{\mathcal{I}_\mathrm{MC}(\theta_0)}{L} &= \int d{\bm{x}}~f({\bm{x}}\,;\,\theta_0)~\frac{~\left.\Big[\partial_\theta \ln[f({\bm{x}}\,;\,\theta)]\Big]^2\right|_{\theta=\theta_0}}{1 + \displaystyle\frac{L}{N_s}\,w({\bm{x}}\,;\,\theta_0)}\label{eqn:toyIMCv0}\\ &= \int d{\bm{x}}~f({\bm{x}}\,;\,\theta_0)~\frac{u^2({\bm{x}}\,;\,\theta_0)}{1 + \displaystyle\frac{L}{N_s}\,w({\bm{x}}\,;\,\theta_0)}~,\label{eqn:toyIMC} \end{align} \end{subequations} where $u({\bm{x}}\,;\,\theta)$ is defined as \begin{equation} u({\bm{x}}\,;\,\theta) \equiv \partial_\theta \ln[f({\bm{x}}\,;\,\theta)] = \frac{1}{f({\bm{x}}\,;\,\theta)}\frac{\partial f({\bm{x}}\,;\,\theta)}{\partial \theta}~. \end{equation} We will refer to $u({\bm{x}}\,;\,\theta)$ as the \emph{per-event score} at the parton-level. This is related to the \emph{score} of an observation used in the statistics literature, with the only distinction being that the integral $F$ of the distribution $f$ over the phase space is $\theta$ dependent, while the traditional score uses a normalized probability distribution\footnote{$\partial_\theta \ln(f/F)$ (as used in \cite{Brehmer:2018kdj,Brehmer:2019bvj,Brehmer:2019xox}) naturally appears in the expression for Fisher information when the experiment uses a given fixed number of real events, while $\partial_\theta \ln f$ naturally appears when the experiment has a given fixed integrated luminosity (with the actual number of events being a Poisson distributed random variable). The distinction should not matter much as long as $F$ is only weakly dependent on $\theta$.}. The per-event score in \eqref{eqn:toyIMC} captures the sensitivity of (the weight) of a given event to the value of $\theta$. It can be computed directly from the parton-level oracle used to compute $f({\bm{x}}\,;\,\theta)$. The quantity $\mathcal{I}_\mathrm{MC}(\theta_0)$ captures the relationship between the sampling distribution $g$ and the sensitivity of the analysis. Correspondingly, $\mathcal{I}_\mathrm{MC}(\theta_0)$ can be used as a performance measure to be \emph{maximized} by the \emph{optimal} sampling distribution. Note that $g({\bm{x}})$ features in \eqref{eqn:toyIMC} only through the weight $w({\bm{x}})=f({\bm{x}})/g({\bm{x}})$, so that for a given ${\bm{x}}$, lower values of $w$ correspond to higher sampling rates $g$. This is consistent with the integrand in \eqref{eqn:toyIMC} being negatively correlated with the weight $w$, since the integrand should increase with increasing sampling rate. However, we cannot assign small weights for all regions since, according to \eqref{eqn:avgweight}, the weights $w({\bm{x}})$ are constrained to have an expected value of $F$ under the sampling distribution $g$. In other words, we are playing a ``fixed sum game''---increasing the sampling rate in some regions must be accompanied by a corresponding decrease in the sampling rate in others. As a result, the sampling of different regions will need to be prioritized based on the true distribution $f$ and the per-event score $u$ of the events in the different regions---this is what we set out to do using OASIS. Before discussing how to use \eqref{eqn:toyIMC} to construct a good sampling distribution $g$, let us consider some special cases in order to gain some further intuition. \subsection{Special cases of \texorpdfstring{$\mathcal{I}_\mathrm{MC}$}{Imc}} In this subsection, we shall discuss several special cases of the main result \eqref{eqn:toyIMC}. For notational convenience, from now on the $\theta_0$ dependence of $f$, $F$, $w$, $u$, $\mathcal{I}_\mathrm{MC}$, $\mathcal{I}$, the optimal sampling distribution, etc., will not be explicitly indicated unless deemed useful. \subsubsection{Sampling directly from the true distribution} In order to make the connection to the conventional use of importance sampling, let us first consider the case when $g$ mimics $f$ well. For concreteness, let us assume that $g$ matches the true distribution $f$ exactly, i.e. \begin{equation} g({\bm{x}}) = \frac{f({\bm{x}})}{F}~. \end{equation} As a result, the weights are constant, $w = F$, and the denominator of the integrand in \eqref{eqn:toyIMCboth} can be taken out in front of the integral: \begin{equation} \mathcal{I}_\mathrm{MC} = \frac{1}{~1+ \displaystyle\frac{L\,F}{N_s}~}~I \approx \frac{1}{~1+\displaystyle\frac{N_r}{N_s}~}~I~. \label{eqn:geqf} \end{equation} Note that $L\,F$ is the \emph{expected} total number of events in the real dataset---barring some spectacular surprise in the data, this estimate should not be too far off from the number of events $N_r$ which were actually observed, hence the last approximate relation above. The prefactor $\left(1+LF/N_s\right)^{-1}$ is precisely the additional penalty that we have to incur for using finite simulation samples. Thus \eqref{eqn:geqf} quantifies the dependence of the sensitivity on the size of the simulated dataset $N_s$---the greater the value of $N_s$, the greater the sensitivity, but the returns diminish as the value of $N_s$ gets too large, due to the additive term ``1'' in the denominator. \subsubsection{Constant per-event score} As a second example, consider the case when the per-event score $u({\bm{x}})$ is constant in ${\bm{x}}$: \begin{equation} u({\bm{x}}) = \mathrm{const}. \end{equation} Then \eqref{eqn:toyIMC} gives \begin{subequations} \begin{align} \frac{\mathcal{I}_\mathrm{MC}}{L} &= u^2~\int d{\bm{x}}~ g({\bm{x}})~\frac{w({\bm{x}})}{1 + \displaystyle\frac{L}{N_s}\,w({\bm{x}})}\\ &\leq u^2~\frac{E_g[w({\bm{x}})]}{1 + \displaystyle\frac{L}{N_s}\,E_g[w({\bm{x}})]} \label{eqn:jensen}\\ &= u^2~\frac{F}{~1 + \displaystyle\frac{LF}{N_s}~} \approx \frac{u^2}{L}~\frac{N_r}{~1 + \displaystyle\frac{N_r}{N_s}~} ~, \end{align} \end{subequations} where $E_g[\,\cdots]$, as before, represents the expectation value under the sampling distribution $g$. In \eqref{eqn:jensen}, we have used Jensen's inequality \cite{jensen1906,Cover2006} and the fact that $w/(1+\alpha w)$ is a concave function in $w$ for a positive $\alpha$. The equality in \eqref{eqn:jensen} holds iff $w({\bm{x}}\,;\,\theta_0)$ is a constant almost everywhere. In other words, when the per-event score is immaterial, $\mathcal{I}_\mathrm{MC}$ is maximized if $g({\bm{x}}) = f({\bm{x}})/F$ almost everywhere, which is in agreement with conventional wisdom. This special case suggests that in the general case when the per-event score is not a constant, the optimal sampling distribution $g_\mathrm{optimal} \equiv f/w_\mathrm{optimal}$ will be such that the weights $w_\mathrm{optimal}$ depend only on the (absolute value of the) per-event score. This hunch will play a crucial role in constructing $g_\mathrm{optimal}$ later on in \sref{sec:weight_score}. \subsubsection{Insufficient simulated data} \label{sec:toolittle} Let us now consider the (unfortunate) situation when the amount of simulated data is very limited, i.e., \begin{equation} N_s\,g({\bm{x}}) \ll L\,f({\bm{x}}), \label{eqn:nosim} \end{equation} implying that in every region of the phase space the simulated data is much sparser than the real dataset. In this case \eqref{eqn:toyIMC} gives \begin{align} \frac{\mathcal{I}_\mathrm{MC}}{L} &\approx \int d{\bm{x}}~f({\bm{x}})~\frac{u^2({\bm{x}})}{~\displaystyle\frac{L}{N_s}\,w({\bm{x}})~} \label{eqn:nodata1}\\ \Rightarrow \mathcal{I}_\mathrm{MC} &\approx N_s~\int d{\bm{x}}~g({\bm{x}})~u^2({\bm{x}}) \label{eqn:nodata2} \end{align} and $\mathcal{I}_\mathrm{MC}$ is maximized when the sampling distribution $g$ focuses entirely on the most sensitive regions, i.e., those with the highest magnitude of per-event score $|u({\bm{x}})|$, since they offer the best bang for the buck in terms of sensitivity gained per event generated. The additive term ``$1$'' in the denominator in \eqref{eqn:toyIMC} was neglected in the limit \eqref{eqn:nosim} to arrive at \eqref{eqn:nodata1}, but its role is to capture the diminishing returns associated with an indefinite increase of the simulated statistics in some region (or increasing the total number of simulated event $N_s$) as we approach the uncertainty floor set by the statistical uncertainties in the real dataset. This term will eventually force the optimal sampling distribution to also cover other regions of the phase space with lower values of $|u({\bm{x}})|$, albeit with higher weights. \subsubsection{Too much simulated data} \label{sec:toomuch} Finally, let us consider the opposite limit to \eqref{eqn:nosim}, i.e., when the simulated data is much denser than the real dataset (in every region of the phase space) \begin{equation} N_s\,g({\bm{x}}) \gg L\,f({\bm{x}})~. \end{equation} Expanding the denominator in \eqref{eqn:toyIMC}, one obtains \begin{subequations} \begin{align} \frac{\mathcal{I}_\mathrm{MC}}{L} &\approx \int d{\bm{x}}~f({\bm{x}})~\left[1 - \frac{L}{N_s}\,w({\bm{x}})\right]~u^2({\bm{x}})\\ &= \frac{I}{L} - \frac{L}{N_s}~\int d{\bm{x}}~g({\bm{x}})~w^2({\bm{x}})~u^2({\bm{x}})~. \label{eqn:infNs_approx} \end{align} \end{subequations} In \aref{appendix:proofs_infNs} we show that this expression is maximized when $g({\bm{x}}) \propto f({\bm{x}})\,|u({\bm{x}})|$, i.e., \begin{equation} \lim_{N_s \rightarrow \infty}~~g_\mathrm{optimal}({\bm{x}}) = \frac{f({\bm{x}})\,|u({\bm{x}})|}{\displaystyle\int d{\bm{x}}~f({\bm{x}})\,|u({\bm{x}})|}~. \label{eqn:optinf} \end{equation} The corresponding optimal weights (in the large $N_s$ limit) are proportional to $|u({\bm{x}})|^{-1}$. \subsection{Constructing optimal sampling distributions} \label{sec:parton_pres} In this subsection, we will introduce some prescriptions for constructing the optimal sampling distribution that maximizes $\mathcal{I}_\mathrm{MC}$. We will refer to this procedure as ``training the sampling distribution'' regardless of whether machine learning techniques are used or not. Instead of reinventing the wheel, we will piggyback on existing importance sampling techniques whenever possible. Equation~\eqref{eqn:toyIMC} will serve as the starting point for all our prescriptions. We will assume that we are provided an oracle that can be queried for the value of $f({\bm{x}}\,;\,\theta_0)$ and $u({\bm{x}}\,;\,\theta_0)$ for different events ${\bm{x}}$. $\theta_0$ is the value of the parameter $\theta$ at which the dataset is to be produced, and it is also the parameter value near which we want the simulated dataset to offer the most sensitivity. In situations where the same simulated dataset will be reweighted for different values of $\theta$ \cite{Gainer:2014bta}, a representative value of $\theta$ can be used as $\theta_0$ for the purpose of training the sampling distribution. The term $L/N_s$ in \eqref{eqn:toyIMC} is a predetermined\footnote{The integrated luminosity $L$ is fixed from experiment while the total number of simulated events $N_s$ depends on the available computing resource budget.} parameter that specifies the size of he simulated dataset that will be generated using the OASIS-trained sampling distribution. Note that the expected number of events in the real dataset is $L\,F$. So, $L/N_s$ can be thought of as the ratio $N_r/N_s$ of real to simulated events used by the analysis, up to a factor of $1/F$ which can be estimated using a preliminary or preexisting dataset. As we will see in \fref{fig:money} and \fref{fig:money2}, sampling distributions trained at some value of $L/N_s$ will continue to be good at other values as well---in this sense, $L/N_s$ is just a heuristic parameter and an accurate pre-estimation of the parameter is not critical to the utility of the trained sampling distribution. \subsubsection{Adjusting the weights of cells in phase space} \label{sec:weightadjust} \texttt{Foam} \cite{Jadach:1999sf,Jadach:2002kn,Jadach:2002ce,Jadach:2005ex} is an importance sampling technique under which the phase space of the events is divided into several non-overlapping cells, with each cell $i$ having an associated probability, say $p_{\mathrm{cell}\,i}$, and an associated phase space volume $V_{\mathrm{cell}\,i}$. The individual cell-probabilities sum up to 1, \begin{equation} \sum_i p_{\mathrm{cell}\,i} =1~, \end{equation} and the individual cell volumes add up to the total phase space volume $V_\mathrm{tot}$: \begin{equation} \sum_i V_{\mathrm{cell}\,i} = V_\mathrm{tot}~. \end{equation} After constructing the cells (and their associated probabilities), the sampling of an event under \texttt{Foam} is done is two steps: 1) choose a cell as per the probabilities $p_{\mathrm{cell}}$, and 2) choose an event uniformly at random within the chosen cell. This ``piecewise uniform'' sampling distribution is given by \begin{equation} g({\bm{x}}) = \frac{p_{\mathrm{cell}({\bm{x}})}}{V_{\mathrm{cell}({\bm{x}})}}~, \label{eqn:piecewise} \end{equation} where $\mathrm{cell}({\bm{x}})$ is the cell that event ${\bm{x}}$ belongs to. A simple approach to performing OASIS is to work with the cells induced by \texttt{Foam} (or a different cellular importance sampling technique\footnote{Since \texttt{VEGAS} assumes the factorizability of the integrand, it may not offer sufficient flexibility to adjust the probabilities of the individual cells of the rectangular grid.}), and simply adjust the probabilities $p_\mathrm{cell}$ for choosing the different cells.\footnote{Although the cells in \texttt{Foam} were not originally constructed for the purpose of OASIS, they will still capture the singular features shared by the optimal sampling distribution $g({\bm{x}})$ and the true distribution $f({\bm{x}}\,;\,\theta_0)$.} For the piecewise uniform sampling distribution given in \eqref{eqn:piecewise}, the expression for $\mathcal{I}_\mathrm{MC}/L$ given in \eqref{eqn:toyIMC} can be written as \begin{equation} \frac{\mathcal{I}_\mathrm{MC}}{L} = \int d{\bm{x}}~f({\bm{x}})~\frac{u^2({\bm{x}})}{1 + \displaystyle\frac{L}{N_s}\,\frac{f({\bm{x}})\,V_{\mathrm{cell}({\bm{x}})}}{p_{\mathrm{cell}({\bm{x}})}}}~. \end{equation} Since we do not a priori know the functional form of $f$, training the sampling distribution $g$ needs to be performed using simulated events, possibly sampled from a different sampling distribution, say $g'$ (with weights $w' = f/g'$) \footnote{The events which were generated during the construction of the cells could also be reused for the purpose of this cell-probability adjustment. But one will have to keep track of the sampling distributions used to generate points at different stages in order to reuse them later.}. This lets us rewrite the previous equation as \begin{equation} \frac{\mathcal{I}_\mathrm{MC}}{L} = \int d{\bm{x}}~g'({\bm{x}})~w'({\bm{x}})~\frac{u^2({\bm{x}})}{1 + \displaystyle\frac{L}{N_s}\,\frac{g'({\bm{x}})\, w'({\bm{x}})\,V_{\mathrm{cell}({\bm{x}})}}{p_{\mathrm{cell}({\bm{x}})}}}~. \end{equation} A further (optional) simplification of the expression is possible if the distribution $g'$ is also piecewise uniform with the exact same cells used by $g$ (as will be the case when data generated as-per the ``regular'' importance sampling \texttt{Foam} is used to adjust its cell-probabilities). If $g'({\bm{x}}) = p'_{\mathrm{cell}({\bm{x}})}/V_{\mathrm{cell}({\bm{x}})}$, then \begin{equation} \frac{\mathcal{I}_\mathrm{MC}}{L} = \int d{\bm{x}}~g'({\bm{x}})~w'({\bm{x}})~\frac{u^2({\bm{x}})}{~1 + \displaystyle\frac{L}{N_s}\,\frac{p'_{\mathrm{cell}({\bm{x}})}\,w'({\bm{x}})}{p_{\mathrm{cell}({\bm{x}})}}~}~. \label{eqn:cellIMC} \end{equation} Now, if the cell-probabilities $p_{\mathrm{cell}({\bm{x}})}$ are parameterized by parameters $\bm{\varphi}$, then the gradient of $\mathcal{I}_\mathrm{MC}$ with respect to $\bm{\varphi}$ can be written as \begin{equation} \frac{N_s}{L^2}~\nabla_{\bm{\varphi}}\;\mathcal{I}_\mathrm{MC} = \int d{\bm{x}}~g'({\bm{x}})~\left[\frac{\genfrac{}{}{0pt}{0}{~}{~} p'_{\mathrm{cell}({\bm{x}})}~w'\,^2({\bm{x}})~u^2({\bm{x}})\genfrac{}{}{0pt}{0}{~}{~}}{~\left[p_{\mathrm{cell}({\bm{x}})} + \displaystyle\frac{L}{N_s}p'_{\mathrm{cell}({\bm{x}})}w'({\bm{x}})\right]^2~}~\big[\nabla_{\bm{\varphi}}\,p_{\mathrm{cell}({\bm{x}})}\big]\right]~. \label{eqn:grad_cellIMC} \end{equation} This expression facilitates the usage of stochastic or (mini)-batch gradient \textbf{ascent} to find the optimal parameters $\bm{\varphi}$ that \textbf{maximize} $\mathcal{I}_\mathrm{MC}$. The discrete cell-probabilities (non-negative and summing up to 1) can be parameterized with real valued $\bm{\varphi}$ (with the same dimensionality as the number of cells), using the softmax function \cite{Goodfellow-et-al-2016} $\bm{\sigma}$ as \begin{equation} p_{\mathrm{cell}\,i} = \sigma_i(\bm{\varphi}) \equiv \frac{e^{\varphi_i}}{\displaystyle\sum_j e^{\varphi_j}}~. \end{equation} Under this parameterization, the gradient of $p_{\mathrm{cell}({\bm{x}})}$ with respect to $\bm{\varphi}$ in \eqref{eqn:grad_cellIMC} can be computed using \begin{equation} \frac{\partial p_{\mathrm{cell}\,i}}{\partial \varphi_j} = p_{\mathrm{cell}\,i}~\left(\delta_{ij} - p_{\mathrm{cell}\,j}\right)~, \end{equation} where $\delta_{ij}$ is the Kronecker delta function. \subsubsection{An illustrative example} \label{sec:example} Now we will present a simple one-dimensional example that demonstrates \begin{enumerate}[label=\Alph*.] \item How the technique introduced in \sref{sec:weightadjust} can be used to train the sampling distribution. \item How an OASIS-trained sampling distribution $g$ can offer more sensitivity to the experiment than even the ideal\footnote{The ideal case of IS is when the sampling distribution perfectly matches the normalized true distribution $f/F$. In order to be conservative in our evaluation of the performance of regular importance sampling, from now on any mention of IS will refer to this ideal situation.} case of regular importance sampling (IS). \end{enumerate} Despite this being only a one-dimensional toy example, it will be sufficient to convey our main point. Later in the paper we will additionally show \begin{itemize \item How to reduce the task of training the sampling distributions in higher dimensions to a one-dimensional problem. This means that the ability to derive the optimal sampling distribution for a one-dimensional case is sufficient to perform OASIS in higher dimensions as well. \item How the results from our one-dimensional example correlate with existing plots from a realistic physics analysis by the Compact Muon Solenoid (CMS) experiment, thus confirming the potential for resource conservation offered by OASIS to collider experiments. \end{itemize} The toy example we will consider is the measurement of the mean of a normally distributed random variable of known standard deviation, which we take to be equal to 2: \begin{equation} f(x\,;\,\theta) = \frac{1}{\sqrt{8\pi}}~\exp{\left[-\displaystyle\frac{(x-\theta)^2}{8}\right]}~. \label{eqn:gaussian} \end{equation} The per-event score for this distribution is given by \begin{equation} u({\bm{x}}\,;\,\theta) = \frac{x-\theta}{4}~. \label{eqn:score_gaussian} \end{equation} In a real analysis, these functional forms will be unavailable, and the analysis will be performed using only the simulated datasets, without knowledge of the true model or the fact that the parameter $\theta$ is simply the mean of the distribution (likelihood-free inference). \begin{figure} \centering \includegraphics[width=.75\columnwidth]{f_g-asymptotic.pdf} \caption{The red lines show distributions $f(x)$ given by \eqref{eqn:gaussian} for $\theta=\theta_0=5$ (solid line) and $\theta=\theta_0\pm 0.3$ (dotted lines). The green dot-dashed line shows the distribution $f(x)|u(x)|$ for $\theta=\theta_0$. All distributions have been unit-normalized in the range $0\leq x\leq 10$. } \label{fig:dist_fisher} \end{figure} We will fix the phase space region considered by the analysis to be $0 \leq x \leq 10$, and we will choose $\theta_0 = 5$. The red solid curve in \fref{fig:dist_fisher} shows the distribution $f(x\,;\,\theta_0)$, while the red dotted curves show the same distribution $f$, but for neighboring values of $\theta = \theta_0 \pm \epsilon$ with $\epsilon=0.3$. By visually inspecting these three curves, one can get a feeling for the sensitivity to the parameter $\theta$ at different values of $x$. Note that the region near the maximum of the distribution offers \emph{the least} amount of sensitivity, since the value of $f$ there does not change much as we vary $\theta$. On the other hand, the regions away from the peak appear to be much more sensitive to $\theta$, the exact amount being a function of the per-event score $u$ and the accumulated statistics as encoded by the value of $f$. In the large simulation statistics limit, the optimal sampling distribution from \eqref{eqn:optinf} is proportional to the product $f|u|$ (at $\theta=\theta_0$), which is shown in \fref{fig:dist_fisher} with the green dot-dashed line. The shape of the $f|u|$ distribution is such that its maxima are located one standard deviation from $x = \theta_0$, which can be checked explicitly using the exact expressions \eqref{eqn:gaussian} and \eqref{eqn:score_gaussian}. We see that going after a sampling distribution $g$ which resembles the red lines in \fref{fig:dist_fisher} (as in the standard approaches to IS) and thus tries to populate the region of the peak, is sub-optimal and this sub-optimality is what OASIS sets out to fix. In order to train the sampling distribution using \eqref{eqn:grad_cellIMC}, we split the region $0 \leq x \leq 10$ into 20 bins of equal length $0.5$. For simplicity $p'_\mathrm{cell}$ was set to be equal for all cells ($p'_\mathrm{cell} = 1/20$). This induces a uniform distribution $g'({\bm{x}}) = 1/10$ for the sampling of the training events. For this first exercise, we set the heuristic parameter $L/N_s$ to 1. Since the integral of $f({\bm{x}})$ in the region $[0, 10]$ is approximately 1 ($\approx 0.9876$), this choice of heuristic parameter corresponds to roughly equal number of simulated and real events\footnote{In our toy example, the cross-section $F$, and hence, the integrated luminosity $L$ are both dimensionless quantities. Although different, this is compatible with the HEP convention where $L$ and $F$ are both dimensionful, but their product is dimensionless.}. \begin{table}[t] \centering \begin{tabular}{c c c c c} \toprule[1.5\heavyrulewidth] $\displaystyle\frac{L}{N_s}$ & Initial $\bm{\varphi}$ & Number of steps & Learning rate $\eta$ & Mini-batch size\\ \midrule[1.5\heavyrulewidth] $1$ & $(1, 1, \dots, 1)$ & $50,000$ & $0.1$ & $20$\\ \cmidrule(lr){1-5} $10$ & $(1, 1, \dots, 1)$ & $50,000$ & $0.1$ & $20$\\ \cmidrule(lr){1-5} $0.1$ & $(1, 1, \dots, 1)$ & $100,000$ & $0.5$ & $20$\\ \bottomrule[1.5\heavyrulewidth] \end{tabular} \caption{The parameters used in the mini-batch gradient ascent.} \label{tab:stochastic_params} \end{table} Using 10,000 training events sampled as-per $g'$, the cell-probabilities $p_\mathrm{cell}$ were trained using mini-batch gradient ascent, i.e., using a mini-batch of randomly chosen training events in each training step. The operation performed in each step is given by \begin{equation} \bm{\varphi} \rightarrow \bm{\varphi} + \eta \times \avg_{\text{mini-batch}}\left[\frac{\;p'_{\mathrm{cell}({\bm{x}})}~w'\,^2({\bm{x}})~u^2({\bm{x}})}{~\left[p_{\mathrm{cell}({\bm{x}})} + \displaystyle\frac{L}{N_s}p'_{\mathrm{cell}({\bm{x}})}w'({\bm{x}})\right]^2~}~\big[\nabla_{\bm{\varphi}}\,p_{\mathrm{cell}({\bm{x}})}\big]\right]~, \end{equation} where $\eta$ is the learning rate parameter, and $\avg$ is the average over the mini-batch. The first row of \tref{tab:stochastic_params} summarizes the parameters of the mini-batch optimization for $L/N_s=1$. The OASIS-trained sampling distribution $g^\ast({\bm{x}})$ given by \begin{equation} g^\ast({\bm{x}}) = \frac{p^\ast_{\mathrm{cell}({\bm{x}})}}{V_{\mathrm{cell}({\bm{x}})}}~, \label{eqn:gstar} \end{equation} where $p^\ast_\mathrm{cell}$ refers to the trained values of cell-probabilities, is shown in the left panel of \fref{fig:sampling_dist} (the blue dashed curve). \begin{figure}[t] \centering \includegraphics[height=.33\columnwidth]{IS_OASIS_LbyNs=1.pdf}~~ \includegraphics[height=.33\columnwidth]{IS_OASIS_relweight.pdf} \caption{The blue dashed line in the left panel shows the sampling distribution trained using OASIS with $L/N_s$ set to $1$. For comparison, the true distribution $f(x\,;\,\theta_0)$, which is the ideal case in regular importance sampling (IS), is shown with the red solid line. The magenta line in the right panel shows the ratio of weights for events sampled under the OASIS-trained distribution \eqref{eqn:gstar} versus events sampled under the best-case scenario in regular IS (i.e., $g$ matching $f$ perfectly). The $\times$ marks indicate the ratios of the squares of the estimated error-bars within each bin for the histograms in \fref{fig:hist} produced under OASIS and IS.} \label{fig:sampling_dist} \end{figure} For comparison, the true distribution $f(x\,;\,\theta_0)$, which is the ideal case in regular importance sampling (IS), is shown with the red solid line, after normalizing to $1$ in the analysis region $0 \leq x \leq 10$. Since the OASIS sampling distribution \eqref{eqn:gstar} is different from the true distribution, each sampled event has an associated weight. The magenta curve in the right panel of \fref{fig:sampling_dist} shows the ratio of weights for events sampled under the OASIS-trained distribution \eqref{eqn:gstar} versus events sampled under the best-case scenario in regular IS when $g$ matches $f/F$ perfectly (henceforth referred to as the IS distribution). Note that all the events from the IS-generated distribution will have \emph{constant} weights $w_\mathrm{IS}$ equal to $F(\theta_0)$ (which is $\approx 0.9876$). Notice how the regions oversampled (undersampled) under OASIS have $w_\mathrm{OASIS} / w_\mathrm{IS}$ less than 1 (greater than 1). Also note how the discontinuities in the sampling distribution coincide with the discontinuities in the weight function. The edge effects from these two discontinuities at the cell/bin boundaries will cancel out and the weighted dataset will not have any binning artifacts---this is true of existing cellular importance sampling techniques as well. \begin{figure}[t] \centering \includegraphics[width=.75\columnwidth]{IS_OASIS_hist_compare.pdf} \caption{Normalized histogram counts with $3\sigma$ error bars with 100,000 events sampled (and weighted appropriately) under the OASIS-trained distribution (blue lines) and the true distribution (red lines labelled IS). To allow for visual comparison, the histograms are plotted on a log-scale and their corresponding $y$-axes have been shifted vertically as indicated by the vertical arrow. The bottom panel shows the ratio of the simulated counts to the true expected count (calculated by integrating the true distribution within each bin), along with $1\sigma$ error bars. } \label{fig:hist} \end{figure} Next we generate 100,000 events from the OASIS-trained sampling distribution \eqref{eqn:gstar}, weight them appropriately, and plot a normalized histogram in the top panel of \fref{fig:hist} (blue histogram). For comparison we also show a histogram with 100,000 events from the IS-sampled distribution (red histogram). To allow for visual comparison, the histograms are plotted on a log-scale on two different vertical axes, which are slightly displaced, so that the IS (OASIS) values should be read off from the red $y$-axis on the left (the blue $y$-axis on the right). The bottom panel shows the ratio of the simulated counts to the true expected count (calculated by integrating the true distribution within each bin). As expected, the histograms from the IS and from the OASIS-trained sampling distributions are both consistent with the true distribution, owing to the robustness of importance sampling as a Monte Carlo technique. Notice that near the center of the histogram ($x=5$) the OASIS-trained histogram in \fref{fig:hist} has larger error-bars than the IS histogram. Away from the center, however, the situation is reversed, with OASIS leading to smaller error-bars than the IS distribution. This is because of the preferential sampling performed by the OASIS-trained sampling distribution $g^\ast$: we already saw from the left panel in \fref{fig:sampling_dist} that the maximum sensitivity is expected away from the peak. Correspondingly, the OASIS-trained sampling distribution $g^\ast$ is designed so that the resulting OASIS-trained histogram has relatively small error bars in the $\theta$-sensitive regions of phase space, $x\in (0,3.5)$ and $x\in (6.5,10)$. This benefit, however, comes at the cost or allowing larger error bars elsewhere, in this case in $x\in (3.5, 6.5)$, but that is precisely where the sensitivity to $\theta$ is minimal, and such regions are anyway not very useful to an experimental analysis which is trying to measure $\theta$. In summary, as illustrated in \fref{fig:hist}, the OASIS perspective keeps an eye on the big picture and improves the precision of the simulated data precisely in the regions that are most valuable to the experimental analysis which will be making use of that simulated data later on. The ratios of squares of the estimated error-bars of the bin counts of the histograms produced under OASIS and IS in \fref{fig:hist} are shown in the right panel of \fref{fig:sampling_dist} with $\times$ marks. They match the weight ratios (magenta curve) since, for a given bin, the statistical error $\sigma$ in the simulated (normalized) histogram scales as $\sigma \propto 1/\sqrt{g} \propto \sqrt{w}$. The slight mismatch between the $\times$ marks and the magenta curve is present because we use the uncertainties \emph{estimated} from the finite simulated samples in \fref{fig:hist}---it is the uncertainties in the uncertainty estimates themselves which cause the mismatch. \begin{figure}[t] \centering \includegraphics[width=.75\columnwidth]{OASIS_LbyNs=all.pdf} \caption{OASIS-trained distributions for several different choices of $L/N_s$ during training, as indicated by the legend. The green dot-dashed line shows the theoretical optimal sampling distribution in the large $N_s$ limit from \eqref{eqn:optinf} (the green dot-dashed line in \fref{fig:dist_fisher}). The bottom panel shows the absolute value of the per-event score $|u|$ as a function of $x$. } \label{fig:LoNsim} \end{figure} Next we repeat the exercise and train optimal sampling distributions for different choices of $L/N_s$ (with optimization parameters shown in \tref{tab:stochastic_params}). The trained distributions are shown in the upper panel of \fref{fig:LoNsim}: $L/N_s=10$ (red solid line), $L/N_s=1$ (blue dashed line), $L/N_s=0.1$ (magenta dotted line). The green dot-dashed line shows the theoretical optimal sampling distribution in the large $N_s$ limit from \eqref{eqn:optinf} (it is the same green dot-dashed line appearing in \fref{fig:dist_fisher}). The per-event score $|u|$ is plotted in the lower panel of \fref{fig:LoNsim}. Note how for large values of $L/N_s$, the optimal sampling distribution $g^\ast$ aggressively focuses the event sampling in regions of high $|u|$, while at lower values of $L/N_s$, the sampling distribution is more lenient towards regions of lower $|u|$. This trend is expected from the special cases considered in sections~\ref{sec:toolittle} and \ref{sec:toomuch}---we saw that when there is not enough simulated data, $N_s\ll LF$, the sampling distribution is focused entirely on the regions with the highest $|u|$ (similar to a delta function), while in the opposite limit, $N_s\gg LF$, the sampling distribution is more lenient towards lower magnitudes $|u|$ of the per-event score, with the weights simply being proportional to $|u|^{-1}$. Having demonstrated the effect of OASIS on the histogram error-bars (i.e., the uncertainties in the differential cross-section estimated from the simulated data), we next turn to the effect of OASIS on the measurement of $\theta$. For this purpose, we perform a number of pseudo-experiments, where both real and simulated data are generated and compared to each other and the true value $\theta_\mathrm{true}$ of the parameter $\theta$ is estimated by minimizing the $\chi^2$ statistic. Results from one representative pseudo-experiment are shown in the left panel of \fref{fig:money3}, while the right panel of \fref{fig:money3} and \tref{tab:pseudoexpts} summarize the relevant results from the whole ensemble of pseudo-experiments. Specifically, the data generation and the $\theta$ measurement were done as follows: \begin{enumerate} \item We performed two separate sets of pseudo-experiments. In each set, the integrated luminosity $L$ and number of simulated events $N_s$ were taken to be equal---$10,000$ for the first set and $100,000$ for the second set, as shown in the first two rows of \tref{tab:pseudoexpts}. \item The underlying true value $\theta_\mathrm{true}$ of the parameter $\theta$ was set to $4.9$ (row 3 of \tref{tab:pseudoexpts}) and the experimental data was generated as-per \eqref{eqn:gaussian}. The particular pseudo-experiment in the left panel of \fref{fig:money3} resulted in $9887$ events (in our example, $F(\theta_\mathrm{true}) \approx 0.9875$). \item In each individual pseudo-experiment, two simulated data samples were produced. For the first one, we used the OASIS-trained distribution shown with the blue dashed line in the left panel of \fref{fig:sampling_dist}, which was trained (only once) at $\theta_0=5$ with $L/N_s=1$ (rows 4 and 5 of \tref{tab:pseudoexpts}). The second simulated sample was produced under the ideal IS distribution which exactly matches $f/F$ (for consistency, we again used $\theta_0=5$). The simulated events were then re-weighted for different trial values $\theta_\mathrm{trial}$ of the parameter $\theta$ \cite{Gainer:2014bta,Mattelaer:2016gcx}. \item The real and simulated data were binned into 40 equally sized bins in the region $0 \leq x \leq 10$. A minimum $\chi^2$ estimation of $\theta_\mathrm{true}$ was performed, accounting for statistical uncertainties in both the real and the simulated data \cite{Barlow:1993dm}, with the re-weighted simulations serving the role of theory expectation for different $\theta_\mathrm{trial}$ values. \item For comparison, we also perform the minimum $\chi^2$ estimation based on the likelihood function using the exact analytical expression \eqref{eqn:gaussian}. Note that this method does not suffer from \emph{simulation} uncertainties and thus represents the ideal case reached in the infinite simulation statistics limit. \end{enumerate} \begin{figure}[t] \centering \includegraphics[width=.465\columnwidth]{moneyplot3.pdf} \includegraphics[width=.45\columnwidth]{moneyplot4_measurement_histogram.pdf} \caption{The left panel illustrates the minimum $\chi^2$ estimation of $\theta_\mathrm{true}$ in one typical pseudo-experiment using a) the theoretical knowledge of the analytical form of \eqref{eqn:gaussian} in order to construct the likelihood function (gray dotted line); b) simulation using OASIS-trained sampling distribution (blue dashed line); and c) simulation using IS sampling distribution (red solid line). The integrated luminosity $L$ for the real data, and the number of simulated events $N_s$ were both set to 10,000 (corresponding to roughly equal number of real and simulated events), and $\theta_\mathrm{true} = 4.9$. The events were re-weighted for different $\theta_\mathrm{trial}$ values as in \cite{Gainer:2014bta,Mattelaer:2016gcx}. Higher convexity is indicative of lower error bars on the estimate $\hat{\theta}$. The right panel shows the distribution of $\hat{\theta}$ for the same three methods of $\theta$ estimation across 2000 pseudo-experiments, each with different instances of real and simulated datasets.} \label{fig:money3} \end{figure} \begin{table}[htbp] \centering \resizebox{\textwidth}{!}{ \begin{tabular}{c c c c c c c} \toprule[2\heavyrulewidth] $L$ & \multicolumn{3}{c}{$10,000$} & \multicolumn{3}{c}{$100,000$}\\ \cmidrule(lr){1-7} $N_s$ & \multicolumn{3}{c}{$10,000$} & \multicolumn{3}{c}{$100,000$}\\ \cmidrule(lr){1-7} $\theta_\mathrm{true}$ & \multicolumn{3}{c}{$4.9$} & \multicolumn{3}{c}{$4.9$}\\ \midrule[2\heavyrulewidth] Training $L/N_s$ & \multicolumn{3}{c}{$1$} & \multicolumn{3}{c}{$1$}\\ \cmidrule(lr){1-7} Simulation $\theta_0$ & \multicolumn{3}{c}{$5$} & \multicolumn{3}{c}{$5$}\\ \midrule[2\heavyrulewidth] Pseudo-expts. & \multicolumn{3}{c}{$2000$} & \multicolumn{3}{c}{$500$}\\ \cmidrule(lr){1-7} & ave. $\hat{\theta}$ & $\stddev \hat{\theta}$ & \small $\left[\mathcal{I}_\mathrm{MC}(\theta_\mathrm{true})\right]^{-1/2}$ & ave. $\hat{\theta}$ & $\stddev \hat{\theta}$ & \small $\left[\mathcal{I}_\mathrm{MC}(\theta_\mathrm{true})\right]^{-1/2}$ \\ \cmidrule(lr){2-4} \cmidrule(lr){5-7} \small Likelihood-based & \small $4.8997(5)$ & \small $2.15(3)\mathrm{E}{-2}$ & \small $2.108(1)\mathrm{E}{-2}$ & \small $4.9001(3)$ & \small $6.9(2)\mathrm{E}{-3}$ & \small $6.667(3)\mathrm{E}{-3}$ \\ \small OASIS-based & \small $4.9000(6)$ & \small $2.64(4)\mathrm{E}{-2}$ & \small $2.611(2)\mathrm{E}{-2}$ & \small $4.8998(4)$ & \small $8.5(3)\mathrm{E}{-3}$ & \small $8.258(5)\mathrm{E}{-3}$ \\ \small IS-based & \small $4.8999(7)$ & \small $3.03(5)\mathrm{E}{-2}$ & \small $2.957(19)\mathrm{E}{-2}$ & \small $4.9004(4)$ & \small $9.6(3)\mathrm{E}{-3}$ & \small $9.390(19)\mathrm{E}{-3}$ \\ \bottomrule[2\heavyrulewidth] \end{tabular}} \caption{Simulation parameters and summary statistics of the results from the simulated pseudo-experiments to measure $\theta_\text{true}$. } \label{tab:pseudoexpts} \end{table} The left panel in \fref{fig:money3} illustrates the minimum $\chi^2$ estimation of $\theta_\mathrm{true}$ in a typical pseudo-experiment from the set with $L=N_s=10,000$, following each of the three methods described above, i.e., using a) the likelihood function formed with the exact analytical expression \eqref{eqn:gaussian} (gray dotted line), b) the OASIS-trained sampling distribution (blue dashed line), and c) the IS sampling distribution (red solid line). The plot shows the value of the $\chi^2$ statistic (relative to its minimum value $\chi^2_\mathrm{min}$) as a function of the trial value $\theta_\text{trial}$ for $\theta$. As anticipated, in each case, the minimum $\chi^2$ is obtained in the vicinity of the true value $\theta_\mathrm{true}=4.9$, but the convexity of the function is different. This is important because the convexity near the minimum is indicative of the size of the error bars associated with the minimum $\chi^2$ estimate $\hat{\theta}$---higher convexity corresponds to lower error bars, and vice versa. We see that, as expected, the most precise measurement is offered by the ideal case when we use the analytical form of \eqref{eqn:gaussian} and thus do not suffer from simulation uncertainties. At the same time, the comparison of the blue dashed and the red solid lines reveals that OASIS outperforms regular IS in terms of the precision on the $\hat\theta$ estimate, since the blue dashed curve is more convex that the red solid line. In order to quantify the precision gains from using OASIS as opposed to regular IS, we analyze the results from the full ensemble of pseudo-experiments. The right panel shows the distribution of $\hat{\theta}$ values obtained in the 2000 pseudo-experiments (each with different instances of real and simulated datasets) performed with $L=N_s=10000$, for each of the three methods: likelihood-based (grey dotted histogram), OASIS-simulation-based (blue dashed histogram), and IS-simulation-based (red solid histogram). The last three lines in \tref{tab:pseudoexpts} list the sample mean and standard deviation for $\hat\theta$, along with the square-root of the inverse of $\mathcal{I}_\mathrm{MC}(\theta_\mathrm{true})$ which is expected to be comparable to the total uncertainty. The histogram shapes in the right panel of \fref{fig:money3} confirm that OASIS outperforms IS and reduces the gap to the ideal sensitivity offered by the likelihood-based analysis. This can also be verified by inspecting the entries in \tref{tab:pseudoexpts} for the standard deviation of $\hat\theta$. Note that increasing the statistics to 100,000 events, as in the rightmost columns of \tref{tab:pseudoexpts}, has the effect of reducing the measurement errors, but does not alter the performance rank of the three methods. Note that the sensitivity of an experimental analysis will depend on the exact likelihood-free inference technique used, and in particular on how the theory expectations are estimated from the simulations. But regardless of the inference strategy, analyses will benefit from the preferential sampling of events in regions of higher sensitivity. \Tref{tab:pseudoexpts} also shows the values of $\left[\mathcal{I}_\mathrm{MC}(\theta_\mathrm{true})\right]^{-1/2}$ for the different simulation sampling distributions. For this purpose, $\mathcal{I}_\mathrm{MC}/L$ is estimated using \eqref{eqn:toyIMC} as the sample mean of $wu^2/(1+Lw/N_s)$ (over 100,000 simulated events). $\mathcal{I}_\mathrm{MC}$ for the likelihood-based case simply refers to $\mathcal{I}$, which can be estimated as the sample mean of $wu^2$ under either sampling distribution. Note the similarity between the estimated values of $\left[\mathcal{I}_\mathrm{MC}(\theta_\mathrm{true})\right]^{-1/2}$ and the corresponding standard deviations in $\hat{\theta}$. This establishes $\mathcal{I}_\mathrm{MC}$ as a reliable measure of sensitivity offered by the respective simulated datasets\footnote{It is presently unclear whether $\mathcal{I}_\mathrm{MC}$ provides a lower limit on the uncertainty of an appropriately defined, generic likelihood-free estimator, like the Fisher information $\mathcal{I}$ does for a generic estimator of $\theta$.}. \begin{figure}[tp] \centering \includegraphics[width=.65\columnwidth]{moneyplot1_case1.pdf} \includegraphics[width=.65\columnwidth]{moneyplot1_case2.pdf} \caption{Dependence of $\mathcal{I}_\mathrm{MC}$ on $N_s/L$ for the OASIS-trained (blue dashed curve) and IS (red solid curve) sampling distributions. In the top (bottom) panel, the OASIS sampling distribution was trained at $L/N_s = 1$ ($L/N_s = 0.1$). The horizontal arrows indicate the percent reduction in the simulation requirements at three representative values of the ratio $N_s/L$. In both panels, the gray dot-dashed line indicates the theoretical upper bound obtained in the infinite simulated statistics limit.} \label{fig:money} \end{figure} Having established the relationship between the measurement uncertainty and $\mathcal{I}_\mathrm{MC}$, we will now use $\mathcal{I}_\mathrm{MC}/L$ at $\theta_0=5$ as a performance metric to quantify the resource conservation offered by OASIS. \Fref{fig:money} shows the value of $\mathcal{I}_\mathrm{MC}$ as a function of the available simulation statistics (as measured by the parameter $N_s/L$) for the OASIS-trained (blue dashed curve) and IS (red solid curve) sampling distributions. In each panel, the OASIS sampling distribution was only trained once: at $L/N_s = 1$ in the top panel and at $L/N_s = 0.1$ in the bottom panel. In spite of this, the same sampling distribution (already trained at a given fixed value of $L/N_s$) can still be reused to produce a different number of simulated events---it is the resulting dependence on $N_s$ which is depicted in \fref{fig:money}. As can be seen from \fref{fig:money}, the OASIS-trained sampling distribution leads to higher values of $\mathcal{I}_\mathrm{MC}$ (and consequently, higher sensitivity of the analysis) for the same value of $N_s/L$. (The maximum achievable value of $\mathcal{I}_\mathrm{MC}/L$ is $\mathcal{I}/L$ (in the large $N_s$ limit), and it is also depicted as the gray dot-dashed horizontal line in the same figure.) Viewed differently, any target value of $\mathcal{I}_\mathrm{MC}$ is reached using fewer simulated events under the OASIS-trained sampling distribution. This potential for resource conservation is depicted by the horizontal arrows in \fref{fig:money}, indicating the percent increase\footnote{The reason why we plot the percent increase instead of the percent reduction is the following. For any given simulation budget $N_s$ read off from the $x$ axes of \fref{fig:money} and \fref{fig:money2}, one would naturally choose to use the more efficient sampling method, in which case the relevant question becomes, how much worse one would have been under the other, less efficient, method.} in the number of simulated events that would have had to be generated under the regular IS scheme, for three different values of $N_s/L$. \Fref{fig:money2} shows an alternate representation of this potential for resource conservation, by plotting the percent increase in the required amount of simulated data as a function of $N_s/L$ for the three different OASIS distributions trained at $L/N_s=0.1$ (magenta dotted line), $L/N_s=1$ (blue dashed line) and $L/N_s=10$ (red solid line). \begin{figure}[t] \centering \includegraphics[width=.7\columnwidth]{moneyplot2.pdf} \caption{The percent increase (indicated by the horizontal arrows in \fref{fig:money}) in the required amount of simulated data to reach the same value of $\mathcal{I}_\mathrm{MC}/L$, if using regular IS instead of OASIS, as a function of $N_s/L$. Each $\bigstar$ mark corresponds to the $N_s/L$ value a particular OASIS distribution was trained to be optimal at.} \label{fig:money2} \end{figure} \subsubsection{Deriving optimal ``target weights'' based on the score} \label{sec:weight_score} The previous example demonstrates the construction of optimal sampling distributions when the phase space is one-dimensional. While the technique of adjusting the weights of cells (created by, say, the \texttt{Foam} algorithm) is applicable in higher dimensions as well, since the cells were not specifically created with OASIS in mind, the performance of the resulting sampling distribution may be limited. In this section, we will convert the problem of OASIS-training the sampling distribution for a multi-dimensional phase space to a one-dimensional problem. The key observation is that for any sampling distribution $g$ (with weight function $w$), there exists a `better' sampling distribution $g_\mathrm{better}$, with weights $w_\mathrm{better}$ that depend only on $|u|$, given by \begin{align} g_\mathrm{better}({\bm{x}}) &= \frac{f({\bm{x}})}{E_g\left[\,w({\bm{x}})~\Big|~|u({\bm{x}})|\,\right]}~,\\ w_\mathrm{better}({\bm{x}}) &= \frac{f({\bm{x}})}{g_\mathrm{better}({\bm{x}})} = E_g\left[\,w({\bm{x}})~\Big|~|u({\bm{x}})|\,\right]~, \end{align} such that \begin{equation} \Big\{\mathcal{I}_\mathrm{MC}\text{ under $g_\mathrm{better}$}\Big\}~\geq~ \Big\{\mathcal{I}_\mathrm{MC}\text{ under $g$}\Big\}~. \label{eqn:hunch} \end{equation} This can be intuitively understood from the special case considered in \eqref{eqn:jensen}---it is better for the regions of phase space with the same value of $|u|$ to have the same weight, and $g_\mathrm{better}$ simply redistributes the sampling distribution $g$ among regions of constant $|u|$ to make the weights the same. An explicit proof of \eqref{eqn:hunch} can be found in \aref{appendix:proof_hunch}. This means that there exists an optimal sampling distribution $g_\mathrm{optimal}$ (for a given value of $\theta_0$), such that the weights of events under this distribution depend only on $|u({\bm{x}})|$. If we can derive these optimal weights as a function of $|u|$, we can use them as target weights $w_\mathrm{target}(|u({\bm{x}})|)$ to be reached by the OASIS-trained sampling distribution. These target weights will correspond to a target sampling distribution \begin{equation} f_\mathrm{target}({\bm{x}}) = \frac{f({\bm{x}})}{w_\mathrm{target}(|u({\bm{x}})|)}~. \end{equation} Note that $f_\mathrm{target}$ can be computed using the oracle that provides $f({\bm{x}})$ and $u({\bm{x}})$, and a lookup table for the target weights. This allows us to employ existing `regular' importance sampling techniques to train the sampling distribution $g$ to approximate the target sampling distribution $f_\mathrm{target}$. Note that $f_\mathrm{target}$ need not be normalized to 1, and the target weight function only needs to be learned up to a constant multiplicative factor for the approach to work. To learn the functional form of $w_\mathrm{target}(|u|)$, we will rewrite \eqref{eqn:toyIMC} for sampling distributions of the form \begin{equation} g({\bm{x}}) = \frac{f({\bm{x}})}{w(|u({\bm{x}})|)} \end{equation} as \begin{subequations} \begin{align} \frac{\mathcal{I}_\mathrm{MC}}{L} &= \int d{\bm{x}}~f({\bm{x}})~\frac{u^2({\bm{x}})}{1 + \displaystyle\frac{L}{N_s}\,w(|u({\bm{x}})|)}\\ &= \int d|u|~f_{|u|}(|u|)~\frac{u^2}{1 + \displaystyle\frac{L}{N_s}\,w(|u|)}\\ &= \int d|u|~f_{|u|}(|u|)~\frac{u^2}{1 + \displaystyle\frac{L}{N_s}\,\frac{f_{|u|}(|u|)}{g_{|u|}(|u|)}}~,\label{eqn:uconversion} \end{align} \end{subequations} where $f_{|u|}$ and $g_{|u|}$ are the distributions of $|u({\bm{x}})|$ under the distributions $f$ and $g$ for ${\bm{x}}$, and in arriving at \eqref{eqn:uconversion} we have used \begin{equation} w(|u|') = \left.\frac{f({\bm{x}})}{g({\bm{x}})}\right|_{|u({\bm{x}})| = |u|'} = \frac{\displaystyle\int d{\bm{x}}~f({\bm{x}})~\delta_D\left(|u({\bm{x}})|-|u|'\right)}{\displaystyle\int d{\bm{x}}~g({\bm{x}})~\delta_D\left(|u({\bm{x}})|-|u|'\right)} = \frac{f_{|u|}(|u|)}{g_{|u|}(|u|)}~, \end{equation} where $\delta_D$ is the Dirac delta function. Comparing \eqref{eqn:uconversion} with \eqref{eqn:toyIMC}, we can see that the problem of deriving the optimal weights as a function of $|u|$ is identical to the problem of deriving optimal weights as a function of ${\bm{x}}$ which was tackled in the previous section. The only difference is that we do not have an oracle to return the value of $f_{|u|}(|u({\bm{x}})|)$ for every generated event ${\bm{x}}$. But because this is just a one-dimensional problem, we can easily estimate the distribution $f_{|u|}$ using simulations, possibly from a different sampling distribution. \subsubsection{Direct construction using machine learning} Recently, there has been a significant interest in employing generative neural networks to perform importance sampling \cite{Bendavid:2017zhk,Klimek:2018mza,10.1145/3341156,Gao:2020vdv,Gao:2020zvv,Bothmann:2020ywa}. The idea is as follows: The neural network takes in as input a random vector $\r$, sampled from a given known distribution $P_r(\r)$ (e.g., multi-variate standard normal), and maps it to the output vector ${\bm{x}}(\r)$. The weights of the neural network, say $\bm{\varphi}$, parameterize the map from $\r$ to ${\bm{x}}$, and this map governs the sampling distribution $g$ of ${\bm{x}}$. Now, if the sampling distribution $g({\bm{x}})$ a) covers the support of the true distribution $f$ (phase space where $f$ is non-zero), and b) can be computed for every sampled event ${\bm{x}}$, then the neural network can be used to perform importance sampling. If the neural network architecture is chosen to be manifestly one-to-one, then $g({\bm{x}}(\r))$ can be computed as \begin{equation} g({\bm{x}}(\r)) = \frac{~P_r(\r)~}{J}~, \end{equation} where $J \equiv |\nabla_\r\,{\bm{x}}|$ is the determinant of the Jacobian matrix of the map induced by the neural network. As a reminder, the weights of the generated events will be computed as $w = f/g$. Such neural networks can be trained using gradient descent to maximize $\mathcal{I}_\mathrm{MC}$ (or minimize $-\mathcal{I}_\mathrm{MC}$). From \eqref{eqn:toyIMC} we have \begin{subequations} \begin{align} -\mathcal{I}_\mathrm{MC} &= \int d{\bm{x}}~f({\bm{x}})~\frac{-u^2({\bm{x}})}{1 + \displaystyle\frac{L}{N_s}\,\frac{f({\bm{x}})}{g({\bm{x}})}}~,\tag{\theequation}\\ \nextParentEquation \Rightarrow -\nabla_{\bm{\varphi}}\,\mathcal{I}_\mathrm{MC} &= \int d{\bm{x}}~f({\bm{x}})~\frac{-u^2({\bm{x}})}{\left[1 + \displaystyle\frac{L}{N_s}\,\frac{f({\bm{x}})}{g({\bm{x}})}\right]^2}~\frac{f({\bm{x}})}{g({\bm{x}})}~\left[\nabla_{\bm{\varphi}}\ln{g({\bm{x}})}\right]\\ &= \int d{\bm{x}}~g({\bm{x}})~\frac{~-w^2({\bm{x}})\,u^2({\bm{x}})~}{\left[1+\displaystyle\frac{L}{N_s}\,w({\bm{x}})\right]^2}~\left[\nabla_{\bm{\varphi}}\ln{g({\bm{x}})}\right]\\ &= E_g\left[-\left(\frac{wu}{1 + Lw/N_s}\right)^2~\left[\nabla_{\bm{\varphi}}\ln{g}\right]\right]~. \end{align} \end{subequations} This expression for the gradient of $-\mathcal{I}_\mathrm{MC}$ as an expectation over events sampled as-per $g({\bm{x}})$ facilitates the use of stochastic or (mini)-batch gradient descent to train the neural network, similar to the importance sampling loss functions in Refs.~\cite{10.1145/3341156,Gao:2020vdv,Bothmann:2020ywa}. The viability of training generative networks using our loss function (or other related surrogate loss functions) is not explored in this work; here we merely intend to communicate the possibility to the community. \section{OASIS for analysis variables} \label{sec:realistic} \subsection{Groundwork} The advantage of the parton-level event specification in MC simulations is that the probability distributions of parton-level variables under a given theory model are exactly computable by an oracle. This is why HEP simulations begin with the parton-level Monte Carlo, followed by the remaining stages of the simulation chain. The methods developed in \sref{sec:parton_level} relied on the oracle to compute $f({\bm{x}})$ and $u({\bm{x}})$, and on the fact that the weight of an event is uniquely determined by its ${\bm{x}}$ value. In this section we will develop the framework for applying OASIS at the analysis level, accounting for the following experimental realities: \begin{itemize} \item Only \emph{reconstructed} versions of visible parton-level final state particles are available to the analyses. \item The kinematic information about \emph{invisible} final state particles (such as neutrinos or dark matter candidates) is inaccessible. \item At hadron colliders, the particle ids and momentum fractions of the incoming partons in a given event are a priori unknown. \item Typically all of the available event information is reduced to a handful of sensitive event variables on which the analyses is performed. \item The analysis only uses events which pass the trigger requirements, the event selection criteria and the analysis cuts. In addition, the remaining events could be partitioned into several different categories to be analyzed separately. \end{itemize} To take these into account, let $\v$ represent the (possibly multi-dimensional) event variable in the final analysis corresponding to an event. A parton-level event ${\bm{x}}$ is mapped to $\v$ in a probabilistic many-to-many manner, via the rest of the simulation pipeline, the reconstruction pipeline, and the event variable calculation. We will use $\v$ to capture all the information used by the analysis, including any event selection or categorization information---if a particular event does not meet the selection cuts, $\v$ can carry a special \texttt{Null} or \texttt{rejected} tag, and if the events are split into different categories (based on purity, for example), the category information could be included as a dimension in $\v$. Let the transfer function $\mathrm{TF}(\v\,|\,{\bm{x}})$ represent the normalized distribution of $\v$ conditional on ${\bm{x}}$. Let $\mathcal{F}(\v\,;\,\theta)$ and $\mathcal{G}(\v)$ be the distributions of $\v$ corresponding to the parton-level distributions $f({\bm{x}}\,;\,\theta)$ and $g({\bm{x}})$ after marginalizing over ${\bm{x}}$ using the transfer function $\mathrm{TF}$: \begin{subequations} \begin{align} \mathcal{G}(\v) &= \int d{\bm{x}}~g({\bm{x}})~\mathrm{TF}(\v\,|\,{\bm{x}})~, \tag{\theequation}\\ \nextParentEquation \mathcal{F}(\v\,;\,\theta) &= \int d{\bm{x}}~f({\bm{x}}\,;\,\theta)~\mathrm{TF}(\v\,|\,{\bm{x}})\\ &= \int d{\bm{x}}~g({\bm{x}})~\mathrm{TF}(\v\,|\,{\bm{x}})~w({\bm{x}}\,;\,\theta)\\ &= \int d{\bm{x}}~\mathcal{G}(\v)~\mathrm{ITF}_g({\bm{x}}\,|\,\v)~w({\bm{x}}\,;\,\theta)\\ &= \mathcal{G}(\v)~E_g[w\,|\,\v\,;\,\theta]~,\label{eqn:Pestimate} \end{align} \end{subequations} where the inverse transfer function $\mathrm{ITF}_g({\bm{x}}\,|\,\v)$ represents the normalized distribution of ${\bm{x}}$ conditional on $\v$, when the prior distribution on ${\bm{x}}$ is $g$. Just like their parton-level counterparts, $\mathcal{F}(\v\,;\,\theta)$ and $\mathcal{G}(\v)$ are normalized to $F(\theta)$ and $1$, respectively. For an analysis performed on $\v$, the relevant Fisher information is given by \begin{equation} \mathcal{I}(\theta_0) = \int d\v~\frac{1}{L\,\mathcal{F}(\v\,;\,\theta_0)}~\left.\left[L\,\frac{\partial \mathcal{F}(\v\,;\,\theta)}{\partial\theta}\right]^2\right|_{\theta=\theta_0}~, \end{equation} where the integral is performed only over the non-\texttt{Null} or non-\texttt{rejected} values of $\v$. Proceeding as before, the expectation and variance for the number of real events in a bin of size $\Delta\v$ (small) at a given value of $\v$, for a given value of $\theta=\theta_0$ is given by $L\,\mathcal{F}(\v\,;\,\theta_0)\,\Delta\v$. The simulated estimate for the expected event-count, as per \eqref{eqn:Pestimate}, is given by the sum of weights of the simulated events in the relevant bin, say $S_w$ (a random variable), scaled by a factor of $L/N_s$. To estimate the variance of $S_w$, note that $S_w$ can be expressed as the sum of $N_s$ independent random variables $A_i \equiv I_i \times B_i$, where $B_i$-s are independent random variables following the same distribution as the weights of simulated events in the bin and $I_i$-s are indicator random variables which take value 1 with probability $\mathcal{G}(\v)\,\Delta\v$ and 0 otherwise. Now, \begin{subequations} \begin{align} S_w &= \sum_{i=1}^{N_s} A_i = \sum_{i=1}^{N_s} I_i\times B_i \tag{\theequation}\\ \nextParentEquation E_g[S_w] &= N_s\times E_g[I_i] \times E_g[B_i] \label{eqn:indep_var1}\\ &= N_s\times\mathcal{G}(\v)\Delta\v\times E_g[w\,|\,\v\,;\,\theta_0] \label{eqn:Gvdv}\\ &= N_s\,\mathcal{F}(\v\,;\,\theta_0)\,\Delta\v~,\\ \nextParentEquation \Rightarrow E\left[S_w\times \frac{L}{N_s}\right] &= L\,\mathcal{F}(\v\,;\,\theta_0)\,\Delta\v \tag{\theequation}\\ \nextParentEquation \var_g{[S_w]} &= N_s~\var_g{[A_i]} \\ &= N_s~\Big[E_g\left[I_i^2\right]~E_g\left[B_i^2\right] - E_g[I_i]^2~E_g[B_i]^2\Big] \label{eqn:indep_var2}\\ &= N_s~\Big[\mathcal{G}(\v)\,\Delta\v~E_g[w^2\,|\, \v\,;\,\theta_0] + \mathcal{O}\left((\Delta\v)^2\right)\Big] \label{eqn:dvsq} \\ \nextParentEquation \Rightarrow \var_g{\left[S_w\times \frac{L}{N_s}\right]} &= \frac{L^2}{N_s}\,\mathcal{G}(\v)\,E_g[w^2\,|\, \v\,;\,\theta_0]\,\Delta\v + \mathcal{O}\left((\Delta\v)^2\right)\\ &= \frac{L}{N_s}\frac{E_g[w^2\,|\, \v\,;\,\theta_0]}{E_g[w\,|\, \v\,;\,\theta_0]} \times L\,\mathcal{F}(\v\,;\,\theta_0)\,\Delta\v + \mathcal{O}\left((\Delta\v)^2\right)~. \label{eqn:realist_var} \end{align} \end{subequations} In \eqref{eqn:indep_var1} and \eqref{eqn:indep_var2}, we have used the fact that $I$ and $B$ are independent by construction. In \eqref{eqn:Gvdv} and \eqref{eqn:dvsq} we have used $E_g[I] = E_g[I^2] = \mathcal{G}(\v)\,\Delta\v$ (the binomial `success' probability), and in \eqref{eqn:realist_var}, we have used \eqref{eqn:Pestimate}. Equation~\eqref{eqn:dvsq} is related to the well-known formula for error-bars in unnormalized weighted histograms, given by the square root of the sum of squares of the weights in a given bin \cite{Barlow:1986ek}. Introducing the uncertainty in $S_w\,L/N_s$ from \eqref{eqn:realist_var} into the expression for Fisher information (after dropping the $\mathcal{O}\left((\Delta\v)^2\right)$ term), we get \begin{equation} \mathcal{I}_\mathrm{MC}(\theta_0) = \int d\v~\frac{\left.\left[L\,\displaystyle\frac{\partial \mathcal{F}(\v\,;\,\theta)}{\partial\theta}\right]^2\right|_{\theta=\theta_0}}{L\,\mathcal{F}(\v\,;\,\theta_0) \left[1 + \displaystyle\frac{L}{N_s}\frac{E_g[w^2\,|\,\v\,;\,\theta_0]}{E_g[w\,|\,\v\,;\,\theta_0]}\right]}~, \end{equation} which is the analogue of \eqref{eqn:IOASIS1}. Further, in analogy to \eqref{eqn:toyIMCboth}, this result can be rewritten as \begin{subequations} \begin{align} \frac{\mathcal{I}_\mathrm{MC}(\theta_0)}{L} &= \int d\v~\mathcal{F}(\v\,;\,\theta_0)~\frac{~\left.\Big[\partial_\theta \ln[\mathcal{F}(\v\,;\,\theta)]\Big]^2\right|_{\theta=\theta_0}~}{1 + \displaystyle\frac{L}{N_s}\frac{E_g[w^2\,|\,\v\,;\,\theta_0]}{E_g[w\,|\,\v\,;\,\theta_0]}}\\ &= \int d\v~\mathcal{F}(\v\,;\,\theta_0)~\frac{\mathcal{U}^2(\v\,;\,\theta_0)}{1 + \displaystyle\frac{L}{N_s}\frac{E_g[w^2\,|\,\v\,;\,\theta_0]}{E_g[w\,|\,\v\,;\,\theta_0]}}~, \label{eqn:before_complicated} \end{align} \end{subequations} where $\mathcal{U}(\v\,;\,\theta_0)$ is the per-event score at the analysis level given by \begin{equation} \mathcal{U}(\v\,;\,\theta) \equiv \left[\partial_\theta \ln[\mathcal{F}(\v\,;\,\theta)]\right] = \left[\frac{1}{\mathcal{F}(\v\,;\,\theta)}\,\frac{\partial \mathcal{F}(\v\,;\,\theta)}{\partial\theta}\right]~. \label{eqn:analysisscore} \end{equation} As before, for notational convenience, we will suppress the $\theta_0$ dependence in the different distributions and quantities, unless deemed useful. Typically the MC dataset for a given analysis is composed of several background and signal subsamples. Furthermore, there could be systematic uncertainties in the MC as well, both from the theory side (e.g., neglecting higher order corrections, working in the narrow-width approximation, etc.) and from the experiment side. All of these can be incorporated into \eqref{eqn:before_complicated} in a straightforward manner as \begin{equation} \frac{\mathcal{I}_\mathrm{MC}}{L} = \int d\v~\mathcal{F}(\v)~\frac{\mathcal{U}^2(\v)}{1 + \displaystyle\frac{\sigma^2_\mathrm{syst}(\v)}{\sigma^2_\mathrm{stat}(\v)} + \displaystyle\sum_k\frac{\mathcal{F}^{(k)}(\v)}{\mathcal{F}(\v)}\frac{L}{N_s^{(k)}}\frac{E_{g^{(k)}}[w_k^2\,|\,\v]}{E_{g^{(k)}}[w_k\,|\,\v]}}~, \label{eqn:complicated} \end{equation} where $\sigma_\mathrm{syst}$ is the systematic uncertainty (in the relevant bin at $\v$) in the MC data unrelated to its finiteness, $\sigma_\mathrm{stat}$ is the statistical uncertainty (in the relevant bin at $\v$) in the real dataset\footnote{Note that while $\sigma_\mathrm{stat}$ and $\sigma_\mathrm{syst}$ individually depend on the bin-width, their ratio does not (up to local smoothing effects). The ratio is also independent of whether the $\sigma$-s refer to absolute or relative uncertainties.}, and $k$ is a subsample index. $N_s^{(k)}$ is the number of simulated events in the \mbox{$k$-th} subsample with $N_s = \sum_k N_s^{(k)}$ being the total number of simulated events. Each subsample has its own true distribution $f^{(k)}$ (normalized to the cross-section of the \mbox{$k$-th} process) and sampling distribution $g^{(k)}$ (normalized to 1). The weight $w_k({\bm{x}})$ of a parton-level event ${\bm{x}}$ in subsample $k$ is given by $f^{(k)}({\bm{x}})/g^{(k)}({\bm{x}})$. $\mathcal{F}^{(k)}(\v)$ and $\mathcal{F}(\v)$ are defined by \begin{align} \mathcal{F}^{(k)}(\v) &\equiv \int d{\bm{x}}~f^{(k)}({\bm{x}})~\mathrm{TF}(\v\,|\,{\bm{x}})= \mathcal{G}^{(k)}(\v)~E_{g^{(k)}}[w_k\,|\,\v]~,\\ \mathcal{F}(\v) &= \sum_{k}~\mathcal{F}^{(k)}(\v)~,\label{eqn:F_sum} \end{align} where $\mathcal{G}^{(k)}(\v)$ is given by \begin{equation} \mathcal{G}^{(k)}(\v) \equiv \int d{\bm{x}}~g^{(k)}({\bm{x}})~\mathrm{TF}(\v\,|\,{\bm{x}})~. \end{equation} Note that reducible backgrounds as well as backgrounds with different sets of invisible final state particles will live in different spaces at the parton-level. At first sight, the task of deriving good sampling distributions $g^{(k)}$ (in their respective domains) using \eqref{eqn:complicated} seems like a daunting task considering that the terms in the expression cannot be exactly computed and live in the realm of individual analyses, while $g^{(k)}$ live in the parton-level MC realm. However, the following observations facilitate the task at hand: \begin{enumerate} \item \textbf{The relevant quantities in \eqref{eqn:complicated} can be estimated from a preliminary smaller MC sample.} $\mathcal{F}$, $\mathcal{F}^{(k)}$, $\mathcal{U}$, and $\sigma_\mathrm{syst}/\sigma_\mathrm{stat}$ can be estimated using `preliminary' (possibly preexisting) simulated datasets much smaller than the final MC dataset. For example, $\sigma_\mathrm{stat}$ in a given bin can be extrapolated from a smaller MC dataset, with $\sigma_\mathrm{syst}$ being independent of the size of the dataset. Similarly, $\mathcal{U}$ can be estimated either from the estimate of $\mathcal{F}$ for neighboring values of $\theta$, or more directly as the appropriately weighted average of $u({\bm{x}})$ (or equivalently $\partial_\theta\ln{w}$), conditional on $\v$ \cite{Brehmer:2018hga}. For example, for a single component sample, from \eqref{eqn:analysisscore} and \eqref{eqn:Pestimate} we have \begin{subequations} \label{eqn:score_regression} \begin{align} \mathcal{U}(\v) &= \frac{1}{\mathcal{F}(\v)}\frac{\partial\mathcal{F}(\v)}{\partial\theta} = \frac{E_g[\partial_\theta w\,|\,\v]}{E_g[w\,|\,\v]}\\ &= \frac{E_g[w~\partial_\theta \ln{w}\,|\,\v]}{E_g[w\,|\,\v]} = \frac{E_g[w\,u\,|\,\v]}{E_g[w\,|\,\v]}\\ &= \frac{E_f[(w/w)\,u~\,|\,\v]}{E_f[w/w~\,|\,\v]} = E_f[u\,|\,\v]~. \end{align} \end{subequations} Similarly, for the case with multiple components, from \eqref{eqn:analysisscore}, \eqref{eqn:F_sum}, and \eqref{eqn:score_regression} we have \begin{subequations} \begin{align} \mathcal{U}(\v) &= \partial_\theta\ln{\mathcal{F}}(\v) = \sum_k~\frac{\mathcal{F}^{(k)}(\v)}{\mathcal{F}(\v)}~\partial_\theta\ln{\mathcal{F}^{(k)}}(\v)\\ &= \sum_k~\frac{\mathcal{F}^{(k)}(\v)}{\mathcal{F}(\v)}~\frac{E_{g^{(k)}}[w_k\,u_k\,|\,\v]}{E_{g^{(k)}}[w_k\,|\,\v]}\\ &= \sum_k~\frac{\mathcal{F}^{(k)}(\v)}{\mathcal{F}(\v)}~E_{f^{(k)}}[u_k\,|\,\v]~, \end{align} \end{subequations} where $u_k$ is simply $\partial_\theta w_k$. Note that although the estimates of $\mathcal{F}$, $\mathcal{F}^{(k)}$, $\mathcal{U}$, and $\sigma_\mathrm{syst}/\sigma_\mathrm{stat}$ from a preliminary dataset will not be accurate up to the sensitivity offered by the full MC dataset \cite{Matchev:2020tbw}, they will be sufficient for projecting, with sufficient accuracy, the sensitivity of the experiment under different sampling distributions. \item \textbf{Target weights in the $\v$ space can be translated to weights in the ${\bm{x}}$ space.} Although the map from ${\bm{x}}$ to $\v$ is technically many-to-many, it is usually approximately many-to-one, with the event variable $\v$ for a given value of the parton-level event ${\bm{x}}$ typically falling within a small window of possibilities. This means that if the individual analyses can identify `target' sampling weights for different regions in $\v$, it can then be translated to weights in the ${\bm{x}}$ (parton-level) phase space. Here we are proposing to restrict our attention to sampling distributions which (roughly) assign the same weights to all ${\bm{x}}$ values which (roughly) map to the same value of $\v$. This can be justified as follows. Since \begin{equation} E_{g^{(k)}}[w_k^2\,|\,\v] \geq \left[E_{g^{(k)}}[w_k\,|\,\v]\right]^2~, \end{equation} it follows from \eqref{eqn:complicated} that \begin{equation} \left\{~\frac{\mathcal{I}_\mathrm{MC}}{L} \text{ under } \big\{g^{(k)}\big\}~\right\} \leq \int d\v~\frac{\mathcal{F}(\v)~\mathcal{U}^2(\v)}{1 + \displaystyle\frac{\sigma^2_\mathrm{syst}(\v)}{\sigma^2_\mathrm{stat}(\v)} + \displaystyle\sum_k\frac{\mathcal{F}^{(k)}(\v)}{\mathcal{F}(\v)}\frac{L}{N_s^{(k)}}E_{g^{(k)}}[w_k\,|\,\v]}~, \label{eqn:simplified} \end{equation} with equality iff $E_{g^{(k)}}[w_k^2\,|\,\v] = \left[E_{g^{(k)}}[w_k\,|\,\v]\right]^2$ (i.e., if the variance of $w$ within subsample $k$, conditional on $\v$ is 0) for all $k$ and almost all $\v$. If the map from ${\bm{x}}$ to $\v$ is strictly deterministic (many-to-one), then from a given set of sampling distributions $\big\{g^{(k)}\big\}$, we can construct a better set of sampling distributions $\big\{g^{(k)}_\mathrm{better}({\bm{x}})\big\}$, with weights $w_{k,\mathrm{better}}$ which only depend on $\v({\bm{x}})$, given by \begin{align} g^{(k)}_\mathrm{better}({\bm{x}}) &= \frac{f^{(k)}({\bm{x}})}{E_{g^{(k)}}[w_k\,|\,\v({\bm{x}})]}~,\\ w_{k,\mathrm{better}}({\bm{x}}) &= \frac{f^{k}({\bm{x}})}{g^{(k)}_\mathrm{better}({\bm{x}})} = E_{g^{(k)}}[w_k\,|\,\v({\bm{x}})]~, \end{align} such that the value of $\mathcal{I}_\mathrm{MC}$ under $\big\{g^{(k)}_\mathrm{better}\big\}$ is greater than or equal to that under $\big\{g^{(k)}\big\}$. This is because the right-hand-side of \eqref{eqn:simplified} equals the value of $\mathcal{I}_\mathrm{MC}/L$ under $\big\{g^{(k)}_\mathrm{better}\big\}$ (based on the expression in \eqref{eqn:complicated}), since \begin{equation} E_{g_\mathrm{better}^{(k)}}\left[w^2_{k,\mathrm{better}}\,|\,\v\right] = \left[E_{g_\mathrm{better}^{(k)}}[w_{k,\mathrm{better}}\,|\,\v]\right]^2 = \left[E_{g^{(k)}}[w_k\,|\,\v]\right]^2~. \end{equation} \end{enumerate} These two observations (the statements in boldface in items 1 and 2 above) lead to a two-stage approach to performing OASIS for a realistic analysis, which we will describe next. \subsection{Constructing optimal sampling distributions} \label{sec:real_prescription} \vskip 2mm \subsubsection{Stage 1: Taking stock at the analysis level} \label{sec:stage1} Following up on the second observation above, let us restrict our attention to sampling distributions of the form \begin{equation} g^{(k)}({\bm{x}}) = \frac{f^{(k)}({\bm{x}})}{w_k(\v({\bm{x}}))}~. \end{equation} For this case, \eqref{eqn:complicated} reduces to \begin{equation} \frac{\mathcal{I}_\mathrm{MC}}{L} = \int d\v~\mathcal{F}(\v)~\frac{\mathcal{U}^2(\v)}{1 + \displaystyle\frac{\sigma^2_\mathrm{syst}(\v)}{\sigma^2_\mathrm{stat}(\v)} + \displaystyle\sum_k\frac{\mathcal{F}^{(k)}(\v)}{\mathcal{F}(\v)}\frac{L}{N_s^{(k)}}w_k(\v)}~.\label{eqn:final} \end{equation} Since all the terms in the right hand side of \eqref{eqn:final} other than $w_k$ are either heuristic parameters or calculable using a small preliminary MC dataset, we can estimate good target weights $w_{k,\mathrm{target}}(\v)$ for different values of $\v$ in the different subsamples $k$ using the same technique as was used to maximize the expression in \eqref{eqn:toyIMC} in this paper. The utility of different regions is captured by the $\mathcal{U}^2$ term in the numerator. This can be appropriately substituted for purposes other than parameter estimation. For example, in a signal search analysis it can be replaced by $(s/b)^2$, since $\mathcal{U}$ is proportional to the signal-to-background ratio when $\theta$ is the signal cross-section and the sensitivity is to be maximized around $\theta=0$. If simulated events are needed in a nonsensitive control region for MC validation, the term can be fixed to an appropriate value by hand. Furthermore, if the optimization performed in estimating the target weights $w_{k,\mathrm{target}}$ is deemed too aggressive, one can adjust the weights appropriately by hand. In short, at this stage individual analyses can take stock and identify a preferred MC sampling distribution in the phase space of the event variable $\v$ for each of the relevant subsamples. The flowchart in \fref{fig:stage1_flowchart} summarizes the main steps of this stage of OASIS. \tikzstyle{input} = [ellipse, draw, text width=5em, text centered, minimum height=3em] \tikzstyle{block} = [rectangle, draw, text width=5em, text centered, minimum height=3em \tikzstyle{data} = [trapezium, draw, text width=5em, text centered, minimum height=3em, trapezium left angle=60, trapezium right angle=120 \tikzstyle{tallblock} = [rectangle, draw, text width=5em, text centered, rounded corners, minimum height=6em] \tikzstyle{line} = [draw, -{Latex[length=2mm,width=1.5mm]}] \begin{figure} \centering \begin{tikzpicture}[node distance = 2.5cm, auto] \node [data, text width=9.5em] (prelim) {\small Preliminary/preexisting analysis level dataset\vskip 2mm (could be weighted)}; \node [block, below of=prelim, text width=8em] (Pestimation) {Estimation of $\mathcal{F}^{(k)}(\v)$ and $\mathcal{U}(\v)$}; \node [data, right of=Pestimation, text width=8em, xshift=3cm] (P) {Oracle for $\mathcal{F}^{(k)}(\v)$ and $\mathcal{U}(\v)$}; \node [block, above of=P, text width=7em] (stage1) {Estimation of target weights}; \node [data, right of=stage1, xshift=1.5cm, text width=4.5em] (targetweights) {Oracle for $w_\mathrm{target}(\v)$}; \path [line] (prelim) -- (Pestimation); \path [line] (prelim) -- (stage1); \path [line] (Pestimation) -- (P); \path [line] (P) -- (stage1); \path [line] (stage1) -- (targetweights); \end{tikzpicture} \caption{A flowchart of the main steps of the first stage of OASIS discussed in \sref{sec:stage1}. Rectangles refer to processes or actions, while the remaining parallelograms refer to the corresponding inputs or deliverables. The estimation of $\mathcal{F}^{(k)}(\v)$ and $\mathcal{U}(\v)$ can be done using existing regression techniques. The techniques introduced in \sref{sec:parton_level} can be used to perform the estimation of $w_\mathrm{target}(\v)$ by maximizing \eqref{eqn:final}.} \label{fig:stage1_flowchart} \end{figure} \subsubsection{Stage 2: Translating the target weights to parton-level} \label{sec:stage2} In this stage we will choose the parton-level sampling distribution $g$ in the phase space of ${\bm{x}}$ to approach the desired target weights in $\v$. Since we are only considering the generation of one process at a time, we will drop the subsample index $k$ for notational convenience. For this purpose, we can employ an existing importance sampling approach like the \texttt{VEGAS} algorithm \cite{PETERLEPAGE1978192,Lepage:1980dq}, the \texttt{Foam} algorithm \cite{Jadach:1999sf,Jadach:2002kn,Jadach:2002ce,Jadach:2005ex}, or a neural network based approach \cite{Bendavid:2017zhk,Klimek:2018mza,10.1145/3341156,Gao:2020vdv,Gao:2020zvv,Bothmann:2020ywa}. Each of these methods needs to be provided with an oracle that can be queried for the value of the underlying (possibly unnormalized) distribution we are trying to sample from. Usually this oracle simply returns $f({\bm{x}})$, which is a combination of parton distribution functions and the relevant matrix elements. In our case, in addition to $f$, the oracle will be based on a simulation and reconstruction pipeline to transform ${\bm{x}}$ into $\v$, and the target weights $w_\mathrm{target}$ for different $\v$ values produced in stage 1. For each queried event ${\bm{x}}$, the oracle will run the simulation forward to find an associated target weight, and return $f_\mathrm{target} \equiv f({\bm{x}})/w_\mathrm{target}$. The flowchart in \fref{fig:stage2_flowchart} depicts the internals of the oracle for $f_\mathrm{target}({\bm{x}})$. Note that much of the existing standard HEP simulation tools can be re-purposed for our analysis, in particular the query for $f({\bm{x}})$, the production of $\v$ from ${\bm{x}}$ and the existing importance sampling algorithms to mimic $f_\mathrm{target}$. \begin{figure} \centering \begin{tikzpicture}[node distance = 2.5cm, auto] \node [input, text width=5.5em] (input) {parton-level event ${\bm{x}}$}; \node [block, below of=input, text width=13em, yshift=0cm] (detsim) {\small Showering, hadronization, detector simulation, event reconstruction, event selection/categorization, high-level variable construction}; \node [block, right of=input, text width=5em, xshift=1.1cm] (flookup) {Query $f({\bm{x}})$}; \node [block, right of=flookup, text width=4.5em, xshift=.5cm] (ftarget) {$f/w_\mathrm{target}$}; \node [block, below of=ftarget, text width=5em, yshift=0cm] (wlookup) {Query $w_\mathrm{target}(\v)$}; \node [input, right of=ftarget, text width=4em, xshift=1cm] (output) {$f_\mathrm{target}({\bm{x}})$}; \path [line] (input) -- (flookup); \path [line] (input) -- (detsim); \path [line] (detsim) -- node [above] {$\v$} (wlookup); \path [line] (wlookup) -- (ftarget); \path [line] (flookup) -- (ftarget); \path [line] (ftarget) -- (output); \end{tikzpicture} \caption{A flowchart of the oracle for $f_\mathrm{target}$ to be used in the second stage of OASIS discussed in \sref{sec:stage2}. The query for $f({\bm{x}})$ can be performed with the existing standard HEP machinery, while the query for $w_\mathrm{target}(\v)$ can be done with the oracle trained in \sref{sec:stage1}.} \label{fig:stage2_flowchart} \end{figure} In concluding this subsection, we provide the following usage notes. \begin{itemize} \item Since the map from ${\bm{x}}$ to $\v$ is not deterministic, the oracle may return different values of $f_\mathrm{target}$ for the same query ${\bm{x}}$. However, the existing importance sampling algorithms are robust under this non-determinism and will simply settle on an intermediate $f_\mathrm{target}$.\footnote{An equivalent compromise is incorporated into the OASIS results in \sref{sec:example} by the use of wide bins where $g$ is constrained to be constant, thus limiting the flexibility and forcing a compromise.} This way, even if a region in the ${\bm{x}}$ space only contributes rarely to an important or sensitive region in the $\v$ space, this contribution will be taken into account by our approach, and the ${\bm{x}}$-region will receive a suitably high sampling rate. \item If the event ${\bm{x}}$ (after forward smearing to $\v$) does not pass the selection thresholds of the analysis, its target weight can be set to $\infty$ since it holds no utility for the analysis. However, this may be too aggressive, and using a suitably high maximum target weight maybe more appropriate. For example, there may be a signal region with contributions from reducible backgrounds due to very rare (in the relative sense) fakes or fluctuations in a process with a large rate. In such cases, a smaller preliminary dataset might not show any contributions from this background component, but manually setting an upper limit on the target weight will ensure that these regions receive adequate coverage by the sampling distribution. \item Computationally inexpensive fast simulators may be sufficient for the purpose of mapping ${\bm{x}}$ to event variables $\v$ in \fref{fig:stage2_flowchart}, since the goal is only to attain a good sampling distribution $g$. \item The $f_\mathrm{target}$ oracle is to be used only in the training phase of the importance sampling algorithm. When actually generating events for the analysis, the weights for the sampled events should be based on the true distribution $f({\bm{x}})$ as $w({\bm{x}}) = f({\bm{x}})/g({\bm{x}})$. \item Note that the individual $L/N_s^{(k)}$ values in \eqref{eqn:final} can also be optimized \cite{Kleiss:1994qy}. For example, if events from different sub-channels are equally costly to produce and process, the relevant constraint on $N_s^{(k)}$ is simply \begin{equation} N_s = \sum_k~N_s^{(k)}~. \end{equation} On the other hand, if events from different sub-channels have different computational costs, the above constraint can be modified using suitable weights for the individual terms. \item If the same sample of simulated events will be used in multiple analyses, a common ground sampling distribution should be found by taking into account the requirements of the individual analyses. \end{itemize} \subsection{Comparison to a real-life example from a CMS analysis} \begin{figure}[t] \centering \includegraphics[width=.75\columnwidth]{f_localshapesensitivity.pdf} \caption{The three distributions of $f({\bm{x}})$ from \fref{fig:dist_fisher} (red solid and dotted lines, left $y$-axis) and the distribution of the local shape sensitivity \eqref{eqn:lss} (blue dashed line, right $y$-axis) for our toy example.} \label{fig:realistic} \end{figure} To appreciate the potential for resource conservation offered by OASIS, let us consider the measurement of the top quark mass by the Compact Muon Solenoid (CMS) experiment in the dileptonic $t\bar{t}$ decay channel presented in \cite{Sirunyan:2017idq}. Fig.~1b (available \href{http://cds.cern.ch/record/2204924/files/Figure_001-b.pdf?version=1}{here}), Fig.~3b (available \href{http://cds.cern.ch/record/2204924/files/Figure_003-b.pdf?version=1}{here}), and Fig.~4b (available \href{http://cds.cern.ch/record/2204924/files/Figure_004-b.pdf?version=1}{here}) of that publication show distributions of different event variables ($\mathrm{M_{bl}}$, $\mathrm{M_{T2}^{bb}}$, and $\mathrm{M_{bl\nu}}$, respectively) for three nearby values of the top quark mass $\mathrm{M^{MC}_t}$ used in the MC: 166.5 GeV, 172.5 GeV and 178.5 GeV. This is analogous to the comparison between the three red curves in \fref{fig:dist_fisher} (one solid and two dotted, reproduced again in \fref{fig:realistic}), where the role of $\theta$ is played by $\mathrm{M^{MC}_t}$. By comparing the shapes of the curves at different values of $\mathrm{M^{MC}_t}$, Ref.~\cite{Sirunyan:2017idq} noted that certain regions of the distributions are more sensitive to $\mathrm{M^{MC}_t}$ than others. In order to quantify the effect, Ref.~\cite{Sirunyan:2017idq} introduced a ``local shape sensitivity'' function defined by \begin{equation} \text{Local shape sensitivity} = \frac{1}{f({\bm{x}}\,;\,\theta)}\left[\frac{\partial f({\bm{x}}\,;\,\theta)}{\partial \theta}\right]^2~, \label{eqn:lss} \end{equation} which was also plotted in Figs.~1b, 3b, and 4b of \cite{Sirunyan:2017idq}. In order to make the connection to our previous example, in \fref{fig:realistic} we also plot with the blue dashed line the so-defined local shape sensitivity \eqref{eqn:lss} (which in our language is $fu^2$). The fact that in both \fref{fig:realistic} and the figures of Ref.~\cite{Sirunyan:2017idq}, the distribution $f$ and the local shape sensitivity \eqref{eqn:lss} have very different shapes demonstrates the scope for optimization by biasing the event generation appropriately. This optimization is precisely the motivation for the OASIS framework, and the results from \fref{fig:money} and \fref{fig:money2} are indicative of the resource conservation which could be available to the LHC experimental collaborations, should such need arise. \section{Conclusions and outlook} In the high-luminosity era of the LHC, as well as in experiments at the intensity frontier, we expect to face a crunch for the computational resources required for Monte Carlo simulations. In this paper, we introduced a technique called OASIS for ameliorating this problem by modifying the sampling distribution used in the Monte Carlo. OASIS preferentially focuses the sampling of simulated events on certain regions of phase space (and appropriately weights them), in order to achieve the best experimental sensitivity for a given computational budget. We can also view the utility of OASIS as reducing the number of simulated events needed to reach a target sensitivity. We do this in two steps described in \sref{sec:real_prescription} and summarized with the flowcharts depicted in \fref{fig:stage1_flowchart} and \fref{fig:stage2_flowchart}. In the remainder of this section, we will summarize and contextualize the key ideas of OASIS. \begin{itemize} \item \emph{The use of {\bf weighted} events in the samples representing the theory model predictions.} While the use of weighted events on an event-by-event basis is currently not very common in experimental analyses\footnote{MC reweighting was used by some LEP experiments in the late 1990s to measure both particle masses \cite{Ackerstaff:1997fr,Barate:1997tr} and couplings \cite{Lemaitre:2000iv}, and more recently by CMS to set limits on anomalous vector boson couplings \cite{Sirunyan:2020tlu}.}, the usefulness of the individual event weights was realised by theorists quite early on, and the event weight information was implemented in the Les Houches event file formats \cite{Boos:2001cv,Alwall:2006yp}. Recently, it has been pointed out that event weights can also be used to optimize the event selection and categorization in any given experimental analysis, leading to higher sensitivity \cite{Matchev:2019lfq,Valassi:2020deh}. The event weighting procedure is actually very straightforward---in fact, experimental analyses in some cases do effectively (re-)weight their events: \begin{itemize} \item For example, when adding subsamples from different underlying processes with the same experimental signature, the individual subsamples have to be weighted appropriately to get their proportions right. \item Another current use example is the oversampling of the tails of distributions, which can be done by either manually ``slicing'' with different generation cuts or by ``biasing'' the parton-level phase space with user-defined suppression factors \cite{Valassi:2020ueh}. While both of these approaches help reduce the overall event generation resource requirements, here we are proposing to exploit the idea to an unprecedented degree. \end{itemize} \item \emph{The choice of the sampling distribution should be dictated not only by the expected statistics, but also by the utility of a given event to the experimental analysis.} The standard approach (importance sampling) generates events according to their expected frequency in the data. However, as we showed here, the most common events in the data are not necessarily the most useful in the information-theoretic sense. OASIS directly takes into account the sensitivity of different phase space regions to a parameter of interest as encoded by the per-event score (at the parton or at the analysis level, as desired). Thus the OASIS approach, by construction, seeks to maximize the utility of the simulated dataset. \item \emph{Optimizing for unknown signal parameters.} One potential complication when applying OASIS to the MC generation of new physics samples is that a priori we do not know the values of the BSM parameters (even approximately). In that case, the standard procedure is to optimize the sensitivity for the parameter values which are close to the {\em expected} exclusion or discovery contours in parameter space. The same approach can be applied to OASIS as well. \item \emph{Aligning the resource allocation with the established priorities of the experiment.} The main objective of any experimental analysis is achieving the highest possible sensitivity. By linking the choice of the sampling distribution to the per-event score values, OASIS aligns the goals of MC event generation and the physics analysis. For a single analysis, this is straightforward. However, the situation is complicated by the fact that modern experimental collaborations are quite large, comprised of many analysis groups, with potentially conflicting views on the relative importance of different phase space regions for their analyses. Nevertheless, reaching a consensus is certainly possible, as evidenced by the accepted agreements for the trigger menu, where different analysis groups are similarly competing for trigger bandwidth. \item \emph{Increased coordination between the analysis and Monte Carlo generation teams within each experiment.} The successful implementation of OASIS also requires unprecedented level of cooperation and interaction among the MC generation and physics analysis groups within the experimental collaborations. The MC group will have to rely on the feedback from the analysts in designing the optimal sampling distribution. \item \emph{Taking stock of current resource usage.} A very achievable near-term goal for any LHC collaboration would be to start tracking the current use of MC generated events, and identify the classes of events which tend to be used a lot (by many analysis groups) and conversely, the classes of events which, once produced, tend to be underutilized. This inventorization (which is in principle a very easy first step, since each simulated event carries a unique label) would go a long way towards implementing the general philosophy of OASIS in practice. \item {\em Optimizing for model exploration.} In this paper we showcased OASIS for measuring the parameters\footnote{Although in this paper we focused on the single parameter measurement case, our technique can be extended to work for the simultaneous measurement of several parameters.} of a theory model. However, the OASIS technique is also applicable when one is interested in quantifying how well the data fits the theory model. For example, if we can parametrize the possible deviations of interest from a reference model, the results from this paper still hold, albeit with respect to the parameters capturing said deviations. \end{itemize} Looking ahead, the HEP community has identified an ambitious and broad experimental program for the coming decades, which would require large investments not only in new facilities and experiments, but also in the R\&D and computational resources for the associated software \cite{Alves:2017she}. One aspect of this program is ``improving the efficiency of event generation as used by the experiments'', which was identified in \cite{Alves:2017she} as an underexplored avenue in event generation R\&D. OASIS directly addresses this by undersampling regions of the parton-level phase space which are less useful to the experimental analyses, thus realizing the goal set out in \cite{Alves:2017she}. \section*{Acknowledgements} The authors would like to thank D.~Acosta, S.~Gleyzer, S.~H\"oche, S.~Mrenna, D.~Noonan, K.~Pedro, and G.~Perdue for useful discussions. \paragraph{Funding information} The work of PS is supported in part by the University of Florida CLAS Dissertation Fellowship funded by the Charles Vincent and Heidi Cole McLaughlin Endowment. This work was supported in part by the United States Department of Energy under Grant No. DE-SC0010296. \section*{Code and data availability} The code and data that support the findings of this study are openly available at the following URL: \url{https://gitlab.com/prasanthcakewalk/code-and-data-availability/} under the directory named \texttt{arXiv\_2006.16972}.
\section{Introduction} We present a Central Limit Theorem (CLT) for situations where random events (or experiments) are describable by nonsingleton sets of probability measures. Such sets arise in economics and finance as the subjective prior beliefs of an agent within a model who does not have sufficient information to justify reliance on a single probability measure\ (e.g. \cite{gs89, gilboabook, annrev}), in mathematical statistics and econometrics where, for example, they represent the predictions of the theory being tested or estimated empirically and where predictions are multivalued because the theory is incomplete (e.g. \cite{huber, walley, tamer, eks}). We refer to such situations as featuring ambiguity. Our focus in this paper is on a sequential or temporal context, where experiments are ordered. The set of probability measures can be taken to be objective (the set of logically possible probability laws) or subjective (representing an individual's beliefs about future experiments). Our first main result can be outlined roughly as follows. Let $\left( \Omega,\mathcal{G}\right) $ be a measurable space and let $\left( X_{i}\right) $ be a sequence of (real-valued) random variables, where $X_{i}$ describes the outcome of experiment $i$. Let $\mathcal{P}$ be a set of probability measures on $\left( \Omega,\mathcal{G}\right) $. Information is represented by the filtration $\{\mathcal{G}_{i}\}${, (}${\mathcal{G _{0}=\{\emptyset,\Omega\}}$), such that $\left( X_{i}\right) $ is adapted to $\{\mathcal{G}_{i}\}$ and $\mathcal{G}=\sigma(\cup_{1}^{\infty}\mathcal{G _{i})$. Assume that the upper and lower conditional means of the $X_{i}$s satisfy: \begin{equation} ess\sup\limits_{Q\in\mathcal{P}}E_{Q}[X_{i}|\mathcal{G}_{i-1}]=\overline{\mu }\text{ and }ess\inf_{Q\in\mathcal{P}}E_{Q}[X_{i}|\mathcal{G}_{i-1 ]=\underline{\mu}\text{, for all }i\geq1\text{.} \label{mubar \end{equation} Ambiguity about means is indicated if $\overline{\mu}>$\underline{$\mu$}. Conditional variances are taken to be unambiguous and common to all $X_{i}$s \begin{equation} E_{Q}\left[ (X_{i}-E_{Q}[X_{i}|\mathcal{G}_{i-1}])^{2}|\mathcal{G _{i-1}\right] =\sigma^{2}>0\text{ for all }Q\in\mathcal{P}\text{ and all }i\text{.} \label{condvar \end{equation} Then, under suitable additional assumptions, we show that for every $\varphi\in C\left( \left[ -\infty,\infty\right] \right) $, the class of all bounded continuous functions with finite limits at $\pm\infty$,{\small \begin{equation} \lim\limits_{n\rightarrow\infty}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{1}{n}{\sum_{i=1}^{n}X_{i}}+\frac{1}{\sqrt{n}}{\sum _{i=1}^{n}}\frac{1}{\sigma}{(X_{i}-E_{Q}[X_{i}|\mathcal{G}_{i-1}])}\right) \right] =\mathbb{E}_{\left[ \underline{\mu},\overline{\mu}\right] }\left[ \varphi\left( B_{1}\right) \right] \text{,} \label{CLT0 \end{equation} }where the right side of this equation is defined to be $Y_{0}$, given that $(Y_{t},Z_{t})$ is the solution of the backward stochastic differential equation (BSDE {\normalsize \begin{equation} Y_{t}=\varphi\left( B_{1}\right) +\int_{t}^{1}{\max_{\underline{\mu}\leq \mu\leq\overline{\mu}}(\mu Z_{s})}ds-\int_{t}^{1}Z_{s}dB_{s},\;0\leq t\leq1, \label{BSDE \end{equation} }and $(B_{t})$ is a standard Brownian motion on a probability space $(\Omega^{\ast},\mathcal{F}^{\ast},P^{\ast})$. {\normalsize The result highlights the connection between CLTs and BSDEs. If $\overline{\mu}=$\underline{$\mu$}$=\mu$, and given (\ref{mubar}) and any fixed measure in $\mathcal{P}$, then $\left( X_{i}-\mu\right) $ is a martingale difference and the limit result reduces to a form of the classical martingale CLT (applying the strong {Law of Large Numbers (LLN)} for martingales which gives a.s. convergence of $\frac{1}{n}\sum_{i=1}^{n}X_{i}$ to $\mu$). In addition, the right side reduces to a linear BSDE that, through its solution, yields the expectation of $\varphi\left( B_{1}\right) $ under the normal distribution $\boldsymbol{N}\left( \mu,1\right) $. More generally, in our CLT accommodating ambiguity about means, the associated BSDE is nonlinear. Rather it corresponds to a model in which a Brownian motion is augmented by a drift that can vary stochastically thru time subject only to remaining in the interval $\left[ \underline{\mu},\overline{\mu}\right] $. For example, when $\varphi$ is the indicator function $I_{\left[ a,b\right] }$, \cite{chenBSDE} shows that $sgn\left( Z_{s}\right) =-sgn\left( B_{s}-\frac{a+b-\left( \overline{\mu}+\underline{\mu}\right) \left( 1-s\right) }{2}\right) $, and henc \[ {\arg\max_{\underline{\mu}\leq\mu\leq\overline{\mu}}(\mu Z_{s})}=\left\{ \begin{array} [c]{cc \underline{\mu} & \text{ if }B_{s}\geq\frac{a+b-\left( \overline{\mu }+\underline{\mu}\right) \left( 1-s\right) }{2},\\ \overline{\mu} & \text{ \ if }B_{s}<\frac{a+b-\left( \overline{\mu }+\underline{\mu}\right) \left( 1-s\right) }{2}. \end{array} \right. \] This stochastic variability of the maximizing mean $\mu$ leads to a non-normal limiting distribution. } {\normalsize Two important points regarding tractability should be noted. First, from \cite{chenBSDE} and also Lemma \ref{explicit-solution} below, the indicated BSDE can be solved in closed-form for some specifications of $\varphi$. For example, when $\varphi$ is the indicator for the interval $\left[ a,b\right] $, then the right side of (\ref{CLT0}) is given by \begin{equation} {\mathbb{E}_{\left[ \underline{\mu},\overline{\mu}\right] }[I_{[a,b]}\left( B_{1}\right) ]=\left\{ \begin{array} [c]{lc \Phi_{-\overline{\mu}}\left( -a\right) -e^{-\frac{(\overline{\mu -\underline{\mu})(b-a)}{2}}\Phi_{-\overline{\mu}}\left( -b\right) & \text{if }a+b\geq d,\\ \Phi_{\underline{\mu}}\left( b\right) -e^{-\frac{(\overline{\mu -\underline{\mu})(b-a)}{2}}\Phi_{\underline{\mu}}\left( a\right) & \text{if }a+b<d, \end{array} \right. \label{upperBSDE} \end{equation} where $d\equiv\overline{\mu}+\underline{\mu}$ and {$\Phi_{\mu}$ is the normal cdf with mean $\mu$ and unit variance. The second point concerns the left side of (\ref{CLT0}) which is nonstandard in that the argument of }$\varphi$, whose distribution is at issue, includes the measures $Q$ in $\mathcal{P}$ and hence is not a function only of past realizations of the $X_{i}$s. However, our second principal result (Theorem \ref{thm-special}) is that for a class of functions $\varphi$, including indicators and quadratics, both of which are prominent in statistical theory and methods, (\ref{CLT0}) is valid also when each conditional expectation ${E_{Q}[X_{i}|\mathcal{G}_{i-1}]}$ is replaced by a suitable (and explicit) function of $\left( X_{1},...,X_{i-1}\right) $ alone. Potential usefulness of this result is illustrated by an application to hypothesis testing. } {\normalsize The key additional assumption underlying both theorems is that the set $\mathcal{P}$ is "rectangular", or closed with respect to the pasting of alien marginals and conditionals. (Rectangularity was introduced in \cite{es2003} in the context of recursive utility theory, where an axiomatic analysis demonstrated its central role in modeling dynamic behavior. It has been studied and applied also in robust stochastic dynamic optimization \cite{shapiro}, in the literature on dynamic risk measures \cite{reidel,cheridito,penner}, and in continuous-time modeling in finance \cite{CE}.) It can be understood as endowing $\mathcal{P}$ with a recursive structure that yields a form of the law of iterated expectations. If $\mathcal{P}=\{P\}$, which implies (and, for our purposes, is essentially equivalent to) $\overline{\mu}=$\underline{$\mu$}, then the law of iterated expectations is a consequence of updating by Bayes rule and rectangularity is vacuously satisfied. (Sections \ref{section-prelim} and \ref{section-IID} provide a precise definition of rectangularity and some motivating informal interpretation.) } {\normalsize Some connections to the literature conclude this introduction. In the classical probability framework, there are numerous CLTs with non-normal limiting distributions (with stable laws, for example) \cite{KG,dasgupta}, all of which have much different motivation and limits than our result. There exist alternative generalizations of the classical theorem that are motivated by robustness to ambiguity.\textbf{ }In \cite{eks} (see also the generalization in \cite{shi}), experiments are not ordered and the analysis is intended for a cross-sectional context. In addition, $\mathcal{P}$ is assumed to be the core of a convex (that is, supermodular) capacity, which renders it inconsistent with a recursive structure \cite{chen-davison}. Finally, the limiting distribution in their result is the normal, in contrast to our novel BSDE-based limit. } {\normalsize Closer to this paper is the CLT due to Peng \cite{peng2008, peng2009} who also assumes that experiments are ordered. Peng's focus is on ambiguity about variance (or at least about the second moment), while{ our focus is on ambiguity about the mean.} A more recent paper \cite{peng2019} provides a CLT (Theorem 3.2) with ambiguity about both mean and variance. (Their theorem also considers rates of convergence, which are ignored here.) To compare it with this paper, consider the special case where there is ambiguity about means only. Then their CLT is related primarily to our Theorem \ref{thm-CLT2}, rather than to our central results Theorems \ref{thm-CLT} and \ref{thm-special}. In particular, only in the latter are limits defined by a BSDE rather than by a normal distribution (as in \cite{peng2019}). See section \ref{section-discuss} for elaboration. Another difference is that our approach is more probability-theoretic: Peng and coauthors take a nonlinear expectation as the core primitive and adopt the PDE approach, while our primitive is a set of probability measures and conditionals are central only in our analysis.} {\normalsize The next section describes the model's primitives and key assumptions formally. These are illustrated in section \ref{section-IID} via a canonical example that can be understood as generalizing the classical random walk to accommodate ambiguity. The two main CLT results (Theorems \ref{thm-CLT} and \ref{thm-special}) are presented in section \ref{section-CLT}. Section \ref{section-discuss} provides perspective on our main results by relating them to an alternative CLT (Theorem \ref{thm-CLT2}) and a weak LLN for our setting (Corollary \ref{cor-LLN}). Proofs of Theorems \ref{thm-CLT} and \ref{thm-special} are presented in section \ref{section-proofs}. An appendix contains other proofs and supplementary material. } \section{Primitives and assumptions\label{section-prelim}} {\normalsize Let $\left( \Pi_{1}^{\infty}\Omega_{i},\{\mathcal{G}_{n \}_{n=1}^{\infty}\right) $ be a filtered space modeling a sequence of experiments. The set of possible outcomes for the $i^{th}$ experiment is $\Omega_{i}$. For each $n$, $\mathcal{G}_{n}$ is a $\sigma$-algebra on $\Pi_{1}^{n}\Omega_{i}$ representing the observable events regarding experiments $1,...,n$. (Accordingly, we assume that $\mathcal{G}_{n}$ is increasing with $n$ and we take $\mathcal{G}_{0}$ to be the trivial $\sigma $-algebra.) The observable events for the collection of all experiments are given by $\mathcal{G}$, \[ \mathcal{G}=\sigma(\cup_{1}^{\infty}\mathcal{G}_{n})\text{, \] a $\sigma$-algebra on $\Omega$, where \[ \Omega=\Pi_{1}^{\infty}\Omega_{i}\text{. \] (Here and in the sequel, we identify each $\mathcal{G}_{n}$ in the obvious way with a }$\sigma$-algebra on $\Omega$.) {\normalsize The ex ante probabilities of observable events are not known precisely and are represented by a set $\mathcal{P}$ of probability measures,\footnote{For any measurable space $\left( Y,\mathcal{F}\right) $, the corresponding set of probability measures is denoted $\Delta\left( Y,\mathcal{F}\right) $.} \[ \mathcal{P}\subset\Delta\left( \Omega,\mathcal{G}\right) \text{. \] We limit ambiguity about which events are possible and assume that all measures in $\mathcal{P}$ are equivalent on each $\mathcal{G}_{n}$. } {\normalsize Below we assume that for each measure $P$ in $\mathcal{P}$ and each $n$, there exists a regular conditional measure $P\left( \cdot \mid\mathcal{G}_{n}\right) $. For example, a well-known \cite[Theorem 7.1]{partha} sufficient condition for regular $\mathcal{G}_{n}$-conditionals to exist for every $P$ in $\Delta\left( \Omega,\mathcal{G}\right) $ is that $\left( \Omega,\mathcal{G}\right) $ is a separable standard Borel space (a special case is where $\Omega$ is a complete separable metric space and $\mathcal{G}$ is its Borel $\sigma$-algebra). } {\normalsize Finally, we consider a sequence $\left( X_{i}\right) $ of real-valued random variables (r.v.), $X_{i}:$ $\Pi_{1}^{\infty}\Omega _{j}\longrightarrow\mathbb{R}$, such that $X_{i}$ is $\mathcal{G}_{i $-measurable (using the Borel $\sigma$-algebra on $\mathbb{R}$). Think of $X_{i}$ as a scalar measure of the outcome of experiment $i$ or of the value (or utility) of that outcome. In general, $X_{i}$ can depend also on the outcomes of earlier experiments. } \begin{remark} {\normalsize We presume a particular ordering of experiments, which may be arbitrary in cross-sectional contexts. Thus we view the analysis and the resulting CLT as more relevant to sequential or time-series contexts where an ordering is given. } \end{remark} {\normalsize In the rest of this section, we describe our assumptions on the above primitives. We use the following notation. $\mathcal{H}$ denotes the set of all r.v. $X$ on $\left( \Omega,\mathcal{G}\right) $ satisfying $\sup_{Q\in\mathcal{P}}E_{Q}[|X|]<\infty$; $E_{Q}[\cdot]$ is the expectation under the probability measure $Q.$ For any $X$ in $\mathcal{H}$, its \emph{upper and lower expectations} are defined respectively by \[ \mathbb{E}[X]\equiv\sup_{Q\in\mathcal{P}}E_{Q}[X],\;\quad\mathcal{E [X]\equiv\inf_{Q\in\mathcal{P}}E_{Q}[X]=-\mathbb{E}[-X]\text{, \] and its \emph{conditional upper and lower expectations} are defined respectively b \[ \mathbb{E}\left[ X\mid\mathcal{G}_{n}\right] \equiv ess\sup_{Q\in \mathcal{P}}E_{Q}\left[ X\mid\mathcal{G}_{n}\right] \text{, \ \ \mathcal{E}\left[ X\mid\mathcal{G}_{n}\right] \equiv ess\inf_{Q\in \mathcal{P}}E_{Q}\left[ X\mid\mathcal{G}_{n}\right] \text{. \] Obviously, the conditional expectations are well-defined due to equivalence of all measures in $\mathcal{P}$ on each $\mathcal{G}_{n}.$ (See section \ref{section-proofs}{ for key properties of these expectations.) Rewritten with this notation, (\ref{mubar}) takes the form \[ \mathbb{E}\left[ X_{i}\mid\mathcal{G}_{i-1}\right] =\overline{\mu}\text{ and }\mathcal{E}\left[ X_{i}\mid\mathcal{G}_{i-1}\right] =\underline{\mu}\text{ for all }i\text{. \] { } } {\normalsize Say that $(X_{i})$ has an \emph{unambiguous conditional variance }$\sigma^{2}\,$\ if (\ref{condvar}) is satisfied. Say that $\left( X_{i}\right) $ satisfies the \emph{Lindeberg condition} if \begin{equation} \lim_{n\rightarrow\infty}\frac{1}{n}\sum\limits_{i=1}^{n}\mathbb{E}\left[ \left\vert X_{i}\right\vert ^{2}I_{\{\left\vert X_{i}\right\vert >\sqrt {n}\epsilon\}}\right] =0,\quad\forall\epsilon>0. \label{linder \end{equation} } {\normalsize To formulate the remaining assumption requires additional notation and terminology. Write \begin{align*} \omega_{\left( n\right) } & =\left( \omega_{n},...\right) \text{, }\omega^{\left( n\right) }=\left( \omega_{1},...,\omega_{n}\right) ,\\ \mathcal{P}_{0,n} & =\{P_{\mid\mathcal{G}_{n}}:P\in\mathcal{P}\}\text{ \ and}\\ \mathcal{G}_{(n+1)} & =\left\{ A\subset\Pi_{n+1}^{\infty}\Omega_{i}:\Pi _{1}^{n}\Omega_{i}\times A\in\mathcal{G}\right\} \text{. \end{align*} } {\normalsize A probability kernel from $\left( \Pi_{1}^{n}\Omega _{i},\mathcal{G}_{n}\right) $ to $\left( \Pi_{n+1}^{\infty}\Omega _{i},\mathcal{G}_{(n+1)}\right) $ is a function $\lambda:\Pi_{1}^{n \Omega_{i}\times\mathcal{G}_{(n+1)}\longrightarrow\left[ 0,1\right] $ satisfying: } \begin{enumerate} \item[Kernel1] {\normalsize $\forall\omega^{(n)}\in\Pi_{1}^{n}\Omega_{i}$, $\lambda\left( \omega^{\left( n\right) },\cdot\right) $ is a probability measure on $\left( \Pi_{n+1}^{\infty}\Omega_{i},\mathcal{G}_{(n+1)}\right) $, } \item[Kernel2] {\normalsize $\forall A\in\mathcal{G}_{(n+1)}$, $\lambda\left( \cdot,A\right) $ is a $\mathcal{G}_{n}$-measurable function on $\Pi_{1 ^{n}\Omega_{i}$. } \end{enumerate} {\normalsize \noindent Any pair $\left( p_{n},\lambda\right) $ consisting of a probability measure $p_{n}$ on $\left( \Pi_{1}^{n}\Omega_{i},\mathcal{G _{n}\right) $ and a probability kernel $\lambda$ as above, induces a unique probability measure $P$ on $\left( \Pi_{1}^{\infty}\Omega_{i},\mathcal{G \right) $ that coincides with $p_{n}$ on $\mathcal{G}_{n}$. It is given by, $\forall A\in\mathcal{G}$ \begin{equation} P\left( A\right) =\int\limits_{\Pi_{1}^{n}\Omega_{i}}\int\limits_{\Pi _{n+1}^{\infty}\Omega_{i}}I_{A}\left( \omega^{\left( n\right) ,\omega_{(n+1)}\right) \lambda\left( \omega^{\left( n\right) ,d\omega_{(n+1)}\right) p_{n}\left( d\omega^{\left( n\right) }\right) \text{.} \label{Pn \end{equation} } {\normalsize For $Q\in\mathcal{P}$, let $Q\left( \cdot\mid\mathcal{G _{n}\right) $ denote its regular conditional. Then it defines a probability kernel $\lambda$ by: $\forall\omega^{\left( n\right) }\in\Pi_{1}^{n \Omega_{i}$, \begin{equation} \lambda\left( \omega^{\left( n\right) },A\right) =Q\left( \Pi_{1 ^{n}\Omega_{i}\times A\mid\mathcal{G}_{n}\right) \left( \omega^{\left( n\right) }\right) \text{, }\forall A\in\mathcal{G}_{(n+1)}\text{. ~} \label{kernel \end{equation} A feature of such a kernel is that the single measure $Q$ is used to define the conditional at every $\omega^{\left( n\right) }$. We are interested in kernels for which the measure to be conditioned can vary with $\omega^{\left( n\right) }$. Say that the probability kernel $\lambda$ is a $\mathcal{P $-\emph{kernel} if: $\forall\omega^{\left( n\right) }\in\Pi_{1}^{n \Omega_{i}$, $\exists Q\in\mathcal{P}$ satisfying (\ref{kernel}). } {\normalsize Finally, say that $\mathcal{P}$ is \emph{rectangular }(with respect to the filtration $\{\mathcal{G}_{n}\}$) if: $\forall n,~\forall p_{n}\in$ $\mathcal{P}_{0,n}$ and for every $\mathcal{P}$-\emph{kernel }$\lambda$, if $P$ is defined as in (\ref{Pn}), then $P\in\mathcal{P}$. (Note that a measure $P\in\Delta\left( \Omega,\mathcal{G}\right) $ is well-defined by (\ref{Pn}), for any $p_{n}\in$ $\mathcal{P}_{0,n}$ and $\mathcal{P $-\emph{kernel }$\lambda$, because of the assumption that all measures in $\mathcal{P}$ are equivalent on $\mathcal{G}_{n}$). When $\mathcal{P}$ is the singleton $\{P\}$, rectangularity is trivially implied by Bayesian updating, specifically by the fact that after decomposing $P$ into a marginal and conditional, these can be pasted together to recover $P$. More generally, rectangularity requires that the set $\mathcal{P}$ is closed also with respect to pasting together conditionals and marginals that are \emph{alien}, that is, induced by possibly different measures in $\mathcal{P}$. In this sense, $\mathcal{P}$ does not restrict the pattern of heterogeneity across experiments (see the next section for elaboration). } {\normalsize The significance of rectangularity is illuminated by the following lemma. (See Appendix \ref{app-rect} for a partial proof. The complement of any $A\subset\Omega$ is denoted }$A^{c}$.{\normalsize ) } \begin{lemma} {\normalsize \label{lemma-rect} $\mathcal{P}$ rectangular implies the following (for any $0\leq m\leq n\in\mathbb{N}$).} {\normalsize \noindent(i) \textbf{Stability by composition:} For any $Q,R\in\mathcal{P}$, $\exists P\in\mathcal{P}$ such that, for any $X\in\mathcal{H}$, \[ E_{P}[X|\mathcal{G}_{m}]=E_{Q}[E_{R}[X|\mathcal{G}_{n}]|\mathcal{G _{m}]\text{. \] (ii) \textbf{Stability by bifurcation:} For any $Q,R\in\mathcal{P}$, and any $A_{n}\in\mathcal{G}_{n}$, $\exists P\in\mathcal{P}$ such that, for any $X\in\mathcal{H}$, \[ E_{P}[X|\mathcal{G}_{n}]=I_{A_{n}}E_{Q}[X|\mathcal{G}_{n}]+I_{A_{n}^{c} E_{R}[X|\mathcal{G}_{n}]. \] } {\normalsize \noindent(iii) \textbf{Law of iterated upper expectations}: For any $X\in\mathcal{H}$, \begin{equation} \mathbb{E}[\mathbb{E}[X|\mathcal{G}_{n}]|\mathcal{G}_{m}]=\mathbb{E [X|\mathcal{G}_{m}]. \label{LIE \end{equation} (iv) Let $\{X_{i}\}$ be a sequence in $\mathcal{H}$. {Set $S_{n-1}=\sum _{i=1}^{n-1}X_{i}$ and, for any $Q\in\mathcal{P}$},{ $S_{n-1}^{Q}=S_{n-1 -\sum_{i=1}^{n-1}E_{Q}[X_{i}|\mathcal{G}_{i-1}]$. Then, for any continuous bounded functions $f,h$: \begin{align} & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ f\left( \frac{S_{n-1}}{n +\frac{S_{n-1}^{Q}}{\sqrt{n}}\right) +h\left( \frac{S_{n-1}}{n +\frac{S_{n-1}^{Q}}{\sqrt{n}}\right) X_{n}\right] \nonumber\\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ ess\sup\limits_{R\in \mathcal{P}}E_{R}\left[ f\left( \frac{S_{n-1}}{n}+\frac{S_{n-1}^{Q} {\sqrt{n}}\right) +h\left( \frac{S_{n-1}}{n}+\frac{S_{n-1}^{Q}}{\sqrt{n }\right) X_{n}|\mathcal{G}_{n-1}\right] \right] .\nonumber \end{align} }(v) If $\{X_{i}\}$ is a sequence in $\mathcal{H}$ satisfying (\ref{mubar}), then \begin{equation} \mathbb{E}\left[ X_{n}\mid\mathcal{G}_{n-1}\right] =\mathbb{E}\left[ X_{n}\right] \text{ and }\mathcal{E}\left[ X_{n}\mid\mathcal{G _{n-1}\right] =\mathcal{E}\left[ X_{n}\right] \text{. } \label{condindep \end{equation} } \end{lemma} {\normalsize (i) and (ii) make explicit two senses in which rectangularity of $\mathcal{P}$ implies that combinations of distinct measures ($Q\not =R$) from $\mathcal{P}$ leave one within $\mathcal{P}$. Together they lead to (iii). The latter is built into the classical model but must be adopted explicitly, via rectangularity, for upper (or lower) expectations. For a general set $\mathcal{P}$, one would expect the supremum on the left in (\ref{LIE}) to be (weakly) larger because it permits the choices of measures conditional on each history {$\omega^{\left( n-1\right) }$ } and the ex ante measure on $\mathcal{G}_{n-1}$ to be alien. However, rectangularity implies that any such combination of measures yields a measure in $\mathcal{P}$, and thus the single-stage supremum on the right is no smaller. The proof of our CLT employs a similar recursive relation also in instances when the r.v. itself depends on $Q\in\mathcal{P}$ as in (iv), the intuition for which is similar to that for (iii). (v) states that conditional upper and lower expectations do not vary with the outcomes of previous experiments. It is an immediate consequence of (\ref{mubar}) and (iii); for example, \[ \mathbb{E}\left[ X_{n}\right] =\mathbb{E}\left[ \mathbb{E}\left[ X_{n \mid\mathcal{G}_{n-1}\right] \right] =\mathbb{E}\left[ \overline {\mathbb{\mu}}\right] =\overline{\mathbb{\mu}}=\mathbb{E}\left[ X_{n \mid\mathcal{G}_{n-1}\right] \text{. \] } \section{Example: IID\label{section-IID}} {\normalsize Our canonical example (adapted from \cite{esIID}) is as follows. Specialize the above framework by assuming that there exists a measurable space $(\overline{\Omega},\overline{\mathcal{F}})$ such that, for all {$1\leq i\leq n$, \[ (\Omega_{i},\mathcal{F}_{i})=(\overline{\Omega},\overline{\mathcal{F}})\text{ and }\mathcal{G}_{n}=\Pi_{1}^{n}\mathcal{F}_{i}\text{. \] That is, experiments have a common set of possible outcomes $\overline{\Omega }$ and an associated common $\sigma$-algebra $\overline{\mathcal{F}}$. In addition, suppose that, for all $i$, \[ X_{i}=\overline{X}:(\Omega_{i},\mathcal{F}_{i})\rightarrow\mathbb{R}\text{. \] } {\normalsize One-step-ahead conditionals are central. Thus, for each $P$ in $\mathcal{P}$, and each $n$, let $P_{n,n+1}\left( \omega^{\left( n\right) }\right) $ denote the restriction to $\mathcal{G}_{n+1}$ of $P\left( \cdot\mid\mathcal{G}_{n}\right) \left( \omega^{\left( n\right) }\right) $. } {\normalsize Fix a subset $\mathcal{L}$ of $\Delta(\overline{\Omega ,\overline{\mathcal{F}})$, all of whose measures are equivalent. Then the IID model is defined via the set $\mathcal{P}^{IID}$ \begin{equation} \mathcal{P}^{IID}=\left\{ P\in\Delta\left( \Omega,\mathcal{G}\right) :P_{n,n+1}\left( \omega^{\left( n\right) }\right) \in\mathcal{L},\text{ }\forall n,\omega^{\left( n\right) }\in\mathcal{G}_{n}\right\} \text{.} \label{Pca \end{equation} The set consists of all measures whose one-step-ahead conditionals, at every history, lie in $\mathcal{L}$. Thus, $\mathcal{L}$ is the set of plausible probability laws for each experiment, independent of history, modeling partial ignorance about each experiment separately. There remains the question of the perception of, or information about, the sequence of experiments, that is, how experiments are related to one another. In spite of $\mathcal{L}$ being common to all $i$, in this model experiments are not necessarily identical. (Accordingly, we refer to experiments as being \textit{indistinguishable rather than identical} and take IID to mean "\textit{indistinguishably} and independently distributed".) Indeed, any measure in $\mathcal{L}$ is plausible as the law describing the {$i^{th}$ experiment} in conjunction with any possibly different measure in $\mathcal{L}$ being the law describing the {$j^{th}$ experiment}. Indeed, $\mathcal{P}^{IID}$ imposes no restrictions on joint distributions thus capturing \emph{agnosticism about the pattern of heterogeneity across experiments}. As demonstrated below, this feature is closely related to rectangularity. } {\normalsize In the special case where $\mathcal{L}=\{P\}$, $\mathcal{P ^{IID}$ consists of the single i.i.d. product of $P$, as in a random walk. One might think of $\mathcal{P}^{IID}$ as modeling an ``ambiguous random walk". } {\normalsize The following lemma gives some readily verified properties of $\mathcal{P}^{IID}$ (see Appendix \ref{app-IID} for some proof details). } \begin{lemma} {\normalsize \label{lemma-IID}The set $\mathcal{P}^{IID}$ satisfies (for every $n\in\mathbb{N}$): }\newline{\normalsize (i) $\mathcal{P}^{IID}$ is rectangular.\newline(ii) Measures in $\mathcal{P}^{IID}$ are mutually equivalent on each $\mathcal{G}_{n}$.\newline(iii) For any $\varphi\in C\left( \mathbb{R}\right) $, with $\varphi\left( X_{n}\right) \in\mathcal{H}$, \[ \mathbb{E}\left[ \varphi\left( X_{n}\right) \mid\mathcal{G}_{n-1}\right] =\sup_{q\in\mathcal{L}}E_{q}\left[ \varphi\left( \overline{X}\right) \right] =\mathbb{E}\left[ \varphi(X_{n})\right] =\mathbb{E}\left[ \varphi(X_{1})\right] . \] (iv) Conditional variances satisfy: \begin{align*} \sup_{Q\in\mathcal{P}^{IID}}E_{Q}\left[ (X_{n}-E_{Q}[X_{n}|\mathcal{G _{n-1}])^{2}|\mathcal{G}_{n-1}\right] & =\sup_{q\in\mathcal{L}}E_{q}\left[ (\overline{X}-E_{q}[\overline{X}])^{2}\right] ,\\ \inf_{Q\in\mathcal{P}^{IID}}E_{Q}\left[ (X_{n}-E_{Q}[X_{n}|\mathcal{G _{n-1}])^{2}|\mathcal{G}_{n-1}\right] & =\inf_{q\in\mathcal{L}}E_{q}\left[ (\overline{X}-E_{q}[\overline{X}])^{2}\right] . \end{align*} } \end{lemma} {\normalsize The key property of $\mathcal{P}^{IID}$ is rectangularity. Because of its centrality, we verify rectangularity here: Let $p_{n}$, $\lambda$ and $P$ be as in (\ref{kernel}). Then, for the given $\omega ^{\left( n\right) }$, \begin{align*} P\left( \Pi_{1}^{n}\Omega_{i}\times\cdot\mid\mathcal{G}_{n}\right) \left( \omega^{\left( n\right) }\right) & =\lambda\left( \omega^{\left( n\right) },\cdot\right) \\ & =Q\left( \Pi_{1}^{n}\Omega_{i}\times\cdot\mid\mathcal{G}_{n}\right) \left( \omega^{\left( n\right) }\right) , \end{align*} for some $Q\in\mathcal{P}^{IID}$. Therefore, the one-step-ahead conditional of $P$ at history $\omega^{\left( n\right) }$ equals that of $Q$ and hence lies in $\mathcal{L}$. Therefore, $P\in\mathcal{P}^{IID}$.\hfill\hfill\ \hfill} {\normalsize The lemma implies that $\mathcal{P}^{IID}$ readily accommodates also the other assumptions in the CLT below. For example, (\ref{mubar}) is implied by (iii) and conditional variances are common and unambiguous if and only if\footnote{In decision theory \noindent(in \cite{gs89}, for example), it is often innocuous and a convenient normalization to take sets of measures to be convex. But because variances are not linear in the measure $q$, convexity of $\mathcal{L}$ precludes (\ref{varL}) except in the degenerate case where means are also unambiguous. Thus we do not assume that $\mathcal{L}$ is convex. \begin{equation} var_{q}\left( \overline{X}\right) \equiv E_{q}\left[ (\overline{X -E_{q}[\overline{X}])^{2}\right] =\sigma^{2}\text{, \ for all q\in\mathcal{L}\text{. } \label{varL \end{equation} } {\normalsize For perspective, consider also the set $\mathcal{P}^{prod}$, consisting of all (nonidentical) product measures that can be constructed from $\mathcal{L}$ - refer to this as the \emph{product model}. The set $\mathcal{P}^{prod}$ also implies a degree of agnosticism about heterogeneity -- after all, it consists of product measures $\Pi_{i=1}^{\infty}\ell_{i}$, where $\ell_{i}\not =\ell_{j}$ in general, and these measures are restricted only by the requirement that they lie in $\mathcal{L}$. However, the two models differ in a significant way in that $\mathcal{P}^{prod}$ violates rectangularity, and hence also (\ref{LIE}), for example. This is because $\mathcal{P}^{prod}$ is "too small" in the sense of not being closed with respect to the pasting of alien marginals and conditionals (note that $\mathcal{P}^{prod}$ is a strict subset of $\mathcal{P}^{IID}$). Our interpretation of $\mathcal{P}^{prod}$ is that it models \emph{certainty} that the probability law for experiment $i$ does not vary with the outcomes of preceding experiments (note that invariance to these outcomes is exhibited by each individual measure in $\mathcal{P}^{prod}$). In contrast, in $\mathcal{P}^{IID}$ one-step-ahead conditionals can vary arbitrarily across different histories subject only to lying in $\mathcal{L}$. Thus $\mathcal{P}^{IID}$ permits heterogeneity across experiments to vary stochastically and thereby models greater agnosticism regarding heterogeneity. } {\normalsize A simple concrete example illustrates both models and the difference between them. Each experiment can produce one of three outcomes: success ($s$), failure ($f$) and the neutral outcome ($n$). Thus $\overline{\Omega}=\{s,f,n\}$ and $\overline{\mathcal{F}}$ is the power set. Outcomes are valued by $\overline{X}$ according t \[ \overline{X}\left( s\right) =1\text{, }\overline{X}\left( f\right) =-1\text{, }\overline{X}\left( n\right) =0\text{. \] Outcomes are uncertain but their probabilities are not known precisely. Le \[ 0<q<p\text{, \ }p+q\leq1\text{. \] } {\normalsize It is known that, for each experiment, and regardless of the outcomes in preceding experiments, the outcomes $s$, $f$ and $n$ (in that order) are given \emph{either} by the favorable distribution $\left( p,q,1-p-q\right) $ \emph{or} by the unfavorable distribution $\left( q,p,1-p-q\right) $, that is, \[ \mathcal{L}=\left\{ \left( p,q,1-p-q\right) ,\left( q,p,1-p-q\right) \right\} \text{. \] } {\normalsize There is no additional information provided that would justify, for example, assigning weights (or probabilities) to these two distributions and then using the average as the Bayesian model would require - there is complete ignorance about which distribution applies for any given experiment. Consequently, conditional on any history, the implied upper and lower means of each $X_{i}$ equal $\overline{\mu}=p-q$ and \underline{$\mu$}$=-(p-q)$ respectively, and the implied conditional variance $\sigma^{2}$ of each $X_{i}$ is unambiguous and equals $p+q-\left( p-q\right) ^{2} \thinspace.\ Thus $p+q$ and $p-q$ parametrize risk (measured by $\sigma^{2}$) and ambiguity (measured by $\frac{\overline{\mu}-\underline{\mu}}{2}$) respectively in the sense that a change in $p+q$ alone changes only risk and a change in $p-q$ alone changes only ambiguity. } {\normalsize The final issue is the relation between experiments. Arguably, ignorance about which probability law applies to any given experiment, logically implies (or at least suggests) ignorance about how experiments are related. Accordingly, $\mathcal{P}^{IID}$ does not restrict measures on the entire sequence of experiments beyond requiring that each one-step-ahead conditional lie in $\mathcal{L}$. In contrast, $\mathcal{P}^{prod}$ admits only measures for which the conditional law for the $i^{th}$ experiment, though it can be either favorable or unfavorable, is necessarily the same for all histories of outcomes. Thus, for example, $\mathcal{P}^{prod}$ excludes measures that specify both (1) the favorable law for experiment $i$ after a successful outcome in $i-1$, and (2) the unfavorable law for experiment $i$ after a failure in $i-1$. } \section{The main results\label{section-CLT}} \subsection{Two theorems} {\normalsize We extend (a version of) the classical martingale CLT to admit ambiguity about means while maintaining the assumption of unambiguous variances. Though the theorems deal with real-valued random variables, multidimensional versions can be proven in a similar fashion and will be reported elsewhere. } \newpage \begin{thm} {\normalsize \label{thm-CLT} Let the sequence $\left( X_{i}\right) $ be such that $X_{i}\in\mathcal{H}$ for each $i$, and where $\left( X_{i}\right) $ satisfies (\ref{mubar}) and (\ref{condvar}), with conditional upper and lower means $\overline{\mu}$ and $\underline{\mu}$, and{ unambiguous conditional variance} $\sigma^{2}>0$. Assume also the Lindeberg condition (\ref{linder}) and that $\mathcal{P}$ is rectangular. Then, for any $\varphi\in C\left( \left[ -\infty,\infty\right] \right) $,{\small \begin{equation} \lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{1}{n}{\sum_{i=1}^{n}X_{i}}+\frac{1}{\sqrt{n} \sum\limits_{i=1}^{n}\frac{1}{\sigma}{(X_{i}-E_{Q}[X_{i}|\mathcal{G}_{i-1 ])}\right) \right] =\mathbb{E}_{\left[ \underline{\mu},\overline{\mu }\right] }[\varphi\left( B_{1}\right) ], \label{CLT \end{equation} or equivalently \begin{equation} \lim\limits_{n\rightarrow\infty}\inf_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{1}{n}{\sum_{i=1}^{n}X_{i}}+\frac{1}{\sqrt{n}}{\sum _{i=1}^{n}\frac{1}{\sigma}(X_{i}-E_{Q}[X_{i}|\mathcal{G}_{i-1}])}\right) \right] =\mathcal{E}_{\left[ \underline{\mu},\overline{\mu}\right] }[\varphi\left( B_{1}\right) ], \label{CLTinf \end{equation} where $\mathbb{E}_{\left[ \underline{\mu},\overline{\mu}\right] [\varphi\left( B_{1}\right) ]\equiv Y_{0}$ is called $g$-expectation by Peng in \cite{peng1997}, given that $(Y_{t},Z_{t})$ is the solution of the BSD \[ Y_{t}=\varphi(B_{1})+\int_{t}^{1}\max\limits_{\underline{\mu}\leq\mu \leq\overline{\mu}}(\mu Z_{s})ds-\int_{t}^{1}Z_{s}dB_{s},\ 0\leq t\leq1, \] and $\mathcal{E}_{\left[ \underline{\mu},\overline{\mu}\right] [\varphi\left( B_{1}\right) ]\equiv y_{0}$, given that $(y_{t},z_{t})$ is the solution of the BSDE \begin{equation} y_{t}=\varphi(B_{1})+\int_{t}^{1}\min\limits_{\underline{\mu}\leq\mu \leq\overline{\mu}}(\mu z_{s})ds-\int_{t}^{1}z_{s}dB_{s},\ 0\leq t\leq1\text{.} \label{BSDE-1-1 \end{equation} Here $(B_{t})$ is a standard Brownian motion on a probability space $(\Omega^{\ast},\mathcal{F}^{\ast},P^{\ast})$. }} \end{thm} \begin{remark} {\normalsize By standard limiting arguments, (\ref{CLT}) can be extended to indicator functions for intervals. Such indicators are sufficient in the classical CLT, because of the additivity of a single probability measure. But when dealing with sets of measures, (\ref{CLT}) is strictly stronger. Another remark is that while in (\ref{CLT}) the second term inside $\varphi\left( \cdot\right) $ is normalized by the standard deviation $\sigma$, a change of variables delivers a CLT without that normalization. (Set $\alpha=\sigma$ and $\beta=1$ in the statement of Theorem \ref{thm-CLTgen} in the appendix.) } \end{remark} {\normalsize Three differences from classical results stand out. First, the limiting distribution is not normal but rather is given by the BSDE (\ref{BSDE}). Another notable difference is that the r.v. on the left in (\ref{CLT}) combines the sample average, typical of LLNs, with a term that is more typical of CLTs. Both of these features will be discussed in section \ref{section-discuss} below. } {\normalsize Here we consider the fact that the argument of $\varphi$ above, whose distribution is the focus, includes measures $Q$ from $\mathcal{P}$, which might raise concerns about tractability. To partially alleviate such concerns, we show that (\ref{CLT}) takes on a more tractable form when restricted to "symmetric" functions $\varphi$. Say that $\varphi :\mathbb{R}\rightarrow\mathbb{R}$ is \emph{symmetric with center} $c\in\mathbb{R}$ if $\varphi\left( c-x\right) =\varphi\left( c+x\right) $ for all $x\in\mathbb{R}$. Examples include indicator(s) {$\varphi(t)=\pm I_{\left[ a,b\right] }(t)$} with $c=\frac{a+b}{2}$, and quadratic functions $\varphi\left( t\right) =\pm\left( t-c\right) ^{2}$, both of which are prominent in statistical methods. It is important to emphasize also that for both of these classes of functions \cite{chenBSDE} provides closed-form expressions for the BSDE-based limits appearing on the right sides of (\ref{CLT}) and (\ref{CLTinf}) above, and (\ref{sym-clt1}) and (\ref{sym-clt2-0}) below; recall (\ref{upperBSDE}), for example. Section \ref{section-hyp} exploits these closed-forms in an application to hypothesis testing. } {\normalsize The next theorem is the second major result of the paper. (Throughout sums of the form $\Sigma_{n}^{0}x_{i}$, }$n\geq1$,{\normalsize are taken to equal $0$, and increasing/decreasing are intended in the weak sense.) } {\normalsize } \begin{thm} {\normalsize \label{thm-special} Adopt the assumptions in Theorem \ref{thm-CLT} and let the function $\varphi\in C([-\infty,\infty])$ be symmetric with center $c\in\mathbb{R}$. For $n\geq1$ and $0\leq m\leq n$, define \begin{align} M_{m,n} & =\frac{1}{n}\sum\limits_{i=1}^{m}X_{i}+\frac{1}{\sqrt{n} \sum\limits_{i=1}^{m}\frac{1}{\sigma}\left( X_{i}-\mu_{i}^{n}\right) \text{,}\quad M_{0,n}\equiv0,\label{Mmn}\\ \widetilde{M}_{m,n} & =\frac{1}{n}\sum\limits_{i=1}^{m}X_{i}+\frac{1 {\sqrt{n}}\sum\limits_{i=1}^{m}\frac{1}{\sigma}\left( X_{i}-\widetilde{\mu }_{i}^{n}\right) , \quad\widetilde{M}_{0,n}\equiv0 \text{,}\; \label{tMmn \end{align} where \begin{align} \mu_{m}^{n} & =\overline{\mu}I_{A_{m-1,n}}+\underline{\mu}I_{A_{m-1,n}^{c },\label{mumn}\\ A_{m-1,n} & =\left\{ M_{m-1,n}\leq-\tfrac{\overline{\mu}+\underline{\mu }{2}\left( {1-\tfrac{m-1}{n}}\right) +c\right\} ,\nonumber \end{align} and {\normalsize \begin{align} \widetilde{\mu}_{m}^{n}= & \overline{\mu}I_{\widetilde{A}_{m-1,n }+\underline{\mu}I_{\widetilde{A}_{m-1,n}^{c}},\label{tmumn}\\ \widetilde{A}_{m-1,n} & =\left\{ \widetilde{M}_{m-1,n}\geq-\tfrac {\overline{\mu}+\underline{\mu}}{2}\left( {1-\tfrac{m-1}{n}}\right) +c\right\} \text{.}\nonumber \end{align} } \begin{description} \item {\normalsize {(1)} Assume that $\varphi$ is decreasing on $(c,\infty)$. Then \begin{equation} \lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( M_{n,n}\right) \right] =\mathbb{E}_{\left[ \underline{\mu },\overline{\mu}\right] }[\varphi\left( B_{1}\right) ]. \label{sym-clt1 \end{equation} } \item {\normalsize {(2)} Assume that $\varphi$ is increasing on $(c,\infty).$ Then \begin{equation} \liminf\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \widetilde{M}_{n,n}\right) \right] \geq\mathbb{E}_{\left[ \underline{\mu},\overline{\mu}\right] }[\varphi\left( B_{1}\right) ]. \label{sym-clt2-0 \end{equation} }\noindent{\normalsize }\noindent{\normalsize Furthermore, assume also that \begin{equation} \lim_{\delta\rightarrow0}\limsup_{n\rightarrow\infty}\frac{1}{n}\sum_{m=1 ^{n}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert E_{Q}[X_{m}|\mathcal{G _{m-1}]-\widetilde{\mu}_{m}^{n}\right\vert I_{\widetilde{A}_{m-1,n}^{\delta }\right] =0, \label{condition-1 \end{equation} }\noindent{\normalsize where \[ \widetilde{A}_{m-1,n}^{\delta}=\left\{ \left\vert \widetilde{M _{m-1,n}+\tfrac{\overline{\mu}+\underline{\mu}}{2}\left( {1-\tfrac{m-1}{n }\right) -c\right\vert \leq\delta\right\} ,\quad\delta>0. \] }\noindent{\normalsize Then \begin{equation} \lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \widetilde{M}_{n,n}\right) \right] =\mathbb{E}_{\left[ \underline{\mu},\overline{\mu}\right] }[\varphi\left( B_{1}\right) ]. \label{sym-clt2 \end{equation} } {\normalsize { }} \end{description} \end{thm} {\normalsize Consider (1). Given $n\geq1$, $\{\mu_{m}^{n}:m\leq n\}$ are defined recursively with $\mu_{m}^{n}$ being a function of $(X_{1 ,...,X_{m-1})$. The definition is clearer in the special case wher \begin{equation} c=0\text{ and }\underline{\mu}+\overline{\mu}=0\text{.} \label{symm-complete \end{equation} Then \begin{equation} \mu_{m}^{n}=\left\{ \begin{array} [c]{ccc \overline{\mu} & \text{if} & \frac{1}{n}\sum\limits_{i=1}^{m-1}X_{i}+\frac {1}{\sqrt{n}}\sum\limits_{i=1}^{m-1}\frac{1}{\sigma}\left( X_{i}-\mu_{i ^{n}\right) \leq0,\\ \underline{\mu} & \text{if} & \frac{1}{n}\sum\limits_{i=1}^{m-1}X_{i}+\frac {1}{\sqrt{n}}\sum\limits_{i=1}^{m-1}\frac{1}{\sigma}\left( X_{i}-\mu_{i ^{n}\right) >0. \end{array} \right. \label{mu-symm-complete \end{equation} That is, $\mu_{m}^{n}$ is set as large (small) as possible when $M_{m-1,n}\leq(>)0,$ {\normalsize hence lying in the region where $\varphi$ is increasing (decreasing). } Conclude that\ the theorem delivers the statistic $M_{n}=M_{n,n}$ defined in (\ref{Mmn}), and, through the upper expectation of $\varphi\left( M_{n}\right) $ for the indicated set of functions $\varphi$, (\ref{sym-clt1}) gives information about its asymptotic distribution. Moreover, in combination with (\ref{upperBSDE}), this information can be expressed in closed-form when $\varphi$ is the indicator for an interval (for a simpler proof than in \cite{chenBSDE} see Lemma \ref{explicit-solution} below). In particular, we have: For any $a<b\in ${\normalsize $\mathbb{R}$,{ \begin{align} & \lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}Q\left( a\leq M_{n}\leq b\right) \nonumber\\ = & \left\{ \begin{array} [c]{lcc \Phi_{-\overline{\mu}}\left( -a\right) -e^{-\frac{(\overline{\mu -\underline{\mu})(b-a)}{2}}\Phi_{-\overline{\mu}}\left( -b\right) & & \text{if }a+b\geq\overline{\mu}+\underline{\mu},\\ \Phi_{\underline{\mu}}\left( b\right) -e^{-\frac{(\overline{\mu -\underline{\mu})(b-a)}{2}}\Phi_{\underline{\mu}}\left( a\right) & & \text{if }a+b<\overline{\mu}+\underline{\mu}. \end{array} \right. \label{sym-indi-clt \end{align} } } Similarly, part (2) produces the statistic $\widetilde{M}_{n}=\widetilde {M}_{n,n}$ defined in (\ref{tMmn}), that plays a corresponding role. A difference is that only the inequality (\ref{sym-clt2-0}) is proven in general, though equality obtains under the condition (\ref{condition-1}). In that case one obtains (as above) that: For any $a<b\in\mathbb{R}$,{\normalsize { \begin{align*} & \lim\limits_{n\rightarrow\infty}\inf_{Q\in\mathcal{P}}Q\left( a\leq\widetilde{M}_{n}\leq b\right) \\ = & \left\{ \begin{array} [c]{lcc \Phi_{-\underline{\mu}}\left( -a\right) -e^{\frac{(\overline{\mu -\underline{\mu})(b-a)}{2}}\;\Phi_{-\underline{\mu}}\left( -b\right) & & \text{if }a+b\geq\overline{\mu}+\underline{\mu},\\ \Phi_{\overline{\mu}}\left( b\right) -e^{\frac{(\overline{\mu -\underline{\mu})(b-a)}{2}}\;\Phi_{\overline{\mu}}\left( a\right) & & \text{if }a+b<\overline{\mu}+\underline{\mu}. \end{array} \right. \end{align*} }} Finally, we note that {\normalsize (\ref{condition-1}) is easily verified when $\overline{\mu}=\underline{\mu}=\mu$, because then $E_{Q}[X_{m}|\mathcal{G _{m-1}]=\mu=$}${\widetilde{\mu}_{m}^{n}}$, {\normalsize for any $Q\in \mathcal{P}$} {\normalsize and $1\leq m\leq n$. }\noindent More generally, ({\normalsize \ref{condition-1}) is satisfied if \[ \lim_{\delta\rightarrow0}\limsup_{n\rightarrow\infty}\frac{1}{n}\sum_{m=1 ^{n}\sup_{Q\in\mathcal{P}}Q(\widetilde{A}_{m-1,n}^{\delta})=0. \] } {\normalsize When $c=\pm\infty$, the assumptions in the theorem imply global monotonicity conditions for }$\varphi${\normalsize , and lead to the fixed means $\underline{\mu}$ and $\overline{\mu}$ replacing the stochastic means appearing in { (\ref{CLT}), }(\ref{sym-clt1}) and (\ref{sym-clt2-0}) respectively, and to the normal as the limiting distribution. These features apply, in particular, to one-sided indicators $I_{(-\infty,b]}$ and $I_{[a,\infty)}$, and stand in contrast to the implications described above for two-sided indicators $I_{[a,b]}$. } \begin{corol} {\normalsize \label{cor-monotonic} Adopt the assumptions in Theorem \ref{thm-CLT} and assume that $\varphi\in C([-\infty,\infty])$. } \begin{description} \item {\normalsize {(1)} If $\varphi$ is decreasing on $\mathbb{R}$, then \begin{equation} \lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{1}{n}\sum\limits_{i=1}^{n}X_{i}+\frac{1}{\sqrt{n} \sum\limits_{i=1}^{n}\frac{1}{\sigma}(X_{i}-\underline{\mu})\right) \right] =\int\varphi\left( t\right) d\Phi_{\underline{\mu}}\left( t\right) \text{.} \label{decreasing-clt \end{equation} } \item {\normalsize {(2)} If $\varphi$ is increasing on $\mathbb{R}$, then \begin{equation} \lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{1}{n}\sum\limits_{i=1}^{n}X_{i}+\frac{1}{\sqrt{n} \sum\limits_{i=1}^{n}\frac{1}{\sigma}(X_{i}-\overline{\mu})\right) \right] =\int\varphi\left( t\right) d\Phi_{\overline{\mu}}\left( t\right) . \label{increasing-clt \end{equation} {\Large \noindent} } \end{description} \end{corol} \subsection{{\protect\normalsize \noindent An application to hypothesis testing\label{section-hyp}}} {\normalsize We give an illustrative application of Theorem \ref{thm-special} to hypothesis testing that demonstrates tractability; a more comprehensive study of statistical applications is beyond the scope of this paper. Here we exploit also explicit solutions to BSDEs established in \cite{chenBSDE}, an example of which is provided in (\ref{upperBSDE}). } {\normalsize Consider the mode \[ X_{i}=\theta+Y_{i}\text{, }i=1,2,...\text{, \] where $\theta\in\mathbb{R}$ is a parameter of interest, $(X_{i})$ describes observable data, and $\left( Y_{i}\right) $ is an unobservable error process. The usual assumption on errors is that they are i.i.d. with zero mean. Since errors are unobservable, a weaker a priori specification is natural. Thus, for example, assume the IID model $\mathcal{P}^{IID}$, and for simplicity, that errors have means that lie in the interval $\left[ -\kappa,\kappa\right] $. Both the variance $\sigma$ and $\kappa$, which $\,$measures ambiguity, are assumed known. In the special case $\kappa=0$, $\theta$ is the unknown mean of each $X_{i}$ and one can test hypotheses about its value by exploiting the classical CLT. Here we generalize that test procedure to cover $\kappa>0$. } {\normalsize Let $\varphi=I_{\left[ a,b\right] }$, which is symmetric with center $c=\frac{a+b}{2}$, and define the statistic{ $M_{n}=M_{n,n}$ by (\ref{Mmn})}. It follows from Theorem \ref{thm-special}(1) and (\ref{upperBSDE}) that, for any $\theta$, (see Appendix \ref{app-hyp}), { \begin{align} & \lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}^{IID}}Q\left( \{M_{n}-b\leq\theta\leq M_{n}-a\}\right) \nonumber\\ & =\lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}^{IID}}Q\left( \{a\leq M_{n}-\theta\leq b\}\right) =\mathbb{E}_{\left[ -\kappa ,\kappa\right] }[I_{[a,b]}\left( B_{1}\right) ]\label{Mtheta}\\ & =\left\{ \begin{array} [c]{lcc \Phi_{-\kappa}\left( -a\right) -e^{-\kappa\left( b-a\right) }\Phi _{-\kappa}\left( -b\right) & & \text{if }a+b\geq0,\\ \Phi_{-\kappa}\left( b\right) -e^{-\kappa\left( b-a\right) }\Phi_{-\kappa }\left( a\right) & & \text{if }a+b<0. \end{array} \right. \nonumber \end{align} } } {\normalsize The null hypothesis is $H_{0}:\theta\in\Theta$ and the alternative is $H_{1}$: $\theta\not \in \Theta$, for some $\Theta \subset\mathbb{R}$. A nonstandard feature is that there are several probability laws that conceivably describe the data even given a specific $\theta$. One test procedure is to accept $H_{0}$ if and only if the realized statistic $M_{n}$ is "sufficiently consistent" with some $\theta\in\Theta$ and some probability law in $\mathcal{P}^{IID}$. Precisely, choose $\left[ a,b\right] $ so that $\mathbb{E}_{\left[ -\kappa,\kappa\right] }[ I_{[a,b]}\left( B_{1}\right) ]=1-\alpha$, for a suitable $\alpha$, and accept $H_{0}$ if and only if $\mathcal{C}_{n}\cap\Theta\not =\varnothing$, where the random interval $\mathcal{C}_{n}$ is given b \[ \mathcal{C}_{n}=\left[ M_{n}-b,M_{n}-a\right] \text{. \] Then, if $H_{0}$ is true, in the limit for large samples the (upper) probability of acceptance is approximately $1-\alpha$. The upper probability of wrongly rejecting $H_{0}$ is typically greater than $\alpha$ because of the multiplicity of measures in $\mathcal{P}^{IID}$: \begin{align*} \sup_{Q\in\mathcal{P}^{IID}}Q\left( \{\mathcal{C}_{n}\cap\Theta =\varnothing\}\right) & =1-\inf_{Q\in\mathcal{P}^{IID}}Q\left( \{\mathcal{C}_{n}\cap\Theta\not =\varnothing\}\right) \\ & \geq1-\sup_{Q\in\mathcal{P}^{IID}}Q\left( \{\mathcal{C}_{n}\cap \Theta\not =\varnothing\}\right) \text{. \end{align*} } {\normalsize Let $\Theta=\{\theta_{0}\}$ and suppose that the truth is $\theta=\theta_{1}\equiv\theta_{0}+\xi$, $\xi\not =0$. Then the limiting upper probability of wrongly accepting $\theta_{0}$ is given by \begin{align*} & \lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}^{IID}}Q\left( \{a\leq M_{n}-\theta_{0}\leq b\}\right) \\ & =\lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}^{IID}}Q\left( \{a\leq M_{n}-\theta_{1}+\xi\leq b\}\right) \\ & =\mathbb{E}_{\left[ -\kappa+\xi,\kappa+\xi\right] }[I_{[a,b]}\left( B_{1}\right) ]=\mathbb{E}_{\left[ -\kappa,\kappa\right] }[I_{[a-\xi,b-\xi ]}\left( B_{1}\right) ] \end{align*} We emphasize that, given $a$ and $b$, $\mathbb{E}_{\left[ -\kappa ,\kappa\right] }[I_{[a-\xi,b-\xi]}\left( B_{1}\right) ]$ can be expressed in closed-form (using (\ref{upperBSDE})); and $a$ and $b$ might be chosen by solving \begin{equation} \min_{a\leq b}\mathbb{E}_{\left[ -\kappa,\kappa\right] }[I_{[a-\xi,b-\xi ]}\left( B_{1}\right) ]\text{ ~s.t. }\mathbb{E}_{\left[ -\kappa ,\kappa\right] }[I_{[a,b]}\left( B_{1}\right) ]\geq1-\alpha\text{.} \label{min \end{equation} } \section{Further discussion\label{section-discuss}} {\normalsize We turn attention to two nonstandard features of the CLT Theorem \ref{thm-CLT} mentioned only briefly above. One novel feature is that the limit is defined by the BSDE (\ref{BSDE}). It is shown in \cite[Theorem 2.2]{CE}, using the Girsanov Theorem, that $\mathbb{E}_{\left[ \underline {\mu},\overline{\mu}\right] }\left[ \cdot\right] $ is also an upper expectation for a set of probability measures, where these are defined on $C\left( \left[ 0,1\right] \right) $, the space of continuous trajectories. Moreover, measures in this set define differing models of the underlying stochastically varying (instantaneous) drift. Stochastic variability of the drift is suggested by (\ref{BSDE}), according to which it varies between $\underline{\mu}$ and $\overline{\mu}$ depending on the sign of $Z_{s}$. When the mean is unambiguous ($\underline{\mu}=\overline{\mu}=\mu$), then the drift is constant and $\mathbb{E}_{\left[ \underline{\mu ,\overline{\mu}\right] }\left[ \cdot\right] $ reduces to a linear expectation with normal distribution. However, in general, \emph{the limit is given by a two parameter (}$\underline{\mu}$\emph{ and }$\overline{\mu $\emph{) family of upper expectations} that model stochastically varying drift in a continuous-time context. This limiting family is common to a large class of models (for example, to all IID models in section \ref{section-IID}), thus endowing the BSDE with special significance for asymptotic approximations in a sequential context with considerable unstructured heterogeneity in means. } {\normalsize The other notable feature is that the r.v. on the left in (\ref{CLT}) combines the sample average, typical of LLNs, with a term that is more typical of CLTs. In the classical i.i.d. or martingale model, including the empirical average $\frac{1}{n}{\sum_{i=1}^{n}X_{i}}$ is of little consequence for the CLT because the LLN permits replacing it by the common mean of the $X_{i}$s, thereby merely shifting the mean of the limiting normal distribution. This supports the common view that, in large samples, sample average reveals location of the population distribution while the ($\sqrt{n $-scaled) average deviation from the mean reflects the distribution about that location. But this separation of roles is not true in our framework because empirical averages need not converge given ambiguity (see related LLNs in \cite{esIID, mm, peng2008,chen}, for example). Next we show that both a LLN and a "more standard-looking" CLT can be obtained from Theorem \ref{thm-CLT} - the former as a corollary and the latter by adapting the proof of our CLT. However, our CLT is more than the "sum of these parts"; for example, a BSDE-based limit as in (\ref{CLT}) is not present or at all evident from inspection of the two derivative results. } \begin{thm} {\normalsize \label{thm-CLT2}Let the sequence $\left( X_{i}\right) $ be such that $X_{i}\in\mathcal{H}$ for each $i$, and where $\left( X_{i}\right) $ satisfies (\ref{mubar}) and (\ref{condvar}), with conditional upper and lower means $\overline{\mu}$ and $\underline{\mu}$, and {unambiguous conditional variance} $\sigma^{2}>0$. Suppose also that $(X_{i})$ satisfies the Lindeberg condition (\ref{linder}). Then, for any $\varphi\in C\left( \left[ -\infty,\infty\right] \right) $ \begin{equation} \lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{1}{\sqrt{n}}\sum\limits_{i=1}^{n}\frac{1}{\sigma {(X_{i}-E_{Q}[X_{i}|\mathcal{G}_{i-1}]}\right) \right] =\int\varphi\left( t\right) d\Phi_{0}\left( t\right) \text{.} \label{CLT2 \end{equation} } \end{thm} {\normalsize \noindent A proof can be constructed along the lines of that of Theorem \ref{thm-CLT} as indicated in Remarks \ref{remark-CLT2} and \ref{remark-CLT2b} and in Appendix \ref{app-CLT2}. } {\normalsize In comparison with Theorem \ref{thm-CLT}, the above theorem drops rectangularity and yields a limit given by the normal distribution as in the classical martingale CLT. This is intuitive since, as argued earlier, the non-normal limit in Theorem \ref{thm-CLT} reflects agnosticism about the \emph{stochastic} variation in means, which is implicit in rectangularity. The difference between the two theorems can be seen clearly through their canonical examples, the IID model $\mathcal{P}^{IID}$ for Theorem \ref{thm-CLT} and, we would argue, the product model $\mathcal{P}^{prod}$ for the second theorem. The noted agnosticism motivates $\mathcal{P}^{IID}$ but is excluded by $\mathcal{P}^{prod}~$(section \ref{section-IID}). } {\normalsize Another point of comparison is that while Theorem \ref{thm-CLT2} adopts weaker assumptions, there is a sense in which it also produces a weaker result. For example, it does not discriminate between the IID and product models - the limit is the same for both. In contrast, it can be shown that Theorem \ref{thm-CLT}, where the sample average term is included, is not valid for the product model. } {\normalsize Theorem \ref{thm-CLT2} also clarifies the relation (outlined in the introduction) between this paper and CLTs by Peng and coauthors. In particular, in common with (\ref{CLT2}) and unlike (\ref{CLT}), \cite[Theorem 3.2]{peng2019} excludes the sample average term and delivers a normal distribution in the limit. } {\normalsize Finally, we show that if Theorem \ref{thm-CLT} is modified so as to include only the sample average term, then one obtains the following LLN. (The idea in the proof, found in Appendix \ref{app-LLN}, is first to note the appropriate form of (\ref{CLT}) when the deviation term is weighted by $\alpha>0$, and then to let $\alpha\to0$.) } \begin{corol} {\normalsize \label{cor-LLN} Adopt the assumptions in Theorem \ref{thm-CLT}. Then, for any $\varphi\in C\left( \left[ -\infty,\infty\right] \right) $, \begin{equation} \lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{1}{n}{\sum_{i=1}^{n}X_{i}}\right) \right] =\sup\limits_{\underline{\mu}\leq\mu\leq\overline{\mu}}\varphi\left( \mu\right) \text{.} \label{LLN \end{equation} } \end{corol} {\normalsize \noindent For example, if $\varphi=I_{\left[ a,b\right] }$, then (\ref{LLN}) takes the form{ \[ \lim\limits_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}Q\left( a\leq\frac {1}{n}{\sum_{i=1}^{n}X_{i}}\leq b\right) =\left\{ \begin{array} [c]{cc 1 & \text{ if }\left[ a,b\right] \cap\left[ \underline{\mu},\overline{\mu }\right] \not =\varnothing\\ 0 & \text{otherwise. \end{array} \right. \] } } \section{Main proofs\label{section-proofs}} {\normalsize This section proves Theorems \ref{thm-CLT} and \ref{thm-special}. Throughout we use the following well-known properties of (conditional) upper expectations, understood to hold for all $X$ and $Y$ in $\mathcal{H}$, and all $n\geq0$. } \begin{enumerate} \item {\normalsize Monotonicity: $X\geq Y$ implies $\mathbb{E}\left[ X\mid\mathcal{G}_{n}\right] \geq\mathbb{E}\left[ Y\mid\mathcal{G _{n}\right] . $ } \item {\normalsize Sub-additivity: $\mathbb{E}\left[ X+Y\mid\mathcal{G _{n}\right] \leq\mathbb{E}\left[ X\mid\mathcal{G}_{n}\right] +\mathbb{E \left[ Y\mid\mathcal{G}_{n}\right] . $ } \item {\normalsize Homogeneity: If $Z$ is $\mathcal{G}_{n}$ measurable, \[ \mathbb{E}\left[ ZX\mid\mathcal{G}_{n}\right] =Z^{+}\mathbb{E}\left[ X\mid\mathcal{G}_{n}\right] -Z^{-}\mathcal{E}\left[ X\mid\mathcal{G _{n}\right] . \] } \item {\normalsize Translation homogeneity: If $Z$ is $\mathcal{G}_{n}$ measurable, \[ \mathbb{E}[Z+X\mid\mathcal{G}_{n}]=Z+\mathbb{E}[X\mid\mathcal{G}_{n}]. \] } \end{enumerate} {\normalsize The assumptions in Theorem \ref{thm-CLT} are adopted throughout. As indicated following (\ref{BSDE-1-1}), $(B_{t})$ is a standard Brownian motion on a filtered probability space {$(\Omega^{\ast},\mathcal{F}^{\ast },\{\mathcal{F}_{t}\},P^{\ast})$}; $\{\mathcal{F}_{t}\}$ is the natural filtration generated by $(B_{t})$. } {\normalsize For both theorems, we prove them first for the special case where \begin{equation} -\underline{\mu}=\overline{\mu}=\kappa\geq0, \label{kappa \end{equation} that is, \[ \mathbb{E}[X_{i}\mid\mathcal{G}_{i-1}]=\kappa,\quad\mathcal{E}[X_{i \mid\mathcal{G}_{i-1}]=-\kappa. \] Then the results asserted for general $\underline{\mu}$ and $\overline{\mu}$ are established by applying the preceding special case to $\left( Y_{i}\right) $, where $Y_{i}=X_{i}-\tfrac{\overline{\mu}+\underline{\mu}}{2 $, and thus \[ \mathbb{E}[Y_{i}\mid\mathcal{G}_{i-1}]=\frac{\overline{\mu}-\underline{\mu }{2},\quad\mathcal{E}[Y_{i}\mid\mathcal{G}_{i-1}]=-\frac{\overline{\mu }-\underline{\mu}}{2}\text{. \] } \subsection{Lemmas} {\normalsize The following lemmas prepare the groundwork for proofs of both Theorems \ref{thm-CLT} and \ref{thm-special}. The special case (\ref{kappa}) is assumed throughout unless specified otherwise. } {\normalsize For any fixed $\epsilon>0$, define $g_{\epsilon}:\mathbb{R \rightarrow\mathbb{R}$ by \begin{equation} g_{\epsilon}(z)=\kappa\left( \sqrt{z^{2}+\epsilon^{2}}-\epsilon\right) \text{.} \label{gep \end{equation} Obviously, $g_{\epsilon}(0)=0$ and $g_{\epsilon}$ is symmetric with center $c=0$. For any suitably integrable random variable $\xi\in\mathcal{F}_{1}$, define $g$-expectation by $\mathbb{E}_{g_{\epsilon}}[\xi]=Y_{0}^{\epsilon}$, where $\left( Y_{t}^{\epsilon},Z_{t}^{\epsilon}\right) $ is the unique solution to the BSDE \begin{equation} Y_{t}^{\epsilon}=\xi+\int_{t}^{1}g_{\epsilon}\left( Z_{s}^{\epsilon}\right) ds-\int_{t}^{1}Z_{s}^{\epsilon}dB_{s},\;0\leq t\leq1\text{.} \label{BSDEep \end{equation} (Existence of a unique solution follows from \cite{pp}.) Moreover, by \cite[Proposition 2.1]{KPQ}, { for any suitably integrable $\xi\in \mathcal{F}_{1},$} \[ \mathbb{E}_{g_{\epsilon}}[\xi]\rightarrow\mathbb{E}_{g_{0}}[\xi]\text{, as }\epsilon\rightarrow0, \] where $\mathbb{E}_{g_{0}}[\xi]=Y_{0}^{0}$, and $\left( Y_{t}^{0},Z_{t ^{0}\right) $ is the unique solution to the BSDE (\ref{BSDEep}) for the extreme case corresponding to $\epsilon=0$, where \begin{equation} g_{0}\left( z\right) =\kappa|z|\text{,} \label{g0 \end{equation} and $\mathbb{E}_{g_{0}}$ is alternative notation for $\mathbb{E}_{\left[ -\kappa,\kappa\right] }$. We consider $g_{\epsilon}$ for $\epsilon>0$ in order to overcome the nondifferentiability of $g_{0}$ at $z=0$. (The relevant smoothness is exploited in Lemma \ref{lemma-ddp}.)} {\normalsize We introduce a sequence of functions generated by $g$-expectation $\mathbb{E}_{g_{\epsilon}}$. Some properties of $g$-expectations can be found in \cite{peng1997}, we need to prove the following properties. } {\normalsize Given $\varphi\in C_{b}^{3}(\mathbb{R})$, let $\xi=\varphi\left( x+B_{1}-B_{\frac{m}{n}}\right) $ in (\ref{BSDEep}) and define the functions $\{H_{m,n}\}_{m=0}^{n}$ by \begin{equation} H_{m,n}\left( x\right) \equiv\mathbb{E}_{g_{\epsilon}}\left[ \varphi\left( x+B_{1}-B_{\frac{m}{n}}\right) \right] ,\;m=0,\cdots,n. \label{BSDEep-1 \end{equation} ($\epsilon>0$ is fixed and dependence on $\epsilon$ is suppressed notationally.) Obviously, \[ H_{n,n}(x)=\varphi(x),\;H_{0,n}(x)=\mathbb{E}_{g_{\epsilon}}\left[ \varphi\left( x+B_{1}\right) \right] . \] The following lemma shows that the functions $\{H_{m,n}\}_{m=0}^{n}$ are suitably differentiable given that $\varphi\in C_{b}^{3}(\mathbb{R})$ and $\epsilon>0$. } \begin{lemma} {\normalsize \label{lemma-ddp}The functions $\{H_{m,n}\}_{m=0}^{n}$ satisfy: } \begin{description} \item {\normalsize {(1)} $H_{m,n}\in C_{b}^{2}(\mathbb{R}),$ for $n\geq1,\;m=0,1,\cdots n.$ } \item {\normalsize {(2)} The second derivatives of $H_{m,n}$ are uniformly bounded and Lipschitz continuous with uniform Lipschitz constant for $\ \{\left( m,n\right) :0\leq m\leq n\}$. } \item {\normalsize {(3)} Dynamic programming principle: for $n\geq1$, $m=1,...,n,$ \[ {\normalsize H_{m-1,n}(x)=\mathbb{E}_{g_{\epsilon}}\left[ H_{m,n}\left( x+B_{\frac{m}{n}}-B_{\frac{m-1}{n}}\right) \right] ,\;x\in\mathbb{R}. \] \item {\normalsize {(4)} Identically distributed: for $n\geq1$, $m=1,...,n,$ \[ \mathbb{E}_{g_{\epsilon}}\left[ H_{m,n}\left( x+B_{\frac{m}{n} -B_{\frac{m-1}{n}}\right) \right] =\mathbb{E}_{g_{\epsilon}}\left[ H_{m,n}\left( x+B_{\frac{1}{n}}\right) \right] ,\;x\in\mathbb{R}. \] } \end{description} \end{lemma} {\normalsize \noindent\textbf{Proof: }{(1) and (2):} From the nonlinear Feynman-Kac Formula \cite[Proposition 4.3]{KPQ}, we have $H_{m,n (x)=u(\frac{m}{n},x)$ and $u$ is the solution of the PD \begin{equation} \left\{ \begin{array} [c]{ll \partial_{t} u+\frac{1}{2}\partial^{2}_{xx}u+\kappa\left( \sqrt{|\partial _{x}u|^{2}+\epsilon^{2}}-\epsilon\right) =0, & \\ u(1,x)=\varphi(x). & \end{array} \right. \label{pde1 \end{equation} } {\normalsize Next we prove that for any $t\in\lbrack0,1]$, $u(t,\cdot)\in C_{b}^{2}(\mathbb{R})$; $u(t,\cdot),$ $\partial_{x}u(t,\cdot),$ $\partial _{xx}^{2}u(t,\cdot)$ are bounded uniformly in $t\in\lbrack0,1]$; and for any $x,x^{\prime}\in\mathbb{R}$, $\exists C>0$ such that $|\partial_{xx ^{2}u(t,x)-\partial_{xx}^{2}u(t,x^{\prime})|\leq C|x-x^{\prime}|\text{, \ }\forall t\in\lbrack0,1]$. } {\normalsize By the definition of $g_{\epsilon}$, \[ g_{\epsilon}^{\prime}(z)=\kappa\frac{z}{\sqrt{\epsilon^{2}+z^{2}} \Rightarrow|g_{\epsilon}^{\prime}(z)|\leq\kappa, \ \[ g_{\epsilon}^{\prime\prime}(z)=\kappa\frac{\epsilon^{2}}{(\epsilon^{2 +z^{2})^{3/2}}\Rightarrow|g_{\epsilon}^{\prime\prime}(z)|\leq\frac{\kappa }{\epsilon}, \ \[ g_{\epsilon}^{\prime\prime\prime}(z)=-\kappa\frac{3z\epsilon^{2} {(\epsilon^{2}+z^{2})^{5/2}}\Rightarrow|g_{\epsilon}^{\prime\prime\prime }(z)|\leq\frac{3\kappa}{\epsilon^{2}}. \] Consider the following BSDE, \begin{equation} Y_{s}^{t,x}=\varphi(x+B_{1}-B_{t})+\int_{s}^{1}g_{\epsilon}(Z_{r ^{t,x})dr-\int_{s}^{1}Z_{r}^{t,x}dB_{r},~s\in\lbrack t,1].\label{bsde \end{equation} Then $u(t,x)=Y_{t}^{t,x}$ is the classical unique solution of PDE (\ref{pde1}), and \begin{align} \partial_{x}Y_{s}^{t,x}= & \varphi^{\prime}(x+B_{1}-B_{t})+\int_{s ^{1}g_{\epsilon}^{\prime}(Z_{r}^{t,x})\partial_{x}Z_{r}^{t,x}dr-\int_{s ^{1}\partial_{x}Z_{r}^{t,x}dB_{r},~s\in\lbrack t,1].\label{1stbsde}\\ \partial_{x}^{2}Y_{s}^{t,x}= & \varphi^{\prime\prime}(x+B_{1}-B_{t})+\int _{s}^{1}g_{\epsilon}^{\prime\prime}(Z_{r}^{t,x})|\partial_{x}Z_{r}^{t,x |^{2}dr+\int_{s}^{1}g_{\epsilon}^{\prime}(Z_{r}^{t,x})\partial_{x}^{2 Z_{r}^{t,x}dr\nonumber\\ & -\int_{s}^{1}\partial_{x}^{2}Z_{r}^{t,x}dB_{r},~s\in\lbrack t,1].\label{2ndbsde \end{align} From standard estimates of BSDEs (\cite{KPQ}), we have, $\forall p\geq2$, $\forall x\in\mathbb{R}$, \begin{align*} & E_{P^{\ast}}\left[ \sup_{s\in\lbrack t,1]}|Y_{s}^{t,x}|^{p}|\mathcal{F _{t}\right] +E_{P^{\ast}}\left[ (\int_{t}^{1}|Z_{s}^{t,x}|^{2}ds)^{\frac {p}{2}}|\mathcal{F}_{t}\right] \\ \leq & C_{p}^{0}E_{P^{\ast}}\left[ |\varphi(x+B_{1}-B_{t})|^{p}+(\int _{t}^{1}|g_{\epsilon}(0)|dr)^{p}|\mathcal{F}_{t}\right] \leq{C_{p}^{0 \Vert\varphi\Vert^{p}};\\ & E_{P^{\ast}}\left[ \sup_{s\in\lbrack t,1]}|\partial_{x}Y_{s}^{t,x |^{p}|\mathcal{F}_{t}\right] +E_{P^{\ast}}\left[ (\int_{t}^{1}|\partial _{x}Z_{s}^{t,x}|^{2}ds)^{\frac{p}{2}}|\mathcal{F}_{t}\right] \\ \leq & C_{p}^{1}E_{P^{\ast}}\left[ |\varphi^{\prime}(x+B_{1}-B_{t )|^{p}|\mathcal{F}_{t}\right] \leq C_{p}^{1}\Vert\varphi^{\prime}\Vert^{p};\\ & E_{P^{\ast}}\left[ \sup_{s\in\lbrack t,1]}|\partial_{x}^{2}Y_{s ^{t,x}|^{p}|\mathcal{F}_{t}\right] +E_{P^{\ast}}\left[ (\int_{t ^{1}|\partial_{x}^{2}Z_{s}^{t,x}|^{2}ds)^{\frac{p}{2}}|\mathcal{F}_{t}\right] \\ \leq & C_{p}^{2}E_{P^{\ast}}\left[ |\varphi^{\prime\prime}(x+B_{1 -B_{t})|^{p}+(\int_{t}^{1}|g_{\epsilon}^{\prime\prime}({Z_{s}^{t,x })||\partial_{x}Z_{s}^{t,x}|^{2}ds)^{p}|\mathcal{F}_{t}\right] \\ \leq & C_{p}^{2}(\Vert\varphi^{\prime\prime}\Vert^{p}+(\tfrac{\kappa }{\epsilon})^{p}C_{2p}^{1}\Vert\varphi^{\prime}\Vert^{2p}), \end{align*} where $C_{p}^{0},C_{p}^{1},C_{2p}^{1},C_{p}^{2}$ are constants independent of $t$ and $\Vert f\Vert=\sup_{x\in\mathbb{R}}f(x)$ denote the sup norm of function $f$. Then, for any $t\in\lbrack0,1]$, $u(t,\cdot)\in C_{b ^{2}(\mathbb{R})$ and $u(t,\cdot),\partial_{x}u(t,\cdot),\partial_{xx ^{2}u(t,\cdot)$ are bounded uniformly in $t\in\lbrack0,1]$. } {\normalsize From (\ref{bsde}), the Malliavin derivative satisfies, for $u\in\lbrack t,s)$, \[ D_{u}Y_{s}^{t,x}=\varphi^{\prime}(x+B_{1}-B_{t})+\int_{s}^{1}g_{\epsilon }^{\prime}(Z_{r}^{t,x})D_{u}Z_{r}^{t,x}dr-\int_{s}^{1}D_{u}Z_{r}^{t,x dB_{r},~s\in\lbrack t,1]. \] From standard estimates for BSDEs, for $s\in\lbrack t,1]$, we have \[ E_{P^{\ast}}\left[ \left( \int_{s}^{1}|D_{u}Z_{r}^{t,x}|^{2}dr\right) ^{\frac{p}{2}}|\mathcal{F}_{s}\right] \leq C_{p}^{1}E_{P^{\ast}}\left[ |\varphi^{\prime}(s+B_{1}-B_{t})|^{p}|\mathcal{F}_{s}\right] \leq C_{p ^{1}\Vert\varphi^{\prime}\Vert^{p}\text{, \] and from (\ref{1stbsde}), we have \begin{align*} D_{u}\left[ \partial_{x}Y_{s}^{t,x}\right] = & \varphi^{\prime\prime }(x+B_{1}-B_{t})+\int_{s}^{1}g_{\epsilon}^{\prime\prime}(Z_{r}^{t,x )D_{u}[Z_{r}^{t,x}]\partial_{x}Z_{r}^{t,x}dr\\ & +\int_{s}^{1}g_{\epsilon}^{\prime}(Z_{r}^{t,x})D_{u}\left[ \partial _{x}Z_{r}^{t,x}\right] dr-\int_{s}^{1}D_{u}\left[ \partial_{x}Z_{r ^{t,x}\right] dB_{r},~s\in\lbrack t,1]. \end{align*} Let $d\tilde{B}_{s}=dB_{s}-g_{\epsilon}^{\prime}(Z_{s}^{t,x})ds$, $\rho _{s}=\exp\left\{ \int_{0}^{s}g_{\epsilon}^{\prime}(Z_{r}^{t,x})dB_{r -\frac{1}{2}\int_{0}^{s}|g_{\epsilon}^{\prime}(Z_{r}^{t,x})|^{2}dr\right\} $, and $E_{P^{\ast}}[\frac{d\tilde{P}}{dP^{\ast}}|_{\mathcal{F}_{s}}]=\rho_{s}$. Then,} {\footnotesize \begin{align*} & \left\vert D_{u}\left[ \partial_{x}Y_{s}^{t,x}\right] \right\vert \\ = & \left\vert E_{\tilde{P}}\left[ \varphi^{\prime\prime}(x+B_{1 -B_{t})+\int_{s}^{1}g_{\epsilon}^{\prime\prime}(Z_{r}^{t,x})D_{u}[Z_{r ^{t,x}]\partial_{x}Z_{r}^{t,x}dr|\mathcal{F}_{s}\right] \right\vert \\ \leq & \Vert\varphi^{\prime\prime}\Vert+\frac{\kappa}{\epsilon}E_{P^{\ast }\left[ \rho_{1}(\rho_{s})^{-1}\cdot\int_{s}^{1}|D_{u}[Z_{r}^{t,x ]|\cdot|\partial_{x}Z_{r}^{t,x}|dr|\mathcal{F}_{s}\right] \\ \leq & \Vert\varphi^{\prime\prime}\Vert+\frac{\kappa}{\epsilon M_{s}\;\bigg(E_{P^{\ast}}\Big[\big(\int_{s}^{1}|D_{u}[Z_{r}^{t,x ]|^{2}dr\big)^{2}|\mathcal{F}_{s}\Big]\bigg)^{\frac{1}{4}}\bigg(E_{P^{\ast }\Big[\big(\int_{s}^{1}|\partial_{x}Z_{r}^{t,x}|^{2}dr\big)^{2}|\mathcal{F _{s}\Big]\bigg)^{\frac{1}{4}}\\ \leq & K\text{, \end{align*} }{\normalsize where $M_{s}\equiv\left( E_{P^{\ast}}\left[ \rho_{1}^{2 (\rho_{s})^{-2}|\mathcal{F}_{s}\right] \right) ^{\frac{1}{2}}$, {and satisfies \begin{align*} M_{s}^{2}= & E_{P^{\ast}}\left[ e^{\int_{s}^{1}2g_{\epsilon}^{\prime (Z_{r}^{t,x})dB_{r}-\int_{s}^{1}|g_{\epsilon}^{\prime}(Z_{r}^{t,x})|^{2 dr}|\mathcal{F}_{s}\right] \\ = & E_{P^{\ast}}\left[ e^{\int_{s}^{1}2g_{\epsilon}^{\prime}(Z_{r ^{t,x})dB_{r}-\frac{1}{2}\int_{s}^{1}|2g_{\epsilon}^{\prime}(Z_{r}^{t,x )|^{2}dr}e^{\int_{s}^{1}|g_{\epsilon}^{\prime}(Z_{r}^{t,x})|^{2 dr}|\mathcal{F}_{s}\right] \leq e^{\kappa^{2}}\text{. \end{align*} } Here $K$ is a constant that depends on $\kappa,\epsilon,p$,$\Vert \varphi^{\prime}\Vert$,$\Vert\varphi^{\prime\prime}\Vert.$ With $u\in\lbrack t,s)$, from (\ref{1stbsde}), the Malliavin derivative satisfies, $\forall s\in\lbrack t,1]$, \begin{align*} D_{u}\left[ \partial_{x}Y_{s}^{t,x}\right] = & -\int_{u}^{s}g_{\epsilon }^{\prime\prime}(Z_{r}^{t,x})D_{u}\left[ Z_{r}^{t,x}\right] \partial _{x}Z_{r}^{t,x}dr-\int_{u}^{s}g_{\epsilon}^{\prime}(Z_{r}^{t,x})D_{u}\left[ \partial_{x}Z_{r}^{t,x}\right] dr\\ & +\int_{u}^{s}D_{u}\left[ \partial_{x}Z_{r}^{t,x}\right] dB_{r +\partial_{x}Z_{u}^{t,x}\text{, and \end{align* \[ \lim_{s\downarrow u}D_{u}\left[ \partial_{x}Y_{s}^{t,x}\right] =\partial _{x}Z_{u}^{t,x}~~P^{\ast}\text{-a.s. \] We have \[ |\partial_{x}Z_{u}^{t,x}|\leq K~~du\times dP^{\ast}\text{-}a.s. \] Thus, from (\ref{2ndbsde}), by standard estimates for BSDEs again, $\forall p\geq2$, $\forall x,x^{\prime}\in\mathbb{R}$,}{\small \begin{align*} & E_{P^{\ast}}\left[ \sup_{s\in\lbrack t,1]}|\partial_{x}^{2}Y_{s ^{t,x}-\partial_{x}^{2}Y_{s}^{t,x^{\prime}}|^{p}|\mathcal{F}_{t}\right] +E_{P^{\ast}}\left[ \left( \int_{t}^{1}|\partial_{x}^{2}Z_{r}^{t,x -\partial_{x}^{2}Z_{r}^{t,x^{\prime}}|^{2}dr\right) ^{\frac{p}{2 }|\mathcal{F}_{t}\right] \\ \leq & C_{p}E_{P^{\ast}}\left[ |\varphi^{\prime\prime}(x+B_{1 -B_{t})-\varphi^{\prime\prime}(x^{\prime}+B_{1}-B_{t})|^{p}|\mathcal{F _{t}\right] \\ & +C_{p}E_{P^{\ast}}\left[ \left( \int_{t}^{1}|g_{\epsilon}^{\prime\prime }(Z_{r}^{t,x})(\partial_{x}Z_{r}^{t,x})^{2}-g_{\epsilon}^{\prime\prime (Z_{r}^{t,x^{\prime}})(\partial_{x}Z_{r}^{t,x^{\prime}})^{2}|dr\right) ^{p}|\mathcal{F}_{t}\right] \\ & +C_{p}E_{P^{\ast}}\left[ \left( \int_{t}^{1}|g_{\epsilon}^{\prime (Z_{r}^{t,x})-g_{\epsilon}^{\prime}(Z_{r}^{t,x^{\prime}})||\partial_{x ^{2}Z_{r}^{t,x}|dr\right) ^{p}|\mathcal{F}_{t}\right] \\ \equiv & I_{1}+I_{2}+I_{3}, \end{align*} }{\normalsize where $C_{p}$ is a constant independent of $t$, and $I_{1 ,I_{2},I_{3}$ satisfied}{\small \begin{align*} I_{1}= & C_{p}E_{P^{\ast}}\left[ |\varphi^{\prime\prime}(x+B_{1 -B_{t})-\varphi^{\prime\prime}(x^{\prime}+B_{1}-B_{t})|^{p}|\mathcal{F _{t}\right] \\ \leq & C_{p}\Vert\varphi^{\prime\prime\prime}\Vert^{p}|x-x^{\prime |^{p}=C_{1,p}|x-x^{\prime}|^{p},\quad(\text{where }C_{1,p}=C_{p}\Vert \varphi^{\prime\prime\prime}\Vert^{p})\\ I_{2}= & C_{p}E_{P^{\ast}}\left[ \left( \int_{t}^{1}\Big|g_{\epsilon }^{\prime\prime}(Z_{r}^{t,x})(\partial_{x}Z_{r}^{t,x})(\partial_{x}Z_{r ^{t,x}-\partial_{x}Z_{r}^{t,x^{\prime}})\right. \right. \\ & \qquad\qquad+(g_{\epsilon}^{\prime\prime}(Z_{r}^{t,x})-g_{\epsilon ^{\prime\prime}(Z_{r}^{t,x^{\prime}}))(\partial_{x}Z_{r}^{t,x})(\partial _{x}Z_{r}^{t,x^{\prime}})\\ & \qquad\qquad+\left. \left. g_{\epsilon}^{\prime\prime}(Z_{r ^{t,x^{\prime}})(\partial_{x}Z_{r}^{t,x^{\prime}})(\partial_{x}Z_{r ^{t,x}-\partial_{x}Z_{r}^{t,x^{\prime}})\Big|dr\right) ^{p}|\mathcal{F _{t}\right] \\ \leq & 2\cdot3^{p-1}C_{p}(\tfrac{\kappa}{\epsilon})^{p}K^{p}E_{P^{\ast }\left[ \left( \int_{t}^{1}|\partial_{x}Z_{r}^{t,x}-\partial_{x Z_{r}^{t,x^{\prime}}|dr\right) ^{p}|\mathcal{F}_{t}\right] \\ & +3^{p-1}C_{p}K^{2p}(\tfrac{3\kappa}{\epsilon^{2}})^{p}E_{P^{\ast}}\left[ \left( \int_{t}^{1}|Z_{r}^{t,x}-Z_{r}^{t,x^{\prime}}|dr\right) ^{p}|\mathcal{F}_{t}\right] \\ \leq & C_{2,p}|x-x^{\prime}|^{p}, \end{align*} }{\normalsize where $C_{2,p}$ is a constant depend on $\kappa,\epsilon ,p,\Vert\varphi^{\prime}\Vert$ and $\Vert\varphi^{\prime\prime}\Vert ,}{\small \begin{align*} I_{3} & =C_{p}E_{P^{\ast}}\left[ \left( \int_{t}^{1}|g_{\epsilon}^{\prime }(Z_{r}^{t,x})-g_{\epsilon}^{\prime}(Z_{r}^{t,x^{\prime}})||\partial_{x ^{2}Z_{r}^{t,x}|dr\right) ^{p}|\mathcal{F}_{t}\right] \\ & \leq C_{p}(\tfrac{\kappa}{\epsilon})^{p}E_{P^{\ast}}\left[ \left( \int_{t}^{1}|Z_{r}^{t,x}-Z_{r}^{t,x^{\prime}}||\partial_{x}^{2}Z_{r ^{t,x}|dr\right) ^{p}|\mathcal{F}_{t}\right] \\ & \leq C_{p}(\tfrac{\kappa}{\epsilon})^{p}\Big(E_{P^{\ast}}\Big[\big(\int _{t}^{1}|Z_{r}^{t,x}-Z_{r}^{t,x^{\prime}}|^{2}|dr\big)^{p}|\mathcal{F _{t}\Big]\Big)^{\frac{1}{2}}\Big(E_{P^{\ast}}\Big[\big(\int_{t}^{1 |\partial_{x}^{2}Z_{r}^{t,x}|^{2}dr\big)^{p}|\mathcal{F}_{t}\Big]\Big)^{\frac {1}{2}}\\ & \leq C_{3,p}|x-x^{\prime}|^{p}, \end{align*} }{\normalsize where $C_{3,p}$ is a constant depend on $\kappa,\epsilon ,p,\Vert\varphi^{\prime}\Vert$ and $\Vert\varphi^{\prime\prime}\Vert$. Therefore,}{\small \begin{align*} & E_{P^{\ast}}\left[ \sup_{s\in\lbrack t,1]}|\partial_{x}^{2}Y_{s ^{t,x}-\partial_{x}^{2}Y_{s}^{t,x^{\prime}}|^{p}|\mathcal{F}_{t}\right] +E_{P^{\ast}}\left[ \left( \int_{t}^{1}|\partial_{x}^{2}Z_{r}^{t,x -\partial_{x}^{2}Z_{r}^{t,x^{\prime}}|^{2}dr\right) ^{\frac{p}{2 }|\mathcal{F}_{t}\right] \\ \leq & (C_{1,p}+C_{2,p}+C_{3,p})|x-x^{\prime}|^{p \end{align*} }{\normalsize Thus we obtain Claims (1) and (2). } {\normalsize \noindent(3): Follows from Peng's dynamic programming principle \cite[Theorem 3.2]{peng1992}. } {\normalsize \noindent(4): It is a direct consequence of \cite[Theorem 3.1]{CE}. \hfill\hfill$\blacksquare$ } {\normalsize \medskip} {\normalsize The following lemma is adapted from \cite[Proposition 2.3 {BCHMP}. } \begin{lemma} {\normalsize \label{lemma6} Suppose that $(b_{t})$ and $(\sigma_{t})$ are two continuous, bounded $\mathcal{F}_{t}$-adapted processes and that $(X_{t})$ is of the form \[ X_{t}=x+\int_{0}^{t}b_{s}ds+\int_{0}^{t}\sigma_{s}dB_{s},\quad x\in \mathbb{R}. \] Then \[ \lim_{n\rightarrow\infty}n\sup_{x\in\mathbb{R}}\left\vert \mathbb{E _{g_{\epsilon}}\left[ X_{\frac{1}{n}}\right] -x-\frac{1}{n}g_{\epsilon }(\sigma_{0})-\frac{1}{n}b_{0}\right\vert =0. \] } \end{lemma} {\normalsize The next lemma is an immediate consequence. } \begin{lemma} {\normalsize \label{lemma-gexpectation} For any $\varphi\in C_{b ^{2}(\mathbb{R})$, \begin{equation} \lim_{n\rightarrow\infty}n\sup_{x\in\mathbb{R}}\left\vert \mathbb{E _{g_{\epsilon}}\left[ \varphi\left( x+B_{\frac{1}{n}}\right) \right] -\varphi(x)-\frac{1}{n}g_{\epsilon}(\varphi^{\prime}(x))-\frac{1}{2n \varphi^{\prime\prime}(x)\right\vert =0. \label{g-exc \end{equation} } \end{lemma} {\normalsize \noindent\textbf{Proof:} Let $X_{s}\equiv\varphi(x+B_{s})$. By Ito's formula, \[ X_{t}=\varphi(x)+\frac{1}{2}\int_{0}^{t}\varphi^{\prime\prime}(x+B_{s )ds+\int_{0}^{t}\varphi^{\prime}(x+B_{s})dB_{s} . \] } {\normalsize \noindent Apply Lemma \ref{lemma6} to complete the proof. \hfill\hfill$\blacksquare$ } {\normalsize \smallskip} \begin{lemma} {\normalsize \label{lemma-taylor} Let $g_{0}$ be defined by (\ref{g0}). For any $\varphi\in C_{b}^{3}(\mathbb{R})$, let $\{H_{m,n}\}_{m=0}^{n}$ be the functions defined in (\ref{BSDEep-1}). Define functions $\{L_{m,n}\}_{m=0 ^{n}$ by \begin{equation} L_{m,n}(x)=H_{m,n}(x)+\frac{1}{n}g_{0}(H_{m,n}^{\prime}(x))+\frac{1 {2n}H_{m,n}^{\prime\prime}(x). \label{eq-1 \end{equation} \noindent Let $\{T_{m,n}\}_{m,n\geq0}$ be an array of r.v.s satisfyin \[ T_{0,n}=0\text{, and }T_{m,n}\in{\mathcal{H}}\text{ is }\mathcal{G _{m}\text{-measurable for all }m\geq1,\ n\geq1\text{, \] and,{ for any $Q\in\mathcal{P}$,} set $Y_{m}^{Q}=\frac{1}{\sigma}(X_{m -E_{Q}[X_{m}|\mathcal{G}_{m-1}])$. Then{\small \begin{equation} \lim_{n\rightarrow\infty}\sum_{m=1}^{n}\left\vert \sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac {Y_{m}^{Q}}{\sqrt{n}}\right) \right] -\sup\limits_{Q\in\mathcal{P} E_{Q}\left[ L_{m,n}(T_{m-1,n})\right] \right\vert =0. \label{Equa \end{equation} }} \end{lemma} \begin{remark} {\normalsize \label{remark-CLT2}In Theorem \ref{thm-CLT2}, the sample average term is absent, and accordingly its proof involves a counterpart of this lemma where the term $\frac{X_{m}}{n}$ is deleted above. Then the proof of (\ref{Equa}), so modified, simplifies, in particular, rectangularity is no longer needed and the generators $g_{\epsilon}$ in (\ref{BSDEep}) and $g_{0}$ in (\ref{eq-1}) can be set equal to $0$. ({Appendix \ref{app-CLT2} provides some details.) } } \end{remark} {\normalsize \noindent\textbf{Proof:} We proceed in two steps. } {\normalsize \smallskip} {\normalsize \noindent\textbf{Step 1:} We first give a remainder estimate that will also be used later in the proof of Lemma \ref{lemma-taylor2}. Let $\{\theta_{m}\}_{m\geq1}$ be a sequence of $\mathcal{G}_{m-1}$-measurable random variables satisfying \[ |\theta_{m}|\leq\kappa,\;\text{for}\ m\geq1. \] We prove tha \begin{align} \lim_{n\rightarrow\infty}\sum_{m=1}^{n} & \left\vert \sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m,n}(T_{m-1,n}+\frac{X_{m}}{n}+\frac{X_{m -\theta_{m}}{\sigma\sqrt{n}})\right] \right. \nonumber\\ & \qquad\qquad\qquad\qquad\qquad\qquad-\sup\limits_{Q\in\mathcal{P} E_{Q}\left[ F(\theta_{m},m,n)\right] \bigg\vert=0, \label{remainder-esti \end{align} where $F(\theta_{m},m,n)\equiv${\footnotesize \begin{equation} H_{m,n}(T_{m-1,n})+H_{m,n}^{\prime}(T_{m-1,n})\left( \frac{X_{m}}{n +\frac{X_{m}-\theta_{m}}{\sigma\sqrt{n}}\right) +\frac{1}{2}H_{m,n ^{\prime\prime}(T_{m-1,n})\left( \frac{X_{m}-\theta_{m}}{\sigma\sqrt{n }\right) ^{2}. \label{F \end{equation} } By Lemma \ref{lemma-ddp}, $\exists C>0$ such that (for all $m$ and $n$), \[ \sup\limits_{m\leq n}\sup\limits_{x\in\mathbb{R}}|H_{m,n}^{\prime\prime }(x)|\leq C\quad\text{ and }\quad{\sup\limits_{m\leq n}\sup\limits_{x,y\in \mathbb{R},x\neq y}\frac{|H_{m,n}^{\prime\prime}(x)-H_{m,n}^{\prime\prime }(y)|}{|x-y|}\leq C. \] } {\normalsize By the Taylor expansion of {$H_{m,n}\in C_{b}^{2}(\mathbb{R})$}, $\forall$$\overline{\epsilon}>0$, $\exists$$\delta>0$ ($\delta$ depends only on $C$ and $\overline{\epsilon}$), such that $\forall$$x,y\in\mathbb{R}$, and all $n\geq m\geq1$, {\small \begin{equation} \left\vert H_{m,n}(x+y)-H_{m,n}(x)-H_{m,n}^{\prime}(x)y-\frac{1}{2 H_{m,n}^{\prime\prime}(x)y^{2}\right\vert \leq\overline{\epsilon |y|^{2}I_{\{|y|<\delta\}}+{C}|y|^{2}I_{\{|y|\geq\delta\}}.\label{le0 \end{equation} }Let $x=T_{m-1,n}$ and $y=\frac{X_{m}}{n}+\frac{X_{m}-\theta_{m}}{\sigma \sqrt{n}}$ in (\ref{le0}), and obtain{\small \begin{align*} & \sum_{m=1}^{n}\left\vert \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{X_{m}-\theta_{m}}{\sigma \sqrt{n}}\right) \right] -\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ F(\theta_{m},m,n)\right] \right\vert \\ \leq & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{X_{m}-\theta_{m}}{\sigma \sqrt{n}}\right) -F(\theta_{m},m,n)\right\vert \right] \\ \leq & R_{1}(\overline{\epsilon},n)+R_{2}(C,n)+R_{3}(C,n)\text{, \ \ where \end{align*} \begin{align*} R_{1}(\overline{\epsilon},n) & :=\overline{\epsilon}\sum\limits_{m=1}^{n \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert \tfrac{X_{m}}{n +\tfrac{X_{m}-\theta_{m}}{\sigma\sqrt{n}}\right\vert ^{2}I_{\left\{ |\frac{X_{m}}{n}+\frac{X_{m}-\theta_{m}}{\sigma\sqrt{n}}|<\delta\right\} }\right] ,\\ R_{2}(C,n) & :={C}\sum\limits_{m=1}^{n}\sup\limits_{Q\in\mathcal{P} E_{Q}\left[ \left\vert \tfrac{X_{m}}{n}+\tfrac{X_{m}-\theta_{m}}{\sigma \sqrt{n}}\right\vert ^{2}I_{\left\{ |\frac{X_{m}}{n}+\frac{X_{m}-\theta_{m }{\sigma\sqrt{n}}|\geq\delta\right\} }\right] ,\\ R_{3}(C,n) & :=\frac{C}{2}\sum\limits_{m=1}^{n}\sup\limits_{Q\in\mathcal{P }E_{Q}\left[ \left\vert \tfrac{X_{m}}{n}\right\vert ^{2}+2\left\vert \tfrac{X_{m}}{n}\right\vert \left\vert \tfrac{X_{m}-\theta_{m}}{\sigma\sqrt {n}}\right\vert \right] . \end{align*} It is readily proven that, for sufficiently large $n$ \begin{align*} R_{1}(\overline{\epsilon},n)\leq & \frac{2\overline{\epsilon}}{n^{2} \sum\limits_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert X_{m}\right\vert ^{2}\right] +\frac{2\overline{\epsilon}}{n}\sum \limits_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert \tfrac{X_{m}-\theta_{m}}{\sigma}\right\vert ^{2}\right] \\ \leq & \frac{4\overline{\epsilon}}{n}\left( \sigma^{2}+\kappa^{2}\right) +\frac{4\overline{\epsilon}}{\sigma^{2}}\left( \sigma^{2}+4\kappa^{2}\right) ,\\ R_{2}(C,n)\leq & 2C\left( \frac{1}{n}+\frac{1}{\sigma\sqrt{n}}\right) ^{2}\sum\limits_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert X_{m}\right\vert ^{2}I_{\left\{ |\frac{X_{m}}{n}+\frac{X_{m}-\theta_{m }{\sigma\sqrt{n}}|\geq\delta\right\} }\right] \\ & +\frac{2C}{\sigma^{2}n}\sum\limits_{m=1}^{n}\sup\limits_{Q\in\mathcal{P }E_{Q}\left[ \left\vert \theta_{m}\right\vert ^{2}I_{\left\{ |\frac{X_{m }{n}+\frac{X_{m}-\theta_{m}}{\sigma\sqrt{n}}|\geq\delta\right\} }\right] \\ \leq & \frac{2C}{\sigma^{2}}\frac{(\sigma+\sqrt{n})^{2}}{n^{2} \sum\limits_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert X_{m}\right\vert ^{2}I_{\left\{ |X_{m}|>\frac{\sigma n}{\sigma+\sqrt{n }\delta-\kappa\right\} }\right] \\ & +\frac{2C}{\sigma^{2}n}\frac{\kappa^{2}}{\delta^{2}}\sum\limits_{m=1 ^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert \tfrac{X_{m} {n}+\tfrac{X_{m}-\theta_{m}}{\sigma\sqrt{n}}\right\vert ^{2}\right] ,\\ R_{3}(C,n)\leq & \frac{C}{2n^{2}}\sum\limits_{m=1}^{n}\sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ \left\vert X_{m}\right\vert ^{2}\right] +\frac {C}{n^{3/2}\sigma}\sum\limits_{m=1}^{n}\sup\limits_{Q\in\mathcal{P} E_{Q}\left[ \left\vert X_{m}\right\vert \left\vert X_{m}-\theta _{m}\right\vert \right] \\ \leq & \left( \frac{C}{n}+\frac{2C}{\sqrt{n}\sigma}\right) \left( \sigma^{2}+\kappa^{2}\right) +\frac{2C\kappa}{\sqrt{n}\sigma}\sqrt{\sigma ^{2}+\kappa^{2}}\text{. \end{align*} By the finiteness of $\kappa,\sigma$ and the Lindeberg condition (\ref{linder}) \[ \lim\limits_{\overline{\epsilon}\rightarrow0}\lim\limits_{n\rightarrow\infty }\left( R_{1}(\overline{\epsilon},n)+R_{2}(C,n)+R_{3}(C,n)\right) =0\text{, \] which proves (\ref{remainder-esti}). } {\normalsize \medskip} {\normalsize \noindent\textbf{Step 2}: To prove (\ref{Equa}), it suffices to prove that if we take $\theta_{m}$$=E_{Q}[X_{m}|\mathcal{G}_{m-1}]$ in (\ref{F}), the \[ \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ F(\theta_{m},m,n)\right] =\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}(T_{m-1,n})\right] ,\;\forall n\geq m\geq1. \] In fact, if $\theta_{m}=$$E_{Q}[X_{m}|\mathcal{G}_{m-1}]$, then by a generalization of Lemma \ref{lemma-rect}(iii) (in the proof of Theorem \ref{thm-CLT}, we shall take $T_{m-1,n}=\frac{S_{m-1}}{n}+\frac{S_{m-1}^{Q }{\sqrt{n}}$, in which case part (iv) of Lemma \ref{lemma-rect} suffices), \begin{align*} & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ F(\theta_{m},m,n)\right] \\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}(T_{m-1,n )+H_{m,n}^{\prime}(T_{m-1,n})\left( \frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt {n}}\right) \right. \\ & \left. \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad +\frac{1}{2}H_{m,n}^{\prime\prime}(T_{m-1,n})\left( \frac{Y_{m}^{Q}}{\sqrt {n}}\right) ^{2}\right] \\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}(T_{m-1,n )+H_{m,n}^{\prime}(T_{m-1,n})E_{Q}\left[ \left( \frac{X_{m}}{n}+\frac {Y_{m}^{Q}}{\sqrt{n}}\right) |\mathcal{G}_{m-1}\right] \right. \\ & \left. \qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad+\frac{1}{2n H_{m,n}^{\prime\prime}(T_{m-1,n})E_{Q}\left[ \left( Y_{m}^{Q}\right) ^{2}|\mathcal{G}_{m-1}\right] \right] \\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}(T_{m-1,n})+\frac{1 {n}H_{m,n}^{\prime}(T_{m-1,n})X_{m}+\frac{1}{2n}H_{m,n}^{\prime\prime }(T_{m-1,n})\right] \\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}(T_{m-1,n})+\frac{1 {n}\;\mathbb{E}[H_{m,n}^{\prime}(T_{m-1,n})X_{m}|\mathcal{G}_{m-1}]+\frac {1}{2n}H_{m,n}^{\prime\prime}(T_{m-1,n})\right] \\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}(T_{m-1,n})+\frac{1 {n}g_{0}\left( H_{m,n}^{\prime}(T_{m-1,n})\right) +\frac{1}{2n H_{m,n}^{\prime\prime}(T_{m-1,n})\right] \\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}(T_{m-1,n})\right] . \end{align*} Combine with (\ref{remainder-esti}) to complete the proof. \hfill \hfill$\blacksquare$ } {\normalsize \medskip} {\normalsize The next three lemmas consider the special implications of symmetry and thus relate to the proof of Theorem \ref{thm-special}. } \begin{lemma} [\cite{chenBSDE}]{\normalsize \label{lemma-sym0} Let $\varphi\in C_{b ^{3}(\mathbb{R})$ be symmetric with {center $c\in\mathbb{R}$}, and $v(t,x)$ be the unique solution of Cauchy's problem for the parabolic equation \begin{equation} \left\{ \begin{array} [c]{rl \partial_{t}v(t,x) & =~\tfrac{1}{2}\partial_{xx}^{2}v(t,x)+g_{\epsilon }(\partial_{x}v(t,x))\\ v(0,x) & =~\varphi(x). \end{array} \right. \label{pde \end{equation} } \begin{description} \item {\normalsize (1) For any $t\geq0$, $v(t,\cdot)$ is symmetric with center $c$. } \item {\normalsize (2) If $sgn(\varphi^{\prime}(x))=-sgn(x-c)$, then, for any $t\geq0$, \[ sgn\left( \partial_{x}v(t,x)\right) =-sgn(x-c)\text{. \] } \item {\normalsize (3) If $sgn(\varphi^{\prime}(x))=sgn(x-c)$, then, for any $t\geq0$, \[ sgn\left( \partial_{x}v(t,x)\right) =sgn(x-c)\text{. \] } \end{description} \end{lemma} {\normalsize } \begin{lemma} {\normalsize \label{lemma-sym} Let $\varphi\in C_{b}^{3}$$(\mathbb{R})$ be symmetric with {center $c\in\mathbb{R}$}. Then the functions $\{H_{m,n \}_{m=0}^{n}$ defined in (\ref{BSDEep-1}) satisfy, for any $n$ and $m=0,\cdots,n$: } \begin{description} \item {\normalsize (1) $H_{m,n}$ is symmetric with center $c$. } \item {\normalsize (2) If $sgn(\varphi^{\prime}(x))=-sgn(x-c)$, then \[ sgn(H_{m,n}^{\prime}(x))=-sgn(x-c),\quad\text{and}\quad H_{m,n}^{\prime\prime }(c)\leq0. \] } \item {\normalsize (3) If $sgn(\varphi^{\prime}(x))=sgn(x-c)$, then \[ sgn(H_{m,n}^{\prime}(x))=sgn(x-c),\quad\text{and}\quad H_{m,n}^{\prime\prime }(c)\geq0. \] } \end{description} \end{lemma} {\normalsize \noindent\textbf{Proof:} By the definition of $H_{m,n}(x)$ via (\ref{BSDEep-1}) and the nonlinear Feynman-Kac formula, we know that $H_{m,n}(x)=v(1-\tfrac{m}{n},x)$, where $v(t,x)$ is the solution of equation (\ref{pde}). Then (1)-(3) follows from Lemma \ref{lemma-sym0}. \hfill \hfill$\blacksquare$} \begin{lemma} {\normalsize \label{lemma-taylor2} Adopt the assumptions and notation in (\ref{mumn}), (\ref{tmumn}) and Lemma \ref{lemma-taylor}, and let $\varphi\in C_{b}^{3}$$(\mathbb{R})$ be symmetric with {center $c\in\mathbb{R}$}. } \begin{description} \item {\normalsize (1) If $sgn(\varphi^{\prime}(x))=-sgn(x-c)$, and if $Y_{m}^{Q}$ in (\ref{Equa}) is replaced by $Z_{m}^{n}$, where \[ Z_{m}^{n}=\frac{1}{\sigma}(X_{m}-\mu_{m}^{n}),\;\mu_{m}^{n}=\kappa I_{A_{m-1,n}}-\kappa I_{A_{m-1,n}^{c}},\;A_{m-1,n}=\{T_{m-1,n}\leq c\}, \] then \begin{align} \lim_{n\rightarrow\infty}\sum_{m=1}^{n} & \left\vert \sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac {Z_{m}^{n}}{\sqrt{n}}\right) \right] \right. \nonumber\\ & \qquad\qquad\qquad\qquad\left. -\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}\left( T_{m-1,n}\right) \right] \right\vert =0. \label{sym-ty-eq \end{align} } \item {\normalsize (2) If $sgn(\varphi^{\prime}(x))=sgn(x-c)$, and if $Y_{m}^{Q}$ in (\ref{Equa}) is replaced by $\widetilde{Z}_{m}^{n}$, where{ \[ \widetilde{Z}_{m}^{n}=\frac{1}{\sigma}(X_{m}-\widetilde{\mu}_{m ^{n}),\;\widetilde{\mu}_{m}^{n}=\kappa I_{\widetilde{A}_{m-1,n}}-\kappa I_{\widetilde{A}_{m-1,n}^{c}},\widetilde{A}_{m-1,n}=\{T_{m-1,n}\geq c\}\text{, \] } the \begin{align} \liminf_{n\rightarrow\infty}\sum_{m=1}^{n} & \left\{ \sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n +\frac{\widetilde{Z}_{m}^{n}}{\sqrt{n}}\right) \right] \right. \nonumber\\ & \qquad\qquad\qquad\qquad-\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}\left( T_{m-1,n}\right) \right] \Bigg\}\geq0. \label{sym-ty-eq2-1 \end{align} Furthermore, if \begin{equation} \lim_{\overline{\delta}\rightarrow0}\limsup_{n\rightarrow\infty}\frac{1 {n}\sum_{m=1}^{n}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert E_{Q [X_{m}|\mathcal{G}_{m-1}]-\widetilde{\mu}_{m}^{n}\right\vert I_{\{|T_{m-1,n -c|\leq\overline{\delta}\}}\right] =0, \label{lemma-condition-1 \end{equation} the \begin{align} \lim_{n\rightarrow\infty}\sum_{m=1}^{n} & \left\vert \sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n +\frac{\widetilde{Z}_{m}^{n}}{\sqrt{n}}\right) \right] \right. \nonumber\\ & \qquad\qquad\qquad\qquad\quad-\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}\left( T_{m-1,n}\right) \right] \Bigg\vert=0. \label{sym-ty-eq2-2 \end{align} } \end{description} \end{lemma} \begin{remark} {\normalsize The lemma is valid also if $c=\pm\infty$. Taking $c=+\infty$ in (1) means that $\varphi$ is increasing on $\mathbb{R}$. Then $A_{m-1,n =\Omega$ and $\mu_{m}^{n}=\kappa$ for any $1\leq m\leq n$. If $c=-\infty$ in (1), then $\varphi$ is decreasing on $\mathbb{R}$, $A_{m-1,n}=\varnothing$ and $\mu_{m}^{n}=-\kappa$. Similarly for (2). } \end{remark} {\normalsize \noindent\textbf{Proof of (1):} We proceed in two steps. } {\normalsize \noindent\textbf{Step 1}: Firstly, we prove \begin{align} \limsup_{n\rightarrow\infty}\sum_{m=1}^{n} & \left\{ \sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac {Z_{m}^{n}}{\sqrt{n}}\right) \right] \right. \nonumber\\ & \qquad\qquad\qquad\qquad\quad-\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}\left( T_{m-1,n}\right) \right] \bigg\}\leq0.\label{symproofstep1 \end{align} By Lemma \ref{lemma-taylor}, we only need to prove the non-positivity of \begin{align*} \limsup_{n\rightarrow\infty}\sum_{m=1}^{n} & \left\{ \sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac {Z_{m}^{n}}{\sqrt{n}}\right) \right] \right. \\ & \left. \quad-\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n}}\right) \right] \right\} . \end{align*} {For any $\overline{\delta}>0$,} we set \[ D_{m-1,n}^{\overline{\delta},1}=\{T_{m-1,n}>c+\overline{\delta}\},\ D_{m-1,n ^{\overline{\delta},2}=\{T_{m-1,n}<c-\overline{\delta}\}\text{, \ \[ D_{m-1,n}^{\overline{\delta},3}=\{|T_{m-1,n}-c|\leq\overline{\delta }\},\ N_{m,n}^{\overline{\delta}}=\left\{ \left\vert X_{m}\right\vert \leq\tfrac{\sigma n}{\sigma+\sqrt{n}}\overline{\delta}-\kappa\right\} . \] For any $\omega\in D_{m-1,n}^{\overline{\delta},1}\cap N_{m,n}^{\overline {\delta}}$, we have \begin{align*} c & <\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{X_{m}-E_{Q}[X_{m}|\mathcal{G _{m-1}]}{\sqrt{n}\sigma}\right) (\omega)\\ & \leq\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{X_{m}+\kappa}{\sqrt{n}\sigma }\right) (\omega). \end{align*} By Lemma \ref{lemma-sym}, $H_{m,n}$ is decreasing on $(c,+\infty)$. Thu \begin{align*} & I_{D_{m-1,n}^{\overline{\delta},1}\cap N_{m,n}^{\overline{\delta}} H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n}}\right) \\ \geq & I_{D_{m-1,n}^{\overline{\delta},1}\cap N_{m,n}^{\overline{\delta} }H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Z_{m}^{n}}{\sqrt{n}}\right) . \end{align*} Also, for any $\omega\in D_{m-1,n}^{\overline{\delta},2}\cap N_{m,n ^{\overline{\delta}}$ \begin{align*} c & >\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{X_{m}-E_{Q}[X_{m}|\mathcal{G _{m-1}]}{\sqrt{n}\sigma}\right) (\omega)\\ & \geq\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{X_{m}-\kappa}{\sqrt{n}\sigma }\right) (\omega)\text{. \end{align*} By Lemma \ref{lemma-sym}, $H_{m,n}$ is increasing on $(-\infty,c)$. Thus \begin{align*} & I_{D_{m-1,n}^{\overline{\delta},2}\cap N_{m,n}^{\overline{\delta}} H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n}}\right) \\ \geq & I_{D_{m-1,n}^{\overline{\delta},2}\cap N_{m,n}^{\overline{\delta} }H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Z_{m}^{n}}{\sqrt{n}}\right) \text{. \end{align*} For $F(\theta_{m},m,n)$ defined in (\ref{F}), we have \begin{align*} & H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Z_{m}^{n}}{\sqrt{n}}\right) -H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n}}\right) \\ = & F(\mu_{m}^{n},m,n)-F\left( E_{Q}[X_{m}|\mathcal{G}_{m-1}],m,n\right) \\ & +H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Z_{m}^{n}}{\sqrt{n }\right) -F(\mu_{m}^{n},m,n)\\ & -\left( H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt {n}}\right) -F\left( E_{Q}[X_{m}|\mathcal{G}_{m-1}],m,n\right) \right) . \end{align*} Therefore,{\small \begin{align*} & \sum_{m=1}^{n}\left\{ \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Z_{m}^{n}}{\sqrt{n}}\right) \right] \right. \\ & \left. \qquad\qquad\qquad\qquad\qquad\qquad\qquad-\sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac {Y_{m}^{Q}}{\sqrt{n}}\right) \right] \right\} \\ \leq & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Z_{m}^{n}}{\sqrt{n}}\right) -H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n}}\right) \right] \\ \leq & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ I_{D_{m-1,n ^{\overline{\delta},3}}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n +\frac{Z_{m}^{n}}{\sqrt{n}}\right) \right. \right. \\ & \left. \left. \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad-H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n }\right) \right] \right] \\ & +\sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ I_{\{\left\vert X_{m}\right\vert >\tfrac{\sigma n}{\sigma+\sqrt{n}}\overline{\delta}-\kappa \}}\left\vert H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Z_{m}^{n} {\sqrt{n}}\right) \right. \right. \\ & \left. \left. \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \qquad-H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n }\right) \right\vert \right] \\ \leq & I_{n}^{1}+I_{n}^{2}+I_{n}^{3}, \end{align*} } where $I_{n}^{1},I_{n}^{2},I_{n}^{3}$ are defined by{\small \begin{align*} I_{n}^{1}\equiv & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ I_{D_{m-1,n}^{\overline{\delta},3}}\left( F(\mu_{m}^{n},m,n)-F\left( E_{Q}[X_{m}|\mathcal{G}_{m-1}],m,n\right) \right) \right] ,\\ I_{n}^{2}\equiv & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ 2\Vert\varphi\Vert I_{\{\left\vert X_{m}\right\vert >\tfrac{\sigma n {\sigma+\sqrt{n}}\overline{\delta}-\kappa\}}\right] \qquad(\text{ where }\Vert\varphi\Vert=\sup_{x\in\mathbb{R}}\varphi(x)),\\ I_{n}^{3}\equiv & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Z_{m}^{n}}{\sqrt{n }\right) -F(\mu_{m}^{n},m,n)\right\vert \right] \\ & +\sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n}}\right) -F\left( E_{Q}[X_{m}|\mathcal{G}_{m-1}],m,n\right) \right\vert \right] . \end{align*} }{{\small By the Lindeberg condition (\ref{linder}), $\lim \limits_{n\rightarrow\infty}I_{n}^{2}=0$, and by the remainder estimate in the proof of Lemma \ref{lemma-taylor}, $\lim\limits_{n\rightarrow\infty}I_{n ^{3}=0$. Thus it suffices to show that $\lim\limits_{n\rightarrow\infty I_{n}^{1}=0$, which is proven as follows. }}} {\normalsize {From Lemma \ref{lemma-sym}(2), $H_{m,n}^{\prime\prime}(c)\leq0$. Therefore,{\small \begin{align*} I_{n}^{1}= & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ I_{D_{m-1,n}^{\overline{\delta},3}}\left( F(\mu_{m}^{n},m,n)-F\left( E_{Q}[X_{m}|\mathcal{G}_{m-1}],m,n\right) \right) \right] \\ \leq & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ I_{D_{m-1,n ^{\overline{\delta},3}}H_{m,n}^{\prime\prime}(T_{m-1,n})\frac{(E_{Q [X_{m}|\mathcal{G}_{m-1}]-\mu_{m}^{n})^{2}}{2n\sigma^{2}}\right] \\ \leq & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ I_{D_{m-1,n ^{\overline{\delta},3}}\left( H_{m,n}^{\prime\prime}(T_{m-1,n})-H_{m,n ^{\prime\prime}(c))\right) \frac{(E_{Q}[X_{m}|\mathcal{G}_{m-1}]-\mu_{m ^{n})^{2}}{2n\sigma^{2}}\right] \\ & +\sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ I_{D_{m-1,n ^{\overline{\delta},3}}H_{m,n}^{\prime\prime}(c)\frac{(E_{Q}[X_{m |\mathcal{G}_{m-1}]-\mu_{m}^{n})^{2}}{2n\sigma^{2}}\right] \\ \leq & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ I_{D_{m-1,n ^{\overline{\delta},3}}L|T_{m-1,n}-c|\frac{(E_{Q}[X_{m}|\mathcal{G}_{m-1 ]-\mu_{m}^{n})^{2}}{2n\sigma^{2}}\right] \leq\frac{L2\kappa^{2}}{\sigma^{2 }\overline{\delta}, \end{align*} }}}where $L$ is the uniform Lipschitz constant for $H_{m,n}^{\prime\prime}$ given in Lemma \ref{lemma-ddp}. {\normalsize } {\normalsize \medskip\smallskip\ } {\normalsize \noindent\textbf{Step 2}: Next we prove \begin{align} \liminf_{n\rightarrow\infty}\sum_{m=1}^{n} & \left\{ \sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac {Z_{m}^{n}}{\sqrt{n}}\right) \right] \right. \nonumber\\ & \qquad\qquad\qquad\qquad-\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}\left( T_{m-1,n}\right) \right] \bigg\} \geq0. \label{symproofstep2 \end{align} } {\normalsize By the remainder estimate in the proof of Lemma \ref{lemma-taylor}, it suffices to take $\theta_{m}=\mu_{m}^{n}$ in (\ref{F}) and to show that \[ \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ F(\theta_{m},m,n)\right] \geq \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}\left( T_{m-1,n}\right) \right] ,\quad n\geq m\geq1. \] } {\normalsize } {\normalsize \noindent By Lemma \ref{Lem_increasing_seq}, there exist $\{Q_{k}\}_{k\geq1},\{\overline{P}_{j}^{m}\}_{j\geq1},\{\underline{P}_{j ^{m}\}_{j\geq1}\subset$$\mathcal{P}$ such that \begin{align*} \lim_{j\rightarrow\infty}E_{\overline{P}_{j}^{m}}[X_{m}|\mathcal{G _{m-1}]=\kappa,\ \lim_{j\rightarrow\infty}E_{\underline{P}_{j}^{m} [X_{m}|\mathcal{G}_{m-1}]=-\kappa, \end{align*} and \begin{align*} & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}(T_{m-1,n})+\frac{1 {n}g_{0}\left( H_{m,n}^{\prime}(T_{m-1,n})\right) +\frac{1}{2n H_{m,n}^{\prime\prime}(T_{m-1,n})\right] \\ = & \lim_{k\rightarrow\infty}E_{Q_{k}}\left[ H_{m,n}(T_{m-1,n})+\frac{1 {n}g_{0}\left( H_{m,n}^{\prime}(T_{m-1,n})\right) +\frac{1}{2n H_{m,n}^{\prime\prime}(T_{m-1,n})\right] . \end{align*} By Lemma \ref{lemma-rect}(ii), there exist $\{R_{j}^{m}\}_{j\geq1}$$\subset $$\mathcal{P}$ satisfying \[ E_{R_{j}^{m}}[X_{m}|\mathcal{G}_{m-1}]=I_{A_{m-1,n}}E_{\overline{P}_{j}^{m }[X_{m}|\mathcal{G}_{m-1}]+I_{A_{m-1,n}^{c}}E_{\underline{P}_{j}^{m} [X_{m}|\mathcal{G}_{m-1}]. \] By Lemma \ref{lemma-rect}(iii) and the dominated convergence theorem \begin{align*} & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}(T_{m-1,n})\right] \\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}(T_{m-1,n})+\frac{1 {n}g_{0}\left( H_{m,n}^{\prime}(T_{m-1,n})\right) +\frac{1}{2n H_{m,n}^{\prime\prime}(T_{m-1,n})\right] \\ = & \lim_{k\rightarrow\infty}E_{Q_{k}}\left[ H_{m,n}(T_{m-1,n})+\frac{1 {n}g_{0}\left( H_{m,n}^{\prime}(T_{m-1,n})\right) +\frac{1}{2n H_{m,n}^{\prime\prime}(T_{m-1,n})\right] \\ = & \lim_{k\rightarrow\infty}E_{Q_{k}}\left[ H_{m,n}(T_{m-1,n )+I_{A_{m-1,n}}H_{m,n}^{\prime}(T_{m-1,n})\frac{\kappa}{n}\right. \\ & \qquad\qquad\qquad\qquad\qquad\left. +I_{A_{m-1,n}^{c}}H_{m,n}^{\prime }(T_{m-1,n})\frac{-\kappa}{n}+\frac{1}{2n}H_{m,n}^{\prime\prime (T_{m-1,n})\right] \\ = & \lim_{k\rightarrow\infty}E_{Q_{k}}\Bigg[H_{m,n}(T_{m-1,n})\\ & \qquad\qquad\quad+\lim_{j\rightarrow\infty}E_{\overline{P}_{j}^{m}}\left[ I_{A_{m-1,n}} H_{m,n}^{\prime}(T_{m-1,n})\left( \frac{X_{m}}{n}+\frac {X_{m}-\kappa}{\sigma\sqrt{n}}\right) |\mathcal{G}_{m-1}\right] \\ & \qquad\qquad\quad+\lim_{j\rightarrow\infty}E_{\overline{P}_{j}^{m}}\left[ I_{A_{m-1,n}} H_{m,n}^{\prime\prime}(T_{m-1,n})\frac{(X_{m}-\kappa)^{2 }{2n\sigma^{2}} |\mathcal{G}_{m-1}\right] \\ & \qquad\qquad\quad+\lim_{j\rightarrow\infty}E_{\underline{P}_{j}^{m}}\left[ I_{A_{m-1,n}^{c}} H_{m,n}^{\prime}(T_{m-1,n})\left( \frac{X_{m}}{n +\frac{X_{m}+\kappa}{\sigma\sqrt{n}}\right) |\mathcal{G}_{m-1}\right] \\ & \qquad\qquad\quad+\lim_{j\rightarrow\infty}E_{\underline{P}_{j}^{m}}\left[ I_{A_{m-1,n}^{c}} H_{m,n}^{\prime\prime}(T_{m-1,n})\frac{(X_{m}+\kappa)^{2 }{2n\sigma^{2}} |\mathcal{G}_{m-1}\right] \Bigg]\\ = & \lim_{k\rightarrow\infty}\lim_{j\rightarrow\infty}E_{Q_{k}}\left[ H_{m,n}(T_{m-1,n})+E_{R_{j}^{m}}\left[ H_{m,n}^{\prime}(T_{m-1,n})\left( \frac{X_{m}}{n}+\frac{Z_{m}^{n}}{\sqrt{n}}\right) \right. \right. \\ & \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad\left. \left. +\frac{1}{2n}H_{m,n}^{\prime\prime}(T_{m-1,n})(Z_{m}^{n})^{2}|\mathcal{G _{m-1}\right] \right] \\ \leq & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}(T_{m-1,n )+ess\sup_{R\in\mathcal{P}}E_{R}\left[ H_{m,n}^{\prime}(T_{m-1,n})\left( \frac{X_{m}}{n}+\frac{Z_{m}^{n}}{\sqrt{n}}\right) \right. \right. \\ & \left. \left. \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad +\frac{1}{2n}H_{m,n}^{\prime\prime}(T_{m-1,n})(Z_{m}^{n})^{2}|\mathcal{G _{m-1}\right] \right] \\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}(T_{m-1,n )+H_{m,n}^{\prime}(T_{m-1,n})\left( \frac{X_{m}}{n}+\frac{Z_{m}^{n}}{\sqrt {n}}\right) \right. \\ & \left. \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad \quad+\frac{1}{2n}H_{m,n}^{\prime\prime}(T_{m-1,n})(Z_{m}^{n})^{2}\right] \text{. \end{align*} Combined with (\ref{remainder-esti}), this implies (\ref{symproofstep2}), thus completing the proof of (1). \noindent} {\normalsize \bigskip} {\normalsize \noindent\textbf{Proof of (2): }\ Proof of inequality (\ref{sym-ty-eq2-1}) is similar to that of (\ref{symproofstep2}). } {\normalsize To prove (\ref{sym-ty-eq2-2}), assuming (\ref{lemma-condition-1 ), we need only prove \begin{align} \limsup_{n\rightarrow\infty}\sum_{m=1}^{n} & \left\{ \sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n +\frac{\widetilde{Z}_{m}^{n}}{\sqrt{n}}\right) \right] \right. \nonumber\\ & \qquad\qquad\qquad\qquad\qquad-\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}\left( T_{m-1,n}\right) \right] \Bigg\} \leq0. \label{symproof-2-step0 \end{align} By assumption (\ref{lemma-condition-1}), $\forall\varepsilon>0$, $\exists\overline{\delta}_{\varepsilon}>0$ such that \[ \limsup_{n\rightarrow\infty}\frac{1}{n}\sum_{m=1}^{n}\sup_{Q\in\mathcal{P }E_{Q}\left[ \left\vert E_{Q}[X_{m}|\mathcal{G}_{m-1}]-\widetilde{\mu _{m}^{n}\right\vert I_{\{|T_{m-1,n}-c|\leq\overline{\delta}_{\varepsilon \}}\right] \leq\varepsilon\text{. \] By Lemma \ref{lemma-taylor}, we only need to prove the non-positivity of \begin{align*} \limsup_{n\rightarrow\infty}\sum_{m=1}^{n} & \left\{ \sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n +\frac{\widetilde{Z}_{m}^{n}}{\sqrt{n}}\right) \right] \right. \\ & \left. \qquad\qquad-\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n}}\right) \right] \right\} . \end{align*} } {\normalsize Defin \[ D_{m-1,n}^{\overline{\delta}_{\varepsilon},1}=\{T_{m-1,n}>c+\overline{\delta }_{\varepsilon}\},\ D_{m-1,n}^{\overline{\delta}_{\varepsilon},2 =\{T_{m-1,n}<c-\overline{\delta}_{\varepsilon}\}\text{, \ \[ D_{m-1,n}^{\overline{\delta}_{\varepsilon},3}=\{|T_{m-1,n}-c|\leq \overline{\delta}_{\varepsilon}\}\text{,}\ N_{m,n}^{\overline{\delta }_{\varepsilon}}=\left\{ \left\vert X_{m}\right\vert \leq\tfrac{\sigma n}{\sigma+\sqrt{n}}\overline{\delta}_{\varepsilon}-\kappa\right\} . \] For any $\omega\in D_{m-1,n}^{\overline{\delta}_{\varepsilon},1}\cap N_{m,n}^{\overline{\delta}_{\varepsilon}}$, \begin{align*} c & <\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{X_{m}-\kappa}{\sqrt{n}\sigma }\right) (\omega)\\ & \leq\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{X_{m}-E_{Q}[X_{m |\mathcal{G}_{m-1}]}{\sqrt{n}\sigma}\right) (\omega). \end{align*} By Lemma \ref{lemma-sym}, $H_{m,n}$ is increasing on $(c,+\infty)$. Thus \begin{align*} & I_{D_{m-1,n}^{\overline{\delta}_{\varepsilon},1}\cap N_{m,n}^{\overline {\delta}_{\varepsilon}}}H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac {Y_{m}^{Q}}{\sqrt{n}}\right) \\ \geq & I_{D_{m-1,n}^{\overline{\delta}_{\varepsilon},1}\cap N_{m,n ^{\overline{\delta}_{\varepsilon}}}H_{m,n}\left( T_{m-1,n}+\frac{X_{m} {n}+\frac{\widetilde{Z}_{m}^{n}}{\sqrt{n}}\right) . \end{align*} Also, for any $\omega\in D_{m-1,n}^{\overline{\delta}_{\varepsilon},2}\cap N_{m,n}^{\overline{\delta}_{\varepsilon}}$ \begin{align*} c & >\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{X_{m}+\kappa}{\sqrt{n}\sigma }\right) (\omega)\\ & \geq\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{X_{m}-E_{Q}[X_{m |\mathcal{G}_{m-1}]}{\sqrt{n}\sigma}\right) (\omega)\text{. \end{align*} By Lemma \ref{lemma-sym}, $H_{m,n}$ is decreasing on $(-\infty,c)$. Thus \begin{align*} & I_{D_{m-1,n}^{\overline{\delta}_{\varepsilon},2}\cap N_{m,n}^{\overline {\delta}_{\varepsilon}}}H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac {Y_{m}^{Q}}{\sqrt{n}}\right) \\ \geq & I_{D_{m-1,n}^{\overline{\delta}_{\varepsilon},2}\cap N_{m,n ^{\overline{\delta}_{\varepsilon}}}H_{m,n}\left( T_{m-1,n}+\frac{X_{m} {n}+\frac{\widetilde{Z}_{m}^{n}}{\sqrt{n}}\right) \text{. \end{align*} Therefore,{ \begin{align*} & \sum_{m=1}^{n}\left\{ \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{\widetilde{Z}_{m}^{n}}{\sqrt {n}}\right) \right] \right. \\ & \left. \qquad\qquad\qquad\qquad\qquad-\sup\limits_{Q\in\mathcal{P} E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q} {\sqrt{n}}\right) \right] \right\} \\ \leq & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{\widetilde{Z}_{m}^{n}}{\sqrt{n}}\right) \right. \\ & \qquad\qquad\qquad\qquad\qquad\qquad\qquad\ -H_{m,n}\left( T_{m-1,n +\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n}}\right) \Bigg]\\ \leq & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ I_{D_{m-1,n ^{\overline{\delta}_{\varepsilon},3}}\left[ H_{m,n}\left( T_{m-1,n +\frac{X_{m}}{n}+\frac{\widetilde{Z}_{m}^{n}}{\sqrt{n}}\right) \right. \right. \\ & \qquad\qquad\qquad\qquad\qquad\qquad\quad\quad-H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n}}\right) \bigg]\Bigg]\\ & +\sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ I_{\{\left\vert X_{m}\right\vert >\tfrac{\sigma n}{\sigma+\sqrt{n}}\overline{\delta }_{\varepsilon}-\kappa\}}\left\vert H_{m,n}\left( T_{m-1,n}+\frac{X_{m} {n}+\frac{\widetilde{Z}_{m}^{n}}{\sqrt{n}}\right) \right. \right. \\ & \qquad\qquad\qquad\qquad\qquad\qquad\qquad\ -H_{m,n}\left( T_{m-1,n +\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n}}\right) \bigg\vert\Bigg]\\ \leq & \widetilde{I}_{n}^{1}+\widetilde{I}_{n}^{2}+\widetilde{I}_{n}^{3}, \end{align*} } where $\widetilde{I}_{n}^{1},\widetilde{I}_{n}^{2},\widetilde{I}_{n}^{3}$ are defined by{\small \begin{align*} \widetilde{I}_{n}^{1}\equiv & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P }E_{Q}\left[ {I_{D_{m-1,n}^{\overline{\delta}_{\varepsilon},3}}}\left( F(\widetilde{\mu}_{m}^{n},m,n)-F\left( E_{Q}[X_{m}|\mathcal{G}_{m-1 ],m,n\right) \right) \right] ,\\ \widetilde{I}_{n}^{2}\equiv & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P }E_{Q}\left[ 2\Vert\varphi\Vert I_{\{\left\vert X_{m}\right\vert >\tfrac{\sigma n}{\sigma+\sqrt{n}}\overline{\delta}_{\varepsilon}-\kappa \}}\right] \qquad(\text{ where }\Vert\varphi\Vert=\sup_{x\in\mathbb{R }\varphi(x)),\\ \widetilde{I}_{n}^{3}\equiv & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P }E_{Q}\left[ \left\vert H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n +\frac{\widetilde{Z}_{m}^{n}}{\sqrt{n}}\right) -F(\widetilde{\mu}_{m ^{n},m,n)\right\vert \right] \\ & +\sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert H_{m,n}\left( T_{m-1,n}+\frac{X_{m}}{n}+\frac{Y_{m}^{Q}}{\sqrt{n}}\right) -F\left( E_{Q}[X_{m}|\mathcal{G}_{m-1}],m,n\right) \right\vert \right] . \end{align*} } By the Lindeberg condition (\ref{linder}), $\lim\limits_{n\rightarrow\infty }\widetilde{I}_{n}^{2}=0$, and by the remainder estimate in the proof of Lemma \ref{lemma-taylor}, $\lim\limits_{n\rightarrow\infty}\widetilde{I}_{n}^{3}=0$. Finally, we prove that $\lim\limits_{n\rightarrow\infty}\widetilde{I}_{n ^{3}=0$: \begin{align*} \widetilde{I}_{n}^{1}= & \sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P} E_{Q}\left[ {I_{D_{m-1,n}^{\overline{\delta}_{\varepsilon},3}}}\left( F(\widetilde{\mu}_{m}^{n},m,n)-F\left( E_{Q}[X_{m}|\mathcal{G}_{m-1 ],m,n\right) \right) \right] \\ \leq & \frac{1}{2n\sigma^{2}}\sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P} E_{Q}\left[ H_{m,n}^{\prime\prime}(T_{m-1,n})(E_{Q}[X_{m}|\mathcal{G _{m-1}]-\widetilde{\mu}_{m}^{n})^{2}I_{\{|T_{m-1,n}-c|\leq\overline{\delta }_{\varepsilon}\}}\right] \\ \leq & {\frac{C\kappa}{n\sigma^{2}}}\sum_{m=1}^{n}\sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ \left\vert E_{Q}[X_{m}|\mathcal{G}_{m-1 ]-\widetilde{\mu}_{m}^{n}\right\vert I_{\{|T_{m-1,n}-c|\leq\overline{\delta }_{\varepsilon}\}}\right] , \end{align*} where $C$ is the uniform bound given in Lemma \ref{lemma-ddp} (2). Thus $\limsup_{n\rightarrow\infty}\widetilde{I}_{n}^{1}\leq \frac{C\kappa\epsilon}{\sigma^2}$, where $\varepsilon$ is arbitrary. This proves (\ref{symproof-2-step0}) and completes the proof of part (2).\hfill\hfill$\blacksquare$ } {\normalsize \medskip\ } {\normalsize The next lemma is used in extending the two theorems from the special case (\ref{kappa}) to general \underline{$\mu$} and $\overline{\mu}$. } \begin{lemma} {\normalsize \label{lemma-shift}For any $\kappa>0$ and $c\in\mathbb{R},$ \[ \mathbb{E}_{\left[ -\kappa,\kappa\right] }\left[ \varphi\left( c+B_{1}\right) \right] \newline=\mathbb{E}_{\left[ -\kappa+c,\;\kappa +c\right] }\left[ \varphi\left( B_{1}\right) \right] , \] where $\mathbb{E}_{\left[ -\kappa+c,\;\kappa+c\right] }\left[ \varphi\left( B_{1}\right) \right] $ is defined in (\ref{BSDE}). } \end{lemma} {\normalsize \noindent\textbf{Proof:} $\mathbb{E}_{[-\kappa+c,\kappa +c]}[\varphi(B_{1})]=Y_{0}^{c}$, where $(Y_{t}^{c},Z_{t}^{c})$ solves \begin{align*} Y_{t}^{c}= & \varphi(B_{1})+\int_{t}^{1}\max\limits_{-\kappa+c\leq\mu \leq\kappa+c}(\mu Z_{s}^{c})ds-\int_{t}^{1}Z_{s}^{c}dB_{s}\\ = & \varphi(B_{1})+\int_{t}^{1}\left( \max\limits_{-\kappa\leq\mu\leq \kappa}(\mu Z_{s}^{c})+cZ_{s}^{c}\right) ds-\int_{t}^{1}Z_{s}^{c dB_{s},\ 0\leq t\leq1\text{. \end{align*} where the last equality is due to \[ \max\limits_{-\kappa+c\leq\mu\leq\kappa+c}(\mu z)=(\kappa+c)z^{+ -(-\kappa+c)z^{-}=\max\limits_{-\kappa\leq\mu\leq\kappa}(\mu z)+cz. \] Let $Q^{c}$ be the probability measure satisfying{ \[ E_{P^{\ast}}\left[ \frac{dQ^{c}}{dP^{\ast}}|\mathcal{F}_{t}\right] =\exp\left\{ -\frac{c^{2}t}{2}+cB_{t}\right\} ,\quad t\geq0\text{. \] } Then $W_{t}=B_{t}-ct$ is a Brownian motion under $Q^{c}$ and $(Y_{t ^{c},Z_{t}^{c})$ solve \[ Y_{t}^{c}=\varphi(c+W_{1})+\int_{t}^{1}{\max\limits_{-\kappa\leq\mu\leq\kappa }}(\mu Z_{s}^{c})ds-\int_{t}^{1}Z_{s}^{c}dW_{s},\ 0\leq t\leq1\text{. \] Hence $Y_{0}^{c}=\mathbb{E}_{\left[ -\kappa,\kappa\right] }\left[ \varphi\left( c+B_{1}\right) \right] $.\hfill\hfill$\blacksquare$ } {\normalsize \medskip} {\normalsize Chen et al \cite{chenBSDE} derive closed-form solutions for a class of BSDEs by using the properties of BSDEs and related PDEs. The next lemma provides a simpler derivation for the special case where the terminal value of the BSDE is a suitably defined indicator function. } \begin{lemma} {\normalsize \label{explicit-solution} For any $a<b\in$$\mathbb{R}$$\ $and $\kappa>0$, \[ \mathbb{E}_{[-\kappa,\kappa]}[I_{[a,b]}(B_{1})]=\left\{ \begin{array} [c]{lcc \Phi_{-\kappa}\left( -a\right) -e^{-\kappa(b-a)}\Phi_{-\kappa}\left( -b\right) & & \text{if }a+b\geq0\\ \Phi_{-\kappa}\left( b\right) -e^{-\kappa(b-a)}\Phi_{-\kappa}\left( a\right) & & \text{if }a+b<0. \end{array} \right. \] and \[ \mathcal{E}_{[-\kappa,\kappa]}[I_{[a,b]}(B_{1})]=\left\{ \begin{array} [c]{lcc \Phi_{\kappa}\left( -a\right) -e^{\kappa(b-a)}\;\Phi_{\kappa}\left( -b\right) & & \text{if }a+b\geq0\\ \Phi_{\kappa}\left( b\right) -e^{\kappa(b-a)}\;\Phi_{\kappa}\left( a\right) & & \text{if }a+b<0. \end{array} \right. \] } \end{lemma} {\normalsize \noindent\noindent\textbf{Proof}: For $\kappa>0$, let {\footnotesize \begin{align*} \mathcal{P} \equiv\left\{ Q^{v}:E_{P^{\ast}}[\frac{dQ^{v}}{dP^{\ast} }|\mathcal{F}_{1}]=e^{-\frac{1}{2}\int_{0}^{1}v_{s} ^{2}ds+\int_{0}^{1 v_{s}dB_{s}}, (v_{t})\text{ is }\mathcal{F}_{t}\text{-adapted and } \sup _{s\in[0,1]}|v_{s}|\leq\kappa\right\} . \end{align*} } } {\normalsize Let $\varphi=I_{[a,b]}$, then by \cite[Theorem 2.2]{CE} or \cite[Lemma 3]{chenpeng}, \[ \mathbb{E}_{[-\kappa,\kappa]}[\varphi\left( B_{1}\right) ]=\sup \limits_{Q\in\mathcal{P}}E_{Q}\left[ \varphi( B_{1}) \right] =\sup \limits_{|v|\leq\kappa}E_{Q^{v}}\left[ \varphi\left( B_{1}^{v}+\int_{0 ^{1}v_{s}ds\right) \right] \text{, \] where $B_{t}^{v}\equiv B_{t}-\int_{0}^{t}v_{s}ds$ is the Brownian motion under $Q^{v}$. } {\normalsize Let $(v_{s})$ be any $\mathcal{F}_{t}$-adapted process valued in $[-\kappa,\kappa]$, and consider the following BSDEs \begin{align*} Y_{t}= & \varphi(B_{1})+\int_{t}^{1}\max\limits_{-\kappa\leq\mu\leq\kappa }(\mu Z_{s})ds-\int_{t}^{1}Z_{s}dB_{s}\\ Y_{t}^{v}= & \varphi(\overline{B}_{1}^{v})+\int_{t}^{1}v_{s}Z_{s}^{v ds-\int_{t}^{1}Z_{s}^{v}d\overline{B}_{s}^{v}\\ = & \varphi(\overline{B}_{1}^{v})-\int_{t}^{1}Z_{s}^{v}dB_{s}\text{ }\\ Y_{t}^{\prime}= & \varphi(\overline{B}_{1}^{v})+\int_{t}^{1}\max \limits_{-\kappa\leq\mu\leq\kappa}(\mu Z_{s}^{\prime})ds-\int_{t}^{1 Z_{s}^{\prime}d\overline{B}_{s}^{v}\text{, \end{align*} where $\overline{B}_{t}^{v}\equiv B_{t}+\int_{0}^{t}v_{s}ds$. Clearly, $Y_{0}=Y_{0}^{\prime}\geq Y_{0}^{v}$, and thu \[ \sup\limits_{|v|\leq\kappa}\mathbb{E}_{Q^{v}}[\varphi(B_{1}^{v}+\int_{0 ^{1}v_{s}ds)]=Y_{0}\geq\sup\limits_{|v|\leq\kappa}Y_{0}^{v}=\sup \limits_{|v|\leq\kappa}E_{P^{\ast}}[\varphi(B_{1}+\int_{0}^{1}v_{s}ds)] \] Let $(X_{t}^{v,x})$ and $(X_{t}^{\ast,x})$ be the solutions respectively of \begin{align*} X_{t}^{v,x} & =x+\int_{0}^{t}v_{s}ds+B_{t},\quad0\leq t\leq1\text{, and}\\ X_{t}^{\ast,x} & =x-\kappa\int_{0}^{t}sgn\left( X_{s}^{\ast,x}\right) ds+B_{t},\quad0\leq t\leq1. \end{align*} By the comparison theorem for stochastic differential equations \cite[Thm. 2.1]{watanabe1977}, \begin{align*} & \sup\limits_{|v|\leq\kappa}P^{\ast}\left( a\leq B_{1}+\int_{0}^{1 v_{s}ds\leq b\right) \\ = & \sup\limits_{|v|\leq\kappa}P^{\ast}\left( |X_{1}^{v,c}|\leq\frac{b-a {2}\right) =P^{\ast}\left( |X_{1}^{\ast,c}|\leq\frac{b-a}{2}\right) \text{, \end{align*} where $c=-\frac{a+b}{2}$. } {\normalsize On the other hand, let $(\alpha_{s})$ be any $\mathcal{F}_{t $-adapted process valued in $[-\kappa,\kappa]$, and $(\overline{X}_{t ^{\alpha,x})$ be the solution of \[ \overline{X}_{t}^{\alpha,x}=x+\int_{0}^{t}\alpha_{s}ds+B_{t}^{v},\quad0\leq t\leq1 \] and let $(\overline{X}_{t}^{\ast,x})$ be the solution o \[ \overline{X}_{t}^{\ast,x}=x-\kappa\int_{0}^{t}sgn\left( \overline{X _{s}^{\ast,x}\right) ds+B_{t}^{v},\quad0\leq t\leq1. \] Then \begin{align*} & Q^{v}\left( a\leq B_{1}^{v}+\int_{0}^{1}\alpha_{s}ds\leq b\right) \\ = & Q^{v}\left( |\overline{X}_{1}^{\alpha,c}|\leq\frac{b-a}{2}\right) \leq Q^{v}\left( |\overline{X}_{1}^{\ast,c}|\leq\frac{b-a}{2}\right) =P^{\ast }\left( |X_{1}^{\ast,c}|\leq\frac{b-a}{2}\right) \text{, \end{align*} and \begin{align*} & \sup\limits_{|v|\leq\kappa}Q^{v}\left( a\leq B_{1}^{v}+\int_{0}^{1 v_{s}ds\leq b\right) \\ \leq & \sup\limits_{|\alpha|\leq\kappa}Q^{v}\left( a\leq B_{1}^{v}+\int _{0}^{1}\alpha_{s}ds\leq b\right) \leq P^{\ast}\left( |X_{1}^{\ast,c |\leq\frac{b-a}{2}\right) . \end{align*} That is, \[ \sup\limits_{|v|\leq\kappa}Q^{v}\left( a\leq B_{1}^{v}+\int_{0}^{1 v_{s}ds\leq b\right) =P^{\ast}\left( |X_{1}^{\ast,c}|\leq\frac{b-a {2}\right) \] By \cite[Proposition 5.1]{KS1984}, the transition probability density of $(X_{t}^{\ast,x})$ is given by (for all $t\in(0,1]$, $z\in$$\mathbb{R}$), \[ q_{x}(t,z)=\frac{1}{\sqrt{2\pi t}}e^{-\frac{(x-z)^{2}+2\kappa t(|z|-|x|)+\kappa^{2}t^{2}}{2t}}+\kappa e^{-2\kappa|z|}\int_{|x|+|z|-\kappa t}^{\infty}\frac{1}{\sqrt{2\pi t}}e^{-\frac{u^{2}}{2t}}du\text{.}\quad \] Thus \begin{align*} P^{\ast}\left( |X_{1}^{\ast,c}|\leq\frac{b-a}{2}\right) & =\int _{\frac{a-b}{2}}^{\frac{b-a}{2}}q_{c}(1,z)dz\\ & =\left\{ \begin{array} [c]{lc \Phi_{-\kappa}\left( -a\right) -e^{-\kappa(b-a)}\Phi_{-\kappa}\left( -b\right) & \text{if }a+b\geq0\\ \Phi_{-\kappa}\left( b\right) -e^{-\kappa(b-a)}\Phi_{-\kappa}\left( a\right) & \text{if }a+b<0. \end{array} \right. \end{align*} } {\normalsize The rest can be proven in the same way. \hfill\hfill $\blacksquare$ } \subsection{{\protect\normalsize Proof of Theorem \ref{thm-CLT}}} {\normalsize It is enough to prove (\ref{CLT}). We prove it for $\varphi\in C_{b}^{\infty}(\mathbb{R})$. This suffices because any $\varphi\in {C([-\infty,\infty])}$ can be approximated uniformly by a sequence of functions in $C_{b}^{\infty}(\mathbb{R})$ (see Approximation Lemma in \cite[Ch. VIII]{feller}). } {\normalsize Le \[ S_{0}\equiv0,\;S_{n}\equiv\sum_{i=1}^{n}X_{i},~S_{n}^{Q}\equiv\sum_{i=1 ^{n}Y_{i}^{Q}\text{,~~}Y_{i}^{Q}\equiv\frac{1}{\sigma}\left( X_{i -E_{Q}[X_{i}|\mathcal{G}_{i-1}]\right) \text{. \] First we prove that \begin{equation} \lim_{\epsilon\rightarrow0}\lim_{n\rightarrow\infty}\left\vert \sup \limits_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{S_{n}}{n +\frac{S_{n}^{Q}}{\sqrt{n}}\right) \right] -\mathbb{E}_{g_{\epsilon}}\left[ \varphi\left( B_{1}\right) \right] \right\vert =0\text{.} \label{eq3-1 \end{equation} By the definition of $\{H_{m,n}\}_{m=0}^{n}$, { \begin{align*} & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{S_{n} {n}+\frac{S_{n}^{Q}}{\sqrt{n}}\right) \right] -\mathbb{E}_{g_{\epsilon }\left[ \varphi\left( B_{1}\right) \right] \\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{n,n}\left( \frac{S_{n} {n}+\frac{S_{n}^{Q}}{\sqrt{n}}\right) \right] -H_{0,n}(0)\\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{n,n}\left( \frac{S_{n} {n}+\frac{S_{n}^{Q}}{\sqrt{n}}\right) \right] -\sup\limits_{Q\in\mathcal{P }E_{Q}\left[ H_{n-1,n}\left( \frac{S_{n-1}}{n}+\frac{S_{n-1}^{Q}}{\sqrt{n }\right) \right] \\ & +\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{n-1,n}\left( \frac{S_{n-1 }{n}+\frac{S_{n-1}^{Q}}{\sqrt{n}}\right) \right] -\sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{n-2,n}\left( \frac{S_{n-2}}{n}+\frac{S_{n-2}^{Q }{\sqrt{n}}\right) \right] \\ & +\ldots\\ & +\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}\left( \frac{S_{m} {n}+\frac{S_{m}^{Q}}{\sqrt{n}}\right) \right] -\sup\limits_{Q\in\mathcal{P }E_{Q}\left[ H_{m-1,n}\left( \frac{S_{m-1}}{n}+\frac{S_{m-1}^{Q}}{\sqrt{n }\right) \right] \\ & +\ldots+ \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{1,n}\left( \frac{S_{1}}{n}+\frac{S_{1}^{Q}}{\sqrt{n}}\right) \right] -H_{0,n}(0)\\ = & \sum\limits_{m=1}^{n}\left\{ \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}\left( \frac{S_{m}}{n}+\frac{S_{m}^{Q}}{\sqrt{n}}\right) \right] -\sup\limits_{Q\in\mathcal{P}}E_{Q}\bigg[ H_{m-1,n}\bigg( \frac{S_{m-1} {n}+\frac{S_{m-1}^{Q}}{\sqrt{n}}\bigg) \bigg] \right\} \\ = & \sum\limits_{m=1}^{n}\left\{ \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}\left( \frac{S_{m}}{n}+\frac{S_{m}^{Q}}{\sqrt{n}}\right) \right] -\sup\limits_{Q\in\mathcal{P}}E_{Q}\bigg[ L_{m,n}\bigg( \frac{S_{m-1} {n}+\frac{S_{m-1}^{Q}}{\sqrt{n}}\bigg) \bigg] \right\} \\ & +\sum_{m=1}^{n}\left\{ \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}\left( \frac{S_{m-1}}{n}+\frac{S_{m-1}^{Q}}{\sqrt{n}}\right) \right] \right. \\ & \left. \qquad\qquad\qquad\qquad\qquad\qquad\qquad-\sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m-1,n}\left( \frac{S_{m-1}}{n}+\frac{S_{m-1}^{Q }{\sqrt{n}}\right) \right] \right\} \\ \equiv & I_{1n}+I_{2n}\text{, \end{align*} } where $L_{m,n}(x)=H_{m,n}\left( x\right) +\frac{1}{n}g_{0}\left( H_{m,n}^{\prime}(x)\right) +\frac{1}{2n}H_{m,n}^{\prime\prime}(x).$ } {\normalsize By Lemma \ref{lemma-taylor}, if $T_{m,n}=\frac{S_{m}}{n +\frac{S_{m}^{Q}}{\sqrt{n}}$, then {\small \begin{align*} |I_{1n}| & \leq\sum\limits_{m=1}^{n}\left\vert \sup\limits_{Q\in\mathcal{P }E_{Q}\left[ H_{m,n}\left( \frac{S_{m}}{n}+\frac{S_{m}^{Q}}{\sqrt{n }\right) \right] -\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}\left( \frac{S_{m-1}}{n}+\frac{S_{m-1}^{Q}}{\sqrt{n}}\right) \right] \right\vert \\ & \rightarrow0\text{ ~as }n\rightarrow\infty\text{. \end{align*} Furthermore, by Lemmas \ref{lemma-ddp} and \ref{lemma-gexpectation}, as $n\rightarrow\infty$ \begin{align*} |I_{2n}| & \leq\sum_{m=1}^{n}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \left\vert L_{m,n}\left( \frac{S_{m-1}}{n}+\frac{S_{m-1}^{Q}}{\sqrt{n }\right) -H_{m-1,n}\left( \frac{S_{m-1}}{n}+\frac{S_{m-1}^{Q}}{\sqrt{n }\right) \right\vert \right] \\ \leq & \sum_{m=1}^{n}\sup\limits_{x\in\mathbb{R}}\left\vert L_{m,n (x)-H_{m-1,n}(x)\right\vert \\ = & \sum_{m=1}^{n}\sup\limits_{x\in\mathbb{R}}\left\vert H_{m,n}\left( x\right) +\frac{1}{n}g_{0}\left( H_{m,n}^{\prime}(x)\right) +\frac{1 {2n}H_{m,n}^{\prime\prime}(x) \right. \\ & \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad- \mathbb{E _{g_{\epsilon}}\left[ H_{m,n}\left( x+B_{\frac{m}{n}}-B_{\frac{m-1}{n }\right) \right] \bigg\vert\\ \leq & \sum_{m=1}^{n}\sup\limits_{x\in\mathbb{R}}\left\vert H_{m,n}\left( x\right) +\frac{1}{n}g_{\epsilon}\left( H_{m,n}^{\prime}(x)\right) +\frac{1}{2n}H_{m,n}^{\prime\prime}(x) - \mathbb{E}_{g_{\epsilon}}\left[ H_{m,n}\left( x+B_{\frac{1}{n}}\right) \right] \right\vert \\ & +\frac{1}{n}\sum_{m=1}^{n}\sup\limits_{x\in\mathbb{R}}\left\vert g_{\epsilon}\left( H_{m,n}^{\prime}(x)\right) -g_{0}\left( H_{m,n}^{\prime }(x)\right) \right\vert \\ \leq & \sum_{m=1}^{n}\sup\limits_{x\in\mathbb{R}}\left\vert \mathbb{E _{g_{\epsilon}}\left[ H_{m,n}\left( x+B_{\frac{1}{n}}\right) \right] -H_{m,n}\left( x\right) -\frac{1}{n}g_{\epsilon}\left( H_{m,n}^{\prime }(x)\right) -\frac{1}{2n}H_{m,n}^{\prime\prime}(x)\right\vert \\ & +2\kappa\epsilon\text{, \end{align*} which sum converges to $2\kappa\epsilon$. This proves (\ref{eq3-1}). } } {\normalsize From the standard estimates for BSDEs \cite[Proposition 2.1 {KPQ}, \begin{align*} \left\vert \mathbb{E}_{g_{\epsilon}}\left[ \varphi\left( B_{1}\right) \right] -\mathbb{E}_{g_{0}}\left[ \varphi\left( B_{1}\right) \right] \right\vert ^{2} & \leq{\widehat{C}}E_{P^{\ast}}\left[ \left( \int_{0 ^{1}\left\vert g_{\epsilon}(Z_{s}^{\epsilon})-g_{0}(Z_{s}^{\epsilon })\right\vert ds\right) ^{2}\right] \\ & <{\widehat{C}4\kappa^{2}}\epsilon^{2}\text{, \end{align*} where {$\widehat{C}>0$} is a constant. Combine with (\ref{eq3-1}) to obtai \begin{align*} & \lim_{n\rightarrow\infty}\left\vert \sup\limits_{Q\in\mathcal{P} E_{Q}\left[ \varphi\left( \frac{S_{n}}{n}+\frac{S_{n}^{Q}}{n}\right) \right] -\mathbb{E}_{g_{0}}\left[ \varphi\left( B_{1}\right) \right] \right\vert \\ \leq & \lim_{\epsilon\rightarrow0}\lim_{n\rightarrow\infty}\left\vert \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{S_{n}}{n +\frac{S_{n}^{Q}}{n}\right) \right] -\mathbb{E}_{g_{\epsilon}}\left[ \varphi\left( B_{1}\right) \right] \right\vert \\ & +\lim_{\epsilon\rightarrow0}\left\vert \mathbb{E}_{g_{\epsilon}}\left[ \varphi\left( B_{1}\right) \right] -\mathbb{E}_{g_{0}}\left[ \varphi\left( B_{1}\right) \right] \right\vert \text{. \end{align*} The latter sum equals $0$, thus completing the proof under condition (\ref{kappa}). } {\normalsize Finally, we describe the proof for general \underline{$\mu$} and $\overline{\mu}$. Let $Y_{i}=X_{i}-\tfrac{\overline{\mu}+\underline{\mu}}{2}$ and $\kappa=\frac{\overline{\mu}-\underline{\mu}}{2}$. Then \[ {\mathbb{E}}[Y_{i}\mid\mathcal{G}_{i-1}]=\frac{\overline{\mu}-\underline{\mu }{2}=\kappa,\quad{\mathcal{E}}[Y_{i}\mid\mathcal{G}_{i-1}]=-\frac {\overline{\mu}-\underline{\mu}}{2}=-\kappa. \] Apply the above result to $(Y_{i})$ and $\widehat{\varphi}$, $\widehat {\varphi}(x)=\varphi\left( x+\tfrac{\overline{\mu}+\underline{\mu} {2}\right) $, to obtai \begin{align*} & \lim_{n\rightarrow\infty}\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{S_{n}}{n}+\frac{S_{n}^{Q}}{n}\right) \right] \\ = & \lim_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{1}{n}\sum\limits_{i=1}^{n}X_{i}+\frac{1}{\sqrt{n} \sum\limits_{i=1}^{n}\frac{1}{\sigma}\left( X_{i}-E_{Q}[X_{i}|\mathcal{G _{i-1}]\right) \right) \right] \\ = & \lim_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{1}{n}\sum\limits_{i=1}^{n}Y_{i}+\frac{\overline{\mu }+\underline{\mu}}{2}+\frac{1}{\sqrt{n}}\sum\limits_{i=1}^{n}\frac{1}{\sigma }\left( Y_{i}-E_{Q}[Y_{i}|\mathcal{G}_{i-1}]\right) \right) \right] \\ = & \lim_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \widehat{\varphi}\left( \frac{1}{n}\sum\limits_{i=1}^{n}Y_{i}+\frac{1 {\sqrt{n}}\sum\limits_{i=1}^{n}\frac{1}{\sigma}\left( Y_{i}-E_{Q [Y_{i}|\mathcal{G}_{i-1}]\right) \right) \right] \\ = & \mathbb{E}_{\left[ \tfrac{\underline{\mu}-\overline{\mu}}{2 ,\tfrac{\overline{\mu}-\underline{\mu}}{2}\right] }\left[ \widehat{\varphi }\left( B_{1}\right) \right] \\ = & \mathbb{E}_{\left[ \tfrac{\underline{\mu}-\overline{\mu}}{2 ,\tfrac{\overline{\mu}-\underline{\mu}}{2}\right] }\left[ \varphi\left( \frac{\overline{\mu}+\underline{\mu}}{2}+B_{1}\right) \right] =\mathbb{E _{\left[ \underline{\mu},\overline{\mu}\right] }\left[ \varphi\left( B_{1}\right) \right] , \end{align*} where the last equality is due to Lemma \ref{lemma-shift}. This completes the proof.\hfill\hfill\hfill\hfill\ $\blacksquare$ } \begin{remark} {\normalsize \label{remark-CLT2b}Straightforward modifications of the preceding arguments deliver a proof of Theorem \ref{thm-CLT2}. The key is modification of Lemma \ref{lemma-taylor} (see Remark \ref{remark-CLT2} and Appendix \ref{app-CLT2}). The remaining arguments are similar to those given above and are omitted. } \end{remark} \subsection{{\protect\normalsize Proof of Theorem \ref{thm-special}}} {\normalsize \noindent\textbf{Proof of (1):}\textbf{ } Let {$\varphi\in C([-\infty,\infty])$} be symmetric with {center $c\in\mathbb{R}$} and decreasing on $(c,\infty)$. {The result is clear if $\varphi$ is globally constant. Thus we assume that $\varphi$ is not a globally constant function. }Then $\varphi$ can be approximated uniformly by $\varphi_{h}$ defined b \begin{equation} \varphi_{h}(x)=\int_{-\infty}^{\infty}\frac{1}{\sqrt{2\pi}}\varphi (x+hy)e^{-\tfrac{y^{2}}{2}}dy\text{,} \label{phih \end{equation} and (see Appendix \ref{app-special}), $\varphi_{h}$ is symmetric with center $c$, and satisfies \[ sgn(\varphi_{h}^{\prime}(x))=-sgn(x-c)\text{, ~}\forall h>0\text{. \] } {\normalsize } {\normalsize Consider the special case (\ref{kappa}). Let $\{H_{m,n \}_{m=0}^{n}$ be defined via (\ref{BSDEep-1}) using $\varphi$, where, without loss of generality we assume $\varphi\in C_{b}^{3}(\mathbb{R})$; otherwise, we can use $\varphi_{h}$ defined in (\ref{phih}). } {\normalsize Let \[ S_{0}\equiv0,\;S_{n}\equiv\sum_{i=1}^{n}X_{i},~\overline{S}_{n}\equiv \sum_{i=1}^{n}Z_{i}^{n}\text{,~~}Z_{i}^{n}\equiv\frac{1}{\sigma}\left( X_{i}-\mu_{i}^{n}\right) \text{. \] First, prove that \begin{equation} \lim_{\epsilon\rightarrow0}\lim_{n\rightarrow\infty}\left\vert \sup \limits_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{S_{n}}{n +\frac{\overline{S}_{n}}{\sqrt{n}}\right) \right] -\mathbb{E}_{g_{\epsilon }\left[ \varphi\left( B_{1}\right) \right] \right\vert =0\text{.} \label{limit \end{equation} Argue as follows: \begin{align*} & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ {\varphi}\left( \frac{S_{n} {n}+\frac{\overline{S}_{n}}{\sqrt{n}}\right) \right] -\mathbb{E _{g_{\epsilon}}\left[ {\varphi}\left( B_{1}\right) \right] \\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{n,n}\left( \frac{S_{n} {n}+\frac{\overline{S}_{n}}{\sqrt{n}}\right) \right] -H_{0,n}(0)\\ = & \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{n,n}\left( \frac{S_{n} {n}+\frac{\overline{S}_{n}}{\sqrt{n}}\right) \right] -\sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{n-1,n}\left( \frac{S_{n-1}}{n}+\frac{\overline {S}_{n-1}}{\sqrt{n}}\right) \right] \\ & +\;\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{n-1,n}\left( \frac {S_{n-1}}{n}+\frac{\overline{S}_{n-1}}{\sqrt{n}}\right) \right] -\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{n-2,n}\left( \frac{S_{n-2} {n}+\frac{\overline{S}_{n-2}}{\sqrt{n}}\right) \right] \\ & +\ldots\\ & +\;\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}\left( \frac{S_{m} {n}+\frac{\overline{S}_{m}}{\sqrt{n}}\right) \right] -\sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m-1,n}\left( \frac{S_{m-1}}{n}+\frac{\overline {S}_{m-1}}{\sqrt{n}}\right) \right] \\ & +\ldots\\ & +\;\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{1,n}\left( \frac{S_{1} {n}+\frac{\overline{S}_{1}}{\sqrt{n}}\right) \right] -H_{0,n}(0)\\ = & \sum\limits_{m=1}^{n}\left\{ \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ H_{m,n}\left( \frac{S_{m}}{n}+\frac{\overline{S}_{m}}{\sqrt{n}}\right) \right] -\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}\left( \frac{S_{m-1}}{n}+\frac{\overline{S}_{m-1}}{\sqrt{n}}\right) \right] \right\} \\ & +\sum_{m=1}^{n}\left\{ \sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}\left( \frac{S_{m-1}}{n}+\frac{\overline{S}_{m-1}}{\sqrt{n}}\right) \right] \right. \\ & \left. \qquad\qquad\qquad\qquad\qquad\qquad\qquad-\sup\limits_{Q\in \mathcal{P}}E_{Q}\left[ H_{m-1,n}\left( \frac{S_{m-1}}{n}+\frac{\overline {S}_{m-1}}{\sqrt{n}}\right) \right] \right\} \\ \equiv & J_{1n}+J_{2n}, \end{align*} where $L_{m,n}(x)=H_{m,n}\left( x\right) +\frac{1}{n}g_{0}\left( H_{m,n}^{\prime}(x)\right) +\frac{1}{2n}H_{m,n}^{\prime\prime}(x).$ } {\normalsize By Lemma \ref{lemma-taylor2}(1), with $T_{m,n}=\frac{S_{m} {n}+\frac{\overline{S}_{m}}{\sqrt{n}}$, we have{\small \begin{align*} |J_{1n}| & \leq\sum\limits_{m=1}^{n}\left\vert \sup\limits_{Q\in\mathcal{P }E_{Q}\left[ H_{m,n}\left( \frac{S_{m}}{n}+\frac{\overline{S}_{m}}{\sqrt{n }\right) \right] -\sup\limits_{Q\in\mathcal{P}}E_{Q}\left[ L_{m,n}\left( \frac{S_{m-1}}{n}+\frac{\overline{S}_{m-1}}{\sqrt{n}}\right) \right] \right\vert \\ & \rightarrow0\text{ ~as }n\rightarrow\infty\text{. \end{align*} }{As in the proof of Theorem \ref{thm-CLT}, we have $|J_{2n}|\rightarrow0,~$as $n\rightarrow\infty$. Hence, (\ref{limit}) holds. Combine it with standard estimate for BSDEs to complete the proof under condition (\ref{kappa}).} } {\normalsize For the case of general $\underline{\mu}$ and $\overline{\mu}$, let $Y_{i}=X_{i}-\tfrac{\overline{\mu}+\underline{\mu}}{2}$. Then \[ {\mathbb{E}[Y_{i}\mid\mathcal{G}_{i-1}]=\frac{\overline{\mu}-\underline{\mu }{2},\quad\mathcal{E}[Y_{i}\mid\mathcal{G}_{i-1}]=-\frac{\overline{\mu }-\underline{\mu}}{2}. \] Apply the above result for $(Y_{i})$ to $\widehat{\varphi}$, $\widehat {\varphi}(x)=\varphi\left( x+\tfrac{\overline{\mu}+\underline{\mu} {2}\right) $, to obtai \begin{align*} & \lim_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{1}{n}\sum\limits_{i=1}^{n}X_{i}+\frac{1}{\sqrt{n}}\sum\limits_{i=1 ^{n}\frac{1}{\sigma}\left( X_{i}-\mu_{i}^{n}\right) \right) \right] \\ = & \lim_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \varphi\left( \frac{1}{n}\sum\limits_{i=1}^{n}Y_{i}+\frac{\overline{\mu }+\underline{\mu}}{2}+\frac{1}{\sqrt{n}}\sum\limits_{i=1}^{n}\frac{1}{\sigma }\left( Y_{i}-\left( \mu_{i}^{n}-\frac{\overline{\mu}+\underline{\mu} {2}\right) \right) \right) \right] \\ = & \lim_{n\rightarrow\infty}\sup_{Q\in\mathcal{P}}E_{Q}\left[ \widehat{\varphi}\left( \frac{1}{n}\sum\limits_{i=1}^{n}Y_{i}+\frac{1 {\sqrt{n}}\sum\limits_{i=1}^{n}\frac{1}{\sigma}\left( Y_{i}-\gamma_{i ^{n}\right) \right) \right] \\ = & \mathbb{E}_{\left[ \tfrac{\underline{\mu}-\overline{\mu}}{2 ,\tfrac{\overline{\mu}-\underline{\mu}}{2}\right] }\left[ \widehat{\varphi }\left( B_{1}\right) \right] \\ = & \mathbb{E}_{\left[ \tfrac{\underline{\mu}-\overline{\mu}}{2 ,\tfrac{\overline{\mu}-\underline{\mu}}{2}\right] }\left[ \varphi\left( \frac{\overline{\mu}+\underline{\mu}}{2}+B_{1}\right) \right] \\ = & \mathbb{E}_{\left[ \underline{\mu},\overline{\mu}\right] }\left[ \varphi\left( B_{1}\right) \right] , \end{align*} where the last equality is due to Lemma \ref{lemma-shift}. Also, \[ \gamma_{m}^{n}=\tfrac{\overline{\mu}-\underline{\mu}}{2}I_{\widehat{A _{m-1,n}}+\tfrac{\underline{\mu}-\overline{\mu}}{2}I_{\widehat{A}_{m-1,n}^{c },\text{ ~and \] \begin{align*} \widehat{A}_{m-1,n} & =\left\{ \tfrac{1}{n}\sum\limits_{i=1}^{m-1 Y_{i}+\tfrac{1}{\sqrt{n}}\sum\limits_{i=1}^{m-1}\tfrac{1}{\sigma}\left( Y_{i}-\gamma_{i}^{n}\right) \leq-\tfrac{\overline{\mu}+\underline{\mu} {2}+c\right\} \\ & =\bigg\{\tfrac{1}{n}\sum\limits_{i=1}^{m-1}X_{i}+\tfrac{1}{\sqrt{n} \sum\limits_{i=1}^{m-1}\tfrac{1}{\sigma}\big(X_{i}-\gamma_{i}^{n -\tfrac{\overline{\mu}+\underline{\mu}}{2}\big)\leq-\tfrac{\overline{\mu }+\underline{\mu}}{2}\big(1-\tfrac{m-1}{n}\big)+c\bigg\}\text{. \end{align*} Thus $\widehat{A}_{0,n}=A_{0,n}$, and \[ \gamma_{1}^{n}+\tfrac{\overline{\mu}+\underline{\mu}}{2}=\overline{\mu }I_{\widehat{A}_{0,n}}+\underline{\mu}I_{\widehat{A}_{0,n}^{c}}=\overline{\mu }I_{A_{0,n}}+\underline{\mu}I_{A_{0,n}^{c}}=\mu_{1}^{n}\text{. \] By induction, $A_{m-1,n}=\widehat{A}_{m-1,n}$, for $m\geq1$, an \[ \gamma_{m}^{n}+\tfrac{\overline{\mu}+\underline{\mu}}{2}=\overline{\mu }I_{\widehat{A}_{m-1,n}}+\underline{\mu}I_{\widehat{A}_{m-1,n}^{c} =\overline{\mu}I_{A_{m-1,n}}+\underline{\mu}I_{A_{m-1,n}^{c}}=\mu_{m ^{n}\text{. \] This completes the proof of (\ref{sym-clt1}). } {\normalsize By standard limiting arguments, (\ref{sym-clt1}) can be extended to indicator functions for intervals. Then (\ref{sym-indi-clt}) follows from Lemmas \ref{lemma-shift} and \ref{explicit-solution}. } {\normalsize \medskip} {\normalsize \noindent\textbf{Proof of (2):} In light of Lemma \ref{lemma-taylor2}(2), the proof of part (2) is similar to that of (1) and is omitted.\hfill\hfill\hfill\hfill\ $\blacksquare$ } {\normalsize }
\section{Introduction} The gravitational path integral requires not only a sum over metrics on a manifold of a given topology, but also a sum over manifolds of different topologies.\footnote{For an opposing viewpoint, arguing not to include topology change, see for example \cite{Anderson:1986ww}.} One strong reason to include a sum over topologies in the gravitational path integral is that doing so gives us the Hawking-Page transition in Anti-de Sitter space \cite{Hawking:1982dh}, which, famously, is the bulk dual of the confinement-deconfinement transition in gauge theory \cite{Witten:1998zw, Aharony:2003sx}.\footnote{ However, note that there is still room for a sum over only certain topologies, as long as the sum is unambiguously defined. For example, in two dimensions, we can choose to sum either over just the oriented manifolds, or to sum over oriented and unoriented manifolds. The recent papers \cite{Maloney:2020nni, Afkhami-Jeddi:2020ezh} featured a sum over a restricted class of three-manifolds, the so-called handlebodies.} While the topological classification of three- and higher-dimensional manifolds is quite complicated, in two-dimensional gravity theories, such as worldsheet string theory \cite{Polchinski:1998rq} or Jackiw-Teitelboim (JT) gravity \cite{Jackiw:1984je, Teitelboim:1983ux, Maldacena:2016upp}, the sum over topologies reduces to a sum over the Euler characteristic of the manifold, a single integer. Recently, there has been a surge of interest in the sum over different topologies in the gravitational path integral. For instance, in \cite{Almheiri:2019qdq,pssy} it was argued that spacetime wormholes are crucial in understanding entropy paradoxes in black hole physics. The sum over different topologies also plays a crucial role in the interpretation of JT gravity as a random matrix theory, and the computation of the ramp and plateau regions of the spectral form factor \cite{largen,sss1, sss2}. A systematic way to quantize a theory that involves topology change and multiple universes is the so-called ``third quantization" formalism \cite{Strominger:1988ys}. Third quantization is a bad name for reasons that will become clear later in this note, but we stick with it because of legacy. The name string field theory (which is the field theory of multiple strings) suggests that ``universe field theory" would perhaps be a more appropriate name.\footnote{ We thank Juan Maldacena for suggesting this name.} This formalism has been reviewed and clarified in a recent paper by Marolf and Maxfield \cite{mm}. An incomplete list of references is \cite{Hawking:1984hk, Hawking:1991vs, Coleman:1988cy,Coleman:1988tj, Giddings:1987cg, Giddings:1988cx, Giddings:1988wv}. Given the recent interest in this subject, one of our aims in this brief note is to clarify some of the conceptual features of third quantization. Much of the mystery of this formalism disappears if we keep in mind the example of worldline gravity, where the third-quantized theory is just the Klein-Gordon theory, as we review in section \ref{sec:worldline}. The worldline gravity discussion also shows us that the commutativity of boundary-creating operators, which is necessary for constructing the alpha states and having a dual ensemble interpretation, is subtle. For example, the Klein-Gordon field operators do not commute at timelike separation. However, as usual, if the target space (which, in general, would be ``superspace") is analytically continued to Euclidean signature, we do expect the boundary-creating operators to commute.\footnote{ Superspace has infinitely many negative-signature directions and this analytic continuation might be subtle.} We also point out that the general construction of the baby universe Hilbert space is the same as the Gelfand-Naimark-Segal (GNS) construction in algebraic QFT. In order to talk about quantities like the entropy of the density matrix of the universe, we first need to specify a global state in the multi-universe Hilbert space. There are multiple options for the global state, as we review in section \ref{sec:mainArgument}. One feature of different global density matrices, defined by the gravitational path integral, is whether or not manifolds connecting the bra and the ket, or a bra-ket wormholes, exist. The choice of whether or not to include bra-ket wormholes is not a free choice, rather it depends on which global state we pick. Two special global states are the Hartle-Hawking state \cite{Hartle:1983ai, HAWKING1984257}, which does not have bra-ket wormholes, and the Page state \cite{Page:1986vw}, which includes bra-ket wormholes. Most of the observations in these sections \ref{sec:worldline} and \ref{sec:mainArgument} are not new and have already appeared in the early literature on quantum cosmology; our aim is to present them in a way that we found useful. Section \ref{sec:implications} is devoted to some implications of these observations. Perhaps most interestingly, we find an application for the notion of effective wormholes, due to \cite{diagcyl}. The bra-ket wormholes that are needed to resolve the bags-of-gold type paradoxes in de Sitter (as in section 6 of \cite{pssy}) and strong subadditivity paradoxes \cite{cgmupcoming} would need to ``emerge" in the Hartle-Hawking state, since they are not originally present in the definition of the Hartle-Hawking state. One way this can happen is if the density matrix of the Hartle-Hawking state, restricted to a single, late-time classical universe, contains effective wormholes obtained by tracing out the unobserved universes. More extreme possibilities are that the Hartle-Hawking state could be non-perturbatively gauge equivalent to a state with bra-ket wormholes, or that the baby universe Hilbert space is one-dimensional. In section \ref{sec:adsaitorjuan} we discuss how boundary entropy computations in AdS are conceptually different, and emphasize that the replica wormholes in that case are simply the wormholes between the various ket boundaries in the bulk Hartle-Hawking state. Throughout this paper, by the baby universe Hilbert space, or the third-quantized Hilbert space, we will mean the Hilbert space that was denoted $\mathcal{H}_{\rm BU}$ or $\mathcal{H}_{0,0}$ in \cite{mm}. \emph{Note added:} While this article was nearing completion, the paper \cite{monicagns} appeared which has some overlap with our section \ref{sec-gns}. \section{Third quantization through the lens of worldline gravity} \label{sec:worldline} Let us recall some basic facts regarding 1d gravity. We specialize to a class of theories describing worldlines embedded in Minkowski space $\mathbb{R}^{1,d-1}$ \cite{Polchinski:1998rq, Strominger:1988ys}. The worldline fields are an einbein $e(\tau)$ and $d$ scalar fields $x^{\mu}(\tau)$ with action \begin{align} I_{\rm WL}[e, x^\mu] = \int_{\tau_i}^{\tau_f} \d \tau\, (e^{-1}\dot{x}^{\mu}\dot{x}^{\nu}\eta_{\mu\nu} - m e)\, . \label{SWL} \end{align} This theory is invariant under reparametrizations of the worldline time $\tau$. Apart from its simplicity, the main advantage of this theory is that the ``third-quantized'' theory describing multiple 1d universes \cite{Strominger:1988ys} is just the Klein-Gordon scalar field theory in $d$-dimensional Minkowski space.\footnote{Usually, the Klein-Gordon theory would be obtained as a ``second quantization" of single-particle wavefunctions, without any reparametrization invariance involved at any stage. Indeed, the worldline perspective and the Schwinger proper-time representation of the propagator is useful even in practical QFT calculations \cite{Schubert:1996jj} or exploring the analyticity structure of Feynman diagrams (see Chapter 18 of \cite{Bjorken:1965zz}).} If the worldlines are not allowed to split, we get a free theory. By allowing a worldline to branch into two, and two worldlines to fuse into one, we can get a $\phi^3$ theory in target space. A typical computation in this theory would be to sum over all worldlines, or 1d manifolds $X$, with boundary $\partial X$ consisting of $n+m$ points, and each boundary point labelled by a point in $\mathbb{R}^{1,d-1}$. Picking points $x_1, \ldots, x_m \in \mathbb{R}^{1,d-1}$ to be the ``past" boundaries, and $y_1, \ldots, y_n \in \mathbb{R}^{1,d-1}$ to be the ``future" boundaries, we denote this quantity by \begin{align} \langle y_1 \ldots y_n \, \vert \, x_1 \ldots x_m \rangle := \int_{X : \, |\partial X| = n+m} e^{- I_\text{WL}}=\begin{gathered}\includegraphics[height=3cm]{mtondiag.pdf} \end{gathered} \label{1dgravobs} \end{align} Note that these quantities are the precise analogs of the quantities $\langle Z[\widetilde{J}_1] \ldots Z[\widetilde{J}_n] \, \vert \, Z[J_1] \ldots Z[J_m] \rangle$ considered in \cite{mm} (see their equation (2.5)).\footnote{ In analogy to the well established notation in worldline gravity, we would prefer to denote these quantities as $\langle \widetilde{J}_1 \ldots \widetilde{J}_n \vert J_1 \ldots J_m \rangle$, without the letter $Z$. The reason in \cite{mm} for adopting the notation $Z$ was the anticipation of a boundary dual, but from the perspective of the bulk path integral, it is perhaps more natural to omit the letter $Z$.} These analogies and others that will be discussed below are summarised in table \ref{tab:comparison}. \begin{table}[t] \vspace{10pt} \centering \begin{tabular}{|c|c|} \hline Worldline gravity/Klein-Gordon theory & Worldvolume gravity/Universe field theory\\[4pt]\hline $\mathfrak{S} = \mathbb{R}^{1,d-1}$ & $\mathfrak{S} = \text{superspace}$ \\ $x\in \mathbb{R}^{1,d-1}$ & $J \in \text{superspace}$ \\ $\ket{\text{KG-vac}}$ & $\ket{\rm HH}$\\[4pt] $\ket{x} = \phi(x)\ket{\text{KG-vac}}$ & $\vert J \rangle = \phi(J)\, \vert \text{HH} \rangle$ or $\ket{Z[J]} = \widehat{Z[J]}\ket{\rm HH}$ \\[4pt] $\braket{y|x}$ & $\braket{J_1|J_2}$ or $\braket{Z[J_1]\, |\, Z[J_2]}$ \\[4pt] $\langle \text{KG-vac} \, \vert \phi(x) \phi(y) \, \vert \text{KG-vac}\rangle$ & $\langle \text{HH} \, \vert \phi(J_1)\, \phi(J_2) \, \vert \text{HH} \rangle$ or $\langle \text{HH} \, \vert \widehat{Z[J_1]}\, \widehat{Z[J_2]} \, \vert \text{HH} \rangle$ \\[4pt] $-\Box + m^2 = 0$ & $H_{\rm WdW} = 0$ \\ \hline \end{tabular} \caption{Comparison between objects in worldline gravity, whose third quantization leads to Klein-Gordon theory, and higher-dimensional gravity theories whose third-quantized description should perhaps be called universe field theory, imitating the name string field theory. The word superspace is used like it is used in quantum cosmology, it is the space of spatial metrics modulo spatial diffeomorphisms. In general, $\mathfrak{S}$ is the space of boundary conditions in the ``worldvolume path integral", and each element of $\mathfrak{S}$ represents a boundary condition that can be imposed on a single connected component of the boundary. The notation involving $Z[J]$'s is due to \cite{mm}. } \label{tab:comparison} \end{table} The simplest nonzero quantity of the form (\ref{1dgravobs}) corresponds to just having one point in the past and one point in the future. It is well-known that this computes the Klein-Gordon propagator:\footnote{Depending on the range of integration of the lapse variable, we can either get two-point functions that obey the homogeneous Klein-Gordon equation, or two-point functions that obey the Klein-Gordon equation with a delta-function source. For details, see, for example \cite{PhysRevD.38.2468}. Notice also that the states $\ket{x}$ are not orthonormal. See also \cite{Cohen:1985sm} for an analogous computation of the off-shell propagator for strings in a special case.} \begin{align} \langle y \vert x\rangle = \langle \text{KG-vac} \, \vert \, \phi(y) \phi(x) \, \vert\, \text{KG-vac}\rangle\, , \label{propwlkg} \end{align} with $\ket{\text{KG-vac}}$ the standard Klein-Gordon vacuum. Similarly, the general quantity in (\ref{1dgravobs}) will compute an $(n+m)$-point function in the Klein-Gordon theory. The relation (\ref{propwlkg}) and similar expressions for the higher point functions make it clear that the usual Klein-Gordon vacuum state $\vert \text{KG-vac} \rangle$ is the precise analog of the Hartle-Hawking state $\vert \rm{HH} \rangle$ \cite{Hartle:1983ai}, and also that the field operators $\phi(x)$ are the precise analogs of what were called the $\widehat{Z[J]}$ operators in \cite{mm}. See table \ref{tab:comparison} and section \ref{sec:mainArgument} for some more details. With the benefit of hindsight and because of this direct analogy to the Klein-Gordon theory, perhaps $\phi(J)$ is a better notation for $\widehat{Z[J]}$. Below we will use $\phi(J)$ and $\widehat{Z[J]}$ interchangeably. Null states, which played a crucial role in \cite{mm}, also exist in this 1d gravity model. To see this, note that the field operator $\phi(x)$ is labeled by a point $x$ in $\mathbb{R}^{1,d-1}$, it is not restricted to a single Cauchy slice. However, the hyperbolic nature of the Klein-Gordon equation allows us to relate the field operator $\phi(t,\mathbf{x})$ to a linear combination of $\phi(0,\mathbf{x})$, and these relationships give rise to null states. The Klein-Gordon equation in this model is the analog of the Wheeler-DeWitt equation in higher-dimensions. In general, if we have some reparametrization-invariant path integral with some set $\mathfrak{S}$ of allowed boundary conditions, then we should consider $\mathfrak{S}$ as our ``target spacetime" and the collection of field operators would be $\phi(J)$ for every $J \in \mathfrak{S}$. The role of $\phi(J)$ is to insert a boundary in the ``worldvolume" path integral with boundary condition $J$. Note also that in general the space $\mathfrak{S}$ is infinite dimensional, has no symmetries, and can have an infinite number of negative signs in its metric signature. For $D$-dimensional gravity,\footnote{Note that we are deliberately using $D$ here, rather than $d$, to distinguish it from the target space of worldline gravity.} the space $\mathfrak{S}$ is called superspace and consists of all $(D-1)$-metrics $h_{ij}(\sigma)$ modulo parallel diffeomorphisms. Here $\sigma$ denotes the collection of $D-1$ coordinates on the worldvolume. The Wheeler-DeWitt equation is a functional differential equation, and it resembles a Laplacian on a space with an infinite number of timelike directions. It is a well-known fact that the conformal factor of $h_{ij}(\sigma)$ for each $\sigma$ corresponds to a time-like direction in $\mathfrak{S}$, along which the line-element is negative. One can further speculate whether there is some notion analogous to a Cauchy slice in QFT, i.e. a subset $\mathfrak{C} \subset \mathfrak{S}$ such that the collection of field operators $\phi(J)$ with $J \in \mathfrak{C}$ constitutes the linearly independent field operators. To make things a bit more concrete, a useful example to keep in mind is JT gravity with a positive cosmological constant. This theory was discussed in detail in \cite{Maldacena:2019cbz, Cotler:2019nbi} (see also \cite{Iliesiu:2020zld}) and describes the fluctuations of a boundary mode in rigid dS$_2$. The superspace $\mathfrak{S}$ consists of a variable corresponding to the boundary length $\ell$ (which is all that remains of $h_{ij}(\sigma)$ after gauge-fixing the spatial diffeomorphisms), and the dilaton profile $\Phi(\sigma)$. In the minisuperspace approximation, where $\Phi$ is taken to be constant, $\mathfrak{S}$ reduces to two-dimensional Minksowki space and the Wheeler-DeWitt equation is a Klein-Gordon equation for a massive charged scalar in an electric field. The null states would therefore be analogous to the ones found in the 1d gravity theory. \subsection{Commutativity of operators, and operator products} A very important claim of \cite{mm} is that, for any $J_1, J_2 \in \mathfrak{S}$, the operators $\widehat{Z[J_1]}$ and $\widehat{Z[J_2]}$ commute. These operators can thus be simultaneously diagonalized to yield a basis of the so-called alpha states. In the boundary dual description, each alpha parameter labels a member of an ensemble of theories, and the eigenvalue of $\widehat{Z[J]}$ in an individual alpha state is interpreted as the numerical value of the partition function $Z[J]$ in a specific boundary theory. The argument in \cite{mm} (see the discussion around their equation (2.16)) for the commutativity of $\widehat{Z[J_1]}$ and $\widehat{Z[J_2]}$ for any $J_1, J_2 \in \mathfrak{S}$ operators is based on the fact that exchanging the two boundaries corresponding to $J_1$ and $J_2$ does nothing to the path integral. We want to point out that this argument is perhaps too quick, and that the statement of commutativity deserves a more careful analysis. Recall that in the Klein-Gordon theory, we have \begin{align} [\phi(t_1,\mathbf{x}_1) , \phi(t_2,\mathbf{x}_2) ] \neq 0 \end{align} if the points $(t_1, \mathbf{x}_1)$ and $(t_2, \mathbf{x}_2)$ are timelike separated. This is a seeming counterexample to the above claim about the commutativity of any two of the $\widehat{Z[J]}$ operators. Note however that if the target space in the Klein-Gordon theory is Wick-rotated to Euclidean signature, these operators do commute. This fact will be discussed more completely in an upcoming publication \cite{mmupcoming}, where it will be argued that, at least in this respect, the universe field theory is more similar to QFT in Euclidean signature.\footnote{We thank Don Marolf and Henry Maxfield for correspondence on this point.} Here, we just want to point out that this is a subtle issue that involves analytic continuations in the target space $\mathfrak{S}$. In this context, see also section 8 of \cite{Giddings:1988wv} (especially the discussion around their equation (8.5)) which takes the view that the boundary-creating operators do not commute in general, even in higher-dimensional gravity. It is interesting to note that the theories dual to AdS are conformal, and hence their partition functions only depend on the conformal class of the boundary metric, with the anomaly coefficients of the boundary encoded in the bulk coupling constants. In other words, the dependence of $Z[J]$ on the ``timelike" directions in $\mathfrak{S}$ seems to be completely determined from a subset $\mathfrak{C} \subset \mathfrak{S}$. Thus, in order to retain the ensemble interpretation needed in AdS, it might be enough that the field operators $\widehat{Z[J_1]}$ and $\widehat{Z[J_2]}$ commute only whenever $J_1, J_2 \in \mathfrak{C} \subset \mathfrak{S}$. This last property is indeed true even in the Lorentzian Klein-Gordon theory with $\mathfrak{C} = \mathbb{R}^{d-1}$ and $\mathfrak{S} = \mathbb{R}^{1,d-1}$. Another interesting question is about singularities in operator products. It is well-known that operator products in Euclidean QFT have singularities as the two operator insertions becomes coincident. These singularities become branch cuts on the lightcone when continued to Lorentzian signature, and these branch cuts give rise to nonzero commutators when operators become timelike separated. Relatedly, if we are given a list of correlators $\langle \text{KG-vac} \vert \phi(t_1, \mathbf{x}_1) \ldots \phi(t_n, \mathbf{x}_n) \vert \text{KG-vac} \rangle$ for all $n$ and all $(t_i, \mathbf{x}_i)$ in a pertubative scalar field theory, we can take derivatives with respect to $t_i$ and get correlators involving the conjugate field $\pi(t_i, \mathbf{x}_i)$.\footnote{We thank Douglas Stanford for asking us about the canonical momentum operator.} Thus, from the perspective of worldline gravity, computing correlators of $\pi$ involves computing the change in the path integral when we perturb the boundary conditions $J \in \mathfrak{S}$. Note that the canonical commutation relation between $\phi$ and $\pi$ could be determined from these correlators. Thus, it is an interesting question to ask in universe field theory whether there are any singularities in the operator product $\phi(J_1) \phi(J_2) = \widehat{Z[J_1]} \, \widehat{Z[J_2]}$ in the coincident limit $J_1 \to J_2$. If this operator product is singular, generically there should be operators acting on $\mathcal{H}_\text{BU}$ that do not commute with $\widehat{Z[J]}$. If the theory is furthermore weakly coupled, we could take derivatives along some direction in $\mathfrak{S}$ and construct an analog of an operator $\pi(J)$, which is canonically conjugate to $\phi(J)$. On the other hand, if operator products in the universe field theory are completely non-singular, the operator algebra will be Abelian. This latter possibility would be a desirable result, because, in gravity theories that have a boundary dual (which in general, could be a disorder-averaged theory), it is hard to give a boundary interpretation to the operators that do not commute with $\widehat{Z[J]}$ \cite{mm}. These OPE-type coincidence singularities exist for loop operators \cite{Banks:1989df} in minimal string theory, at least in the genus expansion. Concretely, the operator to consider is the density of eigenvalues of the matrix integral, written in third-quantized notation as $\widehat{\rho(x)}$. The operator $\widehat{\rho(x)}$ is just a specific example of the general $\widehat{Z[J]}$ operator. The eigenvalue direction $x$ of the dual matrix integral is known to be the target space coordinate for $\mathfrak{S}$ in minimal string theories \cite{Maldacena:2004sn}, and is thus the appropriate ``position-space" variable to diagnose the coincidence limit. Perturbatively, we have $\widehat{\rho(x)} \widehat{\rho(y)} \sim -{(x-y)^{-2}}$; see, for example, equation (139) in \cite{sss2}.\footnote{We thank Douglas Stanford for pointing this out.} Akin to singularities in a BCFT as operators approach the boundary, there are also singularities in the loop operators as $x \to 0$, which is a boundary of $\mathfrak{S}$ in perturbation theory. Thus, at least perturbatively, there exist operators that do not commute with $\widehat{\rho(x)}$. In the string field theory of the $c=1$ matrix model \cite{Das:1990kaa} this becomes completely explicit: The density of eigenvalues is taken to be the field variable, and this field also has a canonical momentum. It is interesting that, non-perturbatively, the two-point function of $\widehat{\rho(x)}$ gets corrected and is replaced by the sine-kernel which washes out the $(x-y)^{-2}$ singularity. It thus remains an open possibility that non-perturbative effects in gravity remove all such OPE-type singularities, and all the $\widehat{Z[J]}$ operators commute. \subsection{Relation to the GNS construction} \label{sec-gns} The procedure described in \cite{mm} for constructing the third-quantized Hilbert space is analogous to the Gelfand-Naimark-Segal (GNS) construction in algebraic quantum field theory; see theorem 2.34 of \cite{Pontello:2020csg} for a brief explanation of the GNS construction and for more references. In the GNS construction, we are given an algebra of operators and a state $\omega$, which is defined abstractly as a positive linear map from the operator algebra into $\mathbb{C}$. In \cite{mm}, the algebra includes all sums of products of the field operators $\phi(J)$, and the state is the linear map that maps the product $\phi(J_1) \ldots \phi(J_n)$ to the complex number computed by the worldvolume path integral with boundaries corresponding to $J_1, \ldots, J_n$. The GNS method first constructs a pre-Hilbert space, which is the span of all formal kets $\ket{A}$, where $A$ is any operator in the algebra. The inner product is defined as $\langle A \vert B \rangle := \omega(A^* B)$. This pre-Hilbert space contains null vectors, which are modded out to give the GNS Hilbert space.\footnote{Technically, one also needs to add appropriate limit points to ensure completeness (in the sense of a metric space).} This makes the analogy to \cite{mm} clear. Notice that this construction of the Hilbert space takes as input \emph{all} correlation functions in a \emph{single} state. See also the recent paper \cite{monicagns} for more on the relationship between the GNS construction and baby universes. \section{Global states in the third-quantized Hilbert space} \label{sec:mainArgument} \newcommand{\Psi_\text{HH}}{\Psi_\text{HH}} \newcommand{\rho_\text{Page}}{\rho_\text{Page}} In this section, we discuss various possibilities for the choice of a global state in the third-quantized Hilbert space $\mathcal{H}_\text{BU}$. Hartle and Hawking \cite{Hartle:1983ai} constructed a particular state $\ket{\text{HH}}$ in the third-quantized Hilbert space, as follows. Consider a $D$-dimensional theory of gravity. Let $Y$ denote a closed $(D-1)$-dimensional manifold, \emph{not necessarily connected}. The Hartle-Hawking state is a function that assigns a complex number to each closed $(D-1)$-manifold $Y$ \begin{align} \Psi_\text{HH} (Y) := \int_{X: \partial X = Y} e^{-I(X)}\,, \label{hhstate} \end{align} where the integration is to be done over all $D$-manifolds $X$ such that $\partial X = Y$. We work with unnormalized states and density matrices. The analogous object in the worldline theory is \begin{align} \Psi_{\text{KG-vac}} (x_1, \ldots, x_n) := \int_{X: \vert \partial X \vert = n} e^{-I_\text{WL}}\,, \label{kgstate} \end{align} where $X$ is a one-dimensional manifold and $x_i \in \mathbb{R}^{1,d-1}$. Note that $\Psi_{\text{KG-vac}}$ depends on the tuple $(x_1, \ldots, x_n)$, and the non-negative integer $n$ is arbitrary. Note that (\ref{hhstate}) is equal to the correlation function $\bra{\text{HH}} \phi(w_1) \ldots \phi(w_n) \ket{\text{HH}}$ where $w_1, \ldots w_n$ are the connected components of $Y$, and that (\ref{kgstate}) is equal to the correlation function $\bra{\text{KG-vac}} \phi(x_1) \ldots \phi(x_n) \ket{\text{KG-vac}}$. Both (\ref{hhstate}) and (\ref{kgstate}) can be thought of as expressing the wavefunction in an overcomplete set of non-orthonormal states. The Klein-Gordon vacuum state would usually be written in the orthonormal basis of eigenstates of the field operators $\phi(\mathbf{x})$ as $\langle \phi(\mathbf{x}) \vert \text{KG-vac}\rangle$, but (\ref{kgstate}) is also correct, and is directly analogous to (\ref{hhstate}) \cite{Hartle:1983ai}. See section \ref{sec-gns} for more details about how all correlation functions in a single state encode the full Hilbert space. The analog of $\langle \phi(\mathbf{x}) \vert \text{KG-vac}\rangle$ in the universe field theory is $\langle \alpha \vert \text{HH} \rangle$ \cite{mm}. In \cite{Page:1986vw}, Page proposed a state for the universe, which is \emph{different} than the state proposed by Hartle and Hawking in \cite{Hartle:1983ai}. Page's state is a density matrix $\rho_\text{Page}$ whose components (in an overcomplete non-orthonormal basis) are given by \begin{align} \rho_\text{Page}(Y_1, Y_2) := \int_{X: \partial X = \overline{Y_1} \cup Y_2}\, e^{- I(X)}\,. \label{pageconj} \end{align} Again, we emphasize that neither $Y_1$ nor $Y_2$ is required to be connected, and in general they have different numbers of connected components. The overline indicates orientation reversal and accounts for complex conjugation in the bra. Note that the right hand side of (\ref{pageconj}) is the same as the object $\langle Y_1 \vert Y_2 \rangle$. The punchline of \cite{Page:1986vw} is that because there exist Euclidean wormholes $X$ that connect $Y_1$ and $Y_2$, these configurations enter the path integral on the right hand side of (\ref{pageconj}) and render the state $\rho_\text{Page}$ mixed. Next, we actually note that\footnote{We thank Don Marolf and Henry Maxfield for discussions on this point.} \begin{align} \rho_\text{Page} = \mathbb{1}_{\mathcal{H}_\text{BU}} \,, \label{rhopageequalid} \end{align} where $\mathbb{1}_{\mathcal{H}_\text{BU}}$ is the identity matrix on the baby universe Hilbert space.\footnote{Note that this density matrix is ill-defined if the Hilbert space is infinite dimensional.} This is true, because, according to (\ref{pageconj}), $\rho_\text{Page}(Y_1, Y_2) = \braket{Y_1\vert Y_2}$ with \emph{nothing} else inserted in the path integral. In particular, if $\text{dim } \mathcal{H}_\text{BU}>1$, we see that \begin{align} \rho_\text{Page} \neq \vert \text{HH} \rangle \, \langle \text{HH} \vert\, . \label{pageneqhh} \end{align} In more detail, note that the components of the density matrix corresponding to $\ket{\text{HH}}$ are given by \begin{align}\label{proposalrho} \rho_\text{HH}(Y_1,Y_2) = \Psi_{\rm HH}(Y_1)^* \, \Psi_{\rm HH}(Y_2)~. \end{align} The right hand side of (\ref{proposalrho}) is a product of two independent path integrals, \emph{without any wormholes connecting} $Y_1$ and $Y_2$. This is simply because $\Psi_\text{HH}(Y_1)$ and $\Psi_\text{HH}(Y_2)$ are well-defined objects that have already been defined in (\ref{hhstate}). We cannot add additional wormholes between $Y_1$ and $Y_2$. The difference between $\rho_{\rm page}$ and $\rho_{\rm HH}$ is illustrated in figure \ref{fig:pageHH}, as also originally noted in \cite{Page:1986vw}. \begin{figure}[t] \centering \includegraphics[width=\textwidth]{pageHH.pdf} \caption{The difference between the Page density matrix $\rho_{\rm Page}$ and the density matrix $\rho_{\rm HH}$ corresponding to $\ket{\text{HH}}$. This figure depicts contributions to a particular matrix element of these density matrices in two-dimensional gravity where a general $Y$ is a union of disconnected circles. In red we indicated the bra and in blue the ket. In the Page density matrix (\ref{pageconj}) \cite{Page:1986vw}, bra-ket wormholes are present, whereas they are absent in the density matrix for the Hartle-Hawking state (\ref{proposalrho}) \cite{Hartle:1983ai}. In particular, the set of configurations that contribute to $\rho_\text{Page}(Y_1, Y_2)$ is a superset of the configurations that contribute to $\rho_\text{HH}(Y_1, Y_2)$. } \label{fig:pageHH} \end{figure} We believe this point should be non-controversial, but nevertheless it is important to highlight because it has important consequences. For instance, there has been much recent work on the the spectral form factor in JT gravity, and its non-factorization $\langle Z(\beta_1) Z(\beta_2)\rangle \neq \langle Z(\beta_1) \rangle\, \langle Z(\beta_2)\rangle$ \cite{largen, sss1, sss2}. Here the left hand side is equal to $\langle \text{HH} \vert \widehat{Z(\beta_1)}\widehat{Z(\beta_2)} \vert \text{HH} \rangle$, whereas the right hand side is equal to $\langle Z(\beta_1) \vert \text{HH} \rangle \langle \text{HH} \vert Z(\beta_2) \rangle $. If we allowed wormholes connecting $Y_1$ and $Y_2$ on the right hand side of (\ref{proposalrho}), we would also say that $\langle Z(\beta_1) \vert \text{HH} \rangle \langle \text{HH} \vert Z(\beta_2) \rangle $ is computed by a two-boundary quantity with all possible wormholes connecting the two $Z$ insertions. This sum would thus be exactly the same as $\langle \text{HH} \vert \widehat{Z(\beta_1)}\widehat{Z(\beta_2)} \vert \text{HH} \rangle$, and there would be no factorization puzzle. If we allowed wormholes between products like that on the right hand side of (\ref{proposalrho}), the variance of all boundary-creating operators (which are all the operators) would be zero, and we would conclude that the third-quantized Hilbert space is one-dimensional. Even though it would be desirable to prove that $\text{dim}\, \mathcal{H}_\text{BU} = 1$,\footnote{This statement has recently been included as a swampland conjecture \cite{McNamara:2020uza}.} this line of argumentation of connecting everything to everything is flawed. Let us also comment on the density matrix considered in Hawking's paper \cite{Hawking:1986vj}, which was contemporaneous to \cite{Page:1986vw}. Hawking considers tracing out all connected components of the spatial manifold except ``our own" connected universe, and interprets this object as the density matrix of the universe in which we live. This is necessarily an approximate notion of a density matrix that would only make sense, for instance, at late times in de Sitter space. See also section \ref{sec-oneuniv} below. Instead, the object considered by Hawking is more appropriately identified as a two-boundary correlation function in the state $\ket{\text{HH}}$. \section{Implications} \label{sec:implications} In the previous section we saw that the choice of a global state in the third-quantized Hilbert space defines what bra-ket wormholes can contribute. We will now discuss two applications. The first is to clarify what wormhole contributions are present in entropy computations, and the second is to discuss how approximate wormholes could arise when restricting to a single large connected universe. \subsection{Bra-ket wormholes in entropy computations} \label{sec:renyi} Let us say we want to compute the quantity $(\text{Tr}\rho)^n$ where $\rho$ is a state on $\mathcal{H}_\text{BU}$. The first point we want to emphasize is that before we try to compute $(\text{Tr}\rho)^n$, we should first specify which $\rho$ we are talking about. In general, $\text{dim }\mathcal{H}_{\text{BU}} > 1$ and the global state of the universe can be chosen from an infinite number of possibilities. So, let us pick a particular $\rho$, which means that we have a definite rule for computing $\rho(Y_1, Y_2)$ for each choice of $Y_1$ and $Y_2$. For example, we could pick $\rho_\text{Page}$ which is defined in (\ref{pageconj}), or we could pick $\rho_\text{HH}$ which is defined in (\ref{hhstate}) and (\ref{proposalrho}). Now, following the exact same logic as in the previous section, while computing $(\sum_Y\rho(Y,Y))^n$ we may not freely add wormholes connecting an arbitrary subset of the various connected components of the $2n$ insertions of $Y$. By specifying the state $\rho$ in question, the quantity $\rho(Y,Y)$ is completely well-defined (and it may or may not include bra-ket wormholes depending on what $\rho$ we picked). In particular, the definition of $(\sum_Y\rho(Y,Y))^n$ is unambiguous: We should simply compute $\rho(Y,Y)$ for each $Y$ using the particular gravitational path integral in the definition of $\rho$, do the explicit sum over $Y$ by hand, and raise it to the $n$-th power. Similar comments apply to $\text{Tr}(\rho^n)$. The quantity $\sum_{Y_1, \ldots, Y_n} \rho(Y_1, Y_2) \ldots \rho(Y_n, Y_1)$ is unambiguously defined once we have specified the gravitational path integral that computes $\rho(Y_1, Y_2)$. It might seem like $\text{Tr}(\rho^n)$ and $(\text{Tr}\rho)^n$ are both computed by the same gravity path integral \cite{pssy},\footnote{Note that \cite{pssy} restricted to the case when $Y$ is connected, see section \ref{sec-oneuniv} for this case.} leading one to believe that they are equal for any choice of $\rho$. However, this reasoning is incorrect, because the only wormholes that can possibly appear are in the computation of the individual quantities $\rho(Y_1, Y_2)$, and then we should use the sums $\sum_{Y_1, \ldots, Y_n} \rho(Y_1, Y_2) \ldots \rho(Y_n, Y_1)$ and $(\sum_Y\rho(Y,Y))^n$ as the definitions $\text{Tr}(\rho^n)$ and $(\text{Tr}\rho)^n$, respectively. For example, to reiterate our basic point, bra-ket wormholes are present in the gravitational path integral that computes $\rho_{\text{Page}}(Y_1, Y_2)$, while they are not present in the gravitational path integral that computes $\rho_{\text{HH}}(Y_1, Y_2)$. Similarly, before discussing wormholes of the sort in section 6 of \cite{pssy} or in \cite{cgmupcoming}, which refer to one-universe density matrices, we first need to specify the global state $\rho$ in the universe field theory. In section \ref{sec-oneuniv}, we discuss how such wormholes can be ``emergent" in special cases, even if they are not present in the original definition of $\rho$. \subsection{Relation to entropy computations in holographic QFTs} \label{sec:adsaitorjuan} The Ryu-Takayanagi formula \cite{Ryu:2006bv, Casini:2011kv, Lewkowycz:2013nqa, Engelhardt:2014gca, Dong:2017xht} and its recent extensions involving ``bath" regions with non-dynamical gravity \cite{Penington:2019npb, Almheiri:2019psf, pssy, Almheiri:2019qdq, Almheiri:2020cfm} compute entropies defined purely in the dual quantum-mechanical system which has no gravity. Conceptually, this is a very different quantity than computing the entropy of $\rho_\text{Page}$ or $\rho_\text{HH}$. The density matrix whose entropy we want to compute in the AdS context is a state in the \emph{boundary} Hilbert space, whereas $\rho_\text{HH}$ and $\rho_{\text{Page}}$ are states in the baby universe Hilbert space $\mathcal{H}_{\text{BU}}$. This is a fundamental difference, and we will denote density matrices in the boundary (plus bath, if present) Hilbert space by $\rho_\text{CFT}$. For entropy calculations in a holographic QFT (plus bath, if present), we follow \cite{Lewkowycz:2013nqa} to first set up the replica trick purely in the non-gravitational description, and then ask what is the gravity dual of this calculation. In particular, in the third-quantized language of \cite{mm}, we would be computing expectation values of the Renyi-entropy ``operator", i.e. quantities like $\langle \text{HH} \vert \, \widehat{\text{Tr}(\rho_\text{CFT}^n)} \,\vert \text{HH} \rangle$. The Renyi entropies of boundary density matrices, or individual matrix elements of $\rho_{\text{CFT}}$, become third-quantized operators acting on $\mathcal{H}_{\text{BU}}$. This is exactly analogous to the operator on the left hand side of equation (3.42) in \cite{mm}. By definition of $\ket{\text{HH}}$, there are wormholes connecting all the boundaries in the computation of $\langle \text{HH} \vert \, \widehat{\text{Tr}(\rho_\text{CFT}^n)} \,\vert \text{HH} \rangle$. In the context of this paper or section 6 of \cite{pssy}, the quantities under consideration were the entropies of states in $\mathcal{H}_\text{BU}$, i.e. quantities of the form $\text{Tr}(\rho_\text{HH}^n)$ or $\text{Tr}(\rho_\text{Page}^n)$. In AdS, the quantities analogous to this would be \begin{align} \sum_{\{\beta_1\ldots \beta_n\}} \big\langle Z(\beta_1) Z(\beta_2) \big\rangle \, \big\langle Z(\beta_2) Z(\beta_3) \big\rangle \ldots \big\langle Z(\beta_{n}) Z(\beta_1) \big\rangle \, . \end{align} In this quantity there are no wormholes connecting all $2n$ of these insertions, but only wormholes connecting the two $Z$'s within a single $\langle \cdots \rangle$. \subsection{Comments on single-universe observables} \label{sec-oneuniv} In inflationary physics, the two-point function of perturbative fields in a single connected universe plays a central role \cite{Maldacena:2002vr}. There is a regime in which such observables should be well-defined: a large classical universe with highly suppressed topology fluctuations, in which we can make sense of inflationary correlators, as well as the density matrix discussed in \cite{Hawking:1986vj, pssy}. In the worldline gravity example considered in section \ref{sec:worldline}, and allowing worldlines allowed to split, this approximation is valid when the particles are very heavy and particle production is suppressed. In this regime, the position and momentum operators of a single particle become well-defined. A single connected (late-time) universe is the scenario considered in section 6 of \cite{pssy} and in \cite{cgmupcoming}, so let us see what our observations imply about this setting. The idea is that we want to define a density matrix for a single universe, for instance via \begin{align} \rho_{\text{1-univ}} (w, w') := \sum_{Y} \rho(w \cup Y, w' \cup Y)\, , \label{rholate} \end{align} where $w$ and $w'$ label a complete set of configurations of single-universe states, and $Y$ denotes the configurations of the ``other" universes.\footnote{The equation (\ref{rholate}) is correct even though the $Y$'s do not form an orthonormal basis. This is related to the fact, nicely explained in \cite{mm}, that the path integral computes inner products, and sidesteps the complications of specifying an orthonormal basis for Hilbert space. In other words, cutting the gravitational path integral still provides us with a resolution of the identity, albeit in a non-orthonormal basis.} Note that this split between our universe and other universes becomes arbitrarily good in an appropriate regime, such as late times in de Sitter. Note that there is \emph{still} some choice of $\rho$ involved on the right hand side of (\ref{rholate}), which could be $\rho_\text{HH}$, $\rho_\text{Page}$, etc. \begin{figure} \centering \includegraphics[width=\textwidth]{EffectiveWormholev2.pdf} \caption{Representation of $\rho_{\text{1-univ}}(w,w')$ in (\ref{rholate}) with $\rho = \rho_{\text{HH}}$. Recall that $Y$ is not necessarily connected. For an appropriate choice of state and model, the sum over $Y$ can give rise to an approximate ``effective" wormhole between $w$ and $w'$ \cite{diagcyl, Blommaert:2019wfy}.} \label{fig:effectiveWormhole} \end{figure} We can now ask the question whether the sum over $Y$ in (\ref{rholate}) leads to an effective wormhole between $w$ and $w'$, even for states like $\rho_\text{HH}$ as in (\ref{proposalrho}) which do not have an explicit wormhole between $w$ and $w'$ in their fundamental definition. As pointed out in \cite{diagcyl}, having effective wormholes is possible, though this likely depends on the choice of the state $\rho$ and the details of the gravitational model. The bra-ket wormhole discussed in equation (6.2) of \cite{pssy} plays an important role in avoiding a bags-of-gold type paradox in de Sitter space. Such wormholes have also recently been shown to prevent violations of strong subadditivity of entropy \cite{cgmupcoming}. Our view is that these wormholes, if not already present in $\rho$, must be emergent: The sum over $Y$ in the definition (\ref{rholate}) of $\rho_{\text{1-univ}} (w, w')$ should lead to approximate geometric connections between the bra $w$ and the ket $w'$, as in figure \ref{fig:effectiveWormhole}. In principle, this could happen even for states such as $\rho_\text{HH}$ that do not have these bra-ket type wormholes in their definition. Note that this approximate geometric connection will generically not be equal to the original cylindrical geometry between $w$ and $w'$, if the latter exists in the definition of $\rho$ (an example of such a case would be $\rho_\text{Page}$). This is analogous to the diagonal piece in the sum over periodic orbits in the spectral form factor giving rise to a cylinder \cite{sss2, pssy}, and the ``diagonal = cylinder" identity derived in the setup of \cite{diagcyl}. See also \cite{Blommaert:2019wfy}. A more drastic possibility is for $\rho_{\text{HH}}$ to be non-perturbatively gauge equivalent to some state with bra-ket wormholes (which need not be $\rho_\text{Page}$).\footnote{This might seem surprising, but the gauge redundancies in gravity are strong \cite{mm, Jafferis:2017tiu} and need to be explored further.} An extreme possibility is that $\text{dim }\mathcal{H}_\text{BU} = 1$, a condition which is equivalent to the condition that $\rho_{\text{HH}}$ and $\rho_\text{Page}$ be gauge equivalent to each other.\footnote{This is because $\rho_\text{Page} = \mathbb{1}_{\mathcal{H}_\text{BU}}$ (\ref{rhopageequalid}) and $\rho_\text{HH}$ is pure. So if $\rho_\text{HH}$ is gauge equivalent to $\rho_\text{Page}$, $\ket{\text{HH}}$ is the only state in $\mathcal{H}_\text{BU}$.} In order to compute the Renyi entropies of $\rho_\text{1-univ}$, one would follow the idea described in section \ref{sec:renyi}. One would first compute the matrix elements $\rho_\text{1-univ}(w,w')$ using (\ref{rholate}), and then explicitly compute the sums in the index contractions in $\text{Tr}(\rho_\text{1-univ}^n)$. The recent paper by Giddings and Turiaci \cite{Giddings:2020yes} also contained some expressions similar to ours. Their equation (3.5) is similar to our (\ref{rholate}), and their equation (3.8) is arguing for computing the Renyi entropies of $\rho_{\text{1-univ}}$ just like we have described. However, we believe that the LHS of their equation (3.10) should be replaced by $\langle \text{HH} \vert \, \widehat{\text{Tr}(\rho_\text{CFT}^n)} \,\vert \text{HH} \rangle$, like we discussed in section \ref{sec:adsaitorjuan}. In particular, we are in complete agreement with \cite{pssy, Almheiri:2019qdq} for computing Renyi entropies of $\rho_\text{CFT}$ (states of the boundary system, possibly coupled to a bath). A brief comment about entanglement entropy in the worldvolume theory. Usually, one computes the entanglement properties of a QFT by considering a complete set of states on a Cauchy slice in spacetime. But one could imagine special states in which the entanglement could be computed by considering worldlines of heavy particles. For instance, the particles could have two-internal states, and we might consider an EPR state of two such heavy particles. See \cite{Mazenc:2019ety} for some work in this direction. The same comments should apply to the universe field theory; there should be a limit in which the entropies of subregions on the worldvolume become well-defined. \paragraph{Acknowledgments.} We thank Dionysios Anninos, Austin Joyce, Adam Levine, Juan Maldacena, Don Marolf, Henry Maxfield, Edgar Shaghoulian, Steve Shenker, Douglas Stanford, John Stout, Zhenbin Yang and Ying Zhao for insightful discussions, and Edgar Shaghoulian for comments on the draft. TA is supported by the Delta ITP consortium, a program of the Netherlands Organisation for Scientific Research (NWO) that is funded by the Dutch Ministry of Education, Culture and Science (OCW). JK is supported by the Simons Foundation. This research was supported in part by the National Science Foundation under Grant No. NSF PHY-1748958. \small \bibliographystyle{apsrev4-1long}
\section{Introduction} The increase in speed and intensity of movement of trains on the tracks, caused an increase in quality control requirements. At the same time, the time of the control, data processing, analysis and decision-making on the admission of the railway is reduced. Integrity monitoring includes the detection of any internal defects: cracks, voids, delamination, loss of integrity of connections, etc. It is crucial to prevent disasters and encure the stability of rail transport. In this regard, the development of automation systems, new models and methods for finding defects in real-time mode is relevant. One of the classic means of scanning railway rails is the use of ultrasound. Various methods are used to decipher ultrasonic defectograms of the rails. Starting from manual, methods based on the analysis of physical principles and ending with tools for analyzing various types of graphical presentation. This article discusses a method for analyzing and identifying defects using machine learning tools. A graphical representation of ultrasonic defectograms is considered as data for analysis. \section{Subject matter and system requirements} During the last 5 years, ultrasonic devices have appeared on the market that allow for high-speed testing of railway rails. Controls systems include the detection and registration of defects in real time, as well as the complete recording of scanned data. These data can be used for periodic monitoring of the state of the railway, by identifying defects in the controlled object with the necessary accuracy and reliability. With the manual method of decoding the visual appearance of defectograms obtained during ultrasound testing, experts are involved. In this case, the main disadvantages are the presence of factors that influence the results obtained. These factors can be: qualification, affentiveness, physical and mental state of a person, etc. Given the large volume and complexity of the visual presentation of data, manual processing performance is very low. Moreover, in recent years, to facilitate the work of specialists, tools have been developed to facilitate the proccessing of large amounts of data \cite{Armbruster}, such as: - data output in a convenient view; - filtering noise signals, for a clearer visualization of areas that may contain defects; - means of classification based on harsh conditions. All these tools accelerate data processing, but in modern conditions do not meet the requirements: - by definition time; - by the percentage of defects detected; - at the time of the decision; - in automated systems, the presence of stringent conditions does not allow to determine all types of defects in the presence of various characteristics of detects; - there is no possibility to conduct an analysis in the mode / speed of receipt of data from the flaw detector sensors. These funds also do not allow for the full and for all identified and possible cases of comparative and periodic monitoring. The level of development of machine learning systems, in particular, neural network algorithms and hardware, make it possible to organize their use for solving the above problem. Development of an automated identification systems (AIS) based on a neural network, which will allow to solve the problem of identifying and classifying defects without imposing restrictions on the input data \cite{Bettayeb2008}. Such a system allows to increase the effeciency of rail monitoring, to organize control in the mode of data entry into the systems, as well as to increase the reliability and accuracy of the results obtained by minimizing the influence of subjective factors. To achieve its goals, AIS must meet the following requirements: - work with single-channel and multichannel ultrasound control systems; - the ability to identify and classify all types of defects in the subject area; - the computational complexity of the algorithms used should ensure that results are obtained in real time when implemented on modern hardware platforms (including parallel ones) with the speed of movement of scanning platforms up to 110 km/h. \section{System description} Scanning probes are located on a special mechanical skid on the front wheel pair (Fig.1) \begin{figure}[h] \includegraphics[width=\linewidth]{fig1} \caption{Ultrasound diagnosis system} \end{figure} When determining the location of the defect in the calculations, the position of each probe relative to the zero position of the system is taken. In this case, the angle of inclination of the sensor is not taken into account, therefore the indication of the depth of the defect and the real position along the scanning axes do not correspond to its actual location in the rail being diagnosed. This is done to simplify the identification of defects, as show in Fig.2. \begin{figure}[h!] \includegraphics[width=\textwidth]{fig2} \caption{Identification of defects} \end{figure} The indications exicting in the railway can be divided into two large classes: technological and defects. To technological include: bolted joints, joints and welds. The defects are: horizontal crack of the rail head, delamination of the rail head, detachment of the rail bottom, crack in the neck of the rail, emptiness in the weld, vertical crack of the rails, cracks in bolted joints (star cracks). Also, defects can be displaced not only in a vertical plane, but also have a horizontal displacement relative to the central axis in the rail head. Each type of defect gives an indication not on all channels of the probes, but only at certain angles (Table 1). Using this feature allows you to combine information on the measuring channel in accordance with the type of defect, this can significantly reduce the amount of information supplied to the appropriate classifier and thereby significantly increase the overall speed of the system. \begin{table}[h] \caption{Combining sensor data} \begin{tabular}{| c | c | c |} \hline N & Sensor combination & Detectable defect types \\ \hline 1 & $0^o$ & Horizontal cracks in the head, neck and foot rail \\ \hline 2 & $\pm70^o$ & Transverse cracks in the head, neck and foot rail \\ \hline 3 & $0^o, \pm35^o, \pm70^o$ & Bolt holes \\ \hline 4 & $0^o, \pm35^o$ & Inclined cracks \\ \hline 5 & $\pm55^o$ & Cracks in the head, neck and foot rail \\ \hline \end{tabular} \end{table} The proposed general scheme of the process of decoding a defectogram is shown in Fig.3. Its main stages are the stage of preliminary processing of ultrasound data, including sampling data from the sensors of the ultrasound system, bringing the amplitude values into a range and combining the data, as well as the stage of searching for defects and making a decision. \begin{figure}[h!] \includegraphics[width=\textwidth]{fig3} \caption{Architecture of the automatic recognition system of railway bed defects} \end{figure} The stack of measurement information is used to select the source data. The data of each channel are recorded sequentially in the tensors of the same size. In the next step, the data of individual channels that are included in the sample are combined into a single structure in accordance with Table 1, which can be used to search for signs of defects. Defects are searched for in parallel by specialized classifiers. Decisions of specialized classifiers are transmitted to the input of the decisionmaking module, which assesses the probability of correctness of decision making by the composition of classifiers \cite{Yaman2008}, and in case of low level of confidence intervals, delegates this decision to an expert. The solutions specified by the expert are further used for the further training of neural networks of the classifier, thereby gradually improving the quality of the entire system. To solve the problem associated with the detection and classification of defects as an object of technical diagnostics, convolutional neural networks (CNN) were used, which allowed: 1. Effectively parallelize computational processes, which made it possible to organize the work of the system in real time. 2. Implement a mechanism for further training classification. 3. To ensure high computational performance of the neural network due to the use of a much smaller number of parameters compared to other neural network architectures. 4. To provide resistance to turns and shifts of recognizable frames. \section{Conclusion} The development of systems that provide decoding of ultrasonic defectograms of railway rails in automatic mode at high scanning speeds is a difficult task. At the same time, the models used to solve this problem at present have a number of limitations that do not allow solving it completely. The application of the proposed system of models in the development of an automated system for decoding ultrasonic defectograms will improve the efficiency of the rail monitoring process, the reliability of the results obtained and the safety of rail transport.
\section{Introduction} The evolution of the velocity field $X$ of an ideal fluid in an arbitrary Riemannian three manifold $(M,g)$ is modeled by the Euler equations: \begin{equation*} \begin{cases} \partial_t X + \nabla_X X &= -\nabla p \\ \operatorname{div}X=0 \end{cases} \end{equation*} where the differential operators are taken with respect to the metric $g$ and the scalar function $p \in C^{\infty}(M)$ is the pressure. Finding stationary solutions for a fixed metric can be challenging, and it is common in the literature to study stationary solutions to the Euler equations by allowing the metric to vary. In the analysis of stationary fluids, Arnold's celebrated structure theorem inaugurated the modern field of topological hydrodynamics \cite{AKh}. For closed manifolds, it provides an almost complete description of the rigid behavior of the flow if the Bernoulli function, which depends on the pressure, is non constant and analytic (or $C^2$ Morse-Bott). Except on an analytic stratified subset of positive codimension, the manifold is trivially fibered by invariant tori where the flow is conjugate to a linear field. However, Arnold's theorem is an \textit{a posteriori} conclusion: it gives the structure of such solutions but says nothing about their existence. When the Bernoulli function is constant and Arnold's theorem does not apply, the solutions are Beltrami fields: vector fields parallel to their curl. The existence of non-vanishing Beltrami fields for some metric has been extensively studied. For instance, it was proved in \cite{EG} that solutions of these type exist in every homotopy class of vector fields (each solution for some particular metric) of any three manifold. This result was recently extended to every odd dimensional manifold in \cite{C1}. Beltrami fields are much more flexible solutions, and can be used to prove the existence of steady Euler flows with some specific dynamical properties \cite{EP,CMPP}. To the authors knowledge, the only known examples of flows that satisfy the hypotheses of the structure theorem are in the round sphere and the flat torus \cite{KKP}. A natural question is to ask in which other manifolds such solutions exist. Motivated by this problem, it is left as an open question in \cite{P} to study which manifolds admit Euler flows of this type for some metric. We will adress it in two different contexts: when the steady flow is non-vanishing, and when it can vanish but the Bernoulli function is of Morse-Bott type. With the extra assumption that the vector field $X$ is non-vanishing, it was shown in \cite{CV} that it forces the manifold to be of a certain topological type: it has to be the union of Seifert manifolds glued along their torus boundaries, or equivalently a graph manifold. A more general case was observed before in \cite{EG0}, and which follows from previous works \cite{FM}: a non-singular flow with a stratified integral can only exist in a graph manifold. We will refer to a non-vanishing solution to the Euler equations for some metric with non constant analytic (or Morse-Bott) Bernoulli function as an Arnold fluid. In the first part of this note, we show that every possible three manifold, which we know to be of graph type, admits an Arnold fluid with analytic Bernoulli function. \begin{theorem}\label{main} Any closed, oriented graph three manifold $M$ admits a non-vanishing steady solution to the Euler equations for some metric and non constant analytic Bernoulli function. \end{theorem} By the discussion above, the statement is in fact an if and only if. We prove this using the standard construction of Seifert manifolds. However, adapting the arguments in the proof of the theorem above, one can use another decomposition of graph manifolds developped by Fomenko et alli to obtain a richer source of examples of Arnold fluids. In particular, one can produce an Arnold fluid realizing as Bernoulli function, up to diffeomorphism, any possible Morse-Bott function. In the language developped in \cite{F1}, the topological characterization of a graph three manifold and the foliation by level sets of a Bott integral is given by a molecule with gluing matrices. We will show that any such configuration with or without critical Klein bottles can be realized by an Arnold fluid. A concrete way to reformulate the result is the following. \begin{theorem}\label{ArnTop} Given an admissible Morse-Bott function $B$ in a graph manifold $M$, there exist an Arnold fluid with Bernoulli function $B$ (modulo diffeomorphism of $M$). \end{theorem} By admissible we mean a Morse-Bott function which can topologically be the integral of a fluid. This theorem shows that when we allow the metric to vary, the apparent difficulty to construct fluids with such a rigid behavior is overcomed, and one can realize flows in all allowed Morse-Bott topological configurations. An immediate corollary, explained in the Appendix, is that the invariants developped for Bott integrable systems lead to a topological classification of Arnold fluids with Morse-Bott Bernoulli function. This classification can be compared with the classification of vorticity functions of Morse type studied in \cite{IK} for the 2D Euler equation in surfaces. The ressemblance between Arnold's structure theorem and the Arnold-Liouville theorem in the theory of integrable systems already suggest that there might be some connection between these two worlds. By taking a careful look at the Arnold fluids constructed in Theorem \ref{main2}, we can relate them to Bott integrable systems by means of the symplectization of an appropiate stable Hamiltonian structure. This yields an alternative proof that any molecule with gluing matrices can be realized by an integrable system, with the additional property that the isoenergy hypersurface is of stable Hamiltonian type. Without this extra property, this was originally proved in \cite{BFM}. \begin{theorem}\label{maincor} The constructed steady Euler flows together with their vorticity in Theorem \ref{ArnTop} can be realized as the isoenergy hypersurface of a Hamiltonian system with a Bott integral (the Bernoulli function) in a symplectic manifold with boundary. Additionally, the Hamiltonian vector field is up to rescaling a Reeb field of a stable Hamiltonian structure. \end{theorem} This materializes the intuition that Arnold's structure theorem and the classical Arnold-Liouville theorem are closely related. However, the construction is \emph{ad hoc} and we can find examples of Arnold fluids that cannot reasonably be though as energy levels set of an integrable system. In the last part of this work, we will drop the assumption that the solution is non-vanishing. In this general case, no obstruction on the topology of $M$ is known. Hence, we analyze the topology of Euler flows with Morse-Bott Bernoulli function that can have stagnation points. We show that the Bernoulli function cannot have a non-degenerate critical point, and use it to prove that the topology of the ambient manifold can prevent the existence of Bott integrable fluids. \begin{theorem}\label{thm:sing} Let $M$ be a three manifold that is not of graph type. Then $M$ does not admit a solution to the Euler equations (for any metric) with a Morse-Bott Bernoulli function. \end{theorem} For example, the class of hyperbolic manifolds satisfies the hypotheses of this theorem. This is the first example of a topological obstruction to the existence of an integrable fluid, and answers the question raised in \cite{P} in the Morse-Bott case. \textbf{Plan of the paper:} In Section \ref{sec:pre} we recall the necessary definitions and results concerning the Euler equations in Riemannian manifolds and the construction of Seifert manifolds. In Section \ref{sec:arn}, we use the topological decomposition of Seifert manifolds to prove Theorem \ref{main}. Finally, in Section \ref{sec:fom}, we combine the techniques introduced in the previous section with the theory of Bott integrable systems developped by Fomenko et alli. We obtain both Theorem \ref{ArnTop} and \ref{maincor}, with the simplifying assumption that the Morse-Bott function has only simple atoms. In Section 5, we analyze Euler flows with a Morse-Bott Bernoulli function that can have stagnation points and obtain Theorem \ref{thm:sing}. In the Appendix, we cover the construction of Section $4$ for general $3$-atoms and discuss the topological classification of the moduli of Arnold fluids with Morse-Bott Bernoulli function. \textbf{Acknowledgements:} The author is grateful to Eva Miranda, C\'edric Oms and Daniel Peralta-Salas for useful conversations. The author thanks also Alexey Bolsinov for helpful correspondence concerning the topological classification of Bott integrable systems. \section{Preliminaries}\label{sec:pre} In this section, we introduce the basic background in the Euler equations and Seifert manifolds, required to prove Theorem \ref{main}. We will eventually introduce other preliminaries when required through the other sections. \subsection{Steady Euler equations and Arnold structure theorem} When the solution does not depend on time, we can rewrite the Euler equations in terms of the dual one form $\alpha=g(X,\cdot)$ and the so called Bernoulli function. The equations are then \begin{equation*} \begin{cases} \iota_X d\alpha=-dB \\ d\iota_X\mu=0 \end{cases}, \end{equation*} where the Bernoulli function is $B=p+\frac{1}{2}g(X,X)$ and $\mu$ is the induced Riemannian volume. A key property of this function is that it is an integral of the field $X$, since the first equation implies that $\iota_X dB=0$. We aim to study vector fields that are solutions to such equations for some metric. \begin{defi} Let $M$ be an odd dimensional manifold with a volume form $\mu$. A volume preserving vector field $X$ is \textbf{Eulerisable} if there is a metric $g$ on $M$ for which $X$ satisfies the Euler equations for some Bernoulli function $B:M \rightarrow \mathbb{R}$. \end{defi} We might refer to such vector fields as Euler flows too. In \cite{PRT} they are characterized, and the following lemma is introduced. \begin{lemma}\label{eul} Let $X$ be a non-vanishing volume preserving vector field in $M$. Then there exists a one form $\alpha$ such that $\alpha(X)>0$ and $\iota_Xd\alpha=-dB$ for some function $B\in C^\infty(M)$ if and only if $X$ satisfies the Euler equations for some metric $g$ satisfying $g(X,\cdot)=\alpha$. \end{lemma} When the Bernoulli function is assumed to be analytic, Arnold \cite{Arn} introduced a dichotomy depending on whether $B$ is constant or not. When the Bernoulli function is non constant, the flow has a rigid structure that is reminiscent of integrable systems in the context of symplectic geometry. When the function is constant, the vector field is Beltrami: it is everywhere parallel to its curl. The following statement is a version of Arnold's theorem in the context of closed manifolds. It holds also when the Bernoulli function is assumed to be $C^2$ Morse-Bott. \begin{theorem}[Arnold's structure theorem] Let $M$ be a closed three manifold and $X$ a flow satisfying the Euler equations for some non constant analytic Bernoulli function. Denote by $C$ the union of critical level sets of $B$, which is an analytic set of codimension at least $1$. Then $M\setminus C$ consists of finitely many domains $M_i$ and each domain is trivially fibered by invariant tori of $X$, where the flow is conjugated to the linear flow. \end{theorem} In \cite{CV} the authors study the case of non-vanishing solutions in the hypotheses of the structure theorem. It is proved that for an analytic Bernoulli function $B$, one can always find some other metric in $M$ such that $X$ is a solution to the Euler equations with constant Bernoulli function. In particular, it is the Reeb field of some stable Hamiltonian structure. As a corollary of the methods in the proof, topological obstructions to the existence of solutions with non constant analytic Bernoulli function are obtained. The manifold has to be a union of Seifert manifolds glued along their torus boundary components, i.e. a graph manifold. This result was obtained in \cite{EG0} for a more general context: it holds for the existence of a non-vanishing vector field with a stratified integral. It follows from a previous work in \cite{FM}. \begin{theorem}[{\cite[Corollary 2.10]{CV}}, {\cite[Theorem 5.1]{EG0}}]\label{top} If a three manifold admits steady solution to the Euler equations for some metric and non constant analytic (or in general stratified) Bernoulli function, then the manifold is of graph type. \end{theorem} To simplify the notation, we might refer to a vector field which is a non-vanishing steady solution to the Euler equations for some metric and non constant analytic Bernoulli function as an \textbf{Arnold fluid}. This is reminiscent of the nomenclature introduced in \cite{KKP}, where one speaks of a divergence free vector field which is \emph{Arnold integrable} when it is almost everywhere fibered by invariant tori. \subsection{Seifert and graph manifolds}\label{Se} Let us recall the definition and construction of Seifert manifolds, introduced and classified by Seifert \cite{Se}. \begin{defi} A \textbf{Seifert fiber space} is a three manifold together with a decomposition as a disjoint union of circles. \end{defi} Equivalently, a Seifert fiber space admits a circle bundle over a two dimensional orbifold. Denote by $\pi:M\rightarrow B$ the bundle map over the compact base $B$. When the manifold $M$ is oriented, Seifert fiberings are classified up to bundle equivalence by the following invariants (up to some operations that yield isomorphic fiberings): $$ M= \{ g ; (\alpha_1,\beta_1),...,(\alpha_m,\beta_m)\}.$$ The only thing we will need in this work is the way to reconstruct the manifold $M$ when given a collection of invariants. The integer $g$ denotes the genus of the base space $B$, and $(\alpha_i,\beta_i)$ are pairs of relatively prime positive integers $0<\beta_i< \alpha_i$. The integer $g$ can be negative, and then $B$ is connected sum of $g$ copies of $ \mathbb{RP}^2$. The integer $m$ represents the amount of orbifold singularities. Given such a collection of invariants, there is a precise construction to obtain the manifold $M$ that we describe following \cite{JN}. The base space $B$ is either an orientable surface $\Sigma_g$ of genus $g$, or decomposes as $\Sigma_{g'}\# \mathbb{RP}^2$ or $\Sigma_{g'}\# \mathbb{RP}^2 \# \mathbb{RP}^2$ for some $g'$. To simplify, denote in any case by $\Sigma_g$ the orientable surface with genus $g$ or $g'$ respectively in each case. Remove $m$ open disks of $\Sigma_g$, that we denote by $D_i, i=1,...,m$. If $B$ has some non-orientable part, one or two additional open disks $\tilde D_1, \tilde D_2$ are removed depending on the amount of $\mathbb{RP}^2$ components that have to be added to $\Sigma_g$ to obtain $B$. We will denote by $\Sigma_0$ the resulting surface with boundary. Over $\Sigma_0$, we take the trivial $S^1$ bundle and denote it by $M_0= \Sigma_0 \times S^1$. At each component of the boundary, which is of the form $\partial D_i \times S^1$, we glue a solid torus $V_i= \bar D^2 \times S^1$ by means of a Dehn surgery with coefficients $(\alpha_i, \beta_i)$. If $B$ was orientable, this concludes the construction: we obtain a closed three manifold. If $B$ was non orientable, we denote by $M_1$ the resulting three manifold with boundary and we need to fill one or two holes $\partial \tilde D_1 \times S^1$ and $\partial \tilde D_2 \times S^1$ if there were respectively one or two copies of $\mathbb{RP}^2$ attached to the orientable part of $B$. To do so, consider the only orientable $S^1$-bundle over the M\"oebius band: namely, the twisted $I$-bundle over the Klein bottle fibered meridianally. Denote two copies of such a space as $M_2$ and $M_3$. The torus boundary of both $M_2$ and $M_3$ can be framed longitudinally by a fiber and meridianally by a section to the bundle. The boundary components $\partial \tilde D_1 \times S^1$ and $\partial \tilde D_2 \times S^1$ in $M_1$ can be framed also longitudinally by a fiber and meridianally by a section to the bundle. Then glue $M_2$ and $M_3$ respectively to the boundary components of $M_1$ according to the identity between first homology groups represented by the given framings. This concludes the construction of $M$ in the most general case. For a Seifert manifold with boundary, we take the base surface $B$ with some boundary circles. The boundary of $M$ is then a collection of tori. \begin{defi} A \textbf{graph manifold} is a manifold obtained by gluing Seifert spaces with boundary along their torus boundary components. \end{defi} These manifolds were introduced and classified by Waldhausen \cite{W1,W2}. Observe that this is a larger class of manifolds, since the gluing of the boundary tori might not match the fibering in each piece. Hence the resulting total space might not admit a foliation by circles. \section{Arnold fluids in Seifert and graph manifolds} \label{sec:arn} In this section we will prove Theorem \ref{main}. To do so, we first show that any Seifert manifold $M$ admits an Arnold fluid. In view of Lemma \ref{eul}, we only need to prove that there is vector field $X$ in $M$ and a one form $\alpha$ such that \begin{itemize} \item $X$ is volume preserving, \item $\alpha(X)>0$, \item $\iota_Xd\alpha=-dB$ for some analytical function $B$. \end{itemize} The strategy of the proof is to break the manifold $M$ into pieces according to the construction detailed above, construct a vector field and a one form satisfying some conditions in each piece and glue them together in an appropriate way. Concretely, we will show that in a neighborhood of the gluing locus, one can interpolate between the Arnold fluids in each piece to obtain a globally defined steady Euler flow. Once we have a globally defined pair $(X,\alpha)$, we show it is a steady Euler flow for some analytic Bernoulli function and hence an Arnold fluid. Finally, we adapt the interpolation to glue Seifert manifolds along their boundary to deduce the general case of graph manifolds. \subsection{Building pieces}\label{ssec:blocks} Let $M$ be a three dimensional manifold which is a Seifert fibered space. Hence $M$ is an $S^1$-fibration over an orientable surface $\Sigma$. To cover the most general case, we shall assume that the base space decomposes as $\Sigma_g \# \mathbb{RP}^2 \# \mathbb{RP}^2$. As in Subsection \ref{Se}, $\Sigma_0$ is an orientable surface of genus $g$ and with some removed open disks $D_i, i=1,...,m$ and $\tilde D_i, i=1,2$. It is a surface with boundary $M_0= \Sigma_0 \times S^1$. We think of $\Sigma_0$ as being embedded in $\mathbb{R}^3$ so that there is a naturally defined height $h$ function, whose minimum is equal to $1$ and is reached at the boundary components of $\Sigma_0$. This height function lifts trivially to $M_0$. See Figure \ref{fig:emb} for an example with genus $2$, two singular fibers and one $\mathbb{RP}^2$ component. \begin{figure}[!ht] \begin{center} \begin{tikzpicture} \node[anchor=south west,inner sep=0] at (0,0) {\includegraphics[scale=0.16]{embedding.png}}; \node at (4.5,5){$\Sigma_0$}; \node at (0,0)[scale=0.8]{$\partial D_1$}; \node at (2,0)[scale=0.8]{$\partial D_2$}; \node at (4,0)[scale=0.8]{$\partial \tilde D_1$}; \draw [->] (6,0) -- (6,6); \node at (6.5,3) {$h$}; \node at (6.35,0.43) {$1$}; \node at (6,0.43) {$-$}; \end{tikzpicture} \caption{Height function in $\Sigma_0$} \label{fig:emb} \end{center} \end{figure} In $M_0$ denote by $\theta$ the coordinate in the $S^1$ component. Consider the vector field $ X= \pp{}{\theta}$, and as connection form $\alpha= hd\theta$. We have $\alpha(X)>0$ and $\iota_X d\alpha=-dh$. For each solid torus $V_i \cong \bar D^2 \times S^1$, we take coordinates $(r,\varphi',\theta')$. Consider in $V_i$ the vector field $Y= \pp{}{\theta'}$ and as one form $\beta= v(r) d\theta'$, where $v'>0$ in $(0,1]$, close to $r=1$ the function is $r$ and close to $r=0$ the function is $\varepsilon + r^2$. We have $\beta(Y)>0$ and $\iota_Yd\beta= -v'(r)dr$. Hence taking as Bernoulli function $B=\int v'(r)dr$ such that $B(0)=0$, we have that $\iota_Y d\beta=-dB$. The remaining blocks $M_1$ and $M_2$ are twisted $I$-bundles over a Klein bottle. This space $M_1\cong M_2\cong K^2\tilde \times I$ can be seen as the mapping torus of \begin{align*} \phi: S^1\times [-1,1] &\longrightarrow S^1\times [-1,1] \\ (\theta,r) &\longmapsto (-\theta, -r). \end{align*} Hence we have $K^2 \tilde \times I= \frac{(S^1\times [-1,1])\times [0,1]}{ ((p,0)\sim (\phi(p),1))}$. Such manifold is foliated by tori parallel to the boundary, together with a Klein bottle at the core. If we denote by $r$ the coordinate in $[-1,1]$, the function $r^2$ is well defined in the mapping torus total space. Furthermore, we have a natural defined vector field $Z=\pp{}{\theta'}$, where $\theta'$ is in $[0,1]$, induced by the flow of the mapping torus and that is $2$-periodic. Construct a function $v(r^2)$ such that close to $r=0$ it is $\varepsilon + r^2$ and close to $r=1$ it is $r^2$. By taking $\gamma=v(r)d\theta'$, we have $\gamma(Z)>0$ and $\iota_Y d\gamma =-dG$ where $G=\int v'(r)dr$ with $G(0)=0$. \subsection{Interpolation Lemma and gluing} In order to reconstruct the whole manifold, we need first to paste the sets $V_i= \overline{D_i}\times S^1$ to the boundary components $\partial D_i \times S^1$ of $M_0$ by means of a Dehn twist. Denote $U_i \cong [1,2) \times S^1 \times S^1$ the boundary components at $D_i$ of $M_0$ and fix one of them that we denote by $U$ with coordinates $(t, \varphi, \theta)$. We can assume the first component $t$ corresponds to the restriction of $h$ to $U$, and the coordinate $\theta$ is on the $S^1$ fibre over $\Sigma_0$. Denote by $\lambda= \{1\} \times \{\varphi\} \times S^1$ and by $\mu= \{1\} \times S^1 \times \{ \theta \}$ the longitude and the meridian of the boundary component $\{1\} \times T^2$ of $U$. We will glue a solid torus $V= D^2 \times S^1$ to the boundary of $U$. Again take $\lambda_1= \{ p\in \partial {\bar D^2} \} \times S^1$ and $\mu_1= \partial {\bar D^2} \times \{\theta'\}$ the longitude and the meridian of $V$. The Dehn surgery is described by gluing in a way that \begin{align*} \varphi: \partial V_i &\longrightarrow \partial U_i \times S^1 \\ \mu_1 &\longrightarrow p\mu + q\lambda \\ \lambda_1 &\longrightarrow m \mu + n\lambda \end{align*} Coordinate wise we have that $\varphi'=p\varphi+q\theta$ and $\theta'= m \varphi+ n\theta$. We can assume that the surgery is such that the radial coordinate $r$ in $V$ is sent to $t$ in the neighborhood of the boundaries. The vector field $Y=\pp{}{\theta'}$ which generates the longitude, is sent to $Y|_{\partial U}= \frac{q}{qm-pn} \pp{}{\varphi}+\frac{p}{pn-qm} \pp{}{\theta}$ in the surgered target coordinates, the boundary of $U$. This can be easily deduced by the fact the coordinate wise we have \begin{equation*} \begin{cases} \varphi&= \frac{n}{pn-qm} \varphi' + \frac{q}{qm-pn} \theta' \\ \theta&= \frac{m}{qm-pn} \varphi' + \frac{p}{pn-qm}\theta' \end{cases}. \end{equation*} Analogously, the one form $\beta$ is sent to $\beta|_{\partial U}= t(m d\varphi + nd\theta)$. This follows from the fact that near the boundary of $B$, the one form is $\beta= r d\theta$. It satisfies $\beta(Y)=t(\frac{qm}{qm-pn}+\frac{pn}{pn-qm})>0$. Once we have our building blocks of an Euler flow, we need to glue the flows in a smooth way: both the vector field and the one form, and such that the critical set of the Bernoulli function is controlled. More precisely, we can do this interpolation by keeping the Bernoulli function regular. \begin{lemma}[Interpolation Lemma]\label{int} Suppose we are given a vector field $Y=A\pp{}{\theta}+B\pp{}{\varphi}$ in the torus $T^2$ and a one form $\gamma=Cd\theta + D d\varphi$, for some constants $A,B,C,D$, such that $\gamma(Y)=AC+DB=1>0$. Denote $t$ the coordinate in $[1,2]$. Then there is a volume perserving vector field $X$ and a one form $\alpha$ in $T^2\times [1,2]$ such that \begin{itemize} \item $X|_{\{t=1\}}=\pp{}{\theta}$, $\alpha|_{\{t=1\}}=d\theta$, \item $X|_{\{t=2\}}=Y$, $\alpha|_{\{t=2\}}=\gamma$, \item $\alpha(X)>0$ everywhere, \item $\iota_X d(t\alpha)=-dh$ where $h(t)$ is a function without critical points and equal to $t$ at the boundary. \end{itemize} \end{lemma} \begin{proof} Break the interval $[1,2]$ into seven disjoint intervals $I_1,...,I_7$, for instance $I_i=[1+\frac{i-1}{7},1+\frac{i}{7}]$. Denote by $H_i(t)$ a cutoff function with support in $I_i$ such that $H_i'\geq 0$, with $H_i=0$ at $1+\frac{i-1}{7}$ and $H_i=1$ at $1+\frac{i}{7}$. Since we have $AC+DB>0$, we might assume that $A$ and $C$ are of the same sign. Otherwise, the constants $D$ and $B$ are of the same sign and an analogous interpolation is done. \begin{enumerate} \item In the first interval, take $X=\pp{}{\theta}$ and $\alpha=d\theta+ H_1(t)d\varphi$. We have $\alpha(X)=1>0$. \item In the second interval, take $X=\pp{}{\theta} + H_2(t)\pp{}{\varphi} $ and $\alpha=d\theta+ d\varphi$. We have $\alpha(X)=1+H_2>0$. \item In the third interval, take $X= (1-H_3(t))\pp{}{\theta}+ \pp{}{\varphi}$ and $\alpha=d\theta+d\varphi$. We have $\alpha(X)=(1-H_3)+1>0$. \item In the fourth interval, take $X=\pp{}{\varphi}$ and $\alpha=(1+H_4(t)(C-1))d\theta + d\varphi$. We have $\alpha(X)=1>0$. \item In the fifth interval, take $X=H_5(t)A\pp{}{\theta} + (1-H_5(t))\pp{}{\varphi}$ and $\alpha= Cd\theta + d\varphi$. We have $\alpha(X)= ACH_5+(1-H_5)>0 $ since $AC>0$. \item In the sixth interval, take $X=A\pp{}{\theta}$ and $\alpha=Cd\theta + (1+H_6(t)(D-1))d\varphi$. We have $\alpha(X)=AC>0$. \item In the last interval, take $X=A\pp{}{\theta}+ H_7(t) B\pp{}{\varphi}$ and $\alpha= Cd\theta + Dd\varphi$. We have $\alpha(X)=AC+H_7BD>0$. It is positive because if $BD$ is positive, then $AC+H_7 BD> AC>0$ and if $BD$ is negative then $AC+H_7BD>AC+BD>0$. \end{enumerate} This a priori arbitrary way of interpolating by steps is done to achieve both that $h$ has no critical points and that it suits an application in the last part of this section. The key point in achieving that $h$ has no critical points is to avoid decreasing a component in $\alpha$ which is non-vanishing when evaluated at $X$. We constructed $(X,\alpha)$ satisfying the first three conditions. To check the fourth condition, we will do it interval by interval. If we compute $\iota_Xd(t\alpha)$ we obtain: \begin{equation*} \iota_Xd(t\alpha)= \begin{cases} - dt \qquad &t\in I_1 \\ -[1+ H_2 ]dt \qquad &t\in I_2\\ -[ 2-H_3 ]dt \qquad &t\in I_3\\ -dt \qquad &t\in I_4\\ -[ H_5AC+(1-H_5) ] dt \qquad &t\in I_5\\ - AC dt \qquad &t\in I_6\\ - [ AC+H_7BD ]dt\qquad &t\in I_7 \end{cases} \end{equation*} It is clear from the case by case description that the function $h$, which is the indefinite integral with respect to $t$ of the $dt$-term, has no critical points in $[1,2]$. At the boundary we have that $\iota_Xd(t\alpha)=-dt$. The vector field preserves the volume form $\mu=dt\wedge d\varphi \wedge d\theta$, since at any point the vector field is of the form $X=A(t) \pp{}{\theta} + B(t) \pp{}{\varphi}$ which implies that $\mathcal{L}_X \mu=d\iota_X\mu=0$. \end{proof} We can now apply this lemma in $U= [1,2] \times T^2$ to interpolate between $(Y,\beta)$ and $(X,\alpha)$. By Lemma \ref{int}, we can do so in such a way that the function $h$ extends in the building blocks as $B$ and has no critical points in $U$. Hence we constructed a pair $(\tilde {X},\tilde {\alpha})$ in $M_1$ with $\tilde {\alpha}(\tilde {X})>0$ and $\iota_{\tilde {X}}d\tilde {\alpha}=-dB'$ for some function $B'\in C^\infty(M)$. Finally, it only remains to glue the $M_1$ and $M_2$ to $W_1= \partial \tilde D_1 \times S^1$ and $W_2= \partial \tilde D_2 \times S^1$. Take for example $M_1$, and $M_2$ is glued analogously. The vector field $Z$ is tangent to the leaves of the foliation (by torus and core Klein bottle) in $M_1$, and on the torus leaves $Z$ is linear and periodic. Hence at the surgered boundary, the vector field $Z$ and the one form $\gamma$ are sent to $Z=C_1\pp{}{\theta}+C_2\pp{}{\varphi}$ and to $t\gamma=t(D_1d\theta+D_2\varphi)$ for some constants $C_1,C_2,D_1,D_2$ with $\gamma(Z)=C_1D_1+C_2D_2=1$. We are under the hypotheses of Lemma \ref{int} in a neighborhood of the surgery locus, so we can obtain a vector field and one form $(X', \alpha')$ in $W_1$ that can be extended in $M_0$ as $(\tilde {X},\tilde {\alpha})$ and in $M_1$ as $(Z, \gamma)$. Doing this to both pieces $M_1$ and $M_2$, we constructed a globally defined function $B\in C^\infty(M)$ such that $\alpha'(X')>0$, the equation $\iota_{X'} \alpha'=-dB$ satisfied and $B$ coincides with $\tilde B$ in $M_1 \setminus U_1 \cup U_2$ and with $G$ in $M_1$ and $M_2$. \subsection{Volume preservation and critical set}\label{ss:volcrit} To prove that $X'$ is volume preserving, we will prove that it preserves some volume in each part of the manifold. \begin{enumerate} \item Denote by $A$ a neighborhoods of the boundary circles of $M_0$ where we applied the interpolation lemma. Then in $M_0\setminus A$ we have that $X'=X=\pp{}{\theta}$ and $X$ clearly preserves $\mu= \mu_{\Sigma_0} \wedge d\theta$, where $\mu_{\Sigma_0}$ is any area form of $\Sigma_0$. This follows from the fact that $\iota_X\mu= \mu_{\Sigma_0}$, which is a closed form. \item In any interpolation area, it is by construction volume preserving. The vector field is of the form $X'= A(t)\pp{}{\theta}+B(t)\pp{}{\varphi}$. Taking as volume $\mu_U= dt \wedge d\varphi \wedge d\theta$, we have that $$ \iota_{\tilde {X}}\mu_U= A(t) dt \wedge d\varphi - B(t)dt\wedge d\theta, $$ which is again closed. \item In every solid torus $V_i$, we have $Y=\pp{}{\theta'}$ which preserves the volume $rdr\wedge d\varphi'\wedge d\theta'$. \item In the mapping tori $M_1$ and $M_2$, the vector field $X'=\pp{}{\theta'}$ preserves the volume form $\mu= \mu_S \wedge d\theta' $, where $\mu_S=d\varphi \wedge dt$ is a volume of $S^1\times [-1,1]$. This follows from the fact that diffeomorphism $\varphi$ that we used for the mapping torus preserves the area form $d\varphi \wedge dt$ \end{enumerate} It is now standard to construct a globally defined volume $\mu$ on $M$ preserved by $X'$. We just proved that $X'$ is volume preserving and admits a one form $\alpha'$ such that $\alpha'(X')>0$ and $\iota_{X'} \alpha'=-dB$ for some function $B\in C^\infty(M)$. By applying Lemma \ref{eul}, we deduce that $X'$ satisfies the Euler equations for some metric with Bernoulli function $B$. \paragraph{\textbf{Analiticity}} The function $B$ is a priori only smooth. However, we have the following theorem of equivalence between smooth and analytic functions. We state a particular case which is enough for our purposes. \begin{theorem}[{\cite[Theorem 7.1]{Sh}}] \label{An} Let $f$ be a smooth function on a manifold $M$. Suppose that at every point we have locally that: \begin{enumerate} \item $f$ is regular, \item $f$ is the sum of a constant and a power of a regular function, \item $f$ is $\pm x_1^2 \pm ... \pm x_k^2 + \operatorname{const}$ for suitable coordinates $(x_1,...,x_n)$. \end{enumerate} Then $f$ is equivalent to an analytic function. \end{theorem} We only need to prove that $B$ satisfies the conditions of this theorem, then $B$ is analytic taking some suitable charts. In $M_0\setminus A$, we have that $B=h$. We initially defined $h$ in $\Sigma_0$ where it is a Morse function, hence $h$ is a Morse-Bott function in the considered three dimensional space. In the solid tori $V_i$ attached via Dehn surgery, we have that $B=r^2$ and the only singularity is of Morse-Bott type (the critical core circle). In the pieces $M_1$ and $M_2$, the Bernoulli function has a Klein bottle as singular set, since at the core of the mapping torus we have $B=r^2$. The singularity is again of Morse-Bott type. Finally, on the regions $U_i$ and $W_i$, we know that $B$ is regular. Hence, the only singular points of $B$ admit an expression of type (2) or (3). We just proved that every Seifert manifold with orientable base admits a steady Euler flow with a Morse-Bott Bernoulli function, and by Theorem \ref{An} equivalent to a non constant analytic Bernoulli function. \begin{theorem}\label{main2} Every Seifert manifold admits a non-vanishing steady solution to the Euler equations (for some metric) with non constant analytic Bernoulli function. Analogously for a smooth Morse-Bott function. \end{theorem} To prove the general case of graph manifolds, it only remains to glue Seifert manifolds with boundary and obtain globally defined Arnold fluids. \subsection{Proof of Theorem \ref{main}} Let $M_1,M_2$ be two Seifert manifolds with boundary. We shall assume that there is only a single torus component in the boundary. The manifold $M_1$ is glued to $M_2$ by a diffeomorphism $$\varphi: \partial M_1 \longrightarrow \partial M_2,$$ between both torus boundaries. By Theorem \ref{main2}, we can construct steady Euler flows with non constant analytic Bernoulli function in both manifold $M_1,M_2$. The idea is to introduce a singular torus to the Bernoulli function and then apply the interpolation lemma. It follows from the construction in the previous section that we can assume that in the neighborhood of the boundaries $\partial M_i=U_i=T^2 \times [1,2]$ we have that $X_i=\pp{}{\theta_i}$ and $\alpha=t_i d\theta_i$ where $(\theta_i,\varphi_i,t_i)$ are coordinates in $U_i$. Once we glue the boundaries, we can construct a coordinate $t$ in $U=T^2 \times [-1,1]$ such that \begin{align}\label{par} &t^2=t_1 \text{ for } t\in [-1,-1+\varepsilon] \\ &t^2=t_2 \text{ for } t\in [1-\varepsilon,1]\label{par2} \end{align} We can assume that $T^2 \times \{-1\}$ is the boundary of $M_1$ and $T^2\times \{+1\}$ is the boundary of $M_2$, and we thickened the gluing torus. Consider the coordinates $(\theta_2,\varphi_2,t)$ of $U$, obtained by extending $\theta_2,\varphi_2$ from the boundary of $M_2$ to $U$. The gluing diffeomorphism, which is in the mapping class of a two torus, can be assumed to be a Dehn twist (up to isotopy). This implies that the vector field $X_1$ and the one form $\alpha_1$, which are defined $\{-1\}\times T^2$ are of the form $X_1=C_1\pp{}{\theta_2} + C_2\pp{}{\varphi_2}$ and $\alpha_1=t^2( D_1d\theta_2 + D_2d\varphi_2)$ for some constants $C_1,C_2,D_1,D_2$. In the other hand, we have $X_2=\pp{}{\theta_2}$ and $\alpha_2=t^2d\theta_2$ defined in $T^2 \times \{1\}$. Using Lemma \ref{int} in $[-1,-1+\varepsilon]$, we obtain a vector field $X'$ and a one form $\beta$ satisfying $\iota_{X'}\beta=-dH$ for some function $H$ without critical points that extends as $t^2$ in the boundary of $[-1,-1+\varepsilon]$. Furthermore, in $\{-1\}\times T^2$, the pair is equal to $(X_1,\alpha_1)$ and in $\{-1+\varepsilon\}$ is equal to $(\pp{}{\theta},t^2d\theta)$. Finally, the vector field $\pp{}{\theta}$ and the one form $t^2d\theta$ extend trivially to $[-1+\varepsilon, 1]$ and hence to all $M_1 \cup_{\varphi}M_2$ by conditions \eqref{par} and \eqref{par2}. We obtained a global volume preserving vector field $X'$ and a one form $\beta$ such that $\beta(X)>0$ and $\iota_X \beta=-dB$. The only new critical level set of the Bernoulli function is given by $\{0\} \times T^2$, a non degenerate critical torus, since there $\alpha=t^2d\theta$. This concludes the proof of the Theorem \ref{main}, since the real analiticity of $B$ follows from Theorem \ref{An}. \section{Fomenko's theory for Arnold fluids}\label{sec:fom} In this section, we use the theory of Bott integrable systems studied by Fomenko et alli to realize Arnold fluids with any possible Morse-Bott Bernoulli function. The connection between these steady flows and the theory of Morse-Bott integrable systems was already observed in \cite{EG0}. We will show that any topological configuration (in the sense of a graph manifold and a given admissible Morse-Bott function) can be realized by an Arnold fluid. To simplify the discussion, we will treat in this section the case where the Morse-Bott integral contains a single connected critical submanifold in each connected component of the critical level set. In the language of atoms introduced in \cite{BF}, this means that we assume that the Bott integral has only simple atoms. We leave for the Appendix the case of arbitrary $3$-atoms, where we also discuss the topological classification of the moduli of Arnold fluids with Morse-Bott Bernoulli function. Taking into acccount this appendix, we get a proof of Theorem \ref{main2}. \subsection{Topology of Bott integrable systems} \label{ssec:blocks2} We will describe in this subsection some aspects of the topological classification of integrable systems with Bott integrals in isoenergy surfaces of dimension three. For more details on this theory, we confer the reader to \cite{F1} which we will mainly follow in the discussion. Consider a symplectic manifold $(M,\omega)$ of dimension four with an integrable Hamiltonian system $F=(H,f)$. That is, they satisfy $dH\wedge df \neq 0$ almost everywhere and they commute with respect to the Poisson bracket $\{f,H\}=0$. Denote by $Q$ a three dimensional regular isoenergy hypersurface of $H$, and assume that $f$ restricts to $Q$ as a Morse-Bott function. Let us denote by $(H)$ the class of orientable closed three manifolds that are isoenergy hypersurfaces of some integrable Hamiltonian system with the properties described above, in some four dimensional symplectic manifold with boundary. Similarly, we denote by $(G)$ the class of orientable graph manifolds and $(Q)$ the class of three manifolds that can be decomposed into the sum of "elementary bricks" which are solid tori $D^2\times S^1$, a torus times an interval $T^2\times I$ or $N^2 \times S^1$. Here $N^2$ denotes a disk with two holes. In a series of papers \cite{BF,F2,FZ1,FZ2}, it was proved that all three classes coincide. \begin{theorem}[Brailov-Fomenko, Fomenko, Fomenko-Zieschang]\label{FZ} The three classes coincide, i.e. we have $(H)=(Q)=(G)$. \end{theorem} Even better, with the assumption we took on the critical level set of $f$, up to five types of blocks describe the topology of the foliation induced by the Bott integral. These five blocks are: \begin{itemize} \item Type $I$: The solid torus $S^1 \times D^2$. \item Type $II$: The thick torus $T^2 \times [1,2]$. \item Type $III$: The space $N^2 \times S^1$, where $N^2$ is a $2$-dimensional disk with two holes. \item Type $IV$: The mapping torus of $N^2$, with a rotation of angle $\pi$ that we will denote $N^2 \tilde \times S^1$. \item Type $V$: The mapping torus of $S^1 \times [-1,1]$ by the diffeomorphism $\varphi(\theta,t)=(-\theta,-t)$. \end{itemize} Denote by $f$ the Bott integral and consider the following integers: $m$ stable periodic orbits (minimum or maximum), $p$ critical tori (minimum or maximum), $q$ the number of unstable critical circles with orientable separatrix diagram, $s$ the number of unstable critical circles with non-orientable separatrix diagram, and $r$ the number of critical Klein bottles (minimum or maximum). Then the manifold $M$ can be represented as $M=mI+pII+qIII+sIV+rV$, gluing the elementary blocks by certain diffeomorphisms of the torus boundary components. If we further indicate how the blocks are connected by means of edges (if we want, oriented with respect to the increase direction of the function), we obtain a complete topological description of the level sets of the Bott integral. The topology of the function is then determined by some graph, as similarly discussed in \cite{Cas}. The graph satisfies that each vertex has one, two or three edges. That is because blocks $I$ and $V$ have one torus in the boundary, blocks $II$ and $IV$ have two boundary tori and blocks $III$ has three boundary tori. In order to fix the topology of the ambient manifold, one needs to specify the mapping class of each gluing diffeomorphism: the coefficient of a Dehn twist. As described in \cite[Section 4.1]{F1}, there is a family of natural choices of framings (all equivalent) in each boundary torus, and hence the coefficient of a Dehn twist determines the gluing isotopy class. Fixing a graph with Dehn coefficients in each edge determines both the topology of the manifold and the topology of the function. The whole theory applies also to Arnold fluids with a Morse-Bott Bernoulli function. The topological properties originally follow from the analysis of the neighborhood of the critical set of the Morse-Bott integral of some non-vanishing vector field, and hence works analogously in this context. This was already used in \cite{EG0}. \begin{example} Take for example the Arnold fluid constructed in Theorem \ref{main} for Figure \ref{fig:emb}. Asssume we take a height function that only has a critical point in each value: assume for example that the critical value joining $\partial D_2$ and $\partial \tilde D_1$ is lower than the critical value joining $\partial D_1$ and $\partial D_2$. A representation of the graph associated to such topological decomposition would be Figure \ref{fig:graph}. We took a framing in the boundary of the Klein bottle neighborhood for which the gluing is trivial as described in Section \ref{sec:pre}. Whenever the Dehn coefficients are trivial in some gluing, nothing is indicated in the edge. The coefficients $(\alpha_i,\beta_i)$ are indicated by the Seifert invariants. \begin{figure}[!ht] \begin{center} \begin{tikzpicture} \node[scale=0.8] at (-0.8,-2,0) {$I$}; \node[scale=0.8] at (1,-2,0) {$I$}; \node[scale=0.8] at (2.8,-2,0) {$V$}; \node[scale=0.8] at (1.9,-1) {$III$}; \node[scale=0.8] at (1,0) {$III$}; \node[scale=0.8] at (1,1,0) {$III$}; \node[scale=0.8] at (1,2,0) {$III$}; \node[scale=0.8] at (1,3,0) {$III$}; \node[scale=0.8] at (1,4,0) {$III$}; \node[scale=0.8] at (1,5,0) {$I$}; \draw (-0.7,-1.8) -- (0.8,-0.2); \draw (1,0.2) -- (1,0.8); \draw (2.7,-1.8) -- (2,-1.2); \draw (1.1,-1.8) -- (1.8,-1.2); \draw (1.8,-0.8) -- (1.1,-0.2); \draw (1.1,1.2) arc(-50:50:0.4); \draw (0.9,1.8) arc(130:230:0.4); \draw (1,2.2)--(1,2.8); \draw (1.1,3.2) arc(-50:50:0.4); \draw (0.9,3.8) arc(130:230:0.4); \draw (1,4.2) -- (1,4.8); \node[scale=0.7] at (-0.5,-0.9) {$(\alpha_1,\beta_1)$}; \node[scale=0.7] at (0.85,-1.45) {$(\alpha_2,\beta_2)$}; \draw [->] (4,-2) -- (4,5); \node at (5,1.5) {$B$}; \node at (-3,0) {}; \end{tikzpicture} \end{center} \caption{Example of graph representation} \label{fig:graph} \end{figure} \end{example} \subsection{Topological realization of Arnold fluids} Using similar arguments as we did to prove Theorem \ref{main}, we can construct an Arnold fluid realizing each topogical configuration. Let us start by constructing an Arnold fluid in each of the "elementary blocks". \begin{prop} \label{ArnBl} All blocks admit an Arnold fluid with the following properties. For type $I$, the longitudinal core circle is a minimum or maximum of the Bernoulli function. For type $II$, the torus $T^2 \times \{3/2\}$ is a minimum or maximum of the Bernoulli function. For type $III$, critical set is a figure eight times a circle: the central circle is of saddle type. For type $IV$, exactly as for type $III$ but with a non orientable separatrix diagram for the critical circle. For type $V$, the core Klein bottle is a minimum or maximum of the Bernoulli function. In all cases, the boundary components are regular level sets of the Bernoulli function. For blocks $III$ and $IV$, we can assume that the Bernoulli function decreases (or increases) outwards in the exterior of $N^2$ boundary component and respectively increases (or decreases) in the other boundary components. \end{prop} \begin{proof} We give construct in each block a vector field $X$ and a one form $\alpha$ such that $\iota_X d\alpha=-dh$ for some function $h$ satisfying the mentioned properties. In all cases, it is easy to check that the vector field is volume preserving as in Subsection \ref{ss:volcrit}. Types $I$ and $V$ follow from the discussion in Section \ref{sec:arn}. In the first one, the vector field is the longitudinal flow $\pp{}{\theta}$ with one form $v(r)d\theta$, where $\theta$ is the longitudinal coordinate of the solid torus and $r$ the radial coordinate in $D^2$. The function $v(r)$ is equal to $(\varepsilon + r^2)$ close to $r=0$ and equal to $ r$ close to the boundary $\{r=1\}$ if it is a minimum. If it a maximum we can take for example $v(r)=1+\varepsilon -r^2$ close to $r=0$ and $v(r)=1+\varepsilon - r$ close to $r=1$. Type $V$ is given by the mapping torus with core Klein bottle introduced in Subsection \ref{ssec:blocks}. The vector field is given by the mapping torus direction $\pp{}{\theta}$, and again the one form is $v(r^2)d\theta$, where the function $v$ is equal to $\varepsilon + r^2$ close to $r=0$ and $r^2$ close to $r=1$. Similarly for a maximum, take $1+\varepsilon -r^2$ close to $r=0$ and $1+\varepsilon - r^2$ close to $r=1$. Recall that $r$ is the coordinate in $[-1,1]$, for the mapping torus obtained by the diffeomorphism $\varphi: S^1 \times [-1,1] \rightarrow S^1 \times [-1,1]$. For the type $II$ block, consider the standard coordinates $(\theta, \varphi,t)$ in $T^2 \times [1,2]$. Take the vector field $X=\pp{}{\theta}$ and the one form $\alpha=v(t)d\theta$. If we want a minimum, we choose as function $v(t)=+\varepsilon + (t-3/2)^2)$, which implies that the Bernoulli function is $h=\int_t v'(t)= t^2-3t $. If we want it as a maximum then $v(t)=1+\varepsilon-(t-3/2)^2$ and $h=-t^2+3t$. We have $\iota_Xd\alpha=-dh$ and $\alpha(X)>0$. For the type $III$ and type $IV$, denote by $\theta$ the coordinate in the $S^1$ component. Take a one form $\alpha=v(x,y)d\theta$, where $(x,y)$ are coordinates in $N^2$. Taking the function $v$ such that it has a saddle point in $(0,0)$ and two minima or maxima in $(\pm 1,0)$ is enough. For example, take $v(x,y)=K \pm \frac{1}{4}(y^2-x^2+1/2x^4)$, for some big enough constant $K>0$ added to the Hamiltonian of the Duffing equation. Then as Bernoulli function take similarly $h(x,y)= C \pm \frac{1}{4}(y^2-x^2+1/2x^4)$, for some constant $C$. We have $$\iota_Xd\alpha=\iota_X (\pp{v}{x}dx\wedge d\theta + \pp{v}{y}dy\wedge d\theta)=-\pp{v}{x}dx-\pp{v}{y}dy,$$ which is exactly equal to $-dh$. It is also satisfied that $\alpha(X)>0$. Depending on the sign, we obtain that $h$ is decreasing or increasing (outwards with respect to the boundary, that we take to be a level set of $h$) in the interior boundary components, and respectively increasing or decreasing in the exterior boundary components. Observe that the defined one form and function $h$ are well defined in the mapping torus in the case of type $IV$ blocks. This is because the Duffing potential is invariant with respect to the rotation of angle $\pi$, which is easily seen in polar coordinates. Hence if we denote by $p$ the projection of $N^2 \tilde \times S^1$ into $S^1$, the function $p^*h$ is well defined. This covers the case of block $IV$. The $N^2$ copy that we take is the one given by the level sets of the function $h$ or $v$: i.e. the boundary and holes we take are given by some of the regular level sets of these functions. Figure \ref{fig:level} gives a representation of the critical level set and the boundary level sets given by the function. \begin{figure} \begin{center} \begin{tikzpicture} \node[anchor=south west,inner sep=0] at (0,0) {\includegraphics[scale=0.16]{MorseEight.png}}; \end{tikzpicture} \end{center} \caption{Level sets of $h$} \label{fig:level} \end{figure} In all cases, the vector field is volume preserving and Lemma \ref{eul} concludes. \end{proof} Combining this result with the interpolation lemma, we can realize any configuration graph as Figure \ref{fig:graph}, and so any possible topology is realized by an Arnold fluid. We also state it in the general case of a molecule with gluing coefficients. \begin{theorem}\label{Mole} Given a graph with blocks $I-V$ and Dehn coefficients, there exist an Arnold fluid with Morse-Bott Bernoulli function realizing it. In general, given a molecule with gluing coefficients there is an Arnold fluid realizing it. \end{theorem} \begin{proof} As in the whole section, we restrict to graphs with simple atoms, i.e. blocks of the form $I-V$, and leave for the appendix the general case. Take a graph with Dehn coefficients and oriented edges. Each vertex indicates the type of block (and hence of the neighborhood of some connected component of a critical level set) of the Bernoulli function. The amount of up-directed edges for type $III$ blocks indicates if in the interior boundary components or in the exterior one the Bernoulli function is increasing. We start from the bottom and construct in the minima blocks an Arnold fluid using Proposition \ref{ArnBl}. We proceed by induction. Assume we have an Arnold fluid in a manifold with boundary $N$ realizing a subgraph of the given marked molecule. Denote by $B$ the Bernoulli function in $N$. In a neighborhood of a torus boundary component of some of its blocks, there exist coordinates $(t,\theta)$ such that the one form is $\alpha=td\theta$. We attach the following block, that we assume to be of type $III$ or $IV$, via a Dehn twist with the coefficients indicated by the edge of the graph. Using Proposition \ref{ArnBl}, we endow the block with an Arnold fluid. Up to choosing well the constants $K$ and $C$ in Proposition \ref{ArnBl}, we can make sure that the minimal value of the Bernoulli function is higher than the maximal value of $B$ in $N$. Denote by $A$ and $B$ the maximal value of $B$ in $N$ and the minimal value of the Bernoulli function in the new block. Hence in a neighborhood of the gluing locus $U(T^2) \cong T^2 \times [A,B]$ we can assume that in each boundary component $T^2 \times \{A\}$ and $T^2 \times \{B\}$ we have the Arnold fluids respectively of $N$ and the glued block. We are in the hypotheses of the interpolation Lemma \ref{int}, since the vector fields are always linear in the torus boundaries. In a neighborhood $U(T^2)$, we obtain a globally defined non-vanishing vector field $X$, and a one form $\alpha$ such that $\alpha(X)>0$ and $\iota_X d\alpha=-dB'$. Here $B'$ is a function which coincides with $B$ in $N$ except at the neighborhood where we applied the interpolation lemma. The cases of attaching the last blocks of type $I$, $II$ or $V$ containing a maximum are done analogously. At the end, the Bernoulli function realizes the given graph. Furthermore, by construction, the vector field is volume preserving in each block and hence globally preserves some volume form. This proves, by Lemma \ref{eul}, that the construction yields a globally defined Arnold fluid realizing the initial graph with coefficients. In the general case, when we can have more than one critical circle in the same connected component of the critical level set, the neighborhood of a singular leaf is a $3$-atom as described in \cite{F1}. In the Appendix we explain how to construct an Arnold fluid in the case of an arbitrary $3$-atom, in the sense of any possible foliation around a singular leaf. Then using the interpolation lemma as above proves that given any graph with arbitrary $3$-atoms of any complexity as vertices, there is an Arnold fluid realizing it. \end{proof} Theorem \ref{ArnTop} stated in the introduction is just a reformulation of the realization of any marked molecule. \begin{Remark} By the same arguments as in the previous section, we can in fact assume that the Bernoulli function is analytic. \end{Remark} \subsection{Symplectization of fluids} In this last subsection, we will show how the Arnold fluids we constructed can be symplectized in to give rise to a Bott integrable system. In order to transform the constructed Arnold fluids into integrable systems, we will need a one form with some properties. Recall that a stable Hamiltonian structure is a pair $(\alpha,\omega)$ of a one form and a two form such that $\alpha\wedge \omega>0$ and $\ker \omega \subset \ker d\alpha$. The equations $\iota_R \omega=0$ and $\alpha(R)=1$ uniquely define the Reeb field of the stable Hamiltonian structure. It was already proved in \cite{CV} that any non-vanishing steady solution to the Euler equations with non constant analytic Bernoulli function can be rescaled to the Reeb field of a stable Hamiltonian structure. For some rescaling of the solutions we constructed (with $B$ of Morse-Bott type and eventually analytic) we can explicitely construct a one form $\beta$ satisfying the condition $\iota_X d\beta=0$ and $\beta(X)>0$, but with an additional property: that it vanishes when evaluated at the curl of $X$. \begin{lemma}\label{beta} In Theorem \ref{ArnTop} denote by $Y$ the curl (for the constructed metric) of the steady flow $X$. Then, there exist a one form $\beta$ such that \begin{itemize} \item $\beta(X)>0$, \item $\iota_{X} d\beta=0$, \item $\beta(Y)=0$. \end{itemize} \end{lemma} \begin{proof} Let us keep the simplifying assumption that the marked molecule has only simple atoms i.e. blocks of type $I-V$. We have a solution as constructed in Theorem \ref{ArnBl}: a given Arnold fluid in each block using Proposition \ref{ArnBl}, and interpolations in each gluing locus using Lemma \ref{int}. For a type $I$ block of the form $S^1\times D^2$ with coordinates $(\theta,r,\varphi)$, the preserved volume form is $\mu=rdr\wedge d\varphi\wedge d\theta$. For the type $II$ block, the volume form is $dt\wedge d\varphi\wedge d\theta$ for coordinates in $T^2 \times [1,2]$. In type $III$ and $IV$, the volume form is $\mu_N\wedge d\theta$, where $\mu_N$ is an area form in the disk with two holes and $\theta$ a coordinate of the mapping torus. Finally, type $V$ block has as volume form $\mu_s\wedge d\theta$ where $\mu_S$ is an area form in $S^1 \times [-1,1]$. We want to study the curl $Y$ of the solutions constructed in Proposition \ref{ArnBl}. In cases $I$ and $II$, the curl is of the form $Y=H(r) \pp{}{\varphi}$. In the three remaining cases, the curl equation writes \begin{align} \iota_Y \mu &= d\alpha \\ &= df \wedge d\theta,\label{base} \end{align} where $f$ is some function in the base space of the mapping torus. We shall prove that the form $d\theta$ satisfies $d\theta(Y)=0$. Assume the converse, that is that $d\theta(Y)$ is not vanishing everywhere. Denote by $B$ the base of the mapping torus and $i$ the inclusion into the mapping torus total space. Then we have that $i^*\iota_Y \mu$ is not vanishing. But this contradicts equation \eqref{base}. From the whole discussion, it follows that the one form $\beta=d\theta$ satisfies $\beta(X)>0$, $\iota_X d\beta=0$ and $\beta(Y)=0$. Finally, we only need to extend $\beta$ in the interpolation areas. In any of the applications of the interpolation lemma we did in Theorem \ref{ArnTop}, observe that in the boundary $U=[1,2]\times T^2$ we have $\beta|_{t=1}=d\theta$ and $\beta|_{t=2}= Cd\theta +Dd\varphi$. Let us prove that in an arbitrary interpolation, we can find a $\beta$ satisfying the boundary conditions and the required conditions inside. For the volume form $dt\wedge d\theta \wedge d\varphi$, which is preserved by $X$ and extends as a globally preserved volume form, we can compute the curl of $X$. It satisfies the condition $\iota_Y \mu=d(t\alpha)$. By writing such an equation in every interval (1)-(7) of Lemma \ref{int}, we find the following expression of $Y$. \begin{equation*} Y= \begin{cases} \pp{}{\varphi} - [tH_1'+H_1] \pp{}{\theta} \qquad &t\in I_1 \\ \pp{}{\varphi} - \pp{}{\theta} \qquad &t\in I_2\\ \pp{}{\varphi} - \pp{}{\theta} \qquad &t\in I_3\\ [1+H_4(C-1)+tH_4'(C-1)]\pp{}{\varphi} - \pp{}{\theta}\qquad &t\in I_4\\ C\pp{}{\varphi} - \pp{}{\theta} \qquad &t\in I_5\\ C\pp{}{\varphi} - [1+H_6(D-1)+tH_6'(D-1)]\pp{}{\theta} \qquad &t\in I_6\\ C\pp{}{\varphi}- D\pp{}{\theta}\qquad &t\in I_7 \end{cases} \end{equation*} Hence, we define $\beta$ as the following one form. \begin{equation*} \beta= \begin{cases} d\theta + [tH_1'+H_1] d\varphi \qquad &t\in I_1 \\ d\theta + d\varphi \qquad &t\in I_2\\ d\theta + d\varphi \qquad &t\in I_3\\ [1+H_4(C-1)+tH_4'(C-1)]d\theta + d\varphi \qquad &t\in I_4\\ Cd\theta+d\varphi \qquad &t\in I_5\\ Cd\theta + [1+H_6(D-1)+tH_6'(D-1)]d\varphi \qquad &t\in I_6\\ Cd\theta + Dd\varphi\qquad &t\in I_7 \end{cases} \end{equation*} Such one form clearly satisfies $\beta(Y)=0$. Furthermore, looking at the expression of $X$ in Lemma \ref{int}, we have that $\beta(X)>0$ and $\iota_Xd\beta=0$. \end{proof} The interpolation Lemma \ref{int} was adjusted so that one can also find the one form $\beta$. Take $M$ to be a graph manifold and $X$ an Arnold fluid constructed as in Theorem \ref{main}, so that for some metric $g$ we have \begin{equation*} \begin{cases} \iota_X d\alpha&=-dB \\ d\iota_X\mu&=0 \end{cases}, \end{equation*} where $\alpha=g(X,\cdot)$ and $\mu$ is the Riemannian volume. Denote $Y$ the curl of $X$ with respect to $g$. By Lemma \ref{beta} we know there is a one form $\beta$ such that $\beta(X)>0$, $\beta(Y)=0$ and $\iota_X d\beta=0$. \begin{Remark} Note that for this $\beta$, the vector field $X$ is a rescaling of the Reeb field of the stable Hamiltonian structure $(\beta, \iota_X\mu)$. \end{Remark} Consider in $M\times \mathbb{R}$, with coordinate $t$ in the second component, equipped with the two form $$ \omega= dt \wedge \beta +td\beta + \iota_X \mu. $$ For $t$ small enough, it is clearly a symplectic form. This is in fact the symplectization (cf. \cite{CV2}) of the stable Hamiltonian structure $(\beta,\iota_X\mu)$. The Euler flow $X$ and its curl can be seen as some Hamiltonian system with Bott integral in the symplectic manifold $M\times (-\varepsilon,\varepsilon)$ equipped with $\omega$ as symplectic form. \begin{prop}\label{sym} The pair $F=(t,-B)$ defines an integrable system in $M\times [-\varepsilon,\varepsilon]$. The Hamiltonian vector fields of $t$ and $B$ in $M\times \{0 \}$ are respectively $X$ and its curl. \end{prop} \begin{proof} The vector field $X$ satisfies that $$ \iota_X \omega= -dt+t\iota_X d\beta= -dt,$$ which implies that $X$ is the Hamiltonian vector field of the function $H=t$. Furthermore, contracting $Y$ with the symplectic form we obtain $$ \iota_Y \omega= \iota_Y \iota_X \mu + t\iota_Yd\beta. $$ Recall that $Y$ satisfies that $\iota_Y\mu=d\alpha$, so we have $\iota_Y\iota_X \mu= -\iota_X d\alpha=dB$. If $X_B$ denotes the Hamiltonian vector field of the function $-B$, we have that $X_B|_{t=0}=Y$. It remains to check that $F=(t,B)$ define an integrable system. Clearly, $dt\wedge dB \neq 0$ almost everywhere, since $dB$ vanishes in zero measure stratified sets. Additionally, we have \begin{align*} \omega(X_t,X_{B})&=-\omega(X_B,X_t)\\ &= -\iota_{X_B}\omega (X_t) \\ &= -dB(X) \\ &=0. \end{align*} The last equality follows from the first Euler equation: the fact that $\iota_X d\alpha=-dB$. \end{proof} We obtain an alternative proof that any topological configuration of a Bott integrable system can be realized, with the additional property that the Hamiltonian vector field is, up to rescaling, the Reeb field of a stable Hamiltonian structure. The result is stated in the introduction as Theorem \ref{maincor}. The realization theorem for Bott integrable systems was originally proved by Bolsinov-Fomenko-Matveev \cite{BFM}. Proposition \ref{sym} unveils an example of an explicit (and expected) relation between Arnold's structure theorem and the classical Arnold-Liouville theorem in the theory of integrable systems. However the symplectization procedure to obtain integrable systems is \emph{ad hoc}. In general, for a non-vanishing flow with an analytic or even Morse-Bott Bernoulli function, it is not possible to find a one form as in Lemma \ref{beta}. In a point of the critical set of the Bernoulli function, we have that $\iota_Xd\alpha=0$ and $\iota_Yd\alpha=0$. This implies that either $d\alpha$ vanishes and so does $Y$, or $Y$ is non-vanishing and parallel to $X$. It is clear that in the second case one cannot find a one form such that $\beta(X)>0$ and $\beta(Y)=0$. It is possible to find examples where this happens, using Example 4.4 in \cite{KKP}. \begin{example} Consider the three torus $T^3$ with the standard metric on it $g=d\theta_1^2+ d\theta_2^2 +d\theta_3^2$. We take the volume preserving vector field $$ X= \sin^2 \theta_3 \pp{}{\theta_1} + \cos \theta_3 \pp{}{\theta_2}, $$ which is tangent to the tori obtained by fixing the third coordinate. The curl of $X$ is given by $Y=\sin \theta_3 \pp{}{\theta_1} + 2\sin \theta_3 \cos \theta_3 \pp{}{\theta_2}$. The dual form to $X$ is $\alpha= \sin^2 \theta_3 d\theta_1 + \cos \theta_3 d\theta_2$, from which we can deduce that the analytic Bernoulli function is $B=\frac{1}{2}(\sin^4\theta_3 + \cos^2\theta_3)$. Along the torus $\theta_3=\pi/2$, we have that the derivative of the Bernoulli function vanishes. However, both $X$ and $Y$ are non-vanishing and parallel. Hence in such example one cannot find a one form as in Lemma \ref{beta}. \end{example} We can also produce an example with a Morse-Bott Bernoulli function. \begin{example} Consider the solid torus as in the block of Section \ref{ssec:blocks}. Take coordinates $(\theta,x,y)$ in $S^1\times D^2$, and denote by $(r,\varphi)$ polar coordinates in $D^2$. We consider the one form $$ \alpha= (r^2+\varepsilon)d\theta + \varphi(r)xdy, $$ where $r=x^2+y^2$, the function $\varphi(r)$ is constantly equal to $1$ close to $0$ and equal to $0$ for $r\geq \delta$. The vector field will still be $X=\pp{}{\theta}$ and the volume form is $\mu=rdr\wedge d\varphi \wedge d\theta=dx\wedge dy \wedge d\theta$. We have $$ d\alpha= 2rdr\wedge d\theta + (\pp{\varphi}{x}2x^3+\varphi)dx\wedge dy. $$ As before, we have that $\iota_Xd\alpha=d(r^2)$, so the Bernoulli function is Morse-Bott $B=r^2$. However, constructing a metric with Lemma \ref{eul}, the curl of $X$ is no longer $\pp{}{\varphi}$. For $r>\delta$, we have $Y=\pp{}{\varphi}$. For $r$ very close to $0$ we have that $\varphi(r)=1$ and hence $d\alpha=2rdr\wedge d\theta + dx\wedge dy$. For such a form, the curl of $X$ is $$ Y=2\pp{}{\varphi} + \pp{}{\theta}, $$ which doesn't vanish at $r=0$. The construction in the solid torus can be completed to a compact manifold as done in Section \ref{sec:arn}. \end{example} In both cases the one form $\beta$ cannot be constructed, and in fact these fluids cannot be seen as integrable systems, as long as we ask the natural compatibility conditions that $X$ and $Y$ are respectively the Hamiltonian vector fields of the integrals $t$ and $B$. Indeed if $Y$ was the Hamiltonian vector field of $B$, it should always vanish at the critical points of $B$, since it would be defined by the equation $\iota_Y \omega=dB$ for some symplectic form $\omega$. Such condition is not satisfied in the previous examples. \section{Singular Morse-Bott Arnold fluids} In this last section we study the most general case of Euler flows with a Morse-Bott Bernoulli function. Those are singular Arnold fluids, and by singular we mean that we allow the vector field $X$ to have stagnation points. We will prove that these fluids do not exist in non graph manifolds. \subsection{Critical sets of the Bernoulli function} Let us first analyze the level sets of a Morse-Bott Bernoulli function. A first lemma is the non-existence of non-degenerate critical points. \begin{lemma}\label{lem:nosad} Let $X$ be a steady Euler flow with smooth Bernoulli function $B$. Then $B$ does not have any non-degenerate critical point. \end{lemma} \begin{proof} Assume there is a critical point $p$ which is not of saddle type. By the Morse lemma there is a local chart $(U,(x,y,z))$ around $c$ such that the functon is $B=x^2+y^2+z^2$ or $B=-x^2-y^2-z^2$. But then either $B^{-1}(\varepsilon)$ or $B^{-1}(-\varepsilon)$ is a regular level set diffeomorphic to a sphere. This is a contradiction with Arnold's theorem, which ensures that all regular level sets are tori. It only remains the case of a saddle point.\hfill \newline Now let $p$ be a saddle point of $B$. Again by the Morse lemma, there are coordinates $(x,y,z)$ such that $$ B=x^2+y^2-z^2. $$ In these coordinates, we can write $$X=X_1\pp{}{x}+X_2\pp{}{y}+X_3\pp{}{z}$$ and $$ d\alpha=Ady\wedge dz + Bdx\wedge dz + Cdx\wedge dy, $$ where $X_1,X_2,X_3,A,B,C$ are functions depending on $x,y,z$. The first Euler equation $\iota_Xd\alpha=-dB$ implies \begin{equation}\label{eq:system} \begin{cases} X_1B-X_2A=z\\ X_1C-X_3A=-y\\ -X_3B-X_2C=-x \end{cases} \end{equation} We claim that $d\alpha|_p\neq 0$. Assume the converse, that $d\alpha|_p=0$. Because $B$ is an integral of $X$, we have that $X$ vanishes at $p$ necessarily. There are several ways to see this. Take coordinates $(x,y,z)$ around $p$ and denote by $X_1,X_2,X_3$ the components in each coordinates of $X$. Similarly, denote $B_1,B_2,B_3$ the derivatives of $B$ with respect to $x,y$ and $z$. The fact that $B$ is an integral of $X$ implies that $X_iB_i=0$. Deriving this equation and restricting to the critical point we get $$(X_1,X_2,X_3) D^2B (X_1,X_2,X_3)^T|_p=0, $$ where $D^2B$ is the Hessian of $B$. This matrix is non-degenerate at $p$ and hence we deduce that $(X_1,X_2,X_3)|_p=0$. Taking the Taylor expansions of the functions $X_1,X_2,X_3$ and $A,B,C$, they all have a vanishing coefficient of order $0$. In particular, the combinations of the system \eqref{eq:system} yield functions that vanish at order two at least. This contradicts the system of equations. We deduce that $d\alpha|_p\neq 0$. However, we know that the vorticity $Y$ is determined by the equation $$ \iota_Y \mu=d\alpha, $$ which implies that $Y|_p\neq 0$. However $B$ is also an integral of $Y$ because $\iota_YdB=-\iota_Y\iota_Xd\alpha=\iota_X \iota_Yd\alpha=0$ and by the previous argument this implies that $Y|_p=0$. We obtain a contradiction, and conclude that a saddle point cannot exist. \end{proof} The previous lemma applies in full generality, however we will see that in the case of a non graph manifold this is enough to prove the non-existence of Bott integrable fluids. We can deduce the structure of the critical level set of $B$. \begin{lemma}\label{lem:stru} Let $X$ be an Euler flow with Morse-Bott Bernoulli function. Let $c$ be a critical submanifold. Then $c$ is either a circle, a torus or a Klein bottle. If $c$ is a circle of saddle type, denote by $Z$ a regular component of the critical level set containing $c$. Then $Z$ is an orientable finitely punctured surface with finite genus. \end{lemma} \begin{proof} If $c$ is two dimensional, it has to be a compact surface. Furthermore, the regular level sets in a trivial neighborhood of $c$ must be tori because of Arnold's theorem. This implies that $c$ is either a torus or a Klein bottle. If $c$ is one dimensional, it is compact and hence a circle. The last case is when $c$ is a critical point. For the second part of the lemma, denote by $Z$ a $2$-dimensional strata of a critical level set: it is an open embedded surface. The fact that $Z$ is orientable follows from the fact that $dB\neq0$ everywhere in $Z$ and is transverse to it. Then the gradient of $B$, which satisfies $g(\operatorname{grad}B,\cdot)=dB$, is a vector field everywhere transverse to $Z$. This implies that $Z$ is an open orientable surface. By compactness, it has a finite amount of punctures (approaching the critical points or circles) and has finite genus. \end{proof} \subsection{Non existence of Bott integrable fluids} We proceed with the proof of Theorem \ref{thm:sing}. \begin{proof}[Proof of Theorem \ref{thm:sing}] We will first show that a stratified Bernoulli function has necessarily a non-empty $0$-strata if $M$ is not of graph type. A function is stratified \cite{EG0} if its critical values are isolated and the critical level sets are Whitney stratified sets of codimension greater than zero. This includes both analytic and Morse-Bott functions. The claim follows easily from the theory of tame functions introduced in \cite{FM}. Assume that there are no $0$-strata. The $1$-strata are necessarily critical circles, by compactness. By Arnold's theorem, every regular level set is a torus. Then the function $B$ is a tame function in the sense of \cite{FM}, and $M$ has to be a graph manifold: this is a contradiction. Hence, if $B$ is a Morse-Bott Bernoulli function of some steady Euler flow in a non-graph manifold, it necessarily has an isolated critical point. By Lemma \ref{lem:nosad}, this is not possible and we conclude that such steady flow cannot exist. \end{proof} The Morse-Bott assumption was key in the proof, and so for the case of an analytical Bernoulli function the problem of existence of integrable steady fluids in non graph manifolds remains open.
\section{Introduction} Many aspects concerning radio echos from meteoroid trails can be understood in terms of the line-oscillator model. The standard work for this is McKinley's book \cite{McK}, chapter 8 and 9. However, McKinley does not show how frequency shifts near the optimal reflection point can be calculated. In this paper the formalism of \cite{McK} is extended to include frequency shifts. In doing so a close relation appears between the line-oscillator and what is referred to as the "moving ball" model. In the latter model frequency shifts occur because the radio echo will be Doppler shifted. Inspecting measured meteoroid radio echo's such as shown in figures~\ref{ex1} and \ref{ex2} one can observe two distinct parts. The first part is a signal with a frequency deviating from the transmitter frequency and the second part,which extends over longer time, is centered around the transmitter frequency. This first part is often referred to as the "head echo". Many authors interpret this signal in terms of Doppler shifts. The larger second part is well understood as a reflection from the trail left behind after a meteoroid passed. The free thermalized electrons in the trail can cause strong reflections of the radio signal when their individual amplitudes add coherently. The head echo is produced during trail formation. In the line-oscillator description the scattering electrons, created as the trail is formed, will have relative phases such that it appears as a frequency shift away from the emitter frequency. This is not the Doppler shift due to reflections on a co-moving plasma. The latter is assumed in the moving ball description. Some recent work on Doppler shifts in head echos can be found in this journal. See for example \cite{Kauf,Verb, German}. One aim of this paper is to derive an approximate value of the frequency shift using the line-oscillator model of \cite{McK}. The notation of that work will be followed unless otherwise indicated. For the convenience of the reader some of the formalism in ref.~\cite{McK} will be repeated here. The derivation of the frequency shift in this model will be given in the next section. The third section considers the case of Doppler shifts, showing the close connection with the line-oscillator model. In section 4 example calculations are made for a qualitative comparison with observations. Section 5 gives a suggestion why spectra like the one shown in fig.~\ref{ex1} with only a half head echo are seen more frequently than the one in fig.~\ref{ex2} with a complete head echo. The final section contains some concluding remarks. \section{Derivation of the frequency shift} When an ionized trail is made by a meteoroid (see fig.~\ref{fig1}), the created free electrons act as individual scatterers, they re-emit the signal of a transmitter in all directions. These can be observed in a receiver contributing an amplitude $dA_R$ \begin{equation}\label{dAr} dA_R \propto \sin\left( 2\pi f t - \frac{2\pi(R'_1+R'_2)}{\lambda} \right) \ , \end{equation} where $\lambda$ is the transmitters wavelength and $f$ its frequency. ()All other parameters in this work are defined in fig.~\ref{fig1}.) Each scattering contribution has a different phase depending on the distance $(R'_1+R'_2)$ the signal travels. Going along the trail the addition becomes coherent when \nopagebreak $~{d (R'_1+R'_2)/dt=0}$. At this point the path followed is a reflection, the specular condition. The length of this path is $R_1+R_2$ and is the shortest path between transmitter and receiver via a point on the meteoroid trajectory. This point will be referred to as the specular point. In fig.~\ref{fig1} also shows signal paths corresponding to back scattering. This is the radar setup, where emitter and transmitter are at nearly the same location. An arbitrary path has length $2R$ and the shortest path is $2R_0$. Near the specular point where $s\ll R_0$ one finds that \begin{figure} \includegraphics[width=0.8\linewidth]{fig188.pdf}\centering \caption{[color on-line] TX and RX are the locations of the transmitter and receiver, respectively. The signal path for back scattering (red) and for forward scattering (blue) is shown for the optimal path corresponding to the reflection (specular) point, $t_0$, (full lines) and the path of a contributing neighboring point (dashed lines) separated by a distance $s$. }\label{fig1} \end{figure} \begin{eqnarray} R_1'+R_2'&\approx &R_1 +R_2 +\frac{s^2 \sin^2 \omega}{2}\left (\frac{1}{R_1-s\cos\omega} +\frac{1}{R_2+s\cos\omega}\right )\\ &\approx& R_1 +R_2 +\frac{s^2 \sin^2 \omega}{2}\ \frac{R_1+R_2}{R_1 R_2} \ .\label{aberhallo} \end{eqnarray} This reduces to \begin{equation}\label{simple} R \approx R_0 +\frac{s^2}{2R_0} \end{equation} for back scattering. Also note that in chapter 9 of \cite{McK} the notation was changed: $s \rightarrow f$ or \textit{\textsf{f}}. Here we will use $s$ consistently for the path of the meteoroid. Further note that, in general, $\omega \ne \pi/2-\phi$ because the trail may make an angle $\beta$ with the plane where forward scattering takes places, in which case $ \sin^2\omega=1- \sin^2\phi\cos^2\beta$. \begin{figure} \includegraphics[width=0.8\linewidth]{ex1.jpg}\centering \caption{Typical example, of a strong head echo. The horizontal scale is one second long, the vertical scale 1.5 kHz. The slope corresponds to -9.7 kHz/s Data were taken 05 May 2020 in Kampenhout (BE) using the 49990 kHz VVS beacon near Ieper (BE)\cite{Felix}}\label{ex1}. \end{figure} Central to the problem is the summation over individual scatterers along the trail. The model assumes a constant ionization density along the trail, the amplitude is then given by \begin{equation}\label{Integral} A_R\propto\int_{x_1}^{x}\sin(\chi - \frac{\pi x^2}{2} )dx \ . \end{equation} Following \cite{McK}, we first evaluate the integral for back scattering where $2s=x(R_0 \lambda)^{1/2}$ and $\chi=2\pi f t\ + $ a time independent phase. Thus one sums from the beginning of the trail until a point $s(t)$, i.e. the length of the trail at time t. Without loss of generality $x_1 \rightarrow -\infty$ can be assumed, as shown explicitly in section 3. One obtains \begin{equation} A_R \propto \left(C(x)+\frac{1}{2}\right) \sin \chi -\left(S(x)+\frac{1}{2}\right) \cos \chi \ , \end{equation} where $C$ and $S$ denote Fresnel integrals\footnote{Here $S(z)=\int_{0}^{z} \sin\frac{\pi t^2}{2} dt$ and $C(z)=\int_{0}^{z} \cos\frac{\pi t^2}{2} dt$}. To see what this means for the frequency we look at times $t<t_0$ and $t>t_0$ avoiding the complex behavior near $t_0$ by considering $|x|\gtrapprox1$. With this approximation \begin{equation}\label{aleft} A_{<} \propto \frac{\cos (\chi- \frac{\pi x^2}{2})}{\pi x}\ \mathrm{and} \ A_{>}\propto\sin (\chi )-\cos (\chi )+\frac{\cos (\chi -\frac{\pi x^2}{2})}{\pi x}\ . \end{equation} As $t$ approaches $t_0$ the amplitude $A_<$ increases slowly compared with the frequency $f$. At each $t$ the instantaneous frequency $f_i$ can be obtained by determining the phase $\Phi$ of $A_<(t)$ \begin{equation}\label{aleft2} \Phi=\chi - \frac{\pi x^2}{2} =2\pi f t - 2\pi \frac{s^2}{R_0\lambda}\ \end{equation} and taking its derivative with respect to $t$, giving \begin{equation}\label{fi} f_i=\frac{1}{2\pi}\frac{d \Phi}{dt}=f-\frac{2s\ ds/dt}{R_0 \lambda} \ . \end{equation} Note that here $s>0$ and $ds/dt <0$, the shift is thus positive. In practice one analyses the change in the instantaneous frequency $f_i$, \begin{equation}\label{timedepshift} \frac{df_i}{dt}=-2\left( \left[ \frac{ds}{dt} \right]^2 + s\frac{d^2s}{dt^2} \right)\frac{1}{R_0 \lambda} \ . \end{equation} A simple model choice is a constant velocity where $s=|V (t_0- t)|$, so that \begin{equation}\label{8-15r} \frac{df_i}{dt}=-\frac{2V^2}{R_0\lambda}\ . \end{equation} To obtain the shift in forward scattering one simply replaces eq.~\ref{simple} wit eq.~\ref{aberhallo} to find \begin{equation}\label{result} \frac{df_i}{dt}\approx-\frac{V^2 \sin^2\omega}{\lambda}\frac{R_1+R_2}{R_1R_2}\ . \end{equation} For $t>t_0$ there is no such simple derivation for the phase of $A_>$ possible. In order to get insight numerical calculations were done. These will be discussed in section~\ref{calcs}. \section{Derivation of the frequency shift in terms of Doppler shifts} \begin{figure}\centering \includegraphics[width=0.8\linewidth]{ex2.jpg} \caption{Less common head echo showing a shift that extends to negative shifts. The slope is -4.9 kHz/s. Data taken on 09 June 2011 in Kampenhout using the 49970 kHz BRAMS beacon at Dourbes (BE)\cite{Felix}}\label{ex2}. \end{figure} In this section we consider the possibility that only a short part of the trail survives, so that it has a length $x <1$. Thus where at the front free electrons are created they disappear at the back. Therefore, the trail has a constant length $\Delta x$. In fact for the observer it appears as a passing object, which maybe as well be the meteoroid itself. When this object passes point $t_0$ it will give an echo. In this case one can approximate eq.~\ref{Integral} by \begin{equation}\label{delta} A_R\propto\sin(\chi - \frac{\pi x^2}{2} )\Delta x \ . \end{equation} The phase of this amplitude is identical to that in eq.~\ref{aleft2} and the same relations hold for the shifts. The shift continues for $t>0$ where the instantaneous frequency, $f_i$, is lower than the emitter frequency $f$. The bistatic Doppler shift is given by $-\frac{1}{\lambda}{d (R'_1+R'_2)/dt}$. Using the same approximations as eq.~\ref{aberhallo}ione arrives at the identical expression as in eq.~\ref{fi}. Thus the shifts are the same as they must be, because of Galilean invariance. A more informative evaluation will come from a numerical calculation in the next section. \section{Example Calculations}\label{calcs} At this point it may be interesting to consider in more detail how the signal appears in observation. The result of section 2 and 3 can be generalized into one expression \begin{equation}\label{ARl} A_R \propto \left(C(x)-C(x-\Delta x)\right) \sin \chi -\left(S(x)-S(x-\Delta x )\right) \cos \chi \ , \end{equation} where $\Delta x$ is the length of the object or trail as defined above. In the following calculation we use for $s$ the backscatter configuration with $V=30$ km/s, $R_0=100$ km, and an emitter frequency $f=50$~MHz. First we consider the signal power, $\overline{ A_R^2(t)}$, which is obtained by averaging over a time long with respect to the frequency but small with respect to $x(t)$. In fig.~\ref{powerplot} this quantity is shown, evaluated for various values of $\Delta x$. \begin{figure}\centering \includegraphics[width=0.7\linewidth]{signalstrength.pdf} \caption{$\overline{ A_R^2(x(t))}$ for $\Delta x= 0.5,1,2,4,8,\infty$ (black, red, blue, green, cyan, magenta)}\label{powerplot} \end{figure} For small $\Delta x$ the signal has a nearly Gaussian dependence, where it should be noted that $x=1$ corresponds to about one Fresnel zone (here it corresponds to $t=\sqrt{\lambda R_0}/2V=13\ \mathrm{ms}$ or a distance of $387\ \mathrm{m}$). At this small distance the signal has the characteristics of Fraunhofer slit scattering. For $\Delta x>2 $ and $x>1$ one observes what are called Fresnel oscillations. $\Delta x=\infty$ refers to the situation discussed in section 2; the pattern seen here corresponds to Fresnel edge scattering. The oscillation frequency in the Fresnel pattern (see chapter 8 eq.~(8-15) in \cite{McK}) is identical to the frequency shift calculated in section 2. In fact, historically, it has been a main tool for determining meteoroid velocities instead of the frequency shift. \begin{figure} \includegraphics[width=0.4\linewidth]{exnew1.pdf}\hfill \includegraphics[width=0.4\linewidth]{exnew2.pdf} \caption{[Color online] Time versus frequency of $\log(A_R)$ obtained with a STFT procedure. Left: passing trail or object. Right: Dynamic meteoroid trail. See text}\label{spectra} \end{figure} To observe the frequency dependence of eq.~\ref{ARl}, it should be displayed as a time dependent frequency spectrum similar to the observed data. This can be done by a Short Time Fourier Transform (STFT) of the theoretical expressions for $A_R$ in eq.~\ref{ARl} (see appendix \ref{appa}). The results are shown in fig.~\ref{spectra}. First we discuss the spectrum (left) which is close to what was discussed in the previous section. The size of the object or trail passing through the specular point is taken to be $\Delta x=1$. The signal has the characteristic Doppler shift dependence with a maximum at the specular point. Superimposed is a Fraunhofer diffraction spectrum. This pattern has to occur independent of the interpretation of the object in terms of a a short-lived trail or as moving object. The spectrum on the right is for $\Delta x=\infty$, the line oscillator model of section 2. It is dominated by the ridge at $f_i - f=0$ at $t>t_0$. Its origin is the stationary trail. The diagonal in the spectrum has the same time-frequency dependence as the left-hand spectrum but without the diffraction pattern. This is the head echo from the trail as it is being formed. There are several observations to be made at this point: The Fresnel oscillations found in fig.~\ref{powerplot} are not seen in the spectrum. They appear by reducing the Hann window in the STFT (see appendix \ref{appa}). Calculations were made for a window width of 0.5, 1 and 2 Fresnel zones. For the short window the oscillations can be seen, but at the cost of resolution in frequency. This is characteristic for a Fourier transform where time and frequency resolution exclude each other mutually. In fig.~\ref{three} the frequency spectrum is shown at $t=0.2$~s for the three Hann windows. The spectrum with the largest Hann window was also used to obtain fig.~\ref{spectra}. The branch of the head echo is clearly seen for that window, while for the smallest window it has all but disappeared due to the reduced frequency resolution. Notice that the head echo signal is more than 100 times smaller compared to the signal of the stationary trail. This indicates that measuring the head echo at $t>t_0$ requires that the receiver settings and the associated analysis programs need to take the time average in consideration. The observation of the frequency shift at $t<t_0$ is rather robust and thus also in an actual measurement. If possible, one could determine both the Fresnel oscillations and the frequency shift by analyzing the data in two different ways by good time and poor frequency resolution and vice versa, respectively. In this way one has two ways to measure the meteoroid velocity. One might expect measured events as in fig.~\ref{ex2} to be the most common. However, most observations are as in fig.~\ref{ex1}. This is either due to problems associated with measuring the head exho at $t>t_0$ for the reasons mentioned above or because the line-scattering model is not describing the meteoroid events adequately. Another reason for this can be the observational bias for strong echo's with a short trail below the specular point. \begin{figure} \includegraphics[width=0.8\linewidth]{logplot.pdf}\ \caption{[Color online] Frequency spectrum of $\log(\mathcal{A_R})$ at $t=0.2$~s the green, orange and blue curves refer to an average over 0.5, 1, and 2 Fresnel zones, respectively. The branch of the head echo is at -700 Hz. See also text}\label{three} \end{figure} \section{The half-ball model} The characteristic asymmetric behavior of the head echo noticed at the end of the previous section can be resolved assuming reflections from the plasma in front of -- and moving with -- the meteoroid. Research around 2000, for example with Arecibo \cite{Mathews} and ALTAIR \cite{NASA} shows the importance of the head echo plasma. Such a plasma reflects radio waves like a metal mirror. The specular condition is then irrelevant since there will always be a spot on a sphere allowing reflection from transmitter to receiver; also in forward scattering. But in forward scattering it is important to realize that only the front half of the meteoroid has this property. The situation is sketched in fig.~\ref{halfcanon}. Only in the approaching phase reflections are possible up to the specular point, after that reflections would have to come from the back of the meteoroid. Therefore, in this scenario a true Doppler shift signal is observed until $t=t_0$, and after that only the trail left by the meteoroid at the specular point contributes to the signal. This scenario, which could be called the "half-ball model", would explain experimental data as in fig.~\ref{ex1}. Reflections at the specular point proceed via the shortest path between transmitter and receiver and therefore also give the strongest reflection in this model, as it does in the line-oscillator model. It will be interesting to combine line-oscillator model (observing the back tail) with the "half-ball model" as the relevant trail parts do not pass the specular point at exactly the same time. In any case it is somewhat surprising that the head plasma reflection is strong enough to be seen in a comparatively modest amateur setup. \begin{figure}\centering \includegraphics[width=0.7\linewidth]{halfcanon.pdf}\hfill \includegraphics[width=0.3\linewidth]{halfballplot.pdf} \caption{[Color online] Half-ball model. An echo can be seen at any point along the meteoroid trajectory. But only from the front plasma of the meteoroid. After passing the specular point ($t=t_0$), there will be no echo any longer except from the stationary trail. The right hand side shows a calculation where this was implemented in the line-oscillator model although this is not the right model for such a scenario. }\label{halfcanon} \end{figure} \section{Conclusions} Two very different approaches lead to the same shifts in the radio-echo frequency when a meteoroid passes through a point where the specular condition is fulfilled. One assumes either thermalized electrons in the local atmosphere \label{key}or electrons co-moving with the meteoroid as the scatterers. They lead to the same frequency shifts because they are both based on the time derivative of eq.~\ref{aberhallo}. The model discussed in section 2 describes head echos and the resulting stationary trail in a unified way. More explicitly, further calculations in section~\ref{calcs} show that frequency shift and the Fresnel diffraction pattern relates to the same observable eq.~\ref{fi}. In section 3 it was shown that a short-lived trail and a moving object give the same frequency shift of the head echo as in section 2. The size of the object must have $|x|\lessapprox1$, i.e one Fresnel zone. The calculations show that in these cases a diffraction pattern should be visible on the head echo. In practice this is not observed. This may be because of the simplicity of the model. The calculations in section~\ref{calcs} allow for a qualitative comparison with actual observations. The contradicting requirements for frequency and time resolution were pointed out and it was also shown that this is reflected in the duality observing either the Fresnel diffraction or the frequency shifts. This duality may also play a role in the absence of a head echo at $t>0$ in most observations. Another reason for this can be the observational bias for strong echo's with a short trail below the specular point. However, assuming that a co-moving plasma in front of the meteoroid is important, there is a simple geometric argument why there is no head echo after the meteoroid passes the specular point $t_0$. As a final remark and recommendation: The measurements of meteoroid echos contain much more information than the frequency shifts. In particular the rapid decay of the signal after the head echo, occurring within a second, may contain more hints as to the precise nature of the meteoroid event. Modern equipment allows a quantitative measurement of the signal strength and the classic text of \cite{McK} provides several methods for its analysis.
\section{Introduction} Many learning and inference tasks in high-dimensional statistics boil down to estimating / approximating the joint probability of a set of random variables (RVs). Having the joint probability allows us to construct predictors that are optimal in a certain probabilistic sense, e.g., the \textit{maximum a posteriori} (MAP) estimator or the \textit{minimum mean squared error} (MMSE) predictor. However, in the high-dimensional regime, directly estimating the joint probability via `structure-free' methods such as sample averaging is considered infeasible \cite{wainwright2019high}. Suppose that there are $N$ RVs, where each has an $I$-dimensional alphabet. To estimate the joint probability reliably, we generally need $S \gg \Omega(I^{N})$ `diverse' $N$-dimensional examples (without any entries missing). This is because the probability of encountering most $N$-tuples is very low. Therefore, only a small portion of the empirical distribution will be non-zero given a reasonable amount of data samples---this makes the approach considerably inaccurate in most cases. Many workarounds have been proposed to circumvent this challenge in the literature. For example, linear approximations have been widely used, e.g., the linear MMSE (LMMSE) estimator \cite{kay1993fundamentals}. Logistic regression, kernel methods, and neural networks can be understood as nonlinear function approximation-based counterparts \cite{bishop2006pattern,murphy2012machine}. These are effective surrogates, but do not directly address the fundamental challenge in estimating high-dimensional joint probability from limited samples. Another commonly adopted route in statistical learning is to make use of problem-specific structural assumptions such as graphical models and prior distributions to help reduce the model complexity \cite{jordan1998learning,tipping2001sparse,blei2003latent}---but making these assumptions restricts the methods to specific applications. Very recently, Kargas {\it et al.} proposed a new framework for {\it blindly} estimating the \textit{joint probability mass function} (PMF) of $N$ discrete finite-alphabet RVs \cite{kargas2017tensors}. Building upon a link between high-dimensional joint PMFs and low-rank tensors, the work in \cite{kargas2017tensors} shows that any $N$-dimensional joint PMF admits a naive Bayes {\it representation}. In addition, if the RVs are `reasonably dependent', the joint PMF can be recovered via jointly decomposing the three-dimensional marginal PMFs (which are third-order tensors). The approach in \cite{kargas2017tensors} does not involve any structural information among the RVs or function approximation and provably guarantee the recoverability of the joint PMF---if the three-dimensional marginal PMFs are accessible. The work in \cite{kargas2017tensors} has shown promising results. However, many challenges remain. First, accurately estimating three-dimensional marginal PMFs is not a trivial task, which requires enumerating the co-occurrences of three RVs. This is particularly hard if the alphabets of the RVs are large and the data is sparse. Second, tensor decomposition is a challenging optimization problem \cite{hillar2013most}. Factoring a large number of latent factor-coupled tensors as in \cite{kargas2017tensors} also gives rise to scalability issues. A natural question is: can we use pairwise marginals, i.e., joint PMFs of {\it two} RVs, to achieve the same goal of joint PMF recovery? Pairwise marginals are much easier to estimate relative to triple ones. In addition, the pairwise marginals give rise to probability mass matrices other than tensors---which may circumvent tensor decomposition in algorithm design and thus lead to more lightweight solutions. Notably, a recent work in \cite{yeredor2019maximum} offers an {\it expectation maximization} (EM) algorithm that directly estimates the latent factors of the $N$th-order probabilistic tensor from the `raw data', instead of working with a large number of three-dimensional marginals. The EM algorithm is well-motivated, since it is associated with the {\it maximum likelihood estimator} (MLE) under the naive Bayes model in \cite{kargas2017tensors}. In addition, it admits simple and economical updates, and thus is much more scalable relative to the coupled tensor decomposition approach. However, unlike the tensor-based approach in \cite{kargas2017tensors}, it is unclear if the recoverability of the joint PMF can be guaranteed using the EM and the MLE. In addition, since the ML estimation problem is nonconvex, convergence properties of the EM algorithm are unclear. \smallskip \noindent {\bf Contributions.} In this work, we propose a new framework that utilizes pairwise marginals to recover the joint PMF of an arbitrary number of discrete finite-alphabet RVs. We address both the theoretical aspects (e.g., recoverability) and the algorithmic aspects. Our contributions are as follows: \noindent $\bullet$ {\bf A Pairwise Marginal-based Framework.} On the theory side, we offer in-depth analyses for the recoverability of the joint PMF from pairwise marginals. We show that the joint PMF can be recovered via jointly factoring the pairwise marginals under nonnegativity constraints in a latent factor-coupled manner. Unlike \cite{kargas2017tensors} which leverages the uniqueness of tensor decomposition to establish recoverability, our analysis utilizes the model identifiability of \textit{nonnegative matrix factorization} (NMF)---leading to recoverability conditions that have a different flavor compared to those in \cite{kargas2017tensors}. More importantly, accurately estimating pariwise marginals is much easier relative to the three-dimensional counterparts, in terms of the amount of data samples needed. \noindent $\bullet$ {\bf Provable Algorithms.} On the algorithm side, we propose to employ a block coordinate descent (BCD)-based algorithm for the formulated coupled NMF problem. More importantly, we propose a pragmatic and easy-to-implement initialization approach, which is based on performing a Gram--Schmidt (GS)-like structured algorithm on a carefully constructed `virtual NMF' model. We show that this approach works provably well even when there is modeling noise---e.g., noise induced by finite-sample estimation of the pairwise marginals. This is in contrast to the method in \cite{kargas2017tensors}, whose recoverability guarantees are based on the assumption that the third-order marginals are perfectly accessible. We also show that the EM algorithm from \cite{yeredor2019maximum} can provably improve upon proper initialization (e.g., that given by the GS-like algorithm) towards the target latent model parameters that are needed to reconstruct the joint PMF. \noindent $\bullet$ {\bf Extensive Validation.} We test the proposed approach on a large variety of synthetic and real-world datasets. In particular, we validate our theory via performing classification on four different UCI datasets and three movie recommendation tasks. \smallskip Part of the paper was submitted to the Asilomar signal processing conference 2020 \cite{ibrahim2020recover}. The journal version additionally includes new theoretical results, e.g., the recoverability analysis for the coupled NMF formulation, and a BCD-based CNMF algorithm, the detailed proofs for the Gram--Schmidt-like procedure, and the optimality analysis for the EM algorithm. More real data experiments are also presented. \smallskip \noindent {\bf Notation.} We use $x,\bm x,\bm X,\underline{\boldsymbol{X}}$ to denote a scalar, vector, matrix and tensor, respectively. $\mathbb{D}_{\rm KL}$ denotes the KL divergence. $\kappa(\bm X)$ denotes the condition number of the matrix $\bm X$ and is given by $\kappa(\bm X) = \frac{\sigma_{\max}(\bm X)}{\sigma_{\min}(\bm X)}$ where $\sigma_{\max}$ and $\sigma_{\min}$ are the largest and smallest singular values of $\bm X$, respectively. $\|\bm x\|_0$ denotes the `zero norm' of the vector $\bm x$, i.e., the number of nonzero elements in $\bm x$. $\bm X \ge \bm 0$ implies that all the elements of $\bm X$ are nonnegative. ${\rm cone}(\bm X)$ represents the conic hull formed by the columns of $\bm X$ and ${\rm conv}(\bm X)$ denotes the convex hull formed by the columns of $\bm X$. $\emptyset$ denotes the empty set. $\|\bm X\|_{2}$ represents the 2-norm of matrix $\bm X$ and $\|\bm X\|_{2} = \sigma_{\max}(\bm X)$. $\|\bm X\|_{\rm F}$ denotes the Frobenius norm of $\bm X$. $\|\bm x\|_2$ and $\|\bm x\|_1$ denote $\ell_2$ and $\ell_1$ norm of vector $\bm x$, respectively. ${\rm vec}(\bm X)$ denotes the vectorization operator that concatenates the columns of $\bm X$. $^{\!\top\!}$ and $^\dag$ denote transpose and pseudo-inverse, respectively. $|{\cal C}|$ denotes the cardinality of set ${\cal C}$. ${\rm Diag}(\bm x)$ is a diagonal matrix that holds the entries of $\bm x$ as its diagonal elements. `$\odot$' denotes the Khatri-Rao product. \section{Background} Consider a set of discrete and finite-alphabet RVs, i.e., $Z_1,\ldots,Z_N$. We will use ${\sf Pr}(i_1,\ldots,i_N)$ as the shorthand notation to represent $${\sf Pr}\left(Z_1=z_1^{(i_1)},\ldots,Z_N=z_N^{(i_N)}\right)$$ in the sequel, where $\{z_n^{(1)},\ldots,z_n^{(I_n)}\}$ denotes the alphabet of $Z_n$. Suppose that we do not have access to the joint PMF ${\sf Pr}(i_1,\ldots,i_N)$. Instead, we have access to the lower-dimensional marginal distributions, e.g., ${\sf Pr}(i_j,i_k,i_\ell)$ and ${\sf Pr}(i_j,i_k)$ for different $j,k,\ell$. Kargas \textit{et al.} asked the following research question \cite{kargas2017tensors}: \vspace{.15cm} \noindent \boxed{ \begin{minipage}{.98\linewidth} \noindent Can the joint distribution of $Z_1,\ldots,Z_N$ be recovered from the low-dimensional marginals without knowing any structural information about the underlying probabilistic model? \end{minipage} } \vspace{.15cm} Note that estimating a high-dimensional joint distribution from lower-dimensional marginals is challenging, but not entirely impossible---if some structural information between the RVs (e.g., tree or Markov chain) is known; see discussions in \cite{kargas2017tensors}. However, learning the structural information from data {\it per se} is often a hard problem \cite{jordan1998learning}. \subsection{Tensor Algebra} The work in \cite{kargas2017tensors} utilizes a connection between joint PMFs and low-rank tensors under the \textit{canonical polyadic decomposition} (CPD) model \cite{harshman1970foundations,sidiropoulos2017tensor}. If an $N$-way tensor $\underline{{\bm X}} \in \mathbb{R}^{I_1 \times I_2 \times \cdots \times I_N}$ has CP rank $F$, it can be written as: \begin{equation}\label{eq:individ} \underline{{\bm X}}(i_1,i_2,\ldots,i_N) = \sum_{f=1}^F \boldsymbol{\lambda}(f) \prod_{n=1}^N {\bm A}_n(i_n,f), \end{equation} where ${\bm A}_n \in \mathbb{R}^{I_n \times F}$ is called the mode-$n$ latent factor. In the above, ${\bm \lambda}=[ \bm \lambda(1),\ldots,\bm \lambda(F)]^{\!\top\!}$ with $\|{\bm \lambda}\|_0=F$ is employed to `absorb' the norms of columns (so that the columns of $\boldsymbol{A}_n$ can be normalized w.r.t. a certain $\ell_q$ norm for $q\geq 1$). We use the shorthand notation $$\underline{{\bm X}} = [\![ {\bm \lambda}, {\bm A}_1,\ldots,{\bm A}_N ]\!]$$ to denote the CPD in \eqref{eq:individ}. Note that $F\gg I_n$ for $n=1,\ldots,N$ could happen. In fact, the tensor rank can reach $O(I^{N-1})$ if $I_1=\ldots=I_N=I$ \cite{sidiropoulos2017tensor}. \subsection{Joint PMF Recovery: A Tensor Perspective} A key takeaway in \cite{kargas2017tensors} is that {\em any} joint PMF admits a naive Bayes (NB) model {\em representation}; i.e., any joint PMF can be generated from a latent variable model with just one hidden variable. It follows that the joint PMF of $\{Z_n\}_{n=1}^N$ can always be decomposed as \begin{equation}\label{eq:pmf_latent_var} \begin{aligned} {\sf Pr}(i_1,i_2,\ldots,i_N) = \sum_{f=1}^F {\sf Pr}(f) \prod_{n=1}^N {\sf Pr}(i_n | f) \end{aligned}, \end{equation} where ${\sf Pr}(f) := {\sf Pr}(H = f) $ is the prior distribution of a latent variable $H$ and ${\sf Pr}(i_n | f) := {\sf Pr}( Z_n = z_n^{(i_n)} | H = f) $ are the conditional distributions. Remarkably, such representation is {\em universal} if one allows the hidden variable to have a sufficiently rich finite alphabet: \begin{theorem}\label{prop:F_upperbound}\cite{kargas2017tensors} The maximum $F$ needed in order to describe an arbitrary PMF using a naive Bayes model is bounded by $F\leq \underset{k}{\min}\prod_{\substack{n=1 \\ n \neq k}}^N I_n.$ \end{theorem} To see this, one can represent any joint PMF as an $N$th-order tensor by letting $\underline{\bm X}(i_1,\ldots,i_N)={\sf Pr}(i_1,\ldots,i_N)$ and ${\bm A}_n(i_n,f) = {\sf Pr}(i_n | f),~\boldsymbol{\lambda}(f) = {\sf Pr}(f).$ Since any nonnegative tensor admits a nonnegative polyadic decomposition with nonnegative latent factors, any joint PMF admits a naive Bayes representation with finite latent alphabet. A relevant question is: what does `low tensor rank' mean for the joint PMF tensors? In \cite{kargas2017tensors}, the authors argue that reasonably dependent RVs lead to a joint PMF tensor with relatively small $F$---which is normally the case in statistical learning and inference. For example, classification is concerned with inferring $Z_N$ (label) from $Z_1,\ldots,Z_{N-1}$ (features), and the dependence amongs the RVs are leveraged for building up effective classifiers. Another key observation in \cite{kargas2017tensors} is that the marginal distribution of any subset of RVs is an induced CPD model. From the law of total probability, if one marginalize the joint PMF down to ${\sf Pr}(i_j,i_k,i_\ell)$ $\forall j,k,\ell \in [N],$ the expression is $${\sf Pr}(i_j,i_k,i_\ell) = \sum_{f=1}^{F} {\sf Pr}(f) {\sf Pr}(i_j | f) {\sf Pr}(i_k | f) {\sf Pr}(i_\ell | f).$$ Let $\underline{\bm X}_{jk\ell}(i_j,i_k,i_\ell)={\sf Pr}(i_j,i_k,i_\ell)$. Then, we have $\underline{{\bm X}}_{jk\ell} = [\![ \boldsymbol{\lambda},{\bm A}_j,{\bm A}_k,{\bm A}_\ell ]\!]$, where $\{{\bm A}_n\}_{n=1}^N$ and ${\bm \lambda}$ are defined as before. Another important observation here is that {\it the marginal PMFs $\underline{\bm X}_{jk\ell}$'s and the joint PMF $\underline{\bm X}$ share the same $\bm A_{j}$, $\boldsymbol{A}_{k}$, $\bm A_{\ell}$ and $\bm \lambda$}. It is readily seen that if the $\underline{\bm X}_{jk\ell}$'s admit essentially unique CPD, then $\bm A_n$'s and $\bm \lambda$ can be identified from the marginals---and thus ${\sf Pr}(i_1,\ldots,i_N)$ can be recovered via identifying the latent factors. The tensor-based approach in \cite{kargas2017tensors} has shown that recovering high-dimensional joint PMF from low-dimensional marginals is possible. However, a couple of major hurdles exist for applying it in practice. First, estimating three-dimensional marginals ${\sf Pr}(i_j,i_k,i_\ell)$ is still not easy, since one needs many co-realizations of three RVs. For sparse datasets, this is particularly hard. Second, tensor decomposition is a hard computation problem \cite{hillar2013most}. The coupled tensor decomposition (CTD) algorithm in \cite{kargas2017tensors} that involves many tensors is even more challenging in practice. \subsection{Maximum Likelihood Estimation and EM} \label{sec:mle_em} A recent work in \cite{yeredor2019maximum} offers an alternative for estimating ${\sf Pr}(f)$ and ${\sf Pr}(i_n|f)$. Instead of working with third-order statistics, the model estimation problem is formulated as a maximum likelihood (ML) estimation problem in \cite{yeredor2019maximum}, and an EM algorithm is employed to handle the ML estimator (MLE). The upshot of this approach is that the EM updates are much more scalable relative to the CTD updates in \cite{kargas2017tensors}. However, there are two challenges of applying EM. First, the {\it identifiability} of the latent variables in \eqref{eq:pmf_latent_var} is unclear under the ML framework, since ML estimation does not imply identifiability; see discussions in the literature, e.g., \cite{huang2014putting}. Hence, the recoverability of the joint PMF may not be guaranteed. Second, as the authors of \cite{yeredor2019maximum} have noticed, the EM algorithm sometimes does not converge to a good solution if randomly initialized. This is perhaps due to the nonconvex nature of the ML estimation problem. \section{Proposed Approach} To advance the task of joint PMF recovery from marginal distributions, we propose a pairwise marginal-based approach. Note that the pairwise marginal is given by \begin{align*} & {\sf Pr}(i_j,i_k)=\sum_{f=1}^F{\sf Pr}(f){\sf Pr}(i_j|f){\sf Pr}(i_k|f) \\& \Longleftrightarrow \boldsymbol{X}_{jk} = \boldsymbol{A}_j{\bm D}(\bm \lambda)\boldsymbol{A}_k^{\!\top\!},~\boldsymbol{X}_{jk}(i_j,i_k)={\sf Pr}(i_j,i_k), \end{align*} where $\bm D(\bm \lambda) = {\rm Diag}(\bm \lambda)$. In practice, the pairwise marginals ${\bm X}_{jk}$'s are estimated from realizations of the joint PMF. Consider a set of realizations (data samples) of ${\sf Pr}(Z_1,\ldots,Z_N)$, denoted as $\{\bm d_{s} \in\mathbb{R}^{N} \}_{s=1}^S$. Assuming that there are no missing observations, the following sample averaging estimator can be employed: \begin{align*} \widehat{\bm X}_{jk}(i_j,i_k) &= \frac{1}{S}\sum_{s=1}^S \mathbb{I}\left[\bm d_s(j)=z_j^{(i_j)},\bm d_s(k)=z_k^{(i_k)}\right], \end{align*} where $\bm d_s(n)$ denotes the realization of $Z_n$ in the $s$-th sample and $\mathbb{I}[E]=1$ if the event $E$ happens and $\mathbb{I}[E]=0$ otherwise. { Notably, with the same amount of data (i.e., with a fixed $S$), the second-order statistics can be estimated to a much higher accuracy, compared to the third-order ones \cite{han2015minimax}. This is particularly articulated when the dataset is sparse. To see this, assume that every RV has an alphabet size $I$ and is observed with probability $p$ (which means that every entry of $\bm d_s$ is observed with probability $p$---and $\bm d_s$ is very sparse when $p$ is small). Then, on average $Sp^2$ and $Sp^3$ co-realizations of every pair and triple of RVs, respectively, can be observed in the samples. Under such cases, Theorem~1 in \cite{han2015minimax} shows that the average estimation error (over all possible joint distributions) for $\underline{\bm X}_{jk\ell}$ in terms of $\ell_1$ distance is $O(\sqrt{\nicefrac{I^3}{Sp^3}})$, while that for $\boldsymbol{X}_{jk}$ is $O( \sqrt{\nicefrac{I^2}{Sp^2}})$. One can see that the difference is particularly significant when $p$ is small---i.e., when the dataset is considerably sparse.} \subsection{Challenges} Despite the sample complexity appeal of using pairwise marginals, the {\it recoverability} of the joint PMF under such settings is nontrivial to establish. The main analytical tool for proving recoverability in \cite{kargas2017tensors} is the essential uniqueness of tensor decomposition---i.e., the latent factors of low-rank tensors are identifiable up to resolvable ambiguities under mild conditions. However, pairwise distributions such as $\bm X_{jk}= \boldsymbol{A}_j{\bm D}(\bm \lambda)\boldsymbol{A}_k^{\!\top\!}$ are matrices, and low-rank matrix decomposition is in general \textit{nonunique}. A natural thought to handle the identifiability problem would be employing certain NMF tools \cite{fu2018nonnegative,gillis2014and}, since the latent factors are all nonnegative, per their physical interpretations. However, the identifiability of NMF models holds only if $F\leq \min\{I_j,I_k\}$ (and preferably $F\ll\min\{I_j,I_k\}$). The pairs $\bm X_{jk}= \boldsymbol{A}_j{\bm D}(\bm \lambda)\boldsymbol{A}_k^{\!\top\!}\in\mathbb{R}^{I_j\times I_k}$ inherit the inner dimension $F$ (i.e., the column dimension of $\bm A_j$) from the joint PMF of all the variables, which is the tensor rank of an $N$th-order tensor. As mentioned, the tensor rank $F$ could be much larger than the $I_j$'s. Hence, one may not directly use the available NMF uniqueness results on individual $\boldsymbol{X}_{jk}$'s to argue for joint PMF recoverability. Nonetheless, as we will show shortly, NMF identifiability can be applied onto carefully constructed {\it coupled} NMF models to establish recoverability. \subsection{Preliminaries: NMF and Model Identifiablility} To see how we approach these challenges, let us first briefly introduce some pertinent preliminaries of NMF. Consider a nonnegative data matrix $\boldsymbol{X}\in\mathbb{R}^{L\times K}$. Assume that the matrix is generated by $\boldsymbol{X}=\boldsymbol{W}\H^{\!\top\!}$, where $\boldsymbol{W}\in\mathbb{R}^{L\times F}$ and $\H \in \mathbb{R}^{K\times F}$. Also assume that $\boldsymbol{W}\geq \bm 0$ and $\H\geq \bm 0$ and $F\leq \min\{L,K\}$. NMF aims to factor $\boldsymbol{X}$ for identifying $\boldsymbol{W}$ and $\H$ up to certain trivial ambiguities. A number of conditions on $\boldsymbol{W}$ and/or $\H$ allow us to establish identifiability of the latent factors. The first one is the so-called separability condition: \begin{definition} (Separability) \label{def:sep} \cite{donoho2003does} If $\bm H\geq \bm 0$, and $\bm \varLambda =\{ l_1,\ldots,l_F \}$ such that $\bm H(\bm \varLambda,:)=\bm \Sigma$ holds, where $\bm \Sigma ={\rm Diag}(\alpha_1,\ldots,\alpha_F)$ and $\alpha_f>0$, then, $\H$ satisfies the {\it separability condition}. When $\bm \varLambda =\{ l_1,\ldots,l_F \}$ satisfies $\|\H(l_f,:)-\bm e_f\|_2\leq \varepsilon$ for $f=1,\ldots,F$, $\bm H$ is called $\varepsilon$-separable. \end{definition} If one of $\boldsymbol{W}$ and $\H$ satisfies the separability condition and the other has full column rank, there exist polynomial-time algorithms that can provably identify $\boldsymbol{W}$ and $\H$ up to scaling and permutation ambiguities. Among these algorithms, a number of Gram--Schmidt-like lightweight algorithms exist; see, e.g., \cite{Gillis2012,fu2014self,arora2012practical,VMAX,MC01}. A more relaxed condition is as follows: \begin{definition}\label{def:suff} (Sufficiently Scattered) \cite{huang2014non,fu2015blind,fu2016robust} Assume that $\bm H\geq \bm 0$ and ${\cal C}\subseteq {\rm cone}\{\bm H^{\!\top\!}\}$ where $\mathcal{C} = \{\bm{x} \in\mathbb{R}^F~|~ \bm{x}^{\!\top\!}\mathbf{1} \geq \sqrt{F-1}\|\bm{x}\|_2\}$. In addition, assume that ${\sf cone}\{\H^{\!\top\!}\} \not\subseteq {\sf cone}\{\bm Q\} $ for any orthonormal $\boldsymbol{Q}\in\mathbb{R}^{K\times K}$ except for the permutation matrices. Then, $\bm H$ is called {\it sufficiently scattered}. \end{definition} The sufficiently scattered condition subsumes the separability condition as a special case. An important result is that if $\boldsymbol{W}$ and $\H$ are both sufficiently scattered, then the model $\boldsymbol{X}=\boldsymbol{W}\H^{\!\top\!}$ is unique up to scaling and permutation ambiguities \cite{huang2014non}. The two conditions are illustrated in Fig.~\ref{fig:cone}. More detailed discussions and illustrations can be seen in \cite{fu2018nonnegative,fu2018identifiability}. In principle, the `taller' $\bm H$ is, the chance that $\bm H$ (approximately) attains the separability or sufficiently scattered condition is higher, if $\H$ is generated following a certain continuous distribution. This intuition was formalized in \cite{ibrahim2019crowdsourcing}, under the assumption that $\H(l,:)$'s are drawn from the probability simplex uniformly at random and then positively scaled. The work in \cite{ibrahim2019crowdsourcing} also shows that the sufficiently scattered condition is easier to satisfy relative to separability, under the same generative model; see Lemma~\ref{lem:Lm} in Appendix~\ref{app:lemmata} in the supplementary materials. \begin{figure}[t!] \centering \includegraphics[width= 0.30\linewidth]{figures/simplex3} \includegraphics[width= 0.25\linewidth]{figures/simplex6} \put(-35,180){$\mathcal{C}$} \caption{Left: an $\bm H$ that satisfies the separability condition. Right: an $\H$ that satisfies the sufficiently scattered condition. The triangle corresponds to probability simplex $\Delta_3$; and the dots correspond to rows of $\H$ rescaled to have unit $\ell_1$-norm. The inner circle on $\Delta_3$ corresponds to the intersection of the second-order cone ${\cal C}$ and $\Delta_3$; and the shaded region is the intersection of $\cone{\bm H^{\!\top\!}}$ and $\Delta_3$.} \label{fig:cone} \vspace{-.35cm} \end{figure} \subsection{Recoverability Analysis} Our goal is to identify $\boldsymbol{A}_n$ and $\bm \lambda$ from the available pairwise marginals $\boldsymbol{X}_{jk}=\boldsymbol{A}_j\bm D(\bm \lambda)\boldsymbol{A}_k^{\!\top\!}$'s, so that the joint PMF can be reconstructed following \eqref{eq:pmf_latent_var}. Note that applying existing NMF techniques onto $\boldsymbol{X}_{jk}$ is unlikely to work, since when $F> \min \{I_j,I_k\}$, `fat' $\boldsymbol{A}_j\in\mathbb{R}^{I_j\times F}$'s can never be separable or sufficiently scattered. To circumvent this, our idea is as follows. Consider a splitting of the indices of the $N$ variables, i.e., ${\cal S}_1=\{\ell_1,\ldots,\ell_M\}$ and ${\cal S}_2=\{\ell_{M+1},\ldots,\ell_{N}\}$ such that ${\cal S}_1\cup{\cal S}_2=\{1,\ldots,N\}$ and ${\cal S}_1\cap {\cal S}_2=\emptyset.$ Then, we construct the following matrix: \begin{equation}\label{eq:constructedX} \begin{aligned} \widetilde{\bm X}=& \begin{bmatrix} \bm X_{\ell_1\ell_{M+1}}& \ldots & {\bm X}_{\ell_1\ell_N} \\ \vdots & \vdots &\vdots \\ {\bm X}_{\ell_M\ell_{M+1}} & \ldots & {\bm X}_{\ell_M\ell_N} \end{bmatrix} \\ = &\underbrace{\begin{bmatrix} \bm A_{\ell_1}\\ \vdots\\ \bm A_{\ell_M} \end{bmatrix}}_{\bm W}\underbrace{{\bm D}({\bm \lambda })[{\bm A}_{\ell_{M+1}}^{\!\top\!},\ldots,{\bm A}_{\ell_{N}}^{\!\top\!}]}_{{\bm H}^{\!\top\!}}. \end{aligned} \end{equation} Note that in this `virtual NMF' model, $\boldsymbol{W}$ and $\H$ matrices have sizes of $MI\times F$ and $(N-M)I\times F$, respectively, if $I_1=\ldots=I_N=I$. The idea is to construct $\widetilde{\bm X}$ such that $F\leq\min\{MI, (N-M)I \}$ so that $\boldsymbol{W}$ and $\H$ may satisfy the separability or sufficiently scattered condition---and thus $\boldsymbol{A}_1,\ldots,\boldsymbol{A}_N$ can be identified via factoring $\widetilde{\boldsymbol{X}}$. This is a straightforward application of the NMF identifiability results introduced in the previous subsection. The challenge lies in finding a suitable splitting of ${\cal S}_1,{\cal S}_2$ such that $\boldsymbol{W}$ and $\H$ are sufficiently scattered and is highly nontrivial. Note that even if $\boldsymbol{W}$ and $\H$ are given, checking if these matrices are sufficiently scattered is hard \cite{huang2014non}. It is also impractical to try every possible index splitting. To address this challenge, we consider the following factorization problem: \begin{subequations}\label{eq:coupled_mat} \begin{align} {\rm find}&~\boldsymbol{A}_n,~n=1,\ldots,N,~\bm \lambda\\ {\rm subject~to}&~\boldsymbol{X}_{jk}=\boldsymbol{A}_j\bm D(\bm \lambda)\boldsymbol{A}_k^{\!\top\!},~\forall j,k \in{\bm \Omega} \label{eq:fic_feas}\\ &~\bm 1^{\!\top\!}\bm A_j=\bm 1^{\!\top\!},~\bm A_j\geq \bm 0\\ &~\bm 1^{\!\top\!}\bm \lambda =1,~\bm \lambda\geq{\bm 0}, \end{align} \end{subequations} where $\bm \Omega$ contains the index set of $(j,k)$'s such that $j<k$ and the joint PMF ${\sf Pr}(i_j,i_k)$ is accessible. Note that the above can be understood as a latent factor-coupled NMF problem. Regarding the identifiability of the conditional PMFs and the latent prior, we have the following result: \begin{theorem}[Recoverability]\label{prop:prop2} Assume that that ${\sf Pr}(i_j,i_k)$'s for $j,k\in{\bm \Omega}$ are available and that ${\sf Pr}(f)\neq 0$ for $f=1,\ldots,F$. Suppose that there exists ${\cal S}_1=\{\ell_1,\ldots,\ell_M\}$ and ${\cal S}_2=\{\ell_{M+1},\ldots,\ell_Q\}$ such that $Q\leq N$ and $ {\cal S}_1\cup{\cal S}_2\subseteq \{1,\ldots,N\},~{\cal S}_1\cap {\cal S}_2=\emptyset. $ Also assume the following conditions hold:\\ \textbf{(i)} the matrices $[\boldsymbol{A}_{\ell_1}^{\!\top\!},\ldots,\boldsymbol{A}_{\ell_M}^{\!\top\!}]^{\!\top\!}$ and $[\boldsymbol{A}_{\ell_{M+1}}^{\!\top\!},\ldots,\boldsymbol{A}_{\ell_{Q}}^{\!\top\!}]^{\!\top\!}$ are \textit{sufficiently scattered};\\ \textbf{(ii) }all pairwise marginal distributions ${\sf Pr}(i_j,i_k)$'s for $j\in{\cal S}_1$ and $k\in{\cal S}_2$ are available; \\ \textbf{(iii)} every $T$-concatenation of $\boldsymbol{A}_n$'s, i.e., $[\boldsymbol{A}_{n_1}^{\!\top\!},\ldots,\boldsymbol{A}_{n_T}^{\!\top\!}]^{\!\top\!}$, is a full column rank matrix, if $I_{n_1}+\ldots+I_{n_T}\geq F$;\\ \textbf{(iv) }for every $j\notin{\cal S}_1\cup{\cal S}_2$ there exists a set of $r_t\in{\cal S}_1\cup{\cal S}_2$ for $t=1,\ldots,T$ such that ${\sf Pr}(i_j,i_{r_t})$ or ${\sf Pr}(i_{r_t},i_j)$ are available. Then, solving Problem~\eqref{eq:coupled_mat} recovers ${\sf Pr}(i_j|f)$ and ${\sf Pr}(f)$ for $j=1,\ldots,N, ~f=1,\dots, F$, thereby the joint PMF ${\sf Pr}(i_1,\ldots,i_N)$. \end{theorem} The proof is relegated to Appendix~\ref{app:prop1}, which is reminiscent of identifiability of a similar coupled NMF problem that arises in crowdsourced data labeling \cite{ibrahim2019crowdsourcing}, with proper modifications to handle the cases where $F>I_n$ (since the crowdsourcing model always has $F=I_n$, which is a simpler case). In particular, conditions (iii) and (iv) are employed to accommodate the more challenging cases. The criterion spares one the effort for first finding ${\cal S}_1$ and ${\cal S}_2$ and then constructing the matrix $\widetilde{\boldsymbol{X}}$. Instead, under Theorem~\ref{prop:prop2}, the goal is simply finding an approximate solution of \eqref{eq:coupled_mat}---which is much more approachable in practice. \begin{remark} { Under our pairwise marginal based approach, a key enabler for recovering the joint PMF is the {\it identifiability} of $\boldsymbol{A}_n$'s up to an {\it identical} column permutation ambiguity. At first glance, the identifiability of the latent factors seems to be irrelevant since what we truly care is the ambient joint PMF tensor $\underline{\bm X}\in\mathbb{R}^{I_1\times\ldots\times I_N}$. However, since the tensor is heavily marginalized (i.e., one only observes pairwise marginals), the identifiability of $\bm A_n$'s is leveraged on to assemble the joint PMF following the model in \eqref{eq:pmf_latent_var} under our framework. } \end{remark} \begin{comment} Theorem~\ref{prop:prop2} does not impose any restrictions on $F$, and thus can be generally applicable. Nevertheless, to establish recoverability, one has to ensure that two `virtual matrices' (i.e., $\boldsymbol{W}$ and $\H$) comprising different conditional PMF matrices to be sufficiently scattered---which might be hard to guarantee in practice. Nevertheless, we find that a stronger result can be derived if $F$ is below a certain threshold. To simplify the statement, let us assume $I_1=\ldots=I_N=I$. We have: \begin{theorem}[Enhanced Recoverability] \label{prop:completion} Assume that ${\sf Pr}(f)\neq 0$ for $f=1,\ldots,F$, and that ${\sf Pr}(i_j,i_k)$'s for all $j,k$ are available and ${\sf Pr}(i_k,i_j)={\sf Pr}(i_j,i_k)$\footnote{This means that the RVs are pairwise exchangeable, which normally holds if the realizations are i.i.d.}. If $\boldsymbol{Z}=[\boldsymbol{A}_1^{\!\top\!},\ldots,\boldsymbol{A}_N^{\!\top\!}]^{\!\top\!}\in\mathbb{R}^{NI\times F}$ is separable or sufficiently scattered and $F\leq (N-1)I - 1$, then, solving the problem in \eqref{eq:coupled_mat} recovers ${\sf Pr}(i_j|f)$ and ${\sf Pr}(f)$ for $j=1,\ldots,N, ~f=1,\dots, F$, thereby the joint PMF ${\sf Pr}(i_1,\ldots,i_N)$. \end{theorem} The proof is relegated to Appendix~\ref{app:prop2}. Theorem~\ref{prop:completion} is stronger in the following sense. In Theorem~\ref{prop:prop2}, the recoverability of the joint PMF depends on if $\boldsymbol{W}=[\boldsymbol{A}_{\ell_1}^{\!\top\!},\ldots,\boldsymbol{A}_{\ell_M}^{\!\top\!}]^{\!\top\!}$ and $\H=[\boldsymbol{A}_{\ell_{M+1}}^{\!\top\!},\ldots,\boldsymbol{A}_{\ell_N}^{\!\top\!}]^{\!\top\!}$ are sufficiently scattered. This requires that there exists at least one splitting strategy for $\boldsymbol{A}_1,\ldots,\boldsymbol{A}_N$ under which two sufficiently scattered/separable matrices can be constructed. However, under Theorem~\ref{prop:completion}, one only needs that all the conditional PMFs can together construct a sufficiently scattered $\boldsymbol{Z}$. Note that $\boldsymbol{Z}$ could thus have many more rows than those of $\boldsymbol{W}$ and $\H$. In fact, it was shown in \cite{ibrahim2019crowdsourcing} that if the rows of $\boldsymbol{Z}$ are randomly drawn from the nonnegative orthant, then the chances for $\boldsymbol{Z}$ being separable or sufficiently scattered are much higher when the number of rows of $\boldsymbol{Z}$ grows. Therefore, Theorem~\ref{prop:completion} is a substantially improved recoverability result relative to Theorem~\ref{prop:prop2}. \end{comment} \section{Algorithms and Performance Analyses} In this section, we develop algorithms under the coupled NMF framework and analyze performance under realistic conditions, e.g., cases with finite samples and missing values. \subsection{BCD for Problem~\eqref{eq:coupled_mat}} \label{sec:alg1} To handle Problem \eqref{eq:coupled_mat}, we employ the standard procedure based on \textit{block coordinate descent} (BCD) for handling coupled tensor/matrix decomposition algorithms in the literature \cite{kargas2017tensors,kargas2019learning,ibrahim2019crowdsourcing}. To be specific, we cyclically minimize the constrained optimization problem w.r.t. $\boldsymbol{A}_k$, when fixing $\boldsymbol{A}_j$ for all $j\neq k$ and $\bm \lambda$. Consequently, the subproblem is as follows: \begin{subequations}\label{eq:sub} \begin{align} \minimize_{\boldsymbol{A}_k}&~\sum_{j\in{\bm \Omega}_k}{\sf dist}\left( \boldsymbol{X}_{jk},\boldsymbol{A}_j\bm D(\bm \lambda)\boldsymbol{A}_k^{\!\top\!}\right)\\ {\rm subject~to}&~\bm 1^{\!\top\!}\bm A_k=\bm 1^{\!\top\!},~\bm A_k\geq \bm 0, \end{align} \end{subequations} where ${\bm \Omega}_k$ is the index set of $j$ such that ${\sf Pr}(i_j,i_k)$ is available and ${\rm dist}(\cdot,\cdot)$ is a certain distance measure. Under a number of distance measures, e.g., the Euclidean distance or the Kullback--Leibler (KL) distance, the subproblems are convex and thus can be solved via off-the-shelf algorithms. In this work, we employ the KL divergence as the distance measure since it is natural for measuring distance between PMFs. Consequently, the subproblems are \begin{subequations}\label{eq:subkl} \begin{align} \boldsymbol{A}_k &\leftarrow\arg\min_{ \begin{subarray}{c} \bm 1^{\!\top\!}\bm A_k=\bm 1^{\!\top\!}\\\bm A_k\geq \bm 0\end{subarray}}~\sum_{j\in{\bm \Omega}_k}\mathbb{D}_{\sf KL}\left( \boldsymbol{X}_{jk},\boldsymbol{A}_j\bm D(\bm \lambda)\boldsymbol{A}_k^{\!\top\!}\right), \label{eq:Aupdate}\\ \bm \lambda &\leftarrow\arg\min_{ \begin{subarray}{c} \bm 1^{\!\top\!}\bm \lambda=1\\ \bm \lambda\geq \bm 0\end{subarray}}~\sum_{j,k\in{\bm \Omega}}\mathbb{D}_{\sf KL}\left( \boldsymbol{X}_{jk},\boldsymbol{A}_j\bm D(\bm \lambda)\boldsymbol{A}_k^{\!\top\!}\right). \label{eq:lambda_update} \end{align} \end{subequations} We employ the {\it mirror descent} algorithm to solve the two subproblems. Mirror descent admits closed-form updates for handling KL-divergence based linear model fitting under simplex constraints (which is also known as exponential gradient in the literature); see, e.g., \cite{arora2012practical}. The algorithm {CNMF-OPT} is described in \eqref{algo:CNMF-OPT}. \begin{algorithm}[h!] \SetKwInOut{Input}{input} \SetKwInOut{Output}{output} \SetKwRepeat{Repeat}{repeat}{until} \Input{data samples $\{\bm d_s\}_{s=1}^S$} estimate second order statistics $\widehat{\boldsymbol{X}}_{jk }$; get initial estimates $\{\widehat{\boldsymbol{A}}_n\}_{n=1}^N$ and $\widehat{\bm \lambda}$ (e.g., using {CNMF-SPA}); \Repeat{some stopping criterion is reached}{ \For{$n=1$ {\bf to} $N$}{ update $\widehat{\boldsymbol{A}}_n \leftarrow \eqref{eq:Aupdate}$ using mirror descent; } update $\widehat{\bm \lambda} \leftarrow\eqref{eq:lambda_update}$ using mirror descent; } \Output{estimates $\{\widehat{\boldsymbol{A}}_n\}_{n=1}^N$, $\widehat{\bm \lambda}$} \caption{{CNMF-OPT}}\label{algo:CNMF-OPT} \end{algorithm} Notably, the work in \cite{kargas2017tensors} also has some experiments (without recoverability analysis) using pairwise marginals to recover the joint PMF using a similar formulation (using Euclidean distance). Our rationale for reaching the formulation in \eqref{eq:coupled_mat} is very different, which is motivated by the NMF theory. Also, the result using pairwise marginals in \cite{kargas2017tensors} seems not promising. In this work, our analysis in Theorems~\ref{prop:prop2} has suggested that the reason why pairwise marginals do not work in \cite{kargas2017tensors} is likely due to optimization pitfalls, rather than lack of recoverability. In the next subsection, we show that with a carefully designed initialization scheme, accurately recovering joint PMFs from pairwise marginals is viable. \subsection{Key Step: Gram--Schmidt-like Initialization} \label{sec:alg2} Directly applying the BCD algorithm to the joint PMF recovery problem has a number of challenges. First, the CNMF problem is nonconvex, and thus global optimality is not ensured. Second, the computational complexity grows quickly with $N$ and $I$, giving rise to potential scalability issues. In this subsection, we offer a fast algorithm that can provably identify ${\sf Pr}(i_n|f)$ and ${\sf Pr}(f)$ up to a certain accuracy---under more stringent conditions relative to those in Theorem~\ref{prop:prop2}. The algorithm is reminiscent of a Gram--Schmidt-like algorithm for NMF with careful construction of a `virtual NMF model'. Let us assume that there is a splitting ${\cal S}_1=\{\ell_1,\ldots,\ell_M\}$ and ${\cal S}_2=\{\ell_{M+1},\ldots,\ell_{N}\}$ such that the $\widetilde{\boldsymbol{X}}=\boldsymbol{W}\H^{\!\top\!}$ in \eqref{eq:constructedX} admits a full rank $\boldsymbol{W}$ and a separable $\H$. Under the separability condition, we have ${\bm H}(\bm \varLambda,:) =\bm \Sigma= {\rm Diag}(\alpha_1,\ldots,\alpha_F)$ and ${\bm W}\bm \Sigma = \widetilde{\boldsymbol{X}}(\bm \varLambda,:).$ Hence, the coupled NMF task boils down to identifying the index set $\bm \varLambda$. The so-called \textit{successive projection algorithm} (SPA) from the NMF literature \cite{Gillis2012,MC01,fu2014self,arora2012practical} can be employed for this purpose. A remark is that SPA is a Gram--Schmidt-like algorithm, which only consists of norm comparison and orthogonal projection. Once ${\bm W}$ is identified, one can recover $\bm A_{\ell_n}\in \mathbb{R}^{I_{\ell_n} \times F}$ for $\ell_n\in{\cal S}_1$ up to identical column permutations, by extracting the corresponding rows of $\bm W$ (cf. line 6 in Algorithm~\ref{algo:CNMF-SPA}). Unlike general NMF models, since every column of $\boldsymbol{A}_n$ is a conditional PMF, there is no scaling ambiguity. The $\H$ matrix can be estimated using (constrained) least squares, and $\boldsymbol{A}_{\ell_n}$ for $\ell_n\in {\cal S}_2$ can then be extracted in a similar way. Denote \eqref{eq:constructedX} as $\widetilde{\bm X} = {\bm W} \bm D(\bm \lambda) \widetilde{\bm H}^{\top}$, where $\widetilde{\bm H} = \begin{bmatrix} \bm A_{\ell_{M+1}}^{\top} \ldots \bm A_{\ell_N}^{\top} \end{bmatrix}^{\!\top\!}$. Then, the PMF of the latent variable can be estimated via $ { \bm \lambda} = ( \widetilde{\bm H} \odot \boldsymbol{W})^{\dagger}\text{vec}(\widetilde{\bm X}),$ where we have used the fact that the Khatri-Rao product $\widetilde{\bm H} \odot \boldsymbol{W}$ has full column rank since both ${\boldsymbol{W}}$ and $\widetilde\H$ have full column rank. A remark is that the SPA-estimated $\widehat{\bm A}_{\ell_n}$ is at best the column-permuted version of $\boldsymbol{A}_{\ell_n}$ \cite{Gillis2012}. However, since the permutation ambiguity across all the $\bm A_n$'s and the $\bm \lambda$ are identical per the above procedure, the existence of column permutations does not affect the ``assembling'' of ${\sf Pr}(i_n|f)$ and ${\sf Pr}(f)$ to recover ${\sf Pr}(i_1,\ldots,i_N)$. We refer to this procedure as {\it coupled NMF via SPA} ({CNMF-SPA}); see Algorithm \ref{algo:CNMF-SPA}. From Algorithm~\ref{algo:CNMF-SPA}, one can see that the procedure is rather simple since SPA is a Gram--Schmidt-like procedure and the other steps are either convex quadratic programming or least squares. Hence, {CNMF-SPA} can be employed for initializing computationally more intensive algorithms, e.g., {CNMF-OPT}. \begin{algorithm}[h] \SetKwInOut{Input}{input} \SetKwInOut{Output}{output} \SetKwRepeat{Repeat}{for}{end} \Input{data samples $\{\bm d_s\}_{s=1}^S$ and $M$} estimate second order statistics $\widehat{\boldsymbol{X}}_{jk }$; split $\{1,\ldots,N\}$ into ${\cal S}_1=\{1,\ldots,M\}$ and ${\cal S}_2=\{M+1,\ldots,N\}$; Construct $\widetilde{\bm X}$ Estimate $\widehat{\bm W}$ using the {\bf SPA algorithm} \cite{Gillis2012} to select $\bm \varLambda$; \For{$n=1$ {\bf to} $M$}{ $\widehat{\bm A}_n \leftarrow \widehat{\bm W} ((n-1)I_n+1:nI_n,:)$; normalize columns of $\widehat{\bm A}_n$ with respect to $\ell_1$ norm;} $\widehat{\bm H} \leftarrow \underset{{\bm H} \ge 0}{\text{arg~min}}~\|\widetilde{\bm X}- \widehat{\bm W} {\bm H}^{{\!\top\!}}\|_{\rm F}^2$ \For{$n=M+1$ {\bf to} $N$}{ $\widehat{\bm A}_n \leftarrow \widehat{\bm H} ((n-1)I_n+1:nI_n,:)$; normalize columns of $\widehat{\bm A}_n$ with respect to $\ell_1$ norm;} $\widetilde{\bm W}^{{\!\top\!}} \leftarrow \begin{bmatrix} \widehat{\bm A}_1^{{\!\top\!}}, \hdots, \widehat{\bm A}_M^{{\!\top\!}} \end{bmatrix}$ ; $\widetilde{\bm H}^{{\!\top\!}} \leftarrow \begin{bmatrix} \widehat{\bm A}_{M+1}^{\top} \hdots \widehat{\bm A}_{N}^{\top} \end{bmatrix}^{\top} $; $\widehat{\bm \lambda} \leftarrow ( \widetilde{\bm H} \odot \widetilde{\bm W})^{\dagger}\text{vec}(\widetilde{\bm X})$; \Output{estimates $\{\widehat{\boldsymbol{A}}_n\}_{n=1}^N$, $\widehat{\bm \lambda}$.} \caption{{CNMF-SPA}}\label{algo:CNMF-SPA} \end{algorithm} \vspace{-.25cm} \subsection{Performance Analysis of CNMF-SPA} \label{sec:analysisSPA} In principle, to make {CNMF-SPA} work, one needs to identify a splitting scheme ${\cal S}_1$ and ${\cal S}_2$ such that $\bm H$ in \eqref{eq:constructedX} satisfies the separability condition. It is impossible to know such a splitting {\it a priori}. Testing all combinations of ${\cal S}_1$ and ${\cal S}_2$ gives rise to a hard combinatorial problem. In addition, the pairwise marginals $\boldsymbol{X}_{jk}$ are not perfectly estimated in practice. In this subsection, we offer performance analysis of {CNMF-SPA} by taking the above aspects into consideration. From our extensive experiments, we observed that using the `naive' construction ${\cal S}_1=\{1,\ldots,M\}$ and ${\cal S}_2=\{M+1,\ldots,N\}$ seems to work reasonably well for various tasks. To establish theoretical understanding to such effectiveness, recall that we use $S$ and $p$ to denote the number of available realizations of ${\sf Pr}(Z_1,\ldots,Z_N)$ and the probability of observing each entry of data sample $\bm d_s$, respectively. For simplicity, we assume that $I_n=I$ for all $n$. We impose the following generative model for $\boldsymbol{A}_m$: \begin{Assumption}\label{ass:A} Assume that every row of $\boldsymbol{A}_n\in\mathbb{R}^{I_m\times F}$ for all $n$ is generated from the $(F-1)$-probability simplex uniformly at random and then positively scaled by a scalar, so that $\bm 1^{\!\top\!}\bm A_n=\bm 1^{\!\top\!}$ is respected\footnote{Such scaling exists under mild conditions; see \cite[Proposition 1]{yang2019learning}.}. \end{Assumption} \color{black} Under the above settings, we show that the following holds: \begin{theorem} \label{thm:spabound} Assume that $\|\widehat{\bm X}_{ij}(:,q)\|_1 \ge \eta>0$ for any $q,i,j$. Also, assume that $M \ge F/I $, $p \geq \left( \frac{8}{S}\log(4/\delta) \right)^{1/2}$, \begin{align*} S & = \Omega\left(\frac{M^2I{\rm log}(1/\delta)}{\sigma^2_{\rm max}({\bm{W}})\eta^2\varepsilon^2p^2}\right),\\ N &= M+ \Omega\left(\frac{\varepsilon^{-2(F-1)}}{IF}{\rm log}\left(\frac{F}{\delta}\right)\right), \end{align*} where $\varepsilon = \frac{M\text{\rm min}\left(\frac{1}{2\sqrt{F-1}},\frac{1}{4}\right)}{2\kappa(\bm{W})(1+80\kappa^2(\bm{W}))}$. Then, under the defined $S,p$ and Assumption~\ref{ass:A}, {CNMF-SPA} outputs $\widehat{\boldsymbol{A}}_m$'s such that \begin{align} \label{eq:thmspa} \min_{\bm \Pi:~\text{permuation}}\|\widehat\boldsymbol{A}_m\bm \Pi - \boldsymbol{A}_m\|_2 = O\left(\kappa^2(\bm W)\sqrt{F} \zeta\right) \end{align} for $m\in{\cal S}_1$ with a probability greater than or equal to $1-\delta$, where $\zeta = \max(\sigma_{\max}(\bm W)\varepsilon,\nicefrac{M\sqrt{I\log(1/\delta)}}{\eta p \sqrt{S}})$. \end{theorem} The proof is relegated to Appendix~\ref{app:spa}. Theorem~\ref{thm:spabound} asserts that using {CNMF-SPA} on the constructed $\widetilde{\boldsymbol{X}}$ in \eqref{eq:constructedX} approximately recovers the joint PMF---if the $N,I,S$ are large enough. Note that if $\boldsymbol{A}_m$ for all $m \in{\cal S}_1$ can be accurately estimated, the estimation accuracy of $\bm A_n$ for all $n \in{\cal S}_2$ and $\bm \lambda$ can also be guaranteed and quantified, following the standard sensitivity analyses of least squares; see, e.g., \cite{wedin1973perturbation}. \begin{remark} \label{rem:theorem_spa} Theorem~\ref{thm:spabound} is not entirely surprising. The insight behind the proof is to recast the constructed $\widetilde{\boldsymbol{X}}$ as an equivalent noisy NMF model with the separability condition holding exactly on the right latent factor. This way, the noise robustness analysis for SPA \cite{Gillis2012} can be applied. The key is to quantify the noise bound in this equivalent model. Such `virtual noise' is contributed by the finite sample-induced error for estimating the pairwise marginals and the violation to the separability condition. In particular, classical concentration theorems are leveraged to quantify the former, and Assumption~\ref{ass:A} for the latter. Note that Assumption~\ref{ass:A} is more of a working assumption, rather than an exact model for capturing reality---it helps formalize the fact that $\H$ in \eqref{eq:constructedX} more likely attains the $\varepsilon$-separability condition when $|{\cal S}_2|$ grows \cite{ibrahim2019crowdsourcing}. In principle, if $\boldsymbol{A}_m$ is drawn from any joint absolutely continuous distribution, a similar conclusion can be reached---but using the uniform distribution simplifies the analysis. \end{remark} \color{black} \subsection{More Discussions: EM Meets CNMF} As mentioned, a recent work in \cite{yeredor2019maximum} proposed an EM algorithm for solving the maximum likelihood estimation problem under \eqref{eq:pmf_latent_var}. To see the idea, let $f_s \in \{1,\dots,F\}$ be the realization of the `latent variable' $H$ in the $s$th realization of ${\sf Pr}(Z_1,\ldots,Z_N)$. The joint log-likelihood of the observed data $\{\bm d_s\}_{s=1}^S$ and the corresponding latent variable $\{f_s\}_{s=1}^S$ as a function of the latent factor $\bm \theta =\begin{bmatrix}{\rm vec}(\bm A_1)^{\!\top\!},\dots,{\rm vec}(\bm A_N)^{\!\top\!}, \bm \lambda^{{\!\top\!}}\end{bmatrix}^{\!\top\!}$ can be expressed as \begin{align}\label{eq:loglike} {\cal L}(\{\bm d_s,f_s\}_{s=1}^S;\bm \theta) &=\log\left(\prod_{s=1}^S \bm \lambda(f_s) \prod_{n=1}^N\prod_{i=1}^{I_n} \bm A_n(i,f_s)^{\mathbb{I}(\bm d_s(n)=z_{n}^{(i)})}\right). \end{align} The EM algorithm estimates $\bm \theta$ via attempting to maximize the log-likelihood. The resulting updates are simple and economical. However, the optimality of the algorithm is unclear. It was also observed in \cite{yeredor2019maximum} that the algorithm sometimes converges to some undesired solutions if not carefully initialized. Naturally, our idea is using {CNMF-SPA} to initialize the EM algorithm in \cite{yeredor2019maximum}. As one will see, this combination oftentimes offers competitive performance This combination also features an appealing runtime performance, since both algorithms consist of lightweight updates. We refer to this procedure as CNMF-SPA-initialized EM ({CNMF-SPA-EM}). In this work, we also present performance characterizations for the EM algorithm. To proceed, we make the following assumption: \begin{Assumption}\label{ass:D} Define $$\overline{D}_1 = \min_{f \neq f'}\frac{1}{N}\sum_{n=1}^N p\mathbb{D}_{\rm KL}(\bm A_n(:,f),\bm A_n(:,f')),\quad \overline{D}_2 = \frac{2}{N}\min_{f\neq f'} \log(\bm \lambda(f)/\bm \lambda(f'))$$ and $\overline{D}=\nicefrac{(\overline{D}_1 + \overline{D}_2)}{2}$. Assume that ${\bm A}_n(i,f) \ge \rho_1$ and ${\bm \lambda}(f) \ge \rho_2$ for all $n,i,f$, and that $\bm A_n, \bm \lambda$ and the initial estimates $ \widehat{\bm A}^0_n, \widehat{\bm \lambda}^0$ satisfy \begin{align*} |\widehat{\bm A}^0_n(i,f)-{\bm A}_n(i,f)| &\le \delta_1:=\frac{4}{\rho_1(4+ \overline{D})}\\ |\widehat{\bm \lambda^0}(f)-{\bm \lambda}(f)|& \le \delta_2:= \frac{4}{\rho_2(4+ N\overline{D})}. \end{align*} \end{Assumption} Here, $\overline{D}_1$ can be understood as a measure for the `conditioning' of $\boldsymbol{A}_n$ under the KL divergence---a larger $\overline{D}_1$ implies more diverse columns of $\boldsymbol{A}_n$, and thus a better `condition number'. In addition, $|\overline{D}_2|$ measures how far $\bm \lambda$ is away from the uniform distribution. Using Assumption~\ref{ass:D}, we show that the EM algorithm can provably improve upon reasonable initial guesses (e.g., those given by {CNMF-SPA}), under some conditions. To be specific, we have the following theorem: \begin{theorem} \label{thm:em} Let $\delta_{\min} = \min(\delta_1,\delta_2)$. Assume that the following hold: \begin{align*} N &\ge \max\left(\frac{33\log(3SF/\mu)}{\rho_1\overline{D}_1},\frac{4\log(4SF^2/(3p\rho_2\mu))}{\overline{D}}\right),\\ S &\ge \frac{192F^2\log(12NFI/\mu)}{p^2\rho_2^2\delta^2_{\min}},~\overline{D} \ge \max\left\{\frac{8-4\rho_1^2}{\rho_1^2},\frac{8-4\rho_2^2}{N\rho_2^2}\right\}. \end{align*} Then, under Assumption~\ref{ass:D}, the EM algorithm in \cite{yeredor2019maximum} outputs $\widehat{\bm A}_n(i,f),\widehat{\bm \lambda}(f)$ that satisfy the following with a probability greater than or equal to $1-\mu$: \begin{align*} & |\widehat{\bm A}_n(i,f)-\bm A_n(i,f)|^2 \le \frac{48\log(12NFI/\mu)}{Sp\bm \lambda(f)}\leq \delta_1^2 ,\\ &|\widehat{\bm \lambda}(f)-\bm \lambda(f)|^2 \le \frac{192F^2\bm \lambda(f)\log(12NFI/\mu)}{S}\leq \delta_2^2. \end{align*} \end{theorem} The proof is relegated to Appendix~\ref{app:thm_em} in the supplementary materials. Our proof extends the analysis of a different EM algorithm proposed in \cite{zhang2014spectral} that is designed for learning the Dawid-Skene model in crowdsourcing. The EM algorithm there effectively learns a naive Bayes model when the latent variable admits a uniform distribution, i.e., $\bm \lambda(f)=1/F$ for all $f$. The algorithm in \cite{zhang2014spectral} and the EM algorithm in \cite{yeredor2019maximum} are closely related, but the analysis in \cite{zhang2014spectral} does not cover the latter---since the EM in \cite{yeredor2019maximum} that does not restrict $\bm \lambda$ to be a uniform PMF. Extending the analysis in \cite{zhang2014spectral} turns out to be nontrivial, which requires careful characterization for the `difficulty' introduced by $\bm \lambda$'s deviation from the uniform distribution. Our definition of $\overline{D}_2$ and Theorem~\ref{thm:em} fill the gap. \section{Experiments} In this section, we use synthetic and real data experiments to showcase the effectiveness of the proposed algorithms. \subsection{Baselines}\label{sec:baselines} We use the CTD based method in \cite{kargas2017tensors} and the MLE-based method in \cite{yeredor2019maximum} as the major benchmarks, since they are general joint PMF estimation approaches as the proposed methods. Since the MLE based EM algorithm in \cite{yeredor2019maximum} may be sensitive to initialization, an iterative optimization algorithm designed for the same MLE formulation (cf. the alternating directions (AD) algorithm in \cite{yeredor2019maximum}) is used to initialize the EM in \cite{yeredor2019maximum}. This baseline is denoted as the {MLE-AD-EM} method in our experiments. For the real data experiments, we test the proposed approaches on two core tasks in machine learning, namely, classification and recommender systems. For the classification task, we use 4 different classifiers from the MATLAB \textit{Statistics and Machine Learning Toolbox}, i.e., linear SVM, kernel SVM with radial basis function (RBF)), multinomial logistic regression and naive Bayes classifier. For the user-item recommender systems, we use the celebrated \textit{biased matrix factorization} (BMF) method \cite{koren2009matrix} as a baseline. We also compare with results obtained by \textit{global average} of the ratings, the \textit{user average}, and the \textit{item average} for predicting the missing entries in the user-item matrix. All the algorithms are implemented in MATLAB 2018b and run on a desktop machine equipped with i7 3.40 GHZ CPU. The iterative algorithms used in the experiments are stopped when the relative change in the objective function value is less than $10^{-6}$. \begin{table}[t!] \centering \caption{MSE \& MRE Performance on Synthetic Data with $N=5,F=5,I=10,p=0.5,\varepsilon=0.1$.} \begin{tabular}{|c|c|c|c|c|c|} \hline \textbf{Algorithms} & \textbf{Metric} & $S=10^3$ & $S=10^4$ & $S=10^5$ & $S=10^6$ \\ \hline CNMF-SPA [Proposed] & MSE & 0.0669 & 0.0270 & 0.0210 & \textbf{0.0204} \\ \hline CNMF-OPT [Proposed] & MSE & \textbf{0.0519} & \textbf{0.0242} & 0.0210 & \textbf{0.0204} \\ \hline CNMF-SPA-EM [Proposed] & MSE & 0.0553 & 0.0247 & \textbf{0.0208} & \textbf{0.0204} \\ \hline RAND-EM & MSE & 0.0734 & 0.0317 & 0.0289 & 0.0336 \\ \hline CTD[Kargas \textit{et al.}] & MSE & 0.1523 & 0.0256 & 0.0212 & 0.0205 \\ \hline MLE-AD-EM [Yeredor \& Haardt] & MSE & 0.0909 & 0.0368 & 0.0266 & 0.0296 \\ \hline \hline CNMF-SPA [Proposed] & MRE & 0.7965 & 0.3321 & 0.1052 & 0.0346 \\ \hline CNMF-OPT [Proposed] & MRE & \textbf{0.6746} & \textbf{0.2327} & 0.0721 & 0.0239 \\ \hline CNMF-SPA-EM [Proposed] & MRE & 0.6788 & 0.2341 & \textbf{0.0664} & \textbf{0.0219} \\ \hline RAND-EM & MRE & 0.8078 & 0.2820 & 0.1845 & 0.2610 \\ \hline CTD [Kargas \textit{et al.}] & MRE & 0.9076 & 0.2920 & 0.0952 & 0.0329 \\ \hline MLE-AD-EM [Yeredor \& Haardt] & MRE & 0.8363 & 0.3552 & 0.1384 & 0.1593 \\ \hline \end{tabular}% \vspace{-.25cm} \label{tab:synthetic2}% \end{table}% \begin{comment} \begin{table}[t!] \centering \caption{MSE \& MRE Performance on Synthetic Data with $N=5,F=5,I=10,p=0.5,\varepsilon=0.2$.} \resizebox{.9\linewidth}{!}{\Huge \begin{tabular}{|c|c|c|c|c|c|} \hline \textbf{Algorithms} & \textbf{Metric} & $S=10^3$ & $S=10^4$ & $S=10^5$ & $S=10^6$ \\ \hline CNMF-SPA [Proposed] & MSE & 0.0701 & 0.0261 & 0.0201 & 0.0200 \\ \hline CNMF-OPT [Proposed] & MSE & \textbf{0.0532} & \textbf{0.0236} & 0.0207 & 0.0209 \\ \hline CNMF-SPA-EM [Proposed] & MSE & 0.0612 & 0.0238 & 0.0208 & 0.0210 \\ \hline RAND-EM & MSE & 0.0718 & 0.0264 & 0.0339 & 0.0272 \\ \hline CTD[Kargas \textit{et al.}] & MSE & 0.1803 & 0.0250 & \textbf{0.0206} & \textbf{0.0207} \\ \hline MLE-AD-EM [Yeredor \& Haardt] & MSE & 0.0882 & 0.0332 & 0.0224 & 0.0292 \\ \hline \hline CNMF-SPA [Proposed] & MRE & 0.8005 & 0.3796 & 0.2029 & 0.1724 \\ \hline CNMF-OPT [Proposed] & MRE & \textbf{0.7084} & \textbf{0.2530} & \textbf{0.1017} & 0.0541 \\ \hline CNMF-SPA-EM [Proposed] & MRE & 0.7213 & 0.2545 & 0.1367 & 0.0911 \\ \hline RAND-EM & MRE & 0.7975 & 0.2856 & 0.2883 & 0.2148 \\ \hline CTD [Kargas \textit{et al.}] & MRE & 0.9248 & 0.2992 & 0.1097 & \textbf{0.0320} \\ \hline MLE-AD-EM [Yeredor \& Haardt] & MRE & 0.8567 & 0.3168 & 0.1352 & 0.1895 \\ \hline \end{tabular}% } \label{tab:synthetic_ep2}% \end{table}% \end{comment} \begin{table}[t!] \centering \caption{MSE \& MRE Performance on Synthetic Data with $N=5,F=5,I=10,p=0.5,\varepsilon=0.3$.} \begin{tabular}{|c|c|c|c|c|c|} \hline \textbf{Algorithms} & \textbf{Metric} & $S=10^3$ & $S=10^4$ & $S=10^5$ & $S=10^6$ \\ \hline CNMF-SPA [Proposed] & MSE & 0.0880 & 0.0288 & 0.0238 & 0.0237 \\ \hline CNMF-OPT [Proposed] & MSE & \textbf{0.0810} & \textbf{0.0247} & \textbf{0.0204} & 0.0210 \\ \hline CNMF-SPA-EM [Proposed] & MSE & 0.0813 & 0.0249 & 0.0206 & 0.0217 \\ \hline RAND-EM & MSE & 0.0883 & 0.0292 & 0.0216 & 0.0276 \\ \hline CTD[Kargas \textit{et al.}] & MSE & 0.1534 & 0.0266 & \textbf{0.0204} & \textbf{0.0206} \\ \hline MLE-AD-EM [Yeredor \& Haardt] & MSE & 0.0911 & 0.0312 & 0.0313 & 0.0233 \\ \hline \hline CNMF-SPA [Proposed] & MRE & 0.8933 & 0.4395 & 0.3201 & 0.3128 \\ \hline CNMF-OPT [Proposed] & MRE & \textbf{0.8010} & 0.2675 & 0.1021 & 0.0784 \\ \hline CNMF-SPA-EM [Proposed] & MRE & 0.8133 & \textbf{0.2658} & 0.1132 & 0.1151 \\ \hline RAND-EM & MRE & 0.8214 & 0.3080 & 0.1390 & 0.2239 \\ \hline CTD [Kargas \textit{et al.}] & MRE & 0.9101 & 0.3298 & \textbf{0.1017} & \textbf{0.0346} \\ \hline MLE-AD-EM [Yeredor \& Haardt] & MRE & 0.8752 & 0.3593 & 0.2666 & 0.1413 \\ \hline \end{tabular}% \vspace{-.25cm} \label{tab:synthetic_ep3}% \end{table}% \subsection{Synthetic-data Experiments} \label{sec:synthetic} We consider $N=5$ RV's where each variable takes $I=10$ discrete values. The entries of the conditional PMF matrices (factor matrices) ${\bm A}_n\in \mathbb{R}^{I_n \times F}$ and the prior probability vector ${\bm \lambda} \in \mathbb{R}^{F}$ are randomly generated from a uniform distribution between 0 and 1 and the columns are rescaled to have unit $\ell_1$ norm with rank $F=5$. We generate $S$ realizations of the joint PMF by randomly hiding each variable realization with observation probability $p=0.5$. In particular, to test the performance of CNMF-SPA under various $\varepsilon$-separability conditions, we fix $M=3$ and manually ensure the $\varepsilon$-separability condition on $\bm H$ in \eqref{eq:constructedX} by fixing $\varepsilon \in\{0.1,0.3\}$. To run the proposed algorithms, the low-order marginals are then estimated from the realizations via sample averaging. The {\it mean square error} (MSE) of the factors (see~\cite{huang2014non} for definition) and the {\it mean relative error} (MRE) of the recovered joint PMFs (see \cite{kargas2017tensors}) are evaluated. We should mention that, ideally, MRE is more preferred for evaluation, but it is hard to compute (due to memory issues) for large $N$. MSE is an intermediate metric since it does not directly measure the recovery performance. Low MSEs imply good joint PMF recovery performance, but the converse is not necessarily true. The results are averaged from 20 random trials. Table \ref{tab:synthetic2}-\ref{tab:synthetic_ep3} present the MSE and MRE results for various values of $\varepsilon$ and $S$, where we manually control $\varepsilon$ when generating the $\boldsymbol{A}_n$'s. One can see that the proposed CNMF-SPA method works reasonably well for both $\varepsilon$'s under test. It performs better when $\varepsilon$ is small, corroborating our analysis in Sec~\ref{sec:analysisSPA}. In addition, CNMF-SPA is quite effective for initializing the EM algorithm whereas randomly initialized EM (RAND-EM) and the MLE-AD-EM method from \cite{yeredor2019maximum} sometimes struggle to attain good performance. Notably, the proposed pairwise marginals based methods consistently outperform the three-dimensional marginals based method, i.e., CTD from \cite{kargas2017tensors}, especially when $S$ is small. This highlights the sample complexity benefits of the proposed methods. Another point is that when CNMF-SPA does not result in good accuracy, then the follow-up EM stage (i.e., CNMF-SPA-EM) does not perform well (e.g., when $S=10^3$). However, the proposed coupled factorization based approach, i.e., CNMF-OPT, still works well in this `sample-starved regime', showing the power of recoverability guaranteed problem formulation. Table~\ref{tab:synthetic3}-\ref{tab:synthetic4} show the MSE results of the algorithms tested on cases where $N=15,I=10$ and $F=10$ for various values of $p$ and $S$---recall that a small $p$ means the data has many missing observations. The MRE is not presented since instantiating $15$th-order tensors is prohibitive in terms of memory. The results for MLE-AD-EM is not presented since the AD stage consumes a large amount of time under this high-dimensional PMF setting. We do not manually impose $\varepsilon$-separability here, with the hope that the $\bm H$ matrix is likely $\varepsilon$-separable under large $N$ and $I$, as argued in Theorem \ref{thm:spabound} and Remark~\ref{rem:theorem_spa}. One can see that the proposed CNMF-based methods exhibit better MSE performance compared to other baselines. Also, the advantage of CNMF-OPT is more articulated under challenging settings (e.g., small $p$ and small $S$), where one can see that CNMF-OPT almost always outperforms the other algorithms. Table~\ref{tab:runtime} shows the average runtime of the algorithms under different problem sizes. One can see that for the smaller case (cf. the left column), all the methods exhibit good runtime performance except for MLE-AD-EM. The elongated runtime of MLE-AD-EM is due to the computationally expensive AD iterations used for initialization. For the high-dimensional case where $N=15,F=I=10$, CNMF-SPA and EM are much faster due to their computationally economical updates. Considering the MSE and MRE results in Tables \ref{tab:synthetic2}-\ref{tab:synthetic4}, CNMF-SPA and CNMF-SPA-EM seem to provide a preferred good balance between speed and accuracy. Furthermore, the proposed CNMF-OPT offers the best accuracy for sample-starved cases---at the expense of higher computational costs. \begin{comment} We have presented the simulation results with $\varepsilon =0.1$ in Table \ref{tab:synthetic2} in Sec.~\ref{sec:synthetic} (the parameter $\varepsilon$ which is associated with separability condition is defined in Def. \ref{def:sep}). Here, we present the results by further increasing $\varepsilon$ to show the effect of this parameter on the performance of the proposed methods. The results are presented in Tables~\ref{tab:synthetic_ep2} and \ref{tab:synthetic_ep3}. One can notice that as $\varepsilon$ increases, the estimation error for CNMF-SPA increases as expected. However the proposed algorithms CNMF-OPT and CNMF-SPA still outperform the baselines especially when the number of samples is not very large ($S \le 10^5)$. \end{comment} \begin{table}[t!] \centering \caption{MSE Performance on Synthetic Data with $N=15,F=10,I=10,p=0.5$.} \begin{tabular}{|c|c|c|c|c|c|} \hline \textbf{Algorithms} & \textbf{Metric} & $S=10^3$ & $S=10^4$ & $S=10^5$ & $S=10^6$ \\ \hline CNMF-SPA [Proposed] & MSE & 0.1183 & 0.1030 & 0.1063 & 0.1041 \\ \hline CNMF-OPT [Proposed] & MSE & \textbf{0.0218} & \textbf{0.0042} & \textbf{0.0022} & 0.0020 \\ \hline CNMF-SPA-EM [Proposed] & MSE & 0.0894 & 0.0110 & 0.0056 & \textbf{0.0018} \\ \hline RAND-EM & MSE & 0.0376 & 0.0112 & 0.0149 & 0.0069 \\ \hline CTD[Kargas \textit{et al.}] & MSE & 0.0329 & 0.0359 & 0.0404 & 0.0355 \\ \hline \end{tabular}% \vspace{-0.25cm} \label{tab:synthetic3}% \end{table}% \begin{table}[t!] \centering \caption{MSE Performance on Synthetic Data for $N=15,F=10,I=10,p=0.2$.} \begin{tabular}{|c|c|c|c|c|c|} \hline \textbf{Algorithms} & \textbf{Metric} & $S=10^3$ & $S=10^4$ & $S=10^5$ & $S=10^6$ \\ \hline CNMF-SPA [Proposed] & MSE & 0.2884 & 0.1181 & 0.0987 & 0.0996 \\ \hline CNMF-OPT [Proposed] & MSE & 0.2277 & \textbf{0.0423} & \textbf{0.0062} & \textbf{0.0021} \\ \hline CNMF-SPA-EM [Proposed] & MSE & \textbf{0.2274} & 0.0672 & 0.0165 & 0.0070 \\ \hline RAND-EM & MSE & 0.2333 & 0.0782 & 0.0349 & 0.0313 \\ \hline CTD[Kargas \textit{et al.}] & MSE & 0.4015 & 0.0862 & 0.0081 & 0.0260 \\ \hline \end{tabular}% \label{tab:synthetic4}% \vspace{-0.25cm} \end{table}% \begin{table}[t!] \centering \begin{threeparttable}[b] \caption{Average Runtime (Sec.) of the Algorithms on Synthetic Data $S=10^5$ under Various $[N,F,I]$'s.} \begin{tabular}{|c|c|c|} \hline \textbf{Algorithms} & $[5,5,10]$ & $[15,10,10]$ \\ \hline CNMF-SPA [Proposed] & \textbf{0.139} & \textbf{0.865} \\ \hline CNMF-OPT [Proposed] & 1.633 & 94.931 \\ \hline CNMF-SPA-EM [Proposed] & 0.490 & 4.091 \\ \hline RAND-EM & 0.353 & 3.217 \\ \hline CTD [Kargas \textit{et al.}] & 0.741 & 50.559 \\ \hline MLE-AD-EM [Yeredor \& Haardt] & 124.449 & $ 12.949\times 10^3~^\dagger$ \\ \hline \end{tabular}% \label{tab:runtime \begin{tablenotes} \item[$\dagger$] {\footnotesize This number is reported from a single trial due to the elongated runtime of the algorithm under this high-dimensional setting.} \end{tablenotes} \end{threeparttable} \vspace{-.25cm} \end{table}% \subsection{Real-data Experiments: Classification Tasks} We conduct classification tasks on a number of UCI datasets (see \url{https://archive.ics.uci.edu}) using the joint PMF recovery algorithms and dedicated data classifiers as we detailed in Sec.~\ref{sec:baselines}. The details of the datasets are given in Table~\ref{tab:uci}. Note that in the datasets, some of the features are continuous-valued. To make the joint PMF recovery methods applicable, we follow the setup in \cite{kargas2017tensors} to discretize those continuous features. We use $I_{\sf ave}=(1/N)\sum_{n=1}^N I_n$ to denote the averaged alphabet size of the discretized features for each dataset in Table~\ref{tab:uci} \footnote{ The detailed setup and source code are available at \url{https://github.com/shahanaibrahimosu/joint-probability-estimation}.}. We split each dataset into training, validation and testing sets with a ratio of $50:20:30$. For our approach, we estimate the joint PMF of the features and the label using the training set, and then predict the labels on the testing data by constructing an MAP predictor following \cite{kargas2017tensors}. The rank $F$ for the joint PMF recovery methods and the number of iterations needed for the methods involving EM are chosen using the validation set. We set $M=5$ for all datasets. We perform 20 trials for each dataset with randomly partitioned training/testing/validation sets, and report the mean and standard deviation of the classification accuracy. Tables~\ref{tab:votes}-\ref{tab:mushroom} show the results for the UCI datasets `Votes', `Car', `Nursery' and `Mushroom', respectively. In all cases, one can see that the proposed approaches CNMF-SPA, CNMF-OPT and CNMF-SPA-EM are promising in terms of offering competitive performance for data classification. We should remark that our method is not designed for data classification, but estimating the joint PMF of the features and the label. The good performance on classification clearly support our theoretical analysis and the usefulness of the proposed algorithms. A key observation is that the CPD method in \cite{kargas2017tensors} does not perform as well compared to the proposed pairwise marginals based methods, especially when the number of data samples is small (e.g., the `Votes' dataset in Table~\ref{tab:votes}). This echos our motivation for this work---using pairwise marginals is advantageous over using third-order ones when fewer samples are available. In terms of runtime, the proposed CNMF-SPA and CNMF-SPA-EM methods are faster than other methods by several orders of magnitude. \begin{table}[t] \centering \caption{Details of UCI datasets.} \begin{tabular}{|l|r|r|r|r|} \hline \textbf{Dataset} & \textbf{$\#$ Samples} & \textbf{$\#$ Features} & \textbf{$I_{\text{avg}}$} & \textbf{$\#$ Classes} \\ \hline Votes & 435 & 17 & 2 & 2 \\ \hline Car & 1728 & 7 & 4 & 4 \\ \hline Nursery & 12960 & 8 & 4 & 4 \\ \hline Mushroom & 8124 & 22 & 6 & 2 \\ \hline \end{tabular}% \label{tab:uci}% \vspace{-.25cm} \end{table}% \begin{table}[t!] \centering \caption{Classification Results on UCI Dataset `Votes'.} \begin{tabular}{|c|c|c|} \hline \textbf{Algorithm} & \textbf{Accuracy (\%)} & \textbf{Time (sec.)} \\ \hline CNMF-SPA [Proposed] & 90.07$\pm$1.30 & 0.005 \\ \hline CNMF-OPT [Proposed] & \textbf{94.94$\pm$2.13} & 9.720 \\ \hline CNMF-SPA-EM [Proposed] & 92.82$\pm$2.17 & 0.018 \\ \hline CTD [Kargas \textit{et al.}] & 92.37$\pm$2.88 & 6.413 \\ \hline MLE-AD-EM [Yeredor \& Haardt] &90.99$\pm$4.18 & 10.556\\ \hline SVM & 94.34$\pm$1.68 & 0.057 \\ \hline Logistic Regression & 94.05$\pm$1.24 & 0.301 \\ \hline SVM-RBF & 92.21$\pm$2.66 & 0.012 \\ \hline Naive Bayes & 90.46$\pm$1.98 & 0.032 \\ \hline \end{tabular} \label{tab:votes}% \vspace{-.25cm} \end{table}% \begin{table}[t!] \centering \caption{Classification Results on UCI Dataset `Car'.} \begin{tabular}{|c|c|c|} \hline \textbf{Algorithm} & \textbf{Accuracy (\%)} & \textbf{Time (sec.)} \\ \hline CNMF-SPA [Proposed] & 70.31$\pm$2.17 & 0.007 \\ \hline CNMF-OPT [Proposed] & 85.00$\pm$1.80 & 5.550 \\ \hline CNMF-SPA-EM [Proposed] & \textbf{87.42$\pm$1.12} & 0.017\\ \hline CTD [Kargas \textit{et al.}] & 84.21$\pm$1.27 & 3.601 \\ \hline MLE-AD-EM [Yeredor \& Haardt] &87.25$\pm$1.41 & 6.321\\ \hline SVM & 84.59$\pm$3.21 & 0.149 \\ \hline Logistic Regression & 83.09$\pm$2.42 & 1.528 \\ \hline SVM-RBF & 77.13$\pm$4.29 & 0.876 \\ \hline Naive Bayes & 83.32$\pm$2.23 & 0.023 \\ \hline \end{tabular}% \label{tab:uci_car}% \vspace{-.25cm} \end{table}% \begin{comment} \begin{table}[t!] \centering \caption{Classification Results on UCI Dataset `Credit'} \resizebox{.8\linewidth}{!}{ \begin{tabular}{|c|c|c|} \hline \textbf{Algorithm} & \textbf{Accuracy (\%)} & \textbf{Time (s)} \\ \hline CNMF-SPA [Proposed] & 84.47$\pm$2.12 & 0.008 \\ \hline \multicolumn{1}{|l|}{CNMF-OPT [Proposed]} & \textbf{84.92$\pm$2.19} & 9.945 \\ \hline CNMF-SPA-EM [Proposed] & 84.64$\pm$1.83 & 0.018 \\ \hline CTD [Kargas \textit{et al.}] & 84.42$\pm$2.31 & 3.374 \\ \hline MLE-AD-EM [Yeredor \& Haardt] &84.52$\pm$1.90 & 23.334\\ \hline SVM & 84.18$\pm$2.04 & 0.026 \\ \hline Linear Regression & 84.88$\pm$2.00 & 0.016 \\ \hline Neural Net & 84.20$\pm$3.20 & 0.107 \\ \hline SVM-RBF & 81.11$\pm$2.25 & 0.009 \\ \hline Naive Bayes & 84.17$\pm$2.07 & 0.016 \\ \hline \end{tabular}% } \label{tab:uci_credit}% \end{table}% \end{comment} \begin{table}[t!] \centering \caption{Classification Results on UCI Dataset `Nursery'.} \begin{tabular}{|c|c|c|} \hline \textbf{Algorithm} & \textbf{Accuracy (\%)} & \textbf{Time (sec.)} \\ \hline CNMF-SPA [Proposed] & 97.48$\pm$0.20 & 0.008 \\ \hline CNMF-OPT [Proposed] & \textbf{98.16$\pm$0.22} & 6.719 \\ \hline CNMF-SPA-EM [Proposed] & 98.04$\pm$0.35 & 0.041 \\ \hline CTD [Kargas \textit{et al.}] & 97.70$\pm$0.22 & 4.318 \\ \hline MLE-AD-EM [Yeredor \& Haardt] &98.04$\pm$0.33 & 8.920\\ \hline SVM & 97.42$\pm$0.79 & 0.706 \\ \hline Logistic Regression & 98.02$\pm$0.15 & 5.019 \\ \hline SVM-RBF & 70.92$\pm$4.70 & 0.738 \\ \hline Naive Bayes & 98.03$\pm$0.20 & 0.046 \\ \hline \end{tabular} \label{tab:nursery}% \vspace{-.25cm} \end{table}% \begin{table}[t!] \centering \caption{Classification Results on UCI Dataset `Mushroom'.} \begin{tabular}{|c|c|c|} \hline \textbf{Algorithm} & \textbf{Accuracy (\%)} & \textbf{Time (sec.)} \\ \hline CNMF-SPA [Proposed] & 91.86$\pm$6.33 & 0.025 \\ \hline CNMF-OPT [Proposed] & 96.70$\pm$0.82 & 39.349 \\ \hline CNMF-SPA-EM [Proposed] & \textbf{99.47$\pm$0.68} & 0.210 \\ \hline CTD [Kargas \textit{et al.}] & 96.09$\pm$0.46 & 24.116 \\ \hline SVM & 97.60$\pm$0.28 & 34.443 \\ \hline Logistic Regression & 96.75$\pm$0.62 & 2.875 \\ \hline SVM-RBF & 97.16$\pm$0.41 & 1.523 \\ \hline Naive Bayes & 94.60$\pm$0.56 & 0.063 \\ \hline \end{tabular}% \label{tab:mushroom}% \vspace{-.25cm} \end{table}% \subsection{Real-data Experiments: Recommender Systems} We test the approaches using the MovieLens 20M dataset \cite{harper2015movielens}. Again, following the evaluation strategy in \cite{kargas2017tensors}, we first round the ratings to the closest integers so that every movie's rating resides in $\{1,2,\ldots,5\}$. We choose different movie genres, namely, action, animation and romance, and select a subset of movies from each genre. Each subset contains 30 movies. Hence, for every subset, $N=30$, $Z_i$ represents the rating of movie $i$, and $Z_i$'s alphabet is $\{1,2,\ldots,5\}$. We predict the rating for a movie, say, movie $N$, by user $k$ via computing $\mathbb{E}[i_N|r_k(1),\ldots,r_k(N-1)]$, where $r_k(i)$ denotes the rating of movie $i$ by user $k$ (i.e., using the MMSE estimator). This can be done via estimating ${\sf Pr}(i_1,\ldots,i_N)$. Note that we leave out the MLE-AD-EM algorithm for the MovieLens datasets due to its scalability challenges. We create the validation and testing sets by randomly hiding $20\%$ and $30\%$ of the dataset for each trial. The remaining $50\%$ is used for training (i.e., learning the joint PMF in our approach). The results are taken from 20 random trials as before. In addition to the root MSE (RMSE) performance, we also report the \textit{mean absolute error} (MAE) of the predicted ratings, which is more meaningful in the presence of outlying trials; see the definitions of RMSE and MAE in \cite{kargas2017tensors}. Table~\ref{tab:action}-\ref{tab:romance} present the results for three different subsets, respectively. One can see that the proposed methods are promising---their predictions are either comparable or better than the BMF approach. Note BMF is specialized for recommender systems, while the proposed approaches are for generic joint PMF recovery. The fact that our methods perform better suggests that the underlying joint PMF is well captured by the proposed CNMF approach. \begin{table}[t!] \centering \caption{Movie Recommendation Results on the Action set. } \label{tab:action}% \begin{tabular}{|c|c|c|c|} \hline \textbf{Algorithm} & \textbf{RMSE} & \textbf{MAE} & \textbf{Time (s)} \\ \hline CNMF-SPA [Proposed] & 0.8497$\pm$0.0114 & 0.6663$\pm$0.0059 & 0.031 \\ \hline CNMF-OPT [Proposed] & 0.8167$\pm$0.0035 & 0.6321$\pm$0.0040 & 70.018 \\ \hline CNMF-SPA-EM [Proposed] & \textbf{0.7840$\pm$0.0025} & \textbf{0.5991$\pm$0.0031} & 2.424 \\ \hline CTD [Kargas \textit{et al.}] & 0.8770$\pm$0.0088 & 0.6649$\pm$0.0076 & 52.253 \\ \hline BMF & 0.8011$\pm$0.0012 & 0.6260$\pm$0.0013 & 46.637 \\ \hline Global Average & 0.9468$\pm$0.0018 & 0.6956$\pm$0.0017 & -- \\ \hline User Average & 0.8950$\pm$0.0010 & 0.6825$\pm$0.0010 & -- \\ \hline Movie Average & 0.8847$\pm$0.0018 & 0.6982$\pm$0.0012 & -- \\ \hline \end{tabular}% \vspace{-.25cm} \end{table}% \begin{table}[t!] \centering \caption{Movie Recommendation Results on the Animation set.} \begin{tabular}{|c|c|c|c|} \hline \textbf{Algorithm} & \textbf{RMSE} & \textbf{MAE} & \textbf{Time (s)} \\ \hline CNMF-SPA [Proposed] & 0.8705$\pm$0.0095 & 0.6798$\pm$0.0060 & 0.028 \\ \hline CNMF-OPT [Proposed] & \textbf{0.8124$\pm$0.0031} & \textbf{0.6241$\pm$0.0041} & 61.018 \\ \hline CNMF-SPA-EM [Proposed] & 0.8170$\pm$0.0075 & 0.6317$\pm$0.0086 & 2.424 \\ \hline CTD [Kargas \textit{et al.}] & 0.8300$\pm$0.0053 & 0.6335$\pm$0.0029 & 48.253 \\ \hline BMF & 0.8408$\pm$0.0023 & 0.6553$\pm$0.0015 & 46.637 \\ \hline Global Average & 0.9371$\pm$0.0021 & 0.7042$\pm$0.0014 & -- \\ \hline User Average & 0.8850$\pm$0.0009 & 0.6632$\pm$0.0011 & -- \\ \hline Movie Average & 0.9027$\pm$0.0019 & 0.6900$\pm$0.0013 & -- \\ \hline \end{tabular}% \label{tab:anim}% \vspace{-.25cm} \end{table}% \begin{table}[t!] \centering \caption{Movie Recommendation Results on the Romance set.} \begin{tabular}{|c|c|c|c|} \hline \textbf{Algorithm} & \textbf{RMSE} & \textbf{MAE} & \textbf{Time (s)} \\ \hline CNMF-SPA [Proposed] & 0.9280$\pm$0.0066 & 0.7376$\pm$0.0076 & 0.032 \\ \hline CNMF-OPT [Proposed] & 0.9076$\pm$0.0014 & 0.7123$\pm$0.0029 & 60.762 \\ \hline CNMF-SPA-EM [Proposed] & \textbf{0.9057$\pm$0.0052} & \textbf{0.7106$\pm$0.0049} & 1.881 \\ \hline CTD [Kargas \textit{et al.}] & 0.9498$\pm$0.0085 & 0.7416$\pm$0.0054 & 47.010 \\ \hline BMF & 0.9337$\pm$0.0007 & 0.7463$\pm$0.0009 & 31.823 \\ \hline Global Average & 1.0019$\pm$0.0007 & 0.8078$\pm$0.0008 & -- \\ \hline User Average & 1.0195$\pm$0.0007 & 0.7862$\pm$0.0008 & --\\ \hline Movie Average & 0.9482$\pm$0.0007 & 0.7599$\pm$0.0007 & --\\ \hline \end{tabular}% \label{tab:romance}% \vspace{-.25cm} \end{table}% \section{Conclusion} We proposed a new framework for recovering joint PMF of a finite number of discrete RVs from marginal distributions. Unlike a recent approach that relies on three-dimensional marginals, our approach only uses two-dimensional marginals, which naturally has reduced-sample complexity and a lighter computational burden. We showed that under certain conditions, the recoverability of the joint PMF can be guaranteed---with only noisy pairwise marginals accessible. We proposed a coupled NMF formulation as the optimization surrogate for this task, and proposed to employ a Gram--Schmidt-like scalable algorithm as its initialization. We showed that the initialization method is effective even under the finite-sample case (whereas the existing tensor-based method does not offer sample-complexity characterization). We also showed that the Gram--Schmidt-like algorithm can provably enhance the performance of an EM algorithm that is proposed from an ML estimation perspective for the joint PMF recovery problem. We tested the proposed approach on classification tasks and recommender systems, and the results corroborate our analyses. \color{black} \bibliographystyle{IEEEtran}
\section{Introduction}\label{sec.intro} \vspace{-2mm} \looseness-1 Block-based visual programming environments are increasingly used nowadays to introduce computing concepts to novice programmers including children and $\textnormal{K-}12$ students. Led by the success of environments like Scratch~\cite{resnick2009scratch}, initiatives like \emph{Hour of Code} by \emph{Code.org}~\cite{hourofcode} (HOC) and online platforms like \emph{CodeHS.com}~\cite{codehscom}, block-based programming has become an integral part of introductory computer science education. Considering HOC alone, over one billion hours of block-based programming activity has been performed so far by over 50 million unique students worldwide~\cite{hourofcode,wu2019zero}. The societal need for enhancing $\textnormal{K-}12$ computing education has led to a surge of interest in developing AI-driven systems for pedagogy of block-based programming~\cite{wang2017learning,price2017position,price2017isnap,weintrop2017comparing,maloney2008programming}. Existing works have studied various aspects of intelligent support, including providing real-time next-step hints when a student is stuck solving a task~\cite{piech15las,yi2017feasibility,paassen2018continuous,marwan2019impact,efremov2020zeroshot}, giving data-driven feedback about a student's misconceptions~\cite{singh2013automated,DBLP:conf/icml/PiechHNPSG15,price2017evaluation,rolim2017learning,wu2019zero}, and demonstrating a worked-out solution for a task when a student lacks the required programming concepts~\cite{zhi2019exploring}. An underlying assumption when providing such intelligent support is that afterwards the student can practice \emph{new similar tasks} to finally learn the missing concepts. However, this assumption is far from reality in existing systems---the programming tasks are typically hand-curated by experts/tutors, and the available set of tasks is limited. Consider HOC's \emph{Classic Maze} challenge~\cite{hourofcode_maze}, which provides a progression of $20$ tasks: Millions of students have attempted these tasks, yet when students fail to solve a task and receive assistance, they cannot practice similar tasks, hindering their ability to master the desired concepts. We seek to tackle this pedagogical challenge by developing techniques for synthesizing new programming tasks. \begin{figure}[t!] \centering \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/intro/intro_hoc_env0.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{in}}$} \label{fig:intro.hoc.t0} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.58} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathLeft}\textcode{)\{}\\ \quad \quad \quad \textcode{turnLeft}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \\ \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{in}}$} \label{fig:intro.hoc.p0} } \end{subfigure} \quad \quad \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/mctsplots/hoc-G-mutation-6-22_run7/mctsplot_best_2M.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{out}}$} \label{fig:intro.hoc.t1} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.58} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnLeft}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathRight}\textcode{)\{}\\ \quad \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:intro.hoc.p1} } \end{subfigure} \vspace{-1.5mm} \caption{Illustration of our methodology for task \emph{Maze 16} from the \emph{Hour of Code: Classic Maze} challenge by \emph{Code.org}~\cite{hourofcode_maze}; the complete list of tasks with their specifications is in \figref{fig:dataset}. } \vspace{-3.5mm} \label{fig:intro.hoc} \end{figure} We formalize the problem of synthesizing visual programming tasks of the kind found in popular learning platforms like \emph{Code.org} (see \figref{fig:intro.hoc}) and \emph{CodeHS.com} (see \figref{fig:intro.karel}). As input, we are given a reference task $\text{\textcode{T}}^{\textnormal{in}}$, specified as a visual puzzle, and its solution code $\text{\textcode{C}}^{\textnormal{in}}$. Our goal is to synthesize a set $\{(\text{\textcode{T}}^{\textnormal{out}}, \text{\textcode{C}}^{\textnormal{out}})\}$ of new tasks along with their solution codes that are \emph{conceptually similar} but \emph{visually dissimilar} to the input. This is motivated by the need for practice tasks that on one hand exercise the same concepts, while looking fresh in order to maintain student engagement. When tackling the problem of synthesizing new tasks with the above desirable properties, three key challenges emerge. First, we are generating problems in a \emph{conceptual domain} with no \emph{well-defined procedure} that students follow to solve a task---consequently, existing work on educational problem generation in procedural domains does not apply in our setting~\cite{Andersen13,gulwani2014example}. Second, the mapping from the space of visual tasks to their solution codes is highly discontinuous; hence, template-based problem generation techniques~\cite{singh2012,polozov2015} that rely on directly mutating the input to generate new tasks is ineffective (see Section~\ref{sec.userstudy} where we use this approach as a baseline). Furthermore, such a direct task-mutation approach would require access to an automated solution synthesizer; however, state-of-the-art program synthesis techniques are not yet on par with experts and their minimal solutions~\cite{Bunel18,Devlin17,chen2018execution}. Third, the space of possible tasks and their solutions is potentially unbounded, and thus, any problem generation technique that relies on exhaustive enumeration is intractable~\cite{singh2012,Ahmed13,Alvin14}. To overcome these challenges, we propose a novel methodology that operates by first mutating the solution code $\text{\textcode{C}}^{\textnormal{in}}$ to obtain a set of codes $\{\text{\textcode{C}}^{\textnormal{out}}\}$, and then performing symbolic execution over a code $\text{\textcode{C}}^{\textnormal{out}}$ to obtain a visual puzzle $\text{\textcode{T}}^{\textnormal{out}}$. Mutation is efficient by creating an abstract representation of $\text{\textcode{C}}^{\textnormal{in}}$ along with appropriate constraints and querying an SMT solver~\cite{BarrettTinelli2018}; any solution to this query is a mutated code $\text{\textcode{C}}^{\textnormal{out}}$. During symbolic execution, we use Monte Carlo Tree Search (MCTS) to guide the search over the (unbounded) symbolic execution tree. We demonstrate the effectiveness of our methodology by performing an extensive empirical evaluation and user study on a set of reference tasks from the \emph{Hour of code} challenge by \emph{Code.org} and the \emph{Intro to Programming with Karel} course by \emph{CodeHS.com}. In summary, our main contributions are: \setlength{\leftmargini}{0.7em} \begin{itemize} \item We formalize the problem of synthesizing block-based visual programming tasks (Section~\ref{sec.problem}). \item We present a novel approach for generating new visual tasks along with solution codes such that they are conceptually similar but visually dissimilar to a given reference task (Section~\ref{sec.approach}). \item We demonstrate the effectiveness of our approach through an extensive empirical evaluation and user study on reference tasks from real-world programming platforms (Section~\ref{sec.simulations} and Section~\ref{sec.userstudy}). \end{itemize} \section{Problem Formulation}\label{sec.problem} \vspace{-2mm} \textbf{The space of tasks.} We define a task as a tuple $\text{\textcode{T}} := (\text{\textcode{T}}_\textnormal{vis}, \text{\textcode{T}}_\textnormal{store}, \text{\textcode{T}}_\textnormal{size})$, where $\text{\textcode{T}}_\textnormal{vis}$ denotes the visual puzzle, $\text{\textcode{T}}_\textnormal{store}$ the available block types, and $\text{\textcode{T}}_\textnormal{size}$ the maximum number of blocks allowed in the solution code. For instance, considering the task $\text{\textcode{T}} := \text{\textcode{T}}^{\textnormal{in}}$ in \figref{fig:intro.hoc.t0}, $\text{\textcode{T}}_\textnormal{vis}$ is illustrated in \figref{fig:intro.hoc.t0}, $\text{\textcode{T}}_\textnormal{store} = \{\textnormal{\textsf{move}\xspace, \textsf{turnL}\xspace, \textcode{turnR}, \textsf{repeatUntilGoal}\xspace, \textsf{If}\xspace}\}$, and $\text{\textcode{T}}_\textnormal{size} = 4$. \looseness-1\textbf{The space of codes.} The programming environment has a domain-specific language (DSL), which defines the set of valid codes $\ensuremath{\mathcal{C}}$ and is shown in \figref{fig:mutation.1}. A code $\text{\textcode{C}} \in \ensuremath{\mathcal{C}}$ is characterized by several properties, such as the set $\text{\textcode{C}}_{\textnormal{blocks}}$ of block types in $\text{\textcode{C}}$, the number of blocks $\text{\textcode{C}}_{\textnormal{size}}$, the depth $\text{\textcode{C}}_{\textnormal{depth}}$ of the corresponding Abstract Syntax Tree (AST), and the nesting structure $\text{\textcode{C}}_{\textnormal{struct}}$ representing programming concepts exercised by $\text{\textcode{C}}$. For instance, considering the code $\text{\textcode{C}} := \text{\textcode{C}}^{\textnormal{in}}$ in \figref{fig:intro.hoc.p0}, $\text{\textcode{C}}_{\textnormal{blocks}}=\{\textnormal{\textsf{move}\xspace, \textsf{turnL}\xspace, \textsf{repeatUntilGoal}\xspace, \textsf{If}\xspace}\}$, $\text{\textcode{C}}_{\textnormal{size}}=4$, $\text{\textcode{C}}_{\textnormal{depth}}=3$, and $\text{\textcode{C}}_{\textnormal{struct}} = \{\textcode{\textsc{Run}}\{\textsf{repeatUntilGoal}\xspace\{\textsf{If}\xspace\}\}\}$. Below, we introduce two useful definitions relating the task and code space. \looseness-1\begin{definition}[Solution code] $\text{\textcode{C}}$ is a solution code for $\text{\textcode{T}}$ if the following holds: $\text{\textcode{C}}$ successfully solves the visual puzzle $\text{\textcode{T}}_\textnormal{vis}$, $\text{\textcode{C}}_{\textnormal{blocks}} \subseteq \text{\textcode{T}}_\textnormal{store}$, and $\text{\textcode{C}}_{\textnormal{size}} \leq \text{\textcode{T}}_\textnormal{size}$. $\ensuremath{\mathcal{C}}_{\text{\textcode{T}}}$ denotes the set of all solution codes for $\text{\textcode{T}}$. \end{definition} \begin{definition}[Minimality of a task] \label{def.minimality} Given a solvable task $\text{\textcode{T}}$ with $|\ensuremath{\mathcal{C}}_\text{\textcode{T}}| \geq 1$ and a threshold $\delta \in \mathbb{N}$, the task is minimal if $\nexists \text{\textcode{C}} \in \ensuremath{\mathcal{C}}_\text{\textcode{T}}$ such that $\text{\textcode{C}}_{\textnormal{size}} < \text{\textcode{T}}_\textnormal{size} - \delta$. \end{definition} \looseness-1Next, we introduce two definitions formalizing the notion of conceptual similarity. Definition~\ref{def.conceptualsimilarity} formalizes conceptual similarity of a task $\text{\textcode{T}}$ along with one solution code $\text{\textcode{C}}$. Since a task can have multiple solution codes, Definition~\ref{def.conceptualsimilarity.task} provides a stricter notion of conceptual similarity of a task $\text{\textcode{T}}$ for all its solution codes. These definitions are used in our objective of task synthesis in conditions (I) and (V) below. \begin{definition}[Conceptual similarity of $(\text{\textcode{T}}, \text{\textcode{C}})$] \label{def.conceptualsimilarity} Given a reference $(\text{\textcode{T}}^{\textnormal{in}}, \text{\textcode{C}}^{\textnormal{in}})$ and a threshold $\delta \in \mathbb{N}$, a task $\text{\textcode{T}}$ along with a solution code $\text{\textcode{C}}$ is conceptually similar to $(\text{\textcode{T}}^{\textnormal{in}}, \text{\textcode{C}}^{\textnormal{in}})$ if the following holds: $\text{\textcode{T}}_\textnormal{store} = \text{\textcode{T}}^{\textnormal{in}}_\textnormal{store}$, $|\text{\textcode{T}}_\textnormal{size} - \text{\textcode{T}}^{\textnormal{in}}_\textnormal{size}| \leq \delta$, and $\text{\textcode{C}}_{\textnormal{struct}} = \text{\textcode{C}}^{\textnormal{in}}_{\textnormal{struct}}$. \end{definition} \begin{definition}[Conceptual similarity of $(\text{\textcode{T}}, \cdot)$] \label{def.conceptualsimilarity.task} Given a reference $(\text{\textcode{T}}^{\textnormal{in}}, \text{\textcode{C}}^{\textnormal{in}})$ and a threshold $\delta \in \mathbb{N}$, a task $\text{\textcode{T}}$ is conceptually similar to $(\text{\textcode{T}}^{\textnormal{in}}, \text{\textcode{C}}^{\textnormal{in}})$ if the following holds: $\text{\textcode{T}}_\textnormal{store} = \text{\textcode{T}}^{\textnormal{in}}_\textnormal{store}$, $|\text{\textcode{T}}_\textnormal{size} - \text{\textcode{T}}^{\textnormal{in}}_\textnormal{size}| \leq \delta$, and $\forall \text{\textcode{C}} \in \ensuremath{\mathcal{C}}_\text{\textcode{T}}, \text{\textcode{C}}_{\textnormal{struct}} = \text{\textcode{C}}^{\textnormal{in}}_{\textnormal{struct}}$. \end{definition} \textbf{Environment domain knowledge.} We now formalize our domain knowledge about the block-based environment to measure \emph{visual dissimilarity} of two tasks, and capture some notion of \emph{interestingness and quality} of a task. Given tasks $\text{\textcode{T}}$ and $\text{\textcode{T}}'$, we measure their visual dissimilarity by an environment-specific function $\ensuremath{\mathcal{F}_{\textnormal{diss}}}(\text{\textcode{T}}_\textnormal{vis}, \text{\textcode{T}}'_\textnormal{vis}) \in [0, 1]$. Moreover, we measure generic quality of a task with function $\ensuremath{\mathcal{F}_{\textnormal{qual}}}(\text{\textcode{T}}_\textnormal{vis},\text{\textcode{C}}) \in [0, 1]$. We provide specific instantiations of $\ensuremath{\mathcal{F}_{\textnormal{diss}}}$ and $\ensuremath{\mathcal{F}_{\textnormal{qual}}}$ in our evaluation. \textbf{Objective of task synthesis.} Given a reference task $\text{\textcode{T}}^{\textnormal{in}}$ and a solution code $\text{\textcode{C}}^{\textnormal{in}} \in \ensuremath{\mathcal{C}}_{\text{\textcode{T}}^{\textnormal{in}}}$ as input, we seek to generate a set $\{(\text{\textcode{T}}^{\textnormal{out}}, \text{\textcode{C}}^{\textnormal{out}})\}$ of new tasks along with solution codes that are \emph{conceptually similar} but \emph{visually dissimilar} to the input. Formally, given parameters $(\delta_{\textnormal{size}}, \delta_{\textnormal{diss}}, \delta_{\textnormal{qual}})$, our objective is to synthesize new tasks meeting the following conditions: \vspace{-1.5mm} \begin{enumerate}[(I)] \setlength{\itemsep}{2pt} \setlength{\parskip}{0pt} \item $(\text{\textcode{T}}^{\textnormal{out}}, \text{\textcode{C}}^{\textnormal{out}})$ is conceptually similar to $(\text{\textcode{T}}^{\textnormal{in}}, \text{\textcode{C}}^{\textnormal{in}})$ with threshold $\delta_{\textnormal{size}}$ in Definition~\ref{def.conceptualsimilarity}. \item $\text{\textcode{T}}^{\textnormal{out}}$ is visually dissimilar to $\text{\textcode{T}}^{\textnormal{in}}$ with margin $\delta_{\textnormal{diss}}$, i.e., $\ensuremath{\mathcal{F}_{\textnormal{diss}}}(\text{\textcode{T}}^{\textnormal{in}}_\textnormal{vis}, \text{\textcode{T}}^{\textnormal{out}}_\textnormal{vis}) \geq \delta_{\textnormal{diss}}$. \item $\text{\textcode{T}}^{\textnormal{out}}$ has a quality score above threshold $\delta_{\textnormal{qual}}$, i.e., $\ensuremath{\mathcal{F}_{\textnormal{qual}}}(\text{\textcode{T}}^{\textnormal{out}}_\textnormal{vis},\text{\textcode{C}}^\textnormal{out}) \geq \delta_{\textnormal{qual}}$. \end{enumerate} In addition, depending on the use case, it is desirable that the new tasks satisfy the following criteria: \vspace{-1.5mm} \begin{enumerate}[(I)] \setcounter{enumi}{3} \setlength{\itemsep}{2pt} \setlength{\parskip}{0pt} \item $\text{\textcode{C}}^{\textnormal{out}}$ is different from the input solution code, i.e., $\text{\textcode{C}}^{\textnormal{out}} \neq \text{\textcode{C}}^{\textnormal{in}}$. \item $\text{\textcode{T}}^{\textnormal{out}}$ is conceptually similar to $(\text{\textcode{T}}^{\textnormal{in}}, \text{\textcode{C}}^{\textnormal{in}})$ with threshold $\delta_{\textnormal{size}}$ in Definition~\ref{def.conceptualsimilarity.task}. \item $\text{\textcode{T}}^{\textnormal{out}}$ is minimal as per Definition~\ref{def.minimality} for a desired value of $\delta_{\textnormal{mini}}$ (e.g., $\delta_{\textnormal{mini}}=0$ or $\delta_{\textnormal{mini}}=1$). \end{enumerate} \section{Our Task Synthesis Algorithm}\label{sec.approach} \vspace{-2mm} \begin{wrapfigure}[6]{r}{0.50\textwidth} \centering \includegraphics[height=1.0cm]{fig/overview-pipeline/overview-pipeline.pdf} \caption{Stages in our task synthesis algorithm.} \label{fig:overviewofapproach} \end{wrapfigure} We now present the pipeline of our algorithm (see \figref{fig:overviewofapproach}), which takes as input a reference task $\text{\textcode{T}}^{\textnormal{in}}$ and its solution code $\text{\textcode{C}}^{\textnormal{in}}$, and generates a set $\{(\text{\textcode{T}}^{\textnormal{out}}, \text{\textcode{C}}^{\textnormal{out}})\}$ of new tasks with their solution codes. The goal is for this set to be conceptually similar to $(\text{\textcode{T}}^{\textnormal{in}}, \text{\textcode{C}}^{\textnormal{in}})$, but for new tasks $\{\text{\textcode{T}}^{\textnormal{out}}\}$ to be visually dissimilar to $\text{\textcode{T}}^{\textnormal{in}}$. This is achieved by two main stages: (1)~mutation of $\text{\textcode{C}}^{\textnormal{in}}$ to obtain a set $\{\text{\textcode{C}}^{\textnormal{out}}\}$, and (2)~symbolic execution of each $\text{\textcode{C}}^{\textnormal{out}}$ to create a task $\text{\textcode{T}}^{\textnormal{out}}$. The first stage, presented in Section~\ref{sec.approach.mutation}, converts $\text{\textcode{C}}^{\textnormal{in}}$ into an abstract representation restricted by a set of constraints (\figref{fig:overviewofapproach}(a)), which must be satisfied by any generated $\text{\textcode{C}}^{\textnormal{out}}$ (\figref{fig:overviewofapproach}(b)). The second stage, described in Section~\ref{sec.approach.tasksynthesis}, applies symbolic execution on each code $\text{\textcode{C}}^{\textnormal{out}}$ to create a corresponding visual task $\text{\textcode{T}}^{\textnormal{out}}$ (\figref{fig:overviewofapproach}(c)) while using Monte Carlo Tree Search (MCTS) to guide the search in the symbolic execution tree. \subsection{Code Mutation}\label{sec.approach.mutation} \vspace{-1mm} This stage in our pipeline mutates code $\text{\textcode{C}}^{\textnormal{in}}$ of task $\text{\textcode{T}}^{\textnormal{in}}$ such that its conceptual elements are preserved. Our mutation procedure consists of three main steps. First, we generate an abstract representation of $\text{\textcode{C}}^{\textnormal{in}}$, called \emph{sketch}. Second, we restrict the sketch with constraints that describe the space of its concrete instantiations. Although this formulation is inspired from work on generating algebra problems~\cite{singh2012}, we use it in the entirely different context of generating conceptually similar mutations of $\text{\textcode{C}}^{\textnormal{in}}$. This is achieved in the last step, where we use the sketch and its constraints to query an SMT solver~\cite{BarrettTinelli2018}; the query solutions are mutated codes $\{\text{\textcode{C}}^{\textnormal{out}}\}$ such that $\text{\textcode{C}}^{\textnormal{out}}_{\textnormal{struct}} = \text{\textcode{C}}^{\textnormal{in}}_{\textnormal{struct}}$ (see Definition~\ref{def.conceptualsimilarity}). \textbf{Step 1: Sketch.} The sketch of code \text{\textcode{C}}, denoted by \textcode{Q}, is an abstraction of $\text{\textcode{C}}$ capturing its skeleton and generalizing $\text{\textcode{C}}$ to the space of conceptually similar codes. \textcode{Q}, expressed in the language of \figref{fig:mutation.2}, is generated from $\text{\textcode{C}}$ with mapping $\ensuremath{\Omega}$. In particular, the map exploits the AST structure of the code: the AST is traversed in a depth-first manner, and all values are replaced with their corresponding sketch variables, i.e., \textnormal{action } \textcode{a}, \textnormal{bool } \textcode{b}, and \textnormal{iter } \textcode{x} are replaced with \textcode{A}, \textcode{B}, and \textcode{X}, respectively. In the following, we also use mapping $\ensuremath{\omega}(\cdot|~\text{\textcode{C}})$, which takes a sketch variable in \textcode{Q} and returns its value in \text{\textcode{C}}. In addition to the above, we may extend a variable \textcode{A} to an \emph{action sequence} \textoverline{\textcode{A}}, since any \textcode{A} is allowed to be empty ($\phi$). We may also add an action sequence of length $\delta_{\textnormal{size}}$ at the beginning and end of the obtained sketch. As an example, consider the code in \figref{fig:mutation.4} and the resulting sketch in \figref{fig:mutation.5}. Notice that, while we add an action sequence at the beginning of the sketch (\textoverline{\textcode{A}}\textsubscript{1}), no action sequence is appended at the end because construct \textsf{repeatUntilGoal}\xspace renders any succeeding code unreachable. \textbf{Step 2: Sketch constraints}. Sketch constraints restrict the possible concrete instantiations of a sketch by encoding the required semantics of the mutated codes. All constraint types are in \figref{fig:mutation.3}. In particular, $\Delta_0$ restricts the size of the mutated code within $\delta_{\textnormal{size}}$. $\Delta_1$ specifies the allowed mutations to an action sequence based on its value in the code, given by $\ensuremath{\omega}(\textoverline{\textcode{A}}~|~\text{\textcode{C}})$. For instance, this constraint could result in converting all \textcode{turnLeft}~actions of a sequence to \textcode{turnRight}. $\Delta_2$ restricts the possible values of the \textsf{repeat}\xspace~counter within threshold $\delta_{\textnormal{iter}}$. $\Delta_3$ ensures that the \textsf{repeat}\xspace~counter is optimal, i.e., action subsequences before and after this construct are not nested in it. $\Delta_4$ specifies the possible values of the \textsf{If}\xspace~condition based on its value in the code, given by $\ensuremath{\omega}(\textnormal{\textcode{B}}~|~\text{\textcode{C}})$. $\Delta_5$ refers to constraints imposed on action sequences nested within conditionals. As an example, consider $\Delta_5$ in \figref{fig:mutation.6}, which states that if $\text{\textcode{B}}_{1}$ = \textcode{pathLeft}, then the nested action sequence must have at least one \textcode{turnLeft}~action, and the first occurrence of this action must not be preceded by a \textsf{move}\xspace~or \textcode{turnRight}, thus preventing invalid actions within the conditional. $\Delta_6$ ensures minimality of an action sequence, i.e., optimality of the constituent actions to obtain the desired output. This constraint would, for instance, eliminate redundant sequences such as \textcode{turnLeft}, \textcode{turnRight}, which does not affect the output, or \textcode{turnLeft}, \textcode{turnLeft}, \textcode{turnLeft}, whose output could be achieved by a single \textcode{turnRight}. All employed elimination sequences can be found in the supplementary material. The entire list of constraints applied on the solution code in \figref{fig:mutation.4} is shown in \figref{fig:mutation.6}. \textbf{Step 3: SMT query.} For a sketch \textcode{Q} generated from code $\text{\textcode{C}}$ and its constraints, we pose the following query to an SMT solver: (sketch \textcode{Q}, \textcode{Q}-constraints). As a result, the solver generates a set of instantiations, which are conceptually similar to \text{\textcode{C}}. In our implementation, we used the Z3 solver~\cite{deMouraBjorner2008}. For the code in \figref{fig:mutation.4}, Z3 generated $66$ mutated codes in $0.8$s from an exhaustive space of $2,997$ possible codes with $\delta_{\textnormal{size}} = 2$. One such mutation is shown in \figref{fig:intro.hoc.p1}. While this approach generates codes that are devoid of most semantic irregularities, it has its limitations. Certain irregularities continue to exist in some generated codes: An example of such a code included the action sequence \textsf{move}\xspace, \textcode{turnLeft}, \textsf{move}\xspace, \textcode{turnLeft}, \textsf{move}\xspace, \textcode{turnLeft}, \textsf{move}\xspace, \textcode{turnLeft}, which results in the agent circling back to its initial location in the task space. This kind of undesirable behaviour is eliminated in the symbolic execution stage of our pipeline. \subsection{Symbolic Execution}\label{sec.approach.tasksynthesis} \vspace{-1mm} Symbolic execution~\cite{King1976} is an automated test-generation technique that symbolically explores execution paths in a program. During exploration of a path, it gathers symbolic constraints over program inputs from statements along the path. These constraints are then mutated (according to a search strategy), and an SMT solver is queried to generate new inputs that explore another path. \looseness-1\textbf{Obtaining visual tasks with symbolic execution.} This stage in our pipeline applies symbolic execution on each generated code $\text{\textcode{C}}^{\textnormal{out}}$ to obtain a suitable visual task $\text{\textcode{T}}^{\textnormal{out}}$. The program inputs of $\text{\textcode{C}}^{\textnormal{out}}$ are the agent's initial location/orientation and the status of the grid cells (\emph{unknown}, \emph{free}, \emph{blocked}, \emph{marker}, \emph{goal}), which is initially \emph{unknown}. Symbolic execution collects constraints over these from code statements. As in \figref{fig:symbolicexecution} for one path, symbolic execution generates a visual task for each path in $\text{\textcode{C}}^{\textnormal{out}}$. However, not all of these tasks are suitable. For instance, if the goal is reached after the first \textsf{move}\xspace~in \figref{fig:intro.hoc.p1}, all other statements in $\text{\textcode{C}}^{\textnormal{out}}$ are not covered, rendering the task less suitable for this code. Na\"ively, symbolic execution could first enumerate all paths in $\text{\textcode{C}}^{\textnormal{out}}$ and their corresponding tasks, and then rank them in terms of suitability. However, solution codes may have an unbounded number of paths, which leads to \emph{path explosion}, that is, the inability to cover all paths with tractable resources. \textbf{Guiding symbolic execution using Monte Carlo Tree Search (MCTS).} To address this issue, we use MCTS~\cite{kocsis2006bandit} as a search strategy in symbolic execution with the goal of generating more suitable tasks with fewer resources---we define task suitability next. Symbolic execution has been previously combined with MCTS in order to direct the exploration towards costly paths~\cite{luckow2018monte}. In the supplementary material, we provide an example demonstrating how MCTS could guide the symbolic execution in generating more suitable tasks. \looseness-1 As previously observed~\cite{kartal2016data}, a critical component of effectively applying MCTS is to define an evaluation function that describes the desired properties of the output, i.e., the visual tasks. Tailoring the evaluation function to our unique setting is exactly what differentiates our approach from existing work. In particular, our evaluation function, \ensuremath{\mathcal{F}_{\textnormal{score}}}, distinguishes suitable tasks by assigning a score ($\in [0,1]$) to them, which guides the MCTS search. A higher \ensuremath{\mathcal{F}_{\textnormal{score}}}~indicates a more suitable task. Its constituent components are: (i) $\ensuremath{\mathcal{F}_{\textnormal{cov}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis},\text{\textcode{C}}^\textnormal{out}) \in \{0,1\}$, which evaluates to 1 in the event of complete coverage of code $\text{\textcode{C}}^{\textnormal{out}}$ by task $\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}$ and 0 otherwise; (ii) $\ensuremath{\mathcal{F}_{\textnormal{diss}}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) \in [0,1]$, which evaluates the dissimilarity of $\text{\textcode{T}}^\textnormal{out}$ to $\text{\textcode{T}}^{\textnormal{in}}$ (see Section~\ref{sec.problem}); (iii) $\ensuremath{\mathcal{F}_{\textnormal{qual}}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out},\text{\textcode{C}}^\textnormal{out}) \in [0,1]$, which evaluates the quality and validity of $\text{\textcode{T}}^\textnormal{out}$; (iv) $\ensuremath{\mathcal{F}_{\textnormal{nocrash}}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{C}}^\textnormal{out}) \in \{0,1\}$, which evaluates to 0 in case the agent crashes into a wall and 1 otherwise; and (v) $\ensuremath{\mathcal{F}_{\textnormal{nocut}}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{C}}^\textnormal{out}) \in \{0,1\}$, which evaluates to 0 if there is a \emph{shortcut sequence} of actions (\textcode{a} in Fig.~\ref{fig:mutation.1}) smaller than $\text{\textcode{C}}^\textnormal{out}_\textnormal{size}$ that solves \text{\textcode{T}}\textsuperscript{out} and 1 otherwise. \ensuremath{\mathcal{F}_{\textnormal{qual}}}~and~\ensuremath{\mathcal{F}_{\textnormal{nocut}}}~also resolve the limitations of our mutation stage by eliminating codes and tasks that lead to undesirable agent behavior. We instantiate \ensuremath{\mathcal{F}_{\textnormal{score}}}~in the next section. \section{Experimental Evaluation}\label{sec.simulations} \vspace{-2mm} In this section, we evaluate our task synthesis algorithm on \textnormal{HOC}~and~\textnormal{Karel}~tasks. Our implementation is publicly available.\footnote{\href{https://github.com/adishs/neurips2020_synthesizing-tasks_code}{https://github.com/adishs/neurips2020\_synthesizing-tasks\_code}\label{footnote.githubrepo}} While we give an overview of key results here, a detailed description of our setup and additional experiments can be found in the supplementary material. \vspace{-2mm} \subsection{Reference Tasks and Specifications} \vspace{-1mm} \textbf{Reference tasks.} We use a set of ten reference tasks from \textnormal{HOC}~and~\textnormal{Karel}, shown in \figref{fig:dataset}. The \textnormal{HOC}~tasks were selected from the \textit{Hour of Code: Classic Maze} challenge by \textit{Code.org}~\cite{hourofcode_maze} and the Karel tasks from the \textit{Intro to Programming with Karel} course by \textit{CodeHS.com}~\cite{intro_to_karel_codehs}. The DSL of \figref{fig:mutation.1} is generic in that it includes both HOC and Karel codes, with the following differences: (i)~construct \textsf{while}\xspace, marker-related actions \textsf{put}\xspace, \textsf{pick}\xspace, and conditions \textcode{noPathA}, \textcode{noPathL}, \textcode{noPathR}, \textcode{marker}, \textcode{noMarker}~are specific to Karel only; (ii)~construct \textsf{repeatUntilGoal}\xspace and \textcode{goal} are specific to HOC only. Furthermore, the puzzles for HOC and Karel are of different styles (see \figref{fig:intro.hoc} and \figref{fig:intro.karel}). For all tasks, the grid size of the puzzles is fixed to $10\times10$ cells (grid-size parameter $n = 10$). \textbf{Specification of scoring functions.} $\ensuremath{\mathcal{F}_{\textnormal{qual}}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out},\text{\textcode{C}}^\textnormal{out}) \in [0,1]$ was approximated as the sum of the normalized counts of `moves', `turns', `segments', and `long-segments' in the grid; segments and long-segments are sequences of $\geq 3$ and $\geq 5$ \textsf{move}\xspace actions respectively. More precisely, for \textnormal{HOC}~tasks, we used the following function where features are computed by executing $\text{\textcode{C}}^\textnormal{out}$ on $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$: \begin{align*} \ensuremath{\mathcal{F}_{\textnormal{qual}}}^{\textnormal{HOC}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out},\text{\textcode{C}}^\textnormal{out}) & = \frac{1}{4}\Big{(} \frac{\ensuremath{\#}\text{moves}}{2n} + \frac{\ensuremath{\#}\text{turns}}{n} + \frac{\ensuremath{\#}\text{segments}}{n/2} + \frac{\ensuremath{\#}\text{long-segments}}{n/3} \Big{)}. \end{align*} Furthermore, in our implementation, $\ensuremath{\mathcal{F}_{\textnormal{qual}}}(\cdot)$ value was set to $0$ when $\ensuremath{\mathcal{F}_{\textnormal{nocrash}}}(\cdot) = 0$. For \textnormal{Karel}~tasks, \ensuremath{\mathcal{F}_{\textnormal{qual}}}~additionally included the normalized counts of \textsf{put}\xspace and \textsf{pick}\xspace, and is provided in the supplementary material. $\ensuremath{\mathcal{F}_{\textnormal{diss}}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) \in [0,1]$ was computed based on the dissimilarity of the agent's initial location/orientation w.r.t. $\text{\textcode{T}}_\textnormal{vis}^\textnormal{in}$, and the grid-cell level dissimilarity based on the Hamming distance between $\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}$ and $\text{\textcode{T}}_\textnormal{vis}^\textnormal{in}$. More precisely, we used the following function: \begin{align*} \ensuremath{\mathcal{F}_{\textnormal{diss}}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) & = \frac{1}{3}\Big{(} \textnormal{diss}(\textnormal{loc}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) + \textnormal{diss}(\textnormal{dir}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) + \textnormal{diss}(\textnormal{grid-cells}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) \Big{)} \end{align*} where $\textnormal{diss}(\textnormal{loc}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) \in \{0, 1\}$, $\textnormal{diss}(\textnormal{dir}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) \in \{0, 1\}$, and $\textnormal{diss}(\textnormal{grid-cells}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) \in [0, 1]$ (after the Hamming distance is normalized with a factor of $\frac{2}{n^2}$). Next, we define the evaluation function $\ensuremath{\mathcal{F}_{\textnormal{score}}}(\text{\textcode{T}}^\textnormal{out}, \text{\textcode{C}}^\textnormal{out}, \text{\textcode{T}}^{\textnormal{in}}, \text{\textcode{C}}^{\textnormal{in}}) \in [0,1]$ used by MCTS: \begin{align*} \ensuremath{\mathcal{F}_{\textnormal{score}}}(\text{\textcode{T}}^\textnormal{out}, \text{\textcode{C}}^\textnormal{out}, \text{\textcode{T}}^\textnormal{in}, \text{\textcode{C}}^\textnormal{in}) & = \underbrace{\mathbbm{1}{\big(\medmath{ \ensuremath{\mathcal{F}_{\textnormal{qual}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) \geq \delta_{\textnormal{qual}}, \ensuremath{\mathcal{F}_{\textnormal{nocrash}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) = 1, \ensuremath{\mathcal{F}_{\textnormal{nocut}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) = 1 }\big)}}_\text{(i)} \cdot \\ & \ \ \ \ \underbrace{\big[ \alpha_{1}\ensuremath{\mathcal{F}_{\textnormal{cov}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) + \alpha_{2}\ensuremath{\mathcal{F}_{\textnormal{qual}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) + \alpha_{3} \ensuremath{\mathcal{F}_{\textnormal{diss}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{T}}^\textnormal{in}_\textnormal{vis}) \big]}_\text{(ii)} \end{align*} where $\mathbbm{1}$ is an indicator function and each constant $\alpha = 1/3$. Component (ii) in the above function supplies the gradients for guiding the search in MCTS; Component (i) is applied at the end of the MCTS run to pick the output. More precisely, the \textit{best} task (i.e, the one with the highest \ensuremath{\mathcal{F}_{\textnormal{score}}}~value) is picked only from the pool of generated tasks which have $\ensuremath{\mathcal{F}_{\textnormal{score}}}(\cdot) > 0$ and satisfy $\ensuremath{\mathcal{F}_{\textnormal{cov}}}(\cdot) = 1$. \looseness-1\textbf{Specification of task synthesis and MCTS.} As per Section~\ref{sec.problem}, we set the following thresholds for our algorithm: (i) $\delta_\textnormal{size} = 2$, (ii) $\delta_\textnormal{diss} = 0.33$, and (iii) $\delta_\textnormal{qual}=0.2$ for codes with \textsf{while}\xspace or \textsf{repeatUntilGoal}\xspace, and $0.05$ otherwise. We run MCTS $10$ times per code, with each run generating one task. We set the maximum iterations of a run to $2$ million (M) and the exploration constant to $2$~\cite{kocsis2006bandit}. Even when considering a tree depth of $2n~(= 20)$, there are millions of leaves for difficult tasks \textsf{H4}\xspace~and \textsf{H5}\xspace, reflecting the complexity of task generation. For each code $\text{\textcode{C}}^{\textnormal{out}}$, we generated $10$ different visual tasks. To ensure sufficient diversity among the tasks generated for the same code, we introduced a measure \ensuremath{\mathcal{F}_{\textnormal{diversity}}}. This measure, not only ensures visual task dissimilarity, but also ensures sufficient diversity in entire symbolic paths during generation (for details, see supplementary material). \vspace{-2mm} \subsection{Results} \looseness-1\textbf{Performance of task synthesis algorithm.} \figref{fig:experiments.analysis} shows the results of our algorithm. The second column illustrates the enormity of the unconstrained space of mutated codes; we only impose size constraint $\Delta_0$ from \figref{fig:mutation.3}. We then additionally impose constraint $\Delta_1$ resulting in a partially constrained space of mutated codes (column 3), and finally apply all constraints from \figref{fig:mutation.3} to obtain the final set of generated codes (column 4). This reflects the systematic reduction in the space of mutated codes by our constraints. Column 5 shows the total running time for generating the final codes, which denotes the time taken by Z3 to compute solutions to our mutation query. As discussed in Section~\ref{sec.approach.mutation}, few codes with semantic irregularities still remain after the mutation stage. The symbolic execution stage eliminates these to obtain the reduced set of valid codes (column 6). Column 7 shows the final number of generated tasks and column 8 is the average time per output task (i.e., one MCTS run). \begin{figure}[t!] \centering \scalebox{0.85}{ \setlength\tabcolsep{2pt} \renewcommand{\arraystretch}{1.1} \begin{tabular}{c||rrrr||rrr||rrr} \toprule Task & \multicolumn{4}{c||}{Code Mutation} & \multicolumn{3}{c||}{Symbolic Execution} & \multicolumn{3}{c}{Fraction of $\text{\textcode{T}}^{\textnormal{out}}$ with criteria} \\ \multicolumn{1}{c||}{$\text{\textcode{T}}^{\textnormal{in}}$} & \multicolumn{1}{r}{\textbf{2:}$\#\text{\textcode{C}}^{\textnormal{out}}_{\Delta=\textnormal{0}}$} & \multicolumn{1}{r}{\textbf{3:}$\#\text{\textcode{C}}^{\textnormal{out}}_{\Delta=\textnormal{0,1}}$} & \multicolumn{1}{r}{\textbf{4:}$\#\text{\textcode{C}}^{\textnormal{out}}_{\Delta=\textnormal{all}}$} & \multicolumn{1}{r||}{\textbf{5:}Time} & \multicolumn{1}{r}{\textbf{6:}$\#\text{\textcode{C}}^{\textnormal{out}}$} & \multicolumn{1}{r}{\textbf{7:}$\#\text{\textcode{T}}^{\textnormal{out}}$} & \multicolumn{1}{r||}{\textbf{8:}Time} & \multicolumn{1}{r}{\textbf{9:}(V)} & \multicolumn{1}{r}{\textbf{10:}$\textnormal{(VI)}_{\delta_{\textnormal{mini}}=1}$} & \multicolumn{1}{r}{\textbf{11:}$\textnormal{(VI)}_{\delta_{\textnormal{mini}}=0}$} \\ \toprule \textsf{H1}\xspace & $3,159$ & $112$ & $64$ & $0.6$s & $28$ & $272$ & $68$s & $1.00$ & $1.00$ & $1.00$\\ \textsf{H2}\xspace & $8,991$ & $594$ & $138$ & $1.7$s & $48$ & $428$ & $61$s & $1.00$ & $1.00$ & $1.00$\\ \textnormal{H3} & $798,255$ & $13,122$ & $720$ & $13.3$s & $196$ & $1,126$ & $60$s & $0.90$ & $0.98$ & $0.90$\\ \textsf{H3}\xspace & $5,913$ & $152$ & $108$ & $1.0$s & $44$ & $404$ & $167$s & $1.00$ & $1.00$ & $0.50$\\ \textsf{H4}\xspace & $2,997$ & $294$ & $66$ & $0.8$s & $46$ & $444$ & $348$s & $0.98$ & $0.59$ & $0.27$\\ \textsf{H5}\xspace & $1,728$ & $294$ & $54$ & $0.6$s & $48$ & $480$ & $347$s & $0.80$ & $0.45$ & $0.07$\\ \textsf{K7}\xspace & $96,875$ & $150$ & $122$ & $1.3$s & $122$ & $1,196$ & $61$s & $1.00$ & $1.00$ & $1.00$\\ \textsf{K8}\xspace & $484,875$ & $4,506$ & $990$ & $11.6$s & $469$ & $4,506$ & $63$s & $1.00$ & $1.00$ & $1.00$\\ \textsf{K9}\xspace & $8.595 \times 10^{6}$ & $60,768$ & $888$ & $11.3$s & $432$ & $4,258$ & $185$s & $0.92$ & $0.92$ & $0.88$\\ \textsf{K10}\xspace & $132.625 \times 10^{6}$ & $19,328$ & $1,404$ & $17.1$s & $532$ & $5,032$ & $158$s & $1.00$ & $1.00$ & $1.00$\\ \bottomrule \end{tabular} } \vspace{-1mm} \caption{Results on \textnormal{HOC}~and~\textnormal{Karel}~tasks; details are provided in Section~\ref{sec.simulations}.} \label{fig:experiments.analysis} \vspace{-4mm} \end{figure} \begin{figure}[t!] \centering \begin{subfigure}[b]{.39\textwidth} \centering { \includegraphics[width=1\textwidth]{fig/mctsplots/hoc-G-mutation-6-22_run7/mctsplot_vary_time.pdf} \caption{Trends in \ensuremath{\mathcal{F}_{\textnormal{score}}}~features} \label{fig:experiments.mcts.varytime} } \end{subfigure} \begin{subfigure}[b]{.197\textwidth} \centering { \includegraphics[height=2.84cm]{fig/mctsplots/hoc-G-mutation-6-22_run7/mctsplot_best_200.pdf} \caption{Best at $200$} \label{fig:experiments.mcts.best1} } \end{subfigure} \begin{subfigure}[b]{.197\textwidth} \centering { \includegraphics[height=2.84cm]{fig/mctsplots/hoc-G-mutation-6-22_run7/mctsplot_best_20K.pdf} \caption{Best at $20$K} \label{fig:experiments.mcts.best2} } \end{subfigure} \begin{subfigure}[b]{.197\textwidth} \centering { \includegraphics[height=2.84cm]{fig/mctsplots/hoc-G-mutation-6-22_run7/mctsplot_best_2M.pdf} \caption{Best at $2$M} \label{fig:experiments.mcts.best3} } \end{subfigure} \vspace{-5mm} \caption{Illustration of a single MCTS run on $\text{\textcode{C}}^{\textnormal{out}}$ from \figref{fig:intro.hoc.p1} obtained from solution code of task \textsf{H4}\xspace~by mutation. (a) shows the temporal trends of different feature values in \ensuremath{\mathcal{F}_{\textnormal{score}}}~averaged over a time window of $100$ steps. (b)--(d)~show the best, i.e., highest scoring, tasks generated up to times $2 \times 10^2$, $2 \times 10^4$, and $2 \times 10^6$ respectively. $\text{\textcode{T}}^{\textnormal{out}}_\textnormal{vis}$ shown in \figref{fig:intro.hoc.t1} is the puzzle produced in (d). } \vspace{-5mm} \label{fig:experiments} \end{figure} \textbf{Analyzing output tasks.} We further analyze the generated tasks based on the objectives of Section~\ref{sec.problem}. All tasks satisfy properties (I)--(III) by design. Objective (IV) is easily achieved by excluding generated tasks for which $\text{\textcode{C}}^{\textnormal{out}} = \text{\textcode{C}}^{\textnormal{in}}$. For a random sample of $100$ of the generated tasks per reference task, we performed manual validation to determine whether objectives (V) and (VI) are met. The fraction of tasks that satisfy these objectives is listed in the last three columns of \figref{fig:experiments.analysis}. We observe that the vast majority of tasks meet the objectives, even if not by design. For \textsf{H5}\xspace, the fraction of tasks satisfying (VI) is low because the corresponding codes are generic enough to solve several puzzles. \textbf{Deep dive into an MCTS run.} To offer more insight into the task generation process, we take a closer look at an MCTS run for task \textsf{H4}\xspace, shown in \figref{fig:experiments}. \figref{fig:experiments.mcts.varytime} illustrates the improvement in various components of \ensuremath{\mathcal{F}_{\textnormal{score}}}~as the number of MCTS iterations increases. Best tasks at different iterations are shown in \figref{fig:experiments.mcts.best1}, \ref{fig:experiments.mcts.best2}, \ref{fig:experiments.mcts.best3}. As expected, the more the iterations, the better the tasks are. \looseness-1\textbf{Remarks.} We also ran the mutation stage by enumerating the programs within size constraints and then post-checking other constraints without Z3. This implementation leads to a run-time increase by a factor of $10$ to $100$ for different tasks. So, Z3 seems to be very effective by jointly considering all the constraints. As a search method, although MCTS seems computationally expensive, the actual run-time and memory footprint of an MCTS run depend on the unique traces explored (i.e., unique symbolic executions done)---this number is typically much lower than the number of iterations, also see discussion in the supplementary material. Considering the MCTS output in Figs.~\ref{fig:experiments.mcts.best2}, \ref{fig:experiments.mcts.best3}, to obtain a comparable evaluation score through a random search, the corresponding number of unique symbolic executions required is at least $10$ times more than executed by MCTS. We note that while we considered one I/O pair for \textnormal{Karel}~tasks, our methodology can be easily extended to multiple I/O pairs by adapting techniques designed for generating diverse tasks. % % \section{User Study and Comparison with Alternate Methods}\label{sec.userstudy} \vspace{-2mm} In this section, we evaluate our task synthesis algorithm with a user study focusing on tasks \textsf{H2}\xspace, \textsf{H3}\xspace, \textsf{H4}\xspace, and \textsf{H5}\xspace. We developed an online app\footnote{\href{https://www.teaching-blocks.cc/}{https://www.teaching-blocks.cc/}\label{footnote.userstudyapp}}, which uses the publicly available toolkit of Blockly Games~\cite{googleblockly} and provides an interface for a participant to practice block-based programming tasks for HOC. Each ``practice session'' of the study involves three steps: (i)~a reference task $\text{\textcode{T}}^{\textnormal{in}} \in \{\text{\textsf{H2}\xspace}, \text{\textsf{H3}\xspace}, \text{\textsf{H4}\xspace}, \text{\textsf{H5}\xspace}\}$ is shown to the participant along with its solution code $\text{\textcode{C}}^{\textnormal{in}}$, (ii)~a new task $\text{\textcode{T}}^{\textnormal{out}}$ is generated for which the participant has to provide a solution code, and (iii)~a post-survey asks the participant to assess the visual dissimilarity of the two tasks on a $4$-point Likert scale as used in \cite{polozov2015}. Details on the app interface and questionnaire are provided in the supplementary material. Participants for the study were recruited through Amazon Mechanical Turk. We only selected four tasks due to the high cost involved in conducting the study (about $1.8$~USD per participant). The number of participants and their performance are documented in \figref{fig:userstudy}. \textbf{Baselines and methods evaluated.} \looseness-1 We evaluated four different methods, including three baselines (\ensuremath{\textsc{Same}}, \ensuremath{\textsc{Tutor}}, \ensuremath{\textsc{MutTask}}) and our algorithm (\ensuremath{\textsc{SynTask}}). \ensuremath{\textsc{Same}}~generates tasks such that $\text{\textcode{T}}^{\textnormal{in}} = \text{\textcode{T}}^{\textnormal{out}}$. \ensuremath{\textsc{Tutor}}~produces tasks that are similar to $\text{\textcode{T}}^{\textnormal{in}}$ and designed by an expert. We picked similar problems from the set of $20$ \emph{Classic Maze} challenge~\cite{hourofcode_maze} tasks exercising the same programming concepts: \emph{Maze 6, 9} for \textsf{H2}\xspace, \emph{Maze 11, 13} for \textsf{H3}\xspace, \emph{Maze 15, 17} for \textsf{H4}\xspace, and \emph{Maze 19} for \textsf{H5}\xspace. \ensuremath{\textsc{MutTask}}~generated tasks by directly mutating the grid-world of the original task, i.e., by moving the agent or goal by up to two cells and potentially changing the agent's orientation. A total of $18$, $20$, $15$, and $17$ tasks were generated for \textsf{H2}\xspace, \textsf{H3}\xspace, \textsf{H4}\xspace, and \textsf{H5}\xspace, respectively. \figref{fig:userstudy.taskmutation} shows two output tasks for \textsf{H3}\xspace~and illustrates the challenge in directly mutating the input task, given the high discontinuity in mapping from the space of tasks to their codes. For \textsf{H3}\xspace, a total of $14$ out of $20$ new tasks were structurally very different from the input. \ensuremath{\textsc{SynTask}}~uses our algorithm to generate tasks. We picked the generated tasks from three groups based on the size of the code mutations from which they were produced, differing from the reference solution code by $+\delta_{\textnormal{size}}$ for $\delta_{\textnormal{size}} \in \{0, 1, 2\}$. For \textsf{H2}\xspace~and \textsf{H3}\xspace, we randomly selected $5$ tasks from each group, for a total of $15$ new tasks per reference task. For \textsf{H4}\xspace~and \textsf{H5}\xspace, we selected $10$ tasks from the first group ($\delta_{\textnormal{size}}=0$) only, due to their complexity stemming from nested constructs in their codes. We observed that \ensuremath{\textsc{Tutor}}~tasks for \textsf{H4}\xspace, \textsf{H5}\xspace~were also of $\delta_{\textnormal{size}}=0$, i.e., $\text{\textcode{C}}^{\textnormal{out}}_{\textnormal{size}} = \text{\textcode{C}}^{\textnormal{in}}_{\textnormal{size}}$. All the generated tasks picked for \ensuremath{\textsc{SynTask}}~adhere to properties (I)--(VI) in Section~\ref{sec.problem}. \textbf{Results on task solving.} In terms of successfully solving the generated tasks, \ensuremath{\textsc{Same}}~performed best (mean success = $0.94$) in comparison to \ensuremath{\textsc{Tutor}}~(mean = $0.90$), \ensuremath{\textsc{SynTask}}~(mean = $0.89$), and \ensuremath{\textsc{MutTask}}~(mean = $0.68$)---this is expected given the tasks generated by \ensuremath{\textsc{Same}}. In comparison to \ensuremath{\textsc{Tutor}}, the performance of \ensuremath{\textsc{SynTask}}~was not significantly different~($\chi^2=0.04, p=0.83$); in comparison to \ensuremath{\textsc{MutTask}}, \ensuremath{\textsc{SynTask}}~performed significantly better ($\chi^2=28.74, p < e^{-8}$). The complexity of the generated tasks is also reflected in the average time that participants spent on solving them. As shown in \figref{fig:userstudy}, they spent more time solving the tasks generated by \ensuremath{\textsc{MutTask}}. \looseness-1 \textbf{Results on visual task dissimilarity.} Visual dissimilarity was measured on a Likert scale ranging from 1--4, 1 being highly similar and 4 highly dissimilar. Comparing the dissimilarity of the generated tasks w.r.t. the reference task, we found that the performance of \ensuremath{\textsc{Same}}~was worst (mean dissimilarity = $1.07$), while that of \ensuremath{\textsc{Tutor}}~was best (mean = $2.90$). \ensuremath{\textsc{SynTask}}~(mean = $2.63$) performed significantly better than \ensuremath{\textsc{MutTask}}~(mean = $2.17$), yet slightly worse than \ensuremath{\textsc{Tutor}}. This is because \ensuremath{\textsc{Tutor}}~generates tasks with additional distracting paths and noise, which can also be done by our algorithm (although not done for this study). Moreover, for \textsf{H2}\xspace, which had no conditionals, the resulting codes were somewhat similar, and so were the generated puzzles. When excluding \textsf{H2}\xspace~from the analysis, the difference between \ensuremath{\textsc{SynTask}}~(mean = $2.72$) and \ensuremath{\textsc{Tutor}}~(mean =$2.93$) was not statistically significant. A detailed distribution of the responses can be found in the supplementary material. \looseness-1\textbf{Remarks.} \ensuremath{\textsc{Same}}'s performance in terms of tasks solved is below $1.00$, possibly because participants overlooked the solution of Step $1$, unaware they will be receiving the same task in Step $2$, and the app did not allow them to go back to Step $1$. This user study provides a proof-of-concept; more elaborate studies are needed to fully reach the motivational goal of teaching $\textnormal{K-}12$ students, and evaluate the long term impact on students' concept learning. As additional studies, it would be important to understand the sensitivity of user study results w.r.t. the Likert scale definition; another possibility is to use pairwise comparisons in eliciting user evaluations. \begin{figure}[t!] \centering \scalebox{0.85}{ \setlength\tabcolsep{3pt} \renewcommand{\arraystretch}{1.1} \begin{tabular}{r|rrrrr|rrrrr|rrrrr|rrrrr} \toprule Method & \multicolumn{5}{c|}{Total participants} & \multicolumn{5}{c|}{Fraction of tasks solved} & \multicolumn{5}{c|}{Time spent in secs} & \multicolumn{5}{c}{Visual dissimilarity} \\ & \textbf{H-} & \textsf{H2}\xspace & \textsf{H3}\xspace & \textsf{H4}\xspace & \textsf{H5}\xspace & \textbf{H-} & \textsf{H2}\xspace & \textsf{H3}\xspace & \textsf{H4}\xspace & \textsf{H5}\xspace & \textbf{H-} & \textsf{H2}\xspace & \textsf{H3}\xspace & \textsf{H4}\xspace & \textsf{H5}\xspace & \textbf{H-} & \textsf{H2}\xspace & \textsf{H3}\xspace & \textsf{H4}\xspace & \textsf{H5}\xspace \\ \toprule \ensuremath{\textsc{Same}} & $\textbf{96}$ & $24$ & $24$ & $24$ & $24$ & $\textbf{.94}$ & $.92$ & $1.00$ & $.96$ & $.88$ & $\textbf{89}$ & $60$ & $59$ & $93$ & $145$ & $\textbf{1.07}$ & $1.12$ & $1.04$ & $1.00$ & $1.12$ \\ \ensuremath{\textsc{Tutor}} & $\textbf{170}$ & $48$ & $48$ & $49$ & $25$ & $\textbf{.90}$ & $.90$ & $.92$ & $.88$ & $.92$ & $\textbf{121}$ & $107$ & $113$ & $118$ & $169$ & $\textbf{2.90}$ & $2.81$ & $2.79$ & $2.96$ & $3.16$ \\ \ensuremath{\textsc{MutTask}} & $\textbf{278}$ & $72$ & $79$ & $60$ & $67$ & $\textbf{.68}$ & $.76$ & $.71$ & $.65$ & $.60$ & $\textbf{219}$ & $135$ & $299$ & $219$ & $215$ & $\textbf{2.17}$ & $2.36$ & $2.33$ & $1.95$ & $1.99$ \\ \ensuremath{\textsc{SynTask}} & $\textbf{197}$ & $59$ & $57$ & $40$ & $41$ & $\textbf{.89}$ & $.92$ & $.89$ & $.92$ & $.83$ & $\textbf{144}$ & $85$ & $183$ & $130$ & $189$ & $\textbf{2.63}$ & $2.41$ & $2.42$ & $2.68$ & $3.20$ \\ \bottomrule \end{tabular} } \vspace{-1mm} \caption{User study results for \textnormal{HOC}~tasks (\textbf{H-} represents all tasks in the study); see Section~\ref{sec.userstudy}. } \vspace{-4mm} \label{fig:userstudy} \end{figure} \begin{figure}[t!] \centering \begin{subfigure}[b]{.1425\textwidth} \centering { \includegraphics[height=2.085cm]{fig/taskmutation_baseline/F_orig.pdf} \caption{$\text{\textcode{T}}^{\textnormal{in}}_\textnormal{vis}$ for \textsf{H3}\xspace} \label{fig:userstudy.hoc.t0.orig} } \end{subfigure} \begin{subfigure}[b]{.1425\textwidth} \centering { \includegraphics[height=2.085cm]{fig/taskmutation_baseline/F19.pdf} \caption{1\textsuperscript{st} $\text{\textcode{T}}^{\textnormal{out}}_\textnormal{vis}$} \label{fig:userstudy.hoc.t0.sim} } \end{subfigure} \begin{subfigure}[b]{.1425\textwidth} \centering { \includegraphics[height=2.085cm]{fig/taskmutation_baseline/F16-1.pdf} \caption{2\textsuperscript{nd} $\text{\textcode{T}}^{\textnormal{out}}_\textnormal{vis}$} \label{fig:userstudy.hoc.t0.diff} } \end{subfigure} \begin{subfigure}[b]{.197\textwidth} \centering { \begin{boxcode}{3.68cm}{0.7}{0.55} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnLeft}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnRight}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \\ \end{boxcode} \vspace{-1mm} \caption{$\text{\textcode{C}}^{\textnormal{in}}$ for \textsf{H3}\xspace} \label{fig:userstudy.hoc.p0.orig} } \end{subfigure} \begin{subfigure}[b]{.197\textwidth} \centering { \begin{boxcode}{3.68cm}{0.7}{0.55} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{move}\xspace\\ \quad \textsf{move}\xspace\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textcode{turnLeft}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnRight}\\ \quad \quad \textsf{move}\xspace\\ \quad \textcode{\}}\\ \textcode{\}} \end{boxcode} \vspace{-1mm} \caption{1\textsuperscript{st} $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:userstudy.hoc.p0.sim} } \end{subfigure} \begin{subfigure}[b]{.145\textwidth} \centering { \begin{boxcode}{2.72cm}{0.7}{0.55} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{move}\xspace\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnLeft}\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnRight}\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnLeft} \\ \quad \textcolor{blue}{$\mathbf{15}$ \textbf{more actions}}\\ \textcode{\}} \end{boxcode} \vspace{-0.6mm} \caption{2\textsuperscript{nd} $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:userstudy.hoc.p0.diff} } \end{subfigure} \vspace{-5mm} \caption{\ensuremath{\textsc{MutTask}}~applied to \textsf{H3}\xspace. $\text{\textcode{T}}^{\textnormal{in}}_\textnormal{vis}$ and $\text{\textcode{C}}^{\textnormal{in}}$ are shown in (a) and (d). (b)--(c) illustrate two tasks $\text{\textcode{T}}^{\textnormal{out}}_\textnormal{vis}$ obtained via small mutations of $\text{\textcode{T}}^{\textnormal{in}}_\textnormal{vis}$. (e) is the smallest solution code for (b) and is structurally similar to $\text{\textcode{C}}^{\textnormal{in}}$. (f) is the smallest solution code for (c) and is drastically different from $\text{\textcode{C}}^{\textnormal{in}}$. } \vspace{-6mm} \label{fig:userstudy.taskmutation} \end{figure} \section{Conclusions and Outlook}\label{sec.conclusions} \vspace{-3mm} \looseness-1We developed techniques for a critical aspect of pedagogy in block-based programming: Automatically generating new tasks that exercise specific programming concepts, while looking visually dissimilar to input. We demonstrated the effectiveness of our methodology through an extensive empirical evaluation and user study on reference tasks from popular programming platforms. We believe our techniques have the potential to drastically improve the success of pedagogy in block-based visual programming environments by providing tutors and students with a substantial pool of new tasks. Beyond the application domain of programming education, our methodology can be used for generating large-scale datasets consisting of tasks and solution codes with desirable characteristics---this can be potentially useful for training neural program synthesis methods. There are several promising directions for future work, including but not limited to: Learning a policy to guide the MCTS procedure (instead of running vanilla MCTS); automatically learning the constraints and cost function from a human-generated pool of problems; and applying our methodology to other programming environments (e.g., Python problems). \section*{Broader Impact}\label{sec.impact} This paper develops new techniques for improving pedagogy in block-based visual programming environments. Such programming environments are increasingly used nowadays to introduce computing concepts to novice programmers, and our work is motivated by the clear societal need of enhancing $\textnormal{K-}12$ computing education. In existing systems, the programming tasks are hand-curated by tutors, and the available set of tasks is typically very limited. This severely limits the utility of existing systems for long-term learning as students do not have access to practice tasks for mastering the programming concepts. \looseness-1 We take a step towards tackling this challenge by developing a methodology to generate new practice tasks for a student that match a desired level of difficulty and exercise specific programming concepts. Our task synthesis algorithm is able to generate 1000's of new similar tasks for reference tasks taken from the \emph{Hour of Code: Classic Maze} challenge by \emph{Code.org} and the \emph{Intro to Programming with Karel} course by \emph{CodeHS.com}. Our extensive experiments and user study further validate the quality of the generated tasks. Our task synthesis algorithm could be useful in many different ways in practical systems. For instance, tutors can assign new practice tasks as homework or quizzes to students to check their knowledge, students can automatically obtain new similar tasks after they failed to solve a given task and received assistance, and intelligent tutoring systems could automatically generate a personalized curriculum of problems for a student for long-term learning. \section{List of Appendices}\label{appendix.table-of-contents} In this section, we provide a brief description of the content provided in the appendices of the paper. \begin{itemize} \item Appendix~\ref{appendix.sec.introduction} shows all the $10$ reference tasks from \figref{fig:dataset}. For each task, we also illustrate our methodology as was done in \figref{fig:intro.hoc} and \figref{fig:intro.karel}. \item Appendix~\ref{appendix.sec.userstudy} expands on the user study analysis. (Section~\ref{sec.userstudy}) \item Appendix~\ref{appendix.sec.mutation} provides additional details on the code mutation stage. (Section~\ref{sec.approach.mutation}) \item Appendix~\ref{appendix.sec.symbolicexecution} demonstrates how MCTS could guide the symbolic execution in generating more suitable tasks. (Section~\ref{sec.approach.tasksynthesis}) \item Appendix~\ref{appendix.sec.simulations} provides additional details and results about experiments. (Section~\ref{sec.simulations}) \end{itemize} \section{Illustration of Our Methodology for the \textnormal{HOC}~and \textnormal{Karel}~Dataset}\label{appendix.sec.introduction} In this section, we illustrate our methodology for all the $10$ reference tasks from \figref{fig:dataset}. For each reference task $(\text{\textcode{T}}^{\textnormal{in}}, \text{\textcode{C}}^{\textnormal{in}})$, we picked one output $(\text{\textcode{T}}^{\textnormal{out}}, \text{\textcode{C}}^{\textnormal{out}})$ from the entire set of generated outputs. \begin{figure}[h!] \centering \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_intro/appendix_intro_H1_env0.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{in}}$} \label{fig:appendix.intro.hoc.t0} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnLeft}\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnRight}\\ \quad \textsf{move}\xspace\\ \textcode{\}} \\ \\ \vspace{2.5mm} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{in}}$} \label{fig:appendix.intro.hoc.p0} } \end{subfigure} \quad \quad \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_intro/appendix_intro_H1_env1.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{out}}$} \label{fig:appendix.intro.hoc.t1} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{move}\xspace\\ \quad \textsf{move}\xspace\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnRight}\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnLeft}\\ \quad \textsf{move}\xspace\\ \textcode{\}} \vspace{2.5mm} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:appendix.intro.hoc.p1} } \end{subfigure} \vspace{-1.5mm} \caption{Task \textsf{H1}\xspace~-- Illustration of our methodology.} \vspace{-3.5mm} \label{fig:appendix.intro.hoc} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_intro/appendix_intro_H2_env0.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{in}}$} \label{fig:appendix.intro.hoc.t0} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textcode{turnRight}\\ \quad \textsf{repeat}\xspace\textcode{(5}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \textcode{\}}\\ \textcode{\}} \\ \\ \\ \vspace{1.5mm} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{in}}$} \label{fig:appendix.intro.hoc.p0} } \end{subfigure} \quad \quad \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_intro/appendix_intro_H2_env1.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{out}}$} \label{fig:appendix.intro.hoc.t1} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{move}\xspace\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnRight}\\ \quad \textsf{repeat}\xspace\textcode{(6}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \textcode{\}}\\ \textcode{\}} \\ \vspace{2mm} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:appendix.intro.hoc.p1} } \end{subfigure} \vspace{-1.5mm} \caption{Task \textsf{H2}\xspace~-- Illustration of our methodology.} \vspace{-3.5mm} \label{fig:appendix.intro.hoc} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_intro/appendix_intro_H3_env0.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{in}}$} \label{fig:appendix.intro.hoc.t0} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeat}\xspace\textcode{(4}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \textcode{\}}\\ \quad \textcode{turnLeft}\\ \quad \textsf{repeat}\xspace\textcode{(5}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \textcode{\}}\\ \textcode{\}} \vspace{2.5mm} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{in}}$} \label{fig:appendix.intro.hoc.p0} } \end{subfigure} \quad \quad \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_intro/appendix_intro_H3_env1.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{out}}$} \label{fig:appendix.intro.hoc.t1} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.58} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeat}\xspace\textcode{(5}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \textcode{\}}\\ \quad \textcode{turnLeft}\\ \quad \textsf{repeat}\xspace\textcode{(5}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \textcode{\}}\\ \quad \textcode{turnLeft}\\ \quad \textsf{move}\xspace\\ \textcode{\}} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:appendix.intro.hoc.p1} } \end{subfigure} \vspace{-1.5mm} \caption{Task \textnormal{H3}~-- Illustration of our methodology.} \vspace{-3.5mm} \label{fig:appendix.intro.hoc} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_intro/appendix_intro_H4_env0.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{in}}$} \label{fig:appendix.intro.hoc.t0} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnLeft}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnRight}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \vspace{1.8mm} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{in}}$} \label{fig:appendix.intro.hoc.p0} } \end{subfigure} \quad \quad \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_intro/appendix_intro_H4_env1.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{out}}$} \label{fig:appendix.intro.hoc.t1} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnRight}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnLeft}\\ \quad \textcode{\}}\\ \textcode{\}} \vspace{1.5mm} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:appendix.intro.hoc.p1} } \end{subfigure} \vspace{-1.5mm} \caption{Task \textsf{H3}\xspace~-- Illustration of our methodology.} \vspace{-3.5mm} \label{fig:appendix.intro.hoc} \end{figure} \begin{figure}[t!] \centering \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/intro/intro_hoc_env0.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{in}}$} \label{fig:appendix.intro.hoc.t0} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathLeft}\textcode{)\{}\\ \quad \quad \quad \textcode{turnLeft}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \vspace{1mm} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{in}}$} \label{fig:appendix.intro.hoc.p0} } \end{subfigure} \quad \quad \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/mctsplots/hoc-G-mutation-6-22_run7/mctsplot_best_2M.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{out}}$} \label{fig:appendix.intro.hoc.t1} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.58} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnLeft}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathRight}\textcode{)\{}\\ \quad \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:appendix.intro.hoc.p1} } \end{subfigure} \vspace{-1.5mm} \caption{Task \textsf{H4}\xspace~-- Illustration of our methodology (same as \figref{fig:intro.hoc} and shown for completeness).} \vspace{-3.5mm} \label{fig:appendix.intro.hoc} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_intro/appendix_intro_H6_env0.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{in}}$} \label{fig:appendix.intro.hoc.t0} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathAhead}\textcode{)\{}\\ \quad \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{\}}\\ \quad \quad \textcode{\textsc{Else}}\textcode{\{}\\ \quad \quad \quad \textcode{turnLeft}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{in}}$} \label{fig:appendix.intro.hoc.p0} } \end{subfigure} \quad \quad \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_intro/appendix_intro_H6_env1.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{out}}$} \label{fig:appendix.intro.hoc.t1} } \end{subfigure} \ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathAhead}\textcode{)\{}\\ \quad \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{\}}\\ \quad \quad \textcode{\textsc{Else}}\textcode{\{}\\ \quad \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \end{boxcode} \vspace{-1mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:appendix.intro.hoc.p1} } \end{subfigure} \vspace{-1.5mm} \caption{Task \textsf{H5}\xspace~-- Illustration of our methodology.} \vspace{-3.5mm} \label{fig:appendix.intro.hoc} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}[b]{.27\textwidth} \centering { \includegraphics[height=1.95cm]{fig/appendix_intro/appendix_intro_K7_env0.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{in}}$} \label{fig:appendix.intro.karel.t0} } \end{subfigure} \ \begin{subfigure}[b]{.195\textwidth} \centering { \begin{boxcode}{3.5cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{move}\xspace\\ \quad \textsf{move}\xspace\\ \quad \textcode{pickMarker}\\ \quad \textsf{move}\xspace\\ \quad \textsf{move}\xspace\\ \textcode{\}} \vspace{2.5mm} \end{boxcode} \vspace{-1.18mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{in}}$} \label{fig:appendix.intro.karel.p0} } \end{subfigure} \quad \ \begin{subfigure}[b]{.27\textwidth} \centering { \includegraphics[height=1.95cm]{fig/appendix_intro/appendix_intro_K7_env1.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{out}}$} \label{fig:appendix.intro.karel.t1} } \end{subfigure} \ \begin{subfigure}[b]{.195\textwidth} \centering { \begin{boxcode}{3.5cm}{0.75}{0.58} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textcode{putMarker}\\ \quad \textcode{turnLeft}\\ \quad \textsf{move}\xspace\\ \quad \textsf{move}\xspace\\ \quad \textcode{pickMarker}\\ \quad \textsf{move}\xspace\\ \quad \textsf{move}\xspace\\ \textcode{\}} \end{boxcode} \vspace{-1.3mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:appendix.intro.karel.p1} } \end{subfigure} \vspace{-1.5mm} \caption{Task \textsf{K7}\xspace~-- Illustration of our methodology.} \vspace{-3.5mm} \label{fig:appendix.intro.karel1} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}[b]{.27\textwidth} \centering { \includegraphics[height=1.95cm]{fig/appendix_intro/appendix_intro_K8_env0.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{in}}$} \label{fig:appendix.intro.karel.t0} } \end{subfigure} \ \begin{subfigure}[b]{.195\textwidth} \centering { \begin{boxcode}{3.5cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeat}\xspace\textcode{(4}\textcode{)\{}\\ \quad \quad \textcode{putMarker}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnLeft}\\ \quad \textcode{\}}\\ \textcode{\}} \vspace{3mm} \end{boxcode} \vspace{-1.18mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{in}}$} \label{fig:appendix.intro.karel.p0} } \end{subfigure} \quad \ \begin{subfigure}[b]{.27\textwidth} \centering { \includegraphics[height=1.95cm]{fig/appendix_intro/appendix_intro_K8_env1.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{out}}$} \label{fig:appendix.intro.karel.t1} } \end{subfigure} \ \begin{subfigure}[b]{.195\textwidth} \centering { \begin{boxcode}{3.5cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeat}\xspace\textcode{(4}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{pickMarker}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnLeft}\\ \quad \textcode{\}}\\ \textcode{\}} \end{boxcode} \vspace{-1.18mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:appendix.intro.karel.p1} } \end{subfigure} \vspace{-1.5mm} \caption{Task \textsf{K8}\xspace~-- Illustration of our methodology.} \vspace{-3.5mm} \label{fig:appendix.intro.karel2} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}[b]{.27\textwidth} \centering { \includegraphics[height=1.95cm]{fig/appendix_intro/appendix_intro_K9_env0.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{in}}$} \label{fig:appendix.intro.karel.t0} } \end{subfigure} \ \begin{subfigure}[b]{.195\textwidth} \centering { \begin{boxcode}{3.5cm}{0.75}{0.58} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeat}\xspace\textcode{(8}\textcode{)\{}\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{noMarker}\textcode{)\{}\\ \quad \quad \quad \textcode{putMarker}\\ \quad \quad \textcode{\}}\\ \quad \quad \textcode{\textsc{Else}}\textcode{\{}\\ \quad \quad \quad \textcode{pickMarker}\\ \quad \quad \textcode{\}}\\ \quad \quad \textsf{move}\xspace\\ \quad \textcode{\}}\\ \textcode{\}} \vspace{1.5mm} \end{boxcode} \vspace{-1.18mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{in}}$} \label{fig:appendix.intro.karel.p0} } \end{subfigure} \quad \ \begin{subfigure}[b]{.27\textwidth} \centering { \includegraphics[height=1.95cm]{fig/appendix_intro/appendix_intro_K9_env1.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{out}}$} \label{fig:appendix.intro.karel.t1} } \end{subfigure} \ \begin{subfigure}[b]{.195\textwidth} \centering { \begin{boxcode}{3.5cm}{0.75}{0.58} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textcode{turnRight}\\ \quad \textsf{repeat}\xspace\textcode{(7}\textcode{)\{}\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{noMarker}\textcode{)\{}\\ \quad \quad \quad \textcode{putMarker}\\ \quad \quad \textcode{\}}\\ \quad \quad \textcode{\textsc{Else}}\textcode{\{}\\ \quad \quad \quad \textcode{pickMarker}\\ \quad \quad \textcode{\}}\\ \quad \quad \textsf{move}\xspace\\ \quad \textcode{\}}\\ \textcode{\}} \end{boxcode} \vspace{-1.18mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:appendix.intro.karel.p1} } \end{subfigure} \vspace{-1.5mm} \caption{Task \textsf{K9}\xspace~-- Illustration of our methodology.} \vspace{-3.5mm} \label{fig:appendix.intro.karel3} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}[b]{.27\textwidth} \centering { \includegraphics[height=1.95cm]{fig/intro/intro_karel_env0.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^{\textnormal{in}}$} \label{fig:appendix.intro.karel.t0} } \end{subfigure} \ \begin{subfigure}[b]{.195\textwidth} \centering { \begin{boxcode}{3.5cm}{0.75}{0.58} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textcode{putMarker}\\ \quad \textsf{while}\xspace\textcode{(}\textcode{pathAhead}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnLeft}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{putMarker}\\ \quad \textcode{\}}\\ \textcode{\}} \vspace{1.9mm} \end{boxcode} \vspace{-1.18mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{in}}$} \label{fig:appendix.intro.karel.p0} } \end{subfigure} \quad \ \begin{subfigure}[b]{.27\textwidth} \centering { \includegraphics[height=1.95cm]{fig/intro/intro_karel_env1.pdf} \caption{Visual puzzle for $\text{\textcode{T}}^\textnormal{out}$} \label{fig:appendix.intro.karel.t1} } \end{subfigure} \ \begin{subfigure}[b]{.195\textwidth} \centering { \begin{boxcode}{3.5cm}{0.75}{0.58} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textcode{putMarker}\\ \quad \textsf{while}\xspace\textcode{(}\textcode{pathAhead}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnRight}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnLeft}\\ \quad \quad \textcode{putMarker}\\ \quad \textcode{\}}\\ \textcode{\}} \end{boxcode} \vspace{-1.18mm} \caption{Solution code $\text{\textcode{C}}^{\textnormal{out}}$} \label{fig:appendix.intro.karel.p1} } \end{subfigure} \vspace{-1.5mm} \caption{Task \textsf{K10}\xspace~-- Illustration of our methodology (same as \figref{fig:intro.karel} and shown for completeness).} \vspace{-3.5mm} \label{fig:appendix.intro.karel4} \end{figure} \section{Code Mutation: Additional Details}\label{appendix.sec.mutation} This section describes the mutation stage of the task synthesis algorithm. In particular, we describe in detail the constraints applied on sketch \textcode{Q} = $\ensuremath{\Omega}(\text{\textcode{C}})$. Note that we denote an empty action as $\phi$. Our implementation of the code mutation stage, using the Z3 solver~\cite{deMouraBjorner2008}, is publicly available (see Footnote~\ref{footnote.githubrepo}) \textbf{Constraint $(\Delta_1)$: \ensuremath{\textsc{ActionEdits}}.} \ensuremath{\textsc{ActionEdits}}~returns the values that all action sequences can take, based on their values in the reference code, $\text{\textcode{C}}^\textnormal{in}$. Consider the action sequence $\textoverline{\textcode{A}}$ in sketch $\text{\textcode{Q}}$. The function $\ensuremath{\omega}(\textoverline{\textcode{A}}|~\text{\textcode{C}}^\textnormal{in})$ returns the value of \textoverline{\textcode{A}}~in $\text{\textcode{C}}^\textnormal{in}$. The types of constraints returned by \ensuremath{\textsc{ActionEdits}}~are: \begin{enumerate} \item Local \textoverline{\textcode{A}}~constraints. These constraints describe the values that one \textoverline{\textcode{A}}~can take w.r.t. $\ensuremath{\omega}(\textoverline{\textcode{A}}|~\text{\textcode{C}}^\textnormal{in})$. It has the following rules: \begin{itemize} \item \textsf{move}\xspace~action $\in \ensuremath{\omega}(\textoverline{\textcode{A}}|~\text{\textcode{C}}^\textnormal{in})$, would imply that the corresponding action in \textoverline{\textcode{A}}~must be \textsf{move}\xspace. \item Set of $\text{\textcode{turnLeft}}$, $\text{\textcode{turnRight}}$~actions $\in \ensuremath{\omega}(\textoverline{\textcode{A}}|~\text{\textcode{C}}^\textnormal{in})$, would imply that the corresponding actions in \textoverline{\textcode{A}}~will either have all the `turn' actions changed to $\text{\textcode{turnLeft}}$, or to $\text{\textcode{turnRight}}$, or remain the same, or be flipped, i.e. $\text{\textcode{turnLeft}} \rightarrow \text{\textcode{turnRight}}$~and $\text{\textcode{turnRight}} \rightarrow \text{\textcode{turnLeft}}$. \item Set of $\text{\textcode{pickMarker}}$, $\text{\textcode{putMarker}}$~actions $\in \ensuremath{\omega}(\textoverline{\textcode{A}}|~\text{\textcode{C}}^\textnormal{in})$, would imply that the corresponding actions in \textoverline{\textcode{A}}~will either have all the `marker' actions changed to $\text{\textcode{pickMarker}}$, or to $\text{\textcode{putMarker}}$, or remain the same, or be flipped i.e. $\text{\textcode{pickMarker}} \rightarrow \text{\textcode{putMarker}}$~and $\text{\textcode{putMarker}} \rightarrow \text{\textcode{pickMarker}}$. \item Additional actions (up to $\delta_{\textnormal{size}}$) to \textoverline{\textcode{A}}~can either be appended before the existing actions (in $\ensuremath{\omega}(\textoverline{\textcode{A}}|~\text{\textcode{C}}^\textnormal{in})$) or after, but not both. In our experiments we set $\delta_{\textnormal{size}} = 2$. \end{itemize} \looseness-1These constraints are listed under ``Local \textoverline{\textcode{A}}~constraints'' in \figref{fig:appendix.mutation.hoc.7} and \figref{fig:appendix.mutation.karel.7}. \item Global \textoverline{\textcode{A}}~constraints. These constraints apply on all the \textoverline{\textcode{A}}'s in sketch \textcode{Q}. They allow only one of all the \textoverline{\textcode{A}}'s to have additional actions added to them. These constraints are listed under ``Global \textoverline{\textcode{A}}~constraints'' in \figref{fig:appendix.mutation.hoc.7} and \figref{fig:appendix.mutation.karel.7}. \end{enumerate} \textbf{Constraint $(\Delta_{6})$: Action sequence is minimal.} These constraints describe the sequences that invalidate minimality of code. The constraints ensure that certain sequences of actions do not occur in \textoverline{\textcode{A}}. The detailed list of sequences for the two example codes described, which invalidate \textoverline{\textcode{A}}~if they occur, are given in \figref{fig:appendix.mutation.hoc.8} and \figref{fig:appendix.mutation.karel.8}. \vspace{-1.5mm} \subsection{Details of Code Mutation for HOC} \vspace{-1mm} Here, we build on the generic DSL presented in \figref{fig:mutation} for \textnormal{HOC}~codes. We describe the \textnormal{HOC}-DSL, Sketch DSL, and constraints for \textnormal{HOC}~codes (shown in \figref{fig:appendix.mutation.hoc.1}, \figref{fig:appendix.mutation.hoc.2}, and \figref{fig:appendix.mutation.hoc.3}, respectively). It is to be noted that the \textnormal{HOC}~DSL does not contain `marker' based actions/conditionals: (action) \textcode{pickMarker}, (action) \textcode{putMarker}, (conditional) \textcode{marker}, (conditional) \textcode{noMarker}. It does not allow few more conditionals: \textcode{noPathA}, \textcode{noPathL}~and \textcode{noPathR}. It also does not contain the \textsf{while}\xspace~construct. We consider a concrete example (continued from the example presented in \figref{fig:mutation.4}), in \figref{fig:appendix.mutation.hoc.4}, illustrate its sketch in \figref{fig:appendix.mutation.hoc.5}, and its constraints in \figref{fig:appendix.mutation.hoc.6}. We elaborate its \textoverline{\textcode{A}}~minimality constraints and \ensuremath{\textsc{ActionEdits}}~in \figref{fig:appendix.mutation.hoc.8} and \figref{fig:appendix.mutation.hoc.7}, respectively. \textbf{A brief description of elimination sequences to ensure \textoverline{\textcode{A}}-minimality.} We identify four sequences in \textnormal{HOC}~codes, which must be removed to ensure code minimality. These are: \textcode{turnLeft}, \textcode{turnRight}~or \textcode{turnRight}, \textcode{turnLeft}, which do not lead to any change in the output; \textcode{turnLeft}, \textcode{turnLeft}, \textcode{turnLeft}, which can be replaced by a single \textcode{turnRight}; and finally \textcode{turnRight}, \textcode{turnRight}, \textcode{turnRight}, which can be replaced by a single \textcode{turnLeft}. It is to be noted that we also eliminate variants of the above sequences, that contain $\phi$, but effectively reduce to these four sequences only, given that $\phi$ denotes an empty action. \vspace{-1.5mm} \subsection{Details of Code Mutation for Karel} \vspace{-1mm} Here, we present a modified/detailed form of \figref{fig:mutation} for \textnormal{Karel}~codes in particular. We describe the \textnormal{Karel}-DSL, Sketch DSL, and constraints for \textnormal{Karel}~codes (shown in \figref{fig:appendix.mutation.karel.1}, \figref{fig:appendix.mutation.karel.2}, and \figref{fig:appendix.mutation.karel.3}, respectively). It is to be noted that \textnormal{Karel}-DSL does not contain the \textsf{repeatUntilGoal}\xspace~construct. We consider a concrete example (same as the \textnormal{Karel}~solution code presented in \figref{fig:intro.karel.p0}), in \figref{fig:appendix.mutation.karel.4}, illustrate its sketch in \figref{fig:appendix.mutation.karel.5}, and its constraints in \figref{fig:appendix.mutation.karel.6}. We elaborate its \textoverline{\textcode{A}}~minimality constraints and \ensuremath{\textsc{ActionEdits}}~in \figref{fig:appendix.mutation.karel.8} and \figref{fig:appendix.mutation.karel.7}, respectively. \textbf{A brief description of elimination sequences to ensure \textoverline{\textcode{A}}-minimality.} In addition to the four sequences considered in \textnormal{HOC}~codes, we identify sixteen more sequences in \textnormal{Karel}~codes, which must be removed to ensure code minimality. These are: \textcode{pickMarker}, \textcode{putMarker}~or \textcode{putMarker}, \textcode{pickMarker}~or \textcode{pickMarker}, \textcode{pickMarker}~or \textcode{putMarker}, \textcode{putMarker}, which do not lead to any change in the output or leads to a crash in the \textnormal{Karel}~grid (only one marker is allowed per grid-cell); \textcode{turnLeft}, \textcode{pickMarker}, \textcode{turnRight}~or \textcode{turnRight}, \textcode{pickMarker}, \textcode{turnLeft}~or \textcode{turnLeft}, \textcode{putMarker}, \textcode{turnRight}~or \textcode{turnRight}, \textcode{putMarker}, \textcode{turnLeft}, which bring about the same output without the `turn' actions; \textcode{pickMarker}, \textcode{turnLeft}, \textcode{putMarker}~or \textcode{putMarker}, \textcode{turnLeft}, \textcode{pickMarker}~or \textcode{pickMarker}, \textcode{turnRight}, \textcode{putMarker}~or \textcode{putMarker}, \textcode{turnRight}, \textcode{pickMarker}, which bring about the same output without the `marker' actions; and finally \textcode{pickMarker}, \textcode{turnLeft}, \textcode{pickMarker}~or \textcode{pickMarker}, \textcode{turnRight}, \textcode{pickMarker}~or \textcode{putMarker}, \textcode{turnLeft}, \textcode{putMarker}~or \textcode{putMarker}, \textcode{turnRight}, \textcode{putMarker}, which leads to a crash in the \textnormal{Karel}~grid (only one marker is allowed per grid-cell). It is to be noted that we also eliminate variants of the above sequences, that contain $\phi$, but effectively reduce to these basic sequences only, given that $\phi$ denotes an empty action. \begin{figure}[h!] \centering \begin{minipage}{1\textwidth} \begin{minipage}{0.465\textwidth} \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode2col}{1.2cm}{6.7cm}{0.75}{1.08} \textnormal{code } \text{\textcode{C}} &:= \textcode{def }\textcode{\textsc{Run}}() \textcode{\textsc{do}} y \\ \textnormal{rule } \textcode{y} &:= \textcode{s} | \textcode{g} | \textcode{s}; \textcode{g} \\ \textnormal{rule } \textcode{s} \hspace{1mm} &:= \textcode{a} | $\text{\textcode{s}};\text{\textcode{s}}$ | \textsf{If}\xspace(\textcode{b}) \textcode{\textsc{do}} $\text{\textcode{s}}$ | \textsf{If}\xspace(\textcode{b}) \textcode{\textsc{do}} $\text{\textcode{s}}$ \textcode{\textsc{Else}} $\text{\textcode{s}}$\\ & \quad | \textsf{repeat}\xspace(\textcode{x}) \textcode{\textsc{do}} $\text{\textcode{s}}$ \\ \textnormal{rule } \textcode{g} &:= \textsf{repeatUntilGoal}\xspace(\textcode{goal}) \textcode{\textsc{do}} $\text{\textcode{s}}$\\ \textnormal{action } \textcode{a} &:= \textsf{move}\xspace| \textsf{turnL}\xspace | \textcode{turnR} \\ \textnormal{bool } \textcode{b} &:= \textcode{pathA} | \textcode{pathL} | \textcode{pathR} \\ \textnormal{iter } \textcode{x} &:= $2$ | $3$ | $4$ | $5$ | $6$ | $7$ | $8$ | $9$ | $10$\\ \end{boxcode2col} \vspace{-3mm} \caption{Code DSL -- \textnormal{HOC}} \label{fig:appendix.mutation.hoc.1} } \end{subfigure} \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode2col}{1.2cm}{6.7cm}{0.75}{1.08} \textnormal{sketch } \textcode{Q} &:= \textcode{def }\textcode{\textsc{Run}}() \textcode{\textsc{do}} $\text{\textcode{Y}}$ \\ \textnormal{rule } \textcode{Y} & := \textcode{S} | \textcode{G} | \textcode{S}; \textcode{G} \\ \textnormal{rule } \textcode{S} &:= \textcode{A} | \textcode{S}; \textcode{S} | \textsf{If}\xspace(\textcode{B}) \textcode{\textsc{do}} $\text{\textcode{S}}$ | \textsf{If}\xspace(\textcode{B}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \textcode{\textsc{Else}} $\text{\textcode{S}}$ \\ & \quad | \textsf{repeat}\xspace(\textcode{X}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \\ \textnormal{rule } \textcode{G} & := \textsf{repeatUntilGoal}\xspace(\textcode{goal}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \\ \textcolor{blue}{Comments} & \textcolor{blue}{:\ \textcode{A} may be $\phi$ or take values of action \textcode{a}}\\ & \textcolor{blue}{\ \ \textoverline{\textcode{A}}~denotes a sequence $\text{\textcode{A}}_{1}, \ldots, \text{\textcode{A}}_{n}$}\\ \end{boxcode2col} \vspace{-3mm} \caption{Sketch DSL -- \textnormal{HOC}} \label{fig:appendix.mutation.hoc.2} } \end{subfigure} \end{minipage} \begin{minipage}{0.55\textwidth} \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode}{9.6cm}{0.75}{1.0} \textbf{Input}: code \text{\textcode{C}}, sketch \textcode{Q} $\leftarrow$ $\ensuremath{\Omega}(\text{\textcode{C}})$, map $\ensuremath{\omega}(\cdot|~\text{\textcode{C}})$, $\delta_\text{size}$, $\delta_\text{iter}$ \begin{enumerate \item[(\ensuremath{\Delta_{0}})] Size of generated code may be at most $\text{\textcode{C}}_{\textnormal{size}} + \delta_\text{size}$ % \item[(\ensuremath{\Delta_1})] Edit action sequences $\ensuremath{\textsc{ActionEdits}}(\{\textoverline{\textcode{A}} \in \text{\textcode{Q}}\}, \ensuremath{\omega}(\cdot|~\text{\textcode{C}}))$ % % \item[(\ensuremath{\Delta_{2}})] For each \textcode{X}~$ \in \text{\textcode{Q}}: |\text{\textcode{X}} - \ensuremath{\omega}(\text{\textcode{X}}|~\text{\textcode{C}})| \leq \delta_{\textnormal{iter}}$ % \item[(\ensuremath{\Delta_{3}})] Constraints induced by structure \{\text{\textoverline{\textcode{A}}}\textsubscript{before}; \textsf{repeat}\xspace\{\textoverline{\textcode{A}}\}; \text{\textoverline{\textcode{A}}}\textsubscript{after}\} \begin{enumerate}[\leftmargin=0em] \item[i.] \textoverline{\textcode{A}}~is not a suffix of \textoverline{\textcode{A}}\textsubscript{before} \item[ii.] \textoverline{\textcode{A}}~is not a prefix of \textoverline{\textcode{A}}\textsubscript{after} \end{enumerate} % \item[(\ensuremath{\Delta_{4}})] For each \textcode{B}~$\in \text{\textcode{Q}}:$ \begin{enumerate}[\leftmargin=0em] \item[i.] \ensuremath{\omega}(\text{\textcode{B}}~|~\text{\textcode{C}}) $\in$ \{\textcode{pathA} \} \item[] \qquad $\Rightarrow$ \textcode{B} $\in$ \{\textcode{pathA} \} \item[ii.] \ensuremath{\omega}(\text{\textcode{B}}~|~\text{\textcode{C}}) $\in$ \{\textcode{pathL}, \text{\textcode{pathR} } \} \item[] \quad \quad $\Rightarrow$ \textcode{B} $\in$ \{\textcode{pathL}, \textcode{pathR} \} \end{enumerate} % \item[(\ensuremath{\Delta_{5}})] Constraints induced on \textoverline{\textcode{A}}~nested inside conditional \textcode{B} % \item[(\ensuremath{\Delta_{6}})] For each $\text{\textoverline{\textcode{A}}} \in \text{\textcode{Q}}$, constraints ensuring minimality of \textoverline{\textcode{A}} \vspace{-0.3em} \end{enumerate} \\ \end{boxcode} \vspace{-3mm} \caption{Types of Sketch Constraints -- \textnormal{HOC}} \label{fig:appendix.mutation.hoc.3} } \end{subfigure} \end{minipage} \end{minipage} \centering \begin{subfigure}[b]{0.215\textwidth} \centering { \begin{boxcode}{3.68cm}{0.75}{1.0} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathLeft}\textcode{)\{}\\ \quad \quad \quad \textcode{turnLeft}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \\ \\ \vspace{2mm} \end{boxcode} \vspace{-3mm} \caption{Code \text{\textcode{C}}\textsuperscript{in}} \label{fig:appendix.mutation.hoc.4} } \end{subfigure} \begin{subfigure}[b]{.24\textwidth} \centering { \begin{boxcode}{4.05cm}{0.75}{1.0} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad $\text{\textcode{A}}^{1}_{1}$, $\text{\textcode{A}}^{2}_{1}$ \textcolor{blue}{(\textcolor{blue}{\textoverline{\textcode{A}}}\textsubscript{1})}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad $\text{\textcode{A}}^{1}_{2}$, $\text{\textcode{A}}^{2}_{2}$, $\text{\textcode{A}}^{3}_{2}$, $\text{\textcode{A}}^{4}_{2}$, $\text{\textcode{A}}^{5}_{2}$ \textcolor{blue}{(\textcolor{blue}{\textoverline{\textcode{A}}}\textsubscript{2})}\\ \quad \quad \textsf{If}\xspace\textcode{(}$\text{\textcode{B}}_{1}$\textcode{)\{}\\ \quad \quad \quad $\text{\textcode{A}}^{1}_{3}$, $\text{\textcode{A}}^{2}_{3}$, $\text{\textcode{A}}^{3}_{3}$, $\text{\textcode{A}}^{4}_{3}$, $\text{\textcode{A}}^{5}_{3}$ \textcolor{blue}{(\textcolor{blue}{\textoverline{\textcode{A}}}\textsubscript{3})} \\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \\ \vspace{1.75mm} \end{boxcode} \vspace{-3mm} \caption{Sketch $\text{\text{\textcode{Q}}}^\text{in}$} \label{fig:appendix.mutation.hoc.5} } \end{subfigure} \begin{subfigure}[b]{0.53\textwidth} \centering { \begin{boxcode}{9.6cm}{0.75}{1.0} \textbf{Input}: \text{\textcode{C}}\textsuperscript{in}, $\text{\text{\textcode{Q}}}^\text{in}$, \ensuremath{\omega}$(\cdot|~\text{\text{\textcode{C}}}^\text{in}$), $\delta_\text{size} = 2$ \begin{enumerate} % \item[(\ensuremath{\Delta_0})] Up to $2$ new actions may be added in total to $\text{\textoverline{\textcode{A}}}_{1}$, $\textoverline{\textcode{A}}_{2}$, $\textoverline{\textcode{A}}_{3}$ \item[(\ensuremath{\Delta_1})] Edit action sequences $\ensuremath{\textsc{ActionEdits}}(\{\textoverline{\textcode{A}}_{1}, \textoverline{\textcode{A}}_{2}, \textoverline{\textcode{A}}_{3}\}, \ensuremath{\omega}(\cdot|~\text{\textcode{C}}^\text{in}))$ % \item[(\ensuremath{\Delta_4})] $\text{\textcode{B}}_{1}$ = \textcode{pathL} $\lor$ $\text{\textcode{B}}_{1}$ = \textcode{pathR} % \item[(\ensuremath{\Delta_5})] $(\text{\textcode{B}}_{1} = \text{\textcode{pathL}}) \Rightarrow$ \item[] \quad $\Big{(}\exists i \in [5]$ s.t $\big(\text{\textcode{A}}^{i}_{3} = \text{\textsf{turnL}\xspace} \ \ \land$ $(\text{ } \forall j < i \text{, } \text{\textcode{A}}^{j}_{3} \notin \{\text{\textsf{move}\xspace}, \text{\textcode{turnR}} \})\big) \Big{)}$ % \item[(\ensuremath{\Delta_5})] $(\text{\textcode{B}}_{1} = \text{\textcode{pathR}}) \Rightarrow$ \item[] \quad $\Big{(} \exists i \in [5]$ s.t $\big(\text{\textcode{A}}^{i}_{3} = \text{\textcode{turnR}} \ \ \land$ $(\text{ } \forall j<i \text{, }\text{\textcode{A}}^{j}_{3} \notin \{\text{\textsf{move}\xspace}, \text{\textsf{turnL}\xspace} \})\big) \Big{)}$ % % \item[(\ensuremath{\Delta_6})] $\text{\textoverline{\textcode{A}}}_{1}$, $\textoverline{\textcode{A}}_{2}$, $\textoverline{\textcode{A}}_{3}$ are minimal % \vspace{-3mm} \end{enumerate} \end{boxcode} \vspace{-3mm} \caption{$\text{\text{\textcode{Q}}}^\text{in}$-Constraints for \textnormal{HOC}} \label{fig:appendix.mutation.hoc.6} } \end{subfigure} \begin{subfigure}[b]{1\textwidth} \centering { \begin{boxcode}{18.5cm}{0.75}{1.0} Set of elimination sequences $\mathcal{E} := \{(\text{\textcode{L}},\text{\textcode{R}}), (\text{\textcode{R}},\text{\textcode{L}}), (\text{\textcode{L}}, \text{\textcode{L}}, \text{\textcode{L}}), (\text{\textcode{R}}, \text{\textcode{R}}, \text{\textcode{R}})\}$ \begin{enumerate}[(i)] \item Apply each elimination sequence from $\mathcal{E}$ to $\textoverline{\textcode{A}}_{1}$ as a set of constraints. \item Apply each elimination sequence from $\mathcal{E}$ to $\textoverline{\textcode{A}}_{2}$ as a set of constraints. \item Apply each elimination sequence from $\mathcal{E}$ to $\textoverline{\textcode{A}}_{3}$ as a set of constraints. \end{enumerate} \vspace{-2mm} \end{boxcode} \vspace{-3mm} \caption{$\text{\text{\textcode{Q}}}^\text{in}$-Constraints: $(\Delta_{6})~\text{ \textoverline{\textcode{A}}}_{1}$, $\textoverline{\textcode{A}}_{2}$, $\textoverline{\textcode{A}}_{3}$ are minimal} \label{fig:appendix.mutation.hoc.8} } \end{subfigure} \begin{subfigure}[b]{1\textwidth} \centering { \begin{boxcode}{18.5cm}{0.75}{1.0} \textcolor{blue}{Shorthand notation for actions: $\text{\textsf{move}\xspace} \rightarrow \text{\textcode{M}}$, $\text{\textsf{turnL}\xspace} \rightarrow \text{\textcode{L}}$, $\text{\textcode{turnR}} \rightarrow \text{\textcode{R}}$, $\phi \rightarrow \text{empty-action}$.} \vspace{2mm} \\ Local \textoverline{\textcode{A}}~constraints that define the values that each action sequence can take: \begin{enumerate}[(i)] \item $(\ha{1}{1} =\text{\textcode{M}} \vee \ha{1}{1} = \text{\textcode{L}} \vee \ha{1}{1} = \text{\textcode{R}} \vee \ha{1}{1} = \phi) \wedge $ $(\ha{1}{2} =\text{\textcode{M}} \vee \ha{1}{2} = \text{\textcode{L}} \vee \ha{1}{2} = \text{\textcode{R}} \vee \ha{1}{2} = \phi) $ \item $(\ha{2}{1} =\text{\textcode{M}} \vee \ha{2}{1} = \text{\textcode{L}} \vee \ha{2}{1} = \text{\textcode{R}} \vee \ha{2}{1} = \phi) \wedge $ $(\ha{2}{2} =\text{\textcode{M}} \vee \ha{2}{2} = \text{\textcode{L}} \vee \ha{2}{2} = \text{\textcode{R}} \vee \ha{2}{2} = \phi) $ $(\ha{2}{3} =\text{\textcode{M}}) \wedge $ $(\ha{2}{4} =\text{\textcode{M}} \vee \ha{2}{4} = \text{\textcode{L}} \vee \ha{2}{4} = \text{\textcode{R}} \vee \ha{2}{4} = \phi) \wedge $ $(\ha{2}{5} =\text{\textcode{M}} \vee \ha{2}{5} = \text{\textcode{L}} \vee \ha{2}{5} = \text{\textcode{R}} \vee \ha{2}{5} = \phi) $ \item $(\ha{2}{1} \neq \phi \vee \ha{2}{2} \neq \phi) \Rightarrow (\ha{2}{4} = \phi \wedge \ha{2}{5} = \phi)$ \item $(\ha{2}{4} \neq \phi \vee \ha{2}{5} \neq \phi) \Rightarrow (\ha{2}{1} = \phi \wedge \ha{2}{2} = \phi)$ \item $(\ha{3}{1} =\text{\textcode{M}} \vee \ha{3}{1} = \text{\textcode{L}} \vee \ha{3}{1} = \text{\textcode{R}} \vee \ha{3}{1} = \phi) \wedge $ $(\ha{3}{2} =\text{\textcode{M}} \vee \ha{3}{2} = \text{\textcode{L}} \vee \ha{3}{2} = \text{\textcode{R}} \vee \ha{3}{2} = \phi) \wedge $ $(\ha{3}{3} = \text{\textcode{L}} \vee \ha{3}{3} = \text{\textcode{R}}) \wedge $ \item[] $(\ha{3}{4} =\text{\textcode{M}} \vee \ha{3}{4} = \text{\textcode{L}} \vee \ha{3}{4} = \text{\textcode{R}} \vee \ha{3}{4} = \phi) \wedge $ $(\ha{3}{5} =\text{\textcode{M}} \vee \ha{3}{5} = \text{\textcode{L}} \vee \ha{3}{5} = \text{\textcode{R}} \vee \ha{3}{5} = \phi) $ \item $(\ha{3}{1} \neq \phi \vee \ha{3}{2} \neq \phi) \Rightarrow (\ha{3}{4} = \phi \wedge \ha{3}{4} = \phi)$ \item $(\ha{3}{4} \neq \phi \vee \ha{3}{5} \neq \phi) \Rightarrow (\ha{3}{1} = \phi \wedge \ha{3}{2} = \phi)$ \end{enumerate} \vspace{2mm} Global \textoverline{\textcode{A}}~constraints that allow actions to be added to either of $\textoverline{\textcode{A}}_{1}, \textoverline{\textcode{A}}_{2}, \textoverline{\textcode{A}}_{3}$: \begin{enumerate}[(i)] \item $(\ha{1}{1} \neq \phi \vee \ha{1}{2} \neq \phi) \Rightarrow (\ha{2}{1} = \phi \wedge \ha{2}{2} = \phi \wedge \ha{2}{4} = \phi \wedge \ha{2}{5} = \phi \wedge$ $\ha{3}{1} = \phi \wedge \ha{3}{2} = \phi \wedge \ha{3}{4} = \phi \wedge \ha{3}{5} = \phi)$ \item $(\ha{2}{1} \neq \phi \vee \ha{2}{2} \neq \phi) \Rightarrow (\ha{1}{1} = \phi \wedge \ha{1}{2} = \phi \wedge$ $\ha{3}{1} = \phi \wedge \ha{3}{2} = \phi \wedge \ha{3}{4} = \phi \wedge \ha{3}{5} = \phi)$ \item[] $(\ha{2}{4} \neq \phi \vee \ha{2}{5} \neq \phi) \Rightarrow (\ha{1}{1} = \phi \wedge \ha{1}{2} = \phi \wedge$ $\ha{3}{1} = \phi \wedge \ha{3}{2} = \phi \wedge \ha{3}{4} = \phi \wedge \ha{3}{5} = \phi)$ \item $(\ha{3}{1} \neq \phi \vee \ha{3}{2} \neq \phi) \Rightarrow (\ha{1}{1} = \phi \wedge \ha{1}{2} = \phi \wedge \ha{2}{1} = \phi \wedge \ha{2}{1} = \phi \wedge$ $\ha{2}{4} = \phi \wedge \ha{2}{5} = \phi \wedge )$ \item[]$(\ha{3}{4} \neq \phi \vee \ha{3}{5} \neq \phi) \Rightarrow (\ha{1}{1} = \phi \wedge \ha{1}{2} = \phi \wedge \ha{2}{1} = \phi \wedge \ha{2}{2} = \phi \wedge$ $\ha{2}{4} = \phi \wedge \ha{2}{5} = \phi)$ \end{enumerate} \end{boxcode} \vspace{-3mm} \caption{$\text{\text{\textcode{Q}}}^\text{in}$-Constraints: ~$(\Delta_{1})~\ensuremath{\textsc{ActionEdits}}(\{\textoverline{\textcode{A}}_{1}, \textoverline{\textcode{A}}_{2}, \textoverline{\textcode{A}}_{3}\}, \ensuremath{\omega}(\cdot|~\text{\textcode{C}}^\text{in}))$} \label{fig:appendix.mutation.hoc.7} } \end{subfigure} \caption{Illustration of Code Mutation for \textnormal{HOC}~on the solution code for task \emph{Maze 16} from the \emph{Hour of Code: Classic Maze} challenge by \emph{Code.org}~\cite{hourofcode_maze}; We build on \figref{fig:mutation} here. } \label{fig:appendix.mutation.hoc} \vspace{-5mm} \end{figure} \begin{figure}[h!] \centering \begin{minipage}{1\textwidth} \begin{minipage}{0.465\textwidth} \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode2col}{1.2cm}{6.7cm}{0.75}{1.15} \textnormal{code } \text{\textcode{C}} &:= \textcode{def }\textcode{\textsc{Run}}() \textcode{\textsc{do}}~\textcode{s} \\ \textnormal{rule } \textcode{s} \hspace{1mm} &:= \textcode{a} | $\text{\textcode{s}};\text{\textcode{s}}$ | \textsf{If}\xspace(\textcode{b}) \textcode{\textsc{do}} $\text{\textcode{s}}$ | \textsf{If}\xspace(\textcode{b}) \textcode{\textsc{do}} $\text{\textcode{s}}$ \textcode{\textsc{Else}} $\text{\textcode{s}}$\\ & \quad | \textsf{while}\xspace (\textcode{b}) \textcode{\textsc{do}} $\text{\textcode{s}}$ | \textsf{repeat}\xspace(\textcode{x}) \textcode{\textsc{do}} $\text{\textcode{s}}$ \\ \textnormal{action } \textcode{a} &:= \textsf{move}\xspace| \textsf{turnL}\xspace | \textcode{turnR}| \textsf{put}\xspace | \textsf{pick}\xspace \\ \textnormal{bool } \textcode{b} &:= \textcode{pathA} | \textcode{noPathA} | \textcode{pathL} | \textcode{noPathL} \\ & \quad | \textcode{pathR} | \textcode{noPathR} | \textcode{marker} | \textcode{noMarker} \\ \textnormal{iter } \textcode{x} &:= $2$ | $3$ | $4$ | $5$ | $6$ | $7$ | $8$ | $9$ | $10$\\ \end{boxcode2col} \vspace{-3mm} \caption{Code DSL -- Karel} \label{fig:appendix.mutation.karel.1} } \end{subfigure} \\ \\ \\ \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode2col}{1.2cm}{6.7cm}{0.75}{1.15} \textnormal{sketch } \textcode{Q} &:= \textcode{def }\textcode{\textsc{Run}}() \textcode{\textsc{do}} $\text{\textcode{Y}}$ \\ \textnormal{rule } \textcode{Y} & := \textcode{S} \\ \textnormal{rule } \textcode{S} &:= \textcode{A} | \textcode{S}; \textcode{S} | \textsf{If}\xspace(\textcode{B}) \textcode{\textsc{do}} $\text{\textcode{S}}$ | \textsf{If}\xspace(\textcode{B}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \textcode{\textsc{Else}} $\text{\textcode{S}}$ \\ & \quad | \textsf{while}\xspace(\textcode{B}) \textcode{\textsc{do}} $\text{\textcode{S}}$ | \textsf{repeat}\xspace(\textcode{X}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \\ \textcolor{blue}{Comments} & \textcolor{blue}{:\ \textcode{A} may be $\phi$ or take values of action \textcode{a}}\\ & \textcolor{blue}{\ \ \textoverline{\textcode{A}}~denotes a sequence $\text{\textcode{A}}_{1}, \ldots, \text{\textcode{A}}_{n}$}\\ \end{boxcode2col} \vspace{-3mm} \caption{Sketch DSL -- Karel} \label{fig:appendix.mutation.karel.2} } \end{subfigure} \end{minipage} \begin{minipage}{0.55\textwidth} \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode}{9.6cm}{0.75}{1.0} \textbf{Input}: code \text{\textcode{C}}, sketch \textcode{Q} $\leftarrow$ $\ensuremath{\Omega}(\text{\textcode{C}})$, map $\ensuremath{\omega}(\cdot|~\text{\textcode{C}})$, $\delta_\text{size}$, $\delta_\text{iter}$ \begin{enumerate \item[(\ensuremath{\Delta_{0}})] Size of generated code may be at most $\text{\textcode{C}}_{\textnormal{size}} + \delta_\text{size}$ % \item[(\ensuremath{\Delta_1})] Edit action sequences $\ensuremath{\textsc{ActionEdits}}(\{\textoverline{\textcode{A}} \in \text{\textcode{Q}}\}, \ensuremath{\omega}(\cdot|~\text{\textcode{C}}))$ % % \item[(\ensuremath{\Delta_{2}})] For each \textcode{X}~$ \in \text{\textcode{Q}}: |\text{\textcode{X}} - \ensuremath{\omega}(\text{\textcode{X}}|~\text{\textcode{C}})| \leq \delta_{\textnormal{iter}}$ % \item[(\ensuremath{\Delta_{3}})] Constraints induced by structure \{\text{\textoverline{\textcode{A}}}\textsubscript{before}; \textsf{repeat}\xspace\{\textoverline{\textcode{A}}\}; \text{\textoverline{\textcode{A}}}\textsubscript{after}\} \begin{enumerate}[\leftmargin=0em] \item[i.] \textoverline{\textcode{A}}~is not a suffix of \textoverline{\textcode{A}}\textsubscript{before} \item[ii.] \textoverline{\textcode{A}}~is not a prefix of \textoverline{\textcode{A}}\textsubscript{after} \end{enumerate} % \item[(\ensuremath{\Delta_{4}})] For each \textcode{B}~$\in \text{\textcode{Q}}:$ \begin{enumerate}[\leftmargin=0em] \item[i.] \ \ \ensuremath{\omega}(\text{\textcode{B}}~|~\text{\textcode{C}}) $\in$ \{\textcode{pathA}, \textcode{noPathA}\} \item[] \qquad \ $\Rightarrow$ \textcode{B} $\in$ \{\textcode{pathA}, \textcode{noPathA}\} \item[ii.] \ \ensuremath{\omega}(\text{\textcode{B}}~|~\text{\textcode{C}}) $\in$ \{\textcode{pathL}, \textcode{noPathL} \text{\textcode{pathR} }, \textcode{noPathR}\} \item[] \quad \quad \ $\Rightarrow$ \textcode{B} $\in$ \{\textcode{pathL}, \textcode{noPathL}, \textcode{pathR}, \textcode{noPathR}\} \item[iii.] \ensuremath{\omega}(\text{\textcode{B}}~|~\text{\textcode{C}}) $\in$ \{\textcode{marker}, \textcode{noMarker}\} \item[] \quad \quad \hspace{0.1em} $\Rightarrow$ \textcode{B} $\in$ \{ \textcode{marker},\textcode{noMarker}\} \end{enumerate} % \item[(\ensuremath{\Delta_{5}})] Constraints induced on \textoverline{\textcode{A}}~nested inside conditional \textcode{B} % \item[(\ensuremath{\Delta_{6}})] For each $\text{\textoverline{\textcode{A}}} \in \text{\textcode{Q}}$, constraints ensuring minimality of \textoverline{\textcode{A}} \vspace{-0.3em} \end{enumerate} \end{boxcode} \vspace{-3mm} \caption{Types of Sketch Constraints -- Karel} \label{fig:appendix.mutation.karel.3} } \end{subfigure} \end{minipage} \end{minipage} \centering \begin{subfigure}[b]{0.215\textwidth} \centering { \begin{boxcode}{3.68cm}{0.75}{1.0} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textcode{putMarker}\\ \quad \textsf{while}\xspace\textcode{(}\textcode{pathAhead}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnLeft}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{putMarker}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \\ \vspace{2.5mm} \end{boxcode} \vspace{-3mm} \caption{Code \text{\textcode{C}}\textsuperscript{in}} \label{fig:appendix.mutation.karel.4} } \end{subfigure} \begin{subfigure}[b]{.24\textwidth} \centering { \begin{boxcode}{4.05cm}{0.75}{1.0} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad $\text{\textcode{A}}^{1}_{1}$, $\text{\textcode{A}}^{2}_{1}$, $\text{\textcode{A}}^{3}_{1}$, $\text{\textcode{A}}^{4}_{1}$, $\text{\textcode{A}}^{5}_{1}$, \textcolor{blue}{(\textcolor{blue}{\textoverline{\textcode{A}}}\textsubscript{1})}\\ \quad \textsf{while}\xspace\textcode{(}$\text{\textcode{B}}_{1}$\textcode{)\{}\\ \quad \quad $\text{\textcode{A}}^{1}_{2}$, $\text{\textcode{A}}^{2}_{2}$,\\ \quad \quad $\text{\textcode{A}}^{3}_{2}$, $\text{\textcode{A}}^{4}_{2}$, $\text{\textcode{A}}^{5}_{2}$,\\ \quad \quad $\text{\textcode{A}}^{6}_{2}$, $\text{\textcode{A}}^{7}_{2}$, $\text{\textcode{A}}^{8}_{2}$, \quad \quad \textcolor{blue}{(\textcolor{blue}{\textoverline{\textcode{A}}}\textsubscript{2})} \\ \quad \quad $\text{\textcode{A}}^{9}_{2}$, $\text{\textcode{A}}^{10}_{2}$, $\text{\textcode{A}}^{11}_{2}$,\\ \quad \quad $\text{\textcode{A}}^{12}_{2}$, $\text{\textcode{A}}^{13}_{2}$ \\ \quad \textcode{\}}\\ \quad $\text{\textcode{A}}^{1}_{3}$, $\text{\textcode{A}}^{2}_{3}$ \textcolor{blue}{(\textcolor{blue}{\textoverline{\textcode{A}}}\textsubscript{3})}\\ \textcode{\}} \\ \vspace{1.5mm} \end{boxcode} \vspace{-3mm} \caption{Sketch $\text{\text{\textcode{Q}}}^\text{in}$} \label{fig:appendix.mutation.karel.5} } \end{subfigure} \begin{subfigure}[b]{0.53\textwidth} \centering { \begin{boxcode}{9.9cm}{0.75}{1.0} \textbf{Input}: \text{\textcode{C}}\textsuperscript{in}, $\text{\text{\textcode{Q}}}^\text{in}$, \ensuremath{\omega}$(\cdot|~\text{\text{\textcode{C}}}^\text{in}$), $\delta_\text{size} = 2$ \begin{enumerate} % \item[(\ensuremath{\Delta_0})] Up to $2$ new actions may be added in total to $\text{\textoverline{\textcode{A}}}_{1}$, $\textoverline{\textcode{A}}_{2}$, $\textoverline{\textcode{A}}_{3}$ \item[(\ensuremath{\Delta_1})] Edit action sequences $\ensuremath{\textsc{ActionEdits}}(\{\textoverline{\textcode{A}}_{1}, \textoverline{\textcode{A}}_{2}, \textoverline{\textcode{A}}_{3}\}, \ensuremath{\omega}(\cdot|~\text{\textcode{C}}^\text{in}))$ % \item[(\ensuremath{\Delta_4})] $\text{\textcode{B}}_{1}$ = \textcode{pathA} $\lor$ $\text{\textcode{B}}_{1}$ = \textcode{noPathA} % \item[(\ensuremath{\Delta_5})] $(\text{\textcode{B}}_{1} = \text{\textcode{pathA}} ) \Rightarrow$ \item[] \quad $\Big{(} \exists i \in [13]$ s.t $\big(\text{\textcode{A}}^{i}_{2} = \text{\textsf{move}\xspace} \ \ \land$ $(\text{ } \forall j < i \text{, } \text{\textcode{A}}^{j}_{2} \notin \{\text{\textsf{turnL}\xspace}, \text{\textcode{turnR}} \})\big) \Big{)}$ % \item[(\ensuremath{\Delta_5})] $(\text{\textcode{B}}_{1} = \text{\textcode{noPathA}}) \Rightarrow $ \item[] \quad $\Big{(} \exists i \in [13]$ s.t $\big{(}\text{\textcode{A}}^{i}_{2} = \text{\textsf{move}\xspace}$ $\Rightarrow$ $(\text{ } \exists j<i \text{, }\text{\textcode{A}}^{j}_{2} \in \{\text{\textsf{turnL}\xspace}, \text{\textcode{turnR}} \}) \big{)} \Big{)}$ % % \item[(\ensuremath{\Delta_6})] $\text{\textoverline{\textcode{A}}}_{1}$, $\textoverline{\textcode{A}}_{2}$, $\textoverline{\textcode{A}}_{3}$ are minimal \vspace{-2.5mm} \end{enumerate} \end{boxcode} \vspace{-3mm} \caption{$\text{\text{\textcode{Q}}}^\text{in}$-Constraints for \textnormal{Karel}} \label{fig:appendix.mutation.karel.6} } \end{subfigure} \begin{subfigure}[b]{1\textwidth} \centering { \begin{boxcode}{18.5cm}{0.75}{1.0} Set of elimination sequences $\mathcal{E} := \{(\text{\textcode{L}},\text{\textcode{R}}), (\text{\textcode{R}},\text{\textcode{L}}), (\text{\textcode{L}}, \text{\textcode{L}}, \text{\textcode{L}}), (\text{\textcode{R}}, \text{\textcode{R}}, \text{\textcode{R}}), (\text{\textcode{piM}}, \text{\textcode{puM}}), (\text{\textcode{puM}}, \text{\textcode{piM}}), (\text{\textcode{piM}}, \text{\textcode{piM}}), (\text{\textcode{puM}}, \text{\textcode{puM}}), (\text{\textcode{L}}, \text{\textcode{piM}}, \text{\textcode{R}}),$ \\ \qquad \qquad \qquad \qquad \qquad \qquad \qquad $(\text{\textcode{R}}, \text{\textcode{piM}}, \text{\textcode{L}}), (\text{\textcode{L}}, \text{\textcode{puM}}, \text{\textcode{R}}), (\text{\textcode{R}},\text{\textcode{puM}}, \text{\textcode{L}}), (\text{\textcode{piM}}, \text{\textcode{L}}, \text{\textcode{puM}}), (\text{\textcode{puM}}, \text{\textcode{L}}, \text{\textcode{piM}}), (\text{\textcode{piM}}, \text{\textcode{R}}, \text{\textcode{puM}}), (\text{\textcode{puM}}, \text{\textcode{R}}, \text{\textcode{piM}}),$\\ \qquad \qquad \qquad \qquad \qquad \qquad \qquad $(\text{\textcode{piM}}, \text{\textcode{L}}, \text{\textcode{piM}}), (\text{\textcode{piM}}, \text{\textcode{R}}, \text{\textcode{piM}}), (\text{\textcode{puM}}, \text{\textcode{L}}, \text{\textcode{puM}}), (\text{\textcode{puM}}, \text{\textcode{R}}, \text{\textcode{puM}})\}$ \begin{enumerate}[(i)] \item Apply each elimination sequence from $\mathcal{E}$ to $\textoverline{\textcode{A}}_{1}$ as a set of constraints. \item Apply each elimination sequence from $\mathcal{E}$ to $\textoverline{\textcode{A}}_{2}$ as a set of constraints. \item Apply each elimination sequence from $\mathcal{E}$ to $\textoverline{\textcode{A}}_{3}$ as a set of constraints. \end{enumerate} \vspace{-2mm} \end{boxcode} \vspace{-3mm} \caption{$\text{\text{\textcode{Q}}}^\text{in}$-Constraints:~$(\Delta_{6})\text{ \textoverline{\textcode{A}}}_{1}$, $\textoverline{\textcode{A}}_{2}$, $\textoverline{\textcode{A}}_{3}$ are minimal} \label{fig:appendix.mutation.karel.8} } \end{subfigure} \caption{\textbf{(a)--(g)}: Illustration of Code Mutation for \textnormal{Karel}~task \emph{Diagonal} from the \emph{Intro to Programming with Karel} course by \emph{CodeHS.com}~\cite{intro_to_karel_codehs}; We present the \textnormal{Karel}~variant of \figref{fig:mutation} here. } \label{fig:appendix.mutation.karel} \vspace{-5mm} \end{figure} \begin{figure}[h!] \ContinuedFloat \begin{subfigure}[b]{1\textwidth} \centering { \begin{boxcode}{18.5cm}{0.75}{1.0} \textcolor{blue}{Shorthand notation for actions: $\text{\textsf{move}\xspace} \rightarrow \text{\textcode{M}}$, $\text{\textsf{turnL}\xspace} \rightarrow \text{\textcode{L}}$, $\text{\textcode{turnR}} \rightarrow \text{\textcode{R}}$, $\text{\textsf{pick}\xspace} \rightarrow \text{\textcode{piM}}$, $\text{\textsf{put}\xspace} \rightarrow \text{\textcode{puM}}$, $\phi \rightarrow \text{empty-action}$.} \\ \\ Local \textoverline{\textcode{A}}~constraints that define the values that each action sequence can take: \vspace{-0.5mm} \begin{enumerate}[(i)] \item \hspace{0.25em} $(\ha{1}{1} =\text{\textcode{M}} \vee \ha{1}{1} = \text{\textcode{L}} \vee \ha{1}{1} = \text{\textcode{R}} \vee \ha{1}{1} = \text{\textcode{piM}} \vee \ha{1}{1} = \text{\textcode{puM}} \vee \ha{1}{1} = \phi)$ \item[] $\wedge (\ha{1}{2} =\text{\textcode{M}} \vee \ha{1}{2} = \text{\textcode{L}} \vee \ha{1}{2} = \text{\textcode{R}} \vee \ha{1}{2} = \text{\textcode{piM}} \vee \ha{1}{2} = \text{\textcode{puM}} \vee \ha{1}{2} = \phi) $ \item[] $\wedge ( \ha{1}{3} =\text{\textcode{piM}} \vee \ha{1}{3} = \text{\textcode{puM}} )$ \item[] $\wedge(\ha{1}{4} =\text{\textcode{M}} \vee \ha{1}{4} = \text{\textcode{L}} \vee \ha{1}{4} = \text{\textcode{R}} \vee \ha{1}{4} = \text{\textcode{piM}} \vee \ha{1}{4} = \text{\textcode{puM}} \vee \ha{1}{4} = \phi)$ \item[] $\wedge (\ha{1}{5} =\text{\textcode{M}} \vee \ha{1}{5} = \text{\textcode{L}} \vee \ha{1}{5} = \text{\textcode{R}} \vee \ha{1}{5} = \text{\textcode{piM}} \vee \ha{1}{5} = \text{\textcode{puM}} \vee \ha{1}{5} = \phi)$ \item $\wedge (\ha{1}{1} \neq \phi \vee \ha{1}{2} \neq \phi) \Rightarrow (\ha{1}{4} = \phi \wedge \ha{1}{5} = \phi) \wedge$ \item[] $\wedge (\ha{1}{4} \neq \phi \vee \ha{1}{5} \neq \phi) \Rightarrow (\ha{1}{1} = \phi \wedge \ha{1}{2} = \phi)$ \item \hspace{0.25em} $(\ha{2}{1} =\text{\textcode{M}} \vee \ha{2}{1} = \text{\textcode{L}} \vee \ha{2}{1} = \text{\textcode{R}} \vee \ha{2}{1} = \text{\textcode{piM}} \vee \ha{2}{1} = \text{\textcode{puM}} \vee \ha{2}{1} = \phi) $ \item[] $\wedge(\ha{2}{2} =\text{\textcode{M}} \vee \ha{2}{2} = \text{\textcode{L}} \vee \ha{2}{2} = \text{\textcode{R}} \vee \ha{2}{2} = \text{\textcode{piM}} \vee \ha{2}{2} = \text{\textcode{puM}} \vee \ha{2}{2} = \phi)$ \item[] $\wedge (\ha{2}{3} = \text{\textcode{M}} )$ \item[] $\wedge (\ha{2}{4} =\text{\textcode{M}} \vee \ha{2}{4} = \text{\textcode{L}} \vee \ha{2}{4} = \text{\textcode{R}} \vee \ha{2}{4} = \text{\textcode{piM}} \vee \ha{2}{4} = \text{\textcode{puM}} \vee \ha{2}{4} = \phi)$ \item[] $\wedge \big{(}(\ha{2}{5} = \text{\textcode{L}} \wedge \ha{2}{9} = \text{\textcode{L}}) \vee (\ha{2}{5} = \text{\textcode{R}} \wedge \ha{2}{9} = \text{\textcode{R}}) \vee (\ha{2}{5} = \text{\textcode{L}} \wedge \ha{2}{9} = \text{\textcode{R}}) \vee (\ha{2}{5} = \text{\textcode{R}} \wedge \ha{2}{9} = \text{\textcode{L}}) \big{)}$ \item[] $\wedge (\ha{2}{6} =\text{\textcode{M}} \vee \ha{2}{6} = \text{\textcode{L}} \vee \ha{2}{6} = \text{\textcode{R}} \vee \ha{2}{6} = \text{\textcode{piM}} \vee \ha{2}{6} = \text{\textcode{puM}} \vee \ha{2}{6} = \phi)$ \item[] $\wedge (\ha{2}{7} = \text{\textcode{M}})$ \item[] $ \wedge (\ha{2}{8} =\text{\textcode{M}} \vee \ha{2}{8} = \text{\textcode{L}} \vee \ha{2}{8} = \text{\textcode{R}} \vee \ha{2}{8} = \text{\textcode{piM}} \vee \ha{2}{8} = \text{\textcode{puM}} \vee \ha{2}{8} = \phi)$ \item[] $\wedge (\ha{2}{10} =\text{\textcode{M}} \vee \ha{2}{10} = \text{\textcode{L}} \vee \ha{2}{10} = \text{\textcode{R}} \vee \ha{2}{10} = \text{\textcode{piM}} \vee \ha{2}{10} = \text{\textcode{puM}} \vee \ha{2}{10} = \phi)$ \item[] $\wedge (\ha{2}{11} = \text{\textcode{piM}} \vee \ha{2}{11} = \text{\textcode{puM}})$ \item[] $\wedge (\ha{2}{12} =\text{\textcode{M}} \vee \ha{2}{12} = \text{\textcode{L}} \vee \ha{2}{12} = \text{\textcode{R}} \vee \ha{2}{12} = \text{\textcode{piM}} \vee \ha{2}{12} = \text{\textcode{puM}} \vee \ha{2}{12} = \phi)$ \item[] $\wedge (\ha{2}{13} =\text{\textcode{M}} \vee \ha{2}{13} = \text{\textcode{L}} \vee \ha{2}{13} = \text{\textcode{R}} \vee \ha{2}{13} = \text{\textcode{piM}} \vee \ha{2}{13} = \text{\textcode{puM}} \vee \ha{2}{13} = \phi) $ \item \hspace{0.25em} $ \big{(}(\ha{2}{1} \neq \phi \vee \ha{2}{2} \neq \phi) \Rightarrow (\ha{2}{4} = \phi \wedge \ha{2}{6} = \phi \wedge \ha{2}{8} = \phi \wedge \ha{2}{10} = \phi \wedge \ha{2}{12} = \phi \wedge \ha{2}{13} = \phi)\big{)}$ \item[] $ \wedge \big{(}(\ha{2}{4} \neq \phi) \Rightarrow (\ha{2}{1} = \phi \wedge \ha{2}{2} = \phi \wedge \ha{2}{6} = \phi \wedge \ha{2}{8} = \phi \wedge \ha{2}{10} = \phi \wedge \ha{2}{12} = \phi \wedge \ha{2}{13} = \phi) \big{)}$ \item[] $ \wedge \big{(}(\ha{2}{6} \neq \phi) \Rightarrow (\ha{2}{1} = \phi \wedge \ha{2}{2} = \phi \wedge \ha{2}{4} = \phi \wedge \ha{2}{8} = \phi \wedge \ha{2}{10} = \phi \wedge \ha{2}{12} = \phi \wedge \ha{2}{13} = \phi) \big{)}$ \item[] $ \wedge \big{(}(\ha{2}{8} \neq \phi) \Rightarrow (\ha{2}{1} = \phi \wedge \ha{2}{2} = \phi \wedge \ha{2}{4} = \phi \wedge \ha{2}{6} = \phi \wedge \ha{2}{10} = \phi \wedge \ha{2}{12} = \phi \wedge \ha{2}{13} = \phi) \big{)}$ \item[] $ \wedge \big{(}(\ha{2}{10} \neq \phi) \Rightarrow (\ha{2}{1} = \phi \wedge \ha{2}{2} = \phi \wedge \ha{2}{4} = \phi \wedge \ha{2}{6} = \phi \wedge \ha{2}{8} = \phi \wedge \ha{2}{12} = \phi \wedge \ha{2}{13} = \phi) \big{)}$ \item[] $ \wedge \big{(}(\ha{2}{12} \neq \phi \vee \ha{2}{13} \neq \phi) \Rightarrow (\ha{2}{1} = \phi \wedge \ha{2}{2} = \phi \wedge \ha{2}{4} = \phi \wedge \ha{2}{6} = \phi \wedge \ha{2}{8} = \phi \wedge \ha{2}{10} = \phi) \big{)}$ \item \hspace{0.25em} $(\ha{3}{1} =\text{\textcode{M}} \vee \ha{3}{1} = \text{\textcode{L}} \vee \ha{3}{1} = \text{\textcode{R}} \vee \ha{3}{1} = \text{\textcode{piM}} \vee \ha{3}{1} = \text{\textcode{puM}} \vee \ha{3}{1} = \phi)$ \item[] $\wedge (\ha{3}{2} =\text{\textcode{M}} \vee \ha{3}{2} = \text{\textcode{L}} \vee \ha{3}{2} = \text{\textcode{R}} \vee \ha{3}{2} = \text{\textcode{piM}} \vee \ha{3}{2} = \text{\textcode{puM}} \vee \ha{3}{2} = \phi)$ \end{enumerate} \\ Global \textoverline{\textcode{A}}~constraints that allow actions to be added to either of $\textoverline{\textcode{A}}_{1}, \textoverline{\textcode{A}}_{2}, \textoverline{\textcode{A}}_{3}$: \vspace{-0.5mm} \begin{enumerate}[(i)] \item $(\ha{1}{1} \neq \phi \vee \ha{1}{2} \neq \phi \vee \ha{1}{3} \neq \phi \vee \ha{1}{4} \neq \phi)$ \item[] \qquad $\Rightarrow (\ha{2}{1} = \phi \wedge \ha{2}{2} = \phi \wedge \ha{2}{4} = \phi \wedge \ha{2}{6} = \phi \wedge \ha{2}{8} = \phi \wedge \ha{2}{10} = \phi \wedge \ha{2}{12} = \phi \wedge \ha{2}{13} = \phi$ $\wedge$ $\ha{3}{1} = \phi \wedge \ha{3}{2} = \phi)$ \item $(\ha{2}{1} \neq \phi \vee \ha{2}{2} \neq \phi \vee \ha{2}{4} \neq \phi \wedge \ha{2}{6} \neq \phi \wedge \ha{2}{8} \neq \phi \wedge \ha{2}{10} \neq \phi \wedge \ha{2}{12} \neq \phi \wedge \ha{2}{13} \neq \phi )$ \item[] \qquad $\Rightarrow (\ha{1}{1} = \phi \wedge \ha{1}{2} = \phi \wedge \ha{1}{4} = \phi \wedge \ha{1}{5} = \phi$ $\wedge$ $\ha{3}{1} = \phi \wedge \ha{3}{2} = \phi)$ \item $(\ha{3}{1} \neq \phi \vee \ha{3}{2} \neq \phi)$ \item[] \qquad $\Rightarrow (\ha{1}{1} = \phi \wedge \ha{1}{2} = \phi \wedge \ha{1}{4} = \phi \wedge \ha{1}{5} = \phi \wedge \ha{2}{1} = \phi \wedge \ha{2}{2} = \phi \wedge \ha{2}{4} = \phi \wedge \ha{2}{6} = \phi \wedge \ha{2}{8} = \phi \wedge \ha{2}{10} = \phi \wedge$ $\ha{2}{12} = \phi \wedge \ha{2}{13} = \phi)$ \end{enumerate} \end{boxcode} \vspace{-3mm} \caption{$\text{\text{\textcode{Q}}}^\text{in}$-Constraints:~$(\Delta_{1})~\ensuremath{\textsc{ActionEdits}}(\{\textoverline{\textcode{A}}_{1}, \textoverline{\textcode{A}}_{2}, \textoverline{\textcode{A}}_{3}\}, \ensuremath{\omega}(\cdot|~\text{\textcode{C}}^\text{in}))$} \label{fig:appendix.mutation.karel.7} } \end{subfigure} \caption{\textbf{(h)}: Illustration of Code Mutation for \textnormal{Karel}~task \emph{Diagonal} from the \emph{Intro to Programming with Karel} course by \emph{CodeHS.com}~\cite{intro_to_karel_codehs}; We present the \textnormal{Karel}~variant of \figref{fig:mutation} here.} \end{figure} \section{Symbolic Execution: Additional Details}\label{appendix.sec.symbolicexecution} In this section, we provide an example demonstrating how MCTS could guide the symbolic execution in generating more suitable tasks, see Fig.~\ref{fig:appendix.mcts.symbolicexecution}. \begin{figure}[h!] \centering \begin{subfigure}[b]{.17\textwidth} \centering { \includegraphics[height=2.3cm]{fig/appendix_mcts_symbolicexecution/mcts_symbolicexecution_a.pdf} \caption{Initialization} \label{fig:appendix.mcts.symbolicexecution.init} } \end{subfigure} \begin{subfigure}[b]{.27\textwidth} \centering { \includegraphics[height=4.7cm]{fig/appendix_mcts_symbolicexecution/mcts_symbolicexecution_tree.pdf} \caption{Search tree} \label{fig:appendix.mcts.symbolicexecution.tree} } \end{subfigure} \begin{subfigure}[b]{.17\textwidth} \centering { \includegraphics[height=2.3cm]{fig/appendix_mcts_symbolicexecution/mcts_symbolicexecution_b.pdf} \caption{(1, 0, 1)} \label{fig:appendix.mcts.symbolicexecution.path1} } \end{subfigure} \begin{subfigure}[b]{.17\textwidth} \centering { \includegraphics[height=2.3cm]{fig/appendix_mcts_symbolicexecution/mcts_symbolicexecution_c.pdf} \caption{(1, 1, 0)} \label{fig:appendix.mcts.symbolicexecution.path2} } \end{subfigure} \begin{subfigure}[b]{.17\textwidth} \centering { \includegraphics[height=2.3cm]{fig/appendix_mcts_symbolicexecution/mcts_symbolicexecution_d.pdf} \caption{(1, 1, 1, 0, 0)} \label{fig:appendix.mcts.symbolicexecution.path3} } \end{subfigure} \caption{Search strategy for guiding the symbolic execution; see the text below for details. } \label{fig:appendix.mcts.symbolicexecution} \end{figure} In Fig.~\ref{fig:appendix.mcts.symbolicexecution.tree}, we consider the MCTS search tree for the code $\text{\textcode{C}}^{\textnormal{out}}$ from \figref{fig:intro.hoc.p1} obtained from the solution code of task \textsf{H4}\xspace~by mutation. At the top of the tree, we have a ``Root'' node where the initial location/direction of the agent is picked from among the available choices. Node ``RU'' corresponds to the block \textsf{repeatUntilGoal}\xspace; the child ``1'' from a node ``RU'' corresponds to unrolling of the loop (i.e., \textcode{goal} is false). Node ``If'' corresponds to the block \textsf{If}\xspace; the child ``1'' from a node ``If'' corresponds to executing the code inside (i.e., \textcode{pathR} is true). For the purpose of this demonstration, we limited the unrolling of the loops to a maximum of $3$; for our experiments, this depth is $2n (=20)$ as discussed in Appendix~\ref{appendix.sec.simulations}. Furthermore, in this demonstration, the initial location/direction for the agent are fixed as shown in Fig.~\ref{fig:appendix.mcts.symbolicexecution.init}; for our experiments, we consider $5\times4 (=20)$ initial configurations which are picked by MCTS resulting in a large branching factor at the root of the tree. Figs.~\ref{fig:appendix.mcts.symbolicexecution.path1},~\ref{fig:appendix.mcts.symbolicexecution.path2},~and~\ref{fig:appendix.mcts.symbolicexecution.path3} illustrate the symbolic execution output for three different paths in the search tree as discussed below: \begin{itemize} \item Fig.~\ref{fig:appendix.mcts.symbolicexecution.path1} corresponds to the path (``RU'':1, ``If'':0, ``RU'': 1). This path results in agent crashing the wall. As discussed in Section~\ref{sec.simulations}, $\ensuremath{\mathcal{F}_{\textnormal{qual}}}(\cdot)$ score is set to $0$ when $\ensuremath{\mathcal{F}_{\textnormal{nocrash}}}(\cdot) = 0$ and hence this tree path evaluates to low $\ensuremath{\mathcal{F}_{\textnormal{score}}}(\cdot)$ score. \item \looseness-1Fig.~\ref{fig:appendix.mcts.symbolicexecution.path2} corresponds to the path (``RU'':1, ``If'':1, ``RU'': 0). This path results in two moves and two turns. \item Fig.~\ref{fig:appendix.mcts.symbolicexecution.path3} corresponds to the path (``RU'':1, ``If'':1, ``RU'': 1, ``If'':0, ``RU'': 0). This path results in three moves and two turns, and is the higher scoring path compared to other two paths. \end{itemize} MCTS is extremely effective as a search strategy and quickly learns to pick paths with high scores. For the same code $\text{\textcode{C}}^{\textnormal{out}}$ used in Fig.~\ref{fig:appendix.mcts.symbolicexecution} above, Fig.~\ref{fig:experiments.mcts.varytime} shows the temporal trends of different feature values in \ensuremath{\mathcal{F}_{\textnormal{score}}}~averaged over a time window of $100$ steps in our experiments. For further details, we refer the reader to \cite{kocsis2006bandit} for an overview of the MCTS procedure, and to \cite{luckow2018monte} where MCTS is used with symbolic execution to direct the exploration towards costly paths. \section{Experimental Evaluation: Additional Details and Results}\label{appendix.sec.simulations} This section elaborates the experimental setup and results described in Section~\ref{sec.simulations}. We begin by providing details on the MCTS procedure in the symbolic execution stage of our task synthesis algorithm. Furthermore, we provide insights on generating multiple tasks for a single code. We also illustrate some example output tasks which violate criteria (V) and (VI), and mutated codes which got pruned in the symbolic execution stage (see Figure~\ref{fig:experiments.analysis}). Our implementation of the symbolic execution stage with MCTS procedure is publicly available (see Footnote~\ref{footnote.githubrepo}). \subsection{Specification of MCTS for Single Run and Additional Results} In this section, we elaborate on the specification of MCTS, briefly discussed in Section~\ref{sec.simulations}. We begin by discussing choices that effect the scalability and run-time of MCTS procedure. \textbf{Choice of initial location and direction.} When doing symbolic execution using MCTS, the procedure begins by picking an initial location and direction for the agent (see \figref{fig:symbolicexecution}(b)). Given a grid-size $n$, and four initial directions (\emph{north}, \emph{east}, \emph{south}, \emph{west}) of the agent to choose from, we get a total of $4n^2$ choices for our initial configuration of the grid-puzzle. In the implementation used for generating the results, we restricted the set of initial choices to $20$ (by choosing only $5$ initial locations of the grid including four corners and centre, and $4$ directions)---this aids in exploration by limiting the branching factor at the root of the MCTS's tree. \textbf{Tree depth for symbolic execution.} The depth of the symbolic tree depends on the nature of the corresponding solution code. For codes without the \textsf{repeatUntilGoal}\xspace~or \textsf{while}\xspace~constructs (\textsf{H1}\xspace, \textsf{H2}\xspace, \textnormal{H3}, \textsf{K7}\xspace, \textsf{K8}\xspace~and \textsf{K9}\xspace), the tree-depth is bounded. But, for more complex codes (\textsf{H3}\xspace, \textsf{H4}\xspace, \textsf{H5}\xspace, and \textsf{K10}\xspace), the tree depth is unbounded. In our implementation, we limited the unrolling of the loops to a maximum of $2n (=20)$. To get an insight into the complexity of the problem, we note that with $20$ initial choices and a depth of $2n$, there are over $40$ million leaves in the symbolic tree for codes \textsf{H4}\xspace~and \textsf{H5}\xspace~which contain conditionals nested inside \textsf{repeatUntilGoal}\xspace~or \textsf{while}\xspace~constructs.\footnote{The actual memory footprint of the MCTS procedure is small given that the symbolic tree is dynamically constructed during a run and the actual number of leaves explored is much lesser. In fact, the average runtime per output task (i.e., one MCTS run) as reported in Column $8$ of \figref{fig:experiments.analysis} is achieved on a laptop machine with $2.8$ GHz Quad-Core Intel Core i$7$ processor and $16$ GB RAM.} Next, we describe the details of our evaluation function for MCTS. \textbf{Details on the evaluation function \ensuremath{\mathcal{F}_{\textnormal{score}}}.} Our evaluation function $\ensuremath{\mathcal{F}_{\textnormal{score}}}(\text{\textcode{T}}^\textnormal{out}, \text{\textcode{C}}^\textnormal{out}, \text{\textcode{T}}^{\textnormal{in}}, \text{\textcode{C}}^{\textnormal{in}}) \in [0,1]$ measures the suitability of a generated task. A higher \ensuremath{\mathcal{F}_{\textnormal{score}}}~indicates a more suitable task. We describe the elements of our evaluation function in greater detail here. We defined it in Section~\ref{sec.simulations} and present it here again for completeness: \begin{align*} \ensuremath{\mathcal{F}_{\textnormal{score}}}(\text{\textcode{T}}^\textnormal{out}, \text{\textcode{C}}^\textnormal{out}, \text{\textcode{T}}^\textnormal{in}, \text{\textcode{C}}^\textnormal{in}) & = \underbrace{\mathbbm{1}{\big(\medmath{ \ensuremath{\mathcal{F}_{\textnormal{qual}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) \geq \delta_{\textnormal{qual}}, \ensuremath{\mathcal{F}_{\textnormal{nocrash}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) = 1, \ensuremath{\mathcal{F}_{\textnormal{nocut}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) = 1 }\big)}}_\text{2a} \cdot \\ & \ \ \ \ \underbrace{\big[ \alpha_{1}\ensuremath{\mathcal{F}_{\textnormal{cov}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) + \alpha_{2}\ensuremath{\mathcal{F}_{\textnormal{qual}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) + \alpha_{3} \ensuremath{\mathcal{F}_{\textnormal{diss}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{T}}^\textnormal{in}_\textnormal{vis}) \big]}_\text{2b} \label{evalfunc2} \tag{2} \end{align*} where $\mathbbm{1}$ is an indicator function and each constant $\alpha = 1/3$. It is to be noted that component $2\textnormal{b}$ in Eq.\ref{evalfunc2} supplies the gradients for guiding the search in MCTS. At the end of the MCTS run (containing $2$ million iterations), the \textit{best} task (i.e, the one with the highest \ensuremath{\mathcal{F}_{\textnormal{score}}}~value) is picked only from the pool of generated tasks which satisfy $\ensuremath{\mathcal{F}_{\textnormal{cov}}}(\cdot) = 1, \ensuremath{\mathcal{F}_{\textnormal{score}}}(\cdot) > 0$. We discuss each constituent function of \ensuremath{\mathcal{F}_{\textnormal{score}}}~next. \textbf{Task quality component of evaluation function.} $\ensuremath{\mathcal{F}_{\textnormal{qual}}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out},\text{\textcode{C}}^\textnormal{out}) \in [0,1]$ evaluates the quality and validity of $\text{\textcode{T}}^\textnormal{out}$. Its is defined as a linear combination of the normalized counts of certain features of $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$ when $\text{\textcode{C}}^\textnormal{out}$ is executed. As certain elements differ in the two task types, \textnormal{HOC}~and \textnormal{Karel}, we define the features differently for each. More precisely, for \textnormal{HOC}~tasks, we have: \begin{align*} \ensuremath{\mathcal{F}_{\textnormal{qual}}}^{\textnormal{HOC}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out},\text{\textcode{C}}^\textnormal{out}) & = \frac{1}{4}\Big{(} \frac{\ensuremath{\#}\text{moves}}{2n} + \frac{\ensuremath{\#}\text{turns}}{n} + \frac{\ensuremath{\#}\text{segments}}{n/2} + \frac{\ensuremath{\#}\text{long-segments}}{n/3} \Big{)} \end{align*} where the individual features are defined as \vspace{4mm} \begin{itemize} \item \ensuremath{\#} moves: This refers to the count of `moves'. \item \ensuremath{\#} turns: This refers to the count of `turns'. \item \ensuremath{\#} segments: This refers to the number of consecutive sequence ($\geq 3$) of `moves' \item \ensuremath{\#} long-segments: This refers to the number of longer consecutive sequence ($\geq 5$) of `moves'. \end{itemize} For \textnormal{Karel}~tasks, we additionally have two marker based features to define the quality of the task i.e, \begin{align*} \ensuremath{\mathcal{F}_{\textnormal{qual}}}^{\textnormal{Karel}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out},\text{\textcode{C}}^\textnormal{out}) & = \frac{3}{4} \cdot \frac{1}{4}\Big{(} \frac{\ensuremath{\#}\text{moves}}{2n} + \frac{\ensuremath{\#}\text{turns}}{n} + \frac{\ensuremath{\#}\text{segments}}{n/2} + \frac{\ensuremath{\#}\text{long-segments}}{n/3} \Big{)} \\ & + \frac{1}{4} \cdot \frac{1}{2} \Big{(}\frac{\ensuremath{\#}\text{pick-markers}}{n} + \frac{\ensuremath{\#}\text{put-markers}}{n}\Big{)} \end{align*} where the additional features are defined as \begin{itemize} \item \ensuremath{\#} pick-markers: This refers to the count of `pick-marker' activity \item \ensuremath{\#} put-markers: This refers to the count of `put-marker' activity \end{itemize} \looseness-1 While we have used high-level features of $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$ to define the quality of a task, one could also embed more specific domain knowledge in defining these features to obtain more interesting/complex tasks. \textbf{Task dissimilarity component of the evaluation function.} $\ensuremath{\mathcal{F}_{\textnormal{diss}}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) \in [0,1]$ evaluates the visual dissimilarity of $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$ w.r.t. $\text{\textcode{T}}^{\textnormal{in}}_\textnormal{vis}$. We define it as a linear combination of the dissimilarity features as follows: \begin{align*} \ensuremath{\mathcal{F}_{\textnormal{diss}}}(\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) & = \frac{1}{3}\Big{(} \textnormal{diss}(\textnormal{loc}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) + \textnormal{diss}(\textnormal{dir}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) + \textnormal{diss}(\textnormal{grid-cells}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) \Big{)} \end{align*} where the individual features are defined as \begin{itemize} \item $\textnormal{diss}(\textnormal{loc}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) \in \{0, 1\}$ measures the dissimilarity in the agent's initial location in the task-puzzles $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$ and $\text{\textcode{T}}^\textnormal{in}_\textnormal{vis}$. \item $\textnormal{diss}(\textnormal{dir}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) \in \{0, 1\}$ measures the dissimilarity in the agent's initial direction in the task-puzzles $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$ and $\text{\textcode{T}}^\textnormal{in}_\textnormal{vis}$. \item $\textnormal{diss}(\textnormal{grid-cells}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis}^\textnormal{in}) \in [0, 1]$ measures the grid-cell level dissimilarity in the task-puzzles $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$ and $\text{\textcode{T}}^\textnormal{in}_\textnormal{vis}$. This is computed as the normalized Hamming distance w.r.t. the two grid-worlds (i.e., number of cells which are different, multiplied with a normalization factor of $\frac{2}{n^2}$). \end{itemize} \textbf{Deep dive into an MCTS run for Karel.} Analogous to the example provided in Section~\ref{sec.simulations}, we take a closer look at an MCTS run for the \textnormal{Karel}~task~\textsf{K10}\xspace, shown in \figref{fig:appendix.experiments.mcts}. \figref{fig:appendix.experiments.mcts.varytime.1} and \figref{fig:appendix.experiments.mcts.varytime.2} illustrate the improvement in various components of \ensuremath{\mathcal{F}_{\textnormal{score}}}~as the number of MCTS iterations increases. Best tasks at different iterations are shown in \figref{fig:appendix.experiments.mcts.best1} and \figref{fig:appendix.experiments.mcts.best3}. As expected, the more the iterations, the better the tasks which are generated. \begin{figure}[h!] \centering \begin{subfigure}[b]{.45\textwidth} \centering { \includegraphics[width=1\textwidth]{fig/appendix_mctsplots_karel/20200610/karel-F_mutation-8-252_run5/mctsplot_vary_time_with_karel-features.pdf} \caption{Trends in \ensuremath{\mathcal{F}_{\textnormal{score}}}~features} \label{fig:appendix.experiments.mcts.varytime.1} } \end{subfigure} \quad \begin{subfigure}[b]{.45\textwidth} \centering { \includegraphics[width=1\textwidth]{fig/appendix_mctsplots_karel/20200610/karel-F_mutation-8-252_run5/mctsplot_vary_time_diss-features.pdf} \caption{Trends in \ensuremath{\mathcal{F}_{\textnormal{score}}}~features capturing dissimilarity} \label{fig:appendix.experiments.mcts.varytime.2} } \end{subfigure} \\ \vspace{2mm} \begin{subfigure}[b]{.45\textwidth} \centering { \includegraphics[height=2.00cm]{fig/appendix_mctsplots_karel/20200607/karel-F_mutation-8-252_run4/mctsplot_best_20.pdf} \caption{Best at $20$} \label{fig:appendix.experiments.mcts.best1} } \end{subfigure} \quad \begin{subfigure}[b]{.45\textwidth} \centering { \includegraphics[height=2.00cm]{fig/appendix_mctsplots_karel/20200607/karel-F_mutation-8-252_run4/mctsplot_best_2000.pdf} \caption{Best at $2$M} \label{fig:appendix.experiments.mcts.best3} } \end{subfigure} \caption{Illustration of a single MCTS run on $\text{\textcode{C}}^{\textnormal{out}}$ from \figref{fig:intro.karel.p1} obtained from solution code of task \textsf{K10}\xspace~by mutation. (a, b) show the temporal trends of different feature values in \ensuremath{\mathcal{F}_{\textnormal{score}}}~averaged over a time window of $100$ steps. (c, d)~show the best, i.e., highest scoring, tasks generated up to times $2 \times 10^1$ and $2 \times 10^6$ respectively. } \vspace{-10mm} \label{fig:appendix.experiments.mcts} \end{figure} \subsection{Specification of MCTS for Multiple Runs with Diversity and Additional Results} Our task synthesis algorithm can also generate multiple tasks for a \emph{single} code, with sufficient diversity. To achieve this, we modify the evaluation function \ensuremath{\mathcal{F}_{\textnormal{score}}}~guiding the MCTS search. We introduce a diversity measure \ensuremath{\mathcal{F}_{\textnormal{diversity}}}~which measures the diversity between the generated tasks. More concretely, when generating a new $(k+1)^{\textsuperscript{th}}$ task, we capture the diversity score w.r.t the tasks generated in the previous k-runs of MCTS $\{ \text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1}, \ldots, \text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},k} \}$. \textbf{Modified evaluation function \ensuremath{\mathcal{F}_{\textnormal{score}}}.} Our evaluation function with the new diversity component is given below with each $\alpha = 1/4$. We have $\ensuremath{\mathcal{F}_{\textnormal{score}}}(\text{\textcode{T}}^\textnormal{out}, \text{\textcode{C}}^\textnormal{out}, \text{\textcode{T}}^\textnormal{in}, \text{\textcode{C}}^\textnormal{in}, \{ \text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1}, \ldots, \text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},k} \}):=$ \begin{align*} &\quad \underbrace{\mathbbm{1}{\big(\medmath{ \ensuremath{\mathcal{F}_{\textnormal{qual}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) \geq \delta_{\textnormal{qual}}, \ensuremath{\mathcal{F}_{\textnormal{nocrash}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) = 1, \ensuremath{\mathcal{F}_{\textnormal{nocut}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) = 1 }\big)}}_\text{3a} \cdot \\ &\quad \underbrace{\big[ \alpha_{1}\ensuremath{\mathcal{F}_{\textnormal{cov}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) + \alpha_{2}\ensuremath{\mathcal{F}_{\textnormal{qual}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}) + \alpha_{3} \ensuremath{\mathcal{F}_{\textnormal{diss}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{T}}^\textnormal{in}_\textnormal{vis}) + \alpha_{4} \ensuremath{\mathcal{F}_{\textnormal{diversity}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}~|~\{ \text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1} \ldots \text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},k} \}) \big]}_\text{3b} \label{evalfunc3} \tag{3} \end{align*} \textbf{Diversity score of tasks \ensuremath{\mathcal{F}_{\textnormal{diversity}}}.} Here, we describe the diversity component of the evaluation function. $\ensuremath{\mathcal{F}_{\textnormal{diversity}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}~|~\{ \text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1},\ldots, \text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},k} \}) \in [0,1]$ operates on a pool of generated tasks, and computes a diversity score for the new task w.r.t the tasks in the pool. Initially, the pool of tasks generated is empty. In this case, we have $\ensuremath{\mathcal{F}_{\textnormal{diversity}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}~|~\{\}) = 1$. After one run of MCTS, we have one task in the task pool $\{\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1}$\}. We define the diversity score for a subsequent task $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$ as follows. First, if $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis} = \text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1}$ then we set $\ensuremath{\mathcal{F}_{\textnormal{diversity}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}~|~ \{\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1} \}) = 0$. Otherwise, the diversity score is given by \begin{align*} \ensuremath{\mathcal{F}_{\textnormal{diversity}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}~|~ \{\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1} \}) & = \frac{1}{4} \Big{(} \textnormal{diss}(\textnormal{loc}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis,1}^\textnormal{out}) + \textnormal{diss}(\textnormal{dir}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis,1}^\textnormal{out}) \\ & + \textnormal{diss}(\textnormal{grid-cells}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis,1}^\textnormal{out}) + \textnormal{diss}(\textnormal{symbolic-paths}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis,1}^\textnormal{out}) \Big{)} \end{align*} where the individual features are defined as \begin{itemize} \item $\textnormal{diss}(\textnormal{loc}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis,1}^\textnormal{out}) \in \{0,1\}$ measures the dissimilarity in the agent's initial location in the task-puzzles $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$ and $\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1}$. \item $\textnormal{diss}(\textnormal{dir}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_\textnormal{vis,1}^\textnormal{out}) \in \{0,1\}$ measures the dissimilarity in the agent's initial direction in the task-puzzles $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$ and $\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1}$. \item $\textnormal{diss}(\textnormal{grid-cells}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_{\textnormal{vis},1}^\textnormal{out}) \in [0,1]$ measures the grid-cell level dissimilarity in the task-puzzles $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$ and $\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1}$. This is computed as the normalized Hamming distance w.r.t. the two grid-worlds (i.e., number of cells which are different, multiplied with a normalization factor of $\frac{2}{n^2}$). \item \looseness-1 $\textnormal{diss}(\textnormal{symbolic-paths}~|~\text{\textcode{T}}_\textnormal{vis}^\textnormal{out}, \text{\textcode{T}}_{\textnormal{vis},1}^\textnormal{out}) \in [0,1]$ measures the dissimilarity in the symbolic-paths used in the generation of $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$ and $\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1}$. This is computed as the normalized ``edit distance" between these paths. \end{itemize} After we have run $k$ MCTS runs, the pool of tasks generated is populated ($\{\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1} \ldots \text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},k}\} $) and the diversity score of the subsequent task is computed as follows: \begin{align*} \ensuremath{\mathcal{F}_{\textnormal{diversity}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}~|~\{\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1}, \ldots, \text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},k}\} ) & = \min_{i \in [k]} \ensuremath{\mathcal{F}_{\textnormal{diversity}}}(\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}~|~\{\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},i}\} ) \end{align*} As the pool of tasks grow, it becomes more constrained to generate a task that is diverse from all the tasks in the pool. In general, there is a limit to the number of tasks per code that can be generated---eventually, the new task will have \ensuremath{\mathcal{F}_{\textnormal{diversity}}}~to be $0$ or \ensuremath{\mathcal{F}_{\textnormal{score}}}~to be $0$. As stated in Section~\ref{sec.simulations}, for each code $\text{\textcode{C}}^{\textnormal{out}}$, we generated up to $10$ different visual tasks using this process. \textbf{Illustration of output tasks using diversity.} We illustrate our diverse task generation process on both \textnormal{HOC}~and \textnormal{Karel}~tasks. \figref{fig:appendix.experiments.mcts.hoc.diversity} shows the $10$ diverse tasks generated for code shown in \figref{fig:intro.hoc.p1}, while \figref{fig:appendix.experiments.mcts.karel.diversity} shows the $6$ diverse tasks generated for the code shown in \figref{fig:intro.karel.p1}. \begin{figure}[h!] \centering \begin{subfigure}[b]{.18\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_hoc/hoc-G_mutation-6-22_run2_diversity/mcts_diversity_1.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},1}$} \label{fig:appendix.experiments.mcts.hoc.diversity.1} } \end{subfigure} \begin{subfigure}[b]{.18\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_hoc/hoc-G_mutation-6-22_run2_diversity/mcts_diversity_2.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},2}$} \label{fig:appendix.experiments.mcts.hoc.diversity.2} } \end{subfigure} \begin{subfigure}[b]{.18\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_hoc/hoc-G_mutation-6-22_run2_diversity/mcts_diversity_3.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},3}$} \label{fig:appendix.experiments.mcts.hoc.diversity.3} } \end{subfigure} \begin{subfigure}[b]{.18\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_hoc/hoc-G_mutation-6-22_run2_diversity/mcts_diversity_4.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis},4}$} \label{fig:appendix.experiments.mcts.hoc.diversity.4} } \end{subfigure} \begin{subfigure}[b]{.18\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_hoc/hoc-G_mutation-6-22_run2_diversity/mcts_diversity_5.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis}, 5}$} \label{fig:appendix.experiments.mcts.hoc.diversity.5} } \end{subfigure} \begin{subfigure}[b]{.18\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_hoc/hoc-G_mutation-6-22_run2_diversity/mcts_diversity_6.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis}, 6}$} \label{fig:appendix.experiments.mcts.hoc.diversity.6} } \end{subfigure} \begin{subfigure}[b]{.18\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_hoc/hoc-G_mutation-6-22_run2_diversity/mcts_diversity_7.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis}, 7}$} \label{fig:appendix.experiments.mcts.hoc.diversity.7} } \end{subfigure} \begin{subfigure}[b]{.18\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_hoc/hoc-G_mutation-6-22_run2_diversity/mcts_diversity_8.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis}, 8}$} \label{fig:appendix.experiments.mcts.hoc.diversity.8} } \end{subfigure} \begin{subfigure}[b]{.18\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_hoc/hoc-G_mutation-6-22_run2_diversity/mcts_diversity_9.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis}, 9}$} \label{fig:appendix.experiments.mcts.hoc.diversity.9} } \end{subfigure} \begin{subfigure}[b]{.18\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_hoc/hoc-G_mutation-6-22_run2_diversity/mcts_diversity_10.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis}, 10}$} \label{fig:appendix.experiments.mcts.hoc.diversity.10} } \end{subfigure} \caption{Illustration of task diversity on $\text{\textcode{C}}^{\textnormal{out}}$ from \figref{fig:intro.hoc.p1} which was obtained from solution code of task \textsf{H4}\xspace~by mutation. All the $10$ diverse tasks generated are shown here. } \vspace{-4mm} \label{fig:appendix.experiments.mcts.hoc.diversity} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}[b]{.32\textwidth} \centering { \includegraphics[height=2.00cm]{fig/appendix_mctsplots_karel/20200607/karel-F_mutation-8-252_run4_diversity/mcts_diversity_1.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis}, 1}$} \label{fig:appendix.experiments.mcts.karel.diversity.1} } \end{subfigure} \begin{subfigure}[b]{.32\textwidth} \centering { \includegraphics[height=2.00cm]{fig/appendix_mctsplots_karel/20200607/karel-F_mutation-8-252_run4_diversity/mcts_diversity_2.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis}, 2}$} \label{fig:appendix.experiments.mcts.karel.diversity.2} } \end{subfigure} \begin{subfigure}[b]{.32\textwidth} \centering { \includegraphics[height=2.00cm]{fig/appendix_mctsplots_karel/20200607/karel-F_mutation-8-252_run4_diversity/mcts_diversity_3.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis}, 3}$} \label{fig:appendix.experiments.mcts.karel.diversity.3} } \end{subfigure} \begin{subfigure}[b]{.32\textwidth} \centering { \includegraphics[height=2.00cm]{fig/appendix_mctsplots_karel/20200607/karel-F_mutation-8-252_run4_diversity/mcts_diversity_4.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis}, 4}$} \label{fig:appendix.experiments.mcts.karel.diversity.6} } \end{subfigure} \begin{subfigure}[b]{.32\textwidth} \centering { \includegraphics[height=2.00cm]{fig/appendix_mctsplots_karel/20200607/karel-F_mutation-8-252_run4_diversity/mcts_diversity_5.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis}, 5}$} \label{fig:appendix.experiments.mcts.karel.diversity.7} } \end{subfigure} \begin{subfigure}[b]{.32\textwidth} \centering { \includegraphics[height=2.00cm]{fig/appendix_mctsplots_karel/20200607/karel-F_mutation-8-252_run4_diversity/mcts_diversity_6.pdf} \caption{$\text{\textcode{T}}^\textnormal{out}_{\textnormal{vis}, 6}$} \label{fig:appendix.experiments.mcts.karel.diversity.8} } \end{subfigure} \caption{Illustration of task diversity on $\text{\textcode{C}}^{\textnormal{out}}$ from \figref{fig:intro.karel.p1} which was obtained from solution code of task \textsf{K10}\xspace~by mutation. First $6$ diverse tasks are shown here. } \vspace{-4mm} \label{fig:appendix.experiments.mcts.karel.diversity} \end{figure} \subsection{Insights into Results of \figref{fig:experiments.analysis}} In this section, we provide further insights into the final results presented \figref{fig:experiments.analysis}. In particular, we illustrate few limitations of the codes and tasks we generate (w.r.t task-synthesis objectives defined in Section~\ref{sec.problem}): \begin{itemize} \item \textbf{Limitations of mutated codes generated}: Column $4$ of \figref{fig:experiments.analysis} lists the number of codes generated by our mutation stage. However this set ($\#\text{\textcode{C}}^\textnormal{out}_{\Delta=\textnormal{all}}$) continues to have few semantic irregularities (as discussed in Section \ref{sec.approach.mutation}). Some of these irregularities are illustrated in \figref{fig:appendix.experiments.problematic.pruned}. These codes are pruned by the symbolic execution stage of our algorithm, and the revised set of codes($\#\text{\textcode{C}}^\textnormal{out}$) is listed in Column $6$ of \figref{fig:experiments.analysis}. \item \textbf{Tasks which violate task-synthesis objective $\textnormal{(V)}$}: Out of the final set of tasks generated (shown in Column $7$ of \figref{fig:experiments.analysis}), some of them violate objective (V). The fraction of the tasks which satisfy this particular objective are listed in Column $9$ of \figref{fig:experiments.analysis}. In \figref{fig:appendix.experiments.problematic.structure} we illustrate two examples which violate the objective, in output tasks for \textsf{H4}\xspace~and \textsf{H5}\xspace. \item \textbf{Tasks which violate task-synthesis objective $\textnormal{(VI)}_{\delta_\textnormal{mini} = 1}$}: Column $10$ of \figref{fig:experiments.analysis} lists the fraction of the tasks generated that satisfy this particular objective, on task-minimality. In \figref{fig:appendix.experiments.problematic.minimality}, we illustrate two examples of tasks which violate this minimality constraint with $\delta_\textnormal{mini} = 1$. \end{itemize} \begin{figure}[h!] \centering \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnRight}\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnRight}\\ \quad \textsf{move}\xspace\\ \textcode{\}} \\ \\ \\ \vspace{4.3mm} \end{boxcode} \vspace{-2mm} \caption{\textsf{H1}\xspace: $\text{\textcode{C}}^\textnormal{out}$} \label{fig:appendix.experiments.pruned.1} } \end{subfigure} \quad \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textcode{turnLeft}\\ \quad \textsf{repeat}\xspace\textcode{(5}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnRight}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \\ \\ \\ \vspace{0.5mm} \end{boxcode} \vspace{-2mm} \caption{\textsf{H2}\xspace: $\text{\textcode{C}}^\textnormal{out}$} \label{fig:appendix.experiments.pruned.2} } \end{subfigure} \quad \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeat}\xspace\textcode{(4}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \textcode{\}}\\ \quad \textcode{turnLeft}\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnLeft}\\ \quad \textsf{repeat}\xspace\textcode{(6}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \textcode{\}}\\ \textcode{\}} \end{boxcode} \vspace{-2mm} \caption{\textnormal{H3}: $\text{\textcode{C}}^\textnormal{out}$} \label{fig:appendix.experiments.pruned.3} } \end{subfigure} \quad \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnLeft}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnLeft}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \\ \\ \vspace{1.7mm} \end{boxcode} \vspace{-2mm} \caption{\textsf{H3}\xspace: $\text{\textcode{C}}^\textnormal{out}$} \label{fig:appendix.experiments.pruned.4} } \end{subfigure} \\ \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{turnRight}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathRight}\textcode{)\{}\\ \quad \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \vspace{1mm} \end{boxcode} \vspace{-2mm} \caption{\textsf{H4}\xspace: $\text{\textcode{C}}^\textnormal{out}$} \label{fig:appendix.experiments.pruned.5} } \end{subfigure} \quad \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathAhead}\textcode{)\{}\\ \quad \quad \quad \textsf{move}\xspace\\ \quad \quad \quad \textcode{turnLeft}\\ \quad \quad \textcode{\}}\\ \quad \quad \textcode{\textsc{Else}}\textcode{\{}\\ \quad \quad \quad \textcode{turnLeft}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \end{boxcode} \vspace{-2mm} \caption{\textsf{H5}\xspace: $\text{\textcode{C}}^\textnormal{out}$} \label{fig:appendix.experiments.pruned.6} } \end{subfigure} \quad \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.70} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeat}\xspace\textcode{(5}\textcode{)\{}\\ \quad \quad \textcode{pickMarker}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{putMarker}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \\ \\ \vspace{1.8mm} \end{boxcode} \vspace{-2mm} \caption{\textsf{K8}\xspace: $\text{\textcode{C}}^\textnormal{out}$} \label{fig:appendix.experiments.pruned.7} } \end{subfigure} \quad \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.70} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textcode{putMarker}\\ \quad \textsf{while}\xspace\textcode{(}\textcode{pathAhead}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnLeft}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{turnLeft}\\ \quad \quad \textcode{putMarker}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \vspace{2mm} \end{boxcode} \vspace{-2mm} \caption{\textsf{K10}\xspace: $\text{\textcode{C}}^\textnormal{out}$} \label{fig:appendix.experiments.pruned.8} } \end{subfigure} \quad \vspace{-3.5mm} \caption{Illustration of codes with semantic irregularities in Column $\text{\textcode{C}}^\textnormal{out}_{\Delta=\textnormal{all}}$ of \figref{fig:experiments.analysis}. (a)--(f) show the semantic irregularities in mutated codes generated for \textnormal{HOC}~tasks. All of these codes lead to circular paths in output task, and are pruned out in the symbolic execution stage, by the \ensuremath{\mathcal{F}_{\textnormal{nocut}}}~component of the \ensuremath{\mathcal{F}_{\textnormal{score}}}~measure. In particular, consider the semantic irregularity presented in (g). This code corresponding to the reference task \textsf{K8}\xspace, has redundant marker activity. With each iteration of \textsf{repeat}\xspace, the \textcode{pickMarker}~and \textcode{putMarker}~actions occur consecutively, leading to no change in marker activity in the output. (h) illustrates a mutated code for reference task \textsf{K10}\xspace~where if the \textsf{while}\xspace~is executed more than once, \textcode{putMarker}~activity occurs in the same location consecutively leading to a crash (as only one marker is allowed per grid-cell); if \textsf{while}\xspace~is executed only once, the corresponding task generated has a short-cut to the goal. } \vspace{-2.5mm} \label{fig:appendix.experiments.problematic.pruned} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_problematic-examples/criteria_structure_hoc-G_in-hoc-G_mutation-5-19_div3.pdf} \caption{\textsf{H4}\xspace: $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$} \label{fig:appendix.experiments.problematic.structure.1} } \end{subfigure} \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{4.0cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathRight}\textcode{)\{}\\ \quad \quad \quad \textcode{turnRight}\\ \quad \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \\ \\ \vspace{1mm} \end{boxcode} \vspace{-1mm} \caption{\textsf{H4}\xspace: $\text{\textcode{C}}^\textnormal{out}$} \label{fig:appendix.experiments.problematic.structure.2} } \end{subfigure} \quad \quad \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_problematic-examples/criteria_structure_hoc-H_in-hoc-H_mutation-6-36_div1.pdf} \caption{\textsf{H5}\xspace: $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$} \label{fig:appendix.experiments.problematic.structure.3} } \end{subfigure} \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{4.0cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathAhead}\textcode{)\{}\\ \quad \quad \quad \textsf{move}\xspace\\ \quad \quad \quad \textsf{move}\xspace\\ \quad \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{\}}\\ \quad \quad \textcode{\textsc{Else}}\textcode{\{}\\ \quad \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \end{boxcode} \vspace{-1mm} \caption{\textsf{H5}\xspace: $\text{\textcode{C}}^\textnormal{out}$} \label{fig:appendix.experiments.problematic.structure.4} } \end{subfigure} \quad \vspace{-1.5mm} \caption{Illustration of violation of task-synthesis objective (V) by generated output tasks for reference tasks \textsf{H4}\xspace~and \textsf{H5}\xspace. (a, b) show the irregularity in generated task ($\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}$) for \textsf{H4}\xspace~which leads to only a straight path in the visual-puzzle. The corresponding code renders the \textsf{If}\xspace~construct redundant. (c, d) illustrate a similar irregularity in the generated task ($\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}$) for \textsf{H5}\xspace. Here, \textsf{IfElse}\xspace~construct is not needed for the optimal solution. } \vspace{-2.5mm} \label{fig:appendix.experiments.problematic.structure} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_problematic-examples/criteria_minimality_hoc-G_in-hoc-G_mutation-6-12_div6} \caption{\textsf{H4}\xspace: $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$} \label{fig:appendix.experiments.problematic.minimality.1} } \end{subfigure} \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{4.0cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{move}\xspace\\ \quad \textcode{turnRight}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathRight}\textcode{)\{}\\ \quad \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \vspace{3mm} \end{boxcode} \vspace{-1mm} \caption{\textsf{H4}\xspace: $\text{\textcode{C}}^\textnormal{out}$} \label{fig:appendix.experiments.problematic.minimality.2} } \end{subfigure} \quad \quad \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_problematic-examples/criteria_minimality_hoc-H_in-hoc-H_mutation-6-27_div1.pdf} \caption{\textsf{H5}\xspace: $\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}$} \label{fig:appendix.experiments.problematic.minimality.3} } \end{subfigure} \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{4.0cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textcode{turnRight}\\ \quad \textsf{move}\xspace\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathAhead}\textcode{)\{}\\ \quad \quad \quad \textsf{move}\xspace\\ \quad \quad \textcode{\}}\\ \quad \quad \textcode{\textsc{Else}}\textcode{\{}\\ \quad \quad \quad \textcode{turnRight}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \end{boxcode} \vspace{-1mm} \caption{\textsf{H5}\xspace: $\text{\textcode{C}}^\textnormal{out}$} \label{fig:appendix.experiments.problematic.minimality.4} } \end{subfigure} \quad \vspace{-1.5mm} \caption{\looseness-1 Illustration of violation of task-synthesis objective (V1), with $\delta_\textnormal{mini} = 1$ by generated output tasks for reference tasks \textsf{H4}\xspace~and \textsf{H5}\xspace. (a, b) show the violation of task minimality, for the task ($\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}$) generated for \textsf{H4}\xspace. In particular, the first two actions in the code shown in (b) are unnecessary. Similarly, (c, d) show the violation of task minimality, for the task ($\text{\textcode{T}}^\textnormal{out}_\textnormal{vis}, \text{\textcode{C}}^\textnormal{out}$) generated for \textsf{H5}\xspace. } \vspace{-2.5mm} \label{fig:appendix.experiments.problematic.minimality} \end{figure} \subsection{Additional Results and Discussions} \subsection{Adding More Variability to Output Tasks}\label{appendix.sec.simulations.more_variability} Here, we propose a few simple extensions to our task generation algorithm allowing us to add more variability in the visual puzzles. We show that high variability can be achieved through suitable post-processing and pre-processing of the generated tasks (happening after and before the symbolic execution process, respectively). We describe each of these strategies next. \textbf{Different grid-sizes.} A simple strategy to enhance task variability is by altering the grid-size parameter $n$. \figref{fig:appendix.gridsz} illustrates the tasks generated with different values of the grid-size parameter $n$. For instance, this strategy is employed in generating multiple input-output pairs for Karel tasks in \textit{Intro to Programming with Karel} course by \textit{CodeHS.com}~\cite{intro_to_karel_codehs}. \begin{figure}[h!] \centering \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_variants/hoc-G_mutation-6-22_variants_vary-gridsz/mcts_variants_vary-gridsz_12.pdf} \caption{$\text{\textcode{T}}^{\textnormal{out}}_{\textnormal{vis}}$; $n = 10$} \label{fig:appendix.samegridsz} } \end{subfigure} \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_variants/hoc-G_mutation-6-22_variants_vary-gridsz/mcts_variants_vary-gridsz_10.pdf} \caption{$\text{\textcode{T}}^{\textnormal{out}}_{\textnormal{vis}}$; $n = 8$} \label{fig:appendix.gridsz8} } \end{subfigure} \begin{subfigure}[b]{.22\textwidth} \centering { \includegraphics[height=2.39cm]{fig/appendix_mctsplots_variants/hoc-G_mutation-6-22_variants_vary-gridsz/mcts_variants_vary-gridsz_8.pdf} \caption{$\text{\textcode{T}}^{\textnormal{out}}_{\textnormal{vis}}$; $n = 6$} \label{fig:appendix.gridsz6} } \end{subfigure} \caption{ Tasks generated for $\text{\textcode{C}}^{\textnormal{out}}$ from \figref{fig:intro.hoc.p1} when varying grid-size ($n$). } \label{fig:appendix.gridsz} \end{figure} \textbf{Post-processing: Using distractor paths.} One of the ways to add variability to the tasks is by adding \emph{distractor-paths}, to the generated tasks. These paths are added after the symbolic execution stage is complete, and a basic task has been generated. \figref{fig:appendix.nopostprocess} shows the task generated without any post-processing of the output of symbolic execution, carried out on $\text{\textcode{C}}^{\textnormal{out}}$ from \figref{fig:intro.hoc.p1}. \figref{fig:appendix.postprocess1}, and \figref{fig:appendix.postprocess2} illustrate two different post-processing patterns that yield tasks with greater variability, for the same code. \textbf{Pre-processing: Using different initializations of grid cells.} We could also add task variability by initializing the grid-cells differently, before they are subjected to symbolic execution for task synthesis. We have a set of fixed grid-patterns, which when chosen as initializations of the grid-world yield very different looking output tasks. \figref{fig:appendix.nopreprocessing} shows the task generated for $\text{\textcode{C}}^{\textnormal{out}}$ from \figref{fig:intro.hoc.p1}~without any pre-processing on the grid-cells. \figref{fig:appendix.preprocessing1} and \figref{fig:appendix.preprocessing2} show two different tasks obtained using different grid-initializations, for the same code. \clearpage \begin{figure}[t!] \centering \begin{subfigure}[b]{.465\textwidth} \centering { \includegraphics[trim={0 0.55cm 0 0},clip,height=2.45cm]{fig/appendix_mctsplots_variants/hoc-G_mutation-6-22_variants_post-distractor/mcts_variants_post-distractor_1.pdf} \vspace{-4mm} \caption{No post processing} \label{fig:appendix.nopostprocess} } \end{subfigure} \\ \begin{subfigure}[b]{.465\textwidth} \centering { \includegraphics[trim={0 0.55cm 0 0},clip,height=2.45cm]{fig/appendix_mctsplots_variants/hoc-G_mutation-6-22_variants_post-distractor/mcts_variants_post-distractor_2.pdf} \vspace{-4mm} \caption{Post-processing 1} \label{fig:appendix.postprocess1} } \end{subfigure} \quad \ \ \begin{subfigure}[b]{.465\textwidth} \centering { \includegraphics[trim={0 0.55cm 0 0},clip,height=2.45cm]{fig/appendix_mctsplots_variants/hoc-G_mutation-6-22_variants_post-distractor/mcts_variants_post-distractor_3.pdf} \vspace{-4mm} \caption{Post-processing 2} \label{fig:appendix.postprocess2} } \end{subfigure} \caption{Illustration of the (post-processing) distractor path strategy to increase task variability on tasks generated from $\text{\textcode{C}}^{\textnormal{out}}$ in \figref{fig:intro.hoc.p1} which was obtained from solution code of task \textsf{H4}\xspace~by mutation. (a) illustrates the basic task obtained after symbolic execution. (b, c) show two different distractor paths added after the symbolic execution stage, yielding visually very different tasks. } \label{fig:appendix.postprocess} \end{figure} \begin{figure}[t!] \centering \begin{subfigure}[b]{.465\textwidth} \centering { \includegraphics[trim={0 0.55cm 0 0},clip,height=2.45cm]{fig/appendix_mctsplots_variants/hoc-G_mutation-6-22_variants_pre-constraints/mcts_variants_pre-constraints_cons-none.pdf} \vspace{-4mm} \caption{No grid-cell initialization} \label{fig:appendix.nopreprocessing} } \end{subfigure} \\ \begin{subfigure}[b]{.465\textwidth} \centering { \includegraphics[trim={0 0.55cm 0 0},clip,height=2.45cm]{fig/appendix_mctsplots_variants/hoc-G_mutation-6-22_variants_pre-constraints/mcts_variants_pre-constraints_cons1.pdf} \vspace{-4mm} \caption{Grid-cell initialization 1} \label{fig:appendix.preprocessing1} } \end{subfigure} \quad \ \ \begin{subfigure}[b]{.465\textwidth} \centering { \includegraphics[trim={0 0.55cm 0 0},clip,height=2.45cm]{fig/appendix_mctsplots_variants/hoc-G_mutation-6-22_variants_pre-constraints/mcts_variants_pre-constraints_cons2.pdf} \vspace{-4mm} \caption{Grid-cell initialization 2} \label{fig:appendix.preprocessing2} } \end{subfigure} \caption{Illustration of the (pre-processing) grid-cell initialization strategy to increase task variability on tasks generated from $\text{\textcode{C}}^{\textnormal{out}}$ in \figref{fig:intro.hoc.p1} which was obtained from solution code of task \textsf{H4}\xspace~by mutation. (a) illustrates the basic task obtained after symbolic execution. (b, c) show two different grid-cell initializations, yielding visually very different tasks. } \label{fig:appendix.preprocessing} \end{figure} \section{User Study: Additional Details and Results}\label{appendix.sec.userstudy} \vspace{-2mm} In this section, we discuss additional details of our user study and expand on the key results provided in Section \ref{sec.userstudy}. For our user study, we used $4$ reference tasks (\textsf{H2}\xspace, \textsf{H3}\xspace, \textsf{H4}\xspace, and \textsf{H5}\xspace). We developed an web app where participants, recruited through Amazon Mechanical Turk, were asked to solve tasks generated by four algorithms, $\ensuremath{\textsc{Same}}, \ensuremath{\textsc{Tutor}}, \ensuremath{\textsc{MutTask}}, \text{ or } \ensuremath{\textsc{SynTask}}$ (described in Section~\ref{sec.userstudy}). Next, we describe the interface of our app and details of the questionnaire. The web app is publicly available (see Footnote~\ref{footnote.userstudyapp}). \begin{figure}[h!] \centering \begin{subfigure}[b]{0.48\textwidth} \centering { \begin{adjustbox}{varwidth=1\textwidth,fbox,center} \includegraphics[trim={0.4cm 0 0.4cm 0},clip,width=1\textwidth]{fig/appendix_userstudy/interface_v1/step0.png} \end{adjustbox} \caption{Login and welcome page} \label{fig:appendix.userstudy.login} } \end{subfigure} \ \ \begin{subfigure}[b]{.48\textwidth} \centering { \begin{adjustbox}{varwidth=1\textwidth,fbox,center} \includegraphics[trim={0.4cm 0 0.4cm 0},clip,width=1\textwidth]{fig/appendix_userstudy/interface_v1/step1.png} \end{adjustbox} \caption{Step $1$: Coding task with solution} \label{fig:appendix.userstudy.step1} } \end{subfigure} \\ \vspace{2mm} \begin{subfigure}[b]{.48\textwidth} \centering { \begin{adjustbox}{varwidth=1\textwidth,fbox,center} \includegraphics[trim={0.4cm 0 0.4cm 0},clip,width=1\textwidth]{fig/appendix_userstudy/interface_v1/step2.png} \end{adjustbox} \caption{Step $2$: Solve new coding task} \label{fig:appendix.userstudy.step2} } \end{subfigure} \ \ \begin{subfigure}[b]{.48\textwidth} \centering { \begin{adjustbox}{varwidth=1\textwidth,fbox,center} \includegraphics[trim={0.4cm 0 0.4cm 0},clip,width=1\textwidth]{fig/appendix_userstudy/interface_v1/step3.png} \end{adjustbox} \caption{Step $3$: Survey} \label{fig:appendix.userstudy.step3} } \end{subfigure} \vspace{-1.5mm} \caption{Interface of the app.} \label{fig:appendix.userstudy.app} \end{figure} \vspace{-4mm} \subsection{App Interface and Questionnaire} Our online app was developed using the publicly available toolkit of Blockly Games~\cite{googleblockly} and provides an interface for a participant to practice Block-based programming tasks for \textnormal{HOC}. Participants were familiarized with the tasks by a small tutorial given before they logged-in to the app. Each participant was randomly assigned a reference task, an algorithm (out of the four chosen for evaluation), and a particular task generated based on the chosen algorithm. These elements constituted a ``practice session" for a participant. Each session consisted of three steps. In Step $1$, the reference task along with its solution code was shown to the participant (\figref{fig:appendix.userstudy.step1}). In Step $2$, the participant was asked to solve a new task (\figref{fig:appendix.userstudy.step2}). The new task was generated by one of the four algorithms: $\ensuremath{\textsc{Same}}, \ensuremath{\textsc{Tutor}}, \ensuremath{\textsc{MutTask}}, \text{ or } \ensuremath{\textsc{SynTask}}$. To solve this new task, the participant was given $10$ tries. If they successfully solved the task or ran out of tries, they were directed to Step $3$ of the practice session, the survey~(\figref{fig:appendix.userstudy.step3}). Here, they were presented with a question on the visual dissimilarity of the tasks from Step 1 and Step 2, which was to be answered on a $4$-point Likert scale as used in \cite{polozov2015}: \begin{itemize} \item Score $1$: indicates that the tasks are visually exactly same \item Score $2$: indicates that the tasks are visually similar \item Score $3$: indicates that the tasks are visually slightly different \item Score $4$: indicates that the tasks are visually very different \end{itemize} \subsection{Results on Visual Task Dissimilarity} \begin{figure}[t!] \centering \begin{subfigure}[b]{.194\textwidth} \centering { \includegraphics[width=1\textwidth]{fig/appendix_userstudy/histograms/histogram_H-all.pdf} \caption{\textnormal{H-}} \label{fig:appendix.userstudy.q2.all} } \end{subfigure} \begin{subfigure}[b]{.194\textwidth} \centering { \includegraphics[width=1\textwidth]{fig/appendix_userstudy/histograms/histogram_H2.pdf} \caption{\textsf{H2}\xspace} \label{fig:appendix.userstudy.q2.h2} } \end{subfigure} \begin{subfigure}[b]{.194\textwidth} \centering { \includegraphics[width=1\textwidth]{fig/appendix_userstudy/histograms/histogram_H4.pdf} \caption{\textsf{H3}\xspace} \label{fig:appendix.userstudy.q2.h4} } \end{subfigure} \begin{subfigure}[b]{.194\textwidth} \centering { \includegraphics[width=1\textwidth]{fig/appendix_userstudy/histograms/histogram_H5.pdf} \caption{\textsf{H4}\xspace} \label{fig:appendix.userstudy.q2.h5} } \end{subfigure} \begin{subfigure}[b]{.194\textwidth} \centering { \includegraphics[width=1\textwidth]{fig/appendix_userstudy/histograms/histogram_H6.pdf} \caption{\textsf{H5}\xspace} \label{fig:appendix.userstudy.q2.h6} } \end{subfigure} \caption{Distribution of participant responses on visual dissimilarity of tasks, rated on a 4-point Likert scale (1: exactly same, 2: almost same, 3: slightly different, 4: very different) } \label{fig:appendix.userstudy.q2} \end{figure} The distribution of participant responses (on a 4-point scale) on the visual dissimilarity of the presented tasks is shown in \figref{fig:appendix.userstudy.q2}; the aggregate statistics are provided in \figref{fig:userstudy}. Comparing the dissimilarity of the generated tasks w.r.t. all the reference tasks \textnormal{H-}, we found that the performance of \ensuremath{\textsc{Same}}~was worst (mean dissimilarity = $1.07$) in comparison to \ensuremath{\textsc{MutTask}}~(mean = $2.17$), \ensuremath{\textsc{SynTask}}~(mean = $2.63$), and \ensuremath{\textsc{Tutor}}~(mean = $2.90$). The poor performance of \ensuremath{\textsc{Same}},~with the majority of scores being $1$, is expected. Furthermore, we also see in \figref{fig:appendix.userstudy.q2.all} that \ensuremath{\textsc{MutTask}}~has a greater percentage of lower scores of $1$ and $2$, and this is because the baseline directly mutates the task puzzle. Comparing the performance of \ensuremath{\textsc{SynTask}}~to the baselines, we find that \ensuremath{\textsc{SynTask}}~performed significantly better than \ensuremath{\textsc{MutTask}}~($\chi^2 = 38.81, p < e^{-7}$). However, its performance was worse than that of \ensuremath{\textsc{Tutor}}~and this difference was significant~($\chi^2 = 12.20, p = 0.0053$). When analyzing the differences in the performance of \ensuremath{\textsc{SynTask}}~w.r.t. \ensuremath{\textsc{Tutor}}, we find that \ensuremath{\textsc{Tutor}}~performs better primarily because of the following two reasons: (i) some of the tasks generated by \ensuremath{\textsc{Tutor}}~have additional distracting paths / noise, and (ii) for simpler tasks without conditionals like \textsf{H2}\xspace, more powerful code mutations were used. Next, we performed additional analysis by limiting to two complex tasks with nested conditionals, \textsf{H4}\xspace~and \textsf{H5}\xspace. On these two tasks, the mean scores of the methods \ensuremath{\textsc{MutTask}}, \ensuremath{\textsc{SynTask}}, and \ensuremath{\textsc{Tutor}}~were $1.97$, $2.94$, and $3.03$ respectively. Furthermore, we find that \ensuremath{\textsc{SynTask}}'s performance continued to be significantly better than \ensuremath{\textsc{MutTask}}~($\chi^2 = 64.33, p < e^{-13}$). But, the difference in the performance of \ensuremath{\textsc{SynTask}}~and~\ensuremath{\textsc{Tutor}}~was not statistically significant ($\chi^2 = 2.68, p = 0.44$). In general, the performance of our task synthesis algorithm can be further improved by allowing for more powerful code mutations in tasks without conditionals (such as \textsf{H2}\xspace) and by adding more variability in the output tasks by incorporating techniques discussed in Appendix ~\ref{appendix.sec.simulations.more_variability}. \section{Related Work}\label{appendix.relatedwork} \paragraph{Related work. } FIRST PARAGRAPH: \begin{itemize} \item Problem generation \item Conceptual vs. procedural \item Existing works on problem generation (other than coding) and differences \end{itemize} SECOND PARAGRAPH: Existing works on problem generation for coding and differences THIRD PARAGRAPH: Existing works on visual content generation FOURTH PARAGRAPH: \begin{itemize} \item Solution synthesizer, ITS hints, feedback \item curriculum, teaching sequential tasks \cite{haug_teaching_2018} \end{itemize} \section{Misc}\label{appendix.misc} \begin{figure}[t!] \centering \begin{minipage}{0.50\textwidth} \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode2col}{1.2cm}{6.2cm}{0.75}{1.0} \textnormal{code } \text{\textcode{C}} &:= \textcode{def }\textcode{\textsc{Run}}() \textcode{\textsc{do}} y \\ \textnormal{rule } \textcode{y} &:= \textcode{s} | \textcode{g} | \textcode{s};\textcode{g} \\ \textnormal{rule } \textcode{s} \hspace{1mm} &:= \textcode{a} \text{ } | $\text{\textcode{s}};\text{\textcode{s}}$ | \textsf{If}\xspace(\textcode{b}) \textcode{\textsc{do}} $\text{\textcode{s}}$ | \textsf{If}\xspace(\textcode{b}) \textcode{\textsc{do}} $\text{\textcode{s}}$ \textcode{\textsc{Else}} $\text{\textcode{s}}$\\ & \quad | \textsf{while}\xspace(\textcode{b}) \textcode{\textsc{do}} $\text{\textcode{s}}$ | \textsf{repeat}\xspace(\textcode{x}) \textcode{\textsc{do}} $\text{\textcode{s}}$ \\ \textnormal{rule } \textcode{g} &:= \textsf{repeatUntilGoal}\xspace(\textcode{goal}) \textcode{\textsc{do}} $\text{\textcode{s}}$\\ \textnormal{action } \textcode{a} &:= \textsf{move}\xspace| \textsf{turnL}\xspace | \textcode{turnR}| \textsf{put}\xspace | \textsf{pick}\xspace \\ \textnormal{bool } \textcode{b} &:= \textcode{pathA} | \textcode{noPathA} | \textcode{pathL} | \textcode{noPathL} \\ & \quad | \textcode{pathR} | \textcode{noPathR} | \textcode{marker} | \textcode{noMarker} \\ \textnormal{iter } \textcode{x} &:= $2$ | $3$ | $4$ | $5$ | $6$ | $7$ | $8$ | $9$ | $10$\\ \end{boxcode2col} \vspace{-3mm} \caption{Code DSL} \vspace{0.5mm} \label{fig:mutation.1} } \end{subfigure} \\ \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode}{9.0cm}{0.75}{1.0} \textbf{Input}: code \text{\textcode{C}}, sketch \textcode{Q} $\leftarrow$ $\ensuremath{\Omega}(\text{\textcode{C}})$, parameters $\ensuremath{\omega}(.| \text{\textcode{C}})$, $\delta_\text{thresh}$, $\delta_{r}$ \\ Note: \textoverline{\textcode{A}}~is a sequence of actions: $\text{\textcode{A}}_{1}$, \ldots $\text{\textcode{A}}_{N}$ \begin{enumerate \item[(\ensuremath{\Delta_{0}})] Constraint on generated code size based on $\text{\textcode{C}}_{\textnormal{size}} \pm \delta_\text{thresh}$ \item[(\ensuremath{\Delta_{1}})] For each $\text{\textoverline{\textcode{A}}} \in \text{\textcode{Q}}$, constraints ensuring minimality of \textoverline{\textcode{A}} \item[(\ensuremath{\Delta_{2}})] Constraints induced on \textoverline{\textcode{A}}~nested inside conditional \textcode{B} \item[(\ensuremath{\Delta_{3}})] Constraints induced by repeat: \{\text{\textoverline{\textcode{A}}}\textsubscript{before}; \textsf{repeat}\xspace\{\textoverline{\textcode{A}}\} \text{\textoverline{\textcode{A}}}\textsubscript{after}\} \begin{enumerate}[\leftmargin=0em] \item[i.] \textoverline{\textcode{A}}~is not a suffix of \textoverline{\textcode{A}}\textsubscript{before} \item[ii.] \textoverline{\textcode{A}}~is not a prefix of \textoverline{\textcode{A}}\textsubscript{after} \end{enumerate} \item[(\ensuremath{\Delta_{4}})] For each \textcode{X}~$ \in \text{\textcode{Q}}: |\text{\textcode{X}} - \ensuremath{\omega}(\text{\textcode{X}}| \text{\textcode{C}})| \leq \delta_{r}$ \item[(\ensuremath{\Delta_{5}})] For each \textcode{B}~$\in \text{\textcode{Q}}:$ \begin{enumerate}[\leftmargin=0em] \item[i.] \ensuremath{\omega}(\text{\textcode{B}}| \text{\textcode{C}}) $\in$ \{ \textcode{pathA}, \textcode{noPathA} \} $\Rightarrow$ \textcode{B} $\in$ \{ \textcode{pathA},\textcode{noPathA} \} \item[ii.] \ensuremath{\omega}(\text{\textcode{B}}| \text{\textcode{C}}) $\in$ \{ \textcode{pathL}, \textcode{noPathL} \text{\textcode{pathR} }, \textcode{noPathR} \} \item[] $\Rightarrow$ \textcode{B} $\in$ \{ \textcode{pathL}, \textcode{noPathL}, \textcode{pathR}, \textcode{noPathR} \} \item[iii.] \ensuremath{\omega}(\text{\textcode{B}}| \text{\textcode{C}}) $\in$ \{\textcode{marker}, \textcode{noMarker}\} \item[] $\Rightarrow$ \textcode{B} $\in$ \{ \textcode{marker},\textcode{noMarker}\} \end{enumerate} \item[(\ensuremath{\Delta_{6}})] $\text{For each }\text{\textoverline{\textcode{A}}} \in \text{\textcode{Q}}$, \ensuremath{\textsc{ActionEdits}}(\textoverline{\textcode{A}}, $\ensuremath{\omega}(\textoverline{\textcode{A}}| \text{\textcode{C}})$). \item[] \quad Only one block has actions added to them at a time. \vspace{-0.8em} \end{enumerate} \end{boxcode} \vspace{5mm} \caption{Sketch Constraint Types} \label{fig:mutation.3} } \end{subfigure} \end{minipage} \hspace{0.5em} \begin{minipage}{0.40\textwidth} \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode2col}{1.2cm}{6.2cm}{0.75}{1.0} \textnormal{sketch } \textcode{Q} &:= \textcode{def }\textcode{\textsc{Run}}() \textcode{\textsc{do}} $\text{\textcode{Y}}$ \\ \textnormal{rule } \textcode{Y} & := \textcode{S} | \textcode{G} | \textcode{S}; \textcode{G} \\ \textnormal{rule } \textcode{S} &:= \ensuremath{\Lambda} | \textcode{S};\textcode{S} | \textsf{If}\xspace(\textcode{B}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \\ & \quad | \textsf{If}\xspace(\textcode{B}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \textcode{\textsc{Else}} $\text{\textcode{S}}$ \\ & \quad | \textsf{while}\xspace(\textcode{B}) \textcode{\textsc{do}} $\text{\textcode{S}}$ | \textsf{repeat}\xspace(\textcode{X}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \\ \textnormal{rule } \textcode{G} & := \textsf{repeatUntilGoal}\xspace(\textcode{goal}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \\ \textnormal{rule }\ensuremath{\Lambda} &:= $\phi$ | \textcode{A} | \textcode{A}; \ensuremath{\Lambda}\\ \end{boxcode2col} \vspace{-3mm} \caption{Sketch DSL} \label{fig:mutation.2} } \end{subfigure} \\ \begin{subfigure}[b]{0.52\textwidth} \centering { \begin{boxcode}{3.8cm}{0.60}{0.65} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathLeft}\textcode{)\{}\\ \quad \quad \quad \textcode{turnLeft}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \\ \vspace{-1.5mm} \end{boxcode} \vspace{-3mm} \caption{Solution code \text{\textcode{C}}\textsuperscript{in}} \label{fig:mutation.4} } \end{subfigure} \begin{subfigure}[b]{.40\textwidth} \centering { \begin{boxcode}{3.8cm}{0.65}{0.45} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ {\small \quad $\text{\textcode{A}}^{1}_{1}$, $\text{\textcode{A}}^{2}_{1}$ \textcolor{blue}{(\textcolor{blue}{\textoverline{\textcode{A}}}\textsubscript{1})} } \\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ {\small \quad \quad $\text{\textcode{A}}^{1}_{2}$, $\text{\textcode{A}}^{2}_{2}$, $\text{\textcode{A}}^{3}_{2}$, $\text{\textcode{A}}^{4}_{2}$, $\text{\textcode{A}}^{5}_{2}$ \textcolor{blue}{(\textcolor{blue}{\textoverline{\textcode{A}}}\textsubscript{2})} } \\ \quad \quad \textsf{If}\xspace\textcode{(}$\text{\textcode{B}}_{1}$\textcode{)\{}\\ {\small \quad \quad \quad $\text{\textcode{A}}^{1}_{3}$, $\text{\textcode{A}}^{2}_{3}$, $\text{\textcode{A}}^{3}_{3}$, $\text{\textcode{A}}^{4}_{3}$, $\text{\textcode{A}}^{5}_{3}$ \textcolor{blue}{(\textcolor{blue}{\textoverline{\textcode{A}}}\textsubscript{2})} } \\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \vspace{-1.5mm} \end{boxcode} \vspace{-3mm} \caption{Sketch \textcode{Q}\textsuperscript{in}} \label{fig:mutation.5} } \end{subfigure} \\ \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode}{8.2cm}{0.75}{1.0} \textbf{Input}: \text{\textcode{C}}\textsuperscript{in}, $\text{\textcode{Q}}^\text{in}$, \ensuremath{\omega}($.| \text{\text{\textcode{C}}}^\text{in}$) = ($\phi$ , $\text{\textsf{move}\xspace}$, $\text{\textsf{turnL}\xspace}$, \textcode{pathL}), \\ \qquad \quad $\delta_\text{thresh} = 2$ \begin{enumerate} \item[(\ensuremath{\Delta_1})] $\text{\textoverline{\textcode{A}}}_{1}$, $\textoverline{\textcode{A}}_{2}$, $\textoverline{\textcode{A}}_{3}$ is minimal \item[(\ensuremath{\Delta_2})] $\text{\textoverline{\textcode{A}}}_{3}$ in \textnormal{bool } $\text{\textcode{B}}_{1} = \text{\textcode{pathL}}$ \begin{itemize} \item[] $\exists \text{\textcode{A}}_{3i} \in \{ \text{\textcode{A}}_{31}, \ldots , \text{\textcode{A}}_{35}\}$ s.t ($\text{\textcode{A}}_{3i} = $ \textsf{turnL}\xspace \item[] $\land \text{ } \forall \text{\textcode{A}}_{3j} \in \{ \text{\textcode{A}}_{31}, \ldots , \text{\textcode{A}}_{3i} \}$ $\text{\textcode{A}}_{3j}$ $\notin$ \{\textsf{move}\xspace, \textcode{turnR} \}) \end{itemize} \item[(\ensuremath{\Delta_2})] $\text{\textoverline{\textcode{A}}}_{3}$ in \textnormal{bool } $\text{\textcode{B}}_{1} = \text{\textcode{pathR}}$ \begin{itemize} \item[]$\exists \text{\textcode{A}}_{3i} \in \{ \text{\textcode{A}}_{31}, \ldots , \text{\textcode{A}}_{35}\}$ s.t ($\text{\textcode{A}}_{3i} = $ \textcode{turnR} \item[] $\land \text{ } \forall \text{\textcode{A}}_{3j} \in \{ \text{\textcode{A}}_{31}, \ldots , \text{\textcode{A}}_{3i} \}$ $\text{\textcode{A}}_{3j} \notin $ \{\textsf{move}\xspace, \textsf{turnL}\xspace \}) \end{itemize} \item[(\ensuremath{\Delta_5})] $\text{\textcode{B}}_{1}$ = \textcode{pathL} $\lor$ $\text{\textcode{B}}_{1}$ = \textcode{pathR} \item[(\ensuremath{\Delta_6})] $\ensuremath{\textsc{ActionEdits}}(\textoverline{\textcode{A}}_{1}, \ensuremath{\omega}(\textoverline{\textcode{A}}_{1}| \text{\textcode{C}}^\text{in}))$, $\ensuremath{\textsc{ActionEdits}}(\textoverline{\textcode{A}}_{2}, \ensuremath{\omega}(\textoverline{\textcode{A}}_{2}| \text{\textcode{C}}^\text{in}))$, \item [] \qquad $\ensuremath{\textsc{ActionEdits}}(\textoverline{\textcode{A}}_{3}, \ensuremath{\omega}(\textoverline{\textcode{A}}_{3}| \text{\textcode{C}}^\text{in}))$ \item[] \quad \quad Only one of $\textoverline{\textcode{A}}_{1}, \textoverline{\textcode{A}}_{2}, \textoverline{\textcode{A}}_{3}$ have actions added to them. \vspace{-2mm} \end{enumerate} \end{boxcode} \vspace{-3mm} \caption{Sketch \textcode{Q}-Constraints} \label{fig:mutation.6} } \end{subfigure} \end{minipage} \caption{Illustration of Program Mutation} \label{fig:mutation} \end{figure} \clearpage \begin{figure}[t!] \centering \begin{minipage}{0.48\textwidth} \begin{minipage}{1.0\textwidth} \hspace{-4em} \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode2col}{1.2cm}{6.2cm}{0.75}{1.0} \textnormal{code } \text{\textcode{C}} &:= \textcode{def }\textcode{\textsc{Run}}() \textcode{\textsc{do}} y \\ \textnormal{rule } \textcode{y} &:= \textcode{s} | \textcode{g} | \textcode{s};\textcode{g} \\ \textnormal{rule } \textcode{s} \hspace{1mm} &:= \textcode{a} \text{ } | $\text{\textcode{s}};\text{\textcode{s}}$ | \textsf{If}\xspace(\textcode{b}) \textcode{\textsc{do}} $\text{\textcode{s}}$ | \textsf{If}\xspace(\textcode{b}) \textcode{\textsc{do}} $\text{\textcode{s}}$ \textcode{\textsc{Else}} $\text{\textcode{s}}$\\ & \quad | \textsf{while}\xspace(\textcode{b}) \textcode{\textsc{do}} $\text{\textcode{s}}$ | \textsf{repeat}\xspace(\textcode{x}) \textcode{\textsc{do}} $\text{\textcode{s}}$ \\ \textnormal{rule } \textcode{g} &:= \textsf{repeatUntilGoal}\xspace(\textcode{goal}) \textcode{\textsc{do}} $\text{\textcode{s}}$\\ \textnormal{action } \textcode{a} &:= \textsf{move}\xspace| \textsf{turnL}\xspace | \textcode{turnR}| \textsf{put}\xspace | \textsf{pick}\xspace \\ \textnormal{bool } \textcode{b} &:= \textcode{pathA} | \textcode{noPathA} | \textcode{pathL} | \textcode{noPathL} \\ & \quad | \textcode{pathR} | \textcode{noPathR} | \textcode{marker} | \textcode{noMarker} \\ \textnormal{iter } \textcode{x} &:= $2$ | $3$ | $4$ | $5$ | $6$ | $7$ | $8$ | $9$ | $10$\\ \end{boxcode2col} \vspace{-3mm} \caption{Code DSL} \vspace{0.5mm} \label{fig:mutation.1} } \end{subfigure} \end{minipage} \\ \begin{minipage}{1.0\textwidth} \hspace{-4em} \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode2col}{1.2cm}{6.2cm}{0.75}{1.0} \textnormal{sketch } \textcode{Q} &:= \textcode{def }\textcode{\textsc{Run}}() \textcode{\textsc{do}} $\text{\textcode{Y}}$ \\ \textnormal{rule } \textcode{Y} & := \textcode{S} | \textcode{G} | \textcode{S}; \textcode{G} \\ \textnormal{rule } \textcode{S} &:= \ensuremath{\Lambda} | \textcode{S};\textcode{S} | \textsf{If}\xspace(\textcode{B}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \\ & \quad | \textsf{If}\xspace(\textcode{B}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \textcode{\textsc{Else}} $\text{\textcode{S}}$ \\ & \quad | \textsf{while}\xspace(\textcode{B}) \textcode{\textsc{do}} $\text{\textcode{S}}$ | \textsf{repeat}\xspace(\textcode{X}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \\ \textnormal{rule } \textcode{G} & := \textsf{repeatUntilGoal}\xspace(\textcode{goal}) \textcode{\textsc{do}} $\text{\textcode{S}}$ \\ \textnormal{rule }\ensuremath{\Lambda} &:= $\phi$ | \textcode{A} | \textcode{A}; \ensuremath{\Lambda}\\ \end{boxcode2col} \vspace{-3mm} \caption{Sketch DSL} \vspace{0.5mm} \label{fig:mutation.2} } \end{subfigure} \end{minipage} \end{minipage} \hspace{-5em} \begin{minipage}{0.48\textwidth} \begin{subfigure}[b]{1.0\textwidth} \centering { \begin{boxcode}{9.0cm}{0.75}{1.0} \textbf{Input}: code \text{\textcode{C}}, sketch \textcode{Q} $\leftarrow$ $\ensuremath{\Omega}(\text{\textcode{C}})$, parameters $\ensuremath{\omega}(.| \text{\textcode{C}})$, $\delta_\text{thresh}$, $\delta_{r}$ \\ Note: \textoverline{\textcode{A}}~is a sequence of actions: $\text{\textcode{A}}_{1}$, \ldots $\text{\textcode{A}}_{N}$ \begin{enumerate \item[(\ensuremath{\Delta_{0}})] Constraint on generated code size based on $\text{\textcode{C}}_{\textnormal{size}} \pm \delta_\text{thresh}$ \item[(\ensuremath{\Delta_{1}})] For each $\text{\textoverline{\textcode{A}}} \in \text{\textcode{Q}}$, constraints ensuring minimality of \textoverline{\textcode{A}} \item[(\ensuremath{\Delta_{2}})] Constraints induced on \textoverline{\textcode{A}}~nested inside conditional \textcode{B} \item[(\ensuremath{\Delta_{3}})] Constraints induced by repeat: \{\text{\textoverline{\textcode{A}}}\textsubscript{before}; \textsf{repeat}\xspace\{\textoverline{\textcode{A}}\} \text{\textoverline{\textcode{A}}}\textsubscript{after}\} \begin{enumerate}[\leftmargin=0em] \item[i.] \textoverline{\textcode{A}}~is not a suffix of \textoverline{\textcode{A}}\textsubscript{before} \item[ii.] \textoverline{\textcode{A}}~is not a prefix of \textoverline{\textcode{A}}\textsubscript{after} \end{enumerate} \item[(\ensuremath{\Delta_{4}})] For each \textcode{X}~$ \in \text{\textcode{Q}}: |\text{\textcode{X}} - \ensuremath{\omega}(\text{\textcode{X}}| \text{\textcode{C}})| \leq \delta_{r}$ \item[(\ensuremath{\Delta_{5}})] For each \textcode{B}~$\in \text{\textcode{Q}}:$ \begin{enumerate}[\leftmargin=0em] \item[i.] \ensuremath{\omega}(\text{\textcode{B}}| \text{\textcode{C}}) $\in$ \{ \textcode{pathA}, \textcode{noPathA} \} $\Rightarrow$ \textcode{B} $\in$ \{ \textcode{pathA},\textcode{noPathA} \} \item[ii.] \ensuremath{\omega}(\text{\textcode{B}}| \text{\textcode{C}}) $\in$ \{ \textcode{pathL}, \textcode{noPathL} \text{\textcode{pathR} }, \textcode{noPathR} \} \item[] $\Rightarrow$ \textcode{B} $\in$ \{ \textcode{pathL}, \textcode{noPathL}, \textcode{pathR}, \textcode{noPathR} \} \item[iii.] \ensuremath{\omega}(\text{\textcode{B}}| \text{\textcode{C}}) $\in$ \{\textcode{marker}, \textcode{noMarker}\} \item[] $\Rightarrow$ \textcode{B} $\in$ \{ \textcode{marker},\textcode{noMarker}\} \end{enumerate} \item[(\ensuremath{\Delta_{6}})] $\text{For each }\text{\textoverline{\textcode{A}}} \in \text{\textcode{Q}}$, \ensuremath{\textsc{ActionEdits}}(\textoverline{\textcode{A}}, $\ensuremath{\omega}(\textoverline{\textcode{A}}| \text{\textcode{C}})$). \item[] \quad Only one block has actions added to them at a time. \vspace{-0.8em} \end{enumerate} \end{boxcode} \vspace{-3mm} \caption{Sketch Constraint Types} \label{fig:mutation.3} } \end{subfigure} \end{minipage} \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.75}{0.7} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ \quad \quad \textsf{move}\xspace\\ \quad \quad \textsf{If}\xspace\textcode{(}\textcode{pathLeft}\textcode{)\{}\\ \quad \quad \quad \textcode{turnLeft}\\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \\ \end{boxcode} \vspace{-2mm} \caption{Solution code \text{\textcode{C}}\textsuperscript{in}} \label{fig:mutation.4} } \end{subfigure} \begin{subfigure}[b]{.22\textwidth} \centering { \begin{boxcode}{3.8cm}{0.72}{0.65} \textcode{def }\textcode{\textsc{Run}}\textcode{()\{}\\ {\small \quad $\text{\textcode{A}}^{1}_{1}$, $\text{\textcode{A}}^{2}_{1}$ \textcolor{blue}{(\textcolor{blue}{\textoverline{\textcode{A}}}\textsubscript{1})} } \\ \quad \textsf{repeatUntilGoal}\xspace\textcode{(}\textcode{goal}\textcode{)\{}\\ {\small \quad \quad $\text{\textcode{A}}^{1}_{2}$, $\text{\textcode{A}}^{2}_{2}$, $\text{\textcode{A}}^{3}_{2}$, $\text{\textcode{A}}^{4}_{2}$, $\text{\textcode{A}}^{5}_{2}$ \textcolor{blue}{(\textcolor{blue}{\textoverline{\textcode{A}}}\textsubscript{2})} } \\ \quad \quad \textsf{If}\xspace\textcode{(}$\text{\textcode{B}}_{1}$\textcode{)\{}\\ {\small \quad \quad \quad $\text{\textcode{A}}^{1}_{3}$, $\text{\textcode{A}}^{2}_{3}$, $\text{\textcode{A}}^{3}_{3}$, $\text{\textcode{A}}^{4}_{3}$, $\text{\textcode{A}}^{5}_{3}$ \textcolor{blue}{(\textcolor{blue}{\textoverline{\textcode{A}}}\textsubscript{2})} } \\ \quad \quad \textcode{\}}\\ \quad \textcode{\}}\\ \textcode{\}} \\ \end{boxcode} \vspace{-2mm} \caption{Sketch \textcode{Q}\textsuperscript{in}} \label{fig:mutation.5} } \end{subfigure} \begin{subfigure}[b]{0.50\textwidth} \centering { \begin{boxcode}{8.8cm}{0.75}{1.0} \textbf{Input}: \text{\textcode{C}}\textsuperscript{in}, $\text{\textcode{Q}}^\text{in}$, \ensuremath{\omega}($.| \text{\text{\textcode{C}}}^\text{in}$) = ($\phi$ , $\text{\textsf{move}\xspace}$, $\text{\textsf{turnL}\xspace}$, \textcode{pathL}), \\ \qquad \quad $\delta_\text{thresh} = 2$ \begin{enumerate} \item[(\ensuremath{\Delta_1})] $\text{\textoverline{\textcode{A}}}_{1}$, $\textoverline{\textcode{A}}_{2}$, $\textoverline{\textcode{A}}_{3}$ is minimal \item[(\ensuremath{\Delta_2})] $\text{\textoverline{\textcode{A}}}_{3}$ in \textnormal{bool } $\text{\textcode{B}}_{1} = \text{\textcode{pathL}}$ \begin{itemize} \item[] $\exists \text{\textcode{A}}_{3i} \in \{ \text{\textcode{A}}_{31}, \ldots , \text{\textcode{A}}_{35}\}$ s.t ($\text{\textcode{A}}_{3i} = $ \textsf{turnL}\xspace \item[] $\land \text{ } \forall \text{\textcode{A}}_{3j} \in \{ \text{\textcode{A}}_{31}, \ldots , \text{\textcode{A}}_{3i} \}$ $\text{\textcode{A}}_{3j}$ $\notin$ \{\textsf{move}\xspace, \textcode{turnR} \}) \end{itemize} \item[(\ensuremath{\Delta_2})] $\text{\textoverline{\textcode{A}}}_{3}$ in \textnormal{bool } $\text{\textcode{B}}_{1} = \text{\textcode{pathR}}$ \begin{itemize} \item[]$\exists \text{\textcode{A}}_{3i} \in \{ \text{\textcode{A}}_{31}, \ldots , \text{\textcode{A}}_{35}\}$ s.t ($\text{\textcode{A}}_{3i} = $ \textcode{turnR} \item[] $\land \text{ } \forall \text{\textcode{A}}_{3j} \in \{ \text{\textcode{A}}_{31}, \ldots , \text{\textcode{A}}_{3i} \}$ $\text{\textcode{A}}_{3j} \notin $ \{\textsf{move}\xspace, \textsf{turnL}\xspace \}) \end{itemize} \item[(\ensuremath{\Delta_5})] $\text{\textcode{B}}_{1}$ = \textcode{pathL} $\lor$ $\text{\textcode{B}}_{1}$ = \textcode{pathR} \item[(\ensuremath{\Delta_6})] $\ensuremath{\textsc{ActionEdits}}(\textoverline{\textcode{A}}_{1}, \ensuremath{\omega}(\textoverline{\textcode{A}}_{1}| \text{\textcode{C}}^\text{in}))$, $\ensuremath{\textsc{ActionEdits}}(\textoverline{\textcode{A}}_{2}, \ensuremath{\omega}(\textoverline{\textcode{A}}_{2}| \text{\textcode{C}}^\text{in}))$, \item [] \qquad $\ensuremath{\textsc{ActionEdits}}(\textoverline{\textcode{A}}_{3}, \ensuremath{\omega}(\textoverline{\textcode{A}}_{3}| \text{\textcode{C}}^\text{in}))$ \item[] \quad \quad Only one of $\textoverline{\textcode{A}}_{1}, \textoverline{\textcode{A}}_{2}, \textoverline{\textcode{A}}_{3}$ have actions added to them. \vspace{-2mm} \end{enumerate} \end{boxcode} \vspace{-3mm} \caption{Sketch \textcode{Q}-Constraints} \label{fig:mutation.6} } \end{subfigure} \caption{Illustration of Program Mutation} \label{fig:mutation} \end{figure} \section{Related Work}\label{sec.relatedwork} \paragraph{Related work. } FIRST PARAGRAPH: \begin{itemize} \item Problem generation \item Conceptual vs. procedural \item Existing works on problem generation (other than coding) and differences \end{itemize} SECOND PARAGRAPH: Existing works on problem generation for coding and differences THIRD PARAGRAPH: Existing works on visual content generation FOURTH PARAGRAPH: \begin{itemize} \item Solution synthesizer, ITS hints, feedback \item curriculum, teaching sequential tasks \cite{haug_teaching_2018} \end{itemize} \todo{Finish on page 2}
\section{Introduction} Best match graphs (BMGs) appear in mathematical biology as formal description of the evolutionary relationships within a gene family. Each vertex $x$ represents a gene and is ``colored'' by the species $\sigma(x)$ in which it resides. A directed arc connects a gene $x$ with its closest relatives in each of the other species \cite{Geiss:2019a}. The underlying graph of a BMG that contains only bi-directional arcs, that is, those arcs $(x,y)$ for which there is also an arc $(y,x)$, is known as reciprocal best match graph (RBMG). The precise definition of BMGs will be given in Section \ref{sect:prelim}. Empirically, best matches are routinely estimated by measuring and comparing the similarity of gene sequences. Measurement errors and systematic biases, however, introduce discrepancies between ``most similar genes'' extracted from data and the notion of best matches in the sense of closest evolutionary relatedness \cite{Geiss:2019a,Geiss:2020c}. While some systematic effects can be corrected directly \cite{Stadler:2020}, a residual level of error is unavoidable. It is therefore a question of considerable practical interest in computational biology whether the mathematical properties characterizing BMGs can be used to correct empirical estimates. Formally, this question amounts to a graph editing problem: Given a vertex-labeled directed graph $(G,\sigma)$, what is the minimal number of arcs that need to be inserted or deleted to convert $(G,\sigma)$ into a BMG $(G^*,\sigma)$? \begin{figure}[t] \begin{center} \includegraphics[width=0.85\linewidth]{./bmg_example.pdf} \end{center} \caption[]{An evolutionary scenario (left) consists of a gene tree $(T,\sigma)$ embedded into a species phylogeny $S$. The coloring $\sigma$ represents the species, i.e., genomes (leaves of the species tree) in which the genes (leaves of the gene tree) reside. Inner nodes of the gene tree correspond to gene duplications ($\square$) or speciation events ($\newmoon$), the latter coinciding with the inner nodes of the species tree $S$. The BMG $(G,\sigma)$ (right) depends on the topology of the gene tree (middle). A gene $y$ is a best match of $x$ ($x\rightarrow y$ in the BMG) if there is no gene $y'$ of the same color that has a lower last common ancestor with $x$ than $y$. For instance, $b_1$ but not $b_2$ is a best match for $a_1$ in the blue species.} \label{fig:bmg_example} \end{figure} Best matches are, in particular, closely linked to the identification of orthologous genes, i.e., pairs of genes whose last common ancestor coincides with the divergence of two species \cite{Fitch:70}. Orthologous genes from different species are expected to have essentially the same biological functions. Thus, considerable efforts have been expended to devise methods for orthology assessment, see e.g.\ \cite{Sonnhammer:14,Altenhoff:16,Setubal:18a} for reviews and applications. The orthology graph of a gene family (with the genes as vertices and undirected edges between orthologous genes) can be shown to be a subgraph of the reciprocal best match graph (RBMG), i.e., the symmetric part of the BMG \cite{Geiss:2020c}. This has sparked interest in a characterization of RBMGs \cite{Geiss:2020b} and the corresponding graph editing problems \cite{Hellmuth:2020a}. The deletion and the editing problems of 2-colored RBMGs are equivalent to \PROBLEM{Bicluster Deletion} and \PROBLEM{Bicluster Editing}, respectively, a fact that was used to demonstrate NP-hardness for the general, $\ell$-colored case. On the other hand, orthology graphs are cographs \cite{Hellmuth:13a}. \PROBLEM{Cograph Editing} or \PROBLEM{Cograph Deletion} thus have been used to correct empirical approximations of RBMGs to orthology graphs in \cite{Hellmuth:15}. Several related problems have been discussed in the literature, often aiming at using additional biological information as part of the graph modification process, cf.\ eg.\ \cite{Natanzon:2001,lafond2013gene,lafond2014orthology, lafond2016link,dondi2017approximating}. Both \PROBLEM{Cograph Editing} and \PROBLEM{Cograph Deletion} are NP-complete \cite{Liu:2012}. In \cite{Schaller:2020}, we showed that knowledge of BMG makes it possible to identify the edges of the RBMG that cannot be part of the orthology graph and found that these edges in general do not form an optimal solution of either \PROBLEM{Cograph Editing} or \PROBLEM{Cograph Deletion}. This observation suggests to correct the empirical similarity data at the outset by editing them to the nearest BMGs instead of operating on an empirical approximation of the RBMG. Given a BMG, the orthology graph can then be computed in polynomial time \cite{Schaller:2020}. We therefore analyze the arc modification problems for $\ell$-BMGs, that is, BMGs on $\ell$ colors. This contribution is organized as follows: After introducing some notation and reviewing some important properties of BMGs, Sec.~\ref{sec:triples} provides a characterization of BMGs in terms of triples (binary trees on three leaves) that can be derived from vertex colored graphs. Moreover, we provide in Sec.~\ref{sect:forbidden} a characterization of 2-BMGs in terms of forbidden subgraphs. We then prove in Sec.~\ref{sect:NPcomplete2} that \PROBLEM{$2$-BMG Deletion} and \PROBLEM{$2$-BMG Editing} are NP-complete by reduction from \PROBLEM{Exact 3-Cover}, and that \PROBLEM{$2$-BMG Completion} is NP-complete by reduction from \PROBLEM{Chain Graph Completion}. These results are used in Sec.~\ref{sect:NPcomplete-all} to establish NP-completeness for any fixed number $\ell\ge2$ of colors. Finally, we provide ILP solutions for the respective $\ell$-BMG modification problems in Sec.~\ref{sect:ILP}. \section{Preliminaries} \label{sect:prelim} \subsection{Notation} In this contribution, we consider simple directed graphs (digraphs) $G=(V,E)$ with vertex set $V$ and arc set $E\subseteq V\times V \setminus \{(v,v)\mid v\in V\}$. We will also write $V(G)$ and $E(G)$ when referring to the vertex and arc set, respectively, of a specific graph $G$. For a vertex $x\in V$, we say that $(y,x)$ is an \emph{in-arc} and $(x,z)$ is an \emph{out-arc}. The (weakly) connected components of $G$ are the maximal connected subgraphs of the undirected graph underlying $G$. We call $x$ a \emph{hub-vertex} of a graph $G=(V,E)$ if $(x,v)\in E$ and $(v,x)\in E$ holds for all vertices $v\in V\setminus \{x\}$. The subgraph induced by a subset $W\subseteq V$ is denoted by $G[W]$. We write $N(x):=\{z\in V\mid (x,z)\in E\}$ for the out-neighborhood and $N^-(x):=\{z\in V\mid (z,x)\in E\}$ for the in-neighborhood of $x\in V$. A graph is \emph{sink-free} if it has no vertex with out-degree zero, i.e., if $N(x)\ne\emptyset$ for all $x\in V$. We write $E\symdiff F \coloneqq (E\setminus F) \cup (F\setminus E)$ for the symmetric difference of the sets $E$ and $F$. Moreover, for a graph $G=(V,E)$ and an arc set $F$, we define the graphs $G+F\coloneqq (V, E\cup F)$, $G-F\coloneqq (V, E\setminus F)$ and $G\symdiff F\coloneqq (V, E\symdiff F)$. A \emph{vertex coloring} of $G$ is a map $\sigma: V\to M$, where $M$ is the set of \emph{colors}. A graph $G$ endowed with a vertex coloring $\sigma$ will be denoted by $(G,\sigma)$. A vertex coloring is \emph{proper} if $\sigma(x)\ne\sigma(y)$ for all $(x,y)\in E$. To avoid trivial cases, we will always assume a coloring $\sigma$ to be surjective. To this end, we define the restriction of $\sigma$ to a subset $W\subseteq V$ of vertices as $\sigma_{|W}\colon W\to \sigma(W)$ with $\sigma_{|W}(v)=\sigma(v)$ for all $v\in W$. The colored subgraph of $G$ induced by $W$ is therefore $(G[W], \sigma_{|W})$. We often write $|M|$-coloring to emphasize the number of colors in $G$. Moreover, we define $\sigma(W):=\{\sigma(v)\mid v\in W\}$. \begin{fact} Let $x$ be a hub-vertex in a properly colored graph $(G,\sigma)$. Then $x$ is the only vertex of color $\sigma(x)$ in $(G,\sigma)$. \end{fact} A phylogenetic tree $T$ (on $L$) is an (undirected) rooted tree with root $\rho_T$, leaf set $L=L(T)\subseteq V(T)$ and inner vertices $V^0(T) = V(T) \setminus L$ such that each inner vertex of T (except possibly the root) is of degree at least three. \emph{Throughout this contribution, we assume that every tree is phylogenetic.} The \emph{ancestor order} on $V(T)$ is defined such that $u\preceq_T v$ if $v$ lies on the unique path from $u$ to the root $\rho_T$, i.e., if $v$ is an ancestor of $v$. We write $u \prec_T v$ if $u \preceq_{T} v$ and $u \neq v$. If $xy$ is an edge in $T$, such that $y \prec_{T} x$, then $x$ is the \emph{parent} of $y$ and $y$ the \emph{child} of $x$. We denote by $\mathsf{child}_T(x)$ the set of all children of $x$. The set $L(T(v))$ contains of all leaves $x\preceq_T v$. For a non-empty subset $A\subseteq V\cup E$ we define $\lca_T(A)$, the \emph{last common ancestor of $A$}, to be the unique $\preceq_T$-minimal vertex of $T$ that is an ancestor of every $u\in A$. For simplicity we write $\lca_T(A)=\lca_T(x_1,\dots,x_k)$ whenever we specify a vertex set $A=\{x_1,\dots,x_k\}$ explicitly. Note that $\lca_T(x,y)$ and $\lca_T(x,z)$ are comparable for all $x,y,z\in L$ w.r.t.\ $\preceq_T$. A \emph{(rooted) triple} is a tree on three leaves and with two inner vertices. We write $xy|z$ for the triple on the leaves $x,y$ and $z$ if the path from $x$ to $y$ does not intersect the path from $z$ to the root, i.e., if $\lca_T(x,y)\prec_T \lca_T(x,z)=\lca_T(y,z)$. In this case we say that $T$ displays $xy|z$. A set $\mathscr{R}$ of triples on $L$, i.e., a set of triples $\mathscr{R}$ such that $\bigcup_{T\in\mathscr{R}} L(T)=L$, is \emph{compatible} if there is a tree with leaf set $L$ that displays every triple in $L$. If $\mathscr{R}$ is compatible, then such a tree, the \emph{Aho tree} $\Aho(\mathscr{R})$ can be constructed in polynomial time \cite{Aho:81}. For a set $L$, a set of triples $\mathscr{R}$ is \emph{strictly dense} if for all three distinct $x,y,z$ exactly one of the triples $xy|z, xz|y$ and $yz|x$ is contained in $\mathscr{R}$. In this contribution, we also consider trees that explicitly do not display certain triples. More precisely, we will need \begin{definition} Let $\mathscr{R}$ and $\mathscr{F}$ be sets of triples. The pair $(\mathscr{R},\mathscr{F})$ is called \emph{compatible} if there is a tree $T$ that displays all triples in $\mathscr{R}$ but none of the triples in $\mathscr{F}$. In the latter case, we also say that $T$ \emph{agrees with} $(\mathscr{R},\mathscr{F})$. \end{definition} \noindent The problem of deciding whether such a pair $(\mathscr{R},\mathscr{F})$ is compatible and, in particular, of finding a corresponding phylogentic tree was termed \emph{mixed triplets problem restricted to trees (MTT)} in \cite{He:06}. This work also reports a polynomial-time algorithm (also called \texttt{MTT}), which is similar to the well-known \texttt{BUILD} algorithm \cite{Aho:81}. \begin{theorem}{\cite[Thm.~1]{He:06}} Algorithm \texttt{MTT} outputs a phylogenetic tree $T$ that agrees with the pair $(\mathscr{R},\mathscr{F})$ (defined on $n$ distinct leaves) if and only if $(\mathscr{R},\mathscr{F})$ is compatible in $O(|\mathscr{R}|\cdot n+|\mathscr{F}|\cdot n \log n + n^2 \log n)$ time. \end{theorem} A tree $T$ with leaf set $L$ together with function $\sigma:L\to M$ is a \emph{leaf-colored tree}, denoted by $(T,\sigma)$. \subsection{Best match graphs} \begin{definition} Let $(T,\sigma)$ be a leaf-colored tree. A leaf $y\in L(T)$ is a \emph{best match} of the leaf $x\in L(T)$ if $\sigma(x)\neq\sigma(y)$ and $\lca(x,y)\preceq_T \lca(x,y')$ holds for all leaves $y'$ of color $\sigma(y')=\sigma(y)$. \end{definition} The graph $G(T,\sigma) = (V,E)$ with vertex set $V=L(T)$, vertex coloring $\sigma$, and with arcs $(x,y)\in E$ if and only if $y$ is a best match of $x$ w.r.t.\ $(T,\sigma)$ is known as the (colored) \emph{best match graph} (BMG) of $(T,\sigma)$ \cite{Geiss:2019a}. We call an $\ell$-colored BMG simply $\ell$-BMG. Since the last common ancestors of any two vertices of $T$ always exists, and $\lca_T(x,y)$ and $\lca_T(x,z)$ are comparable, there is by definition at least one best match of $x$ for every color $s\in\sigma(V)\setminus\{\sigma(x)\}$: \begin{fact} For every vertex $x$ and every color $s\in\sigma(V(G))\setminus\{\sigma(x)\}$ in a BMG $(G,\sigma)$, there is some vertex $y\in N(x)$ with $\sigma(y)=s$. \label{fact:allcolors-out} \end{fact} Equivalently, the subgraph induced by every pair of colors is sink-free. In particular, therefore, BMGs are sink-free whenever they contain at least two colors. We note in passing that sink-free graphs also appear naturally e.g.\ in the context of graph semigroups \cite{Abrams:10} and graph orientation problems \cite{Cohn:02}. \begin{definition} Let $(G,\sigma)$ be a colored graph. The coloring $\sigma$ is \emph{sink-free} if it is proper and, for every vertex $x$ and every color $s\in\sigma(V(G))\setminus\{\sigma(x)\}$, there is a vertex $y\in N(x)$ with $\sigma(y)=s$. A graph with a sink-free coloring is \emph{sf-colored}. \end{definition} The definition of BMGs together with Obs.~\ref{fact:allcolors-out} implies that BMGs are always sf-colored. \begin{definition}\label{def:BestMatchGraph} An arbitrary vertex-colored graph $(G,\sigma)$ is a \emph{best match graph (BMG)} if there exists a leaf-colored tree $(T,\sigma)$ such that $(G,\sigma) = G(T,\sigma)$. In this case, we say that $(T,\sigma)$ \emph{explains} $(G,\sigma)$. \end{definition} Whether two vertices $x$ and $y$ are best matches or not does not depend on the presence or absence of vertices $z$ with $\sigma(z)\notin\{\sigma(x),\sigma(y)\}$. More precisely, we have \begin{fact}{\cite[Obs.~1]{Geiss:2019a}} \label{obs:color-restriction} Let $(G,\sigma)$ be a BMG explained by $(T,\sigma)$ with leaf set $L$ and let $L'\coloneqq \bigcup_{s\in M'} L[s]$ be a subset of vertices with a restricted color set $M'\subseteq \sigma(L)$. Then the induced subgraph $(G[L'],\sigma_{|L'})$ is explained by the restriction $T_{|L'}$ of $T$ to the leaf set $L'$, i.e. $(G[L'],\sigma_{|L'})=G(T_{|L'},\sigma_{|L'})$. \end{fact} It was shown in \cite{Geiss:2019a} that BMGs can be characterized in terms of certain induced subgraphs on three vertices. These can be specificed as follows \cite{Schaller:2020}: \begin{definition}\label{def:informative_triples} Let $(G,\sigma)$ be a vertex colored graph. We say that a triple $xy|y'$ is \emph{informative} for $(G,\sigma)$ if $x$, $y$ and $y'$ are pairwise distinct vertices in $G$ such that (i) $\sigma(x)\neq\sigma(y)=\sigma(y')$ and (ii) $(x,y)\in E(G)$ and $(x,y')\notin E(G)$. The set of informative triples is denoted by $\mathscr{R}(G,\sigma)$. \end{definition} As shown in \cite{BMG-corrigendum}, BMGs can be characterized in terms of informative triples. \begin{theorem}{\cite[Thm.~15]{BMG-corrigendum}} A colored digraph $(G,\sigma)$ is an $n$-cBMG if and only if $G(\Aho(\mathscr{R}(G,\sigma)),\sigma) = (G,\sigma)$. \label{thm9_new} \end{theorem} However, for our purposes, it will be convenient to avoid the construction of the Aho tree. In Sec.~\ref{sec:triples}, we will establish an alternative characterization, which will depend on the following two technical results: \begin{lemma}{\cite[Lemma~5 and~6]{Schaller:2020}} \label{lem:informative_triples} Let $(G,\sigma)$ be a BMG and $xy|y'$ an informative triple for $G$. Then, every tree $(T,\sigma)$ that explains $(G,\sigma)$ displays the triple $xy|y'$, i.e. $\lca_T(x,y)\prec_T\lca_T(x,y')=\lca_T(y,y')$. Moreover, if the triples $ab|b'$ and $cb'|b$ are informative for $(G,\sigma)$, then every tree $(T,\sigma)$ that explains $(G,\sigma)$ contains two distinct children $v_1,v_2\in \mathsf{child}_T(\lca_T(a,c))$ such that $a,b\prec_T v_1$ and $b',c\prec_T v_2$. \end{lemma} \begin{lemma}{\cite[Prop.\ 1]{Geiss:2019a}} The disjoint union of vertex disjoint BMGs $(G_i, \sigma_i)$, $1\leq i\leq k$, is a BMG if and only if all color sets are the same, i.e., $\sigma_i(V(G_i)) = \sigma_j(V(G_j))$ for $1\leq i< j\leq k$. \label{lem:BMGunion} \end{lemma} \subsection{Neighborhoods in BMGs} A graph is \emph{thin} if no two vertices have the same neighborhood. \begin{definition}\label{def:rthin} Two vertices $x,y\in L$ are in relation $\mathrel{\mathrel{\ooalign{\hss\raisebox{-0.17ex}{$\sim$}\hss\cr\hss\raisebox{0.720ex}{\scalebox{0.75}{$\bullet$}}\hss}}}$ if $N(x)=N(y)$ and $N^-(x)=N^-(y)$. \end{definition} Clearly the \emph{thinness relation} $\mathrel{\mathrel{\ooalign{\hss\raisebox{-0.17ex}{$\sim$}\hss\cr\hss\raisebox{0.720ex}{\scalebox{0.75}{$\bullet$}}\hss}}}$ is an equivalence relation on $V$. For each $\mathrel{\mathrel{\ooalign{\hss\raisebox{-0.17ex}{$\sim$}\hss\cr\hss\raisebox{0.720ex}{\scalebox{0.75}{$\bullet$}}\hss}}}$ class $\alpha$ we have $N(\alpha)=N(x)$ and $N^-(\alpha) = N^-(x)$ for all $x\in\alpha$. The following characterization of 2-BMGs makes use of the structure of the trees by which they are explained. These properties can be expressed in terms of properties of the vertex neighborhoods in the 2-BMGs. While they can be tested in polynomial time, they are far from being intuitive. We refer to \cite{Geiss:2019a} for a detailed discussion. \begin{theorem}{\cite[Thm.~3 and 4]{Geiss:2019a}} \label{thm:charact-2BMG} Let $(G,\sigma)$ be a connected properly 2-colored digraph. Then, $(G,\sigma)$ is a BMG if and only if for any two $\mathrel{\mathrel{\ooalign{\hss\raisebox{-0.17ex}{$\sim$}\hss\cr\hss\raisebox{0.720ex}{\scalebox{0.75}{$\bullet$}}\hss}}}$ classes $\alpha$ and $\beta$ of $G$ holds \begin{itemize} \setlength{\itemindent}{0.15in} \item[\AX{(N0)}] $N(\alpha)\ne\emptyset$ \item[\AX{(N1)}] $\alpha\cap N(\beta)=\beta\cap N(\alpha)=\emptyset$ implies \\ $N(\alpha) \cap N(N(\beta))=N(\beta) \cap N(N(\alpha))=\emptyset$. \item[\AX{(N2)}] $N(N(N(\alpha))) \subseteq N(\alpha)$ \item[\AX{(N3)}] $\alpha\cap N(N(\beta))=\beta\cap N(N(\alpha))=\emptyset$ and $N(\alpha)\cap N(\beta)\neq \emptyset$ implies $N^-(\alpha)=N^-(\beta)$ and $N(\alpha)\subseteq N(\beta)$ or $N(\beta)\subseteq N(\alpha)$. \end{itemize} \end{theorem} We note that \cite{Geiss:2019a} tacitly assumed \AX{(N0)}, i.e., that $(G,\sigma)$ is sink-free. \section{Characterization of BMGs in terms of triples} \label{sec:triples} In this section, we provide a novel characterization of BMGs utilizing allowed and forbidden triples. To this end, we need \begin{definition}\label{def:forbidden_triples} Let $(G,\sigma)$ be a vertex colored graph. We say that a triple $xy|y'$ is \emph{forbidden} for a graph $(G,\sigma)$ if $x$, $y$ and $y'$ are pairwise distinct vertices in $G$ such that (i) $\sigma(x)\neq\sigma(y)=\sigma(y')$ and (ii) $(x,y)\in E(G)$ and $(x,y')\in E(G)$. The set of forbidden triples of $(G,\sigma)$ is denoted by $\mathscr{F}(G,\sigma)$. \end{definition} The characterization of BMGs will make use of the following two technical results: \begin{lemma}\label{lem:forb_triples} Let $(G,\sigma)$ be a BMG explained by $(T,\sigma)$. Then, none of the triples in $\mathscr{F}(G,\sigma)$ is displayed by $(T,\sigma)$. \end{lemma} \begin{proof} Assume, for contradiction, that $(T,\sigma)$ displays $xy|y'\in \mathscr{F}(G,\sigma)$. Hence, $\lca_T(x,y)\prec_T \lca(x,y')$ and thus, $(x,y)\in E(G)$ and $(x,y')\notin E(G)$ contradicting the definition of $xy|y'$ as a forbidden triple of $(G,\sigma)$. \end{proof} \begin{lemma}\label{lem:subgraph-Aho} Let $(G,\sigma)$ be an sf-colored graph with vertex set $L$. Then for every tree $(T,\sigma)$ on $L$ displaying all triples in $\mathscr{R}(G,\sigma)$, it holds $E(G(T,\sigma))\subseteq E(G)$. \end{lemma} \begin{proof} Let $(T,\sigma)$ be a tree displaying all triples in $\mathscr{R}(G,\sigma)$ and set $E'\coloneqq E(G(T,\sigma))$ and $E\coloneqq E(G)$. First note that $(G,\sigma)$ and $G(T,\sigma)$ have the same vertex set $L$. Suppose that $(a, b)\in E'$ but $(a, b)\notin E$. Since $(G,\sigma)$ is sf-colored, vertex $a$ must have at least one out-neighbor $b'$ (distinct from $b$) of color $\sigma(b)$ in $(G,\sigma)$, i.e. $(a,b')\in E$. Hence, $(a,b')\in E$ and $(a, b)\notin E$ imply that $ab'|b$ is an informative triple of $(G,\sigma)$ and thus displayed by $T$. Therefore $\lca_T(a,b')\prec_T\lca_T(a,b)$ which, together with $\sigma(b)=\sigma(b')$, contradicts $(a,b)\in E'$. Therefore, $E'\subseteq E$. \end{proof} \begin{proposition}\label{prop:explaining-tree} Let $(G,\sigma)$ be a sf-colored graph with vertex set $L$. A leaf-colored tree $(T,\sigma)$ on $L$ explains $(G,\sigma)$ if and only if $(T,\sigma)$ agrees with $(\mathscr{R}(G,\sigma), \mathscr{F}(G,\sigma) )$. In this case, $(G,\sigma)$ is a BMG. \end{proposition} \begin{proof} First suppose that $(T,\sigma)$ explains $(G,\sigma)$, in which case $(G,\sigma)$ is a BMG. The only-if-direction now immediately follows from Lemmas~\ref{lem:informative_triples} and~\ref{lem:forb_triples}. Now suppose that there is a tree $(T,\sigma)$ on $L$ that displays all triples in $\mathscr{R}(G,\sigma)$ and none of the triples in $\mathscr{F}(G,\sigma)$. Hence, we can apply Lemma~\ref{lem:subgraph-Aho} to conclude that $E'\coloneqq E(G(T,\sigma)) \subseteq E(G)\eqqcolon E$. Note that $(G,\sigma)$ and $G(T,\sigma)$ have the same vertex set $L$. We show that $E'=E$. Assume, for contradiction, that $E'\subset E$, and thus, that there is an $(a,b)\in E\setminus E'$. By Obs.~\ref{fact:allcolors-out} and since $G(T,\sigma)$ is a BMG, vertex $a$ must have at least one out-neighbor $b'$ of color $\sigma(b)$. Hence, there is an arc $(a,b')\in E'$. Thus, $ab'|b$ is an informative triple of $G(T,\sigma)$ and must therefore be displayed by $T$. Moreover, $(a,b')\in E'$ and $E'\subset E$ imply $(a,b')\in E$. Hence, $(a,b), (a,b')\in E$ implies that $ab'|b$ is a forbidden triple of $(G,\sigma)$ and thus, not displayed by $T$ by assumption; a contradiction. Therefore, $E=E'$ must hold and thus, $G(T,\sigma) = (G,\sigma)$ which, in particular, implies that $(G,\sigma)$ is a BMG. \end{proof} \begin{theorem}\label{thm:BMG-charac-via-R-F} A vertex colored graph $(G,\sigma)$ is a BMG if and only if (i) $(G,\sigma)$ is sf-colored and (ii) $(\mathscr{R}(G,\sigma),\mathscr{F}(G,\sigma))$ is compatible. \end{theorem} \begin{proof} First suppose that $(G,\sigma)$ is a BMG. The definition of BMGs together with Obs.\ \ref{fact:allcolors-out} implies that $(G,\sigma)$ is sf-colored. Thus, there is a tree $(T,\sigma)$ that explains $(G,\sigma)$. By Lemmas~\ref{lem:informative_triples} and~\ref{lem:forb_triples}, $(T,\sigma)$ displays all triples in $\mathscr{R}(G,\sigma)$ and none of the triples in $\mathscr{F}(G,\sigma)$. Hence, the pair $(\mathscr{R}(G,\sigma),\mathscr{F}(G,\sigma))$ is compatible. For the converse, suppose that $(G,\sigma)$ is a sf-colored graph and that $(\mathscr{R}(G,\sigma),\mathscr{F}(G,\sigma))$ is compatible. The latter implies that there is a tree $(T,\sigma)$ on $L$ displaying all triples in $\mathscr{R}(G,\sigma)$ and none of the triples in $\mathscr{F}(G,\sigma)$. Now, we can apply Prop.~\ref{prop:explaining-tree} to conclude that $(G,\sigma)$ is a BMG. \end{proof} In order to use the \texttt{MTT} algorithm \cite{He:06} to recognize BMGs $(G,\sigma)$, we show for completeness that the set of allowed and forbidden triples already determines $V(G)$ except for trivial cases. \begin{lemma}\label{lem:no-vertex-lost} Let $(G,\sigma)$ be a sf-colored graph, $V(G)\neq \emptyset$ and $L'\coloneqq\bigcup_{t\,\in\, \mathscr{R}(G,\sigma)\,\cup\,\mathscr{F}(G,\sigma)} L(t)$. Then the following statements are equivalent: \begin{enumerate}[noitemsep] \item $L'=V(G)$ \item $\mathscr{R}(G,\sigma)\cup\mathscr{F}(G,\sigma)\ne\emptyset$ \item $(G,\sigma)$ is $\ell$-colored with $\ell\geq 2$ and contains two vertices of the same color. \end{enumerate} \noindent Otherwise, $(G,\sigma)$ is a BMG that is explained by any tree $(T,\sigma)$ on $V(G)$. \end{lemma} \begin{proof} The fact that $L'=V(G)\neq \emptyset$ immediately implies that $\mathscr{R}(G,\sigma)\cup\mathscr{F}(G,\sigma)$ must not be empty. Hence, (1) implies~(2). Suppose Condition~(2) is satisfied. Since all triples $xy|y'\in \mathscr{R}(G,\sigma)\cup\mathscr{F}(G,\sigma)$ satisfy $\sigma(x)\ne\sigma(y)=\sigma(y')$, Condition (3) must be satisfied. Hence, (2) implies~(3). Suppose Condition~(3) is satisfied. Hence, there are two vertices of the same color $r$ and there must be a vertex $x\in V(G)$ with $\sigma(x)\ne r$. Since $(G,\sigma)$ is sf-colored, there is a vertex $y\in V(G)$ of color $r$ such that $(x,y)\in E(G)$. Now let $y'\in V(G)$, $y'\neq y$ be one of the additional vertices of color $\sigma(y')=r$. If $(x,y')\notin E(G)$ then $xy|y'\in\mathscr{R}(G,\sigma)$ and, otherwise, if $(x,y')\in E(G)$ then $xy|y'\in\mathscr{F}(G,\sigma)$. In summary, every vertex $x$ of $(G,\sigma)$ is part of some informative or forbidden triple and thus, $L'=V(G)$. Hence, (3) implies~(1). Finally, suppose that none of the equivalent statements~(1), (2), and~(3) holds. Then $(G,\sigma)$ is either 1-colored and thus, does not contain any arc, or $|V(G)|$-colored in which case $(G,\sigma)$ is a complete graph. In both cases, the tree topology of $(T,\sigma)$ does not matter. \end{proof} It is straightforward to test whether a vertex colored graph $(G,\sigma)$ is sf-colored in $O(|E(G)|)$ time. Moreover, \texttt{MTT} \cite{He:06} accomplishes the compatibility check of $(\mathscr{R}(G,\sigma),\mathscr{F}(G,\sigma))$ and the construction of a corresponding tree in polynomial time. If $\mathscr{R}(G,\sigma)\cup\mathscr{F}(G,\sigma)=\emptyset$, $(G,\sigma)$ is a BMG. Otherwise, Lemma~\ref{lem:no-vertex-lost} implies that every vertex in the sf-colored graph $(G,\sigma)$ appears in an informative and/or a forbidden triple. Together with Prop.~\ref{prop:explaining-tree} and Thm.~\ref{thm:BMG-charac-via-R-F}, this implies \begin{corollary}\label{cor:bmg-rec-polytime} It can be determined in polynomial time whether a vertex colored graph $(G,\sigma)$ is a BMG. In the affirmative case, a tree that explains $(G,\sigma)$ can constructed in polynomial time. \end{corollary} \section{Forbidden induced subgraphs of 2-BMGs} \label{sect:forbidden} In this section, we derive a new characterization of 2-colored BMGs in terms of forbidden induced subgraphs. Our starting point is the observation that certain constellations of arcs on four or five vertices cannot occur. \begin{definition}[F1-, F2-, and F3-graphs]\par\noindent \begin{itemize} \item[\AX{(F1)}] A properly 2-colored graph on four distinct vertices $V=\{x_1,x_2,y_1,y_2\}$ with coloring $\sigma(x_1)=\sigma(x_2)\ne\sigma(y_1)=\sigma(y_2)$ is an \emph{F1-graph} if $(x_1,y_1),(y_2,x_2),(y_1,x_2)\in E$ and $(x_1,y_2),(y_2,x_1)\notin E$. \item[\AX{(F2)}] A properly 2-colored graph on four distinct vertices $V=\{x_1,x_2,y_1,y_2\}$ with coloring $\sigma(x_1)=\sigma(x_2)\ne\sigma(y_1)=\sigma(y_2)$ is an \emph{F2-graph} if $(x_1,y_1),(y_1,x_2),(x_2,y_2)\in E$ and $(x_1,y_2)\notin E$. \item[\AX{(F3)}] A properly 2-colored graph on five distinct vertices $V=\{x_1,x_2,y_1,y_2,y_3\}$ with coloring $\sigma(x_1)=\sigma(x_2)\ne\sigma(y_1)=\sigma(y_2)=\sigma(y_3)$ is an \emph{F3-graph} if $(x_1,y_1),(x_2,y_2),(x_1,y_3),(x_2,y_3)\in E$ and $(x_1,y_2),(x_2,y_1)\notin E$. \end{itemize} \label{def:forbidden-subgraphs} \end{definition} \begin{figure}[t] \begin{center} \includegraphics[width=0.85\linewidth]{./forbidden_subgraphs.pdf} \end{center} \caption[]{Templates of the three families of forbidden induced subgraphs in BMGs. Black arcs must exist, non-arcs must not exist and dashed gray arcs may or may not be present.} \label{fig:forbidden-subgraphs} \end{figure} The ``templates'' for F1-, F2-, and F3-graphs are shown in Fig.~\ref{fig:forbidden-subgraphs}. They define 8, 16, and 64 graphs by specifying the presence or absence of the 3, 4, and 6 optional (dashed) arcs, respectively, see Figs.~\ref{fig:all-F1-F2} and \ref{fig:all-F3} in the Appendix. The F1- and F2-graphs fall into a total of 16 isomorphism classes, four of which are both F1- and F2-graphs. All but one of the F3-graphs contain an F1- or an F2-graph as induced subgraph. The exception is the ``template'' of the F3-graphs without optional arcs. The 17 non-redundant forbidden subgraphs are collected in Fig.~\ref{fig:all-17}. We shall see below that they are sufficient to characterize 2-BMGs among the sink-free graphs. \begin{figure}[t] \begin{center} \includegraphics[width=0.85\linewidth]{./all17.pdf} \end{center} \caption[]{Forbidden induced subgraphs in BMGs. All F3-graphs with at least one optional arc have an induced F1- or F2-graph and thus are redundant.} \label{fig:all-17} \end{figure} \begin{lemma} \label{lem:forbidden-subgraphs} If $(G,\sigma)$ is a BMG, then it contains no induced F1-, F2-, or F3-graph. \end{lemma} \begin{proof} Let $(T,\sigma)$ be a tree that explains $(G,\sigma)$. First, assume that $(G,\sigma)$ contains an induced F1-graph, i.e., there are four vertices $x_1,x_2,y_1,y_2$ satisfying \AX{(F1)}, and let $u\coloneqq \lca_T(x_1,y_2)$. Then, $(x_1,y_1),(y_2,x_2)\in E$, $(x_1,y_2),(y_2,x_1)\notin E$ and Lemma \ref{lem:informative_triples} imply that $T$ must display the informative triples $x_1y_1|y_2$ and $y_2x_2|x_1$. Hence, $u$ must have two distinct children $v_1$ and $v_2$ such that $x_1,y_1\prec_T v_1$ and $x_2,y_2\prec_T v_2$. Therefore, $\lca_T(x_1,y_1)\preceq_T v_1 \prec_T u =\lca_T(x_2,y_1)$ and $\sigma(x_1)=\sigma(x_2)$ imply that $(y_1,x_2)\notin E(G)$; a contradiction. Next, assume that $(G,\sigma)$ contains an induced F2-graph, i.e., there are four vertices $x_1,x_2,y_1,y_2$ satisfying \AX{(F2)}. Then $(x_1,y_1)\in E$, $(x_1,y_2)\notin E$ and Lemma~\ref{lem:informative_triples} imply that $T$ displays the informative triple $x_1y_1|y_2$ and thus $\lca_T(x_1,y_1)\prec_{T}\lca_T(x_1,y_2)$. Since $(y_1,x_2)\in E$ and $\sigma(x_1)=\sigma(x_2)$, we conclude that $\lca_T(x_2,y_1)\preceq_T\lca_T(x_1,y_1)\prec_{T}\lca_T(x_1,y_2)$ and therefore also $\lca_T(x_2,y_1)\prec_T\lca_T(x_2,y_2)=\lca_T(x_1,y_2)$. Together with $\sigma(y_1)=\sigma(y_2)$, the latter contradicts $(x_2,y_2)\in E$. Finally, assume that $(G,\sigma)$ contains an induced F3-graph, i.e., there are five vertices $x_1,x_2,y_1,y_2,y_3$ satisfying \AX{(F3)}. By Lemma~\ref{lem:informative_triples}, $(x_1,y_1)\in E$ and $(x_1,y_2)\notin E$ implies that $T$ displays the triple $x_1y_1|y_2$, and $(x_2,y_2)\in E$ together with $(x_2,y_1)\notin E$ implies that $T$ displays the triple $x_2y_2|y_1$. Furthermore, $\lca_T(x_1,x_2)$ has distinct children $v_1$ and $v_2$ such that $x_1,y_1\prec_T v_1$ and $x_2,y_2\prec_T v_1$. Now since $\sigma(y_1)=\sigma(y_2)=\sigma(y_3)$, the two arcs $(x_1,y_3)$ and $(x_2,y_3)$ imply that $\lca_T(x_1,y_3)\preceq_T\lca_T(x_1,y_1)\preceq_T v_1$ and $\lca_T(x_2,y_3)\preceq_T\lca_T(x_2,y_2)\preceq_T v_2$, respectively. Since $v_1$ and $v_2$ are incomparable w.r.t.\ $\preceq_{T}$, this is a contradiction. \end{proof} \begin{lemma} \label{lem:no-Fx-implies-Nx} Let $(G,\sigma)$ be a properly 2-colored graph. Then $(G,\sigma)$ satisfies \AX{(N1)} if it does not contain an induced F1-graph, it satisfies \AX{(N2)} if it does not contain an induced F2-graph, and it satisfies \AX{(N3)} if is contains neither an induced F1-graph nor an induced F3-graph. \end{lemma} \begin{proof} We employ contraposition and thus show that $(G=(V,E),\sigma)$ contains a forbidden subgraph whenever \AX{(N1)}, \AX{(N2)} or \AX{(N3)} are violated. Assume that \AX{(N1)} is not satisfied. Thus, there are two $\mathrel{\mathrel{\ooalign{\hss\raisebox{-0.17ex}{$\sim$}\hss\cr\hss\raisebox{0.720ex}{\scalebox{0.75}{$\bullet$}}\hss}}}$-classes $\alpha$ and $\beta$ with $\alpha\cap N(\beta)=\beta\cap N(\alpha)=\emptyset$ for which $N(\alpha)\cap N(N(\beta))\neq\emptyset$ or $N(\beta)\cap N(N(\alpha))\neq\emptyset$. We can w.l.o.g.\ assume that $N(\beta)\cap N(N(\alpha))\neq\emptyset$. Note that $\alpha\cap N(\beta)=\emptyset$ implies that $(y,x)\notin E$ for all $x\in\alpha, y\in\beta$. Likewise $(x,y)\notin E$ for all $x\in\alpha, y\in\beta$, since $\beta\cap N(\alpha)=\emptyset$. Let $x_1\in\alpha$, $y_2\in\beta$ and $x_2\in N(\beta)\cap N(N(\alpha))\neq\emptyset$. It must hold $(x_1,y_2),(y_2,x_1)\notin E$ by the arguments above. Since $x_2\in N(\beta)$, we have $(y_2,x_2)\in E$. Moreover, $\sigma(x_1)=\sigma(x_2)\ne\sigma(y_2)$, since $(G,\sigma)$ is properly colored. Clearly, $x_2\in N(N(\alpha))$ implies that $N(\alpha)\ne\emptyset$. Now, let $y_1\in N(\alpha)$ be a vertex such that $(y_1,x_2)\in E$, which must exist as a consequence of $x_2\in N(N(\alpha))$. We have $(x_1,y_1)$ since $y_1\in N(\alpha)$ and thus $\sigma(y_1)=\sigma(y_2)\ne\sigma(x_1)=\sigma(x_2)$. Finally, $(y_1,x_2)\in E$ immediately implies that $y_1\ne y_2$. In summary, $(x_1,y_1),(y_1,x_2),(y_2,x_2)\in E$ and $(x_1,y_2),(y_2,x_1)\notin E$, and thus $(G,\sigma)$ contains an induced F1-graph. Now assume that \AX{(N2)} is not satisfied and thus, $N(N(N(\alpha)))\not\subseteq N(\alpha)$ for some $\mathrel{\mathrel{\ooalign{\hss\raisebox{-0.17ex}{$\sim$}\hss\cr\hss\raisebox{0.720ex}{\scalebox{0.75}{$\bullet$}}\hss}}}$-class $\alpha$. Note, the latter implies that $N(N(N(\alpha)))\neq \emptyset$. Hence, there is a vertex $y_2\in N(N(N(\alpha)))$ such that $y_2\notin N(\alpha)$. Thus, there is a vertex $x_1\in \alpha$ such that $(x_1,y_2)\notin E$. By the definition of neighborhoods and since $y_2\in N(N(N(\alpha)))$, we find vertices $y_1\in N(\alpha)$ and $x_2\in N(N(\alpha))$ such that $(x_1,y_1),(y_1,x_2),(x_2,y_2)$. Since $(G,\sigma)$ is properly colored, we must have $\sigma(x_1)=\sigma(x_2)\ne\sigma(y_1)=\sigma(y_2)$. Moreover, $(x_1,y_2)\notin E$ together with $(x_2,y_2)\in E$ and $(x_1,y_1)\in E$ implies $x_1\ne x_2$ and $y_1\ne y_2$, respectively. We conclude that the subgraph induced by $x_1,x_2,y_1,y_2$ contains an induced F2-graph. Finally, assume that \AX{(N3)} is not satisfied. Hence, there are two $\mathrel{\mathrel{\ooalign{\hss\raisebox{-0.17ex}{$\sim$}\hss\cr\hss\raisebox{0.720ex}{\scalebox{0.75}{$\bullet$}}\hss}}}$-classes $\alpha$ and $\beta$ with $\alpha\cap N(N(\beta))=\beta\cap N(N(\alpha))=\emptyset$ and $N(\alpha)\cap N(\beta)\neq \emptyset$, but (i) $N^-(\alpha)\ne N^-(\beta)$, or (ii) neither $N(\alpha)\subseteq N(\beta)$ nor $N(\beta)\subseteq N(\alpha)$. Note, $N(\alpha)\cap N(\beta)\neq \emptyset$ implies that there a vertices $x_1\in\alpha$ and $x_2\in\beta$ with $\sigma(x_1)=\sigma(x_2)$ since $(G,\sigma)$ is properly 2-colored. In particular, there must be a vertex $y_3$ with $(x_1,y_3),(x_2,y_3)\in E$ and thus $\sigma(x_1)=\sigma(x_2)\ne\sigma(y_3)$. Now consider Case~(i) and suppose that $N^-(\alpha)\ne N^-(\beta)$. Thus we can assume w.l.o.g.\ that there is a $y^*$ with $(y^*,x_2)\in E$ but $(y^*,x_1)\notin E$. Note, $(x_1,y^*)\notin E$, since otherwise $(x_1,y^*),(y^*,x_2)\in E$ would contradict $\beta\cap N(N(\alpha))=\emptyset$. Thus, $y^*\ne y_3$ since $(x_1,y^*)\notin E$ and $(x_1,y_3)\in E$. Furthermore, $\sigma(y^*)=\sigma(y_3)\ne\sigma(x_1)=\sigma(x_2)$, since $(G,\sigma)$ is properly 2-colored. In summary, $(y^*,x_2),(x_1,y_3),(x_2,y_3)\in E$ and $(y^*,x_1),(x_1,y^*)\notin E$ which implies that $(G,\sigma)$ contains an induced F1-graph. Now consider Case~(ii) and assume that it holds neither $N(\alpha)\subseteq N(\beta)$ nor $N(\beta)\subseteq N(\alpha)$. Clearly, the latter implies $N(\alpha)\neq \emptyset$ and $N(\beta)\neq \emptyset$. The latter two arguments imply that there must be two distinct vertices $y_1\in N(\alpha)\setminus N(\beta)$ and $y_2\in N(\beta)\setminus N(\alpha)$ and, therefore, $(x_1,y_1),(x_2,y_2)\in E$ and $(x_1,y_2),(x_2,y_1)\notin E$. It follows that $y_1\ne y_3$ and $y_2\ne y_3$ and $\sigma(y_1)=\sigma(y_2)=\sigma(y_3)\ne\sigma(x_1)=\sigma(x_2)$. This and $(x_1,y_1),(x_2,y_2),(x_1,y_3),(x_2,y_3)\in E$ together with $(x_1,y_2),(x_2,y_1)\notin E$ implies that $(G,\sigma)$ contains an induced F3-graph. \end{proof} Based on the latter findings we obtain here a new characterization of 2-colored BMGs that is not restricted to connected graphs. \begin{theorem} \label{thm:newCharacterizatio} A properly 2-colored graph is a BMG if and only if it is sink-free and does not contain an induced F1-, F2-, or F3-graph. \end{theorem} \begin{proof} Suppose that $(G,\sigma)$ is 2-colored BMG and $\mathfrak{C}$ be the set of its connected components. By Lemma \ref{lem:forbidden-subgraphs}, $(G,\sigma)$ does not contain an induced F1-, F2- or F3-graph. Moreover, by Lemma~\ref{lem:BMGunion}, $(G[C],\sigma_{|C})$ must be a 2-colored BMG for all $C\in \mathfrak{C}$. Hence, we can apply Thm.~\ref{thm:charact-2BMG} to conclude that each $(G[C],\sigma_{|C})$ satisfies \AX{(N0)}-\AX{(N3)}. Since every $x\in V$ is contained in some $\mathrel{\mathrel{\ooalign{\hss\raisebox{-0.17ex}{$\sim$}\hss\cr\hss\raisebox{0.720ex}{\scalebox{0.75}{$\bullet$}}\hss}}}$-class, \AX{(N0)} is equivalent to $N(x)\ne\emptyset$, i.e., $(G,\sigma)$ is sink-free. Now suppose that $(G,\sigma)$ is properly 2-colored and sink-free, and that it does not contain an induced F1-, F2- and F3-graph. By Lemma \ref{lem:no-Fx-implies-Nx}, $(G,\sigma)$ satisfies \AX{(N1)}-\AX{(N3)}. Thus, in particular, each connected component of $(G,\sigma)$ is sink-free and satisfies and \AX{(N1)}-\AX{(N3)}. Note, $N(x)\ne\emptyset$ implies that the connected components of $(G,\sigma)$ contain at least one arc and, by assumption, they are properly 2-colored. Moreover, this implies that \AX{(N0)} is satisfied for every connected component of $(G,\sigma)$. Hence, Thm.~\ref{thm:charact-2BMG} implies that every connected component of $(G,\sigma)$ is a 2-colored BMG. By Lemma \ref{lem:BMGunion}, $(G,\sigma)$ is also a 2-colored BMG. \end{proof} \section{Complexity of 2-BMG modification problems} \label{sect:NPcomplete2} In real-live applications, we have to expect that graphs estimated from empirical best match data will contain errors. Therefore, we consider the problem of correcting erroneous and/or missing arcs. Formally, we consider the following graph modification problems for properly colored digraphs. \begin{problem}[\PROBLEM{$\ell$-BMG Deletion}]\ \\ \begin{tabular}{ll} \emph{Input:} & A properly $\ell$-colored digraph $(G =(V,E),\sigma)$ and an integer $k$.\\ \emph{Question:} & Is there a subset $F\subseteq E$ such that $|F|\leq k$ and $(G- F,\sigma)$ is an $\ell$-BMG? \end{tabular} \end{problem} It is worth noting that \PROBLEM{$\ell$-BMG Deletion} does not always have a feasible solution. In particular, if $(G,\sigma)$ contains a sink, no solution exits for any $\ell>1$ as a consequence of Thm.~\ref{thm:BMG-charac-via-R-F} and the fact that we only delete arcs. In contrast, it is always possible to obtain a BMG from a properly colored digraph $(G,\sigma)$ if arc insertions are allowed. To see this, observe that the graph $(G',\sigma)$ with $V(G')=V(G)$ that contains all arcs between vertices of different colors is a BMG, since it is explained the tree with leaf set $V(G')$ in which all leaves are directly attached to the root. This suggests that the following two problems are more relevant for practical applications: \begin{problem}[\PROBLEM{$\ell$-BMG Editing}]\ \\ \begin{tabular}{ll} \emph{Input:} & A properly $\ell$-colored digraph $(G =(V,E),\sigma)$ and an integer $k$.\\ \emph{Question:} & Is there a subset $F\subseteq V\times V \setminus \{(v,v)\mid v\in V\}$ such that $|F|\leq k$\\ & and $(G\symdiff F,\sigma)$ is an $\ell$-BMG? \end{tabular} \end{problem} \begin{problem}[\PROBLEM{$\ell$-BMG Completion}]\ \\ \begin{tabular}{ll} \emph{Input:} & A properly $\ell$-colored digraph $(G =(V,E),\sigma)$ and an integer $k$.\\ \emph{Question:} & Is there a subset $F\subseteq V\times V \setminus (\{(v,v)\mid v\in V\} \cup E)$ such that $|F|\leq k$\\ & and $(G+ F,\sigma)$ is an $\ell$-BMG? \end{tabular} \end{problem} In this section, we consider decision problems related to modifying $2$-colored digraphs. The general case with an arbitrarily large number $\ell\ge2$ of colors will be the subject of the following section. For $\ell=2$, we will show that both \PROBLEM{$2$-BMG Deletion} and \PROBLEM{$2$-BMG Editing} are NP-complete by reduction from the \PROBLEM{Exact 3-Cover} problem (\PROBLEM{X3C}), one of Karp's famous 21 NP-complete problems \cite{Karp1972}. \begin{problem}[\PROBLEM{Exact 3-Cover (X3C)}]\ \\ \begin{tabular}{ll} \emph{Input:} & A set $\mathfrak{S}$ with $|\mathfrak{S}|=3t$ elements and a collection $\mathcal{C}$ of 3-element subsets of $\mathfrak{S}$.\\ \emph{Question:} & Does $\mathcal{C}$ contain an exact cover for $\mathfrak{S}$, i.e., a subcollection $\mathcal{C}'\subseteq\mathcal{C}$ such that \\ & every element of $\mathfrak{S}$ occurs in exactly one member of $\mathcal{C}'$? \end{tabular} \end{problem} \noindent An exact 3-cover $\mathcal{C}'$ of $\mathfrak{S}$ with $|\mathfrak{S}|=3t$ is necessarily of size $|\mathcal{C}'|=t$ and satisfies $\bigcup_{C\in\mathcal{C}'}C=\mathfrak{S}$. \begin{theorem}{\cite{Karp1972}} \PROBLEM{X3C} is NP-complete. \label{thm:NPc-X3c} \end{theorem} In the following, we will make extensive use of properly 2-colored digraphs that contain all possible arcs: \begin{definition} A \emph{bi-clique} of a colored digraph $(G,\sigma)$ is a subset of vertices $C\subseteq V(G)$ such that (i) $|\sigma(C)|=2$ and (ii) $(x,y)\in E(G[C])$ if and only if $\sigma(x)\ne\sigma(y)$ for all $x,y\in C$. A colored digraph $(G,\sigma)$ is a \emph{bi-cluster graph} if all its connected components are bi-cliques. \end{definition} \begin{figure}[t] \begin{center} \includegraphics[width=0.18\linewidth]{./colored_clique_3_3.pdf} \end{center} \caption[]{A (sub)graph induced by a bi-clique consisting of 3 $\mathrm{black}$ and 3 $\mathrm{white}$ vertices. It has 18 arcs in total.} \label{fig:colored_clique_3_3} \end{figure} In a bi-clique, all arcs between vertices of different color are present. Thus a bi-clique with $n$ and $m$ vertices in the two color classes has $2nm$ arcs, see Fig.~\ref{fig:colored_clique_3_3} for the case $n=m=3$. We emphasize that, in contrast to the definition used in \cite{Hellmuth:2020a}, single vertex graphs are not considered as bi-clique. \begin{figure}[t] \begin{center} \includegraphics[width=0.75\linewidth]{./component_tree.pdf} \end{center} \caption[]{A tree $(T,\sigma)$ whose BMG $G(T,\sigma)$ contains bi-cliques $X$ and $Y_1,\dots,Y_n$. The thick gray arrows indicate that all arcs in that direction exist between the respective sets.} \label{fig:component_tree} \end{figure} We start with a simple construction of a subclass of BMGs from disconnected 2-colored bi-cluster graph: \begin{lemma}\label{lem:BMGspecial} Let $(G,\sigma)$ be a 2-colored bi-cluster graph with at least two connected components, let $\mathfrak{C}$ be the set of connected components of $(G,\sigma)$, and fix one of these connected components $X\in \mathfrak{C}$. Now, let $(G',\sigma)$ be the graph obtained from $(G,\sigma)$ by adding all arcs $(x,y)$ with $x\in X$ and $y\in\bigcup_{Y\in \mathfrak{C}\setminus \{X\}} Y$ for which $\sigma(x)\neq\sigma(y)$. Then $(G',\sigma)$ is a BMG. \end{lemma} \begin{proof} To see that $(G',\sigma)$ is a BMG it suffices to show that there is a tree $(T,\sigma)$ that explains $(G',\sigma)$. To this end, consider the tree $(T,\sigma)$ as shown in Fig.~\ref{fig:component_tree} and its BMG $G(T,\sigma)$. Observe first that, for all $x,y\in X$, it holds $\lca_T(x,y)=\rho = \lca_T(x,y')=\lca(x',y)$ for all $x',y'\in L(T)$. Hence, $X$ is a bi-clique and there are arcs from all vertices in $X$ to all vertices of distinct color in $Y_i \in \mathfrak{C}\setminus \{X\}$. Moreover, for all $x,y\in Y_i \in \mathfrak{C}\setminus \{X\}$ it holds that $\lca_T(x,y)=v_i \preceq_T \lca_T(x,y')=\lca(x',y)$ for all $x',y'\in L(T)$. Hence, $Y_i$ is a bi-clique for all $Y_i \in \mathfrak{C}\setminus \{X\}$. Finally, for all $x,y\in Y_i \in \mathfrak{C}\setminus \{X\}$ and all $x',y'\in L(T)\setminus Y_i$ it holds $\lca_T(x,y)=v_i \prec_T \lca_T(x,y')=\lca(x',y) = \rho$ which implies that there are no arcs from vertices in $Y_i$ to vertices in $X$ and no arcs between distinct $Y_i, Y_j \in \mathfrak{C}\setminus \{X\}$. In summary, $G(T,\sigma) = (G',\sigma)$ and hence, $(G',\sigma)$ is a BMG. \end{proof} We are now in the position to prove NP-completeness of \PROBLEM{$2$-BMG Editing}. The strategy of the NP-hardness proof is very similar to the one used in \cite{El-Mallah:1988} and \cite{Liu:2012} to show the NP-hardness of \PROBLEM{Cograph Editing}. Nevertheless, although similar in fashion, our proof has subtle but important differences when compared to the proofs provided in \cite{El-Mallah:1988} and \cite{Liu:2012}. In particular, at the heart of our construction are 2-colored bi-cliques rather than complete graphs. \begin{theorem} \label{thm:2col-NP} \PROBLEM{$2$-BMG Editing} is NP-complete. \end{theorem} \begin{proof} Since BMGs can be recognized in polynomial time by Cor.~\ref{cor:bmg-rec-polytime}, the \PROBLEM{$2$-BMG Editing} problem is clearly contained in NP. To show the NP-hardness, we use reduction from \PROBLEM{X3C}. Let $\mathfrak{S}$ with $|\mathfrak{S}|=n=3t$ and $\mathcal{C}=\{C_1,\dots,C_m\}$ be an instance of \PROBLEM{X3C}. Clearly, if $m=t$ the \PROBLEM{X3C} problem becomes trivial and thus, we assume w.l.o.g.\ that $m>t$. The latter implies that every solution $\mathcal{C}'$ of \PROBLEM{X3C} satisfies $\mathcal{C}'\subsetneq\mathcal{C}$. Moreover, we assume w.l.o.g.\ that $C_i\ne C_j$, $1\leq i<j\leq m$. We construct an instance $(G=(V,E),\sigma,k)$, where $(G,\sigma)$ is colored with the two colors $\mathrm{black}$ and $\mathrm{white}$, of the \PROBLEM{$2$-BMG Editing} problem as follows: First, we construct a bi-clique $S$ consisting of a $\mathrm{black}$ vertex $s_{b}$ and a $\mathrm{white}$ vertex $s_{w}$ for every $s\in \mathfrak{S}$. Thus the subgraph induced by $S$ has $6t$ vertices and $r\coloneqq 18t^2$ arcs in total. Let $q\coloneqq 3\times[6r(m-t)+r-18t]$. For each of the $m$ subsets $C_i$ in $\mathcal{C}$, we introduce two bi-cliques $X_i$ and $Y_i$, where $X_i$ consists of $r$ $\mathrm{black}$ and $r$ $\mathrm{white}$ new vertices, and $Y_i$ consists of $q$ $\mathrm{black}$ and $q$ $\mathrm{white}$ new vertices. In addition to the arcs provided by bi-cliques constructed in this manner, we add the following additional arcs: \begin{description}[noitemsep,nolistsep] \item[--] $(x,y)$ for every $x\in X_i$ and $y\in Y_i$ with $\sigma(x)\ne\sigma(y)$ (note $(y,x)\notin E$), \item[--] $(x,s_{b})$ for every $\mathrm{white}$ vertex $x\in X_i$ and every element $s\in C_i$, and, \item[--] $(x,s_{w})$ for every $\mathrm{black}$ vertex $x\in X_i$ and every element $s\in C_i$. \end{description} This construction is illustrated in Fig.~\ref{fig:reduction}. Clearly, $(G,\sigma)$ is properly colored, and the reduction can be computed in polynomial time. \begin{figure}[ht] \begin{center} \includegraphics[width=0.65\linewidth]{./reduction.pdf} \end{center} \caption[]{Illustration of the reduction from \PROBLEM{Exact 3-Cover}. The thick gray arrows indicate that all arcs from that set to another set/vertex exist. The illustration emphasizes the analogy to \cite{El-Mallah:1988} and \cite{Liu:2012}.} \label{fig:reduction} \end{figure} We set $k\coloneqq 6r(m-t)+r-18t$ and show that there is a $t$-element subset $\mathcal{C}'$ of $\mathcal{C}$ that is a solution of \PROBLEM{X3C} if and only \PROBLEM{$2$-BMG Editing} with input $(G,\sigma,k)$ has a yes-answer. We emphasize that the coloring $\sigma$ remains unchanged in the proof below. \smallskip First suppose that \PROBLEM{X3C} with input $\mathfrak{S}$ and $\mathcal{C}$ has a yes-answer. Thus, there is a $t$-element subset $\mathcal{C}'$ of $\mathcal{C}$ such that $\bigcup_{C\in\mathcal{C}'}C=\mathfrak{S}$. We construct a set $F$ and add, for all $C_i\in\mathcal{C}\setminus\mathcal{C}'$ and all $s\in C_i$, the arcs $(x,s_{w})$ for every $\mathrm{black}$ vertex $x\in X_i$ and the arcs $(x,s_{b})$ for every $\mathrm{white}$ vertex $x\in X_i$. Since $|C_i|=3$ for every $C_i\in \mathcal{C}$ and $|\mathcal{C}\setminus\mathcal{C}'|=m-t$, the set $F$ contains exactly $6r(m-t)$ arcs, so far. Now, we add to $F$ all arcs $(s_b,s'_w)$ and $(s_w,s'_b)$ whenever the corresponding elements $s$ and $s'$ belong to distinct elements in $\mathcal{C}'$, i.e., there is no $C\in\mathcal{C}'$ with $\{s, s'\}\subset C$. Therefore, the subgraph of $G-F$ induced by $\mathfrak{S}$ is the disjoint union of $t$ bi-cliques, each consisting of exactly $3$ $\mathrm{black}$ vertices, $3$ $\mathrm{white}$ vertices, and $18$ arcs. Hence, $F$ contains, in addition to the $6r(m-t)$ arcs, further $r-18t$ arcs. Thus $|F|=k$. This completes the construction of $F$. Since $F$ contains only arcs but no non-arcs of $G$, we have $G\symdiff F = G-F$. It remains to show that $G\symdiff F$ is a BMG. To this end observe that $G\symdiff F$ has precisely $m$ connected components that are either induced by $X_i\cup Y_i$ (in case $C_i\in\mathcal{C}\setminus\mathcal{C}'$ ) or $X_i\cup Y_i\cup S'$ where $S'$ is a bi-clique containing the six vertices corresponding to the elements in $C_i\in\mathcal{C}'$. In particular, each of these components corresponds to the subgraph as specified in Lemma~\ref{lem:BMGspecial}. To see this, consider the bi-cluster graph consisting of the subgraphs induced by the bi-cliques $X_i$ and $Y_i$, and additionally $S'$ in the second case. Now fix the connected component $X_i$ of this graph, and add all arcs from the vertices in $X_i$ to differently-colored vertices in the remaining component(s). Thus, we can apply Lemma~\ref{lem:BMGspecial} to conclude that every connected component is a BMG. In particular, all of these subgraphs contain at least one $\mathrm{black}$ and one $\mathrm{white}$ vertex. Hence, Lemma~\ref{lem:BMGunion} implies that $(G\symdiff F,\sigma)$ is a BMG. \smallskip Now, suppose that \PROBLEM{2-BMG Editing} with input $(G,\sigma)$ has a yes-answer. Thus, there is a set $F$ with $|F|\le k$ such that $(G\symdiff F,\sigma)$ is a BMG. We will prove that we have to delete an arc set similar to the one as constructed above. First note that the number of vertices affected by $F$, i.e. vertices incident to inserted/deleted arcs, is at most $2k$. Since $2k<q=|\{y\in Y_i\mid \sigma(y)=\mathrm{black}\}|=|\{y\in Y_i\mid \sigma(y)=\mathrm{white}\}|$ for every $1\le i\le m$, we have at least on $\mathrm{black}$ vertex $b_i\in Y_i$ and at least one $\mathrm{white}$ vertex $w_i\in Y_i$ that are unaffected by $F$. Recall that $S$ is the bi-clique that we have constructed from a $\mathrm{black}$ vertex $s_{b}$ and a $\mathrm{white}$ vertex $s_{w}$ for every $s\in \mathfrak{S}$. We continue by proving \par\noindent \begin{claim} \label{clm:at-most-one-Xi} Every vertex $s\in S$ has in-arcs from at most one $X_i$ in $G\symdiff F$. \end{claim} \begin{claim-proof}\item \emph{Proof:} Assume w.l.o.g.\ that $s$ is $\mathrm{black}$ and, for contradiction, that there are two distinct vertices $x_1\in X_i$ and $x_2\in X_j$ with $i\ne j$ and $(x_1,s), (x_2,s)\in E\symdiff F$. Clearly, both $x_1$ and $x_2$ are $\mathrm{white}$. As argued above, there are two (distinct) $\mathrm{black}$ vertices $b_1\in Y_i$ and $b_2\in Y_j$ that are not affected by $F$. Thus, $(x_1,b_1)$ and $(x_2,b_2)$ remain arcs in $G\symdiff F$, whereas $(x_1,b_2)$ and $(x_2,b_1)$ are not arcs in $G\symdiff F$, since they do not form arcs in $G$. In summary, we have five distinct vertices $x_1,x_2,b_1,b_2,s$ with $\sigma(x_1)=\sigma(x_2)\ne\sigma(b_1)=\sigma(b_2)=\sigma(s)$, arcs $(x_1,b_1),(x_2,b_2),(x_1,s),(x_2,s)$ and non-arcs $(x_1,b_2),(x_2,b_1)$. Thus $(G\symdiff F,\sigma)$ contains an induced F3-graph. By Lemma~\ref{lem:forbidden-subgraphs}, $(G\symdiff F,\sigma)$ is not a BMG; a contradiction. \hfill$\diamond$ \end{claim-proof} By Claim~\ref{clm:at-most-one-Xi}, every vertex in $S$ has in-arcs from at most one $X_i$. Note each $X_i$ has $r$ $\mathrm{black}$ and $r$ $\mathrm{white}$ vertices. Since each element in $S$ is either $\mathrm{white}$ or $\mathrm{black}$, each single element in $S$ has at most $r$ in-arcs. Since $|S| = 2n$, we obtain at most $2rn = 2r(3t)=6rt$ such arcs in $G\symdiff F$. In $G$, there are in total $6rm$ arcs from the vertices in all $X_i$ to the vertices in $S$. By Claim \ref{clm:at-most-one-Xi}, $F$ contains at least $6r(m-t)$ deletions. It remains to specify the other at most $r-18t$ arc modifications. To this end, we show first \begin{claim} \label{clm:at-presisely-Xi} Every vertex $s\in S$ has in-arcs from precisely one $X_i$ in $G\symdiff F$. \end{claim} \begin{claim-proof}\item \emph{Proof:} Assume that there is a vertex $s\in S$ that has no in-arc from any $X_i$. Hence, to the aforementioned $6r(m-t)$ deletions we must add $r$ further deletions. However, at most $r-18t$ further edits are allowed; a contradiction. \hfill$\diamond$ \end{claim-proof} So far, $F$ contains only arc-deletions. For the next arguments, we need the following two statements: \begin{claim} \label{clm:no-insertion-XiXj} The modification set $F$ does not insert any arcs between $X_i$ and $X_j$ with $i\ne j$. \end{claim} \begin{claim-proof}\item\emph{Proof:} Assume for contradiction that $F$, and thus $G\symdiff F$, contains an arc $(x_1,x_2)$ with $x_1\in X_i$, $x_2\in X_j$ and $i\ne j$. W.l.o.g.\ assume that $x_1$ is $\mathrm{white}$ and $x_2$ is $\mathrm{black}$. As argued above there are $\mathrm{black}$, resp., $\mathrm{white}$ vertices $b, w\in Y_j$ that are unaffected by $F$. Therefore, $(x_2,w)$ and $(b,w)$ remain arcs in $G\symdiff F$, whereas $(x_1,b)$ and $(b,x_1)$ are not arcs in $G\symdiff F$ since they do not form arcs in $G$. In summary, $(x_1,x_2),(b,w),(x_2,w)$ are arcs in $G\symdiff F$ while $(x_1,b),(b,x_1)$ are not arcs in $G\symdiff F$. Since moreover $\sigma(x_1)=\sigma(w)\ne\sigma(b)=\sigma(x_2)$, $(G\symdiff F,\sigma)$ contains an induced F1-graph. By Lemma~\ref{lem:forbidden-subgraphs}, $(G\symdiff F,\sigma)$ is not a BMG; a contradiction. \hfill$\diamond$ \end{claim-proof} \par\noindent \begin{claim} \label{clm:deletions-in-S} Let $s_1,s_2\in S$ be vertices with in-arcs $(x_1,s_1)$, resp., $(x_2,s_2)$ in $G\symdiff F$ for some $x_1\in X_i$ and $x_2 \in X_j$ with $i\ne j$. Then $(s_1,s_2)$ and $(s_2,s_1)$ cannot be arcs in $G\symdiff F$. \end{claim} \begin{claim-proof}\item\emph{Proof:} Assume w.l.o.g. that $(s_1,s_2)$ is an arc in $G\symdiff F$ and that $s_1$ is $\mathrm{black}$. It follows that $x_1$ and $s_2$ are $\mathrm{white}$ and $x_2$ is $\mathrm{black}$. By construction of $G$ and by Claim~\ref{clm:no-insertion-XiXj}, we clearly have $(x_1,x_2),(x_2,x_1)\notin E\symdiff F$. In summary, we have four distinct vertices $x_1,x_2,s_1,s_2$ with $\sigma(x_1)=\sigma(s_2)\ne\sigma(s_1)=\sigma(x_2)$, arcs $(x_1,s_1),(x_2,s_2),(s_1,s_2)$ and non-arcs $(x_1,x_2),(x_2,x_1)$ in $G\symdiff F$. Thus $(G\symdiff F,\sigma)$ contains an induced F1-graph. By Lemma~\ref{lem:forbidden-subgraphs}, $(G\symdiff F,\sigma)$ is not a BMG; a contradiction. \hfill$\diamond$ \end{claim-proof} In summary, $G\symdiff F$ has the following property: Every $s\in S$ has in-arcs from exactly one $X_i$, and there are no arcs between two distinct vertices $s_1$ and $s_2$ in $S$ that have in-arcs from two different sets $X_i$ and $X_j$, respectively. Since $|C_i|=3$ for every $C_i\in\mathcal{C}$, $(G\symdiff F)[S]$ contains connected components of size at most $6$, i.e., the $\mathrm{black}$ and $\mathrm{white}$ vertex for each of the three elements in $C_i$. Hence, the maximum number of arcs in $(G\symdiff F)[S]$ is obtained when each of its connected components contains exactly these $6$ vertices and they form a bi-clique. In this case, $(G\symdiff F)[S]$ contains $18t$ arcs. We conclude that $F$ contains at least another $r-18t$ deletion arcs for $S$. Together with the at least $6r(m-t)$ deletions between the $X_i$ and the elements of $S$, we have at least $6r(m-t)+r-18t=k\geq |F|$ arc-deletions in $F$. Since $|F|\le k$ by assumption, we obtain $|F|=k$. As argued above, the subgraph induced by $S$ is a disjoint union of $t$ bi-cliques of $3$ $\mathrm{white}$ and $3$ $\mathrm{black}$ vertices each. Since all vertices of such a bi-clique have in-arcs from the same $X_i$ and these in-arcs are also in $G$, we readily obtain the desired partition $\mathcal{C}'\subset\mathcal{C}$ of $\mathfrak{S}$. In other words, the $C_i$ corresponding to the $X_i$ having out-arcs to vertices in $S$ in the edited graph $G\symdiff F$ induce an exact cover of $\mathfrak{S}$. \end{proof} The set $F$ constructed in the proof of Thm.~\ref{thm:2col-NP} contains only arc-deletions. This immediately implies \begin{corollary} \label{cor:2col-NP-deletion} \PROBLEM{$2$-BMG Deletion} is NP-complete. \end{corollary} In order to tackle the complexity of the \PROBLEM{$2$-BMG Completion}, we follow a different approach and employ a reduction from the \PROBLEM{Chain Graph Completion} problem. To this end, we need some additional notation. An undirected graph $U$ is bipartite if its vertex set can be partitioned into two non-empty disjoint sets $P$ and $Q$ such that $V(U)=P\dot\cup Q$ and every edge has one endpoint in $P$ and the other endpoint in $Q$. We write $U=(P\dot\cup Q,\widetilde{E})$ to emphasize that $\widetilde{E}$ is a set of undirected edges and that $U$ is bipartite. Furthermore, we write $N(x)$ also for the neighborhood of a vertex $x$ in an undirected graph. Thus $U$ is bipartite if and only if $x\in P$ implies $N(x)\subseteq Q$ and $x\in Q$ implies $N(x)\subseteq P$. \begin{definition}(\cite[cf.][]{Natanzon:2001,Yannakakis:1981}) An undirected, bipartite graph $U=(P\dot\cup Q,\widetilde{E})$ is a \emph{chain graph} if there is an order $\lessdot$ on $P$ such that $u\lessdot v$ implies $N(u)\subseteq N(v)$. \end{definition} The \PROBLEM{Chain Graph Completion} problem consists of finding a minimum-sized set of additional edges that converts an arbitrary undirected, bipartite graph into a chain graph. More formally, its decision version can be stated as follows: \begin{problem}[\PROBLEM{Chain Graph Completion} (\PROBLEM{CGC})]\ \\ \begin{tabular}{ll} \emph{Input:} & An undirected, bipartite graph $U=(P\dot\cup Q,\widetilde{E})$ and an integer $k$.\\ \emph{Question:} & Is there a subset $\widetilde{F}\subseteq \{\{p,q\}\mid (p,q)\in P\times Q\} \setminus \widetilde{E}$ such that $|\widetilde{F}|\leq k$ \\ & and $U'\coloneqq (P\dot\cup Q,\widetilde{E}\cup \widetilde{F})$ is a chain graph? \end{tabular} \end{problem} It is shown in \cite{Yannakakis:1981} that \PROBLEM{CGC} is NP-complete. Following \cite{Yannakakis:1981}, we say that two edges $\{u,v\}$ and $\{x,y\}$ in an undirected graph $U$ are \emph{independent} if $u,v,x,y$ are pairwise distinct and the subgraph $U[\{u,v,x,y\}]$ contains no additional edges. We will need the following characterization of chain graphs: \begin{lemma}{\cite[Lemma~1]{Yannakakis:1981}} \label{lem:independent-edges} An undirected, bipartite graph $U=(P\dot\cup Q,\widetilde{E})$ is a chain graph if and only if it does not contain a pair of independent edges. \end{lemma} \begin{theorem} \label{thm:2col-completion-NP} \PROBLEM{$2$-BMG Completion} is NP-complete. \end{theorem} \begin{proof} Since BMGs can be recognized in polynomial time by Cor.~\ref{cor:bmg-rec-polytime}, \PROBLEM{$2$-BMG Completion} is clearly contained in NP. To show NP-hardness, we use a reduction from \PROBLEM{CGC}. Let $(U=(P\dot\cup Q,\widetilde{E}),k)$ be an instance of \PROBLEM{CGC} with vertex sets $P=\{p_1,\dots,p_{|P|}\}$ and $Q=\{q_1,\dots,q_{|Q|}\}$. To construct an instance $(G=(V,E),\sigma,k)$ of the \PROBLEM{$2$-BMG Completion} problem, we set $ V = P\dot\cup Q \dot\cup R \dot\cup \{b\} \dot\cup \{w\}$ where $R=\{r_1,\dots,r_{|Q|}\}$ is a copy of $Q$. The vertices are colored $\sigma(p_i)=\sigma(r_j)=\sigma(b)=\mathrm{black}$ and $\sigma(q_i)=\sigma(w)=\mathrm{white}$. The arc set $E$ contains $(q_i,r_i)$ and $(r_i,q_i)$ for $1\le i \le |Q|$, $(p_i,w)$ for $1\le i\le |P|$, $(w,b)$ and $(b,w)$, and $(p,q)$ for every $\{p,q\}\in\widetilde{E}$. This construction is illustrated in Fig.~\ref{fig:completion-reduction}. Clearly, $(G,\sigma)$ is properly colored, and the reduction can be computed in polynomial time. Moreover, it is easy to verify that $(G,\sigma)$ is sink-free by construction, and thus, any graph $(G',\sigma)$ obtained from $(G,\sigma)$ by adding arcs is also sink-free. As above, we emphasize that the coloring $\sigma$ remains unchanged in the completion process. \begin{figure}[ht] \begin{center} \includegraphics[width=0.65\linewidth]{./completion_reduction.pdf} \end{center} \caption[]{Illustration of the reduction from \PROBLEM{CGC}. A pair of independent edges in $U$ and the corresponding induced F3-graph in $(G,\sigma)$ are highlighted.} \label{fig:completion-reduction} \end{figure} A pair $(F,\widetilde{F})$ with $F\subseteq P\times Q$ and an edge set $\widetilde{F}=\{ \{p,q\} \mid (p,q)\in F\}$ will be called a \emph{completion pair} for the bipartite graph $U=(P\dot\cup Q,\widetilde{E})$ and the corresponding 2-colored digraph $(G=(V,E),\sigma)$. \begin{claim} \label{clm:F-and-F-bar} If $(F,\widetilde{F})$ is a completion pair, then $|F|=|\widetilde{F}|$, $(p,q)\in F$ if and only if $\{p,q\}\in \widetilde{F}$, and $(p,q)\in F\cup E$ if and only if $\{p,q\}\in \widetilde{F}\cup\widetilde{E}$. \end{claim} \begin{claim-proof}\item \emph{Proof:} First note that, by construction, $F$ contains only arcs from vertices in $P$ to vertices in $Q$. This together with the definition $\widetilde{F}=\{ \{p,q\} \mid (p,q)\in F \}$ clearly implies $(p,q)\in F$ if and only if $\{p,q\}\in \widetilde{F}$ and thus $|F|=|\widetilde{F}|$. By construction of our reduction we have $(p,q)\in E$ if and only if $\{p,q\}\in \widetilde{E}$ and thus also $(p,q)\in E\cup F$ if and only if $\{p,q\}\in \widetilde{E}\cup\widetilde{F}$. \hfill$\diamond$ \end{claim-proof} Before we continue, observe that, for every pair of independent edges $\{p_1,q_1\},\{p_2,q_2\}\in\widetilde{E}$, the subgraph of $(G,\sigma)$ induced by $\{p_1,p_2,q_1,q_2,w\}$ is an F3-graph. Together with Lemmas~\ref{lem:forbidden-subgraphs} and~\ref{lem:independent-edges}, this implies that $(G,\sigma)$ cannot be a BMG if $U$ is not a chain graph. Eliminating these induced F3-graphs is closely connected to chain graph completion. More precisely we will show: \begin{claim} \label{clm:bmg-implies-chain} Let $(F,\widetilde{F})$ be a completion pair. If $(G+F,\sigma)$ is a BMG, then $U'=(P\dot\cup Q,\widetilde{E}\cup\widetilde{F})$ is a chain graph. \end{claim} \begin{claim-proof}\item \emph{Proof:} Suppose that $(G+F,\sigma)$ is a BMG and assume, for contradiction, that $U'=(P\dot\cup Q,\widetilde{E}\cup\widetilde{F})$ is not a chain graph. The latter and Lemma~\ref{lem:independent-edges} imply that $U'$ has two independent edges $\{p_1,q_1\},\{p_2,q_2\}\in\widetilde{E}\cup\widetilde{F}$. Thus $\{p_1,q_2\},\{p_2,q_1\}\notin\widetilde{E}\cup\widetilde{F}$. The latter arguments and Claim~\ref{clm:F-and-F-bar} imply that $(p_1,q_1),(p_2,q_2)\in E\cup F$ and $(p_1,q_2),(p_2,q_1)\notin E\cup F$. Since moreover $(p_1,w),(p_2,w)$ and $\sigma(p_1)=\sigma(p_2)\ne\sigma(q_1)=\sigma(q_2)=\sigma(w)$, it follows that the five distinct vertices $p_1,p_2,q_1,q_2,w$ induce an F3-graph in $(G+F,\sigma)$. By Lemma~\ref{lem:forbidden-subgraphs}, $(G+F,\sigma)$ cannot be a BMG; a contradiction. \hfill$\diamond$ \end{claim-proof} The converse is also true: \begin{claim} \label{clm:chain-implies-bmg} Let $(F,\widetilde{F})$ be a completion pair for $U=(P\dot\cup Q,\widetilde{E})$, and suppose $U'=(P\dot\cup Q,\widetilde{E}\cup\widetilde{F})$ is a chain graph. Then $(G+F,\sigma)$ is a BMG. \end{claim} \begin{claim-proof}\item \emph{Proof:} By Thm.~\ref{thm:newCharacterizatio}, $(G+F,\sigma)$ is a $2$-colored BMG if and and only if it is sink-free and does not contain an induced F1-, F2-, or F3-graph. Since $(G,\sigma)$ is sink-free, this is also true for $(G+F,\sigma)$. Thus it suffices to show that $(G+F,\sigma)$ does not contain an induced F1-, F2-, or F3-graph. Suppose that $(G+F,\sigma)[u,u',v,v']$ is an induced F1-graph. Let $H$ be a subgraph of $(G+F,\sigma)[u,u',v,v']$ that is isomorphic to the \emph{essential} F1-graph, that is, the F1-graph as specified in Fig.~\ref{fig:forbidden-subgraphs} that contains only the solid-lined arcs and none of the dashed arcs while all other non-arcs remain non-arcs. In this case, there is an isomorphism $\varphi$ from $H$ to the essential F1-graph with vertex-labeling as in Fig.~\ref{fig:forbidden-subgraphs}. Hence, $\varphi(u)$ corresponds to one of the vertices $x_1,x_2,y_1$ or $y_2$. To simplify the presentation we will say that, in this case, ``$u$ plays the role of $\varphi(u)$ in an F1-graph''. The latter definition naturally extends to $F2$- and $F3$-graphs and we will use analogous language for $F2$- and $F3$-graphs. Note, in the latter definition, it is not required that $\sigma(u) = \sigma(\varphi(u))$. Nevertheless, for $a,b\in \{u,u',v,v'\}$ with $\sigma(a)\neq \sigma(b)$ it always holds, by construction, that $\sigma(\varphi(a))\neq \sigma(\varphi(b))$. In the following, an in- or out-neighbor of a vertex is just called \emph{neighbor}. A \emph{flank vertex} in an F1-, F2-, resp., F3-graph is a vertex that has only a single neighbor in the essential F1-, F2-, resp., F3-graph. To be more precise, when referring to Fig.~\ref{fig:forbidden-subgraphs}, the flank vertices in an F1-graph and F2-graph are $x_1$ and $y_2$, while the flank vertices in an F3-graph are $y_1$ and $y_2$. Since $(F,\widetilde{F})$ is a completion pair, by definition, $F$ adds only arcs from $P$ to $Q$. Hence, each of the vertices in $R\cup\{b\}$ has a single neighbor in $(G+F,\sigma)$ irrespective of the choice of $F$. Therefore, if $u\in R\cup\{b\}$ is contained in an induced F1-, F2-, or F3-graph in $(G,\sigma)$ or $(G+F,\sigma)$, it must be a flank vertex. Observe first that $b$ can only play the role of $y_2$ in the F1- or F2-graph, since otherwise, the fact that $w$ is the single neighbor of $b$ in $(G,\sigma)$ or $(G+F,\sigma)$ implies that $w$ must play the role of $y_1$ in the F1- or F2-graph, which is not possible since $b$ is the single out-neighbor of $w$ and $F$ does not affect $w$. By similar arguments, none of the vertices in $R\cup\{b\}$ can play the role of $x_1$ in an F1- or F2-graph, or the role of $y_1$ or $y_2$ in an F3-graph in $(G,\sigma)$ or $(G+F,\sigma)$. The vertex $w$ has only in-arcs from the elements in $P$ and from $b$. Likewise, the vertices $q_i\in Q$ have only in-arcs from $P$ and from their corresponding vertex $r_i\in R$. Therefore and since all elements in $P$ have only out-neighbors, it is an easy task to verify that none of the vertices in $R\cup\{b\}$ can play the role of $y_2$ in an F1- or F2-graph. Thus none of the vertices in $R\cup\{b\}$ is part of an induced F1-, F2-, or F3-graph. Thus it suffices to investigate the subgraph $(G',\sigma)$ of $(G+F,\sigma)$ induced by $\{w\}\cup P \cup Q$ for the presence of induced F1-, F2-, and F3-graphs. In $G'$, none of the vertices in $\{w\}\cup Q$ have out-neighbors since $F\subseteq P\times Q$ does not affect $w$ and does not contain arcs from $q_i\in Q$ to any other vertex. Thus, none of the vertices in $\{w\}\cup Q$ can play the role of $x_1$, $y_1$ or $y_2$ in an F1-, the role of $x_1$, $y_1$ or $x_2$ in an F2-graph, or the role of $x_1$ or $x_2$ in an F3-graph. Since $\{w\}\cup Q$ has only in-arcs from $P$, and $P$ has no in-arcs in $G'$, none of the vertices in $\{w\}\cup Q$ can play the role of $x_2$ in an F1-graphs or the role of $y_2$ in an F2-graph. Thus none of the vertices in $\{w\}\cup Q$ is part of an induced F1- or F2-graph. Hence, any induced F1- or F2-graph must be contained in $G'[P]$. However, all vertices of $P$ are colored $\mathrm{black}$, and hence $(G'[P],\sigma_{|P})$ cannot harbor an induced F1- or F2-graph. Suppose $(G',\sigma)$ contains an induced F3-graph. Then there are five pairwise distinct vertices $x_1,x_2,y_1,y_2,y_3\in \{w\}\cup P \cup Q$ with coloring $\sigma(x_1)=\sigma(x_2)\ne\sigma(y_1)=\sigma(y_2)=\sigma(y_3)$ satisfying $(x_1,y_1),(x_2,y_2),(x_1,y_3),(x_2,y_3)\in E\cup F$ and $(x_1,y_2),(x_2,y_1)\notin E\cup F$. Since $P$ has no in-arcs in $(G',\sigma)$, it must hold that $y_1,y_2,y_3\notin P$. Since $\sigma(\{w\}\cup Q)\neq \sigma(P)$ and $(G',\sigma)$ is properly 2-colored, we have $x_1,x_2\in P$. Since $w$ has in-arcs from all vertices in $P$ and $(x_1,y_2),(x_2,y_1)\notin E\cup F$, vertex $w$ can neither play the role of $y_1$ nor of $y_2$ in an F3-subgraph. Thus, $y_1,y_2\in Q$. Claim~\ref{clm:F-and-F-bar} therefore implies $\{x_1,y_1\},\{x_2,y_2\}\in \widetilde{E}\cup\widetilde{F}$ and $\{x_1,y_2\},\{x_2,y_1\}\notin \widetilde{E}\cup\widetilde{F}$. Hence, $U'$ contains a pair of independent edges. By Lemma~\ref{lem:independent-edges}, it follows that $U'$ is not a chain graph; a contradiction. \hfill$\diamond$ \end{claim-proof} Together, Claims~\ref{clm:bmg-implies-chain} and~\ref{clm:chain-implies-bmg} imply that $(G+F,\sigma)$ is a BMG if and only if $U'=(P\dot\cup Q,\widetilde{E}\cup\widetilde{F})$ is a chain graph; see Fig.~\ref{fig:completion-tree} for an illustrative example. \begin{claim} \label{clm:minimum-arc-compl} If $F$ is a minimum-sized arc completion set such that $(G+F,\sigma)$ is a BMG, then $F\subseteq P\times Q$. \end{claim} \begin{claim-proof}\item \emph{Proof:} Let $F$ be an arbitrary minimum-sized arc completion set, i.e., $(G+F,\sigma)$ is a BMG, and put $F'\coloneqq F\cap (P\times Q)$ and let $(F',\widetilde{F'})$ be the corresponding completion pair. If $F'=F$, there is nothing to show. Otherwise, we have $|F'|<|F|$ and minimality of $|F|$ implies that $(G+F',\sigma)$ is not a BMG. By contraposition of Claim~\ref{clm:chain-implies-bmg}, we infer that $U'=(P\dot\cup Q,\widetilde{E}\cup\widetilde{F'})$ is not a chain graph. Hence, Lemma~\ref{lem:independent-edges} implies that $U'$ contains a set of independent edges $\{p_1,q_1\},\{p_2,q_2\}\in \widetilde{E}\cup\widetilde{F'}$ and $\{p_1,q_2\},\{p_2,q_1\}\notin \widetilde{E}\cup\widetilde{F'}$. By Claim~\ref{clm:F-and-F-bar}, it follows that $(p_1,q_1),(p_2,q_2)\in E\cup F'$ and $(p_1,q_2),(p_2,q_1)\notin E\cup F'$. Since $F'\subset F$, we have $(p_1,q_1),(p_2,q_2)\in E\cup F$. Furthermore, from $(p_1,q_2),(p_2,q_1)\in P\times Q$ and $F'= F\cap (P\times Q)$, we conclude that $(p_1,q_2),(p_2,q_1)\notin E\cup F$. By construction of our reduction and since we only insert arcs, we have $(p_1,w),(p_2,w)\in E\cup F$. Together with the coloring $\sigma(p_1)=\sigma(p_2)\ne\sigma(q_1)=\sigma(q_2)=\sigma(w)$, the latter arguments imply that $(G+F,\sigma)$ contains an induced F3-graph. By Lemma~\ref{lem:forbidden-subgraphs}, this contradicts that $(G+F,\sigma)$ is a BMG. \hfill$\diamond$ \end{claim-proof} Now, let $(F,\widetilde{F})$ be a completion pair such that $|\widetilde{F}|\le k$ and $\widetilde{F}$ is a minimum-sized edge completion set for $U$. Thus $U'=(P\dot\cup Q,\widetilde{E}\cup\widetilde{F})$ is a chain graph. Hence, Claim~\ref{clm:chain-implies-bmg} implies that $(G+F,\sigma)$ is a BMG. Since $|F|=|\widetilde{F}|\le k$, it follows that \PROBLEM{$2$-BMG Completion} with input $(G,\sigma,k)$ has a yes-answer if \PROBLEM{CGC} with input $(U=(P\dot\cup Q,\widetilde{E}),k)$ has a yes-answer. Finally, let $F$ be a minimum-sized arc completion set for $(G,\sigma)$, i.e.\ $(G+F,\sigma)$ is a BMG, and assume $|F|\le k$. This and Claim~\ref{clm:minimum-arc-compl} implies $F\subseteq P\times Q$. For the corresponding completion pair $(F,\widetilde{F})$ we have $|\widetilde{F}|=|F|\le k$. Moreover, since $(G+F,\sigma)$ is a BMG, Claim \ref{clm:bmg-implies-chain} implies that $U=(P\dot\cup Q,\widetilde{E}\cup \widetilde{F})$ is a chain graph. Therefore, \PROBLEM{CGC} with input $(U=(P\dot\cup Q,\widetilde{E}),k)$ has a yes-answer if \PROBLEM{$2$-BMG Completion} with input $(G,\sigma,k)$ has a yes-answer. This completes the proof. \end{proof} \begin{figure}[t] \begin{center} \includegraphics[width=0.85\linewidth]{./completion_tree.pdf} \end{center} \caption[]{An example solution for \PROBLEM{CGC}, resp., \PROBLEM{$2$-BMG Completion} as constructed in the proof of Thm.~\ref{thm:2col-completion-NP}. A tree $(T,\sigma)$ that explains the resulting BMG is shown on the right. Here, we have $k=4$ edge, resp., arc additions (indicated by dashed-gray lines) to obtain a chain-graph, resp., 2-BMG. The indices of the vertices in $P=\{p_1,\dots,p_{|P|}\}$ are chosen w.r.t.\ the order $\lessdot$ on $P$ i.e.\ $i<j$ if and only if $p_i\lessdot p_j$ and thus, $N(p_i)\subseteq N(p_j)$. In this example, we have $N(p_1)\cap Q=\emptyset$. Moreover, the vertex $q_1$ has no neighbor in $P$.} \label{fig:completion-tree} \end{figure} Not all (2-)BMGs can be explained by binary trees \cite{Schaller:2020z,Schaller:2020}. BMGs $(G,\sigma)$ for which a binary explaining tree exists have been termed \emph{binary-explainable} \cite{Schaller:2020z}. They are of practical significance because phylogenetic trees are often assumed to be binary by nature, with multifurcations arising in many cases as an artifact of insufficient data \cite{DeSalle:94,Hoelzer:94,Maddison:89}. We therefore consider the modified completion problem that, given an arbitrary properly colored digraph $(G,\sigma)$, aims to find a binary-explainable BMG: \begin{problem}[\PROBLEM{$\ell$-BMG Completion restricted to Binary-Explainable Graphs ($\ell$-BMG CBEG)}]\ \\ \begin{tabular}{ll} \emph{Input:} & A properly $\ell$-colored digraph $(G =(V,E),\sigma)$ and an integer $k$.\\ \emph{Question:} & Is there a subset $F\subseteq V\times V \setminus (\{(v,v)\mid v\in V\} \cup E)$ such that $|F|\leq k$\\ & and $(G+ F,\sigma)$ is a binary-explainable $\ell$-BMG? \end{tabular} \end{problem} \noindent The corresponding editing and deletion problems will be called \PROBLEM{$\ell$-BMG EBEG} and \PROBLEM{$\ell$-BMG DBEG}, respectively. Binary-explainable BMGs can be characterized in terms of a simple forbidden subgraph. \begin{definition} An \emph{hourglass} in a properly vertex-colored graph $(G,\sigma)$, denoted by $[xy \mathrel{\text{\ooalign{$\searrow$\cr$\nearrow$}}} x'y']$, is a subgraph $(G[Q],\sigma_{|Q})$ induced by a set of four pairwise distinct vertices $Q=\{x, x', y, y'\}\subseteq V(G)$ such that (i) $\sigma(x)=\sigma(x')\ne\sigma(y)=\sigma(y')$, (ii) $(x,y),(y,x)$ and $(x'y'),(y',x')$ are bidirectional arcs in $G$, (iii) $(x,y'),(y,x')\in E(G)$, and (iv) $(y',x),(x',y)\notin E(G)$. \end{definition} \noindent Fig.~\ref{fig:hourglass} illustrates this definition. A graph $(G,\sigma)$ is called \emph{hourglass-free} if it does not contain an hourglass as an induced subgraph. \begin{proposition}{\cite[Prop.~8]{Schaller:2020}} \label{prop:binary-iff-hourglass-free} A BMG $(G,\sigma)$ can be explained by a binary tree if and only if it is hourglass-free. \end{proposition} \begin{figure}[t] \begin{center} \includegraphics[width=0.35\linewidth]{./hourglass.pdf} \end{center} \caption[]{An hourglass (left) and the unique non-binary tree (right) that explains it.} \label{fig:hourglass} \end{figure} The reduction employed in the proof of Thm.~\ref{thm:2col-completion-NP} can be adapted to show that the \PROBLEM{$2$-BMG CBEG} problem is hard. \begin{corollary} \label{cor:2col-completion-BEG-NP} \PROBLEM{$2$-BMG CBEG} is NP-complete. \end{corollary} \begin{proof} As shown in \cite[Cor.~6]{Schaller:2020} and \cite[Cor.~3.6]{Schaller:2020z}, binary-explainable BMGs can be recognized in polynomial time. Therefore, \PROBLEM{$2$-BMG CBEG} is contained in the class NP. To show hardness of the problem, we use the same reduction from \PROBLEM{CGC} and the same arguments as in the proof of Thm.~\ref{thm:2col-completion-NP}. In addition, we observe that the hourglass $[xy \mathrel{\text{\ooalign{$\searrow$\cr$\nearrow$}}} x'y']$ contains the bidirectional arcs $(x,y)$ and $(y,x)$ and each of the two vertices $x$ and $y$ has two out-neighbors, and thus, also at least two out-neighbors in every graph that contains the hourglass as an induced subgraph. We have to show that \PROBLEM{CGC} with input $(U=(P\dot\cup Q,\widetilde{E}),k)$ has a yes-answer if and only if \PROBLEM{$2$-BMG CBEG} with input $(G,\sigma,k)$ as constructed in the proof of Thm.~\ref{thm:2col-completion-NP} has a yes-answer. Recall that by Claims~\ref{clm:bmg-implies-chain} and~\ref{clm:chain-implies-bmg}, $(G+F,\sigma)$ is a BMG if and only if $U'=(P\dot\cup Q,\widetilde{E}\cup\widetilde{F})$ is a chain graph, where $(F,\widetilde{F})$ is a completion pair. Moreover, by Claim~\ref{clm:minimum-arc-compl}, every minimum-sized arc completion set $F$ for which $(G+F,\sigma)$ is a BMG satisfies $F\subseteq P\times Q$. Therefore, we can again argue via minimal completion pairs $(F,\widetilde{F})$ to conclude that, both in the \emph{if}- and in the \emph{only-if}-direction, we have a $2$-BMG $(G+F,\sigma)$ with $F\subseteq P\times Q$, i.e., we only inserted arcs from $P$ to $Q$. Using Fig.~\ref{fig:completion-tree}, it is now easy to verify that every bidirectional pair of arcs in $(G+F,\sigma)$ is either incident to the vertex $b$ or to one of the vertices in $R$. Moreover, every vertex in $R\cup\{b\}$ has exactly one out-neighbor. The latter two arguments together with the observation that hourglasses require bidirectional arcs $(x,y),(y,x)$ such that both $x$ and $y$ have at least two out-neighbors imply that $(G+F,\sigma)$ must be hourglass-free. Therefore, $(G+F,\sigma)$ is binary-explainable by Prop.~\ref{prop:binary-iff-hourglass-free}, which completes the proof. \end{proof} Results analogous to Cor.~\ref{cor:2col-completion-BEG-NP} cannot be derived as easily for \PROBLEM{$2$-BMG EBEG} and \PROBLEM{$2$-BMG DBEG}. The reason is that the graph $(G,\sigma)$ (as well as $(G\symdiff F,\sigma)$) constructed in the proof of Thm.~\ref{thm:2col-NP} contains a large number of induced hourglasses. In particular, for every $i\in\{1,\dots,m\}$, we have that every black vertex $a\in X_i$, white vertex $b\in X_i$, black vertex $a'\in Y_i$ and white vertex $b'\in Y_i$ induce an hourglass $[ab \mathrel{\text{\ooalign{$\searrow$\cr$\nearrow$}}} a'b']$. Even though we suspect these problems to be hard as well, a different reduction will be required to prove this conjecture. \section{Complexity of $\ell$-BMG modification problems} \label{sect:NPcomplete-all} We now turn to the graph modification problems for an arbitrary number $\ell$ of colors. The proof of the next theorem follows the same strategy of adding hub-vertices as in \cite{Hellmuth:2020a}. \begin{theorem} \label{thm:ell-col-NPc} \PROBLEM{$\ell$-BMG Deletion}, \PROBLEM{$\ell$-BMG Completion}, and \PROBLEM{$\ell$-BMG Editing} are NP-complete for all $\ell\geq 2$. \end{theorem} \begin{proof} BMGs can be recognized in polynomial time by Cor.~\ref{cor:bmg-rec-polytime} and thus, all three problems are contained in the class NP. Let $(G=(V,E),\sigma)$ be a properly colored digraph with $\ell$ colors. Thm.~\ref{thm:2col-NP}, Cor.~\ref{cor:2col-NP-deletion} and Thm.~\ref{thm:2col-completion-NP} state NP-completeness for the case of $\ell=2$ colors. Thus assume $\ell\ge3$ in the following. By slight abuse of notation, we collectively refer to the three problems \PROBLEM{$\ell$-BMG Deletion}, \PROBLEM{$\ell$-BMG Completion}, and \PROBLEM{$\ell$-BMG Editing} simply as \PROBLEM{$\ell$-BMG Modification}. Correspondingly, we write $(G\odot F, \sigma)$ and distinguish the three problems by the modification operation $\odot\in\{- , +, \symdiff \}$, where $\odot=-$, $\odot=+$ and $\odot=\symdiff$ specifies that $F$ is a deletion-, completion, or edit set, respectively. We use reduction from \PROBLEM{$2$-BMG Modification}. To this end, let $(G_2=(V_2,E_2),\sigma_2,k)$ be an instance of one of the latter three problems. To obtain a properly colored graph $(G_{\ell}=(V_{\ell},E_{\ell}),\sigma_{\ell})$ with $\ell$ colors, we add to $G_2$ a set $V_H$ of $\ell-2$ new vertices with pairwise distinct colors that also do not share any colors with the vertices in $(G_2,\sigma_2)$. Moreover, we add arcs such that every $h\in V_H$ becomes a hub-vertex. Note that $V_{\ell}=V_2\dot\cup V_H$, $G_{\ell}[V_2]=G_2$, and $(\sigma_{\ell})_{|V_2}=\sigma_2$. Furthermore, $V_2$ is a subset of $V_{\ell}$ satisfying the condition in Obs.~\ref{obs:color-restriction}, i.e., $V_2= \bigcup_{s\in S_2} V_{\ell}[s]$ for the color set $S_2$ in $(G_2,\sigma_2)$. Clearly, the reduction can be performed in polynomial time. We proceed by showing that an instance $(G_2,\sigma_2,k)$ of the respective \PROBLEM{$2$-BMG Modification} problem has a yes-answer if and only if the corresponding instance $(G_{\ell},\sigma_{\ell},k)$ of \PROBLEM{$\ell$-BMG Modification} has a yes-answer. Suppose that \PROBLEM{$2$-BMG Modification} with input $(G_2,\sigma_2,k)$ has a yes-answer. Then there is an arc set $F\subseteq V_2\times V_2 \setminus \{(v,v)\mid v\in V_2\}$ with $|F|\le k$ such that $(G_2\odot F, \sigma_2)$ is a BMG. Let $(T_2,\sigma_2)$ be a tree with root $\rho$ explaining $(G_2\odot F, \sigma_2)$. Now take $(T_2,\sigma_2)$ and add the vertices in $V_H$ as leaves of the root $\rho$ and color these leaves as in $(G_{\ell},\sigma_{\ell})$, to obtain the tree $(T_{\ell},\sigma_{\ell})$. By construction, we have $L(T_{\ell})=V_{\ell}=V_2\cup V_H$ and $T_2=(T_{\ell})_{|V_2}$, where $(T_{\ell})_{|V_2}$ is the restriction of $T_{\ell}$ to the leaf set $V_2$. The latter arguments together with Obs.~\ref{obs:color-restriction} imply that $(G(T_{\ell},\sigma_{\ell})[V_2],(\sigma_{\ell})_{|V_2})= G((T_{\ell})_{|V_2},(\sigma_{\ell})_{|V_2}) =G(T_2,\sigma_2)=(G_2\odot F, \sigma_2)$. Let $h\in V_H$ be arbitrary. Since $h$ is the only vertex of its color, $(x,h)$ is an arc in $G(T_{\ell},\sigma_{\ell})$ for every $x\in V_{\ell}\setminus \{h\}$. Since $h$ is a child of the root, we have moreover $\lca_{T_{\ell}}(x,h)=\rho$, and thus, $(h,x)$ is an arc in $G(T_{\ell},\sigma_{\ell})$ for every $x\in V_{\ell}\setminus \{h\}$. The latter two arguments imply that $h$ is a hub-vertex in $G(T_{\ell},\sigma_{\ell})$. Since $F$ is not incident to any vertex in $V_{\ell}\setminus V_2=V_H$ and each vertex $h\in V_H$ is a hub-vertex in $(G_{\ell},\sigma_{\ell})$ and in $G(T_{\ell},\sigma_{\ell})$, we conclude that $G(T_{\ell},\sigma_{\ell})=(G_{\ell}\odot F,\sigma_{\ell})$. Hence, $(G_{\ell}\odot F,\sigma_{\ell})$ is a BMG and the corresponding \PROBLEM{$\ell$-BMG Modification} problem with input $(G_{\ell},\sigma_{\ell},k)$ has a yes-answer. For the converse, suppose that \PROBLEM{$\ell$-BMG Modification} with input $(G_{\ell},\sigma_{\ell},k)$ has a yes-answer. Thus, there is an arc set $F\subseteq V_{\ell}\times V_{\ell} \setminus \{(v,v)\mid v\in V_{\ell}\}$ with $|F|\le k$ such that $(G_{\ell}\odot F, \sigma_{\ell})$ is a BMG. Let $(T_{\ell},\sigma_{\ell})$ be a tree explaining $(G_{\ell}\odot F, \sigma_{\ell})$. Let $F'\subseteq F$ be the subset of arc modifications $(x,y)$ for which $x,y\in V_2$. Thus, it holds $|F'|\le|F|\le k$. By construction, $(G_{\ell}\odot F)[V_2]=G_{\ell}[V_2]\odot F'$. Moreover, by Obs.~\ref{obs:color-restriction}, we have $(G(T_{\ell},\sigma_{\ell})[V_2],(\sigma_{\ell})_{|V_2})= G((T_{\ell})_{|V_2},(\sigma_{\ell})_{|V_2})$. In summary, we obtain $(G_2\odot F',\sigma_2)=(G_{\ell}[V_2]\odot F',\sigma_2)= ((G_{\ell}\odot F)[V_2],(\sigma_{\ell})_{|V_2}) = (G(T_{\ell},\sigma_{\ell})[V_2],(\sigma_{\ell})_{|V_2}) = G((T_{\ell})_{|V_2},(\sigma_{\ell})_{|V_2})$. Thus, $(G_2\odot F',\sigma_2)$ is a BMG. Together with $|F'|\le k$, this implies that \PROBLEM{$2$-BMG Modification} with input $(G_2,\sigma_2,k)$ has a yes-answer. \end{proof} As in the $2$-colored case, we can reuse the reduction to show that $\ell$-BMG CBEG is NP-complete. \begin{corollary} \label{cor:ell-col-CBEG-NPc} \PROBLEM{$\ell$-BMG CBEG} is NP-complete for all $\ell\geq 2$. \end{corollary} \begin{proof} As shown in \cite[Cor.~6]{Schaller:2020} and \cite[Cor.~3.6]{Schaller:2020z}, binary-explainable BMGs can be recognized in polynomial time. Therefore, \PROBLEM{$\ell$-BMG CBEG} is contained in the class NP. Cor.~\ref{cor:2col-completion-BEG-NP} states NP-completeness for the case $\ell=2$. Thus, it remains to show NP-hardness for the case $\ell\ge 3$. We use a reduction from \PROBLEM{$2$-BMG CBEG} and the same polynomial-time construction as in the proof of Thm.~\ref{thm:ell-col-NPc}, i.e., we construct an $\ell$-colored graph $(G_{\ell}=(V_{\ell},E_{\ell}),\sigma_{\ell})$ from a $2$-colored graph $(G_{2}=(V_{2},E_{2}),\sigma_{2})$ by adding a hub-vertex of $\ell-2$ pairwise distinct new colors. Note that we only consider arc insertions here, i.e., we have $\odot=+$. We proceed by showing that an instance $(G_2,\sigma_2,k)$ of the respective \PROBLEM{$2$-BMG CBEG} problem has a yes-answer if and only if the corresponding instance $(G_{\ell},\sigma_{\ell},k)$ of \PROBLEM{$\ell$-BMG CBEG} has a yes-answer. First suppose that \PROBLEM{$2$-BMG CBEG} with input $(G_2,\sigma_2,k)$ has a solution $F\subseteq V_2\times V_2 \setminus \{(v,v)\mid v\in V_2\}$ with $|F|\le k$ such that $(G_2+ F, \sigma_2)$ is a \emph{binary-explainable} BMG. By Prop.~\ref{prop:binary-iff-hourglass-free}, $(G_2+F, \sigma_2)$ is hourglass-free. Since $(G_2+F, \sigma_2)$ is in particular a BMG, we can use the same arguments as in the proof of Thm.~\ref{thm:ell-col-NPc} to conclude that $(G_{\ell}+F, \sigma_{\ell})$ is a BMG. Now observe that an hourglass contains two vertices of each of its two colors. Therefore and since every vertex in $V_H=V_{\ell}\setminus V_{2}$ is the only vertex of its color, none the vertices in $V_H$ is part of an induced subgraph of $(G_{\ell}+ F, \sigma_{\ell})$ that is an hourglass. Hence, all hourglasses of $(G_{\ell}+F, \sigma_{\ell})$ must be part of the induced subgraph $((G_{\ell}+F)[V_2],(\sigma_{\ell})_{|V_2})$. This together with the facts that $((G_{\ell}+F)[V_2],(\sigma_{\ell})_{|V_2})=(G_2+F, \sigma_2)$ and $(G_2+F, \sigma_2)$ is hourglass-free implies that $(G_{\ell}+F, \sigma_{\ell})$ must also be hourglass-free. By Prop.~\ref{prop:binary-iff-hourglass-free}, the BMG $(G_{\ell}+F, \sigma_{\ell})$ is binary-explainable, and hence, \PROBLEM{$\ell$-BMG CBEG} with input $(G_{\ell},\sigma_{\ell},k)$ has a yes-answer. For the converse, suppose that \PROBLEM{$\ell$-BMG CBEG} with input $(G_{\ell},\sigma_{\ell},k)$ has a solution $F\subseteq V_{\ell}\times V_{\ell} \setminus \{(v,v)\mid v\in V_{\ell}\}$ with $|F|\le k$ such that $(G_{\ell}+ F, \sigma_{\ell})$ is a binary-explainable BMG. By Prop.~\ref{prop:binary-iff-hourglass-free}, $(G_{\ell}+ F, \sigma_{\ell})$ is hourglass-free. As before, let $F'\subseteq F$ be the subset of arc modifications $(x,y)$ for which $x,y\in V_2$. By the same arguments as in the proof of Thm.~\ref{thm:ell-col-NPc}, we have $|F'|\le |F|\le k$ and $(G_2+F',\sigma_2)= ((G_{\ell}+F)[V_2],(\sigma_{\ell})_{|V_2})$ is a BMG. In particular, $(G_2+F',\sigma_2)$ is an induced subgraph of $(G_{\ell}+ F, \sigma_{\ell})$, and thus, hourglass-free. Together with Prop.~\ref{prop:binary-iff-hourglass-free}, the latter arguments imply that \PROBLEM{$2$-BMG CBEG} with input $(G_{2},\sigma_{2},k)$ has a yes-answer. \end{proof} It remains an open question whether an analogous result holds for the corresponding editing and deletion problems restricted to binary-explainable graphs. However, by the same arguments as in the proof of Cor.~\ref{cor:ell-col-CBEG-NPc}, we have \begin{remark} If \PROBLEM{$2$-BMG EBEG} is NP-complete, then \PROBLEM{$\ell$-BMG EBEG} is NP-complete for all $\ell\geq 2$. If \PROBLEM{$2$-BMG DBEG} is NP-complete, then \PROBLEM{$\ell$-BMG DBEG} is NP-complete for all $\ell\geq 2$. \end{remark} \section{ILP formulation of $\ell$-BMG modification problems} \label{sect:ILP} Hard graph editing problems can often be solved with integer linear programming (ILP) on practically relevant instances. It is of interest, therefore, to consider an ILP formulation of the BMG deletion, completion and editing problems considered above. As input, we are given an $\ell$-colored digraph $(G=(V,E),\sigma)$. We encode its arcs by the binary constants \begin{align*} E_{xy}=1 \text{ if and only if } (x,y)\in E. \end{align*} for all pairs $(x,y)\in V\times V$, $x\neq y$. The vertex coloring $\sigma$ is represented by the binary constant \begin{align*} \varsigma_{y,s}=1 \text{ if and only if } \sigma(y)=s \end{align*} The arc set of the modified graph $(G^*,\sigma)$ is encoded by binary variables $\epsilon_{xy}$, that is, $\epsilon_{xy} = 1$ if and only if $(x,y)$ is arc in the modified graph $G^*$. The aim is to minimize the number of edit operations, and thus, the symmetric difference between the respective arc sets. This is represented by the objective function \begin{align} &\min \sum_{(x,y)\in V\times V} (1-\epsilon_{xy})E_{xy} + \sum_{(x,y)\in V\times V} (1-E_{xy})\epsilon_{xy}. \end{align} The same objective function can also be used for the BMG completion and BMG deletion problem. To ensure that only arcs between vertices of distinct colors exist, we add the constraints \begin{align} \epsilon_{xy}=0 \text{ for all } (x,y)\in V\times V \text{ with } \sigma(x)=\sigma(y).\label{eq:proper-color} \end{align} For the BMG completion problem, the arc set $E$ must be contained in the modified arc set. Hence, we add \begin{align} E_{xy}\leq \epsilon_{xy} \text{ for all } (x,y)\in V\times V. \label{ilp:add} \end{align} In this case, Equ.~\eqref{ilp:add} ensures that $\epsilon_{xy}=1$ if $E_{xy}=1$ and thus, $(x,y)$ remains an arc in the modified graph. In contrast, for the BMG deletion problem, it is not allowed to add arcs and thus, we use \begin{align} \epsilon_{xy} \leq E_{xy} \text{ for all } (x,y)\in V\times V. \label{ilp:del} \end{align} In this case, Equ.~\eqref{ilp:del} ensures that $\epsilon_{xy}=0$ if $E_{xy}=0$ and thus, $(x,y)$ does not become an arc in the modified graph. For the BMG editing problem, we neither need Constraint \eqref{ilp:add} nor \eqref{ilp:del}. Both characterization in Thm.~\ref{thm:newCharacterizatio} and~\ref{thm:BMG-charac-via-R-F}, respectively, require that $(G^*,\sigma)$ is sf-colored. Eq.~\ref{eq:proper-color} already ensures a proper coloring and thus, it remains to make sure that each vertex has at least one out-neighbor of every other color. This property translates to the constraint \begin{align} &\sum_{y\neq x} \epsilon_{xy}\cdot\varsigma_{y,s} >0\label{ilp:all-colors} \end{align} for all $s\ne\sigma(x)$. The $O(|V|^2)$ variables and $O(|V|^2)$ constraints introduced above are relevant for $\ell$-BMG modification problems for an arbitrary $\ell$. In the following two subsections, we present additional constraints and variables that are sufficient for the cases $\ell=2$ and $\ell\ge 2$, respectively. \subsection*{$2$-BMG modification problems} By Thm.~\ref{thm:newCharacterizatio}, a properly 2-colored graph is a BMG if and only if it is sink-free and does not contain an induced F1-, F2-, or F3-graph. Equ.~\eqref{ilp:all-colors} already guarantees that $(G^*,\sigma)$ is sink-free. Hence it suffices to add constraints that exclude induced F1-, F2-, and F3-graphs. For every ordered four-tuple $(x_1, x_2, y_1, y_2) \in V^4$ with pairwise distinct $x_1, x_2, y_1, y_2$ and $\sigma(x_1)=\sigma(x_2)\neq \sigma(y_1)=\sigma(y_2)$, we require \begin{align} \text{(F1)\qquad} & \epsilon_{x_1y_1}+\epsilon_{y_1x_2} + \epsilon_{y_2x_2} + (1-\epsilon_{x_1y_2})+ (1-\epsilon_{y_2x_1})\le 4 \text{ and }\label{ilp:F1}\\ \text{(F2)\qquad} & \epsilon_{x_1y_1}+ \epsilon_{y_1x_2} + \epsilon_{x_2y_2} + (1-\epsilon_{x_1y_2})\le 3.\label{ilp:F2} \intertext{In addition, for every ordered five-tuple $(x_1, x_2, y_1, y_2,y_3) \in V^5$ with pairwise distinct $x_1, x_2, y_1, y_2,y_3$ and $\sigma(x_1)=\sigma(x_2)\neq \sigma(y_1)=\sigma(y_2)=\sigma(y_3)$, we enforce} \text{(F3)\qquad} & \epsilon_{x_1y_1}+\epsilon_{x_1y_3} + \epsilon_{x_2y_2}+ \epsilon_{x_2y_3} + (1-\epsilon_{x_1y_2}) + (1-\epsilon_{x_2y_1})\le 5.\label{ilp:F3} \end{align} By construction, we still have $O(|V|^2)$ variables but $O(|V|^5)$ constraints. We note that the $2$-colored case is handled correctly by the ILP formulation for the general $\ell$-colored case given in the next section. However, the additional variables required for $\ell>2$ are not needed here. We note in passing that, accordingly, we observed a significant speedup when compared to the application of the general formulation to $2$-colored graphs in a cursory simulation. \subsection*{General $\ell$-BMG modification problems} For the general $\ell$-colored case, we drop Equations~(\ref{ilp:F1})-(\ref{ilp:F3}), and instead rely on Thm.~\ref{thm:BMG-charac-via-R-F}, which requires that the pair $(\mathscr{R}(G^*,\sigma), \mathscr{F}(G^*,\sigma))$ is compatible. To implement this constraint, we follow the approach of \cite{chang2011ilp} and \cite{Hellmuth:15}. Note that we make no distinction between the two triples $ba|c$ and $ab|c$. In order to avoid superfluous variables and symmetry conditions connecting them, we assume that the first two indices in triple variables are ordered. Thus there are three triple variables $t_{ab|c}$, $t_{ac|b}$ and $t_{bc|a}$ for any three distinct $a, b, c \in V$. We add constraints such that $t_{ab|c}=1$ if $ab|c$ is an informative triple (cf.\ Def.~\ref{def:informative_triples} and Lemma \ref{lem:informative_triples}) and $t_{ab|c}=0$ if $ab|c$ is a forbidden triple (cf.\ Def.~\ref{def:forbidden_triples} and Lemma~\ref{lem:forb_triples}). Hence, we add \begin{align} & \epsilon_{xy}+(1-\epsilon_{xy'}) - t_{xy|y'} \leq 1 \text{ and} \label{ilp:info-t}\\ & \epsilon_{xy}+\epsilon_{xy'} + t_{xy|y'} \leq 2 \label{ilp:forb-t} \end{align} for all ordered $(x,y,y')\in V^3$ with three pairwise distinct vertices $x,y,y'$ and $\sigma(x)\neq \sigma(y)=\sigma(y')$. Equ.~\eqref{ilp:info-t} ensures that if $(x,y)$ is an arc ($\epsilon_{xy}=1$) and $(x,y')$ is not an arc ($\epsilon_{xy'}=0$) in the edited graph, then $t_{xy|y'}=1$. To obtain a BMG, we must ensure that there is a tree that displays all triples in $\mathscr{R}(G^*,\sigma)$ and none of the triples in $\mathscr{F}(G^*,\sigma)$. A phylogenetic tree $T$ is uniquely determined by its sets of clusters $\mathscr{C}(T) \coloneqq \{L(T(v)) \mid v\in V(T)\}$ \cite{Semple:03}. Thus, it is possible to reconstruct $T$ by building the clusters induced by the informative triples while avoiding that forbidden triples are displayed. The set of clusters $\mathscr{C}(T)$ forms a hierarchy, that is, for all $p,q\in \mathscr{C}(T)$ it holds that $p\cap q\in\{\emptyset, p,q\}$. It is easy to see that, in order to recover $T$ from $\mathscr{C}(T)$, it suffices to take into account only the non-trivial clusters $p\in \mathscr{C}(T)$ with $|p|\neq 1$ and $p\neq V(T)$. The number of non-trivial clusters of $T$ is bounded by $L(T)-2$ (cf.\ \cite[Lemma~1]{Hellmuth:15}), where $L(T)=V$, i.e., the vertex set of the $\ell$-colored digraph $(G=(V,E),\sigma)$ given as input. In order to translate the condition that $\mathscr{C}(T)$ forms hierarchy into the language of ILPs, we follow \cite{chang2011ilp,Hellmuth:15}. Let $M$ be a binary $|V| \times (|V|-2)$ matrix with entries $M(x,p) = 1$ iff vertex $x\in V$ is contained in cluster $p$. Each cluster $p$ of the tree $T_M$ encoded by $M$, which is represented by the $p$-th column of $M$, corresponds to an inner vertex $v_p$ in $T$ so that $L(T(v_p )) = \{x \mid x\in V, M(x,p)=1\}$. In the following, we identify column $p$ with the corresponding cluster $L(T(v_p))$. We next ensure that all informative triples and none of the forbidden triples $ab|c$ are displayed by $T_M$. This is case if and only if there exists an inner vertex $v_p$ such that $a,b \in L(T(v_p))$ and $c\notin L(T(v_p))$ for every informative triple and no such vertex exists for any forbidden triple. Therefore, we define, for all ordered three-tuples $(a,b,c) \in V^3$ and all $p\in\{1,\dots,|V|-2\}$, the binary variable $m((ab|c),p)$ and set $m((ab|c), p) = 1$ iff $M(a, p) = M (b, p) =1$ and $M (c, p) = 0$, i.e., iff the cluster $p$ contains $a$ and $b$ but not $c$. The latter can be achieved by adding, for all these variables, the constraint \begin{align} & 0 \leq - 3 \cdot m((ab|c), p) + M (a, p) + M (b, p) + (1 - M (c, p)) \leq 2. \label{ilp:triples-clusters} \end{align} Full enumeration of all possible values that can be assigned to $M(a, p)$, $M (b, p)$ and $M(c, p)$ shows that $m((ab|c), p) =1$ if and only if $M(a, p) = M (b, p) =1$ and $M (c, p) = 0$. For every informative triple $ab|c$ there must be at least one column $p$ for which $m((ab|c), p) = 1$ and for each forbidden triple it must be ensured that $m((ab|c), p) = 0$ for all $p\in\{1,\dots,|V|-2\}$. This is achieved by adding \begin{align} & t_{ab|c} \leq \sum_{p=1}^{|V|-2} m((ab|c), p) \leq (|V|-2)\cdot t_{ab|c} \end{align} for all ordered $(a,b,c)\in V^3$ with three pairwise distinct vertices $a,b,c$ and $\sigma(a)\neq \sigma(b)=\sigma(c)$. If $t_{ab|c}=1$, then $m((ab|c), p)=1$ for at least one $p$ and if $t_{ab|c}=0$ then, $\sum_{p=1}^{|V|-2} m((ab|c), p) \leq 0$ implies that all $m((ab|c), p)$ are put to $0$. Finally, we must ensure that the matrix $M$ indeed encodes the hierarchy of a tree. This is the case if all clusters $p$ and $q$ are compatible, i.e., if $p\cap q\in\{p, q,\emptyset\}$. Equivalently, two clusters $p$ and $q$ are incompatible if there are vertices $a$, $b$ and $c$ such that $a\in p\setminus q$, $b\in q\setminus p$ and $c\in p\cap q$, which is represented by the ``gametes'' $(M(a,p),M(a,q))=(1,0)$, $(M(b,p),M(b,q))=(0,1)$ and $(M(c,p),M(c,q))=(1,1)$. We avoid such incompatible clusters by using the so-called three-gamete condition which is described e.g.\ in \cite{Gusfield:97} or \cite[SI]{Hellmuth:15}. To this end, we add for each of the three gametes $(\Gamma,\Lambda)\in\{(0,1),(1,0),(1,1)\}$ the binary variables $C(p,q,\Gamma\Lambda)$ for every pair of columns $p\ne q$. Furthermore, we add the constraints \begin{align} & C(p,q,01) \ge - M(a,p) + M(a,q)\\ & C(p,q,10) \ge M(a,p) - M(a,q)\\ & C(p,q,11) \ge M(a,p) + M(a,q) - 1 \end{align} for every pair of columns $p\ne q$ and every $a\in V$. This ensures that $C(p,q,\Gamma\Lambda)=1$ whenever $M(a,p)=\Gamma$ and $M(a,q)=\Lambda$ holds for at least one $a\in V$. Finally, we add the constraint \begin{align} & C_{p,q,01} + C_{p,q,10} + C_{p,q,11} \le 2 \end{align} for every pair of columns $p\ne q$, in order to ensure the compatibility of clusters $p$ and $q$. In total, this ILP formulation requires $O(|V|^4)$ variables and $O(|V|^4)$ constraints where the most expensive part stems from the variables $m((ab|c), p)$ and their corresponding constraints (cf.\ Equ.~\ref{ilp:triples-clusters}). \section{Concluding Remarks} We have shown here that arc modification problems for BMGs are NP-complete. This is not necessarily an obstacle for using BMG editing in practical workflows -- after all, the computational problems in phylogenetics all involve several NP-complete steps, including \textsc{Multiple Sequence Alignment} \cite{Elias:06} and the \textsc{Maximum Parsimony Tree} \cite{Graham:82} or \textsc{Maximum Likelihood Tree} problems \cite{Chor:06}. Nevertheless, highly efficient and accurate heuristics have been devised for these problems, often adjusted to the peculiarities of real-life data, so that the computational phylogenetics have become a routine task in bioinformatics. As a starting point to tackling BMG editing in practice, we gave novel characterizations of BMGs that made it possible to introduce an ILP formulation that should be workable at least for moderate-size instances. Without further optimization, instances with $\ell\ge 3$ colors are very demanding and already problems with ten vertices may take a few hours on a desktop system. The $2$-colored version (requiring only $O(|V|^2)$ variables) on the other hand, handles instances with 20 vertices in about a minute. We tested both versions using IBM ILOG CPLEX\texttrademark{ }Optimizer 12.10 and Gurobi Optimizer 9.0, and applied them to randomly disturbed ($2$-)BMGs. We note in passing that \PROBLEM{2-BMG Deletion} and \PROBLEM{2-BMG Completion} can be shown to be fixed-parameter tractable (with the number $k$ of edits as parameter) provided that the input graph is sink-free. To see this, observe that sink-free 2-colored graphs are BMGs if and only if they do not contain induced F1-, F2-, and F3-subgraphs (cf.\ Thm.~\ref{thm:newCharacterizatio}). The FPT result follows directly from the observation that all such subgraphs are of fixed size and only a fixed number of arc deletions (resp., additions) are possible. In the case of \PROBLEM{2-BMG Deletion}, only those arc deletions are allowed that do not produce sinks in $G$. Clearly, graphs remain sink-free under arc addition. It remains unclear whether \PROBLEM{2-BMG Editing} is also FPT for sink-free graphs. One difficulty is that arc deletions may result in a sink-vertex which then needs to be resolved by subsequent arc additions. It also remains an open question for future research whether the BMG modification problems for (not necessarily sink-free) $\ell$-colored graphs are also FPT. We suspect that this is not the case for $\ell\ge3$, where the characterization also requires consistency of the set of informative triples. Since removal of a triple from $\mathscr{R}(G,\sigma)$ requires the insertion or deletion of an arc, it seems difficult to narrow down the editing candidates to a constant-size set. Indeed, \textsc{Maximum Triple Inconsistency} is not FPT when parametrized by the number $k$ of triples to be excluded \cite{Byrka:10}. On the other hand, the special case of \textsc{Dense Maximum Triple Inconsistency} is FPT \cite{Guillemot:13}. The set of informative triples $\mathscr{R}(G,\sigma)$, however, is usually far from being dense. For larger-scale practical applications, we expect that heuristic algorithms will need to be developed. An interesting starting point is the observation that in many examples some of the (non-)arcs in forbidden subgraphs cannot be modified. This phenomenon of unambiguously identifiable (non-)arcs will be the topic of ongoing work. \section*{Acknowledgments} We thank Nicolas Wieseke for stimulating discussions. This work was funded in part by the German Research Foundation (DFG). \clearpage \bibliographystyle{plain}
\section{Introducci\'on} En [3] desarrollamos la teor\'ia para poder resolver ecuaciones diferenciales de la forma \begin{equation} \phi^{\prime}=f_{1}(\phi)f_{2}(\phi)\cdots f_{n}(\phi) \end{equation} en t\'ermino de las soluciones de las ecuaciones m\'as simples $\phi^{\prime}=f_{i}(\phi)$. Queremos hacer lo mismo con ecuaciones de diferencia de la forma \begin{equation} y_{n+1}=f_{1}(y_{n})f_{2}(y_{n})\cdots f_{n}(y_{n}) \end{equation} esto es, expresar la soluci\'on $y_{n}$ en t\'ermino de las soluciones de las ecuaciones $y_{n+1}=f_{i}(y_{n})$. Esto ser\'a muy \'util por ejemplo para resolver la ecuaci\'on de diferencia log\'istica $y_{n+1}=\mu y_{n}(1-y_{n})$. Esta es la ecuaci\'on en diferencia no lineal m\'as simple y hasta el momento no tiene una soluci\'on exacta. Como el operador de derivaci\'on $\delta$ y el operador de diferencia forward $\vartriangle$ son ejemplos de operadores delta, entonces iremos un paso m\'a all\'a definiendo y resolviendo sistemas din\'amicos uni-dimensionales tipo delta. Este art\'iculo est\'a dividido de la siguiente forma. Primeramente establecemos conceptos b\'asicos de sistemas din\'amicos unidimensionales sobre dominios de integridad y conceptos y resultados de la teor\'ia de operadores delta y del c\'alculo umbral desarrollado por G.C. Rota. Seguido definimos sistemas din\'amicos unidimensionales tipo delta sobre dominios de integridad y establecemos algunos resultados b\'asicos sobre estos. Uno de los resultados importantes alcanzado es que si fijamos la funci\'on $f$ del sistema y variamos los operadores delta obtenemos un grupo de sistemas din\'amicos. Finalizamos este art\'iculo introduciendo algunos sistemas din\'amicos tipo delta cuando delta es el operador de diferencia forward, el operador de diferencia backward, el operador Abel y el operador Touchard. En todo este artículo $R$ será un anillo de característica cero. Además, $\mathbb{N}$ será el monoide de enteros no negativos y $\mathbb{N}_{1}$ será el semigrupo de enteros positivos. \section{Preliminares} Iniciamos este art\'iculo presentando la informaci\'on necesaria para construir la teor\'ia de sistemas din\'amico tipo delta definidos sobre un dominio de integridad de caracter\'istica cero. Primero son presentados los resultados b\'asicos de [3]. Necesitamos el siguiente isomorfismo de anillos \begin{equation} \dhurw_{R}[[x]]\rightarrow\mathfrak{A}(\dhurw_{R}[[x]])\rightarrow\rho_{t}\mathfrak{A}(\dhurw_{R}[[x]]) \end{equation} en donde $\dhurw_{R}[[x]]$ es el anillo de sucesiones de derivadas de funciones en $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$, el anillo $\mathfrak{A}(\dhurw_{R}[[x]])$ es construido usando el operador aut\'onomo definido sobre $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. Este operador es definido usando los polinomios de Bell, por lo tanto exhibe su car\'acter combinatorial. Finalmente el anillo $\rho_{t}\mathfrak{A}(\dhurw_{R}[[x]])$ es el anillo que contiene los semi flujos soluci\'on de las ecuaciones $\phi^{\prime}=f(\phi)$ para cada $f\in\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. Otros resultados que necesitaremos son obtenido del c\'alculo umbral de Rota, ve\'ase [4], particularmente los operadores delta que son operadores lineales que generalizan a los operadores de derivaci\'on. \subsection{Ecuaciones diferenciales aut\'onomas de orden uno sobre dominios de integridad} Denote $R$ un dominio de integridad de caracter\'istica cero y sea $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$ el anillo de Hurwitz, ve\'ase [2], de las funciones generadoras exponenciales de las sucesiones definidas sobre $R$ con suma y producto ordinarios de series de potencias. Denote $\delta$ la derivaci\'on definida sobre $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$ y denote $\dhurw_{R}[[x]]$ el anillo expansi\'on de Hurwitz de $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$, esto es, el anillo de sucesiones de derivadas $(f(x),\delta f(x),\delta^{2}f(x),...)$ para cada $f(x)$ en $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$, donde la suma $+$ en $\dhurw_{R}[[x]]$ es definida componente a componente y el producto $\ast$ es el producto Hurwitz de sucesiones dado por \begin{equation} \Delta f(x)\ast\Delta g(x)=\left(\sum_{k=0}^{n}\delta^{k}f(x)\delta^{n-k}g(x)\right)_{n\in\mathbb{N}}. \end{equation} Como $\Delta f+\Delta g=\Delta(f+g)$ y $\Delta f\ast\Delta g=\Delta(fg)$, entonces los anillos $\dhurw_{R}[[x]]$ y $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$ son isomorfos. El anillo $\dhurw_{R}[[x]]$ sirve de base para la definici\'on del operador aut\'onomo. Sea $\mathop{\mbox{\textsl{H}}}\nolimits_{S}$ el anillo de sucesiones definidas sobre el anillo $S=\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. El \textbf{operador aut\'onomo} $\mathfrak{A}$ es el mapa no lineal $\mathfrak{A}:\Delta\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]\rightarrow\mathop{\mbox{\textsl{H}}}\nolimits_{S}$ definido por \begin{equation} \mathfrak{A}(\Delta f)=(A_{n}([\delta^{n-1}f]))_{n\in\mathbb{N}_{1}} \end{equation} con $[\delta^{n}f]=(f,\delta f,...,\delta^{n}f)$, en donde los $A_{n}$ son definidos recursivamente por \begin{eqnarray} A_{1}([\delta^{0}f])&=&A_{1}([f])=f,\\ A_{n+1}([\delta^{n}f])&=&Y_{n}(A_{1}([\delta^{0}f]),A_{2}([\delta^{1}f])...,A_{n}([\delta^{n-1}f]);\delta^{1}f,...,\delta^{n}f), \end{eqnarray} $n\geq 1$.\\ Los polinomios $A_{n}$ en las indeterminadas $\delta^{0}f,\delta^{1}f,...,\delta^{n-1}f$ serán llamados \textbf{polinomios aut\'onomos}. Denote $\mathfrak{A}(\dhurw_{R}[[x]])$ el conjunto de todas las sucesiones $\mathfrak{A}(\Delta f)$. Definiendo la suma $\boxplus$ en $\mathfrak{A}(\dhurw_{R}[[x]])$ de la siguiente manera \begin{equation}\label{def_bplus} \mathfrak{A}(\Delta f)\boxplus\mathfrak{A}(\Delta g)=\mathfrak{A}(\Delta f)+\mathfrak{A}(\Delta g)+\left( H_{n}(f,g)\right)_{n\in\mathbb{N}_{1}} \end{equation} en donde $H_{1}(f,g)=0$ y \begin{equation}\label{eqn_Hn} H_{n+1}(f,g)=f\delta A_{n}([\delta^{(n-1)}g])+g\delta A_{n}([\delta^{(n-1)}f])+(f+g)\delta H_{n}(f,g) \end{equation} y el producto $\circledast$ en $\mathfrak{A}(\dhurw_{R}[[x]])$ de la siguiente manera \begin{equation}\label{def_cdast} \mathfrak{A}(\Delta f)\circledast\mathfrak{A}(\Delta g)=\left(\sum_{l=1}^{n}\mathcal{A}_{l}(f)\mathcal{A}_{n-l+1}(g)\right)_{n\in\mathbb{N}_{1}} \end{equation} en donde \begin{equation} \mathcal{A}_{l}(f)=\sum_{\vert p(n)\vert=l}\alpha_{\vert p(n)\vert} A_{j_{1}}([\delta^{j_{1}-1}f])A_{j_{2}}([\delta^{j_{2}-1}f])\cdots A_{j_{r}}([\delta^{j_{r}-1}f]) \end{equation} y $\alpha_{\vert p(n)\vert}$ son n\'umeros apropiados, entonces $(\mathfrak{A}(\dhurw_{R}[[x]]),\boxplus,\circledast)$ es un anillo conmutativo con unidad. Este anillo ser\'a llamado \textbf{anillo aut\'onomo} . Como $\mathfrak{A}(\Delta f)\boxplus\mathfrak{A}(\Delta g)=\mathfrak{A}(\Delta f+\Delta g)$ y $\mathfrak{A}(\Delta f)\circledast\mathfrak{A}(\Delta g)=\mathfrak{A}(\Delta f\ast\Delta g)$, entonces los anillos $\dhurw_{R}[[x]]$ y $\mathfrak{A}(\dhurw_{R}[[x]])$ son isomorfos. Ahora mostraremos la relaci\'on entre anillo aut\'onomo y sistemas din\'amicos. Definimos un \textbf{sistema dinámico} sobre el anillo $R$ como la terna $(R,\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]],\Phi)$ donde $R$ es el \textbf{conjunto de tiempos}, $\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ el \textbf{espacio de fases} y $\Phi$ es el \textbf{flujo} \begin{equation}\label{flujo_diferencial} \Phi(t,x,\Delta f(x))=x+\sum_{n=1}^{\infty}A_{n}([\delta^{(n-1)}f(x)])\dfrac{t^{n}}{n!}. \end{equation} esto es, $\Phi$ es el mapa definido por $\Phi:R\times\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]\times\Delta\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]\rightarrow\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ donde $S=\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. El flujo $\Phi$ satisface \begin{enumerate} \item $\Phi(0,x,\Delta f(x))=x$, \item $\Phi(t,\Phi(s,x,\Delta f(x)),\Delta f(x))=\Phi(t+s,x\Delta f(x))$, \item $f(x)\delta_{x}\Phi(t,x,\Delta f(x))=\delta_{t}\Phi(t,x,\Delta f(x))=f(\Phi)$, \item Para todo $a\in R$ se cumple que $\Phi(t,x,a\Delta^{}f(x))=\Phi(at,x,\Delta^{}f(x))$. \end{enumerate} Las propiedades 1. y 2. le dan a $\Phi$ estructura de grupo abeliano. Este grupo act\'ua sobre el espacio de fases $\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$. La propiedad 4. dota a $\Phi$ de estructura de $R$-m\'odulo. Ponga $\Phi_{t,r}(x)\equiv\Phi(t,x,r\Delta f(x))$. Entonces \begin{equation} \Phi_{t,r}(x)=\Phi_{rt,1}(x)=\Phi_{r,t}(x)=\Phi_{1,rt}(x) \end{equation} Luego podemos definir \begin{equation} \Phi_{R,1}(x)=\{\Phi_{t,1}(x):t\in R\}. \end{equation} Defina el mapa $\star:R\times\Phi_{R,1}\rightarrow\Phi_{R,1}$ por $s\star\Phi_{t,1}=\Phi_{st,1}$. Entonces $\Phi_{R,1}$ es un $R$-módulo. Por otro lado, sea $\rho_{t}$ el mapa llevando $\mathfrak{A}(\dhurw_{R}[[x]])$ a $\rho_{t}\mathfrak{A}(\dhurw_{R}[[x]])$ definido por \begin{equation} \mathfrak{A}(\Delta f(x))\mapsto\sum_{n=1}^{\infty}A_{n}([\delta^{n-1}f(x)])\frac{t^{n}}{n!} \end{equation} Definimos un \textbf{semi sistema dinámico} como la terna $(R,\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]],\Psi)$ donde $R$ es el conjunto de tiempos, $\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ el espacio de fases, con $S=\mathfrak{A}(\Delta\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]])$ y $\Psi$ es el \textbf{semi flujo} \begin{equation} \Psi(t,x,\Delta f(x))=\Phi(t,x,\Delta f(x))-x=\rho_{t}\mathfrak{A}(\Delta f(x)) \end{equation} esto es, $\Psi$ es el mapa $\Psi:R\times\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]\times\Delta\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]\rightarrow\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ . Luego es posible extender las operaciones del anillo $\mathfrak{A}(\dhurw_{R}[[x]])$ al conjunto $\rho_{t}\mathfrak{A}(\dhurw_{R}[[x]])$. Tome $\Delta f(x)$ y $\Delta g(x)$ de $\dhurw_{R}[[x]]$. Definimos la suma $\boxplus$ y el producto $\circledast$ en $\rho_{t}\mathfrak{A}(\dhurw_{R}[[x]])$ así \begin{eqnarray} \rho_{t}\mathfrak{A}(\Delta f)\boxplus\rho_{t}\mathfrak{A}(\Delta g)&=&\sum_{n=1}^{\infty}\left(A_{n}([\delta^{n-1}f(x)])+A_{n}([\delta^{n-1}f(x)])+H_{n}(f,g)\right)\\ \rho_{t}\mathfrak{A}(\Delta f)\circledast\rho_{t}\mathfrak{A}(\Delta g)&=&\sum_{n=1}^{\infty}\left(\sum_{l=1}^{n}\mathcal{A}_{l,n}(f)\mathcal{A}_{n-l+1,n}(g)\right)\frac{t^{n}}{n!} \end{eqnarray} Entonces $\rho_{t}\mathfrak{A}(\dhurw_{R}[[x]])$ con la suma $\boxplus$ y el producto $\circledast$ es un anillo conmutativo con unidades $0$ y $\rho_{t}\mathfrak{A}(\textbf{e}_{\Delta})=t$. Claramente los anillos $\mathfrak{A}(\dhurw_{R}[[x]])$ y $\rho_{t}\mathfrak{A}(\dhurw_{R}[[x]])$ son isomorfos. Luego podemos factorizar semi flujos. Sea $f=g_{1}g_{2}\cdots g_{m}$ un producto de funciones en $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. Entonces \begin{equation} \rho_{t}\mathfrak{A}(\Delta f)=\rho_{t}\mathfrak{A}(\Delta g_{1})\circledast\cdots\circledast\rho_{t}\mathfrak{A}(\Delta g_{m}) \end{equation} implica que \begin{equation} \Phi(t,x,\Delta f(x))=x+(\Phi(t,x,\Delta g_{1}(x))-x)\circledast\cdots\circledast(\Phi(t,x,\Delta g_{m}(x))-x) \end{equation} De este modo podemos expresar el flujo de un sistema din\'amico en t\'erminos de producto de semi flujos. Lo cual es muy \'util para encontrar soluciones de ecuaciones diferenciales en t\'ermino de soluciones de ecuaciones m\'as simples. \subsection{C\'alculo finito de operadores} Sea $\mathbb{F}$ un campo de caracter\'istica cero y $\mathbb{F}[t]$ el $\mathbb{F}$-\'algebra de polinomios con coeficientes en $\mathbb{F}$ en la variable $t$. Una \textbf{sucesi\'on polinomial} $(p_{n}(t))_{n\in\mathbb{N}}$ en $\mathbb{F}[t]$ es un sucesi\'on de polinomios tal que $p_{n}(t)$ tiene exactamente grado $n$. Una sucesi\'on polinomial se dice de \textbf{tipo binomial} si se cumple \begin{equation} p_{n}(t+s)=\sum_{k=0}^{n}\binom{n}{k}p_{k}(t)p_{n-k}(s) \end{equation} para todo $n\in\mathbb{N}$. Si $a$ es un elemento de $\mathbb{F}$, entonces $E^{a}$ es el operador shift enviando un polinomio $p(t)$ a $p(t+a)$. Se puede mostrar que \begin{equation} E^{a}=e^{a\delta}=\sum_{k=0}^{\infty}\frac{a^{k}}{k!}\delta^{k} \end{equation} Un operador $Q$ es \textbf{shift invariante} si $QE^{a}=E^{a}Q$ para cualquier elemento $a$ en $\mathbb{F}$. El operador $\delta$ es claramente un operador shift invariante. Denote $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[\delta]]$ el anillo de Hurwitz de operadores shift invariantes. Un operador $Q:\mathbb{F}[t]\rightarrow\mathbb{F}[t]$ es un \textbf{operador delta} si $Q$ es shift invariante y $Qt=c$, donde $c$ es una constante no cero. Una sucesi\'on polinomial $(p_{n}(t))_{n\in\mathbb{N}}$ es un \textbf{conjunto base} para el operador delta $Q$ si $p_{0}(t)=1$, $p_{n}(0)=0$ para todo $n\geq1$ y $Qp_{n}(t)=np_{n-1}(t)$. Algunas propiedades de operadores delta son: \begin{enumerate} \item Si $p(t)$ es un polinomio de grado $n$, entonces $Qp(t)$ es un polinomio de grado $n-1$. \item Sean $(p_{n}(t))_{n\in\mathbb{N}}$ una sucesi\'on de polinomios y $Q:\mathbb{F}[t]\rightarrow\mathbb{F}[t]$ un operador definido por $Qp_{n}(t)=np_{n-1}(t)$. Entonces son equivalente \begin{enumerate} \item La sucesi\'on $(p_{n}(t))_{n\in\mathbb{N}}$ es de tipo binomial \item El operador $Q$ es un operador delta \item El operador $Q$ tiene la expansión formal \begin{equation} Q=\sum_{k=0}^{\infty}a_{k}\frac{\delta^{k}}{k!} \end{equation} es decir, $Q\in\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[\delta]]$. \end{enumerate} \end{enumerate} Lo anterior significa entre otras cosas que las sucesiones polinomiales de tipo binomial son caracterizadas por operadores delta. Los siguientes son resultados importantes en la teor\'ia de operadores delta: \textbf{Primer teorema de expansi\'on}. Sea $T$ un operador shift invariante y $Q$ un operador delta con conjunto base $(p_{n}(x))$. Entonces \begin{equation} T=\sum_{k=0}^{\infty}\frac{[Tp_{k}(x)]_{x=0}}{k!}Q^{k} \end{equation} \textbf{Teorema de isomorfismo}. Sea $Q$ un operador delta con conjunto base $(q_{n}(x))_{n\in\mathbb{N}}$. Entonces el mapa $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[\delta]]\rightarrow\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[t]]$ dado por \begin{equation} T\mapsto\sum_{k=0}^{\infty}[Tq_{k}(x)]_{x=0}\frac{t^{k}}{k!} \end{equation} es un isomorfismo de anillos. Sea $Q$ un operador delta con conjunto base $p_{n}(t)$ y sea $Q=q(\delta)$. Sea $q^{-1}(t)$ la serie de potencias formal inversa. Entonces \begin{equation}\label{eqn_exp_inver} \sum_{n=0}^{\infty}\frac{q_{n}(t)}{n!}u^{n}=e^{tq^{-1}(u)}. \end{equation} Un operador $L:\mathbb{F}[t]\rightarrow\mathbb{F}[t]$ es un \textbf{operador umbral} si existen dos sucesiones bases $(p_{n}(t))_{n\in\mathbb{N}}$ y $(q_{n}(t))_{n\in\mathbb{N}}$ tal que $Lp_{n}(t)=q_{n}(t)$, para todo $n\in\mathbb{N}$. Existe un \'unico operador lineal $L$ actuando sobre $\mathbb{F}[t]$ tal que $L(t^{n})=q_{n}(t)$. Este operador $L$ es conocido como la \textbf{representaci\'on umbral} de la sucesi\'on $q_{n}(t)$. Si \begin{equation} p_{n}(t)=\sum_{k=0}^{n}a_{n,k}t^{k}, \end{equation} entonces la \textbf{composici\'on umbral} es la sucesi\'on $(r_{n}(t))_{n\in\mathbb{N}}$ definida por \begin{equation} r_{n}(t)=\sum_{k=0}^{n}a_{n,k}q_{k}(t) \end{equation} es decir $r_{n}(t)=Lp_{n}(t)$, donde $L$ es la representaci\'on umbral de $(q_{n}(t))_{n\in\mathbb{N}}$. Usaremos la notaci\'on $r_{n}(t)=p_{n}(\underline{q}(t))$ para $r_{n}(t)=Lp_{n}(t)$. Luego definimos la composici\'on $(p\circ q)(t)$ como la sucesi\'on $(p_{n}(\underline{q}(t)))_{n\in\mathbb{N}}$. Denote $\mathcal{U}$ el conjunto de sucesiones de base. Entonces $\mathcal{U}$ es un grupo de Lie con la composici\'on umbral $\circ$ como operaci\'on en donde dos sucesiones $(p_{n}(t))_{n\in\mathbb{N}}$ y $(q_{n}(t))_{n\in\mathbb{N}}$ son inversas si $p_{n}(\underline{q}(t))=t^{n}$. Si $p_{n}(t)$ y $q_{n}(t)$ son sucesiones bases con operadores delta $P=f(\delta)$ y $Q=g(\delta)$, entonces $p_{n}(\underline{q}(t))$ es un conjunto base con operador delta $f(g(\delta))$. Luego $(p_{n}(t))_{n\in\mathbb{N}}$ y $(q_{n}(t))_{n\in\mathbb{N}}$ son inversas si y s\'olo si $f(g(x))=t$. \section{Sistemas Dinámicos tipo Delta} Sea $Q$ un operador delta con conjunto base $q=(q_{n}(t))_{n\in\mathbb{N}}$. Ahora sea $L$ la representaci\'on umbral de los polinomios base $q$, esto es, $L(t^{n})=q_{n}(t)$. El operador delta se comporta como una derivada cuando actua sobre polinomios. Lo que queremos hacer es definir una nueva clase de ecuaciones diferenciales en donde en vez de usar una derivada ordinaria usaremos operadores delta y luego encontrar analog\'ias en los resultados encontrados en sistemas din\'amicos unidimensionales definidos sobre dominios. \begin{theorem} Denote $\Phi_{Q}(t,x,\Delta f(x))=L[\Phi(t,x,\Delta f(x))]$. Entonces \begin{equation} Q\Phi_{Q}(t,x,\Delta f(x))=f(\Phi_{Q}(t,x,\Delta f(x))). \end{equation} \end{theorem} \begin{proof} Usamos la definici\'on de $\Phi(t,x,\Delta f(x))$ y aplicamos $QL$. Tenemos \begin{eqnarray*} QL[\Phi(t,x,\Delta f(x))]&=&QL\left(x+\sum_{k=1}^{\infty}A_{k}([\delta^{k-1}f(x)])\frac{t^{k}}{k!}\right)\\ &=&xQL(1)+\sum_{k=1}^{\infty}A_{k}([\delta^{k-1}f(x)])\frac{QL(t^{k})}{k!}\\ &=&\sum_{k=1}^{\infty}A_{k}([\delta^{k-1}f(x)])\frac{kL(t^{k-1})}{k!}\\ &=&\sum_{k=0}^{\infty}A_{k+1}([\delta^{k}f(x)])\frac{L(t^{k})}{k!}\\ &=&L\left(\sum_{k=0}^{\infty}A_{k+1}([\delta^{k}f(x)])\frac{t^{k}}{k!}\right)\\ &=&L\left(f(x)\delta_{x}\Phi(t,x,\Delta f(x))\right) \end{eqnarray*} Por las propiedades de flujo la \'ultima l\'inea arriba da $L[f(\Phi(t,x,\Delta f(x)))]$. Finalmente poniendo $\Phi_{Q}(t,x,\Delta f(x))=L[\Phi(t,x,\Delta f(x))]$ obtenemos el resultado deseado. \end{proof} Luego de este resultado definimos ecuaciones diferenciales aut\'onomas de orden uno con derivaci\'on delta de este modo \begin{definition} Sea $Q$ un operador umbral. Tome $f(x)$ en $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. Una ecuaci\'on diferencial aut\'onoma uni-dimensional \textbf{tipo delta} es una ecuaci\'on de la forma \begin{equation} Q\Phi=f(\Phi). \end{equation} \end{definition} Esta definici\'on generaliza a las ecuaciones que ya conocemos. Cuando $Q=\delta$ obtenemos las ecuaciones diferenciales ordinarias. Si $Q$ es el operador de diferencia $\vartriangle$, entonces obtenemos las ecuaciones en diferencias de orden uno. Ahora bien esta definición permite obtener nuevos tipos de ecuaciones según el operador delta $Q$ que usemos. Si $Q=\triangledown$, obtenemos \textbf{ecuaciones de diferencia backward}. Si $Q=E^{a}\delta$, entonces obtenemos \textbf{ecuaciones de tipo Abel}. Si $Q=\log(I+\delta)$, entonces obtenemos \textbf{ecuaciones de tipo Touchard}. Las soluciones a este tipo de soluciones ser\'an estudiadas m\'as adelante. Ahora queremos encontrar una soluci\'on que generalice a las soluciones encontradas en secciones anteriores. Sea $Q$ un operador delta con conjunto base $q=(q_{n}(t))_{n\in\mathbb{N}}$ con representaci\'on umbral $L$. Tome $\mathfrak{A}(\Delta f(x))$ en $\mathfrak{A}(\dhurw_{R}[[x]])$ y denote $\rho_{q}$ el mapa definido por \begin{equation} \rho_{q}(\mathfrak{A}(\Delta f(x)))=\sum_{n=1}^{\infty}A_{k}([\delta^{n-1}f(x)])\frac{q_{n}(t)}{n!}. \end{equation} Luego $\rho_{q}\mathfrak{A}(\Delta f(x))=L(\rho_{t}\mathfrak{A}(\Delta f(x)))$ y $L$ es la representaci\'on umbral de $\rho_{q}\mathfrak{A}(\Delta f(x))$. \begin{definition} Sea $Q$ un operador delta con conjunto base $q=(q_{n}(t))_{n\in\mathbb{N}}$. Tome $\Delta f(x)$ y $\Delta g(x)$ de $\dhurw_{R}[[x]]$. Definimos la suma $\boxplus_{q}$ y el producto $\circledast_{q}$ en $\rho_{q}\mathfrak{A}(\dhurw_{R}[[x]])$ así \begin{eqnarray} \rho_{q}\mathfrak{A}(\Delta f)\boxplus_{q}\rho_{q}\mathfrak{A}(\Delta g)&=&\sum_{n=1}^{\infty}(A_{n}([\delta^{n-1}f(x)])+A_{n}([\delta^{n-1}f(x)])\nonumber\\ &&+H_{n}(f,g))\frac{q_{n}(t)}{n!} \end{eqnarray} donde $$H_{n+1}(f,g)=f\delta A_{n}([\delta^{n-1}g])+g\delta A_{n}([\delta^{n-1}f])+(f+g)\delta H_{n}(f,g)$$ y \begin{eqnarray} \rho_{q}\mathfrak{A}(\Delta f)\circledast_{q}\rho_{q}\mathfrak{A}(\Delta g)&=&\sum_{n=1}^{\infty}\left(\sum_{l=1}^{n}\mathcal{A}_{l,n}(f)\mathcal{A}_{n-l+1,n}(g)\right)\frac{q_{n}(t)}{n!} \end{eqnarray} \end{definition} Ahora dotamos de estructura de anillo al conjunto $\rho_{q}\mathfrak{A}(\dhurw_{R}[[x]])$ \begin{theorem} Sea $Q$ un operador delta con conjunto base $q=(q_{n}(t))_{n\in\mathbb{N}}$. El conjunto $\rho_{q}\mathfrak{A}(\dhurw_{R}[[x]])$ con la suma $\boxplus_{q}$ y el producto $\circledast_{q}$ es un anillo conmutativo con unidades $\rho_{q}\mathfrak{A}(0)=0$ y $\rho_{q}\mathfrak{A}(\textbf{e}_{\Delta})=q_{1}(t)=t$. \end{theorem} \begin{proof} De (\ref{def_bplus}) y (\ref{def_cdast}) se sigue que \begin{eqnarray*} \rho_{q}\mathfrak{A}(\Delta f)\boxplus_{q}\rho_{q}\mathfrak{A}(\Delta g)&=&\rho_{q}[\mathfrak{A}(\Delta f)\boxplus\mathfrak{A}(\Delta g)]\\ \rho_{q}\mathfrak{A}(\Delta f)\circledast_{q}\rho_{q}\mathfrak{A}(\Delta g)&=&\rho_{q}[\mathfrak{A}(\Delta f)\circledast\mathfrak{A}(\Delta g)] \end{eqnarray*} Luego la prueba sigue igual a la que se hizo en [?]. \end{proof} As\'i el mapa $\rho_{q}$ es un isomorfismo de anillos. Denote $L\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$ la imagen de $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$ por el operador umbral. Extenderemos la definici\'on de semi sistemas din\'amicos a operadores delta \begin{definition} Sea $Q$ un operador delta con conjunto base $q=(q_{n}(t))_{n\in\mathbb{N}}$. Definimos un \textbf{semi sistema dinámico tipo delta} como la terna $(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]],\Psi_{Q})$ donde $R$ es el conjunto de tiempos, $L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ el espacio de fases, con $S=\mathfrak{A}(\Delta\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]])$ y $\Psi_{Q}$ es el \textbf{semi flujo delta} \begin{equation} \Psi_{Q}(t,x,\Delta f(x))=\rho_{q}\mathfrak{A}(\Delta f(x)) \end{equation} esto es, $\Psi_{Q}$ es el mapa $\Psi_{Q}:R\times L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]\times\Delta\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]\rightarrow L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ . \end{definition} Esta definici\'on junto con que $\rho_{q}\mathfrak{A}(\dhurw_{R}[[x]])$ es un anillo nos lleva a la siguiente definici\'on \begin{definition} Sea $Q$ un operador delta con conjunto base $q=(q_{n}(t))_{n\in\mathbb{N}}$. Definimos el anillo de semi sistemas din\'amicos tipo delta como el conjunto \begin{equation} (R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[x]],\rho_{q}\mathfrak{A}(\dhurw_{R}[[x]]))=\{(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[x]],\Psi_{Q}):\Psi_{Q}=\rho_{q}\mathfrak{A}(\Delta f)\} \end{equation} donde \begin{small} \begin{eqnarray*} (R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[x]],\rho_{q}\mathfrak{A}(\Delta f))\boxplus_{q}(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[x]],\rho_{q}\mathfrak{A}(\Delta g))&=&(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[x]],\rho_{q}\mathfrak{A}(\Delta(f+g))) \end{eqnarray*} y \begin{eqnarray*} (R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[x]],\rho_{q}\mathfrak{A}(\Delta f))\circledast_{q}(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[x]],\rho_{q}\mathfrak{A}(\Delta g))&=&(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[x]],\rho_{q}\mathfrak{A}(\Delta(f\ast g))) \end{eqnarray*} \end{small} y en donde $(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[x]],0)$ y $(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[x]],t)$ son las unidades con respecto a $\boxplus_{q}$ y $\circledast_{q}$ respectivamente. \end{definition} Como veremos m\'as adelante el anillo $(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[x]],\rho_{q}\mathfrak{A}(\dhurw_{R}[[x]]))$ contiene todas las soluciones a las ecuaciones tipo delta $Q\Phi=f(\Phi)$ para cada función $f(x)$ en $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. Gracias a este anillo será posible descomponer las soluciones de una ecuación diferencial aut\'onoma tipo delta de orden uno en soluciones m\'as simples.\\ Un tipo importante de ecuaciones tipo delta se dan cuando $f(x)$ es un polinomio. Si $f(x)$ es separable, entonces podemos factorizar la soluci\'on de $Q\Phi=f(\Phi)$ usando la factorizaci\'on de $\rho_{q}\mathfrak{A}(\Delta f(x))$ en el anillo $\rho_{q}\mathfrak{A}(\dhurw_{R}[[x]])$. Primero calcularemos $\rho_{q}\mathfrak{A}(\Delta(ax+b))$ \begin{proposition}\label{prop_pol_lin} Sea $Q$ un operador delta con conjunto base $q=(q_{n}(t))_{n\in\mathbb{N}}$ y sea $Q=p(\delta)$. Entonces \begin{equation} \rho_{q}\mathfrak{A}(\Delta(ax+b))=\frac{1}{a}(ax+b)\left(e^{tp^{-1}(a)}-1\right), \end{equation} $a\neq0$ y en donde $p^{-1}$ es la serie de potencia formal inversa de $p$. \end{proposition} \begin{proof} Aplicamos los operadores $\Delta$, $\mathfrak{A}$ y $\rho_{q}$ a la funci\'on $f(x)=ax+b$. As\'i tenemos \begin{eqnarray*} \rho_{q}\mathfrak{A}(\Delta(ax+b))&=&\rho_{q}\mathfrak{A}(ax+b,a,0,...)\\ &=&\rho_{q}(ax+b,a(ax+b),a^{2}(ax+b),...)\\ &=&\sum_{n=1}^{\infty}a^{n-1}(ax+b)\frac{q_{n}(t)}{n!}\\ &=&\frac{1}{a}(ax+b)\sum_{n=1}^{\infty}a^{n}\frac{q_{n}(t)}{n!}\\ &=&\frac{1}{a}(ax+b)\left(e^{tp^{-1}(a)}-1\right) \end{eqnarray*} en donde hemos usado (\ref{eqn_exp_inver}). \end{proof} Ahora si $f(x)$ factoriza como $(a_{1}x+b_{1})(a_{2}x+b_{2})\cdots(a_{n}x+b_{n})$ entonces tenemos \begin{theorem}\label{theo_poly_prod} Sea $Q$ un operador delta con conjunto base $q=(q_{n}(t))_{n\in\mathbb{N}}$ y sea $Q=p(\delta)$. Suponga $f(x)=\prod_{k=1}^{n}(a_{k}x+b_{k})$ un polinomio separable en $\mathbb{F}[x]\subset\mathop{\mbox{\textsl{H}}}\nolimits_{\mathbb{F}}[[x]]$. Entonces \begin{equation} \rho_{q}\mathfrak{A}(\Delta f(x))=\bcastq_{k=1}^{n}\frac{1}{a_{k}}(a_{k}x+b_{k})\left(e^{tp^{-1}(a_{k})}-1\right) \end{equation} en donde $p^{-1}$ es la serie de potencia formal inversa de $p$. \end{theorem} \begin{proof} Por aplicaci\'on directa de la Proposici\'on \ref{prop_pol_lin}. \end{proof} Ahora mostraremos otra forma de calcular $Q\Phi=f(\Phi)$. Suponga que $f(x)=\sum_{k=0}^{n}a_{k}x^{k}$ es un polinomio de grado $n$ en $R[x]\subset\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. Queremos calcular el polinomio $\rho_{q}\mathfrak{A}(\Delta f(x))$. Usaremos la siguiente notaci\'on \begin{eqnarray}\label{eqn_pot_rho} \rho_{q}\mathfrak{A}[\Delta x]_{\circledast_{q}}^{k}&=&\rho_{q}\mathfrak{A}[\Delta x]\circledast_{q}\cdots\circledast_{q}\rho_{q}\mathfrak{A}[\Delta x] \end{eqnarray} Primero calcularemos los monomios $\rho_{q}\mathfrak{A}[\Delta x]_{\circledast_{q}}^{k}$ \begin{proposition}\label{lemma_potencia} Sea $Q$ un operador delta con conjunto base $q=(q_{n}(t))_{n\in\mathbb{N}}$ y sea $Q=p(\delta)$. Sea $L$ la representaci\'on umbral de $q_{n}(t)$. Cuando $k=0$ tenemos que $\rho_{q}\mathfrak{A}[\Delta x]_{\circledast_{q}}^{0}=at$ y cuando $k=1$, claramente $\rho_{q}\mathfrak{A}[\Delta x]_{\circledast_{q}}^{1}=x(e^{tp^{-1}(a)}-1)$. Para $k\geq2$ se tiene \begin{equation} \rho_{q}\mathfrak{A}[\Delta x]_{\circledast_{q}}^{k}=L\left(\frac{x}{\sqrt[k-1]{1-a(k-1)x^{k-1}t}}-x\right) \end{equation} \end{proposition} \begin{proof} En [?] fue mostrado que \begin{equation*} \rho_{t}\mathfrak{A}[\Delta x]_{\circledast}^{k}=\frac{x}{\sqrt[k-1]{1-a(k-1)x^{k-1}t}}-x. \end{equation*} Como $L$ es la representaci\'on umbral de $q_{n}(t)$, entonces $\rho_{q}\mathfrak{A}[\Delta x]_{\circledast}^{k}=L(\rho_{t}\mathfrak{A}[\Delta x]_{\circledast}^{k})$ y todo sigue de aqu\'i. \end{proof} Por aplicación directa de esta Proposici\'on tenemos el siguiente resultado \begin{theorem}\label{theo_poly_sum} Sea $Q$ un operador delta con conjunto base $q=(q_{n}(t))_{n\in\mathbb{N}}$ y sea $Q=p(\delta)$. Suponga $f(x)=\sum_{k=1}^{n}a_{k}x^{k}$ un polinomio $R[x]\subset\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. Entonces \begin{eqnarray} &&\rho_{q}\mathfrak{A}(\Delta f(x))=\bboxq_{k=0}^{n}\rho_{q}\mathfrak{A}[a_{k}\Delta x]_{\circledast_{q}}^{k}\nonumber\\ &&=a_{0}t\boxplus_{q}x(e^{tp^{-1}(a_{1})}-1)\boxplus_{q}\bboxq_{k=2}^{n}L\left(\frac{x}{\sqrt[k-1]{1-a_{k}(k-1)x^{k-1}t}}-x\right) \end{eqnarray} \end{theorem} Finalmente damos la definici\'on de sistemas din\'amicos tipo delta \begin{definition} Sea $Q$ un operador delta con conjunto base $q=(q_{n}(t))_{n\in\mathbb{N}}$ y denote $L$ la representaci\'on umbral de $q_{n}(t)$. Definimos un \textbf{sistema dinámico tipo delta} sobre el anillo $R$ como la terna $(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]],\Phi_{Q})$ donde $R$ es el \textbf{conjunto de tiempos}, $L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ el \textbf{espacio de fases} y $\Phi_{Q}$ es el \textbf{flujo delta} \begin{equation}\label{flujo_delta} \Phi_{Q}(t,x,\Delta f(x))=x+\sum_{n=1}^{\infty}A_{n}([\delta^{(n-1)}f(x)])\dfrac{q_{n}(t)}{n!}. \end{equation} esto es, $\Phi_{Q}$ es el mapa definido por $\Phi_{Q}:R\times L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]\times\Delta\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]\rightarrow L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ donde $S=\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. \end{definition} De este modo \begin{equation} \Phi_{Q}(t,x,\Delta f(x))=x+\rho_{q}\mathfrak{A}(\Delta f(x)) \end{equation} y junto con los Teoremas \ref{theo_poly_prod} y \ref{theo_poly_sum} encontramos la soluci\'on a la ecuaci\'on $Q\Phi=f(\Phi)$ cuando $f(x)$ es un polinomio. La representaci\'on umbral $L$ de $\Phi_{Q}(t,x,\Delta f(x))$ implica que \begin{enumerate} \item $\Phi_{Q}(0,x,\Delta f(x))=0$ \item $\Phi_{Q}(t+s,x,\Delta f(x))=\Phi_{Q}(t,\Phi_{Q}(s,x,\Delta f(x)),\Delta f(x))$ \item $Q\Phi_{Q}(t,x,\Delta f(x))=f(x)\delta_{x}\Phi_{Q}(t,x,\Delta f(x))=f(\Phi_{Q})$. \end{enumerate} Podemos reescribir (\ref{flujo_delta}) de la siguiente forma \begin{equation}\label{eqn_delta_rep} \Phi_{Q}(t,x,\Delta f(x))=\sum_{n=0}^{\infty}Q^{n}\Phi_{Q}(0,x,\Delta f(x))\frac{q_{n}(t)}{n!} \end{equation} Llamamos a (\ref{eqn_delta_rep}) una \textbf{delta representaci\'on formal} de $\Phi_{Q}(t,x,\Delta f(x))$. El \'ultimo resultado de esta secci\'on es mostrar que el conjunto de todos los flujos tipo delta forman un grupo \begin{theorem} Fije una $f(x)$ en $\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. Denote $\mathcal{F}$ el conjunto de flujos tipo delta $\Phi_{Q}$ soluci\'on de $Q\Phi_{Q}=f(\Phi_{Q})$ para todo $Q\in\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[\delta]]$. Tome operadores delta $A,B\in\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[\delta]]$ con polinomios base $(a_{n}(t))_{n\in\mathbb{N}}$ y $(b_{n}(t))_{n\in\mathbb{N}}$, respectivamente. Defina la composici\'on $\circledcirc$ de flujos deltas $\Phi_{A}$ y $\Phi_{B}$ por $\Phi_{A}\circledcirc\Phi_{B}=\Phi_{C}$, donde \begin{equation} \Phi_{C}=x+\sum_{n=1}^{\infty}A_{n}([\delta^{n-1}f(x)])\frac{c_{n}(t)}{n!}. \end{equation} y $c_{n}(t)=a_{n}(\underline{b}(t))$. Entonces $(\mathcal{F},\circledcirc)$ es un grupo de Lie con unidad $\Phi$. \end{theorem} \begin{proof} Como $(c_{n}(t))_{n\in\mathbb{N}}$ es una sucesi\'on de conjuntos base, entonces $\Phi_{C}\in\mathcal{F}$ y de aquí el producto $\circledcirc$ es cerrado en $\mathcal{G}$. Si $\Phi_{A}\circledcirc\Phi_{B}=\Phi$, entonces $c_{n}(t)=t^{n}$ implica que $(a_{n}(t))$ y $(b_{n}(t))$ son inversos con la composici\'on umbral. Luego $\Phi_{A}$ y $\Phi_{B}$ son inversos con respecto a $\circledcirc$. La asociatividad de $\circledcirc$ sigue de la asociatividad de la composici\'on de umbral $\circ$. De este modo $(\mathcal{F},\circledcirc)$ es un grupo. Ahora defina el mapa $\xi:\mathcal{F}\rightarrow\mathcal{U}$ por $\xi(\Phi_{A})=(a_{n}(t))_{n\in\mathbb{N}}$. Entonces $\xi(\Phi_{A}\circledcirc\Phi_{B})=(a_{n}(t))_{n\in\mathbb{N}}\circ(b_{n}(t))_{n\in\mathbb{N}}$. As\'i $\xi$ es un isomorfismo de grupos y por tanto $\mathcal{F}$ es un grupo de Lie. \end{proof} Ahora hallaremos la representaci\'on en serie de potencias formal de $\Phi_{Q}(t,x,\Delta f(x))$. Tendremos presente que $q_{n}(t)=\sum_{i=1}^{n}\beta_{n,i}t^{i}$. \begin{theorem}\label{theo_matriz} Sea $Q$ un operador delta con conjunto base $q=(q_{n}(t))_{n\in\mathbb{N}}$ con $q_{n}(t)=\sum_{k=1}^{n}\beta_{k,n}t^{k}$ para todo $n\geq1$. Entonces \begin{equation}\label{eqn_rel} \Phi_{Q}(t,x,\Delta f(x))=x+\sum_{n=1}^{\infty}\textbf{B}_{n}[\mathfrak{A}(\Delta f)\cdot F]t^{n} \end{equation} adem\'as \begin{equation}\label{eqn_rel_sum} \rho_{q}\mathfrak{A}(\Delta f)\boxplus_{q}\rho_{q}\mathfrak{A}(\Delta g)=\sum_{n=1}^{\infty}\textbf{B}_{n}[\mathfrak{A}(\Delta f)\boxplus\mathfrak{A}(\Delta g)]\cdot Ft^{n} \end{equation} y \begin{equation}\label{eqn_rel_prod} \rho_{q}\mathfrak{A}(\Delta f)\circledast_{q}\rho_{q}\mathfrak{A}(\Delta g)=\sum_{n=1}^{\infty}\textbf{B}_{n}[\mathfrak{A}(\Delta f)\circledast\mathfrak{A}(\Delta g)]\cdot Ft^{n} \end{equation} donde $\textbf{B}=(\textbf{B}_{n})_{n\in\mathbb{N}}$ es la \textbf{matriz de conexi\'on} conectando $(q_{n}(t))$ y $(t^{n})$ \begin{equation} \textbf{B}_{n}=(b_{n,i})_{n\in\mathbb{N}_{1}} \end{equation} \begin{equation} b_{n,i}= \begin{cases} 0, & i<n,\\ \beta_{n,i}, & i\geq n \end{cases} \end{equation} y $F=(1,\frac{1}{2!},\frac{1}{3!},...)$ y $\cdot$ es el producto de Hadamard de vectores, esto es, producto componente a componente \end{theorem} \begin{proof} Probaremos (\ref{eqn_rel}) solamente, pues una prueba para (\ref{eqn_rel_sum}) y (\ref{eqn_rel_prod}) son an\'aloga. Pongamos $A_{n}\equiv A_{n}([\delta^{n-1}f])$. Tenemos \begin{eqnarray*} \rho_{q}\mathfrak{A}(\Delta f)&=&\sum_{n=1}^{\infty}A_{n}(f)\frac{1}{n!}\sum_{k=1}^{n}\beta_{k,n}t^{k}\\ &=&A_{1}(f)\beta_{1,1}t+A_{2}(f)(\beta_{1,2}t+\beta_{2,2}t^{2})\frac{1}{2!}\\ &&+A_{3}(f)(\beta_{1,3}t+\beta_{2,3}t^{2}+\beta_{3,3}t^{3})\frac{1}{3!}+\cdots\\ &=&\left\{A_{1}(f)\beta_{1,1}+A_{2}(f)\beta_{1,2}\frac{1}{2!}+\cdots\right\}t\\ &&+\left\{A_{2}(f)\beta_{2,2}\frac{1}{2!}+A_{3}(f)\beta_{2,3}\frac{1}{3!}+\cdots\right\}t^{2} +\cdots \end{eqnarray*} Por otro lado \begin{eqnarray*} \textbf{B}[\mathfrak{A}(\Delta f)\cdot F]&=& \left( \begin{array}{cccc} \beta_{1,1}&\beta_{1,2}&\beta_{1,3}&\cdots\\ 0&\beta_{2,2}&\beta_{2,3}&\cdots\\ 0&0&\beta_{3,3}&\cdots\\ \vdots&\vdots&\vdots&\ddots \end{array} \right) \left( \begin{array}{c} \frac{A_{1}(f)}{1!}\\ \frac{A_{2}(f)}{2!}\\ \frac{A_{3}(f)}{3!}\\ \vdots \end{array} \right)\\ &=&(\textbf{B}_{1},\textbf{B}_{2},\textbf{B}_{3},...)[\mathfrak{A}(\Delta f)\cdot F]. \end{eqnarray*} Juntando todo obtenemos el resultado deseado. \end{proof} La matriz de conexi\'on del flujo $\Phi(t,x,\Delta f(x))$ es la matriz identidad infinita $\textbf{I}$. Si $\textbf{A}$ y $\textbf{B}$ son las matrices de conexi\'on de los flujos $\Phi_{A}$ y $\Phi_{B}$, entonces $\textbf{BA}$ es la matriz de conexi\'on de $\Phi_{A}\circledcirc\Phi_{B}$. Luego el conjunto de matrices de conexi\'on forman un grupo y tenemos el siguiente \begin{theorem} Denote $\mathcal{C}$ el grupo de matrices de conexi\'on de conjuntos bases. Entonces $\mathcal{F}$ es anti-isomorfo a $\mathcal{C}$. \end{theorem} \begin{proof} Sean $A,B\in\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[\delta]]$ operadores delta con conjuntos base $(a_{n}(t))_{n\in\mathbb{N}}$ y $(b_{n}(t))_{n\in\mathbb{N}}$, respectivamente y sea $\Phi_{C}=\Phi_{A}\circledcirc\Phi_{B}$ con $c_{n}(t)=a_{n}(\underline{b}(t))$. Ahora sean $a_{n}(t)=\sum_{k=0}^{n}\alpha_{k,n}t^{k}$, $b_{n}(t)=\sum_{k=0}^{n}\beta_{k,n}t^{k}$ y $c_{n}(t)=\sum_{k=0}^{n}\alpha_{k,n}t^{k}$ con matrices de conexi\'on $\textbf{A},\textbf{B}$ y $\textbf{C}$. Defina el mapa $\mu:\mathcal{F}\rightarrow\mathcal{C}$ por $\mu(\Phi_{A})=\textbf{A}$. Entonces $\mu(\Phi_{A}\circledcirc\Phi_{B})=\mu(\Phi_{C})=\textbf{B}\textbf{A}=\mu(\Phi_{B})\mu(\Phi_{A})$. Adem\'as $\mu(\Phi)=\textbf{I}$ y $\mu(\Phi_{A}^{-1})=\mu(\Phi_{A})^{-1}$, en donde $\Phi_{A}^{-1}$ es el flujo inverso de $\Phi_{A}$. Luego $\mu$ es un anti-isomorfismo de grupos. \end{proof} Finalizamos este art\'iculo mostrando ejemplos de sistemas din\'amicos tipo delta. En particular cuando $Q$ es alguno de los siguientes operadores: $\vartriangle$, $\triangledown$, $E^{\alpha}\delta$ y $\log(I+\delta)$. \section{Sistemas din\'amicos de diferencia forward} Un sistema din\'amico discreto uni-dimensional es uno de la forma \begin{equation}\label{eqn_sdd} y_{n+1}=g(y_{n}) \end{equation} en donde $n\in\mathbb{N}$. Este tipo de ecuaciones son de gran importancia por sus aplicaciones en econom\'ia, ciencias sociales, biolog\'ia, f\'isica, ingenier\'ia, redes neurales, etc. La ecuaci\'on (\ref{eqn_sdd}) generalmente no tiene soluci\'on exacta cuando $g$ es una funci\'on no lineal. Sin embargo, los resultados anteriores permiten echar a un lado esta limitaci\'on. Usamos la diferencia forward $\vartriangle$ de $y_{n}$, esto es, $\vartriangle y_{n}=y_{n+1}-y_{n}$. Luego (\ref{eqn_sdd}) es equivalente a la ecuaci\'on \begin{equation} \vartriangle y_{n}=f(y_{n}) \end{equation} en donde $f(x)=g(x)-x$. El operador $\vartriangle$ es un operador delta con conjunto base $q=((t)_{n})_{n\in\mathbb{N}}$ donde $(t)_{n}=t(t-1)(t-2)\cdots(t-n+1)$ y \begin{enumerate} \item $(t)_{0}=1$, \item $(0)_{n}=0$, \item $\vartriangle(t)_{n}=n(t)_{n-1}$ \end{enumerate} Sea $L$ la representaci\'on umbral de $(t)_{n}$. Tenemos \begin{definition} Definimos un \textbf{sistema dinámico forward} sobre el anillo $R$ como la terna $(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]],\Phi_{\vartriangle})$ donde $R$ es el \textbf{conjunto de tiempos}, $L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ el \textbf{espacio de fases} y $\Phi_{\vartriangle}$ es el \textbf{flujo forward} \begin{equation}\label{flujo_diferencial} \Phi_{\vartriangle}(t,x,\Delta f(x))=x+\sum_{k=1}^{\infty}A_{k}([\delta^{(k-1)}f(x)])\frac{(t)_{k}}{k!}. \end{equation} esto es, $\Phi_{\vartriangle}$ es el mapa definido por $\Phi_{\vartriangle}:R\times L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]\times\Delta\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]\rightarrow L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ donde $S=\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. \end{definition} Por definici\'on $\frac{(t)_{n}}{n!}=\binom{t}{n}$. Entonces \begin{equation}\label{eqn_flujo_for} \Phi_{\vartriangle}(t,x,\Delta f(x))=x+\sum_{k=1}^{\infty}A_{k}([\delta^{(n-1)}f(x)])\binom{t}{k} \end{equation} es la soluci\'on de (\ref{eqn_sdd}) para todo $t$ en el dominio $R$. Cuando $t\in\mathbb{N}$, entonces (\ref{eqn_flujo_for}) se reduce a \begin{equation} y_{n}=\Phi_{\vartriangle}(n,x,\Delta f(x))=x+\sum_{k=1}^{n}A_{k}([\delta^{(n-1)}f(x)])\binom{n}{k} \end{equation} y tenemos una soluci\'on exacta a la ecuaci\'on (\ref{eqn_sdd}) para todo $f(x)=g(x)-x\in\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. Es de inter\'es notar que $\Phi_{\vartriangle}$ es una funci\'on de coeficientes binomiales. Luego es posible una interpretaci\'on combinatorial a estas soluciones. Por un uso directo de la prueba de la Proposici\'on \ref{prop_pol_lin} obtenemos \begin{equation} \rho_{q}\mathfrak{A}(\Delta(ax+b))=\frac{1}{a}(ax+b)\left((1+a)^{t}-1\right) \end{equation} y si $f(x)=\prod_{k=1}^{m}(a_{k}x+b_{k})$ entonces \begin{equation}\label{eqn_sdd_poli} \Phi_{\vartriangle}(t,x,\Delta f(x))=x+\bcastq_{k=1}^{m}\frac{1}{a_{k}}(a_{k}x+b_{k})\left((1+a_{k})^{t}-1\right) \end{equation} es soluci\'on de la ecuaci\'on en diferencias \begin{equation} \vartriangle y_{n}=(a_{1}y_{n}+b_{1})(a_{2}y_{n}+b_{2})\cdots(a_{m}y_{n}+b_{m}). \end{equation} Como caso particular tenemos la ecuaci\'on logistica. Esta es la ecuaci\'on en diferencias de orden uno no lineal m\'as simple y hasta ahora no exist\'ia una soluci\'on en forma cerrada para ella. Esta ecuaci\'on es encontrada en cualquier libro de texto b\'asico sobre ecuaciones de diferencias. Esta ecuaci\'on se escribe como \begin{equation}\label{eqn_logis} y_{n+1}=\mu y_{n}(1-y_{n}). \end{equation} Para resolverla debemos resolver la ecuaci\'on equivalente $\vartriangle y_{n}=y_{n}(\mu-1-\mu y_{n})=-y_{n}(\mu y_{n}-(\mu-1))$. Aqu\'i $f(x)=-x(\mu x-(\mu-1))$. Luego \begin{eqnarray*} \Phi_{\vartriangle}(t,x,\Delta f(x))&=&x+\Psi_{\vartriangle}(t,x,-\Delta x)\circledast_{\vartriangle}\Psi_{\vartriangle}(t,x,-\Delta(\mu x-(\mu-1)))\\ &=&x+(-x)\circledast_{\vartriangle}[\mu x-(\mu-1)](2^{t}-1) \end{eqnarray*} Con esta soluci\'on notamos que \begin{eqnarray*} \Phi_{\vartriangle}(t,0,\Delta f(x))&=&0\\ \Phi_{\vartriangle}\left(t,\frac{\mu-1}{\mu},\Delta f(x)\right)&=&\frac{\mu-1}{\mu} \end{eqnarray*} As\'i los ceros de $-x(\mu x-(\mu-1))$ corresponde con los puntos fijos de $\mu x(1-x)$. Por otro lado, la ecuaci\'on log\'istica continua $y^{\prime}=-y(\mu y-(\mu-1))$ tiene flujo \begin{equation} \Phi(t,x,\Delta f(x))=\frac{(\mu-1)xe^{(\mu-1)t}}{\mu x(e^{(\mu-1)t}-1)+(\mu-1)}. \end{equation} Luego usando la representaci\'on umbral $L(t^{n})=(t)_{n}$ obtenemos otra forma de escribir la soluci\'on de (\ref{eqn_logis}) \begin{equation} L\left(\frac{(\mu-1)xe^{(\mu-1)t}}{\mu x(e^{(\mu-1)t}-1)+(\mu-1)}\right)=x+(-x)\circledast_{\vartriangle}[\mu x-(\mu-1)](2^{t}-1). \end{equation} Otra aplicaci\'on importante de las ecuaciones de diferencias la encontramos en la teor\'ia de fractales, especialmente en mapas polinomiales iterativos. Uno de tales mapas son los mapas cuadr\'aticos complejos $z_{n+1}=z_{n}^{2}+c$ \'utiles para construir conjuntos de Mandelbrot. Por ser una ecuaci\'on en diferencias de orden uno podemos usar (\ref{eqn_sdd_poli}) para encontrar la soluci\'on exacta a dicho mapa. Resolver \begin{equation} z_{n+1}=z_{n}^{2}+c \end{equation} es resolver la ecuaci\'on equivalente \begin{equation} \vartriangle z_{n}=z_{n}^{2}-z_{n}+c \end{equation} Para este caso tenemos que $f(x)=x^{2}-x+c=(x-\alpha)(x-\overline{\alpha})$ en donde $\alpha=\frac{1+\sqrt{4c-1}i}{2}$. Luego \begin{eqnarray*} z_{n}&=&\Phi_{\vartriangle}(n,x,\Delta f(x))\\ &=&x+\Psi_{\vartriangle}(n,x,\Delta(x-\alpha))\circledast_{\vartriangle}\Psi_{\vartriangle}(n,x,\Delta(x-\overline{\alpha}))\\ &=&x+[(x-\alpha)(2^{n}-1)]\circledast_{\vartriangle}[(x-\overline{\alpha})(2^{n}-1)] \end{eqnarray*} Igualmente como se hizo con la ecuaci\'on log\'istica tenemos \begin{equation} L\left(\frac{\overline{\alpha}e^{\sqrt{4c-1}it}(x-\alpha)-\alpha(x-\overline{\alpha})}{(x-\alpha)e^{\sqrt{4c-1}it}-(x-\overline{\alpha})}\right)=x+[(x-\alpha)(2^{n}-1)]\circledast_{\vartriangle}[(x-\overline{\alpha})(2^{n}-1)] \end{equation} \section{Sistemas din\'amicos de diferencia backward} Si $Q$ es el operador backward $\triangledown$, entonces su conjunto base son los factoriales rising $q=((t)^{n})_{n\in\mathbb{N}}$ donde $(t)^{n}=t(t+1)(t+2)\cdots(t+n-1)$ y \begin{enumerate} \item $(t)^{0}=1$, \item $(0)^{n}=0$, \item $\triangledown(t)^{n}=n(t)^{n-1}$ \end{enumerate} Con el operador backward podemos resolver ecuaciones en diferencias de la forma \begin{equation} \triangledown y_{n}=f(y_{n}) \end{equation} en donde $\triangledown y_{n}=y_{n}-y_{n-1}$. Las ecuaciones en diferencias backward se aplican en las mismas \'areas en donde son aplicados las ecuaciones en diferencias forward. Sea $L(t^{n})=(t)^{n}$ la representaci\'on umbral de $(t)^{n}$. Entonces tenemos la siguiente definici\'on \begin{definition} Definimos un \textbf{sistema dinámico backward} sobre el anillo $R$ como la terna $(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]],\Phi_{\triangledown})$ donde $R$ es el \textbf{conjunto de tiempos}, $L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ el \textbf{espacio de fases} y $\Phi_{\triangledown}$ es el \textbf{flujo backward} \begin{equation}\label{flujo_diferencial} \Phi_{\triangledown}(t,x,\Delta f(x))=x+\sum_{k=1}^{\infty}A_{k}([\delta^{(k-1)}f(x)])\frac{(t)^{k}}{k!}. \end{equation} esto es, $\Phi_{\triangledown}$ es el mapa definido por $\Phi_{\triangledown}:R\times L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]\times\Delta\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]\rightarrow L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ donde $S=\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. \end{definition} Por definici\'on $\frac{(t)^{k}}{k!}=\binom{t+k-1}{k}=\genfrac{\langle}{\rangle}{0pt}{}{t}{k}$. Entonces \begin{equation} \Phi_{\triangledown}(t,x,\Delta f(x))=x+\sum_{k=1}^{\infty}A_{k}([\delta^{(n-1)}f(x)])\genfrac{\langle}{\rangle}{0pt}{}{t}{k} \end{equation} El n\'umero $\genfrac{\langle}{\rangle}{0pt}{}{n}{k}$ es conocido como coeficiente binomial con repeticiones y es usado para contar multiset de cardinalidad $k$ con elementos tomados de un conjunto de $n$ elementos. Denote $\mathop{\mbox{\textsf{exp}}}\nolimits(a)$ la sucesi\'on $(a^{n})_{n\in\mathbb{N}_{1}}$ en $H_{R}$. En [3] fue mostrado que \begin{equation}\label{eqn_R_prod} \mathfrak{A}(a\Delta f(x))=\mathop{\mbox{\textsf{exp}}}\nolimits(a)\mathfrak{A}(\Delta f(x)), \end{equation} El siguiente resultado relaciona a los sistemas din\'amicos discretos de tipo forward y backward \begin{theorem} Para todo $f(x)\in\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$ se cumple \begin{equation} \Phi_{\triangledown}(t,x,\Delta f(x))=\Phi_{\vartriangle}(-t,x,-\Delta f(x)). \end{equation} \end{theorem} \begin{proof} Sabemos que $\genfrac{\langle}{\rangle}{0pt}{}{t}{k}=(-1)^{k}\binom{-t}{k}$. As\'i \begin{eqnarray*} \Phi_{\triangledown}(t,x,\Delta f(x))&=&x+\sum_{k=1}^{\infty}A_{k}([\delta^{(n-1)}f(x)])\genfrac{\langle}{\rangle}{0pt}{}{t}{k}\\ &=&x+\sum_{k=1}^{\infty}A_{k}([\delta^{(n-1)}f(x)])(-1)^{k}\binom{-t}{k}\\ &=&\Phi_{\vartriangle}(-t,x,-\Delta f(x)) \end{eqnarray*} en donde hemos usado el (\ref{eqn_R_prod}) con $a=-1$. \end{proof} Por otro lado, podemos usar el anterior teorema y la ecuaci\'on (\ref{eqn_sdd_poli}) para mostrar que \begin{equation} \Phi_{\triangledown}(t,x,\Delta f(x))=x+\bcastq_{k=1}^{m}\frac{1}{a_{k}}(a_{k}x+b_{k})((1-a_{k})^{t}-1) \end{equation} es soluci\'on de la ecuaci\'on en diferencia backward \begin{equation} \triangledown y_{n}=(a_{1}y_{n}+b_{1})(a_{2}y_{n}+b_{2})\cdots(a_{m}y_{n}+b_{m}). \end{equation} El teorema anterior implica que es suficiente con resolver uno de los dos tipos de ecuaciones de diferencias y luego por aplicaci\'on de este obtener la soluci\'on del otro tipo. \section{Sistemas din\'amicos tipo Abel} Denote $A(\alpha)$ el operador delta $E^{\alpha}\delta$. Este operador es conocido como operador Abel donde sus polinomios bases son los polinomios de Abel $(t(t-n\alpha)^{n-1})_{n\in\mathbb{N}}$ y \begin{enumerate} \item $t(t)^{-1}=1$, \item $0(0-n\alpha)^{n-1}=0$, \item $A(\alpha)t(t-n\alpha)^{n-1})=nt(t-(n-1)\alpha)^{n-2}$ \end{enumerate} Los polinomios de Abel fueron estudiados en [1] en la representaci\'on de funciones. Queremos resolver ecuaciones de la forma \begin{equation} A(\alpha)\Phi=f(\Phi). \end{equation} Sea $L$ la representaci\'on umbral de $(t(t-n\alpha)^{n-1})_{n\in\mathbb{N}}$. Tenemos la siguiente definici\'on \begin{definition} Definimos un \textbf{sistema dinámico tipo Abel} sobre el anillo $R$ como la terna $(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]],\Phi_{A(\alpha)})$ donde $R$ es el \textbf{conjunto de tiempos}, $L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ el \textbf{espacio de fases} y $\Phi_{A(\alpha)}$ es el \textbf{flujo Abel} \begin{equation}\label{flujo_diferencial} \Phi_{A(\alpha)}(t,x,\Delta f(x))=x+\sum_{n=1}^{\infty}A_{n}([\delta^{(n-1)}f(x)])\frac{t(t-n\alpha)^{n-1}}{n!}. \end{equation} esto es, $\Phi_{A(\alpha)}$ es el mapa definido por $\Phi_{A(\alpha)}:R\times L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]\times\Delta\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]\rightarrow L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ donde $S=\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. \end{definition} Usando (\ref{eqn_sdd_poli}) encontramos que \begin{equation} \Phi_{A(\alpha)}(t,x,\Delta f(x))=x+\bcastq_{k=1}^{m}\frac{1}{a_{k}}(a_{k}x+b_{k})\left(e^{tW(\alpha)/\alpha}-1\right), \end{equation} en donde $W$ es la funci\'on $W$ de Lambert, es la soluci\'on de la ecuaci\'on \begin{equation} A(\alpha)\Phi=(a_{1}\Phi+b_{1})(a_{2}\Phi+b_{2})\cdots(a_{n}\Phi+b_{n}) \end{equation} La siguiente identidad relaciona los flujos de las ecuaciones $A(\alpha)\Phi=af(\Phi)$ y $A(a\alpha)\Phi=f(\Phi)$ \begin{theorem} Para todo $a\in R$ se cumple \begin{equation} \Phi_{A(\alpha)}(t,x,a\Delta f(x))=\Phi_{A(a\alpha)}(at,x,\Delta f(x)). \end{equation} \end{theorem} \begin{proof} \begin{eqnarray*} \Phi_{A(\alpha)}(t,x,a\Delta f(x))&=&x+\sum_{n=1}^{\infty}a^{n}A_{n}([\delta^{(n-1)}f(x)])\frac{t(t-n\alpha)^{n-1}}{n!}\\ &=&x+\sum_{n=1}^{\infty}A_{n}([\delta^{(n-1)}f(x)])\frac{(at)(at-na\alpha)^{n-1}}{n!}\\ &=&\Phi_{A(a\alpha)}(at,x,\Delta f(x)). \end{eqnarray*} \end{proof} Con esta identidad podremos, quizas, darle una estructura m\'as que de grupo uni par\'ametrico que la que se obtiene con el flujo de tipo Abel, pero no ser\'a hecho en este art\'iculo. \section{Sistemas din\'amicos tipo Touchard} Los polinomios de Touchard son polinomios de la forma \begin{equation} \phi_{n}(t)=\sum_{k=0}^{n}S(n,k)t^{k} \end{equation} en donde $S(n,k)$ son los n\'umeros de Stirling de segunda clase. Los polinomios de Touchard son polinomios base del operador delta de Touchard $T=\log(I+\delta)$ y satisfacen \begin{enumerate} \item $\phi_{0}(t)=1$, \item $\phi_{n}(0)=0$, \item $\log(I+\delta)\phi_{n}(t)=n\phi_{n-1}(t)$. \end{enumerate} Sea $L$ la representaci\'on umbral de $\phi_{n}(t)$. Entonces tenemos la definici\'on \begin{definition} Definimos un \textbf{sistema dinámico tipo Touchard} sobre el anillo $R$ como la terna $(R,L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]],\Phi_{T})$ donde $R$ es el \textbf{conjunto de tiempos}, $L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ el \textbf{espacio de fases} y $\Phi_{T}$ es el \textbf{flujo Touchard} \begin{equation}\label{flujo_diferencial} \Phi_{T}(t,x,\Delta f(x))=x+\sum_{n=1}^{\infty}A_{n}([\delta^{(n-1)}f(x)])\dfrac{\phi_{n}(t)}{n!}. \end{equation} esto es, $\Phi_{T}$ es el mapa definido por $\Phi_{T}:R\times L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]\times\Delta\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]\rightarrow L\mathop{\mbox{\textsl{H}}}\nolimits_{S}[[t]]$ donde $S=\mathop{\mbox{\textsl{H}}}\nolimits_{R}[[x]]$. \end{definition} Usando (\ref{eqn_sdd_poli}) encontramos que \begin{equation} \Phi_{T}(t,x,\Delta f(x))=x+\bcastq_{k=1}^{m}\frac{1}{a_{k}}(a_{k}x+b_{k})\left(e^{t(e-1)}-1\right) \end{equation} es el flujo de Touchard de la ecuaci\'on \begin{equation} \log(I+\delta)\Phi=(a_{1}\Phi+b_{1})(a_{2}\Phi+b_{2})\cdots(a_{n}\Phi+b_{n}) \end{equation} \section{Conclusi\'on} En este art\'iculo los sistemas din\'amicos tipo delta fueron definidos y algunas de sus propiedades estudiadas. La teor\'ia aqu\'i desarrollada es muy \'util para resolver sistemas din\'amicos tipo delta no lineales. Particularmente los sistemas din\'amicos de diferencia y de tipo Touchard pueden ser \'util para resolver problemas en combinatoria enumerativa. Como los polinomios de Abel son usados en la teor\'ia algebraica estad\'istica, entonces los sistemas din\'amicos tipo Abel podr\'ian ser \'util para aplicaciones en estad\'istica. En este art\'iculo la derivaci\'on fue variada. Estamos interesados en variar el dominio de integridad y dejar fijo el operador delta y de esta forma estudiar los distintos resultados que se pueden obtener. Otra posibilidad es variar el factorial, esto es, construir una teor\'ia para un factorial generalizado.
\section{Introduction} Accurate theoretical predictions of properties of the ground and excited states of few-atomic molecules are of crucial importance for preparation and interpretation of different fundamental physical experiments such as laser-synthesis of diatomics~\cite{Ferber2009,Orban2015}, laser cooling of diatomic and polyatomic molecules, experiments aimed at the search for the fundamental symmetry violations effects such as the electron electric dipole moment, etc. In particular, both diagonal and off-diagonal matrix elements of magnetic dipole hyperfine structure (HFS) and other operators, strongly localized in vicinities of atomic nuclei and sometimes referred to as core property operators, are required for the accurate treatment of non-adiabatic effects~\cite{Petrov:13,Skripnikov:2019a}, parity non-conserving amplitudes~\cite{Geddes:18} and some other transition properties in molecules. In this regard, magnetic dipole hyperfine structure calculations are of particular interest since they are conventionally used as a probe of the accuracy of theoretical predictions. \begin{figure} \center \includegraphics[scale=0.3]{KCs-PEC} \caption{Potential energy curves of the $X^1\Sigma^+$ and $a^3\Sigma^+$ states of the KCs molecule.}\label{fig:pec} \end{figure} An optimization of paths of laser synthesis of diatomic alkali molecules requires exceptionally complete information on both the energy and radiative properties of their rovibronic states, typically provided by nonadiabatic models including both \textit{ab initio} and spectroscopic data \cite{Pazyuk2015,Klincare2012}. In this connection the most challenging problem is the accurate description of the complex formed by the ground and the first excited electronic states of alkali dimers, $X{}^1\Sigma^+ \sim a{}^3\Sigma^+$ (see Fig. \ref{fig:pec} for KCs), since rovibrational levels belonging to this complex are exploited as the working ones at the first step of any laser synthesis procedure (photoassociation or magnetoassociation). The $X{}^1\Sigma^+ - a{}^3\Sigma^+$ mixing due to the hyperfine interaction results in extremely complex compositions of rovibronic states near the dissociation limit \cite{Ferber2009,Orban2015}. Most nonadiabatic models of the $X{}^1\Sigma^+ \sim a{}^3\Sigma^+$ complex constructed to date assumed hyperfine interaction matrix elements to be constant with respect to the internuclear distance $R$, and thus their values were derived from the atomic ones (for example, see \cite{Ferber2009} and references therein). However, there are indications that the hyperfine interaction matrix elements actually depend on $R$ at least in the bound region of potential energy curves (PECs) \cite{Docenko2011,Lysebo2013,Temelkov2015}, but the character of this dependence is quite unclear since no highly reliable calculations of the HFS matrix elements in alkali diatomics were reported. The clarification of this question can not only justify the neglect of $R$-dependence for large values of $R$, but also bring the nonadiabatic models to a new level of accuracy which will be adequate to the current level of high-resolution molecular spectroscopy. In the present paper, we report \textit{ab initio} calculations of the HFS matrix elements in the KCs molecule. The relativistic Fock space coupled cluster (FS-RCC) method \cite{Visscher2001} combined with the denominator-shift technique was employed throughout the paper. This combination has been proven to be a powerful tool for modeling both the energy and radiative properties of such molecules \cite{Zaitsevskii2017,Znotins2019}. Being able to treat relativistic and correlation effects simultaneously, which is of particular importance for really high-precision simulations of systems containing heavy nuclei \cite{Eliav2017}, the FS-RCC method is not well-suitable for analytic calculation of density matrices and calculation of properties due to difficulties with the extraction of explicit wave functions \cite{Szalay1995,Zaitsevskii2018}. This difficulty can be bypassed by using the finite-field (FF) approach. This approach is straightforward for diagonal matrix elements and is based on the Hellmann-Feynman theorem. However, its extension to the case of off-diagonal elements originally introduced in the multireference perturbation theory framework \cite{Zaitsevskii1998} and recently generalized for the case of the Fock space coupled cluster method \cite{Zaitsevskii2018} also allows one to avoid analytic construction of CC transition density matrices. Moreover, within this approach, all off-diagonal matrix elements of interest can be obtained simultaneously. Here we report the first application of the off-diagonal FF technique to calculation of core property matrix elements. In Sec. \ref{sec:theory} we present the theory underlying the magnetic dipole hyperfine interaction in molecules and the extension of the finite-field technique to off-diagonal HFS matrix elements. Technical details describing the computational approach are given in Sec. \ref{sec:comput}. Sec. \ref{sec:results} reports the calculations of the HFS matrix elements mixing the $X{}^1\Sigma^+$ and $a{}^3\Sigma^+$ states of the KCs molecule, including the discussion of the corresponding selection rules, the role of core relaxation and correlation, the dependence of the HFS matrix elements on internuclear separation and the analysis of possible errors. The final Sec. \ref{sec:conclusion} concludes on our research. \section{Theoretical considerations}\label{sec:theory} \subsection{Molecular hyperfine structure} The magnetic dipole hyperfine interaction of the nuclear magnetic moment $\bm{\mu} = \mu\mu_N \mathbf{I}/I$ (where $\mu$ is the value of the nuclear magnetic moment in nuclear magnetons $\mu_N$ and $\mathbf{I}$ is the nuclear spin) with electrons is given by the following operator (see, e.g.~\cite{Norman2018}) \begin{equation}\label{eq:hhfs} H_{\rm hf}= \bm{\mu} \cdot\bm{T}, \end{equation} where the electronic part of the operator is \begin{equation}\label{eq:hfsEl} \bm{T}=\sum_i \frac{[\mathbf{r}_i\times \bm{\alpha}_i]}{r_i^3}, \end{equation} $\bm{\alpha}$ is the set of Dirac alpha matrices and $\mathbf{r}_i$ is a radius-vector of electron $i$ with respect to the center of the chosen nucleus with the magnetic moment $\mu$. In the present paper we are interested in matrix elements of the operator (\ref{eq:hfsEl}) between two electronic states with wavefunctions $\psi_n$ and $\psi_m$: \begin{equation}\label{eq:aperp} A_{\eta}^{nm} = \frac{\mu}{I} \braket{ \psi_n | T_{\eta} | \psi_m}, \end{equation} where $\eta=x,y,z$. In these designations the usual ``pa\-ral\-lel'' component of the HFS constant, i.e. diagonal matrix element of the HFS operator, for the given electronic state $\psi_n$ of the diatomic molecule with the total electronic angular momentum projection $\Omega$ onto the internuclear axis $z$ is: \begin{equation}\label{eq:apar} A_{||} = \frac{1}{\Omega} A_{\eta}^{nn}=\frac{\mu}{I \Omega} \braket{ \psi_n | T_z | \psi_n}. \end{equation} The diagonal matrix elements (\ref{eq:apar}) are non-zero for all $\Omega > 0$; off-diagonal matrix elements are non-zero for electronic states with $\Delta \Omega = 1$ or $0^+$ and $0^-$ states. For the case of the $X^1\Sigma^+ \sim a^3\Sigma^+$ complex in KCs these selection rules result in non-zero matrix elements $1 - 1$, $0^+ - 0^-$, $0^- - 1$ and $0^+ - 1$ (we note that the ${}^3\Sigma^+$ state consists of the $0^-$ and $1$ spin-orbit-split states, while the ${}^1\Sigma^+$ state remains unsplit, $0^+$). At the K(${}^2S$)+Cs(${}^2S$) dissociation limit all these non-zero matrix elements converge to the atomic HFS constant (up to a factor 1/2, arising from the $\Omega = 1/2$ value for the atomic ${}^2S$ state). It should be emphasized that in all the previous studies of HFS in alkali dimers the non-relativistic approximation to the Hamiltonian (\ref{eq:hhfs}) was employed; the Fermi-contact term was shown to be dominant in the HFS mixing of the $X{}^1\Sigma^+$ and $a{}^3\Sigma^+$ states \cite{Lysebo2013}. The relativistic form of the HFS Hamiltonian (\ref{eq:hhfs}) is more general and precise, including the paramagnetic spin-orbit, Fermi-contact, and spin-dipole hyperfine operators. \subsection{Finite-field approach to hyperfine interaction matrix element calculations} Since multireference coupled cluster models do not provide closed expressions for wavefunctions, the evaluation of property matrix elements through constructing pure-state and transition density matrices is normally very costly \cite{Szalay1995} or some linearization approximations are required. However, most properties represented by one-electron operators can be calculated in a more convenient manner by numerical differentiation with respect to the amplitude of some external perturbation. This approach usually called the finite-field method is widely used to evaluate expectation values. For example, the magnetic dipole hyperfine structure constant for the electronic state $\psi_n$ can be considered as the partial derivative of molecular energy with respect to the parameter $\lambda$ formally setting the strength of the hyperfine interaction, $H_{\rm hf} \to \lambda H_{\rm hf}$: \begin{equation} \braket{\psi_n|T_{\eta}|\psi_n} = \frac{\partial E_n}{\partial \lambda} \left| \begin{array}{l}\\_{\!\lambda=0}\end{array}\right. . \label{ffdiag} \end{equation} The counterpart of Eq.~(\ref{ffdiag}) for off-diagonal matrix elements can be obtained from the approximate Hellmann-Feynman-like relation for effective operators formulated in Ref.~\cite{Zaitsevskii1998}. For the case of the magnetic dipole hyperfine structure, the $\braket{\psi_n|T_{\eta}|\psi_m}$ matrix element between two electronic states with wavefunctions $\psi_n$ and $\psi_m$ satisfy the approximate relation \begin{equation} \braket{\psi_n|T_{\eta}|\psi_m} \approx (E_m - E_n) \left< \tilde{\psi}_n^{\perp\perp}(\lambda_\eta) \left| \frac{\partial}{\partial \lambda_\eta} \tilde{\psi}_m(\lambda_\eta)\right. \right> \left| \begin{array}{l}\\_{\!\lambda_\eta=0}\end{array}\right.\!\! . \label{ffhfs} \end{equation} Here $\eta=x,\,y,\,z$ and $\tilde{\psi}^{\perp\perp}$, $\tilde{\psi}$ denote left and right eigenvectors of the field-dependent non-Hermitian FS-RCC effective Hamiltonian acting in the field-independent (constructed for $\lambda=0$) model space, and $E_{m}$ and $E_{n}$ are the field-free energies of the involved states. The derivative in the r.h.s. of Eq. (\ref{ffhfs}) is readily estimated by the finite difference method. Although the formula (\ref{ffhfs}) involves only the effective Hamiltonian eigenvectors (the model space projections of many-electron wavefunctions), the resulting matrix elements estimates implicitly incorporate the bulk of the contributions from the remainder parts of these wavefunctions~\cite{Zaitsevskii1998,Zaitsevskii2018}. Note that the approximate matrix elements $\braket{\psi_n|T_{\eta}|\psi_m}$ and $\braket{\psi_m|T_{\eta}|\psi_n}^*$ defined by Eq.~(\ref{ffhfs}) generally do not coincide due to the non-Hermitian nature of the FS-RCC effective Hamiltonian. To prevent the appearance of unphysical differences between these quantities (which are normally within 1\%), the preliminary transformation of the non-Hermitian FSRCC effective Hamiltonians to the Hermitian form \emph{via} the symmetric orthogonalization of their eigenvectors can be performed. For the case of the KCs molecule the differentiation (\ref{ffdiag}) allows one to obtain only the diagonal $1 - 1$ matrix element; the other three ($0^+ - 0^-$, $0^- - 1$ and $0^+ - 1$) can be calculated within the relation (\ref{ffhfs}). Furthermore, in alkali dimer molecules the lowest $0^-$ and $1$ electronic states corresponding to the $a^3\Sigma^+$ state are nearly not perturbed by the spin-orbit interaction with higher-lying states and hence are actually degenerate (see Fig. \ref{fig:pec}). This results in insurmountable numerical instabilities when using (\ref{ffhfs}) and the $0^- - 1$ matrix element cannot be accessed within the current formulation of the finite-field technique. However, this does not give rise to any problem since the $1 - 1$ and $0^- - 1$ matrix elements are expected to have nearly the same values (and the same dependence on internuclear distance, which is even more important here). \section{Computational details}\label{sec:comput} The relativistic Fock space coupled cluster method with single and double excitations (FS-RCCSD), recently demonstrated to be ideally suitable for high-precision modeling of energy and radiative properties of alkali diatomics \cite{Znotins2019}, was used throughout. The coupled cluster calculations were carried out within the EXP-T program package \cite{Oleynichenko2020} \footnote{See also http://www.qchem.pnpi.spb.ru/expt, accessed on 28 June 2020}. Molecular spinors and molecular integrals, including the HFS ones, were calculated within the DIRAC code \cite{DIRAC17,Saue2020}. Since the magnetic dipole hyperfine interaction is mainly determined by the behavior of electronic wavefunctions in the vicinity of the atomic nucleus, the all-electron four-component relativistic calculations with the Dirac-Coulomb Hamiltonian were performed in order to achieve high and controllable accuracy. An alternative two-step approach \cite{Titov2005} based on a restoration of spinors in the vicinity of a heavy nucleus is formally less precise (however, it can be used in combined schemes to treat high-order correlation effects, basis set corrections, etc. to increase the final accuracy ~\cite{Skripnikov:16b}). In the present calculations, all electrons were correlated; the role of core relaxation and correlations is discussed below in Sec. \ref{sec:results}. The ground state of KCs${}^{2+}$ was used as the reference state in the FS-RCC calculations and the electronic states of the neutral KCs molecule were constructed in the $(0h,2p)$ Fock space sector (two particles over the Fermi vacuum). The active space comprised 12 lowest Kramers pairs of spinors with the total angular momentum projection $|m_j| = 1/2$ , 6 pairs with $|m_j| = 3/2$ and 2 pairs with $|m_j| = 5/2$. At the dissociation limit this corresponds to the $ns$, $np$, $(n-1)d$ and $(n+1)$s spinors of the isolated K and Cs atoms. In order to suppress numerical instabilities due to intruder states in the FS-RCC calculations, the new modification of denominator shift technique \cite{Zaitsevskii2017} based on the simulation of an imaginary shift was used (see Appendix A). We have used flexible uncontracted basis sets $(18s14p6d1f)$ for K and $(28s22p15d5f)$ for Cs (see Supplementary \cite{Supplementary}). These sets are based on the Dyall's basis set family \cite{Dyall2009}\footnote{Available from the Dirac web site, http://dirac.chem.sdu.dk, accessed on 28 June 2020.} and augmented with functions required to reproduce the atomic HFS constants and low-lying energy levels with the fairly good accuracy (see Table \ref{tab:athfs}). The finite-field approach with the numerical differentiation step $\Delta\lambda = 10^{-8}$ MHz${}^{-1}$ ($\approx 1.3 \cdot 10^{-4}$ a.u.) was employed to calculate hyperfine interaction expectation and transition matrix elements; this value was found to be optimal for ensuring numerical stability. \begin{table}[h] \center \def1.2{1.2} \caption{Atomic hyperfine structure constants and energy levels of $^{39}$K and $^{133}$Cs calculated within the FS-RCCSD method and compared with experimental data.}\label{tab:athfs} \begin{tabular}{ccrrcrr} \hline \multicolumn{2}{c}{State} & \multicolumn{2}{c}{A, MHz} & & \multicolumn{2}{c}{ Transition energy, cm${}^{-1}$} \\ \cline{3-4} \cline{6-7} & & FS-RCCSD & exptl\cite{Tiecke2011,Steck2010} & & FS-RCCSD & exptl\cite{Sansonetti2005} \\ \hline \multicolumn{7}{c}{\it Potassium} \\ $4s$ & ${}^2S_{1/2}$ & 222.4 & 230.9 & & 0 & 0 \\ $4p$ & ${}^2P_{1/2}$ & 26.7 & 27.8 & & 12966 & 12985 \\ & ${}^2P_{3/2}$ & 6.0 & 6.1 & & 13025 & 13043 \\ \multicolumn{7}{c}{\it Cesium} \\ $6s$ & ${}^2S_{1/2}$ & 2252.7 & 2298.2 & & 0 & 0 \\ $6p$ & ${}^2P_{1/2}$ & 280.3 & 291.9 & & 11184 & 11178 \\ & ${}^2P_{3/2}$ & 48.6 & 50.3 & & 11732 & 11732 \\ \hline \end{tabular} \end{table} We considered only the most abundant isotopomer ${}^{39}$K${}^{133}$Cs; the HFS constants for other isotopes can be obtained simply by scaling. The qualitative picture of energy levels at the K(${}^2S$)+Cs(${}^2S$) dissociation limit is strongly dominated by the HFS induced by the ${}^{133}$Cs nucleus ($I$ = 7/2, $A_{6s ^2S_{1/2}}$ = 2298.1579425 MHz \cite{Steck2010}); the effect induced by the ${}^{39}$K nucleus ($I$ = 3/2, $A_{4s ^2S_{1/2}}$ = 230.8598601(3) MHz \cite{Tiecke2011}) is much smaller. The picture is actually the same for the two other natural potassium isotopes (${}^{40}$K and ${}^{41}$K). Since the magnetic dipole hyperfine interaction is a one-electron property essentially defined by the behavior of the wavefunctions in the vicinity of nuclei, the HFS matrix element dependencies $A(R)$ can be calculated for the K and Cs nuclei separately. The contributions to the hyperfine structure induced by nuclear electric quadrupole moments are negligible for alkali diatomics \cite{Aldegunde2008,Lysebo2013} and hence are not considered here. The values of nuclear dipole magnetic moments, $\mu_{^{39}K}$ = 0.39147$\mu_N$ and $\mu_{^{133}Cs}$ = 2.582025$\mu_N$, were taken from Ref.~\cite{Stone2005}. Special attention is to be paid to the accuracy limitations of the model employed. The most important factors restricting the overall accuracy of the calculated HFS matrix elements are the following ones: (i) the approximation to the re\-la\-ti\-vis\-tic Hamiltonian (lack of Breit and QED terms), (ii) restrictions of the point dipole model of nuclear magnetization distribution, (iii) the approximation to the cluster operator (e.g. CCSD) used in the FS-RCC calculation and (iv) errors caused by the basis set incompleteness. The latter factor can be suppressed rather efficiently by using extended uncontracted basis sets designed specifically for HFS calculations. The contribution of the Breit two-electron interaction to the $A_{6s\ ^2S_{1/2}}$ constant of Cs atom was found to be less than 0.5\% and even smaller for lighter alkali atoms \cite{Safronova1999}, thus the Dirac-Coulomb approximation can be regarded as precise enough. Errors arising from the point-dipole approximation were estimated recently to be smaller than 1\% \cite{Ginges:2018,Prosnyak2020}. The effect of higher-order excitations in the cluster operator was found to be small for the Cs $6s\ ^2S_{1/2}$ HFS constant (ca.~$\sim$2\%) \cite{Haase2020}. Finally, errors due to non-compensated denominator shifts used to suppress intruder states in a wide range of $R$ are negligible for such low-lying electronic states \cite{Zaitsevskii2017,Znotins2019}. However, the clarification of the $R$-dependence of HFS matrix elements does not require extremely high accuracy; an error of about 5\% is to be regarded as quite satisfactory. \section{Results and discussion}\label{sec:results} The magnetic dipole hyperfine interaction matrix elements between the $X^1\Sigma^+_{0^+}$ and $a^3\Sigma^+_{0^-,1}$ states of ${}^{39}$K${}^{133}$Cs as functions of the internuclear distance are shown in Fig. \ref{fig:hfs}. The obtained $R$-dependencies of the $0^-$ -- $0^+$ coupling elements closely resemble those reported in \cite{Lysebo2013} for the Fermi-contact interaction in the $a^3\Sigma^+_u$ state of homonuclear alkali dimers. \begin{figure}[h] \center \includegraphics[width=0.49\textwidth]{hfs-K-Cs.pdf} \caption{Hyperfine coupling matrix elements mixing the $X^1\Sigma^+_{0^+}$ and $a^3\Sigma^+_{0^-,1}$ states of ${}^{39}$K${}^{133}$Cs for the HFS induced by the ${}^{133}$Cs nucleus (top panel) and the ${}^{39}$K nucleus (bottom panel). The black horizontal ticks show the corresponding experimental values for the atomic hyperfine structure constant $A_{at}/2$.}\label{fig:hfs} \end{figure} The widely used assumption that the hyperfine coupling matrix elements are constant is not correct for the ``bonding'' region of potential curves ($R <8$ \AA) where the deviations from the corresponding atomic values reach 15\% (see Fig. \ref{fig:pec}). However, these deviations are small for a larger $R$. Thus the variation of the matrix elements of the magnetic dipole hyperfine interaction with $R$ is not expected to affect significantly the hyperfine mixing near the dissociation limit. This conclusion is in agreement with the experimentally observed hyperfine splittings which are nearly constant with respect to the vibrational quantum number for the $a^3\Sigma^+$ state (see Fig. 5 in \cite{Ferber2009}). This fact legitimizes the use of atomic values for the modeling of laser synthesis \textit{via} Feshbach resonances or photoassociation. The variations of HFS matrix elements functions are essentially confined to the ``bonding'' domain of $R$ values. It is thus natural to suppose that these variations originate mainly from the redistribution of valence-shell electrons during the formation of chemical bonds. In other words, these variations can be considered as ``chemical shifts''. This feature of the HFS matrix elements can be used to reduce the number of adjustable parameters in non-adiabatic models considering heteronuclear alkali dimers. The elucidation of the role of core relaxation and correlations is of great interest since the neglect of these effects can in principle lead to significant computational savings, making feasible calculations of core properties for large systems. Within the FS-RCCSD approach, core correlations are associated with the double excitations in the cluster operator which involve two core spinors. Omitting these excitations, one neglects the core correlations but retains the bulk of the core relaxation and core-valence correlation which are described by cluster terms involving only one core spinor. Fig.~\ref{fig:core} presents the $R$-dependencies of the $1 - 1$ and $0^+ - 0^-$ matrix elements of the Cs-induced HFS calculated with different sizes of the Cs core. It can be seen that electron correlations restricted to the core including all spinors with the principal quantum numbers $n \le 3$ practically do not contribute to the HFS matrix elements. On the contrary, the results are distorted significantly if the core relaxation and core-valence correlations are omitted as well (i.e. all core spinors are frozen at the post-SCF correlation calculation step): the deviation from the results with the full correlation treatment (black solid curve) reaches 5\% for the frozen $n \le 3$ core and 10\% for the frozen $n \le 4$ core. The latter error is of the same order of magnitude as that of the two-step non-variational core restoration scheme \cite{Titov2005}, which also completely neglects core relaxation and core-valence correlation contributions. However, since these contributions are actually independent from the chemical environment (see Fig. \ref{fig:core}), it might be reasonable to keep the core spinors frozen in molecular calculations and to extract the missing contributions from atomic calculations. A similar scheme can be used for evaluating other core properties. Furthermore, HFS matrix elements calculated as functions of molecular geometry with the frozen core can be adjusted to experimental atomic values simply by appropriate shift. \begin{figure}[h] \center \includegraphics[width=0.49\textwidth]{KCs_HFS_Core.pdf} \caption{Hyperfine coupling matrix elements for the HFS induced by the ${}^{133}$Cs nucleus obtained at the different levels of treatment of core electrons. Black solid line: all electrons are correlated; ``frozen'': core shells with the principal quantum numbers $n$ are completely excluded from correlation treatment; dotted line, ``$n \le 4$ cv only'': only core-valence correlations and relaxation effects for the $n \le 4$ core shells of Cs are incorporated (the corresponding results for the smaller Cs cores are practically indiscernible from those of the full correlation treatment). } \label{fig:core} \end{figure} \section{Conclusions}\label{sec:conclusion} The relativistic four-component Fock space coupled cluster method was used to calculate both diagonal and off-diagonal matrix elements of the magnetic dipole hyperfine interaction operator within the finite-field approach. The numerical stability of the solutions of the FS-RCC equations was ensured by the imaginary shift simulation technique. From the results for the dissociation limit, the overall error of our estimates should be about 3-5\%. Our results demonstrate that the HFS coupling matrix elements in KCs are nearly constant for large and intermediate internuclear distances ($R > 8$ \AA, i.\ e. including the area of small separations of the $X^1\Sigma^+$ and $a^3\Sigma^+$ states in energy). This finding justifies the use of unscaled atomic hyperfine structure data for modeling the Feshbach resonances in alkali diatomics. For smaller $R$ the variation of HFS matrix elements become significant; the deviation of these entities from the corresponding atomic values reaches ca. 15\% in the vicinity of equilibrium distances for the ground and strongly bound excited states. A detailed study of the effect of the core relaxation, core-core and core-valence electron correlations on the computed matrix elements was performed. Core-core correlations practically do not contribute to the matrix elements under study. Rather significant (up to $\sim 10$\%) core relaxation and core-valence correlation contributions were found nearly independent on $R$. Thus the essential information on the variation of the HFS matrix elements upon chemical bond formation (``chemical shift'') can be obtained via relatively inexpensive calculations within the frozen core approximation. \section{Acknowledgements} Authors are grateful to E. A. Bormotova and A. V. Stolyarov for fruitful discussions. This work has been carried out using computing resources of the federal collective usage centre Complex for Simulation and Data Processing for Mega-science Facilities at NRC ``Kurchatov Institute'', \url{http://ckp.nrcki.ru/}, and computers of Quantum Chemistry Lab at NRC ``Kurchatov Institute'' -- PNPI. The reported study was funded by RFBR according to the research project \textnumero19-33-50122\textbackslash19. \section{Appendix A} Although the strategy of solving the relativistic many-electron problem generally followed that described in Refs.~\cite{Zaitsevskii2017,Zaitsevskii2018a}, we employed a somewhat different scheme to suppress numerical instabilities which is described below. Due to the model space completeness, the straightforward application of the conventional FS-RCC formulation in wide ranges of internuclear separations is blocked by numerical instabilities caused by intruder states (see e.g. Refs.~\cite{Evangelisti1987,Zaitsevskii2017} for detailed discussions). The presence of intruder states manifests itself as the appearance of poles of the $D_K^{-1}$ factors arising from small or zero energy denominators in FS-RCC amplitude equations at certain nuclear geometries ($D_K$ stands for the energy denominator for the excitation $K$ \cite{Zaitsevskii2017}). Similarly to the technique used in our previous work~\cite{Zaitsevskii2017}, we replace the original energy denominators $D_K$ in the FS-RCC amplitude equations by their shifted counterparts in such a way that numerical instabilities are suppressed without significant distortions of the description of low-lying states. However, the particular Ans\"{a}tze for the dependencies of real shifts on the original denominator values proposed in Refs.~\cite{Eliav2005,Zaitsevskii2017,Zaitsevskii2018a} can give rise to non-negligible systematic errors and rather strong dependencies of results on the particular choice of shift parameters. Though this problem is efficiently solved through extrapolating to the zero shift limit \cite{Eliav2005,Zaitsevskii2018a}, a less cumbersome approach is desirable for molecular excited state calculations in wide areas of nuclear configurations. To construct a potentially better Ansatz, let us turn to the idea of intruder state avoidance by means of imaginary denominator shifts~\cite{Surjan1996,Forsberg1997}. The imaginary analog of the denominator shift proposed in Ref.~\cite{Zaitsevskii2017} would imply the replacement \begin{equation} D_K\;\Longrightarrow\;D^C_K(m)=D_K+s_K\, \left(\displaystyle\frac{|s_K|}{\left| D_K+s_K i \right|}\right)^{m} i, \label{imags} \end{equation} where the $s_K$ parameters (shift amplitudes) are real; these parameters are supposed to have the same value for all classes of excitations. The non-negative integer $m$ (attenuation parameter) is common for all excitations $K$. The imaginary part of $D_K^C$ tends to $s_K$ for nearly zero denominators $D_K$ and becomes small for ''well-defined'' (large negative or positive) $D_K$. The larger the $m$ value, the smaller the shifting of ``well-defined'' energy denominators. The essential advantage of imaginary shifts compared to their real counterpart introduced in Ref.~\cite{Zaitsevskii2017} arises from the fact that $D_K^C(m)^{-1}$ with any non-zero $s_K$ have no poles on the real axis regardless the behaviour of $D_K$ as functions of the nuclear geometry. Note, however, that the straightforward application of (\ref{imags}) could lead to non-physical imaginary contributions to effective Hamiltonian eigenvalues; furthermore, one would lose the possibility to perform FS-RCC calculations of diatomic (or other highly symmetric) molecules in real numbers. Therefore instead of using Eg.~(\ref{imags}), we replace the original energy denominators $D_K$ in the FS-RCC amplitude equations by real shifted denominators $D^{\prime}_K(m)$ \begin{equation} D_K\;\Longrightarrow\;D^{\prime}_K(m)=D_K + \frac{s_K^2}{D_K}\left(\displaystyle\frac{s_K^2}{ D_K^2+s_K^2}\right)^{m} \label{imagreal} \end{equation} satisfying the requirement \begin{equation} \frac{1}{D^{\prime}_K(m)}={\rm Re}\left(\frac{1}{D_K^C(m)}\right) \end{equation} and thus simulating in a sense the modification (\ref{imags}) without leaving the real axis. The modification (\ref{imagreal}) is a straightforward generalization of the ``imaginary shifting'' widely used in second-order multireference many-body perturbation theories \cite{Forsberg1997,Witek2002}. Assuming $m=0$ in Eq.~(\ref{imagreal}), one immediately arrives at the expression for energy denominators introduced in the cited works. The increase of $m$ should reduce the errors introduced through the replacement of original denominators by shifted ones but can slow down (and finally ruin) the convergence of the iterative solution of the modified cluster equations in the presence of intruder states. A series of single-point calculations demonstrated that the use of a larger $m$ ($m\ge{}2$) is essential for suppressing the dependence of the resulting energies on the choice of shift amplitudes $s_K$. All results presented in Sec.~\ref{sec:results} were obtained with shift parameters $s=-0.2$ a.u. and $m=3$ in the $(0h,2p)$ Fock space sector; FS-RCC equations for the $(0h,0p)$ and $(0h,1p)$ were not modified.
\section{Introduction\label{sec:intro}} Symmetric positive-definite matrices arise in spatial statistics, Gaussian-process inference, and spatio-temporal filtering, with a wealth of application areas, including geoscience \citep[e.g.,][]{Cressie1993,Banerjee2004}, machine learning \citep[e.g.,][]{Rasmussen2006}, data assimilation \citep[e.g.,][]{Nychka2010,Katzfuss2015b}, and the analysis of computer experiments \citep[e.g.,][]{Sacks1989,Kennedy2001}. Inference in these areas typically relies on Cholesky decomposition of the positive-definite matrices. However, this operation scales cubically in the dimension of the matrix, and it is thus computationally infeasible for many modern problems and applications, which are increasingly high-dimensional. Countless approaches have been proposed to address these computational challenges. \citet{Heaton2017} provide a recent review from a spatial-statistics perspective, and \citet{Liu2018} review approaches in machine learning. In high-dimensional filtering, proposed solutions include low-dimensional approximations \citep[e.g.,][]{Verlaan1995,Pham1998,Wikle1999,Katzfuss2010}, spectral methods \citep[e.g.][]{Wikle1999,Sigrist2015}, and hierarchical approaches \citep[e.g.,][]{Johannesson2003,LiAmbikasaran2014,Saibaba2015,Jurek2018}. Operational data assimilation often relies on ensemble Kalman filters \citep[e.g.,][]{Evensen1994,Burgers1998,Anderson2001,Evensen2007,Katzfuss2015b,Katzfuss2017c}, which represent distributions by samples or ensembles. Maybe the most promising approximations for spatial data and Gaussian processes implicitly or explicitly rely on sparse Cholesky factors. The assumption of ordered conditional independence in the popular Vecchia approximation \citep{Vecchia1988} and its extensions \citep[e.g.,][]{Stein2004,Datta2016,Guinness2016a,Katzfuss2017a,Katzfuss2018,Katzfuss2020,Schafer2020} implies sparsity in the Cholesky factor of the precision matrix. \citet{Schafer2017} uses an incomplete Cholesky decomposition to construct a sparse approximate Cholesky factor of the covariance matrix. However, these methods are not generally applicable to spatio-temporal filtering, because the assumed sparsity is not preserved under filtering operations. Here, we relate the sparsity of the Cholesky factors of the covariance matrix and the precision matrix to specific assumptions regarding ordered conditional independence. We show that these assumptions are simultaneously satisfied for a particular Gaussian-process approximation that we call hierarchical Vecchia (HV), which is a special case of the general Vecchia approximation \citep{Katzfuss2017a} based on hierarchical domain partitioning \citep[e.g.,][]{Katzfuss2015,Katzfuss2017b}. We show that the HV approximation can be computed using a simple and fast incomplete Cholesky decomposition. Due to its remarkable property of implying a sparse Cholesky factor whose inverse has equivalent sparsity structure, HV is well suited for extensions to spatio-temporal filtering; this is in contrast to other Vecchia approximations and other spatial approximations relying on sparsity. We provide a scalable HV-based filter for linear Gaussian spatio-temporal state-space models, which is related to the multi-resolution filter of \citet{Jurek2018}. Further, by combining HV with a Laplace approximation \citep[cf.][]{Zilber2019}, our method can be used for the analysis of non-Gaussian data. Finally, by combining the methods with the extended Kalman filter \citep[e.g.,][Ch.~5]{Grewal1993}, we obtain fast filters for high-dimensional, non-linear, and non-Gaussian spatio-temporal models. For a given formulation of HV, the computational cost of all of our algorithms scales linearly in the state dimension, assuming sufficiently sparse temporal evolution. The remainder of this document is organized as follows. In Section \ref{sec:sparsity}, we specify the relationship between ordered conditional independence and sparse (inverse) Cholesky factors. Then, we build up increasingly complex and general methods, culminating in non-linear and non-Gaussian spatio-temporal filters: in Section \ref{sec:hv}, we introduce hierarchical Vecchia for a linear Gaussian spatial field at a single time point; in Section \ref{sec:nongaussian}, we extend this to non-Gaussian data; and in Section \ref{sec:filter}, we consider the general spatio-temporal filtering case, including nonlinear evolution and parameter inference on unknown parameters in the model. Section \ref{sec:comparison} contains numerical comparisons to existing approaches. Section \ref{sec:conclusion} concludes. Appendices \ref{app:graph}--\ref{app:proofs} contain proofs and further details. Code implementing our methods and numerical comparisons is available at \url{https://github.com/katzfuss-group/vecchiaFilter}. \section{Sparsity of Cholesky factors\label{sec:sparsity}} We begin by specifying the connections between ordered conditional independence and sparsity of the Cholesky factor of the covariance and precision matrix. \begin{claim} Let $\mathbf{w}$ be a normal random vector with variance-covariance matrix $\mathbf{K}$. \begin{enumerate} \item Let $\mathbf{L} = \chol(\mathbf{K})$ be the lower-triangular Cholesky factor of the covariance matrix $\mathbf{K}$. For $i>j$: \[ \mathbf{L}_{i,j}=0 \iff w_i \perp w_j \, | \, \mathbf{w}_{1:j-1} \] \item Let $\mathbf{U} = \rchol(\mathbf{K}^{-1}) = \mathbf{P} \chol( \mathbf{P}\mathbf{K}^{-1}\mathbf{P})\,\mathbf{P}$ be the Cholesky factor of the precision matrix under reverse ordering, where $\mathbf{P}$ is the reverse-ordering permutation matrix. Then $\mathbf{U}$ is upper-triangular, and for $i>j$: \[ \mathbf{U}_{j,i}=0 \iff w_i \perp w_j \, | \, \mathbf{w}_{1:j-1},\mathbf{w}_{j+1:i-1} \] \end{enumerate} \label{claim:cond-indep} \end{claim} The connection between ordered conditional independence and the Cholesky factor of the precision matrix is well known \citep[e.g.,][]{Rue2010}; Part 2 of our claim states this connection under reverse ordering \citep[e.g.,][Prop.~3.3]{Katzfuss2017a}. In Part 1, we consider the lesser-known relationship between ordered conditional independence and sparsity of the Cholesky factor of the covariance matrix, which was recently discussed in \citet[][Sect.~1.4.2]{Schafer2017}. For completeness, we provide a proof of Claim \ref{claim:cond-indep} in Appendix \ref{app:proofs}. Claim \ref{claim:cond-indep} is crucial for our later developments and proofs. In Section \ref{sec:hv}, we specify a hierarchical Vecchia approximation of Gaussian processes that satisfies both types of conditional independence in Claim \ref{claim:cond-indep}; the resulting sparsity of the Cholesky factor and its inverse allows extensions to spatio-temporal filtering in Section \ref{sec:filter}. \section{Hierarchical Vecchia for large Gaussian spatial data\label{sec:hv}} Consider a Gaussian process $x(\cdot)$ and a vector $\mathbf{x} = (x_1, \ldots, x_n)^\top$ representing $x(\cdot)$ evaluated on a grid $\mathcal{S} = \{\mathbf{s}_1,\ldots,\mathbf{s}_n \}$ with $\mathbf{s}_i \in \mathcal{D} \subset \mathbb{R}^d$ and $x_i = x(\mathbf{s}_i)$ for $\mathbf{s}_i \in \mathcal{D}$, $i=1,\ldots,n$. We assume the following model: \begin{align} \label{eq:gobs} y_{i} \,|\, \mathbf{x} & \stackrel{ind}{\sim} \mathcal{N}(x_i,\tau_i^2),\qquad i \in \mathcal{I}, \\ \label{eq:gevol} \mathbf{x} & \sim \mathcal{N}_n(\bm{\mu},\bm{\Sigma}), \end{align} where $\mathcal{I} \subset \{1,\ldots,n\}$ are the indices of grid points at which observations are available, and $\mathbf{y}$ is the data vector consisting of these observations $\{y_{i}: i \in \mathcal{I}\}$. Note that we can equivalently express \eqref{eq:gobs} using matrix notation as $\mathbf{y} \,|\, \mathbf{x} \sim \mathcal{N}(\mathbf{H}\mathbf{x},\mathbf{R})$, where $\mathbf{H}$ is obtained by selecting only the rows with indices $i \in \mathcal{I}$ from an identity matrix, and $\mathbf{R}$ is a diagonal matrix with entries $\{\tau_i^2: i \in \mathcal{I}\}$. Our interest is in computing the posterior distribution of $\mathbf{x}$ given $\mathbf{y}$, which requires inverting or decomposing an $n \times n$ matrix at a cost of $\mathcal{O}(n^3)$ if $|\mathcal{I}| = \mathcal{O}(n)$. This is computationally infeasible for large $n$. \subsection{The hierarchical Vecchia approximation\label{sec:hv-intro}} We now describe a hierarchical Vecchia approximation with unique sparsity and computational properties, which enable fast computation for spatial models as in \eqref{eq:gobs}--\eqref{eq:gevol} and also allow extensions to spatio-temporal filtering as explained later. Assume that the elements of the vector $\mathbf{x}$ are hierarchically partitioned into a set $\mathcal{X}^{0:M} = \bigcup_{m=0}^M \mathcal{X}^m$, where $\mathcal{X}^m = \bigcup_{k=1}^m \bigcup_{j_k=1}^{J_k} \mathcal{X}_{j_1,\ldots,j_m}$, and $\mathcal{X}_{j_1,\ldots,j_m}$ is a set consisting of $|\mathcal{X}_{j_1,\ldots,j_m}|$ elements of $\mathbf{x}$, such that there is no overlap between any two sets, $\mathcal{X}_{j_1,\ldots,j_m} \cap \mathcal{X}_{i_1,\ldots,i_l} = \emptyset$ for $({j_1,\ldots,j_m}) \neq ({i_1,\ldots,i_l})$. We assume that $\mathbf{x}$ is ordered according to $\mathcal{X}^{0:M}$, in the sense that if $i>j$, then $x_i \in \mathcal{X}^{m_1}$ and $x_j \in \mathcal{X}^{m_2}$ with $m_1 \geq m_2$. As a toy example with $n=6$, the vector $\mathbf{x} = (x_1,\ldots,x_6)$ might be partitioned with $M=1$, $J_1 = 2$ as $\mathcal{X}^{0:1} = \mathcal{X}^0 \cup \mathcal{X}^1$, $\mathcal{X}^0 = \mathcal{X} = \{x_1,x_2\}$, and $\mathcal{X}^1 = \mathcal{X}_{1,1} \cup \mathcal{X}_{1,2}$, where $\mathcal{X}_{1,1}=\{x_3,x_4\}$, and $\mathcal{X}_{1,2} = \{x_5,x_6\}$. Another toy example is illustrated in Figure \ref{fig:toy}. The exact distribution of $\mathbf{x} \sim \mathcal{N}_n(\bm{\mu},\bm{\Sigma})$ can be written as \[ \textstyle p(\mathbf{x}) = \prod_{m=0}^M \prod_{j_1,\ldots,j_m} p(\mathcal{X}_{j_1,\ldots,j_m}|\mathcal{X}^{0:m-1}, \mathcal{X}_{{j_1,\ldots,j_{m-1}},1:j_m-1}), \] where the conditioning set of $\mathcal{X}_{j_1,\ldots,j_m}$ consists of all sets $\mathcal{X}^{0:m-1}$ at lower resolution, plus those at the same resolution that are previous in lexicographic ordering. The idea of \citet{Vecchia1988} was to remove many of these variables in the conditioning set, which for geostatistical applications often incurs only small approximation error due to the so-called screening effect \citep[e.g.,][]{Stein2002,Stein2011}. \begin{figure}[!htbp] \centering \begin{subfigure}{.99\textwidth} \centering \includegraphics[width=0.9\textwidth]{plots/domain.pdf} \caption{Iterative domain partitioning for $n=35$ locations} \label{fig:domain-&-knots} \end{subfigure}\\ \vspace{3mm} \begin{subfigure}{0.54\textwidth} \includegraphics[width=0.85\textwidth]{plots/graph.pdf} \caption{Directed acyclic graph (DAG)} \label{fig:dag} \end{subfigure} \begin{subfigure}{.44\textwidth} \includegraphics[trim=0mm 12mm 0mm 12mm, clip,width=0.95\textwidth]{plots/matrix.pdf} \caption{Sparsity pattern of the $\mathbf{U}$ matrix} \label{fig:sparsity-pattern} \end{subfigure} \caption{Toy example with $n=35$ of the hierarchical Vecchia approximation in \eqref{eq:vecchia-approx} with $M=2$ and $J_1=J_2=2$; the color for each set $\mathcal{X}_{j_1,\ldots,j_m}$ is consistent across (a)--(c). (a) Partitioning of the spatial domain $\mathcal{D}$ and the locations $\mathcal{S}$; for resolution $m=0,1,2$, locations of $\mathcal{X}^{0:m}$ (solid dots) and locations of points at finer resolutions ($\circ$). (b) DAG illustrating the conditional-dependence structure, with bigger arrows for connections between vertices at neighboring levels of the hierarchy, to emphasize the tree structure. (c) Corresponding sparsity pattern of $\mathbf{U}$ (see Proposition \ref{prop:same-sparsity-factors}), with groups of columns/rows corresponding to different resolutions separated by pink lines, and groups of columns/rows corresponding to different $\mathcal{X}_{j_1,\ldots,j_m}$ at the same resolution separated by blue lines. } \label{fig:toy} \end{figure} Here we consider a hierarchical Vecchia (HV) approximation of the form \begin{equation} \textstyle \hat{p}(\mathbf{x}) = \prod_{m=0}^M \prod_{j_1,\ldots,j_m} p(\mathcal{X}_{j_1,\ldots,j_m}|\mathcal{A}_{j_1,\ldots,j_m}), \label{eq:vecchia-approx} \end{equation} where $\mathcal{A}_{j_1,\ldots,j_m} = \mathcal{X} \cup \mathcal{X}_{j_1} \cup \ldots \cup \mathcal{X}_{{j_1,\ldots,j_{m-1}}}$ is the set of ancestors of $\mathcal{X}_{j_1,\ldots,j_m}$. For example, the set of ancestors of $\mathcal{X}_{2,1,2}$ is $\mathcal{A}_{2,1,2} = \mathcal{X} \cup \mathcal{X}_2 \cup \mathcal{X}_{2,1}$. Thus, $\mathcal{A}_{j_1,\ldots,j_m} = \mathcal{A}_{j_1,\ldots,j_{m-1}} \cup \mathcal{X}_{j_1,\ldots,j_{m-1}}$, and the ancestor sets are nested: $\mathcal{A}_{j_1,\ldots,j_{m-1}} \subset \mathcal{A}_{j_1,\ldots,j_m}$. We can equivalently write \eqref{eq:vecchia-approx} in terms of individual variables as \begin{equation} \textstyle \hat{p}(\mathbf{x}) = \prod_{i=1}^n p(x_i|\,\mathcal{C}_i), \label{eq:vecchia-approx-ind} \end{equation} where $\mathcal{C}_i = \mathcal{A}_{j_1,\ldots,j_m} \cup \{x_k \in \mathcal{X}_{j_1,\ldots,j_m} \! : \, k<i \}$ for $x_i \in \mathcal{X}_{j_1,\ldots,j_m}$. The choice of the $\mathcal{C}_i$ involves a trade-off: generally, the larger the $\mathcal{C}_i$, the higher the computational cost (see Proposition \ref{prop:complexity-vf} below), but the smaller the approximation error; HV is exact when all $\mathcal{C}_i = \{x_1,\ldots,x_{i-1}\}$. Vecchia approximations and their conditional-independence assumptions are closely connected to directed acyclic graphs \citep[DAGs;][]{Datta2016,Katzfuss2017a}. Summarizing briefly, as illustrated in Figure \ref{fig:dag}, we associate a vertex with each set $\mathcal{X}_{j_1,\ldots,j_m}$, and we draw an arrow from the vertex corresponding to $\mathcal{X}_{{i_1,\ldots,i_l}}$ to the vertex corresponding to $\mathcal{X}_{j_1,\ldots,j_m}$ if and only if $\mathcal{X}_{{i_1,\ldots,i_l}}$ is in the conditioning set of $\mathcal{X}_{j_1,\ldots,j_m}$ (i.e., $\mathcal{X}_{{i_1,\ldots,i_l}} \subset \mathcal{A}_{j_1,\ldots,j_m}$). DAGs corresponding to HV approximations always have a tree structure, due to the nested ancestor sets. Necessary terminology and notation from graph theory is reviewed in Appendix \ref{app:graph}. In practice, as illustrated in Figure \ref{fig:domain-&-knots}, we partition the spatial field $\mathbf{x}$ into the hierarchical set $\mathcal{X}^{0:M}$ based on a recursive partitioning of the spatial domain $\mathcal{D}$ into $J_1$ regions $\mathcal{D}_{1},\ldots,\mathcal{D}_{J_1}$, each of which is again split into $J_2$ regions, and so forth, up to resolution $M$ \citep{Katzfuss2015}: $\mathcal{D}_{j_1,\ldots,j_{m-1}} = \bigcup_{j_m=1}^{J_m} \mathcal{D}_{j_1,\ldots,j_m}$, $m=1,\ldots,M$. We then set each $\mathcal{X}_{j_1,\ldots,j_m}$ to be a subset of the variables in $\mathbf{x}$ whose location is in $\mathcal{D}_{j_1,\ldots,j_m}$: $\mathcal{X}_{j_1,\ldots,j_m} \subset \{x_i: \mathbf{s}_i \in \mathcal{D}_{j_1,\ldots,j_m}\}$. This implies that the ancestors $\mathcal{A}_{j_1,\ldots,j_m}$ of each set $\mathcal{X}_{j_1,\ldots,j_m}$ consist of the variables associated with regions at lower resolutions $m=0,\ldots,m-1$ that contain $\mathcal{D}_{j_1,\ldots,j_m}$. Specifically, for all our numerical examples, we set $J_1=\ldots=J_M=2$, and we select each $\mathcal{X}_{j_1,\ldots,j_m}$ corresponding to the first $|\mathcal{X}_{j_1,\ldots,j_m}|$ locations in a maximum-distance ordering \citep{Guinness2016a,Schafer2017} of $\mathcal{S}$ that are contained in $\mathcal{D}_{j_1,\ldots,j_m}$ but are not already in $\mathcal{A}_{j_1,\ldots,j_m}$. The HV approximation \eqref{eq:vecchia-approx} is closely related to the multi-resolution approximation \citep{Katzfuss2015,Katzfuss2017b}, as noted in \citet[][Sec.~2.5]{Katzfuss2017a}, which in turn is closely related to hierarchical off-diagonal low-rank (HODLR) matrices \citep[e.g.][]{Hackbusch2015,Ambikasaran2016,Saibaba2015,Geoga2018}, as noted in \citet{Jurek2018}. However, the definition, exposition, and details provided here enable our later proofs, simple incomplete-Cholesky-based computation, and extensions to non-Gaussian data and to nonlinear space-time filtering. \subsection{Sparsity of the hierarchical Vecchia approximation} For all Vecchia approximations, the assumed conditional independence implies a sparse Cholesky factor of the precision matrix \citep[e.g.,][Prop.~3.3]{Datta2016,Katzfuss2017a}. The conditional-independence assumption made in our HV approximation also implies a sparse Cholesky factor of the covariance matrix, which is in contrast to many other formulations of the Vecchia approximation: \begin{proposition} For the HV approximation in \eqref{eq:vecchia-approx}, we have $\hat p(\mathbf{x}) = \mathcal{N}_n(\mathbf{x}|\bm{\mu},\hat\bm{\Sigma})$. Define $\mathbf{L} = \chol(\hat\bm{\Sigma})$ and $\mathbf{U} = \rchol(\hat\bm{\Sigma}^{-1}) = \mathbf{P} \chol( \mathbf{P}\hat\bm{\Sigma}^{-1}\mathbf{P})\,\mathbf{P}$, where $\mathbf{P}$ is the reverse-ordering permutation matrix. \begin{enumerate} \item For $i\neq j$: \begin{enumerate} \item $\mathbf{L}_{i,j} = 0$ unless $x_j \in \mathcal{C}_i$ \item $\mathbf{U}_{j,i} = 0$ unless $x_j \in \mathcal{C}_i$ \end{enumerate} \item $\mathbf{U} = \mathbf{L}^{-\top}$ \end{enumerate} \label{prop:same-sparsity-factors} \end{proposition} The proof relies on Claim \ref{claim:cond-indep}. All proofs can be found in Appendix \ref{app:proofs}. Proposition \ref{prop:same-sparsity-factors} says that the Cholesky factors of the covariance and precision matrix implied by a HV approximation are both sparse, and $\mathbf{U}$ has the same sparsity pattern as $\mathbf{L}^{\top}$. An example of this pattern is shown in Figure \ref{fig:sparsity-pattern}. Furthermore, because $\mathbf{L} = \mathbf{U}^{-\top}$, we can quickly compute one of these factors given the other, as described in Section \ref{sec:vecchia-complexity} below. For other Vecchia approximations, the sparsity of the prior Cholesky factor $\mathbf{U}$ does not necessarily imply the same sparsity for the Cholesky factor of the posterior precision matrix, and in fact there can be substantial in-fill \citep{Katzfuss2017a}. However, this is not the case for the particular case of HV, for which the posterior sparsity is exactly the same as the prior sparsity: \begin{proposition} Assume that $\mathbf{x}$ has the distribution $\hat p(\mathbf{x})$ given by the HV approximation in \eqref{eq:vecchia-approx}. Let $\widetilde\bm{\Sigma} = \var(\mathbf{x}|\mathbf{y})$ be the posterior covariance matrix of $\mathbf{x}$ given data $y_{i} \,|\, \mathbf{x} \stackrel{ind}{\sim} \mathcal{N}(x_i,\tau_i^2)$, $i \in \mathcal{I} \subset \{1,\ldots,n\}$ as in \eqref{eq:gobs}. Then: \begin{enumerate} \item $\widetilde\mathbf{U} = \rchol(\widetilde\bm{\Sigma}^{-1})$ has the same sparsity pattern as $\mathbf{U} = \rchol(\hat\bm{\Sigma}^{-1})$. \item $\widetilde\mathbf{L} = \chol(\widetilde\bm{\Sigma})$ has the same sparsity pattern as $\mathbf{L} = \chol(\hat\bm{\Sigma})$. \end{enumerate} \label{prop:posterior} \end{proposition} \subsection{Fast computation using incomplete Cholesky factorization\label{sec:vecchia-complexity}} For notational and computational convenience, we assume now that each conditioning set $\mathcal{C}_i$ consists of at most $N$ elements of $\mathbf{x}$. For example, this can be achieved by setting $|\mathcal{X}_{j_1,\ldots,j_m}|\leq r$ with $r = N/(M+1)$. Then $\mathbf{U}$ can be computed using general expressions for the Vecchia approximation in $\mathcal{O}(nN^3)$ time \citep[e.g.,][]{Katzfuss2017a}. Alternatively, inference can be carried out using multi-resolution decompositions \citep{Katzfuss2015,Katzfuss2017b,Jurek2018} in $\mathcal{O}(nN^2)$, but these algorithms are fairly involved. Instead, we show here how HV inference can be carried out in $\mathcal{O}(nN^2)$ time using standard sparse-matrix algorithms, including the incomplete Cholesky factorization, based on at most $nN$ entries of $\bm{\Sigma}$. Our algorithm, which is based on ideas in \citet{Schafer2017}, is much simpler than multi-resolution decompositions. \begin{algorithm}[ht] \caption{Incomplete Cholesky decomposition: $\ichol(\mathbf{A},\mathbf{S})$} \KwInput{ positive-definite matrix $\mathbf{A} \in \mathbb{R}^{n \times n}$, sparsity matrix $\mathbf{S} \in \{0,1\}^{n \times n}$} \KwResult{ lower-triangular $n\times n$ matrix $\mathbf{L}$ } \begin{algorithmic}[1] \FOR{$i=1$ to $n$} \FOR{$j=1$ to $i-1$} \IF{$\mathbf{S}_{i,j}=1$} \STATE $\mathbf{L}_{i,j} = (\mathbf{A}_{i,j} - \sum_{k=1}^{j-1}\mathbf{L}_{i,k}\mathbf{L}_{j,k})/\mathbf{L}_{j,j}$ \\ \ENDIF \ENDFOR \STATE $\mathbf{L}_{i,i} = (\mathbf{A}_{i,i} - \sum_{k=1}^{i-1}\mathbf{L}_{k,k})^{1/2}$ \ENDFOR \end{algorithmic} \label{alg:ic0} \end{algorithm} The incomplete Cholesky factorization \citep[e.g.,][]{Golub2012}, denoted by $\ichol(\mathbf{A}, \mathbf{S})$ and given in Algorithm \ref{alg:ic0}, is identical to the standard Cholesky factorization of the matrix $\mathbf{A}$, except that we skip all operations that involve elements that are not in the sparsity pattern represented by the zero-one matrix $\mathbf{S}$. It is important to note that to compute $\mathbf{L}=\ichol(\mathbf{A}, \mathbf{S})$ for a large dense matrix $\mathbf{A}$, we do not actually need to form or access the entire $\mathbf{A}$; instead, to reduce memory usage and computational cost, we simply compute $\mathbf{L}=\ichol(\mathbf{A} \circ \mathbf{S}, \mathbf{S})$ based on the sparse matrix $\mathbf{A} \circ \mathbf{S}$, where $\circ$ denotes element-wise multiplication. Thus, while we write expressions like $\mathbf{L}=\ichol(\mathbf{A}, \mathbf{S})$ for notational simplicity below, this should always be read as $\mathbf{L}=\ichol(\mathbf{A} \circ \mathbf{S}, \mathbf{S})$. For our HV approximation in \eqref{eq:vecchia-approx}, we henceforth set $\mathbf{S}$ to be a sparse lower-triangular matrix with $\mathbf{S}_{i,j}=1$ if $x_j \in \mathcal{C}_i$, and $0$ otherwise. Thus, the sparsity pattern of $\mathbf{S}$ is the same as that of $\mathbf{L}$, and its transpose is that of $\mathbf{U}$ shown in Figure \ref{fig:sparsity-pattern}. \begin{proposition} \label{prop:chol-lemma} Assuming \eqref{eq:vecchia-approx}, denote $\var(\mathbf{x}) = \hat\bm{\Sigma}$ and $\mathbf{L} = \chol(\hat\bm{\Sigma})$. Then, $\mathbf{L} = \ichol(\bm{\Sigma}, \mathbf{S})$. \end{proposition} Hence, the Cholesky factor of the covariance matrix $\hat\bm{\Sigma}$ implied by the HV approximation can be computed using the incomplete Cholesky algorithm based on the (at most) $nN$ entries of the exact covariance $\bm{\Sigma}$ indicated by $\mathbf{S}$. Using this result, we propose Algorithm \ref{alg:VF} for posterior inference on $\mathbf{x}$ given $\mathbf{y}$. \begin{algorithm}[ht] \caption{Posterior inference using hierarchical Vecchia: $\hv(\mathbf{y},\mathbf{S},\bm{\mu},\bm{\Sigma},\mathbf{H},\mathbf{R})$} \KwInput{data $\mathbf{y}$; sparsity $\mathbf{S}$; $\bm{\mu}, \bm{\Sigma}$ s.t.\ $\mathbf{x} \sim \mathcal{N}_n(\bm{\mu}, \bm{\Sigma})$; obs.\ matrix $\mathbf{H}$; noise variances $\mathbf{R}$} \KwResult{$\widetilde\bm{\mu}$ and $\widetilde\mathbf{L}$ such that $\hat{p}(\mathbf{x}|\mathbf{y}) = \mathcal{N}_n(\mathbf{x}|\widetilde\bm{\mu},\widetilde\mathbf{L}\widetilde\mathbf{L}^\top)$ } \begin{algorithmic}[1] \STATE $\mathbf{L} = \ichol(\bm{\Sigma}, \mathbf{S})$, using Algorithm \ref{alg:ic0} \STATE $\mathbf{U} = \mathbf{L}^{-\top}$ \STATE $\bm{\Lambda} = \mathbf{U}\bU^\top + \mathbf{H}^\top\mathbf{R}^{-1}\mathbf{H}$ \STATE $\widetilde{\mathbf{U}} = \mathbf{P}\left(\chol(\mathbf{P}\bm{\Lambda}\mathbf{P})\right)\mathbf{P}$, where $\mathbf{P}$ is the order-reversing permutation matrix \STATE $\widetilde{\mathbf{L}} = \widetilde{\mathbf{U}}^{-\top}$ \STATE $\widetilde{\bm{\mu}} = \bm{\mu} + \widetilde{\mathbf{L}}\widetilde{\mathbf{L}}^\top\mathbf{H}^{\top}\mathbf{R}^{-1}\left(\mathbf{y} - \mathbf{H} \bm{\mu}\right)$ \end{algorithmic} \label{alg:VF} \end{algorithm} By combining the incomplete Cholesky factorization with the results in Propositions \ref{prop:same-sparsity-factors} and \ref{prop:posterior} (saying that all involved Cholesky factors are sparse), we can perform fast posterior inference: \begin{proposition} \label{prop:complexity-vf} Algorithm \ref{alg:VF} can be carried out in $\mathcal{O}(nN^2)$ time and $\mathcal{O}(nN)$ space, assuming that $|\mathcal{C}_i| \leq N$ for all $i=1,\ldots,n$. \end{proposition} \section{Extensions to non-Gaussian spatial data using the Laplace approximation\label{sec:nongaussian}} Now consider the model \begin{align} \label{eq:ngobs} y_{i} \,|\, \mathbf{x} & \stackrel{ind}{\sim} g_i(y_{i} | x_{i}),\qquad i \in \mathcal{I}, \\ \label{eq:ngevol} \mathbf{x} & \sim \mathcal{N}_n(\bm{\mu},\bm{\Sigma}), \end{align} where $g_i$ is a distribution from an exponential family. Using the HV approximation in \eqref{eq:vecchia-approx}--\eqref{eq:vecchia-approx-ind} for $\mathbf{x}$, the implied posterior can be written as: \begin{equation} \label{eq:nongaussianpost} \hat{p}(\mathbf{x}|\mathbf{y}) = \frac{p(\mathbf{y}|\mathbf{x}) \hat{p}(\mathbf{x})}{\int p(\mathbf{y}|\mathbf{x}) \hat{p}(\mathbf{x}) d\mathbf{x}} = \frac{(\prod_{i \in \mathcal{I}} g_i(y_i|x_i)) \hat{p}(\mathbf{x})}{\int (\prod_{i \in \mathcal{I}} g_i(y_i|x_i)) \hat{p}(\mathbf{x}) d\mathbf{x}}. \end{equation} Unlike in the Gaussian case as in \eqref{eq:gobs}, the integral in the denominator cannot generally be evaluated in closed form, and Markov Chain Monte Carlo methods are often used to numerically approximate the posterior. Instead, \citet{Zilber2019} proposed a much faster method that combines a general Vecchia approximation with the Laplace approximation \citep[e.g.][Sect.~3.4]{Tierney1986,Rasmussen2006}. The Laplace approximation is combined with a Gaussian approximation of the posterior, obtained by carrying out a second-order Taylor expansion of the posterior log-density around its mode. Although the mode cannot generally be obtained in closed form, it can be computed straightforwardly using a Newton-Raphson procedure, because $\log \hat{p}(\mathbf{x}|\mathbf{y}) = \log p(\mathbf{y}|\mathbf{x}) + \log \hat{p}(\mathbf{x}) + c$ is a sum of two concave functions and hence also concave (as a function of $\mathbf{x}$, under appropriate parametrization of the $g_i$). While each Newton-Raphson update requires the computation and decomposition of the $n \times n$ Hessian matrix, the update can be carried out quickly by making use of the sparsity implied by the Vecchia approximation. To do so, we follow \citet{Zilber2019} in exploiting the fact that the Newton-Raphson update is equivalent to computing the conditional mean of $\mathbf{x}$ given pseudo-data. Specifically, at the $\ell$-th iteration of the algorithm, given the current state value $\mathbf{x}^{(\ell)}$, let us define \begin{equation} \textstyle \mathbf{u}^{(\ell)} = \big[ u^{(\ell)}_i \big]_{i \in \mathcal{I}}, \qquad \text{where} \quad u^{(\ell)}_i = \frac{\partial}{\partial x} \log g_i(y_i|x)\big\vert_{x=x^{(\ell)}_i}, \label{eq:u} \end{equation} and \begin{equation} \textstyle \mathbf{D}^{(\ell)} = \diag\big(\{d_i^{(\ell)}: i \in \mathcal{I}\}\big), \qquad \text{ where} \quad d_i^{(\ell)} = -\big(\frac{\partial^2}{\partial x^2} \log g_i(y_i|x)\big)^{-1}\big\vert_{x=x^{(\ell)}_i}. \label{eq:D} \end{equation} Then, we compute the next iteration's state value $\mathbf{x}^{(\ell+1)} = \mathbb{E}(\mathbf{x}|\mathbf{t}^{(\ell)})$ as the conditional mean of $\mathbf{x}$ given pseudo-data $\mathbf{t}^{(\ell)} = \mathbf{x}^{(\ell)} + \mathbf{D}^{(\ell)} \mathbf{u}^{(\ell)}$ assuming Gaussian noise, $t^{(\ell)}_i | \mathbf{x} \stackrel{ind.}{\sim} \mathcal{N}(x_i,d_i^{(\ell)})$, $i \in \mathcal{I}$. \citet{Zilber2019} recommend computing the conditional mean $\mathbb{E}(\mathbf{x}|\mathbf{t}^{(\ell)})$ based on a general-Vecchia-prediction approach proposed in \citet{Katzfuss2018}. Here, we instead compute the posterior mean using Algorithm \ref{alg:VF} based on the HV method described in Section \ref{sec:hv}, due to its sparsity-preserving properties. In contrast to the approach recommended in \citet{Zilber2019}, our algorithm is guaranteed to converge, because it is equivalent to Newton-Raphson optimization of the log of the posterior density in \eqref{eq:nongaussianpost}, which is concave. Once the algorithm converges to the posterior mode $\widetilde\bm{\mu}$, we obtain a Gaussian HV-Laplace approximation of the posterior as \[ \hat{p}_L(\mathbf{x}|\mathbf{y}) = \mathcal{N}_n(\mathbf{x}|\widetilde\bm{\mu},\widetilde\mathbf{L}\widetilde\mathbf{L}^\top), \] where $\widetilde\mathbf{L}$ is the Cholesky factor of the negative Hessian of the log-posterior at $\widetilde\bm{\mu}$. Our approach is described in Algorithm \ref{alg:VL}. The main computational expense for each iteration of the \texttt{for} loop is carrying out Algorithm \ref{alg:VF}, and so each iteration requires only $\mathcal{O}(nN^2)$ time. \begin{algorithm}[ht] \caption{Hierarchical-Vecchia-Laplace inference: $\hvl(\mathbf{y},\mathbf{S},\bm{\mu},\bm{\Sigma},\{g_i\})$} \KwInput{ data $\mathbf{y}$; sparsity $\mathbf{S}$; $\bm{\mu}, \bm{\Sigma}$ such that $\mathbf{x} \sim \mathcal{N}_n(\bm{\mu}, \bm{\Sigma})$; likelihoods $\{g_i: i \in \mathcal{I} \}$} \KwResult{ $\widetilde\bm{\mu}$ and $\widetilde\mathbf{L}$ such that $\hat{p}_L(\mathbf{x}|\mathbf{y}) = \mathcal{N}_n(\mathbf{x}|\widetilde\bm{\mu},\widetilde\mathbf{L}\widetilde\mathbf{L}^\top)$ } \begin{algorithmic}[1] \STATE Initialize $\mathbf{x}^{(0)} = \bm{\mu}$ \STATE Set $\mathbf{H} = \mathbf{I}_{\mathcal{I},:}$ as the rows $\mathcal{I}$ of the $n \times n$ identity matrix $\mathbf{I}$ \FOR{$\ell = 0,1,2,\ldots$} \STATE Calculate $\mathbf{u}^{(\ell)}$ as in \eqref{eq:u}, $\mathbf{D}^{(\ell)}$ as in \eqref{eq:D}, and $\mathbf{t}^{(\ell)} = \mathbf{x}^{(\ell)} + \mathbf{D}^{(\ell)} \mathbf{u}^{(\ell)}$ \STATE Calculate $[\mathbf{x}^{(\ell+1)},\widetilde\mathbf{L}]=\hv(\mathbf{t}^{(\ell)},\mathbf{S},\bm{\mu},\bm{\Sigma},\mathbf{H},\mathbf{D}^{(\ell)})$ using Algorithm \ref{alg:VF} \IF{$\norm{\mathbf{x}^{(\ell+1)} - \mathbf{x}^{(\ell)}}/\norm{\mathbf{x}^{(\ell)}} < \epsilon$} \STATE \algorithmicbreak \ENDIF \ENDFOR \RETURN $\widetilde{\bm{\mu}}=\mathbf{x}^{(\ell+1)}$ and $\widetilde\mathbf{L}$ \end{algorithmic} \label{alg:VL} \end{algorithm} In the Gaussian case, when $g_i(y_i | x_i) = \mathcal{N}(y_i|a_i x_i,\tau_i^2)$ for some $a_i \in \mathbb{R}$, it can be shown using straightforward calculations that the pseudo-data $t_i = y_i/a_i$ and pseudo-variances $d_i = \tau_i^2$ do not depend on $\mathbf{x}$, and so Algorithm \ref{alg:VL} converges in a single iteration. If, in addition, $a_i=1$ for all $i=1,\ldots,n$, then \eqref{eq:ngobs} becomes equivalent to \eqref{eq:gobs}, and Algorithm \ref{alg:VL} simplifies to Algorithm \ref{alg:VF}. For non-Gaussian data, our Laplace and Gaussian approximations introduce an additional source of error. While this error is difficult to quantify theoretically, empirical studies \citep[e.g.,][]{Bonat2016, Zilber2019} have shown that Laplace-type approximations can be very accurate and can strongly outperform sampling-based approaches such as Markov Chain Monte Carlo. \section{Fast filters for spatio-temporal models} \label{sec:filter} \subsection{Linear evolution} \label{sec:linear-filter} We now turn to a spatio-temporal state-space model (SSM), which adds a temporal evolution model to the spatial model \eqref{eq:ngobs} considered in Section \ref{sec:nongaussian}. For now, assume that the evolution is linear. Starting with an initial distribution $\mathbf{x}_0 \sim \mathcal{N}_{n}(\bm{\mu}_{0|0},\bm{\Sigma}_{0|0})$, we consider the following SSM for discrete time $t=1,2,\ldots$: \begin{align} y_{ti} \,|\, \mathbf{x}_t & \stackrel{ind}{\sim} g_{ti}(y_{ti} | x_{ti}), \qquad i \in \mathcal{I}_t \label{eq:linear-dynamics-obs}\\ \mathbf{x}_t \,|\, \mathbf{x}_{t-1} & \sim \mathcal{N}_n(\mathbf{E}_t\mathbf{x}_{t-1},\mathbf{Q}_t), \label{eq:linear-dynamics} \end{align} where $\mathbf{y}_{t}$ is the data vector consisting of $n_t \leq n$ observations $\{y_{ti}: i \in \mathcal{I}_t\}$, $\mathcal{I}_t \subset \{1,\ldots,n\}$ contains the observation indices at time $t$, $g_{ti}$ is a distribution from the exponential family, $\mathbf{x}_t = (x_1,\ldots,x_n)^\top$ is the latent spatial field of interest at time $t$ observed at a spatial grid $\mathcal{S}$, and $\mathbf{E}_t$ is a sparse $n \times n$ evolution matrix. At time $t$, our goal is to obtain or approximate the filtering distribution $p(\mathbf{x}_t|\mathbf{y}_{1:t})$ of $\mathbf{x}_t$ given data $\mathbf{y}_{1:t}$ up to the current time $t$. This task, also referred to as data assimilation or on-line inference, is commonly encountered in many fields of science whenever one is interested in quantifying the uncertainty in the current state or in obtaining forecasts into the future. If the observation equations $g_{ti}$ are all Gaussian, the filtering distribution can be derived using the Kalman filter \citep{Kalman1960} for small to moderate $n$. At each time $t$, the Kalman filter consist of a forecast step that computes $p(\mathbf{x}_t|\mathbf{y}_{1:t-1})$, and an update step which then obtains $p(\mathbf{x}_t|\mathbf{y}_{1:t})$. For linear Gaussian SSMs, both of these distributions are multivariate normal. Our Kalman-Vecchia-Laplace (KVL) filter extends the Kalman filter to high-dimensional SSMs (i.e., large $n$) with non-Gaussian data, as in \eqref{eq:linear-dynamics-obs}--\eqref{eq:linear-dynamics}. Its update step is very similar to the inference problem in Section \ref{sec:nongaussian}, and hence it essentially consists of the HVL in Algorithm \ref{alg:VL}. We complement this update with a forecast step, in which the moment estimates are propagated forward using the temporal evolution model. This forecast step is exact, and so the KVL approximation error is solely due to the HVL approximation at each update step. The KVL filter is given in Algorithm \ref{alg:KVLfilter}. \begin{algorithm}[ht] \caption{Kalman-Vecchia-Laplace (KVL) filter} \KwInput{$\mathbf{S}$, $\bm{\mu}_{0|0}$, $\bm{\Sigma}_{0|0}$, $\{(\mathbf{y}_t,\mathbf{E}_t,\mathbf{Q}_t,\{g_{t,i}\}): t=1,2,\ldots \}$} \KwResult{$\bm{\mu}_{t|t}, \mathbf{L}_{t|t}$, such that $\hat{p}(\mathbf{x}_t|\mathbf{y}_{1:t}) = \mathcal{N}_n(\mathbf{x}_t|\bm{\mu}_{t|t},\mathbf{L}_{t|t}\mathbf{L}_{t|t}^\top)$} \begin{algorithmic}[1] \STATE Compute $\mathbf{U}_{0|0} = \ichol(\bm{\Sigma}_{0|0}, \mathbf{S})$ and $\mathbf{L}_{0|0} = \mathbf{U}_{0|0}^{-\top}$ \FOR{$t = 1, 2, \dots$} \STATE Forecast: $\bm{\mu}_{t|t-1} = \mathbf{E}_t\bm{\mu}_{t-1|t-1}$ and $\mathbf{L}_{t|t-1} = \mathbf{E}_t\mathbf{L}_{t-1|t-1}$ \label{ln:evolL} \STATE For all $(i,j)$ with $\mathbf{S}_{i,j}=1$: $\bm{\Sigma}_{t|t-1; i,j} = \mathbf{L}_{t|t-1;i,:} \mathbf{L}_{t|t-1;j,:}^\top + \mathbf{Q}_{t;i,j}$ \label{ln:forecov} \STATE Update: $[\bm{\mu}_t, \mathbf{L}_{t|t}] = \hvl(\mathbf{y}_t, \mathbf{S}, \bm{\mu}_{t|t-1}, \bm{\Sigma}_{t|t-1}, \left\{g_{t,i}\right\}$) using Algorithm \ref{alg:VL} \RETURN $\bm{\mu}_{t|t}, \mathbf{L}_{t|t}$ \ENDFOR \end{algorithmic} \label{alg:KVLfilter} \end{algorithm} In Line \ref{ln:forecov}, $\mathbf{L}_{t|t-1;i,:}$ denotes the $i$th row of $\mathbf{L}_{t|t-1}$. The KVL filter scales well with the state dimension $n$. The evolution matrix $\mathbf{E}_t$, which is often derived using a forward-finite-difference scheme and thus has only a few nonzero elements in each row, can be quickly multiplied with $\mathbf{L}_{t-1|t-1}$ in Line \ref{ln:evolL}, as the latter is sparse (see Section \ref{sec:vecchia-complexity}). The $\mathcal{O}(nN)$ necessary entries of $\bm{\Sigma}_{t|t-1}$ in Line \ref{ln:forecov} can also be calculated quickly due to the sparsity of $\mathbf{L}_{t|t-1;i,:}$. The low computational cost of the \texttt{HVL} algorithm has already been discussed in Section \ref{sec:nongaussian}. Thus, assuming sufficiently sparse $\mathbf{E}_t$, the KVL filter scales approximately as $\mathcal{O}(nN^2)$ per iteration. In the case of Gaussian data (i.e., all $g_{ti}$ in \eqref{eq:linear-dynamics-obs} are Gaussian), our KVL filter will produce essentially equivalent filtering distributions as the more complicated multi-resolution filter of \citet{Jurek2018}. \subsection{An extended filter for nonlinear evolution} Finally, we consider a nonlinear and non-Gaussian model, which extends \eqref{eq:linear-dynamics-obs}--\eqref{eq:linear-dynamics} by allowing nonlinear evolution operators, $\mathcal{E}_t: \mathbb{R}^n \rightarrow \mathbb{R}^n$. This results in the model \begin{align} \label{eq:obs} y_{ti} \,|\, \mathbf{x}_t & \stackrel{ind}{\sim} g_{ti}(y_{ti} | x_{ti}), \qquad i \in \mathcal{I}_t \\ \label{eq:evol} \mathbf{x}_t \,|\, \mathbf{x}_{t-1} & \sim \mathcal{N}_n(\mathcal{E}_t(\mathbf{x}_{t-1}),\mathbf{Q}_t). \end{align} Due to the nonlinearity of the evolution operator $\mathcal{E}_t$, the KVL filter in Algorithm \ref{alg:KVLfilter} is not directly applicable anymore. However, similar inference is still possible as long as the evolution is not too far from linear. Approximating the evolution as linear is generally reasonable if the time steps are short, or if the measurements are highly informative. In this case, we propose the extended Kalman-Vecchia-Laplace filter (EKVL) in Algorithm~\ref{alg:eKVLfilter}, which approximates the extended Kalman filter \citep[e.g.,][Ch.~5]{Grewal1993} and extends it to non-Gaussian data using the Vecchia-Laplace aproach. For the forecast step, EKVL computes the forecast mean as $\bm{\mu}_{t|t-1} = \mathcal{E}_t(\bm{\mu}_{t-1|t-1})$. The forecast covariance matrix $\bm{\Sigma}_{t|t-1}$ is obtained as before, after approximating the evolution using the Jacobian as $\mathbf{E}_t = \frac{\partial \mathcal{E}_t(\mathbf{y}_{t-1})}{\partial \mathbf{y}_{t-1}} \big|_{\mathbf{y}_{t-1} = \bm{\mu}_{t-1|t-1} }$. Errors in the forecast covariance matrix due to this linear approximation can be captured in the innovation covariance, $\mathbf{Q}_t$. If the Jacobian matrix cannot be computed, it is sometimes possible to build a statistical emulator \citep[e.g.,][]{Kaufman2011} instead, which approximates the true evolution operator. Once $\bm{\mu}_{t|t-1}$ and $\bm{\Sigma}_{t|t-1}$ have been obtained, the update step of the EKVL proceeds exactly as in the KVL filter by approximating the forecast distribution as Gaussian. \begin{algorithm}[ht] \caption{Extended Kalman-Vecchia-Laplace (EKVL) filter} \KwInput{$\mathbf{S}$, $\bm{\mu}_{0|0}$, $\bm{\Sigma}_{0|0}$, $\{(\mathbf{y}_t,\mathcal{E}_t,\mathbf{Q}_t,\{g_{t,i}\}): t=1,2,\ldots \}$} \KwResult{$\bm{\mu}_{t|t}, \mathbf{L}_{t|t}$, such that $\hat{p}(\mathbf{x}_t|\mathbf{y}_{1:t}) = \mathcal{N}_n(\mathbf{x}_t|\bm{\mu}_{t|t},\mathbf{L}_{t|t}\mathbf{L}_{t|t}^\top)$} \begin{algorithmic}[1] \STATE Compute $\mathbf{U}_{0|0} = \ichol(\bm{\Sigma}_{0|0}, \mathbf{S})$ and $\mathbf{L}_{0|0} = \mathbf{U}_{0|0}^{-\top}$ \FOR{$t = 1, 2, \dots$} \STATE Calculate $\mathbf{E}_t = \frac{\partial \mathcal{E}_t(\mathbf{x}_{t-1})}{\partial \mathbf{x}_{t-1}} \big|_{\mathbf{x}_{t-1} = \bm{\mu}_{t-1|t-1} }$ \label{ln:jacobian} \STATE Forecast: $\bm{\mu}_{t|t-1} = \mathcal{E}_t(\bm{\mu}_{t-1|t-1})$ and $\mathbf{L}_{t|t-1} = \mathbf{E}_t\mathbf{L}_{t-1|t-1}$ \STATE For all $(i,j)$ with $\mathbf{S}_{i,j}=1$: $\bm{\Sigma}_{t|t-1; i,j} = \mathbf{L}_{t|t-1;i,:} \mathbf{L}_{t|t-1;j,:}^\top + \mathbf{Q}_{t;i,j}$ \STATE Update: $[\bm{\mu}_t, \mathbf{L}_{t|t}] = \hvl(\mathbf{y}_t, \mathbf{S}, \bm{\mu}_{t|t-1}, \bm{\Sigma}_{t|t-1}, \left\{g_{t,i}\right\}$) using Algorithm \ref{alg:VL} \RETURN $\bm{\mu}_{t|t}, \mathbf{L}_{t|t}$ \ENDFOR \end{algorithmic} \label{alg:eKVLfilter} \end{algorithm} Similarly to Algorithm \ref{alg:KVLfilter}, EKVL scales very well with the dimension of $\mathbf{x}$, the only difference being the additional operation of calculating the Jacobian in Line \ref{ln:jacobian}, whose cost is problem dependent. Only those entries of $\mathbf{E}_t$ need to be calculated that are multiplied with non-zero entries of $\mathbf{L}_{t-1|t-1}$, whose sparsity structure is known ahead of time. \subsection{A particle-EKVL filter in case of unknown parameters} The distributions and matrices in model \eqref{eq:obs}--\eqref{eq:evol} may depend on parameters $\bm{\theta}_t$ at each time $t$, which we have implicitly assumed to be known thus far. We now discuss the case of a (small) number of unknown parameters $\bm{\theta}_t$. Specifically, $\bm{\mu}_{0|0}$ and $\bm{\Sigma}_{0|0}$ may depend on $\bm{\theta}_0$, and the quantities $\{g_{t,i}\}$, $\mathcal{E}_t$, and $\mathbf{Q}_t$ at each time $t$ may depend on $\bm{\theta}_t$. There are two main approaches to simultaneous filtering for the state $\mathbf{x}_t$ and the parameters $\bm{\theta}_t$: state augmentation and Rao-Blackwellized filters \citep{Doucet2011}. The main idea behind the former is to include $\bm{\theta}_t$ in the state vector $\mathbf{x}_t$ and to modify the evolution and the model error matrices accordingly, but this approach is known to work poorly in certain cases \citep[e.g.,][]{delsole2010state,Katzfuss2017c}. Thus, following \citet{Jurek2018}, we now present a Rao-Blackwellized filter in which integration over $\mathbf{x}_t$ is performed based on our HVL approximation. Writing $\bm{\theta}_{0:t} = (\bm{\theta}_0, \ldots, \bm{\theta}_t)$, the integrated likelihood at time $t$ is given by \begin{equation} \textstyle p(\mathbf{y}_{1:t}|\bm{\theta}_{0:t}) = p(\mathbf{y}_1 | \bm{\theta}_{0:1})\prod_{k=2}^t p(\mathbf{y}_{k}|\mathbf{y}_{1:k-1}, \bm{\theta}_{0:k}). \label{eq:int-lik-approx} \end{equation} It is well known that \begin{equation} p(\mathbf{y}_{t}|\mathbf{y}_{1:t-1}, \bm{\theta}_{0:t}) = \frac{p(\mathbf{y}_t, \mathbf{x}_t | \mathbf{y}_{1:t-1},\bm{\theta}_{0:t})}{p(\mathbf{x}_t|\mathbf{y}_{1:t},\bm{\theta}_{0:t})} = \frac{p(\mathbf{y}_t | \mathbf{x}_t,\bm{\theta}_{t}) p(\mathbf{x}_t|\mathbf{y}_{1:t-1},\bm{\theta}_{0:t})}{ p(\mathbf{x}_t|\mathbf{y}_{1:t},\bm{\theta}_{0:t})}, \label{eq:lik-decom} \end{equation} where $p(\mathbf{y}_t | \mathbf{x}_t,\bm{\theta}_{t})$ is available in closed form from \eqref{eq:obs}, and the forecast and filtering distributions can be approximated using the EKVL, to obtain \begin{equation} \mathcal{L}_t(\bm{\theta}_{0:t}) \colonequals \hat p(\mathbf{y}_{t}|\mathbf{y}_{1:t-1}, \bm{\theta}_{0:t}) = \frac{p(\mathbf{y}_t | \mathbf{x}_t,\bm{\theta}_{t})\mathcal{N}(\bm{\mu}_{t|t-1}, \bm{\Sigma}_{t|t-1})}{\mathcal{N}(\bm{\mu}_{t|t}, \bm{\Sigma}_{t|t})}. \label{eq:approximate-yAR} \end{equation} The normal densities can be quickly evaluated for given parameter values $\bm{\theta}_{0:t}$, because Algorithm \ref{alg:eKVLfilter} calculates sparse Cholesky factors of their precision matrices. For $t=1$, the term $\mathcal{L}_1(\bm{\theta}_{0:1}) \colonequals \hat p(\mathbf{y}_1|\bm{\theta}_{0:1})$ can be approximated in a similar way using $\bm{\mu}_{0|0}$ and $\bm{\Sigma}_{0|0}$. The particle-EKVL filter is given by Algorithm \ref{alg:peKVLfilter}, assuming that the parameter priors are given by $f_0(\bm{\theta}_0)$ and then recursively by $f_t(\bm{\theta}_t|\bm{\theta}_{t-1})$. \begin{algorithm}[ht] \caption{Particle-EKVL filter} \KwInput{$\mathbf{S}$, $\bm{\mu}_{0|0}$, $\bm{\Sigma}_{0|0}$, $\{(\mathbf{y}_t,\mathcal{E}_t,\mathbf{Q}_t,\{g_{t,i}\}): t=1,2,\ldots \}$, priors $\{f_t\}$, proposal distributions $\{q_t\}$, desired number of particles $N_p$} \KwResult{ $\{(\bm{\theta}_t^{(l)},w_t^{(l)},\bm{\mu}_{t|t}^{(l)},\mathbf{L}^{(l)}_{t|t}): l=1,\ldots,N_p\}$, such that $\hat p(\bm{\theta}_t,\mathbf{x}_t|\mathbf{y}_{1:t}) = \sum_{l=1}^{N_p} w_t^{(l)} \delta_{\bm{\theta}_t^{(l)}}(\bm{\theta}_t) \mathcal{N}_n(\mathbf{x}_t|\bm{\mu}_{t|t}^{(l)},\mathbf{L}_{t|t}^{(l)}\mathbf{L}_{t|t}^{(l)}{}^\top)$} \begin{algorithmic}[1] \FOR{$l = 1, 2, \dots, N_p$} \STATE Draw $\bm{\theta}_0^{(l)} \sim f_0(\bm{\theta}_0)$ and set weight $w_0^{(l)} = 1/N_p$ \STATE Compute $\mathbf{L}_{0|0}(\bm{\theta}_0^{(l)}) = \ichol(\bm{\Sigma}_{0|0}(\bm{\theta}_0^{(l)}), \mathbf{S})$ \STATE Compute $\bm{\mu}^{(l)}_{0|0}(\bm{\theta}_0^{(l)})$ and $\mathbf{U}_{0|0}(\bm{\theta}_0^{(l)}) = \mathbf{L}_{0|0}^{-\top}(\bm{\theta}_0^{(l)})$ \ENDFOR \FOR{$t = 1, 2, \ldots$} \FOR{$l = 1, 2, \ldots, N_p$} \STATE Draw $\bm{\theta}_t^{(l)} \sim q_t(\bm{\theta}_t^{(l)}|\bm{\theta}_{t-1}^{(l)})$ \STATE Calculate $\mathbf{E}_t^{(l)} = \frac{\partial \mathcal{E}_t(\mathbf{y}_{t-1}, \bm{\theta}_t^{(l)})}{\partial \mathbf{y}_{t-1}} \big|_{\mathbf{y}_{t-1} = \bm{\mu}_{t-1|t-1}(\bm{\theta}_{t-1}^{(l)}) }$ \label{ln:jacobian2} \STATE Forecast: $\bm{\mu}_{t|t-1}^{(l)} = \mathcal{E}_t(\bm{\mu}_{t-1|t-1}, \bm{\theta}_{t-1}^{(l)})$ and $\mathbf{L}_{t|t-1}^{(l)} = \mathbf{E}_t^{(l)}\mathbf{L}_{t-1|t-1}^{(l)}$ \STATE For $(i,j)$ s.t.\ $\mathbf{S}_{i,j}=1$: $\bm{\Sigma}_{t|t-1; i,j}^{(l)} = \mathbf{L}_{t|t-1;i,:}^{(l)} (\mathbf{L}_{t|t-1;j,:}^{(l)})^\top + \mathbf{Q}_{t;i,j}(\bm{\theta}^{(l)}_t)$ \STATE Update: $[\bm{\mu}_t^{(l)}, \mathbf{L}_{t|t}^{(l)}] = \hvl(\mathbf{y}_t, \mathbf{S}, \bm{\mu}_{t|t-1}^{(l)}, \bm{\Sigma}_{t|t-1}^{(l)}, \{g_{t,i}(\bm{\theta}^{(l)}_t)\}$) \STATE Calculate $\mathcal{L}_t(\bm{\theta}_{0:t}^{(l)})$ as in \eqref{eq:approximate-yAR} \STATE Update particle weight $w_t^{(l)} \propto w_{t-1}^{(l)} \mathcal{L}_t(\bm{\theta}_{0:t}^{(l)})f_t(\bm{\theta}_{t}^{(l)} | \bm{\theta}_{t-1}^{(l)}) / q_t(\bm{\theta}_{t}^{(l)} | \bm{\theta}_{t-1}^{(l)})$ \RETURN $\bm{\mu}_{t|t}^{(l)}, \mathbf{L}_{t|t}^{(l)}, \bm{\theta}_t^{(l)}, w_t^{(l)}$ \ENDFOR \STATE Resample $\{(\bm{\theta}_{t}^{(l)}, \bm{\mu}_{t|t}^{(l)}, \mathbf{L}_{t|t}^{(l)})\}_{l=1}^{N_p}$ with weights $\{w_t^{(l)}\}_{l=1}^{N_p}$ to obtain equally weighted particles \citep[e.g.,][]{Douc2005} \ENDFOR \end{algorithmic} \label{alg:peKVLfilter} \end{algorithm} \section{Numerical comparison\label{sec:comparison}} \subsection{Methods and criteria\label{sec:simul-general}} We considered and compared the following methods: \begin{description} \item[Hierarchical Vecchia (HV):] Our methods as described in this paper. \item[Low rank (LR):] A special case of HV with $M=1$, in which the diagonal and the first $N$ columns of $\mathbf{S}$ are nonzero, and all other entries are zero. This results in a matrix approximation $\hat\bm{\Sigma}$ that is of rank $N$ plus diagonal, known as the modified predictive process \citep[][]{Banerjee2008,Finley2009} in spatial statistics. LR has the same computational complexity as HV. \item[Dense Laplace (DL):] A further special case of HV with $M=0$, in which $\mathbf{S}$ is a fully dense matrix of ones. Thus, there is no error due to the Vecchia approximation, and so in the non-Gaussian spatial-only setting, this is equivalent to a Gaussian Laplace approximation. DL will generally be more accurate than HV and low-rank, but it scales as $\mathcal{O}(n^3)$ and is thus not feasible for high dimension $n$. \end{description} For each scenario below, we simulated observations using \eqref{eq:obs}, taking $g_{t,i}$ to be each of four exponential-family distributions: Gaussian, $\mathcal{N}(x,\tau^2)$; logistic Bernoulli, $\mathcal{B}(1/(1+e^{-x}))$; Poisson, $\mathcal{P}(e^x)$; and gamma, $\mathcal{G}(a, ae^{-x})$, with shape parameter $a=2$. For most scenarios, we assumed a moderate state dimension $n$, so that DL remained feasible; a large $n$ was considered in Section \ref{sec:big-simul}. The main metric to compare HV and LR was the difference in KL divergence between their posterior or filtering distributions and those generated by DL; as the exact distributions were not known here, we approximated this metric by the average difference in log scores \citep[dLS; e.g.,][]{Gneiting2014} over several simulations. We also calculated the relative root mean square prediction error (RRMSPE), defined as the root mean square prediction error of HV and LR, respectively, divided by the root mean square prediction error of DL. For both criteria, lower values are better. \subsection{Spatial-only data} \label{sec:purely-spatial} In our first scenario, we considered spatial-only data according to \eqref{eq:ngobs}--\eqref{eq:ngevol} on a grid $\mathcal{S}$ of size $n=34 \times 34 = 1{,}156$ on the unit square, $\mathcal{D} = [0,1]^2$. We set $\bm{\mu} = \mathbf{0}$ and $\bm{\Sigma}_{i,j} = \exp(-\|\mathbf{s}_i - \mathbf{s}_j\|/0.15)$. For the Gaussian likelihood, we assumed variance $\tau^2 = 0.2$. The comparison scores averaged over 100 simulations for the posteriors obtained using Algorithm \ref{alg:VL} are shown as a function of $N$ in Figure \ref{fig:spatial-scores}. HV (Algorithm \ref{alg:VF}) was much more accurate than LR for each value of $N$. \begin{figure}[ht] \centering \begin{subfigure}{1.0\textwidth} \includegraphics[trim=0mm 6mm 0mm 0mm, clip,width=1.0\textwidth]{plots/spatial-RRMSPE.pdf} \end{subfigure} \medskip \begin{subfigure}{1.0\textwidth} \includegraphics[trim=0mm 0mm 0mm 6mm, clip,width=1.0\textwidth]{plots/spatial-dLS.pdf} \end{subfigure} \caption{Approximation accuracy for the posterior distribution $\mathbf{x}|\mathbf{y}$ for spatial data (see Section \ref{sec:purely-spatial})} \label{fig:spatial-scores} \end{figure} \subsection{Linear temporal evolution\label{sec:simul-linear}} Next, we considered a linear spatio-temporal advection-diffusion process with diffusion parameter $\alpha = 4 \times 10^{-5}$ and advection parameter $\beta = 10^{-2}$ as in \citet{Jurek2018}. The spatial domain $\mathcal{D} = [0,1]^2$ was discretized on a grid of size $n=34 \times 34 = 1{,}156$ using the centered finite differences, and we considered discrete time points $t=1,\ldots,T$ with $T=20$. After this discretization, our model was of the form \eqref{eq:linear-dynamics-obs}--\eqref{eq:linear-dynamics}, where $\bm{\Sigma}_{0|0}=\mathbf{Q}_1=\ldots=\mathbf{Q}_T$ with $(i,j)$th entry $\exp(-\|\mathbf{s}_i - \mathbf{s}_j\|/0.15)$, and $\mathbf{E}_t$ was a sparse matrix with nonzero entries corresponding to interactions between neighboring grid points to the right, left, top and bottom. See the supplementary material of \citet{Jurek2018} for details. At each time $t$, we generated $n_t = 0.1 n$ observations with indices $\mathcal{I}_t$ sampled randomly from $\{1,\ldots,n\}$. For the Gaussian case, we assumed variance $\tau^2=0.25$. We used conditioning sets of size at most $N=41$ for both HV and LR; specifically, for HV, we used $J=2$ partitions at $M=7$ resolutions, with set sizes $|\mathcal{X}_{j_1,\ldots,j_m}|$ of $5, 5, 5, 5, 6, 6, 6$, respectively, for $m=0,1,\ldots,M-1$, and $|\mathcal{X}_{j_1,\ldots,j_M}| \leq 3$. Figure \ref{fig:linear-scores} compares the scores for the filtering distributions $\mathbf{x}_t | \mathbf{y}_{1:t}$ obtained using Algorithm \ref{alg:KVLfilter}, averaged over 80 simulations. Again, HV was much more accurate than LR. Importantly, while the accuracy of HV was relatively stable over time, LR became less accurate over time, with the approximation error accumulating. \begin{figure}[ht] \centering \begin{subfigure}{1.0\textwidth} \includegraphics[trim=0mm 6mm 0mm 0mm, clip,width=1.0\textwidth]{plots/linear-RRMSPE.pdf} \end{subfigure} \begin{subfigure}{1.0\textwidth} \includegraphics[trim=0mm 0mm 0mm 6mm, clip,width=1.0\textwidth]{plots/linear-dLS.pdf} \end{subfigure} \caption{Accuracy of filtering distributions $\mathbf{x}_t | \mathbf{y}_{1:t}$ for the advection-diffusion model in Section \ref{sec:simul-linear}} \label{fig:linear-scores} \end{figure} \subsection{Simulations using a very large \texorpdfstring{$n$}{n}} \label{sec:big-simul} We repeated the advection-diffusion experiment from Section \ref{sec:simul-linear} on a high-resolution grid of size $n=300 \times 300 = 90{,}000$, with $n_t=9{,}000$ observations corresponding to 10\% of the grid points. In order to avoid numerical artifacts related to the finite differencing scheme, we reduced the advection and diffusion coefficients to $\alpha = 10^{-7}$ and $\beta=10^{-3}$, respectively. We set $N=44$, $M=14$, $J=2$, and $|\mathcal{X}_{j_1,\ldots,j_m}| = 3$ for $m=0,1,\ldots,M-1$, and $|\mathcal{X}_{j_1,\ldots,j_M}| \leq 2$. DL was too computationally expensive due to the high dimension $n$, and so we simply compared HV and LR based on the root mean square prediction error (RMSPE) between the true state and their respective filtering means, averaged over 10 simulations. As shown in Figure \ref{fig:linear-scores-big}, HV was again much more accurate than LR. Comparing to Figure \ref{fig:linear-scores}, we see that the relative improvement of HV to LR increased even further; taking the Gaussian case as an example, the ratio of the RMSPE for HV and LR was around 1.2 in the small-$n$ setting, and greater than 2 in the large-$n$ setting. \begin{figure}[ht] \centering \begin{subfigure}{1.0\textwidth} \includegraphics[width=1.0\textwidth]{plots/linear-RMSPE.pdf} \end{subfigure} \caption{Root mean square prediction error (RMSPE) for the filtering mean in the high-dimensional advection-diffusion model with $n=90{,}000$ in Section \ref{sec:big-simul}} \label{fig:linear-scores-big} \end{figure} \subsection{Nonlinear evolution with non-Gaussian data\label{sec:lorenz}} Our final set of our simulations involves the most general model \eqref{eq:obs}-\eqref{eq:evol} with nonlinear evolution $\mathcal{E}_t$. Specifically, we considered a complicated model \citep[][Sect.~3]{Lorenz2005} that realistically replicates many features of atmospheric variables along a latitudinal band. A special case of this model \citep{Lorenz1996} is an important benchmark for data-assimilation techniques. The model dynamics are described by \begin{equation} \textstyle \frac{\partial }{\partial t} \tilde x_i = \frac{1}{K^2} \sum_{l=-K/2}^{K/2}\sum_{j=-K/2}^{K/2} -\tilde x_{i-2K-l}\tilde x_{i-K-j} + \tilde x_{i-K+j-l}\tilde x_{i+K+j} - \tilde x_i + F, \label{eq:Lorenz04-1} \end{equation} where $\tilde x_{-i} = \tilde x_{n-i}$, and we used $K=32$ and $F=10$. By solving \eqref{eq:Lorenz04-1} on a regular grid of size $n=960$ on a circle with unit circumference using a 4-th order Runge-Kutta scheme, with five internal steps of size $dt=0.005$, and setting $x_i = b\tilde x_i$ with $b=0.2$, we obtained the evolution operator $\mathcal{E}_t$. We also calculated an analytic expression for its derivative $\nabla\mathcal{E}_t$, which is necessary for Algorithm \ref{alg:eKVLfilter}. To complete our state-space model \eqref{eq:obs}-\eqref{eq:evol}, we assumed $\mathbf{Q}_{t;i,j} = 0.2 \exp(-\|\mathbf{s}_i - \mathbf{s}_j\|/0.15)$, we randomly selected $n_t = n/10 = 96$ observation indices at each $t$, and we took the initial moments $\bm{\mu}_{0|0}$ and $\bm{\Sigma}_{0|0}$ to be the corresponding sample moments from a long simulation from \eqref{eq:Lorenz04-1}. We simulated 40 datasets from the state-space model, each at $T=20$ time steps, and for each of the four exponential-family likelihoods, using $\tau^2=0.2$ in the Gaussian case. For each data set obtained in this way, we applied the three filtering methods described in Section \ref{sec:simul-general}. We used $N=39$, and for the EKVL filter (Algorithm \ref{alg:eKVLfilter}) we set $J=2$, $M=7$, and $\lvert \mathcal{X}_{j_1,\ldots,j_m} \rvert$ equal to 5, 5, 5, 5, 6, 6, 6, respectively, for $m=0, 1, \dots, M-1$, and $\lvert \mathcal{X}_{j_1,\ldots,j_M}\rvert \leq 1$. The average scores over the 40 simulations are shown in Figure \ref{fig:lorenz-scores}. Our method (HV) compared favorably to the low-rank filter and provided excellent approximation accuracy as evidenced by very low RRMSPE and dLS scores. \begin{figure}[ht] \centering \begin{subfigure}{1.0\textwidth} \includegraphics[trim=0mm 6mm 0mm 0mm, clip,width=1.0\textwidth]{plots/lorenz-RRMSPE.pdf} \end{subfigure} \begin{subfigure}{1.0\textwidth} \includegraphics[trim=0mm 0mm 0mm 12mm, clip,width=1.0\textwidth]{plots/lorenz-dLS.pdf} \end{subfigure} \caption{Accuracy of filtering distribution $\mathbf{x}_t | \mathbf{y}_{1:t}$ for the Lorenz model in Section \ref{sec:lorenz}} \label{fig:lorenz-scores} \end{figure} \section{Conclusions\label{sec:conclusion}} We specified the relationship between ordered conditional independence and sparse (inverse) Cholesky factors. Next, we described a hierarchical Vecchia approximation and showed that it exhibits equivalent sparsity in the Cholesky factors of both its precision and covariance matrices. Due to this remarkable property, the approximation is suitable for high-dimensional spatio-temporal filtering. The hierarchical Vecchia approximation can be computed using a simple and fast incomplete Cholesky decomposition. Further, by combining the approach with a Laplace approximation and the extended Kalman filter, we obtained scalable filters for non-Gaussian and non-linear spatio-temporal state-space models. Our methods can also be directly applied to spatio-temporal point patterns modeled using log-Gaussian Cox processes, which can be viewed as Poisson data after discretization of the spatial domain, resulting in accurate Vecchia-Laplace-type approximations \citep{Zilber2019}. We plan on investigating an extension of our methods to retrospective smoothing over a fixed time period. Another interesting extension would be to combine our methodology with the unscented Kalman filter \citep[][]{Julier1997} for strongly nonlinear evolution. Finally, while we focused our attention on spatio-temporal data, our work can be extended to other applications, as long as a sensible hierarchical partitioning of the state vector can be obtained as in Section \ref{sec:hv-intro}. Code implementing our methods and reproducing our numerical experiments is available at \url{https://github.com/katzfuss-group/vecchiaFilter}. \FloatBarrier \footnotesize
\section{Introduction and Statement of the Main Results} The Riemann zeta-function $\zeta(s)$ plays a central role in number theory and, in particular, the distribution of its zeros is relevant for the error term in the prime number theorem and further asymptotic formulae in analytic number theory. In his invited talk at the fifth International Mathematical Congress at Cambridge in 1912, Landau \cite{astart} suggested that ``[g]iven an analytic function, the points for which this function is $0$ are very important; however, of equal interest are those points where the function assumes a given value''. Given a complex number $\alpha$, the roots of the equation $$ \zeta(s)=\alpha $$ are called $\alpha$-points and will be denoted by $\rho_{\alpha}=\beta_{\alpha}+i\gamma_{\alpha}$. Moreover, for the non-trivial zeros of $\zeta(s)$ we just use the notation $\rho=\beta+i\gamma$. Our investigations have their origin in the work of Landau \cite{lan} who proved that if $x>1$, then $$\sum\limits_{0<\gamma\leq T}x^\rho=-\dfrac{T}{2\pi}\Lambda(x)+O_x(\log T)$$ for any $T>1$, where $\Lambda(x)$ is the von Mangoldt function extended to the whole real line by setting it to be equal to zero if $x$ is not a positive integral power of a prime $p$. The dependence of the implicit constant on $x$ was made explicit only much later by Gonek \cite{Gon}. Such explicit formulae have been proven very useful to the study of the vertical distribution of the non-trivial zeros of $\zeta(s)$. For instance, Radamacher \cite{rad} employed Landau's formula and proved that the sequence $(a\gamma)_{\gamma>0}$ is uniformly distributed mod 1 for any real number $a\neq0$, provided that the Riemann Hypothesis is true. Later Elliott \cite{Ell} remarked that the latter condition can be removed, and (independently) Hlawka \cite{Hl} obtained the aforementioned result unconditionally. On the other hand, Ford and Zaharescu \cite{F.Z} and Ford, Soundararajan and Zaharescu \cite{F.S.Z} made use of Gonek's explicit version of Landau's formula to prove quantitative results regarding the distribution of $\left(a\gamma\right)_{\gamma>0}$ with respect to its discrepancy. For related results we also refer to Fujii \cite{F1,F2,F3,F4,F5,F6,F7}. Motivated by such considerations, the third author \cite{st} studied the distribution of the $\alpha$-points of $\zeta(s)$. He first proved the analogue of Landau's formula, that is, if $\alpha\neq1$ is complex number, $x\neq1$ is a positive number and $\epsilon>0$, then \begin{align}\label{Reh} \mathop{\sum\limits_{0<\gamma_\alpha\leq T}}_{\beta_\alpha>0}x^{\rho_\alpha} =\dfrac{T}{2\pi}\left(a(x)-x\Lambda\left(\dfrac{1}{x}\right)\right)+O_{\alpha,x,\epsilon}\left(T^{1/2+\epsilon}\right) \end{align} for any $T>1$, where $a(x)$ is defined on the positive integers by the coefficients of the ordinary Dirichlet series $$\dfrac{\zeta(s)}{\zeta(s)-\alpha}=\sum\limits_{n=1}^{\infty}\dfrac{a(n)}{n^s},$$ and is equal to zero for any other real number $x$.\footnote{The special case of $\alpha=1$ will be discussed in the remark following Theorem 3.} He then employed a classic result due to Levinson \cite{levia}, regarding the clustering of the $\alpha$-points of $\zeta(s)$ around the critical line, and proved that the sequence $(a\gamma_\alpha)_{\gamma_\alpha>0}$ is uniformly distributed mod 1 for any real number $a\neq0$. Recently, Rehberg \cite{Reh} and Gonek and Baluyot \cite{bg} proved (independently) relation \eqref{Reh} and made the dependence on $x$ explicit; in accordance they proved discrepancy estimates for the sequence $(a\gamma_\alpha)_{\gamma_\alpha>0}$. We improve upon these results in Theorem \ref{MAIN3}. As a matter of fact, we start by proving analogous results for functions $\mathcal{L}(s)$ in the Selberg class $\mathcal{S}$ of a given degree $d_\mathcal{L}$. The definition and properties of $\alpha$-points of such functions are similar to the one of $\zeta(s)$, which belongs to $\mathcal{S}$ with $d_\zeta=1$. For more details we refer to Section 2. To state our theorems, we only need to define here for a given complex number $\alpha\neq1$ and $\mathcal{L}\in\mathcal{S}$, the function $\Lambda(x;\mathcal{L},\alpha)$ which for positive integers $x=n$ is given by the coefficients of the Dirichlet series \begin{align}\label{coeff} \dfrac{\mathcal{L}'(s)}{\mathcal{L}(s)-\alpha}=-\sum\limits_{n=1}^{\infty}\dfrac{\Lambda(n;\mathcal{L},\alpha)}{n^s}, \end{align} and is equal to zero for any other real number $x$. The error terms in the subsequent theorems depends on the real quantity $\sigma(\mathcal{L},\alpha)$, which is related to the convergence of the latter Dirichlet series and is explicitly given by (\ref{aabscissa}). Laslty, the {\it Landau symbols} $o(\cdot)$ and $O(\cdot)$ have their usual meaning, and if the implied constant depends on some parameter $\epsilon$ (say), then we write $O_\epsilon$. The implicit constants may depend also on $\mathcal{L}$ and $\alpha$ but we drop such subscripts. The same comments apply to the {\it Vinogradov symbols} $\ll$ and $\gg$. \begin{theorem}\label{MAIN1} Let $\mathcal{L}\in \mathcal{S}\setminus\lbrace1\rbrace$, $\alpha\neq1$ be a complex number and $\epsilon>0$. Then \begin{align*} \mathop{\sum\limits_{0<\gamma_\alpha\leq T}}_{\beta_\alpha\geq0}x^{\rho_\alpha} =&-\dfrac{T}{2\pi}\Lambda\left(x;\mathcal{L},\alpha\right)+O_\epsilon\left(x^{\sigma(\mathcal{L},\alpha)+\epsilon}\left(1+\mathbbm{1}_{\mathbb{R}\setminus\mathbb{Z}}(x)\min\left\{\frac{T}{x},\dfrac{1}{\|x\|}\right\}\right)\right)+\\ &+O_\epsilon\left(x^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon}\log T\left(1+\dfrac{1}{\log x}\right)\right)+\\ &+O\left(\frac{1}{x^2}\left(\log T\left(1+\dfrac{1}{\log x}\right)+\min\left\{T,\dfrac{1}{\log x}\right\}\right)\right) \end{align*} for any $x,T>1$, where $\mathbbm{1}_\mathcal{A}$ is the characteristic function of a set $\mathcal{A}$ and $\|x\|$ denotes the distance from $x$ to the nearest integer. \end{theorem} \begin{theorem}\label{MAIN2} Let $\mathcal{L}\in \mathcal{S}$ be such that $d_{\mathcal{L}}\geq2$, $\alpha\neq1$ be a complex number and $\epsilon\in(0,1/2)$. Then \begin{align*} \mathop{\sum\limits_{0<\gamma_\alpha\leq T}}_{\beta_\alpha\geq0}x^{-\rho_\alpha} =&\,-\dfrac{T}{2\pi x}\overline{\Lambda\left(x;\mathcal{L},0\right)}+O_\epsilon\left(x^\epsilon\left(1+\mathbbm{1}_{\mathbb{R}\setminus\mathbb{Z}}(x)\min\left\{\dfrac{T}{x},\dfrac{1}{\| x\|}\right\}\right)\right)+\\ &+O\left(x^{\epsilon}+\dfrac{1}{x^{\sigma\left(\mathcal{L},\alpha\right)+1}\log x}+x^{\epsilon}\log T\left(\dfrac{1}{\log x}+\log\dfrac{1}{\epsilon}\right)\right) \end{align*} for any $x,T>1$. \end{theorem} \begin{theorem}\label{MAIN3} Let $\mathcal{L}\in S$ be such that $d_\mathcal{L}=1$ and $\alpha\neq1$ be a complex number. Let also $m=1$ if $\mathcal{L}\equiv\zeta$ and $m=7$, otherwise. Then \begin{align*} \mathop{\sum\limits_{0<\gamma_\alpha\leq T}}_{\beta_\alpha\geq0}x^{-\rho_\alpha} =&-\dfrac{T}{2\pi x}\overline{\Lambda\left(x;\mathcal{L},0\right)}+O\left(\log x\min\left\{\dfrac{T}{x},\dfrac{1}{\langle x\rangle}\right\}\right)+O\left(\left(\log T\right)^{2m}\log(3x)\right)+\\ &+O\left((1+\log x)\log(2x)\log\log(3x)+\dfrac{1}{x^{\sigma\left(\mathcal{L},\alpha\right)+1}\log x}\right)+\\ &+O\left(\log T\left(\dfrac{1}{\log x}+\log x+\log\log(3x)\right)\right) \end{align*} for any $x,T>1$. \end{theorem} We do not treat the case of $\alpha=1$ since it seems to be rather complicated. The major difficulty arises from the fact that the function on the right-hand side of \eqref{coeff} can not be represented as an ordinary Dirichlet series if $\alpha=1$ (this will become apparent in Lemma 1 of Section 3). There have been attempts in \cite{JMS}, \cite{Reh}, and \cite{st} but in each case the aforementioned lack of an ordinary Dirichlet series represantation has been overseen. It was first Baluyot and Gonek \cite{bg} who noticed these inaccuracies and gave a partial answer also for the case of $\alpha=1$. Explicit formulae in the case of $L$-functions in the Selberg class have been proven also by Murty and Perelli \cite{MP} with respect to their non-trivial zeros, as well as by Jakhlouti, Mazhouda and Steuding \cite{JMS} with respect to $\alpha$-points. In particular those formulae in \cite{JMS} hold under some hypotheses which are not yet proven to be true. Moreover, their formulae are not uniform in $x$ and there is a $T^{1/2+\epsilon}$ in the error term. Our results are unconditional, uniform in $x$ and have smaller error terms. As we mentioned earlier, such formulae are useful in the study of the vertical distribution of $\alpha$-points of a given function. However, our poor knowledge of the horizontal distribution of $\alpha$-points of functions $\mathcal{L}$ in the Selberg class which have degree $d_\mathcal{L}\geq2$, prevents us from deriving results similar to the ones that have been proved for $\zeta(s)$. We would have to assume certain hypotheses such as the Lindel\"of hypothesis for $L$-functions in the Selberg class. For more details we refer to \cite{JMS} and its bibliography. We are optimistic that our explicit formulae and these additional hypotheses can produce discrepancy estimates for sequences $(a\gamma_\alpha)_{\gamma_\alpha>0}$, but we will not persue this direction further. Instead we prove an unconditional result regarding the vertical-distribution of such $\alpha$-points. \begin{theorem}\label{Main1} Let $\mathcal{L}\in\mathcal{S}\setminus\lbrace1\rbrace$ and $\alpha$ be a complex number. Then there exists a positive constant $A=A(\alpha)$ such that for every $T\geq \exp(3)$ one can find an $\alpha$-point $\beta_\alpha+i\gamma_\alpha$ of $\mathcal{L}(s)$ satisfying \begin{align*} |\gamma_\alpha-T|<\dfrac{A}{\log\log\log T}. \end{align*} \end{theorem} This result is a generalization of a theorem due to Littlewood \cite{ little } regarding the non-trivial zeros of $\zeta(s)$, and it yields the following corollary. \begin{corollary}\label{Main2} Let $\mathcal{L}\in\mathcal{S}\setminus\lbrace1\rbrace$, $b>0$ be a real number and $\alpha$ a complex number. Then there exists a subsequence of $\alpha$-points $\left(\rho_{\alpha,n_k}\right)_{k\in\mathbb{N}}$, of $\mathcal{L}(s)$, such that $\gamma_{\alpha,n_k}=bk+o(1)$, and the sequence $\left(a \gamma_{\alpha, n_{k^m}}\right)_{k\in\mathbb{N}}$, is uniformly distributed mod 1 for every real number $a\notin b^{-1}\mathbb{Q}$ and every positive integer $m$. \end{corollary} Lastly, with the aid of the latter corollary, we prove a theorem which combines the vertical-distibution of $\alpha$-points with the universality of $\zeta(s)$. \begin{theorem}\label{universality} Let $\mathcal{L}\in\mathcal{S}\setminus\lbrace{1}\rbrace$ and $\alpha\in\mathbb{C}$. Then there exists a subsequence of $\alpha$-points $\left(\rho_{\alpha,n_k}\right)_{k\in\mathbb{N}}$, of $\mathcal{L}(s)$ such that for any compact set with connected complement $K\subseteq\mathcal{D}:=\left\{s\in\mathbb{C}:1/2<\sigma<1\right\}$, any non-vanishing function $f$ which is continuous on $K$ and analytic in its interior, and any $\varepsilon>0$ $$\liminf\limits_{N\to\infty}\dfrac{1}{N}\sharp\left\{1\leq k\leq N:\max\limits_{s\in K}|\zeta\left(s+i\gamma_{\alpha, n_k}\right)-f(s)|<\varepsilon)\right\}>0,$$ where $\sharp A$ denotes the cardinality of a set $A\subseteq\mathbb{N}$. \end{theorem} In zeta-function theory, `universality' stands for an approximation property as in the previous theorem; this name has been coined with respect to the fact that a wide class of functions can be uniformly approximated by certain shifts of a single function. The first universality theorem is due to Voronin \cite{voro}; in his result there was no condition on the shifts. The first discrete universality theorem is due to Reich \cite{reich}; in his result the shifts are taken from an arithmetic progression. The statement of Theorem \ref{universality} is not new in the case of $\alpha=0$; however, different from previous versions, it is unconditional. First, Garunk\v stis, Laurin\v cikas and Macaitien\.e \cite{glm} proved the above universality theorem under assumption of what they call a {\it weak Montgomery conjecture} on the spacing of the imaginary parts of the nontrivial zeros (as it would follow from the pair correlation conjecture). Secondly, Garunk\v stis and Laurin\v cikas \cite{gl} obtained the same universality result assuming the Riemann hypothesis. It appears that the statement holds unconditionally and even in the wider context of $\alpha$-points of $L$-functions from the Selberg class. \section{The Selberg Class: Definition and First Properties} For a survey on the Selberg class and the value-distribution of its functions we refer to Kaczorowski and Perelli \cite{KP}, Murty and Murty \cite{MM}, and Perelli \cite{Per}. Here we give a few definitions and poperties of $L$-functions from the Selberg class which is usually denoted by $\mathcal{S}$ and was introduced by Selberg \cite{sel}. It consists of Dirichlet series \begin{align*} \mathcal{L}(s):=\sum\limits_{n=1}^{\infty}\dfrac{f(n)}{n^s}, \end{align*} satisfying the following hypotheses: \begin{enumerate} \item{\it Ramanujan hypothesis.} $f(n)\ll_\epsilon n^\epsilon$. \item{\it Analytic continuation.} There exists a non-negative integer $k$ such that $(s-1)^k\mathcal{L}(s)$ is an entire function of finite order. \item{\it Functional equation.} $\mathcal{L}(s)$ satisfies a functional equation of type \begin{align*} \mathfrak{L}(s)=\omega\overline{\mathfrak{L}(1-\overline{s})}, \end{align*} where \begin{align*} \mathfrak{L}(s):=\mathcal{L}(s)Q^s\prod\limits_{j=1}^{J}\Gamma\left(\lambda_js+\mu_j\right) \end{align*} with positive real numbers $Q$, $\lambda_j$, and complex numbers $\mu_j$, $\omega$ with $\Re\mu_j\geq0$ and $|\omega|=1$. \item{\it Euler product.} $\mathcal{L}(s)$ has a product represantation \begin{align*} \mathcal{L}(s)=\prod\limits_{p}\mathcal{L}_p(s), \end{align*} where \begin{align*} \mathcal{L}_p(s)=\exp\left(\sum\limits_{k=1}^{\infty}\dfrac{b(p^k)}{p^{ks}}\right) \end{align*} with suitable coefficients $b(p^k)$ satisfying $b(p^k)\ll p^{k\theta}$ for some $\theta<1/2$. \end{enumerate} Axioms (i) and (ii) imply that a function $\mathcal{L}(s)$ from $\mathcal{S}$ is a Dirichlet series which is absolutely convergent for $\sigma>1$ and it has an analytic continuation to the whole complex plane except for a possible pole at $s=1$. From axiom (iii) one obtains the quantity $$d_{\mathcal{L}}:=2\sum\limits_{j=1}^J\lambda_j,$$ which is called the degree of $\mathcal{L}(s)$ and, although the data from the functional equation is not unique, $d_{\mathcal{L}}$ is well-defined (by its appearance in a zero-counting formula). It has been conjectured that the degree is always a non-negative integer. This deep conjecture has been verified so far only for $d_\mathcal{L}\leq 2$ by work of Kaczorowski and Perelli \cite{KP2}. The only element of degree zero is the function constant $1$; the degree one elements are the Riemann zeta-function $\zeta(s)$ in addition with real shifts of Dirichlet $L$-functions to primitive residue class characters. Typical examples of degree two are Dedekind zeta-functions to quadratic number fields and $L$-functions to normalized newforms. All these examples posses an Euler product and, indeed, axiom (iv) implies that if $\mathcal{L}\in\mathcal{S}$, then it is zero-free in the half-plane $\sigma>1$ and $f(n)$ is a multiplicative function. The functional equation of a function from the Selberg class will play a crucial role in the proofs presented here. We prefer to rewrite it as \begin{align}\label{functequa} \mathcal{L}(s)=H_\mathcal{L}(s)\overline{\mathcal{L}(1-\overline{s})}, \end{align} valid for all $s\in\mathbb{C}$, where \begin{align*} H_\mathcal{L}(s)=\omega Q^{1-2s}\prod\limits_{j=1}^J\dfrac{\Gamma(\lambda_j(1-s)+\overline{\mu_j})}{\Gamma(\lambda_js+\mu_j)}. \end{align*} By Stirling's formula, it follows that \begin{align}\label{Stril} H_\mathcal{L}(\sigma+it)=\left(\lambda Q^2 t^{d_\mathcal{L}}\right)^{1/2-\sigma}\exp\left(-it\log\left(\lambda Q^2\left(\dfrac{t}{e}\right)^{d_\mathcal{L}}\right)\right)e^{i\pi(\mu-d_\mathcal{L})/4}\left(\omega+O_{\sigma_1,\sigma_2}\left(\dfrac{1}{t}\right)\right) \end{align} and \begin{align}\label{fS} -\dfrac{H'_\mathcal{L}}{H_\mathcal{L}}(\sigma+it)=\log\left(\lambda Q^2\left(\dfrac{t}{e}\right)^{d_\mathcal{L}}\right)+O_{\sigma_1,\sigma_2}\left(\dfrac{1}{t}\right), \end{align} uniformly in vertical strips $\sigma_1\leq\sigma\leq\sigma_2$, where $$\mu:=2\sum\limits_{j=1}^J(1-2\mu_j)\,\,\,\text{ and }\,\,\,\lambda:=\prod\limits_{j=1}^J\lambda_j^{2\lambda_j}.$$ In addition to axiom (iii), we have \begin{align}\label{order} |\mathcal{L}(\sigma+it)|\asymp_{\sigma_1,\sigma_2}|t|^{(1/2-\sigma)d_\mathcal{L}}|\mathcal{L}(1-\sigma+it)|,\,\,\,|t|\geq t_0>0, \end{align} uniformly in $\sigma_1\leq\sigma\leq\sigma_2$. Concerning the distribution of the $\alpha$-points of a non-constant element $\mathcal{L}\in\mathcal{S}\setminus\lbrace1\rbrace$ of the Selberg class, it is worth to mention that their location in general is pretty similar to the case of the Riemann zeta-function. There may be an $\alpha$-point in the neighbourhood of a pole of a Gamma-factor in the functional equation (by Rouch\'e's theorem), however, those so-called trivial $\alpha$-points lie not too distant from the negative real axis and with finitely many further exceptions there are no other in the left half-plane $\sigma\leq0$. All other $\alpha$-points are said to be non-trivial and they lie in the right half-plane $\sigma\geq0$. Their number $\mathcal{N}(\alpha,T)$ is asymptotically given by a Riemann-von Mangoldt--type formula: if $\alpha\neq1$ is a complex number, then \begin{align}\label{RMf} \mathcal{N}(\alpha,T):=\left\{s\in\mathbb{C}:\mathcal{L}(s)=\alpha\text{ and }T<t\leq2 T\right\}=\dfrac{d_\mathcal{L}}{2\pi}T\log\dfrac{4T}{e}+\dfrac{T}{2\pi}\log(\lambda Q^2)+O(\log T). \end{align} The proofs of \eqref{Stril}-\eqref{RMf} can be found in \cite[Lemma 6.7, Theorem 6.8, Corollary 7.4]{S}). \section{Auxiliary Lemmas} Before stating our first lemma we remind the Dirichlet convolution of two arithmetical functions. If $f,g:\mathbb{N}\to\mathbb{C}$, then their Dirichlet convolution (or multiplication) is defined by $$(f*g)(n):=\sum\limits_{d\mid n}f(d)g\left(\dfrac{n}{d}\right)$$ for all $n\in\mathbb{N}$. This operation is associative and we denote by $f^{* k}$ the Dirichlet convolution of $f$ with itself $k$ times for some $k\in\mathbb{N}$. Lastly, we denote by $f_0$ the arithmetical function which is identical to $f$ except at $n=1$, where we define $f_0(1):=0$. \begin{lemma}\label{Init} Let $\mathcal{L}\in \mathcal{S}$ and $\alpha\neq1$ be a complex number. If \begin{align}\label{aabscissa} \sigma(\mathcal{L},\alpha) := \left\{ \begin{array}{ll} 1+\sup_{\rho_\alpha}\beta_\alpha,&\alpha\neq0,\\ 1,&\alpha=0. \end{array} \right. \end{align} then $1\leq\sigma(\mathcal{L},\alpha)<\infty$ and the function $\mathcal{L}'(s)/\left(\mathcal{L}(s)-\alpha\right)$ can be represented as an ordinary Dirichlet series which is absolutely convergent in the half-plane $\sigma>\sigma\left(\mathcal{L},\alpha\right)$. In particular, \begin{align*} \dfrac{\mathcal{L}'(s)}{\mathcal{L}(s)-\alpha}=-\sum\limits_{n=1}^{\infty}\dfrac{\Lambda(n;\mathcal{L},\alpha)}{n^s} \end{align*} for any $\sigma>\sigma\left(\mathcal{L},\alpha\right)$, where \begin{align}\label{vMal} \Lambda\left(n;\mathcal{L},\alpha\right):=\left(f\cdot\log\right)*\left(\sum\limits_{k=0}^{\infty}\dfrac{(-1)^kf_0^{*k}}{(1-\alpha)^{k+1}}\right)(n), \end{align} for any positive integer $n$. Moreover, $\Lambda\left(n;\mathcal{L},\alpha\right)\ll_\epsilon n^{\sigma(\mathcal{L},\alpha)-1+\epsilon}$. \end{lemma} \begin{proof} When $\alpha=0$ there is nothing to prove because for $\mathcal{L}\in S$ we know that $$\dfrac{\mathcal{L}'(s)}{\mathcal{L}(s)}=-\sum\limits_{n=1}^{\infty}\dfrac{\Lambda(n;\mathcal{L},0)}{n^s},\,\,\,\sigma>1,$$ where $\Lambda(n;\mathcal{L},0)=f(n)\Lambda(n)$ and $\Lambda(n)$ is the von Mangoldt function. Since $\Lambda(n)\ll\log n$, the Ramanujan hypothesis for the coefficients $f(n)$ imply that $\Lambda(n;\mathcal{L},0)\ll_\epsilon n^\epsilon$. Now let $\alpha\neq0$. Then \begin{align*} \mathcal{L}(s)-\alpha=(1-\alpha)\left(1+\sum\limits_{n=2}^\infty\dfrac{f(n)}{(1-\alpha)n^s}\right) \end{align*} is an ordinary Dirichlet series and the uniqueness theorem for Dirichlet series (see \cite[\S 9.6]{Titch1}) implies that there is an $A>0$ such that $\mathcal{L}(s)-\alpha\neq0$ for any $\sigma>A$. Therefore, $$0\leq\sigma(\mathcal{L},\alpha)-1\leq A.$$ Moreover, it follows from \cite[Appendix, pg. 89-90]{Lan} that there is $B>0$ such that \begin{align}\label{inv} \dfrac{1}{\mathcal{L}(s)-\alpha}=\dfrac{1}{1-\alpha}\sum\limits_{k=0}^\infty(-1)^k\left(\sum\limits_{n=2}^\infty\dfrac{f(n)}{1-\alpha}\dfrac{1}{n^s}\right)^k=\sum\limits_{n=1}^\infty\left(\sum\limits_{k=0}^{\infty}\dfrac{(-1)^kf_0^{*k}(n)}{(1-\alpha)^{k+1}}\right)\dfrac{1}{n^s} \end{align} for any $\sigma>B$, while from \cite[Satz 12]{Lan} we know that the Dirichlet series on the right hand side of the latter relation converges for every $\sigma>\sigma(\mathcal{L},\alpha)-1$. Hence, the aforementioned series is a Dirichlet series representation of $1/(\mathcal{L}(s)-\alpha)$ in the half-plane $\sigma>\sigma(\mathcal{L},\alpha)-1$. This implies that it is absolutely convergent in the half-plane $\sigma>\sigma(\mathcal{L},\alpha)$ and that \begin{align}\label{g} g(n):=\sum\limits_{k=0}^{\infty}\dfrac{(-1)^kf_0^{*k}(n)}{(1-\alpha)^{k+1}}\ll_\epsilon n^{\sigma\left(\mathcal{L},\alpha\right)-1+\epsilon}. \end{align} On the other hand, the series \begin{align}\label{der} \mathcal{L}'(s)=-\sum\limits_{n=1}^{\infty}\dfrac{f(n)\log n}{n^s} \end{align} is absolutely convergent for any $\sigma>1$. The first assertion of the lemma follows now by mutliplying the Dirichlet series \eqref{inv} and \eqref{der}. In addition, relation \eqref{g} and the Ramanujan hypothesis yield that the coefficients of the resulting series satisfy \begin{align*} \Lambda\left(n;\mathcal{L},\alpha\right)=-\sum\limits_{d\mid n}g\left(\dfrac{n}{d}\right)f(d)\log d \ll_\epsilon \sum\limits_{d\mid n}\left(\dfrac{n}{d}\right)^{\sigma\left(\mathcal{L},\alpha\right)-1+\epsilon/2}d^{\epsilon/2}\ll_\epsilon n^{\sigma\left(\mathcal{L},\alpha\right)-1+\epsilon}. \end{align*} \end{proof} \begin{lemma}\label{hori} Let $\mathcal{L}\in\mathcal{S}$ and $\alpha$ be a complex number. Then \begin{align*} \dfrac{\mathcal{L}'(s)}{\mathcal{L}(s)-\alpha}=\sum\limits_{|\gamma_{\alpha}-t|\leq1}\dfrac{1}{s-\rho_\alpha}+O(\log|t|),\,\,\,|t|\geq1, \end{align*} uniformly in $-1\leq\sigma\leq\sigma(\mathcal{L},\alpha)$. \end{lemma} \begin{proof} The proof follows in exactly the same way, except of some minor changes, as the one of \cite[Lemma 8]{GS} in the case of $\zeta(s)$. \end{proof} \begin{lemma}\label{lb} Let $\mathcal{L}\in\mathcal{S}$ and $\sigma_1\leq\sigma_2<0$. Then \begin{align*} |\mathcal{L}(\sigma+it)|\gg_{\sigma_1,\sigma_2} |t|^{(1/2-\sigma)d_\mathcal{L}},\,\,\,|t|\geq t_0>0, \end{align*} uniformly in $\sigma_1\leq\sigma\leq\sigma_2$. \end{lemma} \begin{proof} We refer to \cite[Chapter III, \S 2]{bes} for an introduction to the theory of analytic almost periodic functions and their elementary properties. Since the Dirichlet series $\mathcal{L}(s)$ is uniformly convergent in the strip $1<1-\sigma_2\leq\sigma\leq1-\sigma_1$, it is a uniformly almost periodic function in that strip. In addition, $\mathcal{L}(s)$ is non-vanishing in $\sigma>1$ by assumption. Hence, $\inf\left\{\left|\mathcal{L}(s)\right|:1-\sigma_2\leq\sigma\leq1-\sigma_1\right\}>0$ by \cite[\S 2, Corollary 1]{bes}. Taking also into account relation \eqref{order} the lemma follows. \end{proof} The following lemma originates from the work of Levinson \cite[Lemma 3.3, Lemma 3.4]{Lev} and it has been improved by Gonek in \cite[Lemma 1, Lemma 2]{gon}. Although the proof there is given for a fixed real number $a$, one can easily see that it holds uniformly in any finite interval $[a_1,a_2]$. \begin{lemma}\label{Gonek} Let $a_1, a_2$ be fixed real numbers such that $a_1\leq a_2$. Then, for all sufficiently large numbers $A,B\gg_{a_1,a_2}1$ with $A<B\leq2A$, we have that \begin{align}\label{GoN} \mathcal{I}(r,a,A,B):=\int\limits_{A}^B\exp\left(it\log\dfrac{t}{re}\right)\left(\dfrac{t}{2\pi}\right)^{a-1/2}\mathrm{d}t=M(r,A,B)+E(r,A,B), \end{align} uniformly in $a_1\leq a\leq a_2$, where \begin{align*} M(r,a,A,B)= \left\{ \begin{array}{ll} (2\pi)^{1-a}r^ae^{-ir+i\pi/4},&A<r\leq B,\\ 0,&\text{otherwise}, \end{array} \right. \end{align*} and \begin{align*} E(r,a,A,B)\ll_{a_1, a_2} A^{a-1/2}+\dfrac{A^{a+1/2}}{|A-r|+A^{1/2}}+\dfrac{B^{a+1/2}}{|B-r|+B^{1/2}}. \end{align*} \end{lemma} \begin{lemma}[Gallagher's lemma]\label{gall} Let $T_0$ and $T\geq\delta>0$ be real numbers and $A$ be a finite subset of $\left[T_0+\delta/2, T+T_0-\delta/2\right]$. Define $N_\delta(x)=\sum_{t\in A,|t-x|<\delta}1$ and assume that $f(x)$ is a complex-valued continuous function on $\left[T_0,T+T_0\right]$ continuously differentiable on $\left(T_0,T+T_0\right)$. Then \begin{align*} \sum\limits_{t\in A}N_{\delta}^{-1}(t)|f(t)|^2\leq\dfrac{1}{\delta}\int\limits_{T_0}^{T+T_0}|f(x)|^2\mathrm{d}x+\left(\int\limits_{T_0}^{T+T_0}|f(x)|^2\mathrm{d}x\int\limits_{T_0}^{T+T_0}|f'(x)|^2\mathrm{d}x\right)^{1/2}. \end{align*} \end{lemma} \begin{proof} For a proof see \cite[Lemma 1.4]{M}. \end{proof} \section{Explicit Formulae} \begin{proof}[Proof of Theorem \ref{MAIN1}] Let $T_0:=\min\left\{1,\gamma_\alpha:\gamma_\alpha>0\right\}/2$. Such number exists as follows from the Riemann-von Mangoldt formula \eqref{RMf}. Recall the definition of $\sigma\left(\mathcal{L},\alpha\right)$ in \eqref{aabscissa} and assume that $T$ is not an ordinate of an $\alpha$-point of $\mathcal{L}(s)$. Since there are only finitely many $\alpha$-points in the plane $\left\{s\in\mathbb{C}:\sigma\leq0,\,t\geq T_0\right\}$, by the calculus of the residues, we have that \begin{align}\label{init} \begin{split} \mathop{\sum\limits_{0<\gamma_\alpha\leq T}}_{\beta_\alpha\geq0}x^{\rho_\alpha} &=\dfrac{1}{2\pi i}\left\{\,\int\limits_{\sigma\left(\mathcal{L},\alpha\right)+\epsilon+iT_0}^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon+iT}+\int\limits_{\sigma\left(\mathcal{L},\alpha\right)+\epsilon+iT}^{-2+iT}+\int\limits_{-2+iT}^{-2+iT_0}+\int\limits_{-2+iT_0}^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon+iT_0}\right\}\hspace{-1pt}x^s\dfrac{\mathcal{L}'(s)}{\mathcal{L}(s)-\alpha}\mathrm{d}s\hspace*{-1pt}+\hspace{-1pt}O(1)\\ &=:\mathcal{I}_1+\mathcal{I}_2+\mathcal{I}_3+\mathcal{I}_4+O(1). \end{split} \end{align} We start by estimating $\mathcal{I}_1$. From Lemma 1 we know that the Dirichlet series expression of $\mathcal{L}'(s)/\left(\mathcal{L}(s)-\alpha\right)$ is absolutely convergent in the half-plane $\sigma\geq \sigma\left(\mathcal{L},\alpha\right)+\epsilon$ and $\Lambda\left(n;\mathcal{L},\alpha\right)\ll_\epsilon n^{\sigma(\mathcal{L},\alpha)-1+\epsilon/2}$. Therefore, interchanging integration and summation yields \begin{align}\label{I1} \begin{split} \mathcal{I}_1=-\dfrac{1}{2\pi}\sum\limits_{n=1}^{\infty}\Lambda(n;\mathcal{L},\alpha)\left(\dfrac{x}{n}\right)^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon}\int\limits_{T_0}^T\left(\dfrac{x}{n}\right)^{it}\mathrm{d}t=-\dfrac{T-T_0}{2\pi}\Lambda(x;\mathcal{L},\alpha)+E, \end{split} \end{align} where \begin{align*} E\hspace*{-1.1pt}\ll\hspace*{-1pt}\mathop{\sum\limits_{n=1}^{\infty}}_{n\neq x}\hspace*{-1pt}|\Lambda(n;\mathcal{L},\alpha)|\hspace*{-1pt}\left(\dfrac{x}{n}\right)^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon}\min\hspace*{-1pt}\left\{\hspace*{-1pt}T,\left|\log\frac{x}{n}\right|^{-1}\right\} \hspace*{-1pt}\ll_\epsilon \mathop{\sum\limits_{n=1}^{\infty}}_{n\neq x}\dfrac{x^{\sigma(\mathcal{L},\alpha)+\epsilon}}{n^{1+\epsilon/2}}\min\hspace*{-1pt}\left\{\hspace*{-1pt}T,\dfrac{\max\left\{x,n\right\}}{|x-n|}\hspace*{-1pt}\right\}. \end{align*} Assume that $x$ is not an integer. Let also $\lfloor x\rfloor$ and $\lceil x\rceil$, denote the largest integer which is less than or equal to $x$ and the smallest integer which is greater than or equal to $x$, respectively. Splitting the latter sum into sums where the indices of their summands range over $n\leq x/2$, $n\geq 2x$, $x/2<n<\lfloor x\rfloor$, $\lceil x\rceil<n<2x$, $n=\lfloor x\rfloor$ and $n=\lceil x\rceil$, we have that \begin{align}\label{E} \begin{split} E&\ll_\epsilon x^{\sigma(\mathcal{L},\alpha)+\epsilon}+ x^{\sigma(\mathcal{L},\alpha)+\epsilon/2}\mathop{\sum\limits_{\frac{x}{2}< n<2x}}_{n\neq\lfloor x\rfloor,\lceil x\rceil}\dfrac{1}{|x-n|}+x^{\sigma(\mathcal{L},\alpha)-1+\epsilon/2}\min\left\{T,\dfrac{x}{ x-\lfloor x\rfloor},\dfrac{\lceil x\rceil}{\lceil x\rceil-x}\right\}\\ &\ll_\epsilon x^{\sigma(\mathcal{L},\alpha)+\epsilon}+x^{\sigma(\mathcal{L},\alpha)+\epsilon/2}\log x+x^{\sigma(\mathcal{L},\alpha)-1+\epsilon/2}\min\left\{T,\dfrac{x}{\| x\|}\right\}\\ &\ll_\epsilon x^{\sigma(\mathcal{L},\alpha)+\epsilon}+x^{\sigma(\mathcal{L},\alpha)+\epsilon/2}\min\left\{\frac{T}{x},\dfrac{1}{\|x\|}\right\}. \end{split} \end{align} If on the other hand $x$ is a positive integer, then we do not need to consider the cases $n=\lfloor x\rfloor$ and $n=\lceil x\rceil$ seperately, in which event we just have \begin{align}\label{error1} E\ll_\epsilon x^{\sigma(\mathcal{L},\alpha)+\epsilon}. \end{align} Since $T_0\Lambda(x;\mathcal{L},\alpha)\ll_\epsilon x^{\sigma(\mathcal{L},\alpha)-1+\epsilon/2}$, it follows from relations \eqref{I1}-\eqref{error1} that \begin{align}\label{I1f} \mathcal{I}_1=-\dfrac{T}{2\pi}\Lambda(x;\mathcal{L},\alpha)+O_\epsilon\left(x^{\sigma(\mathcal{L},\alpha)+\epsilon}\left(1+\mathbbm{1}_{\mathbb{R}\setminus\mathbb{Z}}(x)\min\left\{\frac{T}{x},\dfrac{1}{\| x\|}\right\}\right)\right). \end{align} We continue with estimating $\mathcal{I}_2$. It follows from Lemma \ref{hori} that \begin{align}\label{I2} 2\pi i \mathcal{I}_2-\sum\limits_{|\gamma_\alpha-T|\leq 1}\,\int\limits_{\sigma\left(\mathcal{L},\alpha\right)+\epsilon+iT}^{-2+iT}\dfrac{x^{s}}{s-\rho_\alpha}\mathrm{d}s \ll\log T\int\limits_{-2}^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon}x^{\sigma}\mathrm{d}\sigma \ll x^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon}\dfrac{\log T}{\log x}. \end{align} Moreover, by the calculus of the residues, we know that \begin{align*} \int\limits_{\sigma\left(\mathcal{L},\alpha\right)+\epsilon+iT}^{-2+iT}\dfrac{x^{s}}{s-\rho_\alpha}\mathrm{d}s=&\,-2\pi i R(\rho_\alpha)+\\ &+\left\{ \int\limits_{\sigma\left(\mathcal{L},\alpha\right)+\epsilon+iT}^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon+i(T+2)}+ \int\limits_{\sigma\left(\mathcal{L},\alpha\right)+\epsilon+i(T+2)}^{-2+i(T+2)}+\int\limits_{-2+i(T+2)}^{-2+iT}\right\}\dfrac{x^{s}}{s-\rho_\alpha}\mathrm{d}s, \end{align*} where $R(\rho_\alpha)$ is 0 or 1, depending on whether $\rho_\alpha$ lies or not, respectively, in the rectangle with vertices $\sigma\left(\mathcal{L},\alpha\right)+\epsilon+iT$, $\sigma\left(\mathcal{L},\alpha\right)+\epsilon+i(T+2)$, $-2+i(T+2)$ and $-2+iT$. Then \begin{align}\label{smal} \begin{split} \int\limits_{\sigma\left(\mathcal{L},\alpha\right)+\epsilon+iT}^{-2+iT}\dfrac{x^{s}}{s-\rho_\alpha}\mathrm{d}s & \ll 1+\int\limits_{T}^{T+2}\dfrac{x^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon}}{\sqrt{\epsilon^2+(t-\gamma_\alpha)^2}}\mathrm{dt}+\dfrac{x^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon}}{\log x}+\int\limits_{T}^{T+2}\dfrac{\mathrm{dt}}{x^2\sqrt{4+(t-\gamma_\alpha)^2}}\\ &\ll_\epsilon x^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon}. \end{split} \end{align} Since $\sum_{|\gamma_\alpha-T|\leq 1}1\ll\log T$ by relation \eqref{RMf}, it follows from \eqref{I2} and \eqref{smal} that \begin{align}\label{I2f} \mathcal{I}_2\ll_\epsilon x^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon}\log T\left(1+\dfrac{1}{\log x}\right). \end{align} In order to estimate $\mathcal{I}_3$, we firstly observe that Lemma \ref{lb} implies that $$|\mathcal{L}(-2+it)|>2 |\alpha|$$ for any $t\geq T_1$, where $T_1\gg 1$ is a sufficiently large positive number such that it is not an ordinate of an $\alpha$-point of $\mathcal{L}(s)$. Therefore, for $T\geq T_1$ we have that \begin{align}\label{I3} \begin{split} 2\pi x^2\mathcal{I}_3+O(1) &=-\int\limits_{T_1}^Tx^{it}\dfrac{\mathcal{L}'}{\mathcal{L}}(-2+it)\left(1-\frac{\alpha}{\mathcal{L}(-2+it)}\right)^{-1}\mathrm{d}t\\ &=-\int\limits_{T_1}^Tx^{it}\dfrac{\mathcal{L}'}{\mathcal{L}}(-2+it)\left(1+\sum\limits_{k=1}^{\infty}\left(\dfrac{\alpha}{\mathcal{L}(-2+it)}\right)^k\right)\mathrm{d}t\\ &=:-\left(\mathcal{I}_{31}+\mathcal{I}_{32}\right). \end{split} \end{align} In view of the functional equation \eqref{functequa} and relation \eqref{fS}, it follows that \begin{align}\label{forla} \begin{split} \mathcal{I}_{31} &=\int\limits_{T_1}^Tx^{it}\left(-\dfrac{\overline{\mathcal{L}}'}{\overline{\mathcal{L}}}(3+it)+\dfrac{H_\mathcal{L}'}{H_\mathcal{L}}(-2+it)\right)\mathrm{d}t\\ &=\sum\limits_{n=1}^{\infty}\dfrac{\overline{\Lambda\left(n;\mathcal{L},0\right)}}{n^{3}}\int\limits_{T_1}^T(xn)^{it}\mathrm{d}t-\int\limits_{T_1}^Tx^{it}\log\left(\lambda Q^2\left(\dfrac{t}{e}\right)^{d_\mathcal{L}}\right)\mathrm{d}t+\int\limits_{T_1}^Tx^{it}O\left(\dfrac{1}{t}\right)\mathrm{d}t\\ &=:\mathcal{I}_{3111}+\mathcal{I}_{312}+\mathcal{I}_{313}. \end{split} \end{align} Observe that \begin{align} \mathcal{I}_{3111}\ll\min\left\{T,\dfrac{1}{\log x}\right\}\,\,\,\text{ and }\,\,\,\mathcal{I}_{313} \ll\log T. \end{align} To estimate $\mathcal{I}_{312}$ we integrate by parts. Then \begin{align}\label{forla1} \mathcal{I}_{312}=\left[-\dfrac{x^{it}}{\log x}\log\left(\lambda Q^2\left(\dfrac{t}{e}\right)^{d_\mathcal{L}}\right)\right]_{T_1}^T+\int\limits_{T_1}^T\dfrac{x^{it}ed_\mathcal{L}}{t\log x}\mathrm{d}t\ll\dfrac{\log T}{\log x}. \end{align} Lastly, Lemma \ref{lb} implies that \begin{align}\label{I32} \mathcal{I}_{32}\ll \int\limits_{T_1}^{T}\sum\limits_{k=1}^{\infty}\left(\frac{\alpha}{t^{3d_\mathcal{L}/2}}\right)^k\mathrm{d}t\ll\int\limits_{T_1}^{T}\dfrac{1}{t^{5/2}}\mathrm{d}t\ll1. \end{align} In view of relations \eqref{I3}-\eqref{I32}, we obtain that \begin{align}\label{I3f} \mathcal{I}_3\ll\dfrac{1}{x^2}\left(\min\left\{T,\dfrac{1}{\log x}\right\}+\log T\left(1+\dfrac{1}{\log x}\right)\right), \end{align} as long as $T\geq T_1$. For the remaining $T$, that is for $T_0\leq T<T_1$, we can bound $\mathcal{I}_3$ from above trivially by $x^{-2}$ which is absorbed by the error term appearing in \eqref{I1f} since $x>1$. It remains to estimate $\mathcal{I}_4$ which is independent of $T$ and, therefore, can be bounded trivially from above by $x^{\sigma\left(\mathcal{L},\alpha\right)+\epsilon}$. The theorem now follows from \eqref{init}, \eqref{I1f}, \eqref{I2f} and \eqref{I3f}. Recall that we assumed in the beginning that $T$ is not an ordinate of an $\alpha$-point. Otherwise, we choose a $T_2\in[T,T+1]$ such that it is not an ordinate of an $\alpha$-point and observe that $$\mathop{\sum\limits_{0<\gamma_\alpha\leq T}}_{\beta_\alpha\geq0}x^{\rho_\alpha}=\mathop{\sum\limits_{0<\gamma_\alpha\leq T_2}}_{\beta_\alpha\geq0}x^{\rho_\alpha}+O\left(x^{\sigma\left(\mathcal{L},\alpha\right)}\sum\limits_{T\leq\gamma_\alpha\leq T+1}1\right) =\mathop{\sum\limits_{0<\gamma_\alpha\leq T_2}}_{\beta_\alpha\geq0}x^{\rho_\alpha}+O\left(x^{\sigma\left(\mathcal{L},\alpha\right)}\log T\right).$$ Then we estimate the latter sum as described above, while the error term is absorbed by the error term appearing in \eqref{I2f}. \end{proof} \begin{proof}[Proof of Theorem \ref{MAIN2}] Let $T_0$ be as in the proof of Theorem \ref{MAIN1} and $\epsilon\in(0,1/2)$. If $T$ is not an ordinate of an $\alpha$-point, then by the calculus of the residues it follows that \begin{align}\label{init1} \begin{split} \mathop{\sum\limits_{0<\gamma_\alpha\leq T}}_{\beta_\alpha\geq0}x^{-\rho_\alpha} =&\dfrac{1}{2\pi i}\left\{\,\int\limits_{\sigma\left(\mathcal{L},\alpha\right)+1+iT_0}^{\sigma\left(\mathcal{L},\alpha\right)+1+iT}+\int\limits_{\sigma\left(\mathcal{L},\alpha\right)+1+iT}^{-\epsilon+iT}+\int\limits_{-\epsilon+iT}^{-\epsilon+iT_0}+\int\limits_{-\epsilon+iT_0}^{\sigma\left(\mathcal{L},\alpha\right)+1+iT_0}\right\}\hspace{-1pt}x^{-s}\dfrac{\mathcal{L}'(s)}{\mathcal{L}(s)-\alpha}\mathrm{d}s+\\ &+O(x^\epsilon)\\ =:&\,\mathcal{I}_1+\mathcal{I}_2+\mathcal{I}_3+\mathcal{I}_4+O(x^\epsilon). \end{split} \end{align} The error term occurs from the possible existence of finitely many $\alpha$-points in the vertical strip $-\epsilon\leq\sigma<0$. The absolute convergence of $\mathcal{L}'(s)/(\mathcal{L}(s)-\alpha)$ in the half-plane $\sigma\geq\sigma(\mathcal{L},\alpha)+1$ and our assumption that $x>1$ imply that \begin{align}\label{I1i} 2\pi x^{\sigma\left(\mathcal{L},\alpha\right)+1}\mathcal{I}_1=\sum\limits_{n=1}^{\infty}\dfrac{\Lambda\left(n;\mathcal{L},\alpha\right)}{n^{\sigma\left(\mathcal{L},\alpha\right)+1}}\int\limits_{T_0}^T(xn)^{-it}\mathrm{d}t\ll\sum\limits_{n=1}^{\infty}\dfrac{|\Lambda\left(n;\mathcal{L},\alpha\right)|}{n^{\sigma\left(\mathcal{L},\alpha\right)+1}\log(xn)}\ll\dfrac{1}{\log x}. \end{align} Once more, $\mathcal{I}_4$ is easily seen to be bounded by $x^\epsilon$ which is abosrbed in the error term appearing in \eqref{init1}. To estimate $\mathcal{I}_2$ we work as in \eqref{I2} and \eqref{smal}, where instead of $x^s$ we have $x^{-s}$. Then \begin{align}\label{I2i} \begin{split} \mathcal{I}_2 &\ll\sum\limits_{|\gamma_\alpha-T|\leq 1}\left(1+\int\limits_{T}^{T+2}\dfrac{x^{-\left(\sigma\left(\mathcal{L},\alpha\right)+1\right)}}{\sqrt{1+(t-\gamma_\alpha)^2}}\mathrm{dt}+\dfrac{x^\epsilon}{\log x}+\int\limits_{T}^{T+2}\dfrac{x^\epsilon}{\sqrt{\epsilon^2+(t-\gamma_\alpha)^2}}\mathrm{d}t\right)+x^\epsilon\dfrac{\log T}{\log x}\\ &\ll\sum\limits_{|\gamma_\alpha-T|\leq 1}\left(1+\dfrac{x^\epsilon}{\log x}+x^\epsilon\int\limits_{T}^{T+2}\min\left\{\frac{1}{\epsilon},\dfrac{1}{|t-\gamma_\alpha|}\right\}\mathrm{d}t\right)+x^\epsilon\dfrac{\log T}{\log x}\\ &\ll x^\epsilon\log T\left(\dfrac{1}{\log x}+\log\dfrac{1}{\epsilon}\right). \end{split} \end{align} It remains to estimate $\mathcal{I}_3$. Lemma \ref{lb} implies that \begin{align*} |\mathcal{L}(-\epsilon+it)|>2|\alpha| \end{align*} for any $t\geq T_1$, where $T_1\gg_\epsilon1$ is a sufficienlty large positive number such that it is not an ordinate of an $\alpha$-point. Therefore, for $T\geq T_1$ we have that \begin{align}\label{I3i} \begin{split} \dfrac{2\pi}{x^\epsilon}\mathcal{I}_3+O(1) &=-\int\limits_{T_1}^Tx^{-it}\dfrac{\mathcal{L}'}{\mathcal{L}}(-\epsilon+it)\left(1-\frac{\alpha}{\mathcal{L}(-\epsilon+it)}\right)^{-1}\mathrm{d}t\\ &=-\int\limits_{T_1}^Tx^{-it}\dfrac{\mathcal{L}'}{\mathcal{L}}(-\epsilon+it)\left(1+\sum\limits_{k=1}^{\infty}\left(\dfrac{\alpha}{\mathcal{L}(-\epsilon+it)}\right)^k\right)\mathrm{d}t\\ &=:-\left(\mathcal{I}_{31}+\mathcal{I}_{32}\right). \end{split} \end{align} Working as in \eqref{forla}-\eqref{forla1}, it follows that \begin{align*} \mathcal{I}_{31}=\sum\limits_{n=1}^{\infty}\dfrac{\overline{\Lambda\left(n;\mathcal{L},0\right)}}{n^{1+\epsilon}}\int\limits_{T_1}^T\left(\dfrac{n}{x}\right)^{it}\mathrm{d}t+O\left(\log T\left(1+\dfrac{1}{\log x}\right)\right). \end{align*} By estimating the latter sum as in \eqref{I1}-\eqref{error1}, we obtain that \begin{align}\label{I31i} \mathcal{I}_{31}=\dfrac{T}{x^{1+\epsilon}}\overline{\Lambda\left(x;\mathcal{L},0\right)}+O_\epsilon\left(1+\dfrac{\mathbbm{1}_{\mathbb{R}\setminus\mathbb{Z}}(x)}{x^{\epsilon/2}}\min\left\{\dfrac{T}{x},\dfrac{1}{\| x\|}\right\}\right)+O\left(\log T\left(1+\dfrac{1}{\log x}\right)\right) \end{align} To estimate $\mathcal{I}_{32}$ we simply note that $d_{\mathcal{L}}\geq2$. Thus, in view of Lemma \ref{lb}, we have that \begin{align}\label{I32i} \mathcal{I}_{32} \ll_\epsilon\int\limits_{T_1}^T\sum\limits_{k=1}^{\infty}\left(\dfrac{\alpha}{t^{(1/2+\epsilon)d_\mathcal{L}}}\right)^k\mathrm{d}t \ll_\epsilon\int\limits_{T_1}^T\dfrac{1}{t^{1+2\epsilon}}\ll_\epsilon 1. \end{align} Combining relations \eqref{I3i}-\eqref{I32i} yields that \begin{align}\label{I3if} \mathcal{I}_3 =-\dfrac{T\overline{\Lambda\left(x;\mathcal{L},0\right)}}{2\pi x}+O_\epsilon\hspace*{-2pt}\left(x^\epsilon\left(1+\mathbbm{1}_{\mathbb{R}\setminus\mathbb{Z}}(x)\min\hspace*{-0.7pt}\left\{\dfrac{T}{x},\dfrac{1}{\| x\|}\right\}\right)\hspace*{-1pt}\right)+O\hspace*{-2pt}\left(x^{\epsilon}\log T\left(1+\dfrac{1}{\log x}\right)\hspace*{-1pt}\right), \end{align} as long as $T\geq T_1$. For the remaining $T$, that is for $T_0\leq T<T_1$, we have that \begin{align}\label{remain} \mathcal{I}_3=\pm\dfrac{T\overline{\Lambda\left(x;\mathcal{L},0\right)}}{2\pi x}+\int\limits_{-\epsilon+iT}^{-\epsilon+iT_0}x^{-s}\dfrac{\mathcal{L}'(s)}{\mathcal{L}(s)-\alpha}\mathrm{d}s=-\dfrac{T\overline{\Lambda\left(x;\mathcal{L},0\right)}}{2\pi x}+O_\epsilon\left(x^\epsilon\right). \end{align} The theorem now follows from relations \eqref{init1}-\eqref{I2i}, \eqref{I3if} and \eqref{remain} and by arguing similarly as in the end of the proof of the Theorem \ref{MAIN1} for the case of $T$ being an ordinate of an $\alpha$-point. \end{proof} \begin{proof}[Proof of Theorem \ref{MAIN3}] We set $\epsilon=1/\log 3x$ and we work exactly as in the proof of Theorem \ref{MAIN2} to estimate $\mathcal{I}_1$, $\mathcal{I}_2$ and $\mathcal{I}_4$. In particular, we have that $1\leq x^{\epsilon}\leq e$ and \begin{align}\label{firste} \mathcal{I}_1\ll\dfrac{1}{x^{\sigma\left(\mathcal{L},\alpha\right)+1}\log x},\,\,\,\mathcal{I}_2\ll\log T\left(\dfrac{1}{\log x}+\log\log (3x)\right)\,\,\,\text{ and }\,\,\,\mathcal{I}_4\ll1. \end{align} The estimation of $\mathcal{I}_3$ is more laborious. Since $d_\mathcal{L}=1$, $\mathcal{L}(s)$ is either the Riemann zeta-function $\zeta(s)$ or a shift $L\left(s+i\theta;\chi\right)$ of a Dirichlet $L$-function for some $\theta\in\mathbb{R}$ and some primitive Dirichlet character $\chi$. Then, it follows from \cite[Theorem 3.22, Theorem 8.20, Theorem 8.22]{Ten} that \begin{align} |\mathcal{L}(\sigma+it)|\gg\left(\log |t|\right)^{-m},\,\,\,|t|\geq t_0>1, \end{align} uniformly in $1\leq\sigma\leq2$, where $m=1$ if $\mathcal{L}(s)=\zeta(s)$ and $m=7$, otherwise. In view of relation \eqref{order} we deduce that \begin{align}\label{gorder} |\mathcal{L}(\sigma+it)|\gg\dfrac{|t|^{1/2-\sigma}}{\left(\log |t|\right)^{m}},\,\,\,|t|\geq t_0>1, \end{align} uniformly in $-1\leq\sigma\leq0$. Hence, there is a sufficiently large positive number $T_1$, only this time independent of $\epsilon$, such that it is not an ordinate of an $\alpha$-point and $$|\mathcal{L}(\sigma+it)|>2|\alpha|$$ for any $t\geq T_1$ and $-1\leq\sigma\leq0$. Therefore, for $T\geq T_1$ we have that \begin{align}\label{I3ii} \begin{split} \frac{2\pi}{ x^{\epsilon}}\mathcal{I}_3+O(1) &=-\int\limits_{T_1}^Tx^{-it}\dfrac{\mathcal{L}'}{\mathcal{L}}(-\epsilon+it)\left(1-\frac{\alpha}{\mathcal{L}(-\epsilon+it)}\right)^{-1}\mathrm{d}t\\ &=-\int\limits_{T_1}^Tx^{-it}\dfrac{\mathcal{L}'}{\mathcal{L}}(-\epsilon+it)\left(1+\dfrac{\alpha}{\mathcal{L}(-\epsilon+it)}+\sum\limits_{k=2}^{\infty}\left(\dfrac{\alpha}{\mathcal{L}(-\epsilon+it)}\right)^k\right)\mathrm{d}t\\ &=:-\left(\mathcal{I}_{31}+\mathcal{I}_{32}+\mathcal{I}_{33}\right). \end{split} \end{align} Once more, we have that \begin{align}\label{I31ii} \mathcal{I}_{31}=\sum\limits_{n=1}^{\infty}\dfrac{\overline{\Lambda\left(n;\mathcal{L},0\right)}}{n^{1+\epsilon}}\int\limits_{T_1}^T\left(\dfrac{n}{x}\right)^{it}\mathrm{d}t+O\left(\log T\left(1+\dfrac{1}{\log x}\right)\right). \end{align} In this case, however, we know that $|\Lambda\left(n;\mathcal{L},0\right)|=\Lambda(n)$. Thus, \begin{align}\label{I31part} \begin{split} \sum\limits_{n=1}^{\infty}\dfrac{\overline{\Lambda\left(n;\mathcal{L},0\right)}}{n^{1+\epsilon}}\int\limits_{T_1}^T\left(\dfrac{n}{x}\right)^{it}\mathrm{d}t\ &=\frac{T-T_1}{x^{1+\epsilon}}\overline{\Lambda\left(x;\mathcal{L},0\right)}+\mathop{\sum\limits_{n=1}^{\infty}}_{n\neq x}\dfrac{\Lambda(n)}{n^{1+\epsilon}}\min\left\{T,\left|\log\dfrac{x}{n}\right|^{-1}\right\}\\ &=\hspace*{-0.55pt}\dfrac{T\overline{\Lambda\left(x;\mathcal{L},0\right)}}{x^{1+\epsilon}} \hspace*{-0.55pt}+\hspace*{-0.55pt}O\left(\log(2 x)\log\log (3x)+\log x\min\hspace*{-0.5pt}\left\{\dfrac{T}{x},\dfrac{1}{\langle x\rangle}\right\}\right), \end{split} \end{align} as follows by \cite[Lemma 2]{Gon}. It is simple to estimate $\mathcal{I}_{33}$ since by relation \eqref{gorder} it follows that \begin{align}\label{I33i} \mathcal{I}_{33}\ll\int\limits_{T_1}^{T}\sum \limits_{k=2}^{\infty}\left(\dfrac{\alpha(\log t)^m}{t^{1/2+\epsilon}}\right)^k\mathrm{d}t\ll(\log T)^{2m}\int\limits_{T_1}^T\dfrac{1}{t^{1+2\epsilon}}\mathrm{d}t\ll(\log T)^{2m}\log(3x). \end{align} To estimate $\mathcal{I}_{32}$ we start with integration by parts, that is, \begin{align}\label{I32e} \dfrac{x^{\epsilon}}{\alpha i}\mathcal{I}_{32}=-\int\limits_{-\epsilon+iT_1}^{-\epsilon+iT}x^{-s}\dfrac{\mathcal{L}'}{\mathcal{L}^2}(s)\mathrm{d}s =\left[\dfrac{x^{-s}}{\mathcal{L}(s)}\right]_{-\epsilon+iT_1}^{-\epsilon+iT}+\log x\int\limits_{-\epsilon+iT_1}^{-\epsilon+iT}\dfrac{x^{-s}}{\mathcal{L}(s)}\mathrm{d}s. \end{align} The first term on the right-hand side is bounded above by $T_1^{-1/2}(\log T_1)^m\ll1$ by relation \eqref{gorder}. For the second term we split the path of integration in a dyadic manner: \begin{align}\label{split} \int\limits_{-\epsilon+iT_1}^{-\epsilon+iT}\dfrac{x^{-s}}{\mathcal{L}(s)}\mathrm{d}s=O(1)+\sum\limits_{k=1}^{\left\lfloor\log (T/T_0)/\log 2\right\rfloor}\int\limits_{-\epsilon+iT/2^{k}}^{-\epsilon+iT/2^{k-1}}\dfrac{x^{-s}}{\mathcal{L}(s)}\mathrm{d}s=:O(1)+\sum\limits_{k=1}^{\left\lfloor\log (T/T_1)/\log 2\right\rfloor}I_k. \end{align} Observe that $2^k\leq T$ for all $k=1,\dots,\left\lfloor\log (T/T_1)/\log 2\right\rfloor$. To estimate $I_{k}$ we use the functional equation \eqref{functequa} of $\mathcal{L}(s)$: \begin{align*} I_{k} =\int\limits_{-\epsilon+iT/2^k}^{-\epsilon+iT/2^{k-1}}\dfrac{x^{-s}}{H_\mathcal{L}(s)\overline{\mathcal{L}(1-\overline{s})}}\mathrm{d}s =ix^{\epsilon} \int\limits_{T/2^k}^{T/2^{k-1}}\dfrac{x^{-it}}{H_{\mathcal{L}}(-\epsilon+it)\overline{\mathcal{L}(1+\epsilon+it)}}\mathrm{d}t. \end{align*} Since $\mathcal{L}(s)$ is absolutely convergent in the half-plane $\sigma>1$ and $f(n)$ is a completely multiplicative arithmetical function, we have that \begin{align*} \dfrac{1}{\mathcal{L}(s)}=\sum\limits_{n=1}^{\infty}\dfrac{\mu(n)f(n)}{n^s},\,\,\,\sigma>1, \end{align*} where $\mu(n)$ is the M\"obius function and the series converges absolutely in the half-plane $\sigma>1$ (see for example \cite[Section 11.4, Example 3]{apo}. In addition to relation \eqref{Stril}, it follows that \begin{align*} I_{k} =&\,\dfrac{ix^{\epsilon}e^{i\pi(1-\mu)/4}}{\left(2\pi\lambda Q^2\right)^{1/2+\epsilon}}\sum\limits_{n=1}^{\infty}\dfrac{\mu(n)\overline{f(n)}}{n^{1+\epsilon}}\times\\ &\times\int\limits_{T/2^k}^{T/2^{k-1}}\exp\left(id_\mathcal{L}t\log\left(\left(\dfrac{n\lambda Q^2}{x}\right)^{1/d_\mathcal{L}}\dfrac{t}{e}\right)\right)\left(\dfrac{t}{2\pi}\right)^{-\epsilon-1/2}\dfrac{1}{\omega+O\left(\frac{1}{t}\right)}\mathrm{d}t. \end{align*} Observe that the implicit constant in the latter relation is independent of $\epsilon$ since $0<\epsilon<1/\log3$ and we applied relation \eqref{Stril} in the strip $-1/\log 3\leq\sigma\leq0$. If we take now $T_1\gg1$ to be a sufficiently large positive number then $$\left(\omega+O\left(\dfrac{1}{t}\right)\right)^{-1}=\dfrac{1}{\omega}+O\left(\dfrac{1}{t}\right)$$ for any $t\geq T_1$. Then integrating by substitution will yield \begin{align}\label{Ik2} I_{k} \ll &\sum\limits_{n=1}^{\infty}\dfrac{1}{n^{1+\epsilon}}\left|\,\int\limits_{d_\mathcal{L}T/2^k}^{d_\mathcal{L}T/2^{k-1}}\exp\left(it\log\left(\left(\dfrac{n\lambda Q^2}{x}\right)^{1/d_\mathcal{L}}\dfrac{t}{d_\mathcal{L}e}\right)\right)\left(\dfrac{t}{2\pi}\right)^{-\epsilon-1/2}\mathrm{d}t\right|+\\ &+\sum\limits_{n=1}^{\infty}\dfrac{1}{n^{1+\epsilon}}\int\limits_{T/2^k}^{T/2^{k-1}}\dfrac{1}{t^{\epsilon+3/2}}\mathrm{d}t, \end{align} since $\left|\mu(n){f(n)}\right|=1$ for all $n\in\mathbb{N}$. From the last term of the relation above we get \begin{align}\label{Ik2p} \sum\limits_{n=1}^{\infty}\dfrac{1}{n^{1+\epsilon}}\int\limits_{T/2^k}^{T/2^{k-1}}\dfrac{1}{t^{\epsilon+3/2}}\mathrm{d}t \ll \left(\dfrac{2^k}{T}\right)^{1/2}\log\log(3x). \end{align} For the first term of \eqref{Ik2}, which we denote by $J_k$, we employ Lemma \ref{Gonek}. To this end, we consider first $T_1\gg1$ sufficiently large, with the implicit constant being independent of $\epsilon$ as it ranges over the interval $(0,1/\log3)$. Then, following our notation from Lemma \ref{Gonek}, we obtain that \begin{align*} J_k=&\mathop{\sum\limits_{n=1}^{\infty}}_{\frac{d_\mathcal{L}T}{2^{k}}<d_\mathcal{L}\left(\frac{x}{\lambda Q^2n}\right)^{1/d_\mathcal{L}}\leq \frac{d_\mathcal{L}T}{2^{k-1}}}\dfrac{1}{n^{1+\epsilon}}M\left(d_\mathcal{L}\left(\dfrac{x}{\lambda Q^2n}\right)^{1/d_\mathcal{L}},-\epsilon,\dfrac{d_\mathcal{L}T}{2^{k}},\dfrac{d_\mathcal{L}T}{2^{k-1}}\right)+\\ &+\sum\limits_{n=1}^{\infty}\dfrac{1}{n^{1+\epsilon}}E\left(d_\mathcal{L}\left(\dfrac{x}{\lambda Q^2n}\right)^{1/d_\mathcal{L}},-\epsilon,\dfrac{d_\mathcal{L}T}{2^{k}},\dfrac{d_\mathcal{L}T}{2^{k-1}}\right)\\ &=:M_k+E_k. \end{align*} We estimate firstly $M_k$: \begin{align*} M_k\ll\mathop{\sum\limits_{n=1}^{\infty}}_{\frac{d_\mathcal{L}T}{2^{k}}<d_\mathcal{L}\left(\frac{x}{\lambda Q^2n}\right)^{1/d_\mathcal{L}}\leq \frac{d_\mathcal{L}T}{2^{k-1}}}\dfrac{1}{n^{1+\epsilon}}\left(\dfrac{x}{\lambda Q^2n}\right)^{-\epsilon/d_\mathcal{L}} \ll\sum\limits_{\left(\frac{2^{k-1}}{T}\right)^{d_\mathcal{L}}\frac{x}{\lambda Q^2}\leq n<\left(\frac{2^{k}}{T}\right)^{d_\mathcal{L}}\frac{x}{\lambda Q^2}}\dfrac{1}{n} \ll 1. \end{align*} We estimate now $E_k$: \begin{align*} E_k&\ll\sum\limits_{n=1}^{\infty}\dfrac{1}{n^{1+\epsilon}}\left[\left(\dfrac{d_\mathcal{L}T}{2^k}\right)^{-\epsilon-1/2}+\dfrac{\left(\frac{d_\mathcal{L}T}{2^k}\right)^{-\epsilon+1/2}}{\left|\frac{d_\mathcal{L}T}{2^k}-d_\mathcal{L}\left(\frac{x}{\lambda Q^2n}\right)^{1/d_\mathcal{L}}\right|+\left(\frac{d_\mathcal{L}T}{2^k}\right)^{1/2}}+\right.\\&\hspace*{7cm}\left.+\dfrac{\left(\frac{d_\mathcal{L}T}{2^{k-1}}\right)^{-\epsilon+1/2}}{\left|\frac{d_\mathcal{L}T}{2^{k-1}}-d_\mathcal{L}\left(\frac{x}{\lambda Q^2n}\right)^{1/d_\mathcal{L}}\right|+\left(\frac{d_\mathcal{L}T}{2^{k-1}}\right)^{1/2}}\right]\\ &\ll\left(\dfrac{2^k}{T}\right)^\epsilon\sum\limits_{n=1}^{\infty}\dfrac{1}{n^{1+\epsilon}}\left[\left(\dfrac{2^k}{T}\right)^{1/2}+1+2^{-\epsilon}\right]\\ &\ll\left(\dfrac{2^k}{T}\right)^{\epsilon}\log\log(3x). \end{align*} Summing up we will have that \begin{align*} \sum\limits_{k=1}^{\left\lfloor\log (T/T_1)/\log 2\right\rfloor}J_k &\ll\sum\limits_{k=1}^{\left\lfloor\log (T/T_1)/\log 2\right\rfloor}\left(1+\left(\dfrac{2^k}{T}\right)^{\epsilon}\log\log(3x)\right)\\ &\ll\log T+\dfrac{2^{\epsilon\log (T/T_1)/\log 2}}{(2^\epsilon-1)T^\epsilon}\log\log(3x)\\ &\ll\log T+\log(3x)\log\log(3x). \end{align*} From this and relations \eqref{Ik2} and \eqref{Ik2p} it follows that \begin{align*} \sum\limits_{k=1}^{\left\lfloor\log (T/T_1)/\log 2\right\rfloor}I_{k} \ll\,& \sum\limits_{k=1}^{\left\lfloor\log (T/T_1)/\log 2\right\rfloor}\left(\dfrac{2^{k}}{T}\right)^{1/2}\log\log(3x)+\log T+\log(3x)\log\log(3x)\\ \ll\,&\log T+\log(2x)\log\log(3x). \end{align*} Then relations \eqref{I32e} and \eqref{split} imply that \begin{align*} \mathcal{I}_{32}\ll1+\log x\left(\log T+\log(2x)\log\log(3x)\right) \end{align*} and, thus, from \eqref{I31ii}-\eqref{I33i} we have that \begin{align}\label{laste} \begin{split} \mathcal{I}_3=&\,-\dfrac{T\overline{\Lambda\left(x;\mathcal{L},0\right)}}{2\pi x} +O\left(\log(2 x)\log\log (3x)+\log x\min\left\{\dfrac{T}{x},\dfrac{1}{\langle x\rangle}\right\}\right)+\\ &+O\left((\log T)^{2m}\log(3x)+\dfrac{\log T}{\log x}+\log x\left(\log T+\log(2x)\log\log(3x)\right)\right), \end{split} \end{align} as long as $T\geq T_1$. The theorem now follows by combining \eqref{firste} and \eqref{laste} and by arguing similarly as in the end of the proof of the Theorem \ref{MAIN1} for the case of $T$ being an ordinate of an $\alpha$-point. \end{proof} \section{Littlewood's theorem and Applications to Universality} \begin{proof}[Proof of Theorem \ref{Main1}] Let $n_0>1$ be the first positive integer $n$ such that $f(n)\neq0$. We know that such a number exists, because $\mathcal{L}(s)$ differs from the only constant function in $\mathcal{S}$. This also implies that $d_{\mathcal{L}}\geq1$. In the sequel we make use of the notation $a_n:=f(n)$, for all $n\in\mathbb{N}$. Now we define the function $$g(s):=\left\{ \renewcommand{\arraystretch}{1.5} \begin{array}{lllll} \dfrac{|a_{n_0}|n_0^s}{a_{n_0}}(\mathcal{L}(s)-1),&\text{ if }\alpha=1,\\ \mathcal{L}(s)-\alpha,&\text{ if }\Re \alpha<1,\\ \alpha-\mathcal{L}(s),&\text{ if }\Re \alpha>1,\\ -i\left(\mathcal{L}(s)-\alpha\right),&\text{ if }\Re \alpha=1\text{ and }\Im \alpha>0,\\ i\left(\mathcal{L}(s)-\alpha\right),&\text{ if }\Re \alpha=1\text{ and }\Im \alpha<0, \end{array} \right.$$ for every $s\in\mathbb{C}\setminus\lbrace1\rbrace$ . Then there exists $\sigma_0=\sigma_0(\alpha)>1$ such that \begin{align}\label{gasy} g(s)\asymp\Re(g(s))\asymp1, \end{align} uniformly in the half-plane $\sigma\geq\sigma_0-1$. Indeed, the absolute convergence of $\mathcal{L}(s)$ in the half-plane $\sigma>1$ implies that $$\Re(g(s))\leq|g(s)|\ll1,$$ uniformly in any half-plane $\sigma\geq\sigma_1>1$. On the other hand, for $\sigma>1$, $$\Re(g(s))=\left\{ \renewcommand{\arraystretch}{1.5} \begin{array}{lllll} |a_{n_0}|+\sum\limits_{n>n_0}\left(n_0/n\right)^{\sigma}E(n,t),&\alpha=1,\\ 1-\Re \alpha+\sum\limits_{n\geq n_0}n^{-\sigma}F(n,t),&\Re \alpha<1,\\ \Re \alpha-1-\sum\limits_{n\geq n_0}n^{-\sigma}F(n,t),&\Re \alpha>1,\\ \Im \alpha+\sum\limits_{n\geq n_0}n^{-\sigma}G(n,t),&\Re \alpha=1\text{ and }\Im \alpha>0,\\ -\Im \alpha-\sum\limits_{n\geq n_0}n^{-\sigma}G(n,t),&\Re \alpha=1\text{ and }\Im \alpha<0, \end{array} \right.$$ where \begin{align*} \renewcommand{\arraystretch}{1.5} \begin{array}{lll} E(n,t):=|a_{n_0}|^{-1}\left[\Re \left(\overline{a_{n_0}}a_n\right)\cos\left(t\log{{\dfrac{n_0}{n}}}\right)-\Im \left(\overline{a_{n_0}}a_n\right)\sin\left(t\log\dfrac{n_0}{n}\right)\right],\\ F(n,t):=\Re a_n\cos\left(t\log n\right)+\Im a_n\sin\left(t\log n\right),\\ G(n,t):=\Im a_n\cos\left(t\log n\right)-\Re a_n\sin\left(t\log n\right). \end{array} \end{align*} Since $E(n,t),F(n,t),G(n,t)\ll_\epsilon n^{\epsilon}$ for all $n\in\mathbb{N}$ and $t\in\mathbb{R}$, there is a sufficiently large $\sigma_0>0$ such that $$|g(s)|\geq\Re(g(z))\gg1,$$ uniformly in $\sigma\geq\sigma_0-1$. Moreover, by arguing similarly, we can take $\sigma_0>0$ large enough such that also \begin{align}\label{order1} |\mathcal{L}(s)|\gg1, \end{align} uniformly in $\sigma\geq\sigma_0-1$. Lastly, we define for every $s\in\mathbb{C}\setminus\lbrace1\rbrace$ the function $h(s):=\log g(s),$ where the logarithm takes its principal value for $\sigma\geq\sigma_0-1$, and for other points $s$ we define $h(s)$ to be the value obtained from $h(\sigma_0)$ by continuous variation along the line segments $[\sigma_0,\sigma_0+it]$ and $[\sigma_0+it,\sigma+it]$, provided that the path does not cross a zero or a pole of $g(s)$; if it does, then we take $h(s)=h(s+0)$. From the latter definition and \eqref{gasy} it follows that \begin{align}\label{or} h(s)\ll1, \end{align} uniformly in $\sigma\geq\sigma_0-1$. For the second part of the proof we employ a technique used by Titchmarsh (see \cite[Theorem 9.12]{Titch2}). It suffices to show that for every sufficiently large positive number $T$, if there is no $\alpha$-point of $\mathcal{L}(s)$ such that $|\gamma_\alpha-T|\leq\delta<1/2$, then $\delta\ll\left(\log\log\log T\right)^{-1}$. To this end, let $T$ be a large positive number and assume that $\mathcal{L}(s)$ has no $\alpha$-point such that $|\gamma_\alpha-T|\leq\delta<1/2$. Then, the function $h(s)$, as it was defined above is regular in the rectangle $$\mathcal{R}:=\left\{s\in\mathbb{C}:-(\sigma_0+1)\leq\sigma\leq\sigma_0+1,\,\,\,\,\,|t-T|\leq\delta\right\}.$$ We set \begin{align}\label{N} N:=\left\lfloor\dfrac{8\sigma_0}{\delta}\right\rfloor+1, \end{align} and we consider the circles $$\mathcal{K}_{m,n}:=\left\{s\in\mathbb{C}:\left|s-\left(\sigma_0-\frac{n\delta}{4}+iT\right)\right|=\dfrac{m\delta}{4}\right\};$$ we define the maximum value of $h$ on them by $$\mathbf{M}_{m,n}:=\max\limits_{s\in\mathcal{K}_{m,n}}|h(s)|$$ for every $n=0,\dots,N$ and $m=1,2,3,4$. Observe that all circles $\mathcal{K}_{m,n}$ lie inside the strip $-(\sigma_0+1)\leq\sigma\leq\sigma_0+1$ and, in particular, in $\mathcal{R}$. Now the proof follows by arguing similarly as in \cite[Theorem 9.12]{Titch2}. \end{proof} \begin{proof}[Proof of Corollary \ref{Main2}] Let $(\rho_{\alpha,n})_{n\in\mathbb{N}}$ be the sequence of $\alpha$-points of $\mathcal{L}(s)$. Then, for every $k\geq k':=\lfloor\exp(3)/b\rfloor$, Theorem \ref{Main1} yields the existence of a positive integer $n_k$ such that $$\gamma_{\alpha,n_k}=bk+O\left(\dfrac{1}{\log\log\log (bk)}\right)=bk+o(1).$$ We also set $\gamma_{\alpha,n_k}=\gamma_{\alpha,n_{k'}}$ for every positive integer $k<k'$. Now, if $a\notin b^{-1}\mathbb{Q}$ is a real number and $m$ a positive integer, then we know that the sequence $\left(a b k^m\right)_{k\in\mathbb{N}}$, is uniformly distributed mod 1 (see for example \cite[Chapter 1, Theorem 3.2]{K-N}) and $$\lim\limits_{k\to\infty}\left(a bk^m-a\gamma_{\alpha,n_{k^m}}\right)=0.$$ Hence, it follows from \cite[Chapter 1, Theorem 1.2]{K-N} that the sequence $\left(a\gamma_{\alpha,n_{k^m}}\right)_{k\in\mathbb{N}}$ is uniformly distributed mod 1. \end{proof} \begin{proof}[Proof of Theorem \ref{universality}] Let $\alpha\in\mathbb{C}$ and $m=1$. According to Corollary \ref{Main2}, we can find a subsequence of $\alpha$-points of $\mathcal{L}(s)$ such that \begin{align}\label{In} |\gamma_{\alpha, n_k}-2\pi k|<\dfrac{\pi}{2}, \end{align} for every $k\geq k_1$, where $k_1\gg1$ is a sufficiently large and fixed positive integer. In addition, the sequence $\left(a\gamma_{\alpha, n_k}\right)_{k\in\mathbb{N}}$, is uniformly distributed modulo one or, equivalently from Weyl's criterion \cite[Chapter 1, Theorem 2.1]{K-N}, \begin{align}\label{W1} \lim\limits_{N\to\infty}\dfrac{1}{N}\sum\limits_{k=1}^N\,{\rm{e}}\left(a\gamma_{\alpha, n_k}\right)=0, \end{align} for every $a\notin(2\pi)^{-1}\mathbb{Q}$. Let $\mathbb{P}$ denote the set of prime numbers. Since the numbers $$1\,\,\,\text{ and }\,\,\,\dfrac{\log p}{2\pi},\,\,\,p\in\mathbb{P},$$ are linearly independent over $\mathbb{Q}$, it follows from\cite[Chapter 1, Theorem 6.2]{K-N} and relation \eqref{W1} that the sequence \begin{align}\label{W2} \left(\gamma_{\alpha, n_k}\dfrac{\log p}{2\pi}\right)_{p\in M},\,\,\,k\in\mathbb{N}, \end{align} is uniformly distributed modulo one in $\mathbb{R}^{\sharp M}$, for any finite set $M\subseteq\mathbb{P}$. If we define now the truncated Euler products of $\zeta(s)$, $$\zeta_M\left(s,\left(\theta_p\right)_{p\in M}\right):=\mathlarger\prod\limits_{p\in M}\left(1-\dfrac{\,{\rm{e}}\left(\theta_p\right)}{p^s}\right)^{-1}$$ for every $\left(s,\left(\theta_p\right)_{p\in M}\right)\in\left\{s\in\mathbb{C}:{\sigma>0}\right\}\times\mathbb{R}^{\sharp M}$ and finite $M\subseteq\mathbb{P}$, then \eqref{W2} and \cite[Lemma 4]{P} yield the existence of positive numbers $v$ and $d$ such that \begin{align}\label{App1} \liminf\limits_{N\to\infty}\dfrac{1}{N}\sharp\left\{1\leq k\leq N:\max\limits_{s\in K}|\zeta_{\left\{p:p\leq y\right\}}(s+i\gamma_{\alpha, n_k},\underline{0})-f(s)|<\varepsilon\right\}>d, \end{align} for every $y\geq v$. Let $\delta:=\pi$, $T_0:=\gamma_{\alpha, n_{k_1}}-\pi/2$, $T:=\gamma_{\alpha, n_N}-\gamma_{\alpha, n_{k_1}}+\pi$, $A:=\lbrace \gamma_{\alpha, n_{k_1}},\dots,\gamma_{\alpha, n_N}\rbrace$ and \begin{align*} f(t):=\zeta(s+it)-\zeta_{\lbrace p:p\leq y\rbrace}(s+it,\underline{0}). \end{align*} Then inequality \eqref{In} and Lemma \ref{gall} yield \begin{align}\label{G} \begin{split} \sum\limits_{k=k_1}^N\hspace{-1pt}|\zeta(s+i\gamma_{\alpha, n_k})\hspace{-1pt}-\hspace{-1pt}\zeta_{\lbrace p:p\leq y\rbrace}(s+i\gamma_{\alpha, n_k},\underline{0})|^2\leq&\,2\int\limits_{0}^{2\pi(N+1)}|f(x)|^2\mathrm{d}x+\\ &+\hspace{-1pt}\left(\int\limits_{0}^{2\pi(N+1)}|f(x)|^2\mathrm{d}x\hspace{-1pt}\int\limits_{0}^{2\pi(N+1)}\left|f'(x)\right|^2\mathrm{d}x\right)^{1/2}. \end{split} \end{align} Bohr \cite[Hilfssatz 2]{Bohr} proved that \begin{align}\label{Bo} \lim\limits_{y\to\infty}\limsup\limits_{T\to\infty}\dfrac{1}{T}\int\limits_{0}^{T}|\zeta(s+i\tau)-\zeta_{\left\{p:p\leq y\right\}}(s+i\tau,\underline{0})|^2\mathrm{d}\tau=0, \end{align} uniformly on compact subsets of $\mathcal{D}$. It is clear that an application of Cauchy's integral formula would yield \eqref{Bo} also in the case of $\zeta'-\zeta'_{\left\{p:p\leq y\right\}}$. Therefore, in view of \eqref{G} and \eqref{Bo} it follows that \begin{align}\label{A} \lim\limits_{y\to\infty}\limsup\limits_{N\to\infty}\dfrac{1}{N}\sum\limits_{k=1}^{N}|\zeta(s+i\gamma_{\alpha, n_k})-\zeta_{\lbrace p:p\leq y\rbrace}(s+i\gamma_{\alpha, n_k},\underline{0})|^2=0, \end{align} uniformly on compact subsets of $\mathcal{D}$. If $G\subseteq\mathbb{C}$ is a bounded domain and $g$ an analytic and square integrable function on $G$, then $$|g(z)|\leq\left(\sqrt{\pi}d(z,\partial G)\right)^{-1}\left(\mathlarger\iint_G|g(\sigma+it)|^2\mathrm{d}\sigma\mathrm{d}t\right)^{1/2},$$ for every $z\in G$ (see for example \cite[Chapter 1, Theorem 1]{D-S}). Thus, by considering a bounded domain $G$ such that $K\subseteq G\subseteq\overline{G}\subseteq\mathcal{D}$, relation \eqref{A} and Chebyshev's inequality yield the existence of a positive number $u$ such that \begin{align}\label{App2} \liminf\limits_{N\to\infty}\dfrac{1}{N}\sharp\left\{1\leq k\leq N:\max\limits_{s\in K}\left|\zeta\left(s+i\gamma_{\alpha, n_k}\right)-\zeta_{\lbrace p: p\leq y\rbrace}\left(s+i\gamma_{\alpha, n_k},\underline{0}\right)\right|<\tilde{\varepsilon} \right\}>1-\tilde{\varepsilon}, \end{align} for every $y\geq u$, where $\tilde{\varepsilon}=\min\lbrace\varepsilon,d/2\rbrace$. Now the theorem follows from \eqref{App1} and \eqref{App2} by taking $y=\max\lbrace u,v\rbrace$. \end{proof}
\section{Introduction}\label{sec:intro} The recent COVID-19 pandemic (SARS-CoV-2) has caused radical social changes world-wide, driven by both citizens' prevention efforts and health authorities' policies and recommendations for flattening the curve. As part of such efforts, technological interventions such as mobility-tracking and self-diagnosis apps have been developed to help mitigate the risks (e.g., \citep{mayor2020covid,cho2020contact}). While the context could be different from pandemics, crisis management strategies and technological interventions have been widely studied in a similar manner in the computer-supported cooperated work (CSCW), human-computer interaction (HCI), and a broader field of crisis informatics (e.g., \citep{perry2001dealing}). For example, scholars have studied information and communication technologies (ICTs) for disasters and emergencies, which include, but are not limited to, effective communications tools \citep{frommberger2013mobile4d}, people's re-appropriation of existing ICTs \citep{reuter2017social}, and crowdsourcing technologies for curating crisis-related data \citep{yang2014providing}. To make these kinds of technological interventions effective for pandemics, understanding human mobility needs to be preceded, because the spread of the virus is closely related to human mobility \citep{kraemer2020effect}. Due to this reason, social distancing has been one of the major guidelines for citizens in many countries, among other measures during the COVID-19 outbreak. Human mobility is a strong predictor of the epidemic diffusion in its early stage, but it is also a direct indicator for measuring people's social distancing practices \citep{kraemer2020effect}. By monitoring mobility in local communities, health authorities can benefit by having data-driven evidence to adjust contingency plans and prepare strategies for future pandemics dynamically. From a technological intervention perspective, the context of COVID-19 poses new challenges for CSCW scholars in understanding the new norms and mobility with respect to people's work and life. While outdoor activities are not recommended during the pandemic, it is still necessary for many people to work either from their homes or workplaces, to go for grocery shopping, and to do exercises for their health. Because the forms of these essential activities vary significantly by region, available resources, and even people's demographic characteristics \citep{coven2020disparities}, people's behavioral patterns shaped by social determinants might be different by social, geographical, and cultural groups. This is why understanding human mobility during pandemics is a basis for implementing health policies and augmenting technological interventions to flatten the curve as well as to build the community resilience capacity. Without understanding the dynamics of human mobility that are often contingent on people's socio-economic and socio-cultural characteristics, a technological intervention that is effective for one group could be a source of inequality for another. In light of this implication, there have been many studies that focus on mobility changes during the COVID-19 outbreak. On the one hand, research has examined national-, state-, or county-level mobility changes, which tend to reflect people's mid- to long-term mobility during the pandemic (e.g., international students and employees go back to their home countries for the pandemic period) \citep{klein2020assessing,google_mobilty}. On the other hand, with the support of IT companies and non-profit organizations that have curated mobility data of their customers, many others studied mobility changes at the granular geospatial levels, such as point of interest (POIs) \citep{mckenziea2020country}. These studies and statistics show where hot or dead spots are located during the pandemic and how people change their behaviors in a high geographical resolution, such as at a census block or a location level. They can also capture people's daily mobility patterns under strong social-distancing measures such as travel restriction \citep{klein2020assessing,zhang2020interactive}. However, these studies' implications could be limited when it comes to a context where social and economic activities are weakly restricted. To understand the role of socio-political context during the COVID-19 outbreak, we study the human mobility change between December in 2019 and May in 2020 in a metropolitan city in South Korea, where social distancing was encouraged but not implemented in the form of strong travel restrictions or stay-at-home orders. This mild social distancing was possible partially by virtue of the health authority's aggressive management in the early stage of the outbreak \citep{Beaubien_2020}. From a scientific point of view, the context of mild social distancing in South Korea provides opportunities to understand: (1) how human mobility manifests based on people's prevention behaviors and perceptions, rather than by the government's policies and administrative enforcement, (2) how social determinants of health outcomes such as demographic and socio-economic features shape people's mobility, (3) how mobility changes when the infection rate is decreasing (i.e., during a releasing period), and (4) what the mobility changes during special occasions such as the national election look like during the pandemic. In addition to these scientific contributions, this paper also provides design implications for pandemic-related technological systems. Beyond crisis management, the CSCW community has a long tradition of studying technology-assisted collaborative work for mobile workers \citep{perry2001dealing} and crowdsourcing strategies for solving community problems through spatio-temporal data \citep{liu2014crisis,priedhorsky2008computational}. Understanding human mobility during the pandemic is useful not only for the design of crisis management systems but also by suggesting a typology of potential users who respond differently to the pandemic. It also provides implications for technology-assisted collaborative work strategies such as collaborative problem-solving in distant work settings. The mobility patterns of workers and their new norms in workplaces and homes might raise new challenges for collaborative systems, which might require a re-design of the existing systems. Unpacking these design challenges based on people's mobility patterns will help develop mobile working and crowdsourcing strategies during the pandemic. We expect that exploring this design space will facilitate discussions about the collaborative system design for the new norms after the pandemic by introducing a new set of behavioral characteristics that manifest in diverse socio-political contexts. To this end, we make use of the 5-month pedestrian location data in the city of Incheon where the largest international airport is located.\footnote{The population in the city of Incheon is around 3M. Due to its location next to Seoul, there are about 26M residents in a 2-hour distance from the city, characterizing it as a metropolitan area. It also has the fourth biggest number of COVID-19 confirmed cases in South Korea (see \url{http://ncov.mohw.go.kr/en}).} The data collection period is from December 18th in 2019 through April 30th in 2020, which covers the periods of pre-pandemic, the major COVID-19 outbreak, and relief.\footnote{Although the pandemic has not ended and its risk remains as of May 2020, the paper calls the period after the Mid-March through April as ``relieved'' based on news articles' characterization of the period. See \ref{sec:events}.} This dataset is a by-product of the location-based advertisement recommendation systems and was made available based on a partnership between the authors' institutions and a start-up company in South Korea. We aim to understand human mobility during COVID-19 in the context of mild social distancing through this data analysis. Based on this analysis, we identify a typology of populations from a mobility perspective during the pandemic: \emph{crowd-avoiding outdoor workers, old workers, working voters, flexible office workers, and leisure-time seekers}. This typology provides design implications for technological interventions during pandemics. \section{Human Mobility during the Pandemic} We first review scientific research about human mobility during the pandemic in diverse contexts. Mobility research can be classified into macro-, meso- and microscopic analyses depending on the geographical unit of analysis and the mobility data aggregation level \citep{klein2020assessing}. The macroscopic-level analysis includes studies that focus on international, inter-state, or inter-county mobility patterns, which might help understand mid- to long-term migration behaviors rather than daily mobility patterns. The mesoscopic level covers regions smaller than a county or metropolitan area, such as within a Combined Statistical Area (CSA) of the United States Census. Such analyses focus on small-region mobility, such as cross-census tract dynamics. Finally, microscopic-level analyses focus on place-level or location-based analysis where the resolution of the geographical unit is precise geo-coordinates. Along with this classification, we review pandemic-related mobility research in several socio-political contexts related to the pandemic. Subsequently, we review known risk factors and social determinants of health outcomes that can give rise to human mobility. \subsection{Mobility under Strong Measures} Many studies about human mobility during the COVID-19 outbreak have focused on regions or countries that implemented a strong social distancing measure such as a stay-at-home order for a majority population. The analysis level in this context ranges from macroscopic- to microscopic-level analyses. Many of them made use of mobility data provided by IT companies or non-profit organizations that was made available to the public or on-demand as part of efforts to overcome the pandemic. These studies examined the effects of strong social distancing measures in different governance units. For example, a macroscopic-level study using the mobility data from Baidu showed that the inter-city and inter-province mobility in China was a proxy of the spread of the virus in the early stage of the pandemic \citep{kraemer2020effect}. This study concluded that the correlation between inter-city mobility and the spread of the virus weakened significantly after the country had taken a strong measure of locking down the affected cities. While the degree of enforcement was different from that in China, studies in the contexts of North America and Europe provide similar implications for the impact of social distancing measures. Del Fava et al. showed decreasing patterns in social contacts by directly surveying people during COVID-19 and found that the reduction in social contacts after announcing the social distancing guideline was smaller in North America and European countries, except for Italy than China \citep{del2020differential}. Similarly, by making use of the Cuebiq data, Klein at al. found that, after the stay-at-home order in multiple states in the United States, inter-CSA travels decreased by 60\% to 80\% (macroscopic) and inter-census tract mobility decreased by 50\% (mesoscopic). Individual-level mobility measured using the radius of gyration decreased by 40\% to 60\% during weekdays (microscopic) \citep{klein2020assessing}. Using the same dataset but focusing on the New York metropolitan area, Bakker et al. reported similar patterns at the place level, showing that individuals' average travel distance per day decreased by 70\% during weekends, the social contact rate decreased by 93\%, and the place visiting rate decreased by 60\% after the national emergency declaration in the area \citep{bakker2020effect}. Using the same mobility data, similar findings were found in Italy, in which a strong social distancing measure was implemented \citep{pepe2020covid}. Studies with other datasets confirmed the same findings as that of the studies using the Cuebiq data. For example, Descartes Lab. curated human mobility data from smartphone users' GPS logs \citep{warren2020mobility}. This study reported sharp mobility drops in many states in the United States after strong measures and explained some contextualized patterns by regions (macroscopic). Combining this data with the SafeGraph dataset, another study also developed a GIS-based visualization system for monitoring county-level human mobility, showing the change of people's dwelling time by county over time \citep{gao2020mapping}. A study that used the Unacast data reported that, at the county-level, a reduction in mobility was associated with a rise in the local infection rate \citep{engle2020staying}, which is consistent with the findings of other studies \citep{kraemer2020effect,gao2020mobile}. Overall, these studies show the effects of strong social distancing measures on human mobility in various locations, regions, and countries. Although the administrative management of health authorities do affect human mobility, people's voluntary efforts and prevention behaviors also give rise to their mobility changes \citep{warren2020mobility}. This phenomenon can be observed better when social distancing measures are weakly implemented because government policies may have had relatively small effects on human mobility. \subsection{Mobility under Mild Measures} The number of countries that took a mild social distancing measure is smaller than those that took a strong measure. Countries that were studied in the context of mild social distancing are Sweden and South Korea \citep{dahlberg2020effects,park2020changes}. Although both countries took similar measures, their backgrounds and motivations are different. According to a news article, the ``Swedish model,'' which keeps schools and other facilities open while encouraging social distancing, is intended to maintain the national healthcare system's stability by sharing the burden of the healthcare workers in taking care of their children \citep{tharoor_2020}. This article reported that the Swedish model was implemented based on people's strong trust towards the health authorities. Meanwhile, in South Korea, a mild social distancing was implemented, aided by their testings to trace all individuals who contacted confirmed patients \citep{Beaubien_2020}. While taking a strong measure of self-quarantine and converted schools online, Korean governments have allowed free movement for most of the population. Because of these differences between the two countries, their meso- or microscopic mobility patterns might be different. To our knowledge, only several studies have analyzed mobility during COVID-19 in the context of mild social distancing. A study that used call detail records (CDR) acquired by a telecom company in Sweden reported that there was a 64\% decrease in mobility in residential areas (mesoscopic), a 33\% decrease in commercial areas during daytime (mesoscopic), and a 38\% decrease in the maximum travel distance per day (microscopic) in the greater Stockholm region \citep{dahlberg2020effects}. Another study using the Seoul Metropolitan Subway data in South Korea reported that daily passengers decreased by 40.6\% overall (mesoscopic) \citep{park2020changes}. These studies provide a similar mobility change implication to that in the countries with strong measures: (1) the overall mobility in metropolitan areas decreases significantly; (2) the mobility in commercial areas decreases relatively less compared to residential areas, maybe due to the continued operations of businesses; and (3) demographic and socio-economic features minimally give rise to the variation of mobility change. Although these studies analyzed mobility changes during COVID-19 with respect to demographic and socio-economic status at the micro- and mesoscopic levels, their analyses are limited due to their short analysis period, implicit classification of land-use, and low temporal resolution. The Sweden case focused on daytime mobility during an early stage of the COVID-19 development, and the South Korean case focused on only subway transit logs for a small number of subway stations. Due to these limitations, more systematic and contextualized analyses are necessary to understand how mobility patterns change and manifest in the context of mild social distancing. To provide better implications for mobility changes in this context, we aim to conduct analyses by land-use types, socio-economic factors, and demographic features at the mesoscopic region level. As the first step toward the goal, we ask the following Research Question 1: \begin{itemize} \item \emph{RQ1: How did socio-political events about COVID-19 affect human mobility in South Korea?}\footnote{``Socio-political events'' mean any articles, governments' policies, and other events about COVID-19 that attracted attention. See Section~\ref{sec:events}.} \end{itemize} \subsection{Social Determinants of Health Outcomes and Mobility}\label{sec:determinants} In addition to socio-political events, social determinants of health outcomes, such as demographic features, could be related to a risk of COVID-19, which in turn might affect people's preventive behaviors. While chronic diseases and other health conditions are considered critical factors, this paper focuses on social determinants of health outcomes for our focus on community dynamics. In public health, it is known that health outcomes such as mortality rate are heavily influenced by people's socio-economic status (e.g., income, education, and employment status), demographic features (e.g., age), and social capital (e.g., the strength of social support networks) \citep{havranek2015social}. Because these factors are closely related to or confounded with individuals' access to healthcare services, health-related behaviors, and nutrition levels, mitigating the potential inequality in local communities is one of the main goals on which many medical and public health experts have focused. During COVID-19, while it is still a developing phenomenon as of May 2020, individuals with high socio-economic deprivation were victimized most in the United States \citep{thebault_2020}. Countries with mild distancing measures might present similar patterns to the United States when it comes to social determinants of health outcomes, even though their socio-economic and socio-cultural dynamics are different. Of course, the healthcare systems in South Korea and Sweden are universal and government-funded, so the effect sizes of the social determinants could be different from that in the United States. However, human mobility can still vary depending on socio-economic status in these countries because of the nature of different professions and occupations across socio-economic groups \citep{coven2020disparities}. Because it is still unclear whether socio-economic status shaped the mobility patterns of individuals under mild social distancing measures, we ask Research Question 2 as follows: \begin{itemize} \item \emph{RQ2: How did human mobility in South Korea vary depending on socio-economic status?} \end{itemize} Demographic features are also known as important risk factors for COVID-19. Studies found that age and sex give rise to the degree of risk (mortality rate) \citep{caramelo2020estimation, jordan2020covid}. Men were reported as being more vulnerable to COVID-19 than women and women tend to pursue safety more actively than men from a behavioral perspective \citep{perrotta2020behaviors}. This shows that gender-driven risk-taking behavior may mediate the effects of the reported medical risk on human mobility (i.e., the social construction of the reported risk). Age also matters. The medical risk from COVID-19 is higher among older people; thus, the perceived risk of COVID-19 may be higher among them as well. A study showed that the social distancing rate during the COVID-19 outbreak was higher among older people than young people in eight European countries \citep{del2020differential}. Because the demographic factors correlated with the medical risk may shape people's perception of COVID-19 differently, human mobility might vary depending on the demographic characteristics. Overall, we expect that both the medical risk and the social-construction of gender-based prevention behaviors give rise to human mobility. Previous studies on sex as a biological factor \citep{jordan2020covid} and gender-based behavioral discrepancies \citep{perrotta2020behaviors} suggest two potentially-conflicting inferences for the effects of sex on mobility during COVID-19. Because the reported risk from COVID-19 is higher among men, we can hypothesize that the drop rate of men's mobility might be higher than that of women. Conversely, it is also reasonable to infer the other way around due to the behavioral patterns. Therefore, we ask Research Question 3 as follows: \begin{itemize} \item \emph{RQ3: How are demographic characteristics related to human mobility during COVID-19?} \end{itemize} \subsection{Points of Interest (POIs) and Mobility} Several recent studies used the classification of places as a proxy for understanding the motivation of mobility changes at the microscopic level during COVID-19 (e.g., whether each individual's movement was for an essential or non-essential purpose) \citep{mckenziea2020country,klein2020assessing}. While partially providing similar implications, we study unique POIs that are related to, but are not limited to, the international travel through a hub airport, the domestic travel through major bus stations, and the national election day. There is the biggest international airport in South Korea in the City of Incheon. For example, the mobility change in the airport area can imply the volumes of international travel from and to South Korea. Another major event during the pandemic was the national elections for congressmen and congresswomen, which were held on April 15th, 2020 \citep{olsen_2020}. This was the first national elections in the world under COVID-19, which let the South Korean governments take new approaches. For example, the government employees made sure that voters keep social distancing while waiting on line, wear masks, and sanitize their hands throughout the voting process. Because of this new measure, human mobility on the election day would present a unique mobility pattern compared to other days. Because some of these POI-based analyses may show unique mobility patterns that can be observed only under the mild social-distancing measure, POI-based analyses might provide a nuanced understanding of the mobility changes during COVID-19. In this regard, we ask Research Question 4 as follows: \begin{itemize} \item \emph{RQ4: How did human mobility change during COVID-19 in the regions with important POIs and on the national election day?} \end{itemize} \section{Data Curation} \begin{figure}[t] \centering \includegraphics[width=0.75\textwidth]{images/data-curation.pdf} \caption{The data curation workflow. Smartphones send a probing message periodically to find nearby WiFi access points. The transmission delay of the probing message is under 50 microseconds in general, and the signal traverses through the air in the speed of light~\citep{10.1007/s11276-009-0192-z}. The signal decoding time in the collecting device is also under a few microseconds. Therefore, a probing message is received instantaneously, and data is curated in real-time, even at the taxi velocity of 100km/h.} \label{fig:data_curation} \end{figure} Data is curated by a location-based advertisement start-up in South Korea. This company works with one of the largest telecom companies in South Korea to detect real-time demographic information around a taxi. Taxis use this demographic information to provide targeted advertisements that are streamed through the rooftop displays. Overall, there are more than 200 taxis deployed in the city of Incheon, the third-largest city in South Korea. Incheon International Airport, located in this city, carries 77\% of South Korea's international flights. Each taxi has a WiFi intelligent access point (IAP), a Long-term Evolution (LTE) cellular modem, a GPS. IAP is a customized version of the general WiFi access point (AP) that captures MAC addresses of WiFi devices such as smartphones in real-time. To protect user privacy during the data acquisition process, the demographic information is collected in an aggregated manner, and MAC addresses are randomized. The data curation process is as follows. The numbers for the following steps correspond to those in the workflow in Fig.~\ref{fig:data_curation}. (1) Individual smartphones keep sending WiFi probe requests to find a new AP. Because the IAP on a taxi keeps scanning these WiFi probe request messages, it can extract an MAC address from a request message. (2) The taxi sends the extracted MAC address to both the telecom company and the data server of the start-up company. (3) The telecom company looks up its subscriber database, as MAC addresses are received, and aggregates the demographic information (i.e., age and gender) every minute. Then, they send the aggregated demographic data to the start-up's server every minute. As a result, the returned demographic data does not include any original MAC addresses. The start-up company ensures privacy by making it impossible to join taxis' sensory data and the returned demographic data. Finally, (4) the returned demographic data is used for targeted advertisements that stream through the rooftop displays in real-time. The number of captured MAC addresses and their corresponding demographic information aggregated every minute are the key to understanding mobility in our analysis. \emph{Volume per minute} (VPM), denoted $p_{i,t}$ for taxi $i$ at time point $t$, is the unit of human mobility (see our notations in Table~\ref{tbl:notation}). The quality of data collection was tested at up to 100km/h without failure, which ensures the data consistency and stability (see the description in Fig.~\ref{fig:data_curation}). \section{Data Processing} In this section, technical details are presented to show how key variables are generated and how the spatial and temporal units of analysis are determined. This process includes (1) the Voronoi decomposition~\citep{a71ff2df9f3246469efe8638d750498d} of the city of Incheon for determining the geospatial unit of analysis, (2) the temporal aggregation of the collected demographic data for determining the temporal unit of analysis, (3) the land-use classification in the city of Incheon, (4) the socio-political segmentation of the data collection period, denoted $\mathcal{T}$, and (5) the geographical imputation of socio-economic status at the Voronoi cells. We present key notations in Table~\ref{tbl:notation}. \begin{table}[] \centering \footnotesize \caption{The notation table}\label{tbl:notation} \resizebox{\textwidth}{!}{\begin{tabular}{|c|c|} \hline Symbol & Meaning \\ \hline $i, t$ & Taxi $i$, time point $t$ in second (e.g., $t$ can be 23:59:59, 2020-03-13) \\ \hline $D$ & A set of discrete time points\\ \hline $\mathcal{T}$ & The entire time period in our dataset, i.e., from 00:00:00, 2019-12-18 to 23:59:59, 2020-04-30 \\ \hline $t_f, t_m, t_g$ & The first outbreak time $t_f$, the first massive infection time $t_m$, and the golden-cross time $t_g$ \\ \hline $t_0, t_l$ & The first and last time point of $\mathcal{T}$ in our dataset\\ \hline $h$ & An hour band in a day. $h$ can be one of $\{[0,1), [1,2), \dots, [23,0)\}$.\\ \hline $c, C$ & Voronoi cell $c$ and a cluster $C$ of Voronoi cells \\ \hline $s_{i,t}$ & The <Longitude, Latitude> information of taxi $i$ at time point $t$ \\ \hline $p_{i,t}$ & \begin{tabular}[c]{@{}c@{}} The volume of floating population detected by taxi $i$ for the past one minute from $t$, i.e., $[t - 60, t]$. \\We call this as \emph{volume per minute} (VPM). This is taught by the telecom company.\end{tabular}\\ \hline $p_{c,D}$ & \begin{tabular}[c]{@{}c@{}} The average volume of per-minute floating population in cell $c$ at time points in $D$. \\ $\displaystyle{p_{c,D} = \frac{\displaystyle{\sum_{p_{i,t} \in P} p_{i,t}}}{|P|}}$,\\where $P$ is a set of VPMs with $t \in D$ and the longitude/latitude of taxi $i$ belong to $c$ at time point $t$.\end{tabular} \\ \hline $p_{C,D}$ & \begin{tabular}[c]{@{}c@{}} The average volume of per-minute floating population in a cluster $C$ at time points in $D$ \\ $\displaystyle{p_{C,D} = \frac{\displaystyle\sum_{c \in C} p_{c,D}}{|C|}}$\end{tabular}\\ \hline $p_{h,c,D}$ & Similar to $p_{c,D}$ but we use only VPMs in $D$ whose hour band is $h$.\\ \hline $p_{h,C,D}$ & Similar to $p_{C,D}$ but we use only VPMs in $D$ whose hour band is $h$.\\ \hline ORDINARY & The set of time points before the first case, i.e., the time interval $[t_0, t_f)$\\ \hline ALERT & The set of time points between the first case and the massive infection case, i.e., the time interval $[t_f, t_m)$\\ \hline PANIC & The set of time points between the massive infection case and the golden-cross, i.e., the time interval $[t_m, t_g)$\\ \hline RELIEVED & The set of time points after the golden-cross, i.e., the time interval $[t_g, t_l]$\\ \hline WORKING & \begin{tabular}[c]{@{}c@{}}Working days in $\mathcal{T}$. We use ORINARY\_WORKING, PANIC\_WORKING, ALERT\_WORKING,\\and PANIC\_WORKING to denote working days in each interval.\end{tabular}\\ \hline HOLIDAY & \begin{tabular}[c]{@{}c@{}}Holidays in $\mathcal{T}$. We use ORINARY\_HOLIDAY, PANIC\_HOLIDAY, ALERT\_HOLIDAY,\\and PANIC\_HOLIDAY to denote holidays in each interval.\end{tabular}\\ \hline \end{tabular}} \end{table} \subsection{Geographical Unit of Analysis}\label{sec:voronoi} \begin{figure}[t] \centering \subfigure[]{\includegraphics[width=0.49\textwidth]{images/elbow_method.pdf}} \subfigure[]{\includegraphics[width=0.49\textwidth]{images/non_empty_cell_per_60_minutes.pdf}} \subfigure[]{\includegraphics[width=0.49\textwidth]{images/non_empty_cell_per_30_minutes.pdf}} \subfigure[]{\includegraphics[width=0.49\textwidth]{images/non_empty_cell_per_120_minutes.pdf}} \caption{(a) The $k$-Means clustering of $s_{i,t}$. The X-axis has various $k$ configurations, and Y-axis is the sum of the squared distances to cluster centroids. We choose $k=1,000$ using the elbow method. Note that $k=1,000$ is the starting point of the saturation of the unsupervised clustering evaluation metric. (b) The histogram of the percentage of non-empty time slots when $u$ is one hour. For example, there are about 30 cells whose non-empty percentage is 80\%. (c) The histogram when the unit $u$ is 30 minutes (d) The histogram when the unit $u$ is 2 hours} \label{fig:kmeans} \end{figure} Although there are municipal boundaries available within the city of Incheon, these administrative boundaries tend to be inconsistent with those of meaningful mobility or people's perception of the neighborhoods, as previous work demonstrates \citep{mckenzie2018identifying,cranshaw2012livehoods}. In addition, the uneven distribution of taxi locations in our data may cause varying uncertainty levels of mobility across regions if municipal boundaries are used. These potential issues lead us to generate geographical boundaries based on taxi locations. This taxi-report-driven approach to determine the geographical unit of analysis ensures the regularity of taxi density across the city's regions. One of the best ways to generate geographical boundaries based on location data is Voronoi diagram~\citep{a71ff2df9f3246469efe8638d750498d}. To generate Voronoi cells, we first run the $k$-Means clustering~\citep{bishop:2006:PRML} for the geo-coordinates of taxis to find $k$ centroids. Fig.~\ref{fig:kmeans} (a) shows the sum of the squared distances to cluster centroids, a popular unsupervised metric to evaluate the quality of clustering~\citep{10.1007/s10115-016-1004-2}, as $k$ increases. We use the elbow method~\citep{Thorndike53whobelongs} to choose the optimal $k$ configuration and $k=1,000$ is selected. To make use of the elbow method, we first draw a line segment connecting the first and last points (i.e., $k=500$ and $k=2,500$) in Fig.~\ref{fig:kmeans} (a) and calculate the perpendicular distance to the line segment for each point. As a result, $k=1,000$ yields the longest perpendicular distance. Using the 1,000 centroids identified by the $k$-Means clustering, we draw a Voronoi diagram and the entire city can be segmented into 1,000 Voronoi cells, as depicted in Fig~\ref{fig:volume} (a). \subsection{Temporal Unit of Analysis} As mentioned, $p_{i,t}$ is reported every minute from the partner telecom company, which poses a similar challenge to that of the geospatial unit of analysis but in a temporal manner. If the VPM data is used directly, it may not cover all the temporal range for a given Voronoi cell $c$, due to the uneven distribution of taxis across the time slots. This means we also need to determine the temporal unit of analysis for covering an enough number of time slots for each Voronoi cell. We take the following approach to decide the temporal unit. First, let $u$, e.g., one hour, be a new temporal unit after aggregating the original time unit $t$. We divide the entire time period $\mathcal{T}$ into many time slots of size $u$, $\{[0,u), [u,2u), \dots\}$. We count the number of unique MAC addresses for each time slot $[xu,(x+1)u)$ and then calculate the percentage of the time slots where the count is non-zero in a cell $c$. We choose such a configuration of $u$ where the number of cells with non-empty periods (i.e., the count is non-zero) is large enough. Fig.~\ref{fig:kmeans} (b) shows the histogram for the non-empty time slot percentages when $u$ is one hour. In that case, a majority of cells have more than 50\% of non-empty time slots. We think that the histogram of $u = $ 30 minutes has many cells with empty time slots, and $u = $ two hours is too coarse to observe meaningful changes in our analysis. Therefore, we use one hour as the temporal unit of analysis. \subsection{Land Use of Voronoi Cells} \label{sec:tag} Because human mobility patterns depend on the characteristics of the Voronoi cells, mobility needs to be understood by land-use. Government-provided land-use exists, but based on our qualitative examination, it does not reflect the land-use of each polygon well, maybe because people's use of the land is often mixed and varies significantly. For example, the Incheon National Airport area is designated as a green area according to the government's classification, but people's main use is international travel. This inconsistency between the official land-use classification and their manifestation is common in many cities that present a high population density in Asia \citep{tong1997advantages}. This makes it challenging to use the government's land-use classification and necessitates identifying the ground truth of the land-use in each cell in a different way. For identifying the land-use of Voronoi cells, four student assistants who are familiar with the city of Incheon manually assessed the land-use of each cell based on the amenities and places in it. They were asked to rank four land-use types for each Voronoi cell: \emph{residential, commercial, green, and industrial}, instead of selecting the best use because many cells were a mix of different uses. For each cell $c$, we randomly assigned three raters and have them rank the land-use types for each cell without talking to each other to minimize peer-influence. We classified each cell with a land-use type that was rated by equal to or more than two raters based on the manual coding results. To evaluate the quality of the initial tagging results, we use the Fleiss' kappa~\citep{gwet2008computing}, denoted $\kappa$, which is a standard way to measure inter-rater agreement on rankings. The Fleiss' $\kappa$ was 0.41, which is a moderate agreement level and suggests a reasonable coding result for the analysis. After that, we encouraged people to discuss and make a consensus for each cell's land-use type. \subsection{Socio-Political Events related to COVID-19}\label{sec:events} The first COVID-19 case in South Korea was reported on January 20th, denoted $t_f = $ 00:00:00, 2020-01-20 and the first massive infections started from a cult ceremony in the City of Daegu on February 18th, denoted $t_m = $ 00:00:00, 2020-02-18~\citep{Senn:2009}. Even though the City of Daegu was about $250km$ away from Incheon, this massive outbreak brought a serious concern to South Korean people, reminding them of the criticalness of social distancing practices. About a month later, since this event, the ``golden-cross,'' where the number of daily new confirmed cases became smaller than that of daily discharged patients from self-quarantine or hospitalization for the first time, happened on March 13th, denoted $t_g = $ 00:00:00, 2020-03-13 \citep{golden_cross_news}. This event was meaningful to people, signaling that the COVID-19 outbreak was going downhill. These events overall were symbolically noticeable to people because the Korea Centers for Disease Control and Prevention (KCDC) provided guidelines or announcements on these days, and online/offline news media also highlighted these events through many articles~\citep{kcdc:2009}. Using these socio-political events that are symbolically and practically meaningful about COVID-19, we divide the entire period $\mathcal{T}$ into four segments: (1) before the first case in Korea, i.e., $[t_0, t_f)$, (2) between the first case in Korea and a large outbreak in the City of Daegu, i.e., $[t_f, t_m)$, (3) between the outbreak in Daegu and the golden-cross, i.e., $[t_m, t_g)$, and (4) on and after the golden-cross, i.e., $[t_g, t_l]$. We use $t_0$ and $t_l$ to denote the first and last time points, respectively, in our dataset, i.e., $t_0 = $ 00:00:00, 2019-12-18 and $t_l = $ 23:59:59, 2020-04-30. These four time-segments are characterized as ORDINARY, ALERT, PANIC, and RELIEVED, respectively, based on how South Korean people feel about COVID-19. We also note that ALERT includes the Lunar New Year (January 25th), which is one of the biggest holidays in east Asia, and RELIEVED includes the national legislative elections day (April 15th). \subsection{Socio-Economic Status}\label{sec:imputation} Because we focus on Voronoi cells within the city of Incheon, high-resolution data that indicates the socio-economic status of residents is needed at the cell level to answer RQ2. However, South Korea has not made the socio-economic status data open to the public at the granular geographical level within a city; instead, it only provides income and education status data at the city and province level \citep{kostat}. Due to a lack of official socio-economic status data at the Voronoi cell level, we use the housing transaction data as a proxy for measuring the socio-economic status. This is feasible because, in South Korea, real estate occupies the most significant portion of wealth, especially since the 2000s \citep{kim2018dissonance}. Although housing prices weakly predicted the household income in the 1990s in South Korea \citep{kim1998socioeconomic}, the structure of the real estate financing market has radically changed. Since the 2000s, real estate owners have heavily relied on the \emph{Chonsei} system, a unique rent system in South Korea that allows the owner to keep a large amount of money from tenants during their rental period, instead of receiving monthly rent \citep{kim2018dissonance}. This system made it possible for the owners to finance by themselves in acquiring additional real-estates, without relying on banking systems such as a mortgage. As a result, real estate ownership underpinned by the Chonsei system has become a significant source of socio-economic inequality in South Korea in the 2010s by hampering the entrance of new owners to the real estate market, because the institutional support for real-estate financing was insufficient for newbies \citep{kim2018dissonance}. These studies on the Korean real-estate market justify that the housing price data based on real-world transactions can be used as a proxy of socio-economic status for the Voronoi cells. The housing price data was part of the real-estate transaction dataset for the period between April 1st in 2019 and April 30th in 2020. This data was released by Ministry of Land, Infrastructure and Transport through their open data portal \citep{mlit}. While the transaction data provides precise locations with physical addresses, the real-estates' locations cover only part of the Voronoi cells. This led us to use a geospatial imputation method to estimate the housing prices of empty cells. When the locations of the real estate transactions were geographically aggregated into Voronoi cells, 573 out of 1000 cells had housing price values. For each of the empty cells, we selected the real-estates that are located within a $1km$ radius from the centroid of the cell and imputed the housing price by averaging the unit prices of the selected real-estates. The length of the radius, $1 km$, was determined based on the size of ``Dong,'' the smallest census unit in South Korea. The mean value of all Dong areas in the city of Incheon is $3.4 km^2$, and the median value of the areas is $2.1 km^2$, showing a long-tale distribution. This means the average radius of Dong areas is about $1.04 km$, and the median radius of Dong areas is about $0.82 km$, which justifies $1 km$ as the radius for imputing the housing prices of empty cells. After the imputations with the $1 km$ threshold, 114 Voronoi cells (11.4\% of entire cells) were still empty, meaning that there were no real-estate transactions within a $1 km$ radius from the centroids of these cells. Because many of these cells were located in the peripheral areas of the city or green areas such as mountains, we used a well-known statistical imputation method, \emph{mean substitution} for these regions: the 114 cells were imputed with the average value of all the other cells. We use the results of this multi-step imputation process as the proxy of socio-economic status for the Voronoi cells. \section{Results} In this section, we describe our main analysis results, including their detailed charts. After describing descriptive statistics in our dataset, we answer all the research questions. \subsection{Descriptive Statistics} \begin{figure}[t] \centering \subfigure[]{\includegraphics[width=0.52\textwidth]{images/avg.pdf}} \subfigure[]{\includegraphics[width=0.46\textwidth]{images/volume_trend.pdf}} \caption{(a) The average unit prices for housing in the Voronoi cells (after geo-imputation) (b) The total volume of the floating population in Voronoi cells, i.e., the number of unique MAC addresses discovered daily. Note that the volume slightly decreases after the first massive infections at $t_m$. Because the nationwide lock-down had not been imposed in South Korea, the degree of mobility reduction is not as high as that in other countries.} \label{fig:volume} \end{figure} Fig.~\ref{fig:volume} (a) shows the Voronoi diagram with 1,000 cells generated based on taxi locations in the city of Incheon, following the steps presented in Section~\ref{sec:voronoi}. Using the average unit price of the real-estates that were purchased or sold or the value that was imputed based on the method presented in Section~\ref{sec:imputation}, the Voronoi cells are color-coded in Fig.~\ref{fig:volume} (a). The smallest cell has a size of $0.01 km^2$, the largest has $124 km^2$, and the median size of the cells is $0.2 km^2$, showing a long-tale distribution, just like that of `Dong's.\footnote{The size of the largest cell is $124 km^2$ because it covers the region outside of the city due to the characteristic of the Voronoi diagram. Because the size of the cells is not used in the analysis, this bias that exists on the periphery of the city is negligible.} The total volume change of the floating population in our dataset is shown in Fig.~\ref{fig:volume} (b). More than 1M unique MAC addresses are collected in a day for the data collection period. Compared to that in ALERT, the total volume of working days decreased by 3.3\% ($p$=3.56e-18) during the PANIC period. We expect that the weak implementation of a social distancing measure in South Korea resulted in a small decrease compared to that in other countries \citep{Beaubien_2020}. \subsection{RQ1: How did socio-political events about COVID-19 affect human mobility in South Korea?} To precisely analyze the human mobility influenced by important socio-political events, we first perform a t-test to test whether a Voronoi cell $c$'s mobility is influenced by the occurrence of the first massive infections at $t_m$. After dividing each working day and each holiday in ALERT/PANIC into 24 hour bands, respectively, we construct an array of 48 values (24 for working days and 24 for holidays), denoted as follows: \begin{align}\begin{split} S_{c,ALERT\_WORKING}=&\{p_{[0,1),c,ALERT\_WORKING}, p_{[1,2),c,ALERT\_WORKING}, \dots\},\\ S_{c,PANIC\_WORKING}=&\{p_{[0,1),c,PANIC\_WORKING}, p_{[1,2),c,PANIC\_WORKING}, \dots\},\\ S_{c,ALERT\_HOLIDAY}=&\{p_{[0,1),c,ALERT\_HOLIDAY}, p_{[1,2),c,ALERT\_HOLIDAY}, \dots\},\\ S_{c,PANIC\_HOLIDAY}=&\{p_{[0,1),c,PANIC\_HOLIDAY}, p_{[1,2),c,PANIC\_HOLIDAY}, \dots\}, \end{split}\end{align} where $p_{-,c,-}$ means the average of all the VPMs in each hour band in cell $c$ during all working days/holidays of ALERT/PANIC. We use $S_{c,ALERT\_WORKING}$ and $S_{c,ALERT\_HOLIDAY}$ (resp. $S_{c,PANIC\_WORKING}$ and $S_{c,PANIC\_HOLIDAY}$) to construct an array with 48 values representing the mobility signature of $c$ during ALERT (resp. PANIC). We compare these two arrays, one for ALERT and the other for PANIC, using a paired t-test in each cell $c$. The massive infections at $t_m$ put people into a panic so comparing ALERT and PANIC is an effective method to understand the mobility change during COVID-19. Using the p-value threshold of 0.05, we found that 146 cells presented decreases in mobility, 47 cells showed increases, and the other remaining cells had no significant changes in mobility before and after $t_m$. We analyze the decreasing, increasing, and non-changing cases separately to highlight each case's unique patterns as well as to identify diverse populations. \begin{figure}[t] \centering \subfigure[Residential cluster (82 Voronoi cells)]{\includegraphics[width=0.49\textwidth]{images/decreased_volume_trend_residential.pdf}} \subfigure[Commercial cluster (37 Voronoi cells)]{\includegraphics[width=0.49\textwidth]{images/decreased_volume_trend_commercial.pdf}} \subfigure[Industrial cluster (9 Voronoi cells)]{\includegraphics[width=0.49\textwidth]{images/decreased_volume_trend_industrial.pdf}} \subfigure[Green cluster (13 Voronoi cells)]{\includegraphics[width=0.49\textwidth]{images/decreased_volume_trend_green.pdf}} \caption{The hourly mobility patterns for various land-use types of the Voronoi cells where human mobility decreased after $t_m$. The vertical red and black lines mean 9am and 6pm, respectively.} \label{fig:rq1} \end{figure} We classify Voronoi cells with decreased mobility into four types of land-uses, namely, \emph{residential}, \emph{commercial}, \emph{industrial}, and \emph{green}, using the manual tagging, as described in Section~\ref{sec:tag}. Fig.~\ref{fig:rq1} shows their mobility patterns. $Y$-axis is the volume relative to the hourly baseline volume of ORDINARY.\footnote{100\% means volume at an hour band is same as the mean volume in the same hour band of ORDINARY.} Both the residential and commercial regions show significant drops in mobility in PANIC. The cells for residential use present a mobility ratio of -14.50\% ($p$=3.81e-39) between ALERT and PANIC --- these residential cells include many standalone high-rise apartments with commercial places on their lower floors, which are usually more expensive than other residential types. The commercial cluster that consists of commercial places around bus stations, stadiums, administrative buildings presented -13.41\% ($p$=2.39e-38) between ALERT and PANIC. In particular, the working day mobility of the residential regions decreases by -16.00\% ($p$=8.68e-78). Their mobility is not recovered even in RELIEVED. For the industrial cluster around the port of Incheon, the mobility does not decrease during working days. However, weekend mobility shows a meaningful difference between ALERT and PANIC by -25.71\% ($p$=1.32e-6). In the 12 Voronoi cells of the green cluster, their mobility decreases during PANIC by -16.13\% ($p$= 1.88e-15). These cells include not only park areas but also hills and small mountains, so their absolute volume of mobility is much smaller than the baseline. One interesting pattern across residential, commercial, and industrial clusters is that while morning time mobility decreases in general, mobility at the peak rush hour time around 8 AM does not decrease that much. Also, slight peaks around the 6 PM (rush hours) during ORDINARY working days disappear in PANIC. This suggests that many people who can work remotely started working from home, while people who need to go to work still commute to workplaces but may have changed their commuting patterns to avoid rush hours. Similarly, mobility peaks during ORDINARY disappear in both holidays and working days for the green cluster. This means the massive outbreak at $t_m$ affected people's commuting behavior as well as their leisure activities during weekends. \begin{figure}[t] \centering \subfigure[Residential cluster (29 Voronoi cells)]{\includegraphics[width=0.49\textwidth]{images/increased_volume_trend_residential.pdf}} \subfigure[Commercial cluster (13 Voronoi cells)]{\includegraphics[width=0.49\textwidth]{images/increased_volume_trend_commercial.pdf}} \subfigure[Industrial cluster (3 Voronoi cells)]{\includegraphics[width=0.49\textwidth]{images/increased_volume_trend_industrial.pdf}} \subfigure[Green cluster (1 Voronoi cell)]{\includegraphics[width=0.49\textwidth]{images/increased_volume_trend_green.pdf}} \caption{The hourly mobility patterns for various land-use types of Voronoi cells where human mobility increased after $t_m$.} \label{fig:rq1-2} \end{figure} \begin{figure}[t] \centering \subfigure[Residential cluster (146 Voronoi cells)]{\includegraphics[width=0.49\textwidth]{images/non_changed_volume_trend_residential.pdf}} \subfigure[Commercial cluster (36 Voronoi cells)]{\includegraphics[width=0.49\textwidth]{images/non_changed_volume_trend_commercial.pdf}} \subfigure[Industrial cluster (18 Voronoi cells)]{\includegraphics[width=0.49\textwidth]{images/non_changed_volume_trend_industrial.pdf}} \subfigure[Green cluster (10 Voronoi cell)]{\includegraphics[width=0.49\textwidth]{images/non_changed_volume_trend_green.pdf}} \caption{The hourly mobility patterns for various land-use types of Voronoi cells where human mobility does not change after $t_m$.} \label{fig:rq1-3} \end{figure} Fig.~\ref{fig:rq1-2} shows the mobility patterns of the increasing cases. In all but the green cluster, their increasing rates are 80.14\% ($p$=1.76e-5) --- this residential cluster has many apartment complexes, a typical living type for many people in South Korea, for the middle and working classes. In particular, the mobility of the green cluster in PANIC increases the most in our dataset compared to that in ALERT for early morning on working days (245.99\%, $p$ = 0.029). We speculate that this radical increase is due to people's increased exercise in early morning times under the COVID-19 situation. For holidays, both early-morning and afternoon mobility increases significantly, maybe, also due to outdoor exercise (166.30\%, $p$=0.015). This cell that shows such an abnormal pattern is a park and the only cell in the green cluster. This region is highlighted with a red circle in Fig.~\ref{fig:volume} (a), and its nearby cells are one of the most expensive areas and the best school district in the city of Incheon.\footnote{The reputation of the school district is a key determinant that shapes housing prices in South Korea. In this particular cell, there are two high-profile high schools special-purpose for science/international subjects and highly competitive.} Another interesting pattern is that there are new peaks observed in early morning times and late afternoons on working days during PANIC in the residential cluster. In the commercial cluster, the pattern is similar to the residential cluster where the morning and afternoon peaks are slightly shifted to earlier times, respectively, during working days. These changes might be due to commuting citizens who had to shift their commuting times to avoid the crowds. Also, the increased volumes on both working days and holidays in these clusters indicate that some people had work more during and after the pandemic, which might be caused by decreased income. Finally, Fig.~\ref{fig:rq1-3} presents Voronoi cells with non-significant mobility changes (residential: -0.62\%, $p=$0.198, commercial: -0.34\%, $p=$0.713, industrial: -0.84\%, $p=$0.418, green: 0.68\%, $p=$0.438). As noted, $p$-values are not significant in these cells between ALERT and PANIC, when the paired t-test is used. However, we can still observe some pattern changes for particular time frames. For example, on working days in the green cluster during PANIC, a peak in mobility is observed at around 6 PM, maybe due to people's outdoor exercises. During the morning times on holidays in the residential cluster, a peak is observed as well, maybe due to extra work or outdoor activities. These cells are a random sample of 210 cells out of all the 777 cells that do not present changes in mobility because many cells are in peripheral areas and we assumed that a random sampling of these cells would show a representative mobility pattern of the population (i.e., the 777 cells). \subsection{RQ2: How did human mobility in South Korea vary depending on socio-economic status?} \begin{figure}[t] \centering \subfigure[The top quartile of housing price]{\includegraphics[width=0.49\textwidth]{images/top_0_to_25_percent.pdf}} \subfigure[The bottom quartile of housing price]{\includegraphics[width=0.49\textwidth]{images/top_75_to_100_percent.pdf}} \caption{The hourly mobility patterns for the top and bottom quantiles of the average unit prices for housing.} \label{fig:rq2} \end{figure} In the aggregate level, there was no significant change in mobility that is shaped by socio-economic differences, which is consistent with the reporting from the Sweden case \citep{dahlberg2020effects}. We further analyze the impact of socio-economic status to see how they vary in more contextual conditions. Using the housing price information in Section~\ref{sec:imputation}, we choose residential cells and group the cells into quantiles. The mobility patterns for the top and bottom quantiles of housing prices are shown in Fig.~\ref{fig:rq2}. In the top quantile cells in Fig.~\ref{fig:rq2} (a), the average mobility on working days and holidays slightly decreases during the daytime of PANIC compared to that of ALERT (-2.69\%, $p$=0.050). RELIEVED, however, shows an increased mobility pattern by 3.44\% ($p$=0.007) in comparison with PANIC. One more interesting point is that the top quantile's mobility is mostly larger than the baseline marked with the dotted horizontal line (i.e., y=100). This might be because wealthy areas in South Korea tend to have well-managed parks, and people would have better access to these parks. In the bottom quantile cells in Fig.~\ref{fig:rq2} (b), there are no significant changes observed in working-day mobility during PANIC, and its mobility pattern is mostly lower than the baseline. One possible interpretation is that people still need to work even in the COVID-19 situation, so there are no significant working-day mobility changes. Maybe for a similar reason, the golden-cross does not cause any mobility change for the bottom quantile. Also, increased mobility in the morning and afternoon times on holidays during PANIC compared to ALERT confirms such inferences. Meanwhile, its holiday mobility shows meaningful increases across time frames (9.10\%, $p$=1.24e-4). However, the absolute volume is not as large as that of the top quantile, maybe due to the limited access to parks and recreational zones. \begin{figure}[t] \centering \subfigure[The hourly mobility of female over 60s]{\includegraphics[width=0.49\textwidth]{images/age_over_60_gender_F.pdf}} \subfigure[The hourly mobility of male over 60s]{\includegraphics[width=0.49\textwidth]{images/age_over_60_gender_M.pdf}} \subfigure[The hourly mobility of female in their 20s]{\includegraphics[width=0.49\textwidth]{images/age_20_gender_F.pdf}} \subfigure[The hourly mobility of male in their 20s]{\includegraphics[width=0.49\textwidth]{images/age_20_gender_M.pdf}} \subfigure[The mobility change by age in the residential cluster with decreased mobility from Fig.~\ref{fig:rq1} (a)]{\includegraphics[width=0.49\textwidth]{images/decreased_rate.pdf}} \subfigure[The mobility change by age in the residential cluster with increased mobility from Fig.~\ref{fig:rq1-2} (a)]{\includegraphics[width=0.49\textwidth]{images/increased_rate.pdf}} \caption{The hourly mobility patterns by gender and age.} \label{fig:rq3} \end{figure} \subsection{RQ3: How are demographic characteristics related to human mobility during COVID-19?} RQ3 is answered through analyzing the mobility patterns by gender and age during COVID-19. According to a study that assesses risk factors of COVID-19 \citep{jordan2020covid}, the age of more than 60 is the most vulnerable demographic group. Therefore, we analyze the most vulnerable age band in conjunction with gender in Figs.~\ref{fig:rq3} (a) and (b). We do not consider land-use and socio-economic factors for this analysis but show the mobility averaged over all cases. Interestingly, the male population in their 60s or more shows greater mobility in general than females of the same ages. This might be due to the cultural embeddedness of traditional gender roles in mobility patterns, where men tend to work outside while women work as housewives. The changing gender roles in younger generations can be observed in the mobility patterns of people in their 20s, where the mobility difference between men and women is minimal (Fig.~\ref{fig:rq3} (c) and (d)). Another finding is that the holiday mobility of males in their 60s or more increases during PANIC and afterward. The mobility of females also increases but not as much as that of males. To understand the increase of mobility in old generations better, we plot the mobility change by age group as bar charts in Figs.~\ref{fig:rq3} (e) and (f). These figures show the average mobility changes (\%) and standard deviations as error bars in the residential areas reported in Fig.~\ref{fig:rq1} (a) and Fig.~\ref{fig:rq1-2} (a), respectively. Similar to the patterns observed in Fig.~\ref{fig:rq1} (a), the overall mobility of all age groups decreases during PANIC with varying degrees. In the cells with increased mobility, while they are not statistically significant due to the small number of cells, older generations tend to move more than other age groups. These observations indicate that the older generations show less mobility change in many areas after the COVID-19 outbreak and sometimes present even increased mobility compared to younger groups. This pattern is counter-intuitive to what we have reviewed in Section~\ref{sec:determinants}, where we expected that the older generations' perceived risk of COVID-19 through news articles might hamper their mobility. This result implies that older generations might be more vulnerable than expected not only due to their age from a medical perspective \citep{jordan2020covid}, but also because of the mobility pattern that does not show a meaningful decrease during the pandemic. \subsection{RQ4: How did human mobility change during COVID-19 in the regions with important POIs and on the national election day?} \begin{figure}[t] \centering \subfigure[The hourly mobility in Incheon National Airport.]{\includegraphics[width=0.49\textwidth]{images/incheon_airport.pdf}} \subfigure[The hourly mobility in Incheon Bus Terminal Station.]{\includegraphics[width=0.49\textwidth]{images/bus_terminal.pdf}} \caption{The hourly mobility patterns in major transportation-related cells.} \label{fig:rq4-1} \end{figure} \paragraph{Passenger Transportation. }Fig.~\ref{fig:rq4-1} shows the hourly patterns in the two Voronoi cells related to mid- to long-distance transportation. The mobility around Incheon National Airport drastically decreases after the first massive infections (-31.46\%, $p$=8.24e-6). Compared to ORDINARY, the mobility in RELIEVED is almost four times smaller (-80.50\%, $p$=1.21e-56). This is because many international flights have canceled or temporarily stopped services; international travelers have also decided to stay in the country due to the global pandemic. In the cell with the city's major ground transportation, however, the mobility pattern decreases only on working days during PANIC and RELIEVED (-17.76\%, $p$=1.10e-4).\footnote{Incheon does not have high-speed train stops (whereas Seoul has three and a nearby city has one). Thus, people should either move to Seoul to take trains or use the bus terminal to travel to other cities. Therefore, we characterize this cell as the major domestic transportation method.} On holidays, mobility change shows two interesting patterns. During the afternoons and night times, the mobility increases during PANIC; conversely, during the morning and dinner times, the mobility decreases sharply. This might indicate that mid- to long-term travels to other cities increased while short-term trips decreased. In RELIEVED, the overall mobility in holidays significantly increases (14.19\%, $p$=0.04) compared to ALERT and PANIC. The sharp decrease in morning- and dinner-time mobility observed during PANIC gets back or even increases in RELIEVED. This could be the case that people who left the city for mid- to long-term come back to the city, and short-term travelers re-start traveling to other cities after observing the golden-cross. \paragraph{Healthcare Services. } There are a couple of general hospitals in the city, such as Inha University Medical Center, Catholic University Medical Center, and Gacheon University Gil Medical Center. Fig.~\ref{fig:rq4-2} shows the mobility pattern in the cells with these hospitals. Because they are the largest hospitals in the city of Incheon and are responsible for taking care of COVID-19 patients, their mobility increases for all cases (24.00\%, $p$=6.67e-5). Only the holiday mobility in RELIEVED is similar to that in ALERT, which indicates a decreased number of COVID-19 patients. Around the golden-cross, the number of daily new patients is no more than 50 nationwide. Therefore, it is possible to say that mobility in hospital regions decreases as COVID-19 patients decrease after the golden-cross. \begin{figure}[t] \centering \includegraphics[width=0.49\textwidth]{images/hospital.pdf} \caption{The hourly mobility patterns in hospitals} \label{fig:rq4-2} \end{figure} \paragraph{Education. }The city of Incheon is one of the education-oriented cities in South Korea. There are many higher education institutions, such as George Mason University Korea, The University of Utah Asia Campus, The State University of New York Korea, Yonsei University Global Campus, Inha University. All those universities except Inha University are located close to each other across adjacent Voronoi cells. They are not open for Spring 2020. \begin{figure}[t] \centering \subfigure[The hourly mobility in Inha University]{\includegraphics[width=0.49\textwidth]{images/inha_university.pdf}} \subfigure[The hourly mobility in other universities in the Songdo district]{\includegraphics[width=0.49\textwidth]{images/songdo_university.pdf}} \caption{The hourly mobility patterns in universities} \label{fig:rq4-3} \end{figure} Fig.~\ref{fig:rq4-3} shows that mobility decreases slightly during the working days in PANIC around Inha University (-12.07\%, $p$=0.02). However, its holiday mobility significantly increases during PANIC because this university opens its campus to residents (27.64\%, $p$=0.031). The university campus might have played a role as a park during PANIC. For other universities located in the Songdo district where premium, apartments, and parks are co-located, their mobility patterns do not change much on working days in PANIC. People visit the campuses on holiday mornings during PANIC (46.60\%, $p$=0.028). Because the Songdo district, highlighted in a blue rectangle in Fig.~\ref{fig:volume} (a), also has accessible parks, recreational zones, and commercial facilities, their working day mobility does not decrease in general. In both figures, one interesting pattern is that the high holiday mobility in PANIC disappears in RELIEVED. This might indicate that people are getting back to normal. \begin{figure}[ht] \centering \subfigure[Bupyeong area, the area with the largest number of voters (450K)]{\includegraphics[width=0.49\textwidth]{images/top_bupyeong_weekend.pdf}} \subfigure[Yeonsu area, the area with the smallest number of voters (250K)]{\includegraphics[width=0.49\textwidth]{images/bottom_yeonsu_weekend.pdf}} \subfigure[Top-3 cells in housing price]{\includegraphics[width=0.49\textwidth]{images/top_3_weekend.pdf}} \subfigure[Bottom-3 cells in housing price]{\includegraphics[width=0.49\textwidth]{images/bottom_3_weekend.pdf}} \caption{The hourly mobility patterns on the legislative elections day. We compare with the holiday mobility in other periods.} \label{fig:rq4-4} \end{figure} \paragraph{Legislative Elections. } South Korea's 21st legislative elections were held on April 15th, a temporary holiday promoting voting. They were the first nationwide event since the COVID-19 outbreak in South Korea. As shown in Fig.~\ref{fig:rq4-4}, the mobility on the election day significantly increases in all cells related to the events, compared to the mobility in other holidays. Fig.~\ref{fig:rq4-4} (a) shows the mobility pattern in the area with the largest number of voters, and (b) shows the smallest one. Their increase ratios are 10.18\% ($p$=0.024) in Fig.~\ref{fig:rq4-4} (a) and 7.03\% ($p$=0.045) in Fig.~\ref{fig:rq4-4} (b). Another interesting finding on the election day is the difference in mobility by wealth. In Fig.~\ref{fig:rq4-4} (c), people in the top-3 areas (in terms of housing prices) move more actively than those in the bottom-3 areas. This difference might provide important implications for the relationship between socio-economic status and socio-political equity, as discussed in the next section. \section{A Typology of Populations during the Pandemic} Answering research questions is scientifically meaningful because it can show mobility pattern changes that are different from or similar to countries with different social distancing measures. In addition to this scientific contribution in the context of mild social distancing, the findings provide design implications for future systems in the CSCW domain. Based on the mobility patterns identified concerning diverse factors, we discuss potential opportunities to design technological interventions that could help flatten the curve and sustain people's daily practices and work during pandemics. As an initial effort to provide such implications, a typology of populations is identified and developed based on their mobility patterns during COVID-19 and associated factors, which imply their lifestyles and work conditions in the context of mild social distancing. \subsection{Crowd-avoiding Outdoor Workers} One of the salient types of people during COVID-19 is those who still commute between their homes and workplaces while changing their commuting times, which we call ``crowd-avoiding outdoor workers.'' In the cells that present an increase in mobility (Fig.~\ref{fig:rq1-2}, mobility increased in early mornings and early afternoons on working days in both residential and commercial areas. This may mean many people who had to go outside for their work shifted their commuting times to avoid rush hours. Their concerns might be to ensure their safety during commuting times. For this type of worker, congestion- and crowd-monitoring systems or route recommendation/coordination systems could help mitigate their safety concerns during pandemics. This difficulty is observed in cells with low socio-economic status (Fig.~\ref{fig:rq2}). While other patterns did not change between ALERT and PANIC, cells with low socio-economic status present peaks during morning times and in the afternoons, just like working days. This means many people may have to work more during the holidays in PANIC than ORDINARY, maybe because they need to complement decreased income through gigs or part-time jobs. We hypothesize that this pattern is not due to other leisure or religious activities because they are not observed during ORDINARY. Further research is needed to understand the citizen groups who present this mobility pattern through surveys or in-depth interviews. If the reason for the increased mobility is because of extra work, the design of crowd-monitoring systems could be improved by considering the job characteristics of crowd-avoiding outdoor workers. While not designed in this context, there have been relevant geographically-oriented recommendation systems developed in the CSCW and related fields. For example, Priedhorsky and Terveen developed a crowdsourcing system called Cyclopath to recommend bicycle routes for cyclists in the City of Minneapolis, Minnesota, based on people's biking trajectory data \citep{priedhorsky2008computational}. Also, Quercia and colleagues designed happy maps that recommend aesthetically pleasant routes by using people's ratings of urban scenes \citep{quercia2014shortest}. Although these systems focus on geographical routes, a similar approach could be used to recommend a route and departure time to help workers safely commute to their workplaces dynamically. \subsection{Old Workers: Poverty of the Already Vulnerable Population?} Related to workers who have to shift their commuting times, old generations in South Korea could be another population that needs special consideration from a mobility perspective. One inference that could be made based on the age group observation is that a large portion of the older generations who are more vulnerable to COVID-19 than other generations might still need to commute for their work during the pandemic. As we observed in Fig.~\ref{fig:rq2}, people who are in their 60s or more present a smaller decrease in mobility during the pandemic compared to people who are in their 20s to 50s. This might be because, in South Korea, people have to retire around the age of 60 by law, and many rely on a gig economy or part-time jobs after retirement. Studies and news articles show that these generations (usually characterized as ``baby boomers'' and ``Korean-war generations'') work hard after their retirements but still in poverty \citep{old_poverty,jang2019}. A news outlet reported that 33\% of the retired population in South Korea still work but remain in a low socio-economic status, which is one of the long-standing social issues \citep{old_poverty}. A research article published by Korea Institute of Finance (KIF) reports that the proportion of the old generations in the relative poverty level is 43.8\% and that in their absolute poverty level is 32.6\%, which is a significantly higher percentage than the absolute poverty rate of younger generations at 9.3\% \citep{jang2019}. According to this report, the reasons for the low socio-economic status include the massive retirements of people who are baby boomers, a lack of income sources for the old generations, insufficient preparations for retirement life, and insufficient retirement funds. From a technological intervention perspective, providing a crowd-monitoring system is not sufficient for this population. Technological designs need to consider not only the safe commuting of this population during pandemics, but also their safe job information and potential digital divides such as technical literacy, data literacy, and physical access to the internet \citep{van2012evolution}. At the same time, policies and social supports need to be combined for the welfare of the old generations because of their double hardships during the pandemic: both old generations' medical vulnerability and work conditions are related to their socio-economic status. Health authorities and policy-makers can benefit from this analysis in implementing social support policies by knowing how hardships during COVID-19 manifest across generations in people's mobility patterns. \subsection{Working Voters} The difference between regions with high and low socio-economic status also manifests in the mobility patterns on the legislative election day, as depicted in Fig.~\ref{fig:rq4-4}. In the cells with low socio-economic status, the mobility change is minimal on the election day compared to wealthy areas, and their peak in mobility is concentrated in morning times. This may indicate that a non-trivial portion of them voted in the morning and moved to other cells to work even though it is an official holiday, or they voted in advance.\footnote{It was possible to vote in advance a few days earlier than the official legislative election day.} Either way, this phenomenon provides implications for the design of technological interventions for elections during pandemics. On the one hand, the voting, in general, can benefit from a design of technological coordination systems that help minimize the congestion at voting venues by assigning voters to appropriate time slots. In this case, the designers of such systems need to consider existing voting methods and known factors that could shape voting turnouts, such as early in-person voting and voters' demographic characteristics \citep{fitzgerald2005greater}. On the other hand, the mobility-driven characteristics of voters need to be taken into accounts, such as their available times and routes on the election and pre-election days. As the mobility change patterns indicate, there might be many citizens who still need to work even on voting days, e.g., self-employed people. Safety issues during a voting process can result in small voting turnouts, particularly in regions with low socio-economic status due to their limited voting time slots. Any interventions for voting during pandemics would need to be designed in a way that does not decrease the voting rate among this population. At the same time, policy-makers and National Election Commission could benefit from the mobility pattern data by choosing appropriate voting locations for the convenience and safety of marginalized populations. \subsection{Flexible Office Workers} A noticeable pattern observed from the data analysis is a decrease in mobility in the afternoons in residential, commercial, and industrial cells on working days (Fig.~\ref{fig:rq1}). During the pandemic, people in these cells decreased their outside activities in the afternoons and rush hours. Because there is no peak during the rush hours around dinner time, people may not have gone to work during the pandemic. Based on these patterns, it is possible to infer that a large group of people are flexible in changing their working times and locations, such as opting to work from home. For this group of workers, their primary focus might be productivity. If so, asynchronous, remote collaboration tools might be helpful. As briefly mentioned in Section~\ref{sec:intro}, technological tools for facilitating remote collaboration are among the core topics in the fields of CSCW and HCI. Bj{\o}rn and colleagues report, through their ethnographic work, that successful remote collaboration should involve (1) the development of common ground among team members to have a shared understanding of concepts, vocabularies, and norms, (2) collaboration readiness such as languages, necessary skill sets, and peripheral knowledge outside of their core jobs shaped by organizational structure, (3) collaboration technology readiness such as conferencing tools and shared document practices, (4) coupling of work that creates interdependencies among remote workers that facilitate communications with and awareness of each other, and (5) organizational management that tends to be more difficult in a remote environment because of the reinforced power structure driven by the physical separation of teams \citep{bjorn2014does}. In addition to these already complex challenges in remote collaboration, the context of pandemics can make it more difficult to develop any of these components. For example, a sudden change in working environments could result in a lack of preparation time for organizations and workers to develop common ground among team members, equip them with the necessary technology for remote collaboration, and structure the work in a way that creates higher interdependencies among them. Also, remote workers could struggle from additional challenges in a home environment if they have family duties, such as taking care of children and helping household work, as reported by many recent studies \citep{cluver2020parenting}. Accordingly, the design for remote collaboration during pandemics should consider these factors as well as people's daily mobility patterns (i.e., high in the mornings and low in the afternoons) to understand their behaviors and daily challenges better. \subsection{Leisure Time Seekers: Socializing Goers and Day Travellers} Part of the remote work collaboration is closely related to their socializing and leisure behaviors, because knowing and understanding team members is a good way to develop common grounds. Beyond this, socializing and leisure activities with friends and family members is an essential part of life for people's mental/physical health and the development of trustworthiness within a community. According to Fig.~\ref{fig:rq1}, people usually hang out with friends and family in the afternoons of holidays in ORDINARY. However, in the PANIC period, the peak during dinner times disappears. This change suggests that socializing activities outside of their homes decreased significantly during the COVID-19 outbreak. Similarly, in ORDINARY of Fig.~\ref{fig:rq4-2} (b), bus stations are peaked in the mornings and in the dinner times on holidays. This might be because of day travelers during the holidays. Domestic travels from Incheon to locations outside of the city are easier with buses rather than with trains due to the location of the city. Mobility is decreased during morning and dinner times on the holidays because day travelers who regularly go to hiking and leisure activities outside of the city might have stopped having trips during the pandemic. Since socializing and leisure activities are closely related to people's mental and physical health, these mobility patterns suggest a need for technological interventions to help them socialize with each other and enjoy their outdoor activities while ensuring safety. One possible implication might be, similar to that for crowd-avoiding outdoor workers, a consideration of crowdedness in POIs or leisure places: systems could be designed by focusing on safe alternatives and times for outdoor activities. Also, existing socializing and online networking apps could be re-appropriated by considering their emotional changes and safe times for connecting socializing goers during dinner times on holidays. \section{Limitations and Conclusion} As with other data-driven studies, this analysis has some limitations. Even though spatial and temporal units were aggregated to some degree, there is still uncertainty embedded in the processed data due to the uneven distribution of taxis across times and locations. Refining aggregation techniques and other imputation methods could help minimize the spatio-temporal bias. Another difficulty is that taxis cannot capture mobility if some regions are not accessible by cars. We overcame this by setting the size of Voronoi cells big enough in such areas. However, future studies may need to take this uncertainty into account to identify mobility changes more precisely. Also, mixed land-use needs to be considered in future analysis. In this paper, we used the highest-ranking types among the manually-coded land-uses. However, this method still has a limitation from an analytical perspective. Developing ways to consider the mixed land-use types would make this kind of study more accurate in interpreting results, especially in cities with a high population density. Statistical models could be improved in future studies. This study provides a descriptive analysis of mobility changes, rather than fitting novel statistical models such as Event Study analysis or hazard models because this study focuses on providing implications for technological interventions during pandemics. Analyzing mobility changes with advanced statistical models and spatio-temporal analysis will benefit social scientists and policy-makers with more accurate measures and monitoring technologies. Finally, the use of housing transaction data as a proxy of socio-economic status needs more validation. Although there is strong evidence that real-estate ownership is a symbolic and material wealth indicator, there might be some discrepancies between housing prices and actual wealth at the mesoscopic region level. Measuring and predicting socio-economic status could benefit from machine learning models and large-scale surveys in future studies. Also, open data support from the statistical department in the government of South Korea will help alleviate this issue. Nevertheless, this study provides extensive analyses of human mobility during the COVID-19 outbreak, by possibly covering the most pre- and after-pandemic periods in South Korea. By analyzing human mobility in diverse regions and times of the day, this paper contributes to the scientific findings on mobility during COVID-19 in the context of mild social distancing. Also, through the examinations of daily pattern changes in mobility, this paper identifies a typology of five mobility groups who potentially need more attention for their safe navigation of daily practices. We hope that the typology of populations and their discussions provide useful implications for the design of technological interventions to help relieve the on-going challenges and plan for the post-pandemic era. \bibliographystyle{ACM-Reference-Format}
\section{Introduction} Hadron resonances manifest themselves in the strongly interacting systems of the underlying hadronic states, such as the two- and many-body scattering processes, the form factors and the spectral functions of the hadrons, etc. The combination of the chiral effective field theory and the requirements of the unitarity and analyticity provides a reliable and powerful tool to systematically investigate the hadronic resonances appearing in various physical quantities. The methodology developed in the hadronic sector could also shed light on the exploring study of the possible resonances beyond the Standard Model that appear in the scattering processes of the $W$ and $Z$ bosons~\cite{bibchptew}. The spontaneous $SU(3)_L\times SU(3)_R\to SU(3)_V$ chiral symmetry breaking of QCD leads to the eight pseudo-Nambu-Goldstone bosons (pNGBs), which can be identified as the eight light mesons $\pi, K$ and $\eta$. The small masses of the pNGBs are caused by the explicit breaking of the chiral symmetry from the light-flavor quark masses. Chiral perturbation theory ($\chi$PT)~\cite{Weinberg:1978kz,Gasser:1983yg,Gasser:1984gg}, as the first well-established effective theory of QCD, has been extensively demonstrated to be powerful to describe the physical processes involving the pNGBs $\pi, K$ and $\eta$. Another important property of QCD at low energy is the $U_A(1)$ anomaly arising from the strong interactions, which is believed to be responsible for the large mass of the singlet $\eta_0$, that gives the most important component to the physical $\eta'$ state. Due to the $\uao$ anomaly effect, $M_0$, the mass of the singlet $\eta_0$, does not vanish and keeps a large value around 1~GeV even in the chiral limit. The appearance of the new scale $M_0$ breaks down the conventional chiral power-counting scheme, which relies on the perturbative expansions of the external momenta and light meson masses. One way to systematically include the $\eta'$ state in $\chi$PT is the large $N_C$ framework, being $N_C$ the number of colors in QCD. According to the large $N_C$ QCD~\cite{largenc}, the quark loops, which are responsible for the QCD $U_A(1)$ anomaly~\cite{ua1anomaly}, are $1/N_C$ suppressed, implying that in the $N_C\to \infty$ limit the QCD $\uao$ anomaly would disappear and the singlet $\eta_0$ would become a pNGB in the chiral limit~\cite{ua1nc}, as the $\pi, K$ and $\eta$. In this framework, the leading order mass squared of the $\eta_0$, $M_0^2$, scales as $1/N_C$ when $N_C\to \infty$. Based on this argument, the triple $\delta$ expansion scheme, i.e. $O(\delta) \sim O(1/N_C) \sim O(p^2) \sim O(m_q)$, is proposed to simultaneously study the $\pi, K, \eta$ and $\eta'$ in $\chi$PT, which is also referred as $U(3)$ $\chi$PT in literature~\cite{HerreraSiklody:1996pm,Kaiser:2000gs}. By taking both the chiral and large $N_C$ limits, the dynamical degrees of freedom of the very low energy QCD would be the nonet $\pi, K, \eta_8$ and $\eta_0$. From this point of view, specially when one attempts to probe the $N_C$ behaviors of various hadron resonances, the $U(3)$ $\chi$PT offers a better motivated theoretical framework to study the resonance properties than the conventional $SU(3)$ case~\cite{Gasser:1984gg}. During the last decade, important progresses on the $U(3)$ $\chi$PT within the $\delta$ expansion scheme have been made, including the one-loop calculation of all the two-meson scattering amplitudes, scalar and pseudoscalar form factors and the study of the $N_C$ behaviors of the various light-flavor scalar and vector resonances~\cite{Guo:2011pa,Guo:2012ym,Guo:2012yt,Guo:2016zep}. Special attention has been paid to the light-flavor resonance dynamics in the scalar and pseudoscalar spectral sum rules, and the semilocal duality from the meson-meson scattering. In this note, we first briefly introduce the theoretical formalism and then discuss the key findings of the recent $U(3)$ $\chi$PT developments. \section{The theoretical setups of the $U(3)$ chiral theory}\label{sec.theorysetup} At leading order (LO) in the $\delta$ expansion, the $U(3)$ Lagrangian consists of three independent terms \begin{eqnarray}\label{eq.laglo} \mL^{(0)}= \frac{ F^2}{4}\bra u_\mu u^\mu \ket+ \frac{F^2}{4}\bra \chi_+ \ket + \frac{F^2}{12}M_0^2 X^2 \,, \end{eqnarray} where the basic chiral operators take the form \begin{eqnarray}\label{defbb} && U = u^2 = e^{i\frac{ \sqrt2\Phi}{ F}}\,, \qquad \chi = 2 B (s + i p) \,, \nn \\&& X= \ln{(\det U)}\,, \quad \chi_\pm = u^\dagger \chi u^\dagger \pm u \chi^\dagger u \,, \quad u_\mu = i u^\dagger D_\mu U u^\dagger \,, \nn \\ && D_\mu U \, =\, \partial_\mu U - i (v_\mu + a_\mu) U\, + i U (v_\mu - a_\mu) \,, \end{eqnarray} and the contents of the pNGBs in the $U(3)$ case are given by \begin{equation}\label{eq.phi9} \Phi \,=\, \left( \begin{array}{ccc} \frac{1}{\sqrt{2}} \pi^0+\frac{1}{\sqrt{6}}\eta_8+\frac{1}{\sqrt{3}} \eta_0 & \pi^+ & K^+ \\ \pi^- & \frac{-1}{\sqrt{2}} \pi^0+\frac{1}{\sqrt{6}}\eta_8+\frac{1}{\sqrt{3}} \eta_0 & K^0 \\ K^- & \overline{K}^0 & \frac{-2}{\sqrt{6}}\eta_8+\frac{1}{\sqrt{3}} \eta_0 \end{array} \right)\,. \end{equation} Here $F$ stands for the pion decay constant at LO, with the physical normalization $F_\pi=92.1$~MeV. $v_\mu, a_\mu, p$ and $s$ represent the vector, axial-vector, pseudoscalar and scalar external sources, respectively. By taking the vacuum expectation values of the scalar source as $s={\rm diag}(m_u,m_d,m_s)$, being $m_{q=u,d,s}$ the light quark masses, one can implement the explicit chiral symmetry breaking in the same way as that in QCD. It is noted that we work in the isospin symmetric situation throughout, that is to take $m_u=m_d=\hat{m}$. The quantity $B$ is proportional to the quark condensate via $\bra 0| \bar{q}^{a}q^{b} |0\ket = - B\,F^2 \delta^{ab}$. The last term in Eq.~\eqref{eq.laglo} introduces the QCD $\uao$ anomaly effect and gives the $\eta_0$ the LO mass $M_0$. Generally, the higher-order operators in the effective field theory incorporates the higher energy dynamics. So that, apart from introducing the higher order local operators, another approach to take into account the higher order effects is to explicitly include dynamical degrees of freedom beyond low energy ones. One of such successful attempts along the line of this research is the resonance chiral theory (R$\chi$T), which explicitly includes the light-flavor vector, scalar and pseudoscalar resonances in its construction of the Lagrangians~\cite{Ecker:1988te}. Later on R$\chi$T also turns out to be very useful for the phenomenological study of the physical processes involving resonances~\cite{rxtpheno}. Although the rigorous generalization of the R$\chi$T into the loop calculation still faces problems, the large $N_C$ QCD argument provides useful guidelines for the construction of the R$\chi$T operators~\cite{Cirigliano:2006hb}. The relevant ones that enter the meson-meson scattering, the scalar and pseudoscalar form factors in our study are analyzed in detail in Refs.~\cite{Guo:2011pa,Guo:2012ym,Guo:2012yt}. The R$\chi$T Lagrangian that describes the interactions between the pNGBs and the vector resonances reads~\cite{Ecker:1988te} \begin{eqnarray}\label{eq.lagvector} \mL_{V}= \frac{i G_V}{2\sqrt2}\langle V_{\mu\nu}[ u^\mu, u^\nu]\rangle \,, \end{eqnarray} and the one describing the interactions between the pNGBs and the scalar resonances is given by \begin{align}\label{eq.lagscalar} \mL_{S}&= c_d\bra S_8 u_\mu u^\mu \ket + c_m \bra S_8 \chi_+ \ket + \widetilde{c}_d S_1 \bra u_\mu u^\mu \ket + \widetilde{c}_m S_1 \bra \chi_+ \ket \,. \end{align} The relevant Lagrangian involving the pseudoscalar resonances is \begin{eqnarray}\label{eq.lagpscalar} \mL_{P} = i d_m \bra P_8 \chi_- \ket + i \widetilde{d}_m P_1 \bra \chi_- \ket\,. \end{eqnarray} For the definitions of the explicit matrix contents of the vector nonet $V$, scalar octet $S_8$ and scalar singlet $S_1$, we refer to Ref.~\cite{Guo:2011pa} and references therein for details. The matrix contents of the pseudoscalar resonances share the same flavor structures of the pNGBs in Eq.~\eqref{eq.phi9}. Since we focus on the resonance dynamics in the study of the meson-meson scattering and the form factors, the R$\chi$T Lagrangians in Eqs.~\eqref{eq.lagvector}, \eqref{eq.lagscalar} and \eqref{eq.lagpscalar} are used in the calculation. By integrating out the resonances, one can get the higher-order local operators, most of which are the ones surviving in the large $N_C$ limit. In the $\delta$ expansion, there are two next-to-leading order (NLO) pure $U(3)$ local operators, namely \begin{eqnarray}\label{eq.laglam} \mL^{(1)} &=&-\frac{F^2\, \Lambda_1}{12} \partial^\mu X \partial_\mu X -\frac{F^2\, \Lambda_2}{12} X \bra \chi_- \ket\,, \end{eqnarray} in the sense that they do not appear in the $SU(3)$ $\chi$PT. These two operators can not be generated from the resonance Lagrangians in Eqs.~\eqref{eq.lagvector},~\eqref{eq.lagscalar} and~\eqref{eq.lagpscalar}. So we explicitly include the $\Lambda_1$ and $\Lambda_2$ operators in the phenomenological study. Moreover, we also include a remnant part of the $L_8$ term to account for the large uncertainties of the pseudoscalar resonances~\cite{Guo:2012ym,Guo:2012yt}. The complete one-loop two-pNGB scattering amplitudes involving the $\pi, K, \eta$ and $\eta'$ with tree-level resonance exchanges in the $U(3)$ chiral theory have been calculated in Ref.~\cite{Guo:2011pa}. The one-particle-irreducible (1PI) Feynman diagrams of the two-pNGB scattering amplitudes are illustrated in Fig.~\ref{fig.fyndiagsc}. The one-loop diagrams of the self-energies and the decay constants of the light mesons are given in Fig.~\ref{fig.fyndiagsefp}. The 1PI one-loop diagrams with tree-level resonance exchanges of the two-pNGB scalar form factors and the one-pNGB pseudoscalar form factors are shown in Fig.~\ref{fig.fyndiagff} and they are calculated in Refs.~\cite{Guo:2012ym,Guo:2012yt}. Within the $\delta$ expansion scheme, the conventional dimensional regularization method that is used in the $SU(2)$ and $SU(3)$ $\chi$PT~\cite{Gasser:1983yg,Gasser:1984gg}, is still valid in the $U(3)$ case, since the new scale $M_0$, behaves as $1/N_C$ in the large $N_C$ limit. While by treating the $\eta_0$ as a heavy field, the dimensional regularization will break the well-established chiral power-counting rule and different regularization methods have been correspondingly suggested to study the $\eta'$ in Refs.~\cite{Beisert:2001qb,Beisert:2002ad}. \begin{figure}[htbp] \centering \includegraphics[width=0.95\textwidth,angle=-0]{sc_diagram.eps} \caption{ 1PI Feynman diagrams for the meson-meson scattering up to one loop with explicit tree-level exchanges. } \label{fig.fyndiagsc} \end{figure} \begin{figure}[htbp] \centering \begin{minipage}[t]{0.45\textwidth} \centering \includegraphics[width=0.95\textwidth,angle=-0]{selfenergy.eps} \end{minipage} \begin{minipage}[t]{0.45\textwidth} \centering \includegraphics[width=0.95\textwidth,angle=-0]{Fp.eps} \end{minipage} \caption{ Feynman diagrams for the one-loop self-energy (the left two diagrams) and the decay constant (the right two diagrams) for the light pseudoscalar meson. } \label{fig.fyndiagsefp} \end{figure} \begin{figure}[htbp] \centering \begin{minipage}[t]{0.45\textwidth} \centering \begin{mdframed} \includegraphics[width=0.99\textwidth,angle=-0]{sff.eps} \end{mdframed} \end{minipage} \begin{minipage}[t]{0.45\textwidth} \centering \begin{mdframed} \includegraphics[width=0.99\textwidth,angle=-0]{pff.eps} \end{mdframed} \end{minipage} \caption{ Feynman diagrams for the scalar (left panel) and pseudoscalar (right panel) form factors. } \label{fig.fyndiagff} \end{figure} To incorporate the meson-meson nonperturbative strong interactions at the resonance energy region, the perturbative calculations elaborated in Figs.~\ref{fig.fyndiagsc} and \ref{fig.fyndiagff}, even after the explicit inclusion of the bare resonance exchanges, are not enough, because the chiral interactions between the meson pairs could increase rapidly when the energies lie above the two-meson thresholds. One efficient way to include such nonperturbative effects is to perform the unitarization of the amplitudes, and there are vast literatures on this subject, see recent comprehensive and pedagogical reviews in Refs.~\cite{Oller:2019opk,Oller:2020guq} and references therein for further details. The basic unitarization formalism for the two-body partial-wave scattering amplitudes that we use is an approximated version of the $N/D$ method~\cite{Oller:1998zr} \begin{eqnarray} \label{eq.ut} \mT_{IJ}(s) = \dfrac{N_{IJ}(s)}{1 - N_{IJ}(s)\,G_{IJ}(s)}\,, \end{eqnarray} where the subscripts $IJ$ denote the quantum numbers of the isospin and angular momentum. We will omit the subscripts $IJ$ in the next discussions for simplicity. By construction, the quantity $N(s)$ only contains the crossed-channel contributions (including the local contact terms as well) and the function $G(s)$ includes the right-hand cut contributions. Above the threshold the unitarity of the S matrix determines the imaginary part of the $G(s)$ function \begin{equation}\label{eq.img} {\rm Im}G(s) = \rho(s) \, \equiv \dfrac{q(s)}{8\pi\sqrt{s}} \,, \,\,\, (s>s_{\rm th})\, \end{equation} where $s_{\rm th}=(m_1+m_2)^2$ stands for the threshold of the two particles with masses $m_1$ and $m_2$, and the center of mass (CM) three momentum takes the form \begin{equation}\label{eq.q3} q(s) = \dfrac{\sqrt{[s-(m_1+m_2)^2][s-(m_1-m_2)^2]}}{2\sqrt{s}}\,. \end{equation} The K-matrix unitarization method includes only the imaginary part of the $G(s)$ function in its construction of the unitarized scattering amplitudes. Clearly by taking only the imaginary part of the $G(s)$ the analyticity is not preserved. One can improve the K-matrix description by using a once subtracted dispersion relation to include the real part of the $G(s)$ function. It turns out that by using the dimensional regularization method to calculate the one-loop two-point function we can also obtain the same result for the $G(s)$ function by replacing the divergent term with a free subtraction constant. The explicit expression takes the form~\cite{Oller:1998zr} \begin{eqnarray}\label{eq.gfunc} G(s)^{\rm DR} &=& -\frac{1}{16\pi^2}\left[ a(\mu^2) + \log\frac{m_2^2}{\mu^2}-x_+\log\frac{x_+-1}{x_+} -x_-\log\frac{x_--1}{x_-} \right]\,, \end{eqnarray} where $\mu$ is the regularization scale and will be set to $\mu=770$~MeV throughout, and $x_\pm$ are given by \begin{equation} x_\pm =\frac{s+m_1^2-m_2^2}{2s}\pm \frac{q(s)}{\sqrt{s}}\,. \end{equation} Notice that due to the inclusion of the minus sign of the $G(s)$ function, comparing with the definition in Refs.~\cite{Guo:2011pa,Guo:2012ym,Guo:2012yt}, the positive sign in the denominator becomes the minus sign in Eq.~\eqref{eq.ut}. The corresponding changes should also apply in the following discussions. By matching the unitarized amplitudes of Eq.~\eqref{eq.ut} and the perturbative chiral amplitudes order by order~\cite{Oller:2000fj}, one can obtain the expression for the $N(s)$ function \begin{eqnarray}\label{eq.defn} N_{IJ}(s) = T_{IJ}(s)^{\rm LO+Res+Loop} - T_{IJ}(s)^{\rm LO}\,G_{IJ}(s)\,T_{IJ}(s)^{\rm LO}\,, \end{eqnarray} where $T_{IJ}(s)$ stand for the partial-wave projections of the perturbative chiral amplitudes. The explicit expressions for the leading order (LO), resonance exchanges (Res) and loop diagrams (Loop) are given in Ref.~\cite{Guo:2011pa}. For the scalar form factors of the two-meson states, we use a similar unitarization method to resum the nonperturbative strong interactions between the two mesons~\cite{Guo:2012ym,Guo:2012yt} \begin{eqnarray} \mathcal{F}_{I}(s)= \frac{R_{I}}{1-N_{IJ}(s)\,G_{IJ}(s)}\,, \end{eqnarray} where $N_{IJ}(s)$ is given by Eq.~\eqref{eq.defn} and $R_{I}(s)$ can be obtained by matching the unitarized form factor $\mathcal{F}(s)$ and the perturbative chiral results \begin{eqnarray} R_{I}(s) = F_{I}(s)^{\rm LO+Res+Loop} - N_{IJ}(s)^{\rm LO}\,G_{IJ}(s)\,F_{I}(s)^{\rm LO}\,. \end{eqnarray} $F_{I}(s)$ stands for the scalar form factors from the perturbative chiral calculation with definite isospin number $I$. The explicit expressions for the chiral perturbative scalar form factors are given in Ref.~\cite{Guo:2012yt}. In the coupled-channel case with $n$ channels, one should understand the functions $N_{IJ}(s)$ and $G_{IJ}(s)$ as $n\times n$ matrices, and $R_{I}(s)$ as an $n$-row vector. \section{Resonance dynamics in the meson-meson scattering, form factor and spectral functions} In order to fix the unknown parameters, we have fitted a large amount of experimental and lattice data. The experimental data include the phase shifts and inelasticities from the $S$- and $P$-wave $\pi\pi \to \pi\pi$, $\pi\pi \to K\bar{K}$ and $\pi K \to \pi K$ scattering processes. Regarding the $\pi\eta$ case, the experimental measurement on this scattering process is still not available and there are only various $\pi\eta$ event distributions, which would require more theoretical inputs apart from the $\pi\eta$ scattering parameters. It turns out that the uncertainties of the $\pi\eta$ scattering amplitudes obtained from the fits to the event distributions alone are quite large~\cite{Guo:2011pa,Guo:2012ym,Guo:2012yt}. This motivates us to include the lattice finite-volume spectra from the Hadron Spectrum Collaboration~\cite{Dudek:2016cru} to further constrain the $\pi\eta$, $K\bar{K}$ and $\pi\eta'$ coupled-channel scattering amplitudes~\cite{Guo:2016zep}. Interested readers are recommended to go through Refs.~\cite{Guo:2011pa,Guo:2012yt,Guo:2016zep} for details of the fit results. Next we elaborate the resonance dynamics in the various physical processes. \begin{table}[htbp] \renewcommand{\tabcolsep}{0.05cm} \renewcommand{\arraystretch}{1.2} \begin{center} {\small \begin{tabular}{|c|c|c| |c|c|c|} \hline R & M (MeV) & $\Gamma/2$ (MeV) & R & M (MeV) & $\Gamma/2$ (MeV) \\ [0.1cm] \hline \hline $f_0(500)$& $442^{+4}_{-4}$ & $246^{+7}_{-5}$ & $\rho(770)$& $760^{+7}_{-5}$ & $71^{+4}_{-5}$ \\[0.1cm] \hline $f_0(980)$& $978^{+17}_{-11}$ & $29^{+9}_{-11}$ & $K^*(892)$& $892^{+5}_{-7}$ & $25^{+2}_{-2}$ \\[0.1cm] \hline $f_0(1370)$& $1360^{+80}_{-60}$ & $170^{+55}_{-55}$ & $\phi(1020)$& $1019.1^{+0.5}_{-0.6}$ & $1.9^{+0.1}_{-0.1}$ \\[0.1cm] \hline $K^*_0(800)$& $643^{+75}_{-30}$ & $303^{+25}_{-75}$ & $a_0(980)$ & $1019^{+22}_{-8}$ & $24^{+57}_{-17}$ \\[0.1cm] \hline $K^*_0(1430)$& $1482^{+55}_{-110}$ & $132^{+40}_{-90}$ & $a_0(1450)$ & $1397^{+40}_{-27}$ & $62^{+79}_{-8}$ \\[0.1cm] \hline \end{tabular} } \caption{ The masses and the half widths of the resonances appearing in the meson-meson scattering. The resonance poles of the $a_0(980)$ and $a_0(1450)$ are determined by fitting simultaneously the experimental $\pi\eta$ event distributions, the cross sections of $\gamma\gamma \to \pi\eta$ and also the lattice finite-volume spectra with the NLO chiral amplitudes~\cite{Guo:2016zep}. The other resonance poles are determined by fitting the experimental phase shifts and inelasticities~\cite{Guo:2012yt}. } \label{tab:pole} \end{center} \end{table} The resonance contents are briefly summarized in Table~\ref{tab:pole}, where both the mass (real part) and the half width (imaginary part) for each pole are given. It is interesting to dissect the roles of these resonance poles that are played in the various physical quantities, such as the form factors, spectral functions and semilocal duality from the scattering. In Fig.~\ref{fig.sffpipi}, we show two different types of $\pi\pi$ scalar form factors with the scalar densities of $\bar{u}u+\bar{d}d$ and $\bar{s}s$. The real parts, imaginary parts and the magnitudes from the two similar fit results in Refs.~\cite{Guo:2011pa,Guo:2012yt} are shown together in Fig.~\ref{fig.sffpipi}. It is clear that the $f_0(500)$ or the $\sigma$ resonance should be responsible for the low energy bump around $0.5$~GeV in the scalar form factor $F_{\pi\pi}^{\bar{u}u+\bar{d}d}(s)$, which is defined as \begin{eqnarray}\label{eq.defsffuudd} B\,F_{\pi\pi}^{\bar{u}u+\bar{d}d}(s) = \bra 0|\, \bar{u} u + \bar{d} d \,|\,(\pi\pi)_{I=0} \,\ket\,. \end{eqnarray} In contrast the broad $\sigma$ resonance barely contributes to the scalar form factor $F_{\pi\pi}^{\bar{s}s}(s)$, which is defined as \begin{eqnarray}\label{eq.defsffss} B\,F_{\pi\pi}^{\bar{s}s}(s) = \bra 0|\, \bar{s}s \,|\,(\pi\pi)_{I=0} \,\ket\,. \end{eqnarray} Interestingly, the $f_0(980)$ manifests itself as a dip in the $F_{\pi\pi}^{\bar{u}u+\bar{d}d}(s)$, but shows up as a peak in the $F_{\pi\pi}^{\bar{s}s}(s)$. While in the energy region above 1~GeV, we do not see any narrow structure appearing in both types of scalar form factors of $\pi\pi$. In this way, one can discern the role of the higher mass resonance $f_0(1370)$ played in the $\pi\pi$ scalar form factors. Other types of strangeness conserving two-meson scalar form factors defined as $\bra 0|\, \bar{q} \lambda_a q \,|\,PQ \,\ket$ are also calculated, with $\lambda_a$ the Gell-Mann matrices. The scalar spectral function, i.e. the imaginary part of the correlating two-point scalar-density function, can be given by the scalar form factors via \begin{eqnarray}\label{eq.impi} {\rm Im} \Pi_{S^{a}}(s) = \sum_i \rho_i(s) |F^{a}_i(s)|^2 \theta(s-s_i^{\rm th})\,, \end{eqnarray} where $i$ runs over the relevant two-meson channels, $s_i^{\rm th}$ stands for the threshold of the $i$th channel, $\theta(x)$ is the standard Heaviside step function and $\rho_i(s)$ is the kinematical factors defined in Eq.~\eqref{eq.img}. In Fig.~\ref{fig.sffimpi}, the scalar spectral functions of $a=0,3,8$ calculated with the parameters given in Refs.~\cite{Guo:2011pa,Guo:2012yt} are shown. In the chiral limit the scalar and pseudoscalar spectral functions follow a set of sum rules~\cite{speclsumrule} \begin{eqnarray} \int_0^{\infty} \big[ {\rm Im} \Pi_{X}(s) - {\rm Im} \Pi_{X'}(s) \big] ds = 0 \,, \end{eqnarray} with $X$ or $X'$ corresponding to either scalar or pseudoscalar light-flavor quark densities $\bar{q}\lambda_a q$ or $i\bar{q}\lambda_a \gamma_5 q$. These scalar and pseudoscalar spectral sum rules offer an important tool to study the complicated scalar resonance dynamics. It is advisory to split the integrals of the above sum rules into the nonperturbative and perturbative parts as \begin{eqnarray}\label{eq.specint} \int_0^{s_0}\big[ {\rm Im} \Pi_{X}(s) - {\rm Im} \Pi_{X'}(s) \big]ds + \int_{s_0}^{\infty}\big[ {\rm Im} \Pi_{X}(s) - {\rm Im} \Pi_{X'}(s) \big] ds = 0 \,, \end{eqnarray} where the nonperturbative integrands in the $0$ and $s_0$ region can be evaluated via Eq.~\eqref{eq.impi} and the operator product expansion (OPE) can be used to calculate the perturbative parts above $s_0$. According to the QCD OPE calculation~\cite{speclsumrule}, in the high energy perturbative region different types of the spectral integrals with $X$ or $X'$ $=S^{a}, P^{b}$ are equal in the chiral limit, which implies that the second integrals in Eq.~\eqref{eq.specint} are always zero in the chiral limit. This reduces the discussions of the spectral sum rules to the nonperturbative integrals in Eq.~\eqref{eq.specint}. Since there is lack of a rigorous criteria to set the separation scale $s_0$, we have chosen three different values for $s_0$, namely 2.5, 3.0 and 3.5~GeV$^2$, in our study. In practice, we find that the uncertainty caused by the ambiguity of $s_0$ is not that big, because the form factors and the spectral functions in our method tend to vanish in the high energy region, or at least they approach to rather small values in magnitudes, which can be clearly seen in Fig.~\ref{fig.sffimpi}. According to the curves in the figure, it seems that the broad $\sigma$ resonance contributes to both the spectral functions with $a=0$ and $a=8$, i.e. the isocalar $SU(3)$ singlet and octet currents, respectively. To be more specific, the height of the bump around the $\sigma$ resonance region in the isocalar singlet spectral function is around twice as that in the octet case. Similarly the $f_0(980)$ peak in the $a=0$ case is also higher than that in the $a=8$ case. While for the $f_0(1370)$ resonance, it dominantly contributes to the isocalar octet spectral function. For the isovector spectral function with $a=3$, both $a_0(980)$ and $a_0(1450)$ will contribute. Based on the fit results from Refs.~\cite{Guo:2011pa,Guo:2012yt}, which are obtained by only including the $\pi\eta$ event distributions to constrain the $\pi\eta$ scattering, we conclude that the $a_0(980)$ peak is much more prominent than the one from the $a_0(1450)$. Nevertheless there will be large uncertainties from those determinations. It will be interesting to make an analysis of the $\pi\eta$ form factor and to further explore its phenomenological application in a future work. \begin{figure}[htbp] \centering \includegraphics[width=0.95\textwidth,angle=-0]{figsff-ffa-all.eps} \caption{ Results for the scalar $\pi\pi$ form factors. The curves labeled as PRD11 and PRD12 are obtained by using the parameters from Ref.~\cite{Guo:2011pa} and Ref.~\cite{Guo:2012yt}, respectively. } \label{fig.sffpipi} \end{figure} \begin{figure}[htbp] \centering \includegraphics[width=0.95\textwidth,angle=-0]{figsffimpi-onlynew-symA.eps} \caption{ The scalar spectral functions with the definitions in Eq.~\eqref{eq.impi}. The left and right panels give the results with the parameters determined in Ref.~\cite{Guo:2012yt} by taking the physical masses and the chiral limit, respectively. } \label{fig.sffimpi} \end{figure} For the pseudoscalar spectral function, we will only consider the single-meson contributions, so that it is simply given by the $\delta$ functions \begin{eqnarray} {\rm Im} \Pi_{P^a}(s)= \sum_k \pi \delta(s-m_{P_k}^2)|H_k^a(s)|^2\,, \end{eqnarray} where $k$ runs over the proper intermediate pNGBs and the one-meson pseudoscalar form factor $H_k^a$ is defined as \begin{eqnarray} B\,H_k^{a}(s)=\bra 0 | i \bar{q} \lambda_a \gamma_5 q |P_k\ket\,. \end{eqnarray} The one-meson pseudoscalar form factors are calculated up to one-loop level, see the relevant Feynman diagrams in the right panel of Fig.~\ref{fig.fyndiagff}. In order to quantity the fulfillment of the spectral sum rules in Eq.~\eqref{eq.specint}, several quantities based on the nonperturbative spectral integrals are proposed \begin{eqnarray} \overline{W} &=& \frac{\sum_n W_n}{3\times 6}\,, \\ \sigma_W &=& \sqrt{\sum_n\frac{(W_n-\overline{W})^2}{3\times6 -1}}\,, \end{eqnarray} with \begin{eqnarray}\label{eq.defw} W_n = 16\pi \int_0^{s_0} {\rm Im} \Pi_{n}(s)\, ds\,,\,\, \big( n=\{S^{0,3,8},P^{0,3,8}\} \big)\,. \end{eqnarray} The value $\sigma_W/\overline{W}$ can be interpreted as a parameter to judge at which level the spectral sum rules are satisfied. The results by taking the fit parameters from Ref.~\cite{Guo:2012yt} and the physical masses for the mesons are \begin{eqnarray} \overline{W}=9.0\,,\quad \sigma_W= 1.5\,\, \Rightarrow \,\, \frac{\sigma_W}{\overline{W}} = 0.16\,, \end{eqnarray} which implies that the scalar and pseudoscalar spectral sum rules in Eq.~\eqref{eq.specint} are only violated at the level around $15\%$. However, the violation of such sum rules is more severe when taking the fit parameters from Ref.~\cite{Guo:2011pa}, which can reach around $30\%$. We have also tried to perform the chiral extrapolation of the spectral functions to the chiral limit case, which introduces more uncertainties due to the less controlled extrapolating behaviors of the subtraction constants in the unitarized amplitudes~\cite{Guo:2012ym,Guo:2012yt}. The scalar and pseudoscalar spectral sum rules discussed previously enable us to discern the underlying relations of the scalar and pseudoscalar mesons. On the other hand, the semilocal or the average duality from the meson-meson scattering provides another interesting theoretical framework to study the possible relations between the scalar and the vector resonances. The semilocal/average duality here refers to the relations between the hadronic system and the Regge theory in the fixed-$t$ scattering amplitudes. The key object is given by \begin{eqnarray}\label{eq.defsd} \int_{\nu_1}^{\nu_2} \nu^{-n}{\rm Im} T_{\rm t,Regge}^{I}(\nu,t) d\nu = \int_{\nu_1}^{\nu_2} \nu^{-n}{\rm Im} T_{\rm t,Hadron}^{I}(\nu,t) d\nu\,, \end{eqnarray} with $s,t,u$ the Mandelstam kinematical variables and $\nu=(s-u)/2$. The Regge amplitudes and the relevant phenomenological inputs are given in details in Refs.~\cite{bargerbook,RuizdeElvira:2010cs}. The general linear relations between the $t$- and $s$-channel isospin amplitudes can be found in many text books in literature, e.g. the one in Ref.~\cite{collinsbook}. Usually the averaging integration region $\nu_2 -\nu_1$ in Eq.~\eqref{eq.defsd} should be taken as $k\cdot{\rm GeV}^2$, with $k=1,2,3,\cdots$. The semilocal duality in Eq.~\eqref{eq.defsd} should in principle work well for the forward scattering amplitude, i.e. by taking $t=0$. It is reasonable to also consider small changes of the $t$, e.g., by taking $t=t_{\rm th}=4m_\pi^2$ for the $\pi\pi$ scattering. Regarding the exponent $n$ in Eq.~\eqref{eq.defsd}, clearly different values of $n$ allow us to probe the interactions in different energy ranges. We will study the duality by setting $n$ at several integers from 0 to 3, which are demonstrated to be proper for the interested energy region below 3~GeV$^2$~\cite{RuizdeElvira:2010cs}. In practice it turns out to be useful to consider the ratios of the average integrations for the $\pi\pi$ scattering, e.g., two different types of ratios are considered in Refs.~\cite{RuizdeElvira:2010cs,Guo:2012ym,Guo:2012yt} \begin{eqnarray}\label{eq.defsdr} R^I_n &=& \frac{ \int_{\nu_1}^{\nu_2} \nu^{-n}\, {\rm Im}\, T_{\rm t,Hadron}^{(I)}(\nu, t)\, d\nu} {\int_{\nu_1}^{\nu_3} \nu^{-n}\, {\rm Im}\, T_{\rm t,Hadron}^{(I)}(\nu, t)\, d\nu}\,, \\ F_n^{I I'} &=& \frac{ \int_{\nu_1}^{\nu_{\rm max} } \nu^{-n}\, {\rm Im}\, T_{\rm t,Hadron}^{(I)}(\nu, t)\, d\nu} {\int_{\nu_1}^{\nu_{\rm max}} \nu^{-n}\, {\rm Im}\, T_{\rm t,Hadron}^{(I')}(\nu, t)\, d\nu}\,,\label{eq.defsdf} \end{eqnarray} where $\nu_1, \nu_2$ and $\nu_3$ will be set at the $\pi\pi$ threshold, 1~GeV$^2$ and 2~GeV$^2$, respectively. Two different values for $\nu_{\rm max}=$ 1 or 2 GeV~$^2$ are tested in our study. Nevertheless, since we include the excited scalar resonances around $1.4$~GeV, it is meaningful to fix $\nu_{\rm max}=2$~GeV$^2$, instead of 1~GeV$^2$. Indeed the results with $\nu_{\rm max}=2$~GeV$^2$ turn out to be more reasonable than the case with $\nu_{\rm max}=1$~GeV$^2$. Therefore in the following discussions, we only show the results by taking $\nu_{\rm max}=2$~GeV$^2$. The integrands in the ratios~\eqref{eq.defsdr} and \eqref{eq.defsdf} can be decomposed into a set of the sum of the partial-wave amplitudes~\cite{RuizdeElvira:2010cs,Guo:2012yt}, which can be calculated with unitarized chiral approach in Eq.~\eqref{eq.ut}. In this way one can discern the roles of the resonances played in the semilocal duality. We focus on the situation of the fulfillment of semilocal duality for the $\pi\pi$ scattering here. The values for the ratios with different isospin numbers and $n$ are summarized in Table~\ref{tab:sdratios}. The smaller(larger) values of $n$ enable us to probe the fulfillment of the semilocal duality in the higher(lower) energy region. Apart from the scalar and vector resonances, it is found that the inclusion of the $D$-wave tensor resonances generally improves the fulfillment of the semilocal duality, except the $n=0$ case. To incorporate the $D$-wave contributions to the ratios~\eqref{eq.defsdr} and \eqref{eq.defsdf}, we follow Ref.~\cite{Ecker:2007us} to include the tree-level tensor exchanges. In addition, the other contributions to the $D$-wave amplitudes from the chiral loops, higher order contact terms and the crossed-channel scalar and vector exchanges are also taken into account. The additional parameters related to the tensor resonances are fixed by properly reproducing the $f_2(1270)$ pole~\cite{Guo:2012yt}. The ratios of $F_n^{20}$ and $F_n^{21}$ are particularly interesting to probe the semilocal duality, since the Regge contributions to the $t$-channel amplitudes with $I=2$ are greatly suppressed. As a result, the values of $F_n^{20}$ and $F_n^{21}$ should tend to zero according to the Regge theory. Therefore one would expect the cancellations between the scalar, vector and tensor resonance exchanges for the integrals with $I=2$ in the ratios of $F_n^{20}$ and $F_n^{21}$. By only including the scalar or vector resonance contributions, one obtains that the magnitude of $F_n^{21}$ should approach to 1, which can be considered as a value that signals the complete violation of the semilocal duality. For the $n=1,2,3$ cases, the magnitudes of the $F_n^{21}$ are smaller than 0.3, which indicate that the semilocal duality is well satisfied. Similar conclusion is also obtained for the $F_n^{20}$ case. Regarding the values of the $R_n^{I}$, generally speaking the semilocal duality is better satisfied for higher values of $n$ and we verify that the inclusion of the $D$-wave tensor resonance contributions plays relevant roles in the description of the semilocal duality. It is verified that the results when taking $t=0$ lead to quantitatively similar conclusions as the case with $t=4m_\pi^2$. \begin{table}[ht] \renewcommand{\tabcolsep}{0.05cm} \renewcommand{\arraystretch}{1.2} \begin{center} {\small \begin{tabular}{l|l|llllll} \hline n & && $R_n^0$ && $R_n^1$ && $F_n^{21}$ \\ [0.1cm] \hline \hline Regge & 0 && 0.225 && 0.325 && $\simeq 0$ \\[0.1cm] & 1 && 0.425 && 0.578 && $\simeq 0$ \\[0.1cm] & 2 && 0.705 && 0.839 && $\simeq 0$ \\[0.1cm] & 3 && 0.916 && 0.966 && $\simeq 0$ \\[0.1cm] \hline Hadrons & 0 && 0.410 && 0.453 && 0.531 \\[0.1cm] {\footnotesize $(S+P+D)$} & 1 && 0.653 && 0.694 && 0.154 \\[0.1cm] & 2 && 0.850 && 0.875 && 0.027 \\[0.1cm] & 3 && 0.954 && 0.965 && 0.225 \\[0.1cm] \hline \hline \end{tabular} } \caption{The results of the ratios defined in Eqs.~\eqref{eq.defsdr} and \eqref{eq.defsdf} to quantify the semilocal duality in the $\pi\pi$ scattering. All the numbers shown in this table are evaluated by taking $t=4m_\pi^2$ and $\nu_{\rm max}=2$~GeV$^2$. The entries in the hadronic parts include the contributions from the $S$, $P$ and $D$ waves. } \label{tab:sdratios} \end{center} \end{table} \section{$N_C$ behaviors of the resonances and various physical quantities} As mentioned previously, the $U(3)$ chiral theory provides a more appropriate theoretical framework to study the large $N_C$ dynamics of QCD than the $SU(3)$ case, since the singlet $\eta_0$ would become the ninth pNGB in the large $N_C$ and chiral limits. Indeed rather different $N_C$ evolutions for the masses of the $\pi, K$ and $\eta$ in the $U(3)$ chiral theory, which can be seen in Fig.~\ref{fig.ncpsmassandtheta}, have been found, when compared to the more or less flat behaviors in the $SU(3)$ case. The most significant change happens for the $\eta$ meson, which mass greatly decreases to 300~MeV and tends to become degenerate with the pion. For the kaon and $\eta'$, their masses still remain large in the large $N_C$ mainly due to the large physical strange quark mass. The leading order $\eta$-$\eta'$ mixing angle $\theta$ monotonically decreases and approaches to the ideal mixing value in the large $N_C$ limit. The $N_C$ evolutions of the masses for the pNGBs and the $\eta$-$\eta'$ mixing will be taken into account in the following discussions on the $N_C$ behaviors of the resonances and various physical quantities, including the spectral functions integrals and the ratios defined in the previous section to quantify the semilocal duality. It is mentioned that previous works on the study of $N_C$ behaviors of the resonances~\cite{nctrajmeson} have neglected the QCD $\uao$ anomaly effect. In order to explicitly show the influences of the QCD $\uao$ effect in the determinations of the $N_C$ trajectories for the resonances, we propose a way to imitate the $SU(3)$ results from the $U(3)$ case, which include the following operations: fixing the leading order mixing angle $\theta$ at zero throughout, freezing the $\pi, K$ and $\eta$ masses at their physical values and fixing the $\eta'$ mass at its leading order value. The results can be seen in Fig.~\ref{fig.ncpoleu3su3}, where the resonance poles of the $K_0^{*}(1430)$ and $K^*(892)$ are taken as examples to illustrate the differences from the $U(3)$ and $SU(3)$ chiral theories. Generally we can conclude that the QCD $\uao$ effects are not negligible and they have more important influences on the scalar resonances than the vector ones. \begin{figure}[htbp] \begin{center} \includegraphics[angle=0, width=0.95\textwidth]{fig-nc-masstheta-symA.eps} \caption{ The $N_C$ evolutions for the masses of the pNGBs (left panel) and the LO $\eta$-$\eta'$ mixing angle (right panel).} \label{fig.ncpsmassandtheta} \end{center} \end{figure} \begin{figure}[htbp] \begin{center} \includegraphics[angle=0, width=0.95\textwidth]{fig-nc-kvks-symA.eps} \caption{ Comparisons of the $N_C$ trajectories from the $U(3)$ and $SU(3)$ cases. } \label{fig.ncpoleu3su3} \end{center} \end{figure} According to the large $N_C$ QCD~\cite{largenc}, the mass and width for the conventional $\bar{q}q$ meson when $N_C \to \infty$ scale as $N_C^0$ and $1/N_C$, respectively. This fact provides us a qualitative criteria to study the inner structures of hadrons, once the $N_C$ trajectories of the resonance poles are known. In order to obtain the $N_C$ behaviors of the resonance poles, we need to provide the $N_C$ scaling rules for the various parameters in the unitarized scattering amplitudes. In Refs.~\cite{Guo:2012ym,Guo:2012yt} detailed discussions on the leading and subleading $N_C$ scalings of the relevant parameters are given. By taking into account the $N_C$ evolutions of the pNGBs' masses, the $\eta$-$\eta'$ mixing angle and the various parameters, the corresponding results for the $N_C$ trajectories of the scalar and vector resonances appearing in the $\pi\pi$ scattering are shown in Fig.~\ref{fig.ncpole}. The most important lesson we learn is that the poles of $f_0(980)$, $f_0(1370)$ and $\rho(770)$ fall down to the real axis when $N_C$ becomes large, indicating that at least there are some $\bar{q}q$ seeds inside these resonances in the large $N_C$ limit, which are also supported in our later calculations by using the generalized Weinberg compositeness relations in Refs.~\cite{Guo:2015daa,Gao:2018jhk}. To be more specific, it is verified that the width of the $\rho(770)$ behaves perfectly as $1/N_C$ for $N_C\geq3$ and its mass approaches to a constant for $N_C\geq 15$. Therefore the $N_C$ trajectory of the $\rho(770)$ clearly manifests itself as a standard $\bar{q}q$ resonance. For the $f_0(980)$ and $f_0(1370)$, although their $N_C$ trajectories show some peculiar trends when $N_C\leq 10$, the widths of both resonances approach to zero and their masses tend to constants for large values of $N_C$, implying that important $\bar{q}q$ components start to become dominant when $N_C\to \infty$. While for the $f_0(500)$ pole, its $N_C$ trajectory tends to go deep in the complex plane, instead of falling down to the real axis, i.e. the width of the $f_0(500)$ obviously does not behave as $1/N_C$ even at large $N_C$. This tells us that in our study the $\bar{q}q$ component does not seem playing dominant roles in the $f_0(500)$ when $N_C \to \infty$. \begin{figure}[htbp] \begin{center} \includegraphics[angle=0, width=0.95\textwidth]{fig-ncpole-symA.eps} \caption{ $N_C$ trajectories of the scalar and vector resonance poles in the $\pi\pi$ scattering.} \label{fig.ncpole} \end{center} \end{figure} The complex $N_C$ behaviors of the various resonances will be also reflected in the $N_C$ evolutions of the physical quantities, such as the form factors, spectral functions and semilocal dualities, etc. Regarding the $N_C$ evolutions of the spectral function sum rules, it is explicitly verified that the spectral integrals in Eq.~\eqref{eq.defw} obtained in the chiral limit, perfectly scale as $N_C$, as expected from the large $N_C$ QCD~\cite{Guo:2012ym,Guo:2012yt}. It is found that the subtle subleading $N_C$ scalings of the various parameters in the unitarized amplitudes also play relevant roles in the $N_C$ study of the semilocal duality. We show in Fig.~\ref{fig.ncf21} the $N_C$ evolutions of the ratios \eqref{eq.defsdf} by including the subleading $N_C$ scalings of the various parameters~\cite{Guo:2012yt}. The Regge theory predicts the vanishing values of the ratios $F_n^{21}$. Indeed the magnitudes of the $F_n^{21}$ ratios turn to be small for a wide range of $N_C$, indicating that there are cancellations between the contributions from different types of resonances. Nevertheless the cancellation pattern is not universal at different values of $N_C$. We find that rather different cancellation patterns happen for different values of $N_C$. E.g., in the physical case with $N_C=3$ the bump around the $\sigma$ resonance region gives dominant contribution that balances the one from the $\rho(770)$ in the ratio $F_2^{21}$. When $N_C=30$ the bump in the $\sigma$ region barely contributes any more and the contribution from the $\rho(770)$ to the $F_2^{21}$ also get greatly reduced. For the ratio $F_0^{21}$, the $\rho(770)$ contribution for all the values of $N_C$ is mainly canceled by the one from the $f_0(1370)$, which however barely affects the ratios with $n\ge 1$. Comparing with the left and right panels of Fig.~\ref{fig.ncf21}, we see that the $D$-wave tensor contributions generally improve the fulfillment of the semilocal duality, except the $n=0$ case. This indicates that more types of resonances would be needed to better fulfill the duality for the $n=0$ ratio. \begin{figure}[htbp] \begin{center} \includegraphics[angle=0, width=0.99\textwidth]{figncduality-F21sim-symA.eps} \caption{ The $N_C$ evolutions of the ratios $F_n^{21}$ defined in Eq.~\eqref{eq.defsdf}. The curves correspond to the results by including the subleading $N_C$ scalings of the various parameters~\cite{Guo:2012yt}. The left panel is to show the results by only considering the $S$ and $P$ waves. The right panel includes the contributions from the $D$ wave with tensor resonances, as well as the $S$ and $P$ waves. } \label{fig.ncf21} \end{center} \end{figure} \section{Summary and conclusions} Recently we have continuously pushed forward the consistent higher-order calculations in the $U(3)$ chiral effective field theory, which include not only the meson-meson scattering and the form factors briefly discussed here, but also the systematical calculations of the light pseudoscalar meson properties, the $\eta$-$\eta'$ mixing and their thermal behaviors. The $U(3)$ chiral effective field theory can be clearly used to investigate more subjects on the hadron phenomenologies than the $SU(3)$ case. The energy regions covered by the $U(3)$ theory in principle are higher than the $SU(3)$ one. It has been also demonstrated to be useful and efficient to analyze the various lattice data~\cite{Guo:2015xva,Guo:2016zep,Gu:2018swy}. In this note we mainly focus on the resonance dynamics in various physical quantities calculated in the $U(3)$ resonance chiral theory. Special attention has been paid to the $N_C$ evolutions of the resonance poles and various physical quantities, including the spectral functions and the ratios to quantify the semilocal duality. To properly take into account the nonperturbative strong interactions between the meson pairs, the approximated $N/D$ method is employed to unitarize the perturbative $U(3)$ chiral amplitudes and the scalar form factors. All the relevant scalar resonances below around $1.4$~GeV and almost all the ground vector resonances are obtained in a consistent theoretical framework in our study, including $f_0(500)$, $f_0(980)$, $f_0(1370)$, $K_0^*(800)$, $K_0^*(1430)$, $a_0(980)$, $a_0(1450)$, $\rho(770)$, $K^*(892)$ and $\phi(1020)$. The scalar spectral functions of the two-point correlators are calculated in terms of the unitarized scalar form factors and the pseudoscalar spectral functions are approximated by the single-meson contributions. Two kinds of ratios have been defined to quantify the semilocal duality, which gives us further insight into the underlying relations between different types of resonances. The $N_C$ trajectory curves of the resonance poles reveal that in the large $N_C$ the $\bar{q}q$ components seem playing marginal roles for the $f_0(500)$, $a_0(980)$ and $K_0^*(800)$, while there are strong evidences in our study that the $\bar{q}q$ seeds are important for the other resonances mentioned above. The scalar and pseudoscalar spectral sum rules are found to be rather well satisfied and perfectly scale as $N_C$ in the chiral limit. Although to a good extent the semilocal duality is generally fulfilled, the cancellation patterns among the contributions from the different resonances are found to be subtle at different values of $N_C$. We foresee that the $U(3)$ chiral theory can be further investigated to address many interesting phenomenological and lattice problems. \section*{Acknowledgement} I thank J.~A.~Oller and J.~Ruiz de Elvira for the pleasant collaborations and useful discussions on the topics covered here. This work is supported in part by the Natural Science Foundation of China(NSFC) under Grants Nos.~11975090 and 11575052, the Natural Science Foundation of Hebei Province under Contract No.~A2015205205.
\section{mass formalisms} The residual masses for the $s^P_l=\frac{1}{2}^-$ ($H$-sector), $s^P_l=\frac{1}{2}^+$ ($S$-sector), and $s^P_l=\frac{3}{2}^+$ ($T$-sector) charmed mesons have been derived within HMChPT framework including one loop chiral corrections \cite{ms05,Alhakami20}. They can be written as \cite{Alhakami,Alhakami20} \begin{equation} \begin{split}\label{rmassesN} &m^r_{D_{(s)}}=\eta_H-\frac{3}{4}\xi_H+\alpha_{(s)} L_{H}-\beta_{(s)} F_{H}+\Sigma_{D_{(s)}},\\[1ex] &m^r_{D^*_{(s)}}=\eta_H+\frac{1}{4}\xi_H+\alpha_{(s)} L_{H}+\frac{1}{3} \beta_{(s)} F_{H}+\Sigma_{D^*_{(s)}},\\[1ex] &m^r_{D^*_{(s)0}}=\eta_S-\frac{3}{4}\xi_S+\alpha_{(s)} L_{S}-\beta_{(s)} F_{S}+\Sigma_{D^*_{(s)0}},\\[1ex] &m^r_{D^\prime_{(s)1}}=\eta_S+\frac{1}{4}\xi_S+\alpha_{(s)} L_{S}+\frac{1}{3} \beta_{(s)} F_{S}+\Sigma_{D^\prime_{(s)1}},\\[1ex] &m^r_{D_{(s)1}}=\eta_T-\frac{5}{8}\xi_T+\alpha_{(s)} L_{T}-\frac{5}{6} \beta_{(s)} F_{T}+\Sigma_{D_{(s)1}},\\[1ex]\ &m^r_{D^*_{(s)2}}=\eta_T+\frac{3}{8}\xi_T+\alpha_{(s)} L_{T}+\frac{1}{2}\beta_{(s)} F_{T}+\Sigma_{D^*_{(s)2}}, \end{split} \end{equation} where $\alpha_{(s)}$ and $\beta_{(s)}$ are $\alpha=-1/3$, $\alpha_s=2/3$, $\beta=-1/4$, $\beta_s=1/2$; the subscript $s$ stands for the strange charmed meson. The $\eta$ and $L$ ($\xi$ and $F$) parameters in $H$, $S$, and $T$ sectors respect (violate) heavy quark spin-flavor symmetry. Note that the parameter $F_X$ (in this work and in \cite{Alhakami20}) has the same definition of the parameter $T_X$ in \cite{Alhakami}; we use $F$ instead of $T$ to avoid confusion with $T$-sector states. Masses in Eq.~\eqref{rmassesN} do not contain terms that only break heavy quark flavor symmetry. The self-energy corrections, which are represented by $\Sigma_{D^\pm}$, are nonlinear functions of the mass difference of charmed mesons and masses of the light pseudoscalar mesons $\pi$, $\eta$, and $K$. They depend quadratically on five ($g$, $g^\prime$,$g^{\prime\prime}$, $h$, and $h^\prime$) couplings. The $g$, $g^\prime$, and $g^{\prime\prime}$ couplings govern the strong interactions among states in the $s^P_l=\frac{1}{2}^-$, $s^P_l=\frac{1}{2}^+$, and $s^P_l=\frac{3}{2}^+$ doublets, respectively. The $h$ ($h^\prime$) coupling parametrizes the strong interactions of $s^P_l=\frac{1}{2}^-$ and $s^P_l=\frac{1}{2}^+$ ($s^P_l=\frac{1}{2}^+$ and $s^P_l=\frac{3}{2}^+$) mesons; for an illustration see Fig.~\ref{coupling}. The explicit expressions of self energies for the excited $s^P_l=\frac{1}{2}^+$ and $s^P_l=\frac{3}{2}^+$ charmed meson states are given in the Appendix of \cite{Alhakami20}. For the $s^P_l=\frac{1}{2}^-$ ground state, we use expressions given in Appendix of \cite{Alhakami}. \begin{SCfigure} \centering \caption{A representation for the coupling constants entering the one-loop corrections. The $g$, $g^\prime$, and $g^{\prime\prime}$ couplings govern the strong interactions among states in the $s^P_l=\frac{1}{2}^-$, $s^P_l=\frac{1}{2}^+$, and $s^P_l=\frac{3}{2}^+$ doublets, respectively. The $h$ ($h^\prime$) coupling parametrizes the strong interactions of $s^P_l=\frac{1}{2}^-$ and $s^P_l=\frac{1}{2}^+$ ($s^P_l=\frac{1}{2}^+$ and $s^P_l=\frac{3}{2}^+$) mesons.} \label{coupling} \includegraphics[width=5cm,height=7cm]{couplings} \end{SCfigure} The chiral loop functions describing the interaction of heavy mesons with same (opposite) parity are denoted by $K_1$ ($K_2$). They are given, in the $\mathrm{\overline{MS}}$-scheme, by \cite{Alhakami,Alhakami20} \begin{equation}\label{K1} \begin{split} K_1(\omega, m_i,\mu)&=\frac{1}{16 \pi^2}\left[(-2\omega^3+3m_i^2\omega)\mathrm{ln}\left(\frac{m_i^2}{\mu^2}\right)-4(\omega^2- m_i^2)F(\omega,m_i)+\frac{16}{3}\omega^3-7\omega\, m_i^2\right],\\[2ex] K_2(\omega, m_i,\mu)&=\frac{1}{16 \pi^2} \left[ (-2\omega^3+ m_i^2\omega)\mathrm{ln}\left(\frac{m_i^2}{\mu^2}\right)-4\omega^2 F(\omega,m_i)+4\omega^3- \omega\, m_i^2\right], \end{split} \end{equation} where the arguments $\omega$, $m_i$, and $\mu$ represent the heavy meson mass differences, the masses of the Goldstone bosons, and the renormalization scale, respectively. The function $F(\omega,m_i)$ is given by \begin{equation} F(\omega,m_i)=\left\{ \begin{array}{c c}-\sqrt{m_i^2-\omega^2} \cos^{-1}(\frac{\omega}{m_i}), & \mbox{$m_i^2>\omega^2,$} \\[2ex] \sqrt{\omega^2-m_i^2}[i \pi-\cosh^{-1}(-\frac{\omega}{m_i})], & \mbox{$\omega<-m_i,$}\\[2ex] \sqrt{\omega^2-m_i^2}\cosh^{-1}(\frac{\omega}{m_i}), & \mbox{$\omega>m_i.$} \end{array} \right. \end{equation} The HMChPT results for charmed mesons, Eq.~\eqref{rmassesN}, can be used to obtain the predictions for the analog beauty meson spectrum. For this, the heavy quark spin violating ($\xi$ and $F$) parameters should be rescaled by $\frac{m_c}{m_b}$. Following Ref. \cite{Alhakami}, we use $\mathrm{\overline{MS}}$ masses, $m_b=4.18$ GeV and $m_c=1.27$ GeV, to define the rescaling factor $m_c/m_b=0.304(50)$, where an extra uncertainty of $O(\Lambda_{\text{QCD}})$ is added to cover the spread of $b$ and $c$ masses resulting from different schemes \cite{pdg12}. The HMChPT masses for the beauty mesons read \begin{equation} \begin{split}\label{rmassesNb} &m^r_{B_{(s)}}=\eta_H-\frac{3}{4}\xi^b_H+\alpha_{(s)} L_{H}-\beta_{(s)} F^b_{H}+\Sigma_{B_{(s)}},\\[1ex] &m^r_{B^*_{(s)}}=\eta_H+\frac{1}{4}\xi^b_H+\alpha_{(s)} L_{H}+\frac{1}{3} \beta_{(s)} F^b_{H}+\Sigma_{B^*_{(s)}},\\[1ex] &m^r_{B^*_{(s)0}}=\eta_S-\frac{3}{4}\xi^b_S+\alpha_{(s)} L_{S}-\beta_{(s)} F^b_{S}+\Sigma_{B^*_{(s)0}},\\[1ex] &m^r_{B^\prime_{(s)1}}=\eta_S+\frac{1}{4}\xi^b_S+\alpha_{(s)} L_{S}+\frac{1}{3} \beta_{(s)} F^b_{S}+\Sigma_{B^\prime_{(s)1}},\\[1ex] &m^r_{B_{(s)1}}=\eta_T-\frac{5}{8}\xi^b_T+\alpha_{(s)} L_{T}-\frac{5}{6} \beta_{(s)} F^b_{T}+\Sigma_{B_{(s)1}},\\[1ex]\ &m^r_{B^*_{(s)2}}=\eta_T+\frac{3}{8}\xi^b_T+\alpha_{(s)} L_{T}+\frac{1}{2}\beta_{(s)} F^b_{T}+\Sigma_{B^*_{(s)2}}, \end{split} \end{equation} where $\xi^b_X=\frac{m_c}{m_b}\xi_X$ and $F^b_X=\frac{m_c}{m_b}F_X$. The one-loop corrections, $\Sigma_{B^\pm}$, are now nonlinear functions of the beauty meson mass differences and masses of the light Goldstone particles. By fitting parameters in Eq.~\eqref{rmassesN} to charmed spectrum, we can use Eq.~\eqref{rmassesNb} to predict the mass splittings in the beauty sector. To extract the absolute masses of the excited beauty mesons, other leading power corrections $O(\Lambda_{\text{QCD}}/m_c-\Lambda_{\text{QCD}}/m_b)$ to the HQ limit should be included to HMChPT masses. Such missing terms are needed to get the correct mass splittings among the different doublets in the predicted beauty meson spectrum. We will elaborate how to properly include them to our masses. For this, let us first recall heavy meson masses in heavy quark effective theory (HQET). In a compact form, the mass of a heavy meson $X$ containing a single heavy quark flavor $Q$ can be expressed up to the leading power corrections to the HQ limit as \cite{hqet} \begin{equation}\label{hqet} m_{X^{(Q)}_\pm}=m_Q+\bar{\Lambda}^X-\frac{\lambda_{X,1}}{2m_Q}\pm n_\mp\frac{\lambda_{X,2}}{2m_Q}, \end{equation} where $n_\pm=2J_\pm+1$ gives the number of spin states in the meson $X_\pm$. The energy of the light degrees of freedom in the HQ limit is represented by the nonperturbative parameter $\bar{\Lambda}^X$. In the $SU(3)$ limit, this parameter has the same value for all particles in a given $s^P_l$ doublet. If $SU(3)$ breaking is considered, it is different for nonstrange, $\bar{\Lambda}_n^X$, and strange, $\bar{\Lambda}_s^X$, mesons. The other nonperturbative parameters $\lambda_{X,1}$ and $\lambda_{X,2}$ determine the heavy quark kinetic energy and the chromomagnetic energy, respectively. They have the same values for all particles in a given $s^P_l$ heavy quark doublet. As kinetic energy is a positive quantity, the sign of $\lambda_{X,1}$ in Eq.~\eqref{hqet} should be negative. In Eq.~\eqref{hqet}, the third term, which contains $\lambda_{X,1}$, breaks heavy quark flavor symmetry, but it leaves the heavy quark spin symmetry intact. However, the last term, which has $\lambda_{X,2}$, breaks both heavy quark flavor and spin symmetries. The spin averaged mass, $\bar{m}_X$, weighted by the number of helicity states \begin{equation}\label{avg} \bar{m}^{(Q)}_X=\frac{n_-m_{X^{(Q)}_-}+n_+m_{X^{(Q)}_+}}{n_++n_-}, \end{equation} is independent of spin symmetry violating parameters, i.e., $\lambda_{X,2}$ ($\xi$ and $F$) in Eq.~\eqref{hqet} [Eq.~\eqref{rmassesN}]. By using Eqs.~\eqref{hqet} and \eqref{avg}, one can define the difference of spin averaged masses in the beauty sector, \begin{equation}\label{dbavg} \begin{split} \bar{m}^{(b)}_{A_{(s)}}-\bar{m}^{(b)}_{H_{(s)}}&=\bar{m}^{(c)}_{A_{(s)}}-\bar{m}^{(c)}_{H_{(s)}}+\delta^{(s)}_{AH}, \end{split} \end{equation} where $A\in \{S,T\}$, and \begin{equation}\label{dbavgg} \delta_{AH}^{(s)}=(\lambda_{A,1}-\lambda_{H,1})^{(s)}\left(\frac{1}{2m_c}-\frac{1}{2m_b}\right), \end{equation} represents the leading $O(\Lambda_{\text{QCD}}/m_c-\Lambda_{\text{QCD}}/m_b)$ corrections. Such corrections to the HQ limit are missing in HMChPT formalisms [Eq.~\eqref{rmassesN}]. Therefore, one has to incorporate them properly into HMChPT masses for the beauty mesons. It should be noted that the HMChPT masses in Eq.~\eqref{rmassesN} not only involve effects to first order in the inverse heavy quark mass, $1/m_Q$, as those of HQET in Eq.~\eqref{hqet}, but also involve effects due to the light quark mass, $m_q$, and $m_q/m_Q$ terms. These terms, which are buried in the ($\eta$, $\xi$, $L$, $F$) parameters of Eq.~\eqref{rmassesN}, scale as $\Lambda_{\text{QCD}}^2/m_Q\propto \Delta \sim Q$ and $m_q\sim Q^2$, where $Q\sim m_\pi,~m_K, m_\eta$ and $\Delta$ is hyperfine splitting operator; for technical details see Refs. \cite{Alhakami,Alhakami20}. As HMChPT masses are defined up to third order, we add the factor, \begin{equation}\label{dbavggg} \begin{split} \Delta^{(s)}_{AH}=\delta^{(s)}_{AH}\left(1+a\frac{M}{\Lambda_\chi}+b\frac{M^2}{\Lambda^2_\chi}\right), \end{split} \end{equation} to the excited $s^P_l=\frac{1}{2}^+$ and $s^P_l=\frac{3}{2}^+$ beauty meson masses, see Eq.~\eqref{rmassesNbD} below. The chiral symmetry breaking scale is $\Lambda_\chi \simeq 1$ GeV and $M$ is $m_\pi$ ($m_K$) for nonstrange (strange) splittings. The magnitude and relative sign of the numerical factors $a$ and $b$ in the above expansion [Eq.~\eqref{dbavggg}] can be chosen to reproduce the observed beauty meson spectrum. It is found that for $a$ and $b$ with values less than unity, good results can be obtained; the difference between the observed and predicted masses for the excited $j^P_l=\frac{3}{2}^+$ states is very small, i.e., of order few MeV. Theoretical results are not much affected when taking any values for $a$ and $b$ less than unity. Here, we choose $a=0.82$ and $b=-0.18$, which provides more accurate results. In light of the foregoing, one can reexpress the HMChPT masses for the beauty mesons in Eq. ~\eqref{rmassesNb} as \begin{equation}\label{rmassesNbD} \begin{split} &m^r_{B_{(s)}}=\eta_H-\frac{3}{4}\xi^b_H+\alpha_{(s)} L_{H}-\beta_{(s)} F^b_{H}+\Sigma_{B_{(s)}},\\[1ex] &m^r_{B^*_{(s)}}=\eta_H+\frac{1}{4}\xi^b_H+\alpha_{(s)} L_{H}+\frac{1}{3} \beta_{(s)} F^b_{H}+\Sigma_{B^*_{(s)}},\\[1ex] &m^r_{B^*_{(s)0}}=\Delta^{(s)}_{SH}+\eta_S-\frac{3}{4}\xi^b_S+\alpha_{(s)} L_{S}-\beta_{(s)} F^b_{S}+\Sigma_{B^*_{(s)0}},\\[1ex] &m^r_{B^\prime_{(s)1}}=\Delta^{(s)}_{SH}+\eta_S+\frac{1}{4}\xi^b_S+\alpha_{(s)} L_{S}+\frac{1}{3} \beta_{(s)} F^b_{S}+\Sigma_{B^\prime_{(s)1}},\\[1ex] &m^r_{B_{(s)1}}=\Delta^{(s)}_{TH}+\eta_T-\frac{5}{8}\xi^b_T+\alpha_{(s)} L_{T}-\frac{5}{6} \beta_{(s)} F^b_{T}+\Sigma_{B_{(s)1}},\\[1ex]\ &m^r_{B^*_{(s)2}}=\Delta^{(s)}_{TH}+\eta_T+\frac{3}{8}\xi^b_T+\alpha_{(s)} L_{T}+\frac{1}{2}\beta_{(s)} F^b_{T}+\Sigma_{B^*_{(s)2}}, \end{split} \end{equation} Both expressions [Eqs. ~\eqref{rmassesNb} and \eqref{rmassesNbD}] will be used in the next section to predict the mass splittings in the beauty sector. The absolute masses for the beauty mesons will also be predicted using Eq. ~\eqref{rmassesNbD}. To proceed we need to extract the values of $(\lambda_{A,1}-\lambda_{H,1})^{(s)}$ and $\delta^{(s)}_{AH}$ using Eqs.~\eqref{dbavg} and \eqref{dbavgg}. From the spectroscopy of the $s^P_l=\frac{1}{2}^-$ and $s^P_l=\frac{3}{2}^+$ charmed and beauty mesons, one finds $\lambda_{T,1}-\lambda_{H,1}=-0.197~\text{GeV}^2$ ($\delta_{TH}=-54$ MeV) for nonstrange particles and $\lambda^s_{T,1}-\lambda^s_{H,1}=-0.174~\text{GeV}^2$ ($\delta^s_{TH}=-47.7$ MeV) for strange ones. The negative sign shows that the kinetic energy of the heavy quark in the excited $s^P_l=\frac{3}{2}^+$ mesons is larger than that in the $s^P_l=\frac{1}{2}^-$ ground state. From Eq.~\eqref{dbavggg}, the corrections are found to be $\Delta_{TH}=-60$ MeV for nonstrange beauty sector and $\Delta^s_{TH}=-65$ MeV for strange one. The extracted values for $\Delta^{(s)}_{TH}$ amount to lowering the masses of the excited $s^P_l=\frac{3}{2}^+$ beauty mesons, see Eq.~\eqref{rmassesNbD}. The nonperturbative parameter $\lambda^{(s)}_{S,1}$ is unknown, and, hence, we cannot extract $\Delta^{(s)}_{SH}$. In Refs. \cite{ms05,HYu}, the value $\lambda^{(s)}_{S,1}-\lambda^{(s)}_{H,1}\approx\lambda^{(s)}_{T,1}-\lambda^{(s)}_{H,1}$ is considered by assuming that the kinetic energy of the heavy quark in the $s^P_l=\frac{1}{2}^+$ states is comparable to that of $s^P_l=\frac{3}{2}^+$ states. To cover all possibilities for the value of the kinetic energy of heavy quark in the $s^P_l=\frac{1}{2}^+$ states and not limit it to values that are comparable to that of the $s^P_l=\frac{3}{2}^+$ states, we consider that the kinetic energy of heavy quark in the $s^P_l=\frac{1}{2}^+$ states lying between those of the $s^P_l=\frac{1}{2}^-$ and $s^P_l=\frac{3}{2}^+$ states and add a large uncertainty that measures our ignorance of $\lambda^{(s)}_{S,1}$. Thus, we take $(\lambda_{S,1}-\lambda_{H,1})^{(s)}=-0.09(6)~\text{GeV}^2$. From Eqs.~\eqref{dbavgg} and \eqref{dbavggg}, the beauty nonstrange (strange) $s^P_l=\frac{1}{2}^+$ masses in Eq.~\eqref{rmassesNbD} are lowered by $\Delta_{SH}=-27(18)$ MeV [$\Delta^{s}_{SH}=-33(22)$ MeV]. At our level of precision, the uncertainties due to experimental masses and higher order $O(\Lambda_{\text{QCD}}/m_c-\Lambda_{\text{QCD}}/m_b)$ corrections are negligible. \section{results and discussion} Before presenting our results, let us first illustrate the fitting and predicting methods. Here, we follow the approach employed in \cite{Alhakami} to fit $\eta$, $\xi$, $L$, and $F$ parameters and predict the beauty meson masses. The fitting method is essentially based on using physical masses of charmed mesons to evaluate the chiral loop functions, which ensures that the imaginary parts of self-energies (loop functions) are correctly related to the observed decay widths. This makes fit linear and hence helps to extract unique values for the $\eta$, $\xi$, $L$, and $F$ parameters. Because of computing loop integrals using physical masses, the obtained values for the parameters will contain contributions beyond $\mathcal{O}(Q^3)$. The generated higher order $\mu$-dependent terms cannot properly be renormalized using $\mu$-dependence counterterms of the theory. Therefore, a theoretical error coming from such higher order terms should be estimated. As in \cite{Alhakami}, the $\beta$ functions of the $\eta$, $\xi$, $L$, and $F$ parameters will be defined to estimate the contributions from the generated higher-order terms. In the fit, we use twelve masses of strange and nonstrange charmed mesons \cite{pdg12}, see Fig. \ref{Ddoublets}. We work in the isospin limit. We only average the masses of the well-determined charmed nonstrange mesons. The $\frac{1}{2}^+$ charmed nonstrange mesons, however, are poorly determined. So, we instead use the masses of the excited $D_0^{*0}$, 2300(19) MeV \cite{pdg12}, and $D^{0\prime}_1$, 2427(26)(25) MeV \cite{19}, mesons. For Goldstone particles, $m_{\pi}=140$ MeV, $m_K = 495$ MeV, and $m_\eta = 547$ MeV are used. Our results smoothly change with the normalization scale $\mu$; consequently, performing calculations at any other values of the normalization scale will not make much difference. In our numerical calculations, we set the normalization scale to the average of pion and kaon masses, $\mu = 317$ MeV, as in \cite{Alhakami}. The numerical values for the couplings can be extracted using available data on strong decays of charmed mesons. The coupling constant $g$ at tree level can be extracted using the measured width of $D^{*\pm}$ \cite{pdg12}; this gives $g=0.5672(80)$. For the $h$ coupling, we use $h=0.514(17)$, which is extracted from the width of $D^{*\pm}_0$ \cite{cheng}. The $g^\prime$, $h^\prime$, and $g^{\prime\prime}$ couplings are unknown experimentally. We, therefore, use lattice QCD result for $g^\prime=-0.122(8)(6)$ \cite{glattice} and restrict $h^\prime$ and $g^{\prime\prime}$ to lie between 0 and 1; so, one can study the variation of the calculated masses with the $h^\prime$ and $g^{\prime\prime}$ couplings. By confronting our resulting masses against experiments, these unmeasured couplings will be constrained to lie in a narrow range making our theory much reliable. As our calculations are performed at different $h^\prime$ and $g^{\prime\prime}$, we will only show the fitting method considering $h^\prime=0.30$ and $g^{\prime\prime}=0.03$. In Eq.~\eqref{rmassesN}, $m_A^r$ represents the residual mass of the charmed meson $A$, which is taken to be the difference between the experimental mass and an arbitrarily chosen reference mass of $O(m_c)$ \cite{ms05}. Here we choose $m_{D^*}$ as a reference, which yields the following central values for charmed meson residual masses \cite{pdg12,19} \begin{equation}\label{rm0} \begin{split} m^r_D&=-141.32, ~~m^r_{D^*}=0,~~~~~~~~~m^r_{D_s}=-40.22,\\ m^r_{D^*_s}&= 103.65,~~~~m^r_{D_0^*}=291.45,~~~m^r_{D^\prime_1}= 418.45,\\ m^r_{D^*_{s0}}&=309.25,~~~ m^r_{D^\prime_{s1}}=450.95,~~~m^r_{D_1}=413.45,\\ m^r_{D_{s1}}&= 526.56,~~~~m^r_{D^*_2}=454.5,~~~~ m^r_{D^*_{s2}}=560.55 \end{split} \end{equation} in MeV units. By fitting the mass expressions in Eq.~\eqref{rmassesN} to the corresponding empirical masses in Eq.~\eqref{rm0}, one obtains \begin{equation}\label{rm1} \begin{split} \eta_H&=104(7),~~~~~~\xi_H=149(5),\\ L_H&=212(14),~~~~F_H=-44(11),\\ \eta_S&=385(19),~~~~~\xi_S=138(27),\\ L_S&=20(31),~~~~~F_S=12(42),\\ \eta_T&=490(1),~~~~~~\xi_T=41(1),\\ L_T&=119(1),~~~~~F_T=-4(2), \end{split} \end{equation} which are given in MeV units. The fit results are obtained by computing the chiral loop functions in Eq.~\eqref{rmassesN} using physical masses and couplings, as mentioned above. The errors use to get this fit are the experimental errors on masses and couplings, the lattice QCD error on $g^\prime$, and the theoretical error that we have estimated from the $\beta$ functions of the parameters. The uncertainty in the nonstrange $D_0^{*0}$ and $D^{0\prime}_1$ masses gives rise to the large uncertainties seen in $\eta_S,~\xi_S,~L_S$, and $F_S$ parameters. The charm sector results on HMChPT parameters, Eq.~\eqref{rm1}, can be used in Eq.~\eqref{rmassesNb} [Eq.~\eqref{rmassesNbD}] to predict the mass splittings (the mass splittings and absolute masses) in the beauty sector. For an illustration, we will use Eq.~\eqref{rmassesNbD} to extract the beauty meson masses. Following \cite{Alhakami}, one can choose the ground state, $B$, as a reference mass to define eleven independent mass splittings, $\Delta m_A=m_A-m_B$, where $A\in \{B^*,B_s,B^*_s,B^*_0,B^\prime_1,B^*_{s0},B^\prime_{s1}, B_1,B^*_2,B_{s1},B^*_{s2}\}$. As the self-energies represent nonlinear functions of the beauty meson mass differences, these independent splittings form nonlinear equations. An iterative method is utilized to solve them starting from the tree-level masses. Adding the mean value of the observed mass $m_B$, which are chosen as a reference mass in our calculations, to the predicted mass splittings, yields \begin{equation} \begin{split}\label{predict} m_{B^*}&=5325(9),~~~~~~~~~~~~m_{B_s}=5369(13),\\ m_{B_s^*}&=5415(15),~~~~~~~~~~m_{B_0^*}=5681(25)(18),\\ m_{B_1^\prime}&=5719(26)(18),~~~~m_{B_{s0}^*}=5711(32)(22),\\ m_{B_{s1}^\prime}&=5756(31)(22),~~~~~m_{B_1}=5726(13),\\ m_{B_2^*}&=5739(14),~~~~~~~~~~m_{B_{s1}}=5830(14),\\ m_{B_{s2}^*}&=5840(14) \end{split} \end{equation} in MeV units. The errors (first for the $s^P_l=\frac{1}{2}^+$ masses) come from the uncertainties in the charmed masses, coupling constants, lattice QCD computation on $g^\prime$, rescaling factor, and estimated theoretical error. The first error on the predicted masses of the excited $s^P_l=\frac{1}{2}^+$ beauty mesons is dominated by the uncertainty in $D_0^{*0}$ and $D^{0\prime}_1$ masses and the second is the uncertainty in $\lambda^{(s)}_{S,1}$. To investigate the influence of virtual loop effects on the predicted beauty meson spectrum, our calculations are performed considering different input values for $h^\prime$ and $g^{\prime\prime}$. The spectrum of the $s^P_l=\frac{1}{2}^-$ and $s^P_l=\frac{1}{2}^+$ beauty mesons depend only on the $h^\prime$ coupling. Both $h^\prime$ and $g^{\prime\prime}$ couplings, however, affect the excited $s^P_l=\frac{3}{2}^+$ beauty meson masses. The results can be justified by confronting them with the experiments. \begin{figure}[h!] \includegraphics[width = 0.7\textwidth]{T5gpp} \caption{The predicted hyperfine splittings (upper panel) and $SU(3)$ flavor splittings (lower panel) in the excited $s^P_l=\frac{3}{2}^+$ doublets using HMChPT masses in Eqs.~\eqref{rmassesNb} and \eqref{rmassesNbD} plotted against $g^{\prime\prime}$. The associated errors include the experimental errors on the charmed masses and coupling constants, the error from the lattice QCD calculations of $g^\prime$, the error from the input parameter $\frac{m_c}{m_b}$, and the estimated theoretical error. Different symbols are given to the experiment and two theoretical predictions using HMChPT masses in Eqs.~\eqref{rmassesNb} and \eqref{rmassesNbD} according to the key in the ($m_{B^*_{s2}}-m_{B^*_2}$) plot.} \label{Tsector} \end{figure} We first look at the dependence of the higher excited $s^P_l=\frac{3}{2}^+$ states on $g^{\prime\prime}$. To neglect loops effect from the virtual excited $s^P_l=\frac{1}{2}^+$ states, the $h^\prime$ coupling is set to zero. As shown in Fig.~\ref{Tsector}, the self-energy effects within $s^P_l=\frac{3}{2}^+$ states, which are parametrized by $g^{\prime\prime}$, have a strong impact on the predicted masses. The calculated masses of $B_1$ and $B_{s1}$ ($B^*_2$ and $B^*_{s2}$) mesons significantly increase (decrease) as $g^{\prime\prime}$ increases. The observations and predictions are in a good agreement for small values of the coupling, $g^{\prime\prime}< 0.10$. At $g^{\prime\prime}\simeq 0.15$ ($g^{\prime\prime}\simeq 0.25$), the excited $B_{s1}$ and $B^*_{s2}$ ($B_1$ and $B^*_2$) states become degenerate; which in turn implies that the predictions are unreliable in the limit $g^{\prime\prime}>0.10$. Accordingly, $g^{\prime\prime}$ should be constrained to lie between $0$ and $0.10$. Hyperfine splittings are independent of $O(\Lambda_{\text{QCD}}/m_c-\Lambda_{\text{QCD}}/m_b)$ corrections, and this is confirmed in our theoretical results. However, there is no exact cancellation between the $O(\Lambda_{\text{QCD}}/m_c-\Lambda_{\text{QCD}}/m_b)$ corrections to nonstrange and strange heavy meson masses. Such corrections lower the predicted $SU(3)$ splittings [compare results from Eqs.~\eqref{rmassesNb} and \eqref{rmassesNbD}] by nearly 5 MeV with central values close to the observed ones for $g^{\prime\prime}< 0.10$. In the following, we will use $g^{\prime\prime}=0.03$. The variation of the predicted beauty meson splittings with $h^\prime$ is presented in Figs.~\ref{HTp} and \ref{Sp} and compared with the available experimental data. In Fig.~\ref{HTp}, the predicted hyperfine splittings in the $s^P_l=\frac{1}{2}^-$ and $s^P_l=\frac{3}{2}^+$ doublets, which exhibit weak dependence on $h^\prime$, are in excellent agreement with the observed values. Evidently, the $O(\Lambda_{\text{QCD}}/m_c-\Lambda_{\text{QCD}}/m_b)$ corrections will, in general, lower the $SU(3)$ flavor splittings in the $s^P_l=\frac{1}{2}^-$ and $s^P_l=\frac{3}{2}^+$ doublets by nearly 10 and 5 MeV, respectively. In the lower panel of Fig.~\ref{HTp}(a), the results for the flavor splittings in the $s^P_l=\frac{1}{2}^-$ doublet obtained using Eqs.~\eqref{rmassesNb} and \eqref{rmassesNbD} show weak dependence on $h^\prime$. The extracted values from applying Eq.~\eqref{rmassesNbD}, which takes into account $O(\Lambda_{\text{QCD}}/m_c-\Lambda_{\text{QCD}}/m_b)$ corrections, are in excellent agreement with the reported values. However, for those obtained using Eq.~\eqref{rmassesNb}, the agreement are within 1$\sigma$ standard deviation. For the $SU(3)$ flavor splittings in the excited $s^P_l=\frac{3}{2}^+$ doublet, the theoretical results are in good agreement with data for $h^\prime\leqslant0.5$, as shown in the lower panel of Fig.~\ref{HTp}(b). For $h^\prime>0.5$, the results (more precisely the central values) extracted using Eq.~\eqref{rmassesNbD} start to deviate from the observations. Therefore, the coupling $h^\prime$ should be restricted to values smaller than $0.5$. The Fig.~\ref{HTp}(b) also shows how theoretical error, which is estimated from the $\beta$ functions of the parameters, varies with $h^\prime$. \begin{figure}[h!] \subfloat[ ]{\includegraphics[width = 0.7\textwidth]{Hp-sector}} \\ \subfloat[ ]{\includegraphics[width = 0.7\textwidth]{Tp-sector}} \caption{The predicted hyperfine splittings (upper panel) and $SU(3)$ flavor splittings (lower panel) in the (a) $s^P_l=\frac{1}{2}^-$ and (b) $s^P_l=\frac{3}{2}^+$ heavy quark doublets plotted against $h^\prime$. The notation is the same as in Fig.\ref{Tsector}.} \label{HTp} \end{figure} \begin{figure}[h!] \includegraphics[width = 0.7\textwidth]{Sp-sector} \caption{The predicted hyperfine splittings (upper panel) and $SU(3)$ flavor splittings (lower panel) in the excited $s^P_l=\frac{1}{2}^+$ heavy quark doublets plotted against $h^\prime$. The notation is the same as in Fig.\ref{Tsector}. These beauty mesons have not yet been discovered. Our predictions (upper right panel) confirm the mass relation $m_{B^\prime_{s1}}-m_{B^*_{s0}}\approx m_{B^*}-m_B \approx m_{B^*_s}-m_{B_s}$, which has been observed in the charm sector and expected in the beauty sector by heavy quark symmetry; for details please refer to the text.} \label{Sp} \end{figure} The $s^P_l=\frac{1}{2}^+$ beauty mesons have not yet been observed. Our theoretical calculations of hyperfine and flavor splittings for these missing states are shown in Fig.~\ref{Sp}. The empirical relation $m_{D^\prime_{s1}}-m_{D^*_{s0}}\approx m_{D^*}-m_D \approx m_{D^*_s}-m_{D_s}$ in the charm sector is expected in the beauty sector by heavy quark symmetry \cite{pdg12,cheng}. Our predictions confirm that $m_{B^\prime_{s1}}-m_{B^*_{s0}}\approx m_{B^*}-m_B \approx m_{B^*_s}-m_{B_s}$, as shown in the upper right panel of Fig.~\ref{Sp}. Our calculations show that there is an accidental cancellation between counterterms and $SU(3)$ breaking loop corrections in the predicted flavor splittings. The predicted $SU(3)$ splittings $m_{B^*_{s0}}-m_{B^*_0}\simeq 19$ MeV and $m_{B^\prime_{s1}}-m_{B^\prime_1}\simeq 25$ MeV ($m_{B^*_{s0}}-m_{B^*_0}\simeq 30$ MeV and $m_{B^\prime_{s1}}-m_{B^\prime_1}\simeq 36$ MeV) are obtained using Eq.~\eqref{rmassesNb} [Eq. \eqref{rmassesNbD}]. These results are far below theoretical expectations like those in the charm sector; i.e., $m_{D^*_{s0}}-m_{D^{*0}_0}\approx 18$ MeV and $m_{D^\prime_{s1}}-m_{D^{0\prime}_1}\approx 33$ MeV \cite{pdg12,19}. Thus, our results are consistent with the expectations of heavy quark spin-flavor symmetry. We have shown the predicted hyperfine and flavor splittings from applying HMChPT masses in Eq. \eqref{rmassesNbD}, which incorporates $O(\Lambda_{\text{QCD}}/m_c-\Lambda_{\text{QCD}}/m_b)$ corrections, in Figs.~ \ref{Tsector}--\ref{Sp}. The variation of the predicted beauty meson masses with $h^\prime$ is presented in Table \ref{tab:2} and compared with the experimental data. The masses of the $s^P_l=\frac{1}{2}^-$ and nonstrange $s^P_l=\frac{3}{2}^+$ ($s^P_l=\frac{1}{2}^+$ and strange $s^P_l=\frac{3}{2}^+$) states show a weak (strong) dependence on the $h^\prime$ coupling. For $B^*$, $B_s$, $B^*_s$, $B_1$, and $B^*_2$ states, the difference between the mean values of the observed and predicted masses is very small, i.e., of order few MeV. However, this is not the case for the $s^P_l=\frac{1}{2}^+$ and strange $s^P_l=\frac{3}{2}^+$ beauty mesons, where the virtual loop effects lower their masses by an amount of $\sim O(15)$ MeV. \begin{table*}[ht!] \def2.5{2.5} \begin{center} \caption{Comparison of the experimental data \cite{pdg12} and our theoretical results using HMChPT masses in Eq.~\eqref{rmassesNbD}. We take the isospin average of $B^-_1$ and $B^0_1$ ($B^{*-}_2$ and $B^{*0}_2$) to obtain the mass of nonstrange excited state $B_1$ ($B^*_2$). In our calculations, we fix $g^{\prime\prime}=0.03$ and use different values for the $h^\prime$ coupling. Masses are in units of MeV.} \begin{tabular}{lllllllllc} \hline\hline \multicolumn{10}{c}{Theoretical predictions at different $h^\prime$} \\ \cline{4-7} $j^P_l$&$J^P$&Meson&$0.00$&$0.30$&$0.50$&$0.90$&Experiment& &\\ \hline $\frac{1}{2}^-$&$1^-$&$B^*$&5325(9)&5325(9)&5325(9)&5325(9)&5324.70(21)& & \\ $\frac{1}{2}^-$&$0^-$&$B_s$&5369(13)&5369(13)&5368(13)&5366(13)&5366.88(14)& &\\ $\frac{1}{2}^-$&$1^-$&$B_s^*$&5415(15)&5415(15)&5414(15)&5413(15)&5415.4(2.3)& &\\ $\frac{1}{2}^+$&$0^+$&$B^*_0$&5683(25)(18)&5681(25)(18)&5678(25)(18)&5667(28)(18)&unseen& & \\ $\frac{1}{2}^+$&$1^+$&$B_1^\prime$&5721(26)(18)&5719(26)(18)&5717(26)(18)&5709(28)(18)&unseen& & \\ $\frac{1}{2}^+$&$0^+$&$B^*_{s0}$&5713(32)(22)&5711(32)(22)&5709(32)(22)&5699(36)(22)&unseen& & \\ $\frac{1}{2}^+$&$1^+$&$B_{s1}^\prime$&5757(31)(22)&5756(31)(22)&5754(31)(22)&5749(36)(22)&unseen& & \\ $\frac{3}{2}^+$&$1^+$&$B_1$&5727(13)&5726(13)&5725(14)&5724(19)&5726(2)& &\\ $\frac{3}{2}^+$&$2^+$&$B_2^*$&5739(14)& 5739(14)&5738(15)&5737(19)&5738.35(49)& &\\ $\frac{3}{2}^+$&$1^+$&$B_{s1}$&5832(13)&5830(14)&5826(15)&5813(28)&5828.7(2)& &\\ $\frac{3}{2}^+$&$2^+$&$B_{s2}^*$&5842(14)&5840(14)&5837(16)&5826(29)&5839.86(12)& &\\ \hline\hline \end{tabular} \label{tab:2} \end{center} \end{table*} By analyzing the predicted and observed spectrum in Table \ref{tab:2}, it is clear that the $s^P_l=\frac{1}{2}^-$ and $s^P_l=\frac{3}{2}^+$ states are well reproduced, which without a doubt reflects the power of HMChPT. Clearly, the best values for the masses of the strange excited $s^P_l=\frac{3}{2}^+$ states are those extracted considering $h^\prime\leqslant0.50$. It is worth remarking that the predicted excited $s^P_l=\frac{1}{2}^+$ beauty nonstrange (strange) masses are well above (below) the threshold for decays to ground state $B$ mesons and pions (kaons), and therefore these mesons are expected to be very broad (narrow) like $s^P_l=\frac{1}{2}^+$ charmed nonstrange (strange) mesons. Our predictions for the not yet discovered $B^*_{s0}$ and $B^\prime_{s1}$ states are remarkably close to the lattice QCD results in \cite{B}: $m_{B^*_{s0}}=5711(13)(19)$ MeV and $m_{B^\prime_{s1}}=5750(17)(19)$ MeV. It should be noted that the approach employed in the current paper and \cite{Alhakami} to predict the beauty meson spectrum within HMChPT framework is different from the one utilized in \cite{HYu,cheng,col}. In this work and in \cite{Alhakami}, a third-order one-loop mass expansion for the heavy-light mesons, which takes into account the effects to first order in light quark mass, $m_q$, and to first order in $1/m_Q$, and $m_q/m_Q$ terms, is considered. The unknown parameters in such mass expansion, i.e., Eq. \eqref{rmassesN}, are fixed using charm spectrum. Then, the fitted hyperfine parameters, which are functions of $\mathcal{O}(1/m_c)$, are scaled by $m_c/m_b$ to define the mass expansion, i.e., Eqs. \eqref{rmassesNb} and \eqref{rmassesNbD}, for the corresponding beauty meson states. A self-consistent approach is then used to extract the beauty meson masses. In \cite{HYu,cheng,col}, on the other hand, the treatment is based on the heavy quark symmetry argument. In these studies, the one-loop corrections and chiral symmetry breaking terms are neglected. In the rest of this section, we will briefly review and discuss the approach employed in these studies. For this, we will use the notation of \cite{col} and restrict the discussion to the missing excited $s^P_l=\frac{1}{2}^+$ states. In the strict HQ limit \cite{col}, \begin{equation} \begin{split}\label{col} \Delta^{(c)}_S &=\Delta^{(b)}_S,\\ \lambda^{(c)}_S &=\lambda^{(b)}_S,\\ \end{split} \end{equation} where $\Delta_S$ measures the spin-averaged mass splittings between the excited $S$ doublet and ground state $H$ doublet (this corresponds to $\delta_S-\delta_H$ in \cite{ms05,Alhakami,Alhakami20}) and $\lambda_S$ measures the mass splitting between spin partners of $S$ doublet. The quantity $\lambda_S$ represents the HQET nonperturbative parameter $\lambda_{S,2}$, see Eq.~\eqref{hqet}. The HMChPT hyperfine parameter, which is denoted by $\Delta_S$ in \cite{ms05,Alhakami,Alhakami20}, is related to this HQET parameter by $\Delta_S=\lambda_S/m_c$ for the case of the charmed mesons. Note that the mass expansion in \cite{ms05,Alhakami,Alhakami20} is defined up to to first order in $1/m_c$, which in turn implies that $\lambda^{(c)}_S\equiv\lambda^{(b)}_S$. Therefore, it is sufficient to rescale the hyperfine parameters ($\xi$ and $F$) in the charmed meson mass expansion [Eq.~\eqref{rmassesN}] by the mass ratio $m_c/m_b$ to define the HMChPT mass expansion for the analog beauty meson states, i.e., Eqs. \eqref{rmassesNb} and \eqref{rmassesNbD}. The leading QCD corrections and $1/m_Q$ effect \cite{lamdc} to $\lambda^{(c)}_X\equiv\lambda^{(b)}_X$ are beyond the order, i.e., $\mathcal{O}(Q^3)$, to which we are working. Such corrections, which have been considered in \cite{cheng,HYu}, are found to shift the masses by a few MeV; see the text below Eq.~\eqref{2014}. The lhs of the relations in Eq.~\eqref{col} is experimentally determined. The two relations are then used to predict states in the corresponding beauty doublets. For the missing excited $s^P_l=\frac{1}{2}^+$ states, the authors of \cite{col} obtained \begin{equation} \begin{split}\label{12} m_{B^*_0}&=5708.2(22.5),~~~m_{B^\prime_1}=5753.3(31.1),\\ m_{B^*_{s0}}&=5706.6(1.2),~~~m_{B^\prime_{s1}}=5765.6(1.2) \end{split} \end{equation} in MeV units. The leading QCD corrections and $1/m_Q$ effect to the relations in Eq.~\eqref{col} are taken into account in \cite{cheng,HYu}. The leading $1/m_Q$ correction to $\Delta^{(c)}_S=\Delta^{(b)}_S$ is estimated using HQET as done above. It is given by \begin{equation}\label{kk} \Delta^{(b)}_S=\Delta^{(c)}_S+\delta_{SH}, \end{equation} where $\delta_{SH}\sim \mathcal{O}(-35)$ MeV is obtained using $4.65$ and $1.275$ GeV for the beauty and charm quark masses, respectively, and by assuming that the kinetic energy of the heavy quark in the $s^P_l=\frac{1}{2}^+$ states is comparable to that of $s^P_l=\frac{3}{2}^+$ states. The next-to-leading corrections to the relation $\lambda^{(c)}_S=\lambda^{(b)}_S$ has not yet been calculated. The authors of \cite{HYu} have generalized the calculations of Amoros, Beneke, and Neubert \cite{lamdc} for the negative-parity mesons by considering the leading QCD corrections to the relation $\lambda^{(c)}_S=\lambda^{(b)}_S$, i.e., \begin{equation}\label{hl} \lambda^{(b)}_S=\lambda^{(c)}_S\left(\frac{\alpha_s{(m_b)}}{\alpha_s{(m_c)}}\right)^{9/25}. \end{equation} With aforementioned improvements [Eqs.~\eqref{kk} and \eqref{hl}], the authors of \cite{HYu} obtained (in MeV) \begin{equation} \begin{split}\label{14} m_{B^*_0}&=5715(22)+\delta_{SH},~~~m_{B^\prime_1}=5752(31)+\delta_{SH},\\ m_{B^*_{s0}}&=5715(1)+\delta_{SH},~~~m_{B^\prime_{s1}}=5763(1)+\delta_{SH}, \end{split} \end{equation} where the $\delta_{SH}$ correction amounts to lowering the masses of the excited $s^P_l=\frac{1}{2}^+$ beauty states. The predicted masses in \cite{col,cheng,HYu}, which are given in Eqs.~\eqref{12} and \eqref{14}, are obtained using $m_{D^{*0}_0}=2318(29)$ MeV for the nonstrange scalar charmed meson, which is very close to its strange partner, $D^{*+}_{s0}$. Our theoretical predictions in Figs.~\ref{Tsector}--\ref{Sp} and Table \ref{tab:2} are obtained using the 2020 PDG \cite{pdg12}, where the updated value for the mass of the scalar $D^{*0}_0$ state is $2300(19)$ MeV, which is smaller than $D^{*+}_{s0}$ by nearly 18 MeV. To compare the approach employed in this work with the one used in \cite{col,cheng,HYu}, the results in Eqs.~\eqref{12} and \eqref{14} must be updated using the 2020 PDG \cite{pdg12}. This leads to the following predicted masses (in MeV) \begin{equation} \begin{split}\label{2012} m_{B^*_0}&=5696(19),~~~~~~~m_{B^\prime_1}=5749(31),\\ m_{B^*_{s0}}&=5706.9(1.8),~~~m_{B^\prime_{s1}}=5765.9(1.8), \end{split} \end{equation} in the HQ limit [Eq.~\eqref{col}] and \begin{equation} \begin{split}\label{2014} m_{B^*_0}&=5702(20)+\delta_{SH},~~~m_{B^\prime_1}=5746(30)+\delta_{SH},\\ m_{B^*_{s0}}&=5714.0(1.8)+\delta_{SH},\\ m_{B^\prime_{s1}}&=5763.5(1.8)+\delta_{SH}, \end{split} \end{equation} when considering the $1/m_Q$ [Eq.~\eqref{kk}] and leading QCD [Eq.~\eqref{hl}] corrections. By comparing Eqs.~\eqref{2012} and \eqref{2014}, it is obvious that including the leading QCD corrections enhances (reduces) the masses of the scalar (axial-vector) beauty mesons by nearly 7 MeV (2 MeV), as already noted in \cite{HYu,cheng}. The predicted $B^*_{s0}$ and $B^\prime_{s1}$ states in Eq.~\eqref{2014} are close to our predictions in Table \ref{tab:2}. However, the masses for $B^*_0$ and $B^\prime_1$ states in Eq.~\eqref{2014} are higher than the predicted masses in Table \ref{tab:2} by order 20 and 30 MeV, respectively. \section{CONCLUSIONS} The spectroscopy of the ground-state ($s_l^P=\frac{1}{2}^-$) and lowest-excited ($s_l^P=\frac{1}{2}^+$ and $s_l^P=\frac{3}{2}^+$) beauty mesons were analyzed within HMChPT framework. The mass expressions used in our study include all leading contributions from one-loop corrections and those due to chiral and heavy quark symmetry breakings. The charmed spectrum was used to fix the unknown parameters that appear in the mass formulas. Then, we used charm results to make predictions for the analog beauty meson spectrum. Our calculations were performed at different values for the experimentally and theoretically unknown ($h^\prime$ and $g^{\prime\prime}$) couplings, which helped to examine the influence of virtual loops effect on the calculated masses. It was found that the data is more consistent with the predicted $s_l^P=\frac{3}{2}^+$ masses when $g^{\prime\prime}<0.10$. For self-energy corrections parametrized by $h^\prime$, the calculated masses for the $s^P_l=\frac{1}{2}^-$ and nonstrange $s^P_l=\frac{3}{2}^+$ ($s^P_l=\frac{1}{2}^+$ and strange $s^P_l=\frac{3}{2}^+$) beauty mesons were found to have a weak (strong) dependence on $h^\prime$. The $s^P_l=\frac{1}{2}^+$ and strange $s^P_l=\frac{3}{2}^+$ beauty mesons were pushed down by nearly $O(15)$ MeV. The resulting masses for the $s_l^P=\frac{1}{2}^-$ and $s_l^P=\frac{3}{2}^+$ beauty mesons are consistent with the observed values. However, the $s^P_l=\frac{1}{2}^+$ beauty mesons have not yet been discovered; so, our findings could provide useful information for experimentalists investigating such states. \section{Acknowledgments} The author extends his appreciation to the Deanship of Scientific Research at King Saud University for funding this work through Research Group No. RG-1441-537.
\section{Introduction}\label{intro} Fix a prime $p$ and let $q=p^a$. Then for any curve, $C$, defined over $\Ff_q$, we can define the zeta function attached to the curve as \begin{align}\label{zetafunc} Z_C(u) = \exp\left( \sum_{n=1}^\infty \#C(\Ff_{q^n})\frac{u^n}{n} \right). \end{align} The Riemann hypothesis (proved by Weil \cite{W}) states that \begin{align}\label{Lfunc} Z_C(u) = \frac{L_C(u)}{(1-u)(1-qu)} \end{align} where $L_C(u)$ is a polynomial of degree $2g$ (where $g$ is the genus of the curve), all of whose zeros lie on the ``half-line" $|u|=q^{-1/2}$. Moreover, the distribution of these zeroes give us arithmetic information about the number of points on the curve. Therefore, it is of interest to study statistical properties of these zeroes. One such statistical object that is of interest is the one-level density of the zeroes. Specifically, for any Schwartz test function, $f$, define \begin{align}\label{OLD1} \mathcal{D}(L_C,f) = \sum_{\theta} f\left(2g \frac{\theta}{2\pi}\right) \end{align} where the sum is over all real numbers $\theta$ such that $q^{-1/2} e^{i\theta}$ are the zeros of $L_C(u)$, counted with multiplicity. Note that by the cyclic nature of $e^{i\theta}$ if $\theta$ appears in the sum then so does $\theta+2\pi n$ for all $n\in\mathbb{Z}$. Since $f$ is Schwartz, it's mass is concentrated near $0$, and so $\mathcal{D}(L_C,f)$ can be viewed as a measure on the zeroes near the real line, the so-called ``low lying zeroes". Since $L_C(u)$ is a polynomial of degree $2g$ whose zeroes lie on $|u|=q^{-1/2}$, we get that we can find a unitary $2g\times2g$ matrix $\Theta_C$, called the Frobenius of the curve $C$, such that \begin{align}\label{Frob} L_C(u) = \det(1-\sqrt{q} u\Theta_C). \end{align} Therefore, if for any unitary $2g\times2g$ matrix $U$ and even Schwartz function, $f$, we define $$\mathcal{D}(U,f) = \sum_{j=1}^{2g} \sum_{n\in\Z} f\left(2g\left(\frac{\theta_j}{2\pi} -n\right)\right) $$ where the $\theta_j$ are the eigenvalues of $U$ then we get \begin{align}\label{OLD2} \mathcal{D}(L_C,f)= \mathcal{D}(\Theta_C,f) \end{align} Katz and Sarnak \cite{KS} predicted that for a nice family of curves $\Hh$ then there should be a matrix group $M$, called the monodromy group, such that $$\langle \mathcal{D}(L_C,f)\rangle_{\Hh}\footnote{Here we use the notation for any set $S$ and any function $\phi$ on $S$ that $\langle\phi(s)\rangle_S =\frac{1}{|S|}\sum_{s\in S} \phi(s)$ } \sim \int_M \mathcal{D}(U,f) dU.$$ They also predicted that $M$ should be one of $USp$, the unitary symplectics; $O$, the orthogonals; $SO(even)$, the even special orthogonals; $SO(odd)$, the odd special orthogonal; or $U$, the unitaries. These predictions have been confirmed for multiple families. Classically, over number fields Katz and Sarnak \cite{KS} showed that the family of $L$-functions attached to quadratic characters have symplectic monodromy group. In \cite{M2}, I showed that the cubic characters have unitary monodromy group whereas Cho and Park \cite{CP} proved a more general result for this family. Shankar, S\"{o}dergren and Templier \cite{SST} showed that $L$-functions attached to $S_3,S_4$ and $S_5$ extensions of $\mathbb{Q}$ have symplectic monodromy group while Yang \cite{Y} showed that the $S_3$ and $S_4$ extensions of $\Ff_q[T]$ also have symplectic monodromy group. Using Poisson summation one can show that for any $U$, we get \begin{align}\label{D(u,f)} \mathcal{D}(U,f) = \frac{1}{2g}\sum_{n\in\mathbb{Z}} \hat{f}\left(\frac{n}{2g}\right) \Tr(U^n). \end{align} Therefore to understand the statistics of $\mathcal{D}(L_C,f)$, it is enough to understand the statistics of $\Tr(\Theta_C^n)$. Typically, one is able to calculate the expected value of $\Tr(\Theta_C^n)$ as long as $n<2\alpha g$ for some $\alpha$. Then restricting down to $f$ such that $\supp(\hat{f})\subset (-\alpha,\alpha)$ allows you to calculate the one level density. \subsection{Cyclic Covers}\label{background} In this paper we are interested in the expected value of $\Tr(\Theta_C^n)$ as $C$ varies over cyclic covers. Namely, the family \begin{align}\label{curv} \Hh_r = \{ (C,\pi) : \pi:C\to\Pp^1 \mbox{ is a degree-$r$ map defined over $\Ff_q$} \} \end{align} for any positive integer $r$. Clearly $\Hh_r$ is an infinite set. Therefore, we wish to find an invariant such that only finitely many curves have a given invariant. The obvious choice is the genus as we want to associate the family of $\Theta_C$ to a matrix group and we have that if the genus is fixed then the dimension of $\Theta_C$ is fixed. Hence, define the (finite) set of curves \begin{align}\label{curvgen} \Hh^{gen}_r(g) = \{(C,\pi)\in\Hh_r : g(C)=g\} \end{align} where we denote $g(C)$ as the genus of $C$. This was first considered in the case $r=2$ by Rudnick \cite{R} in the affine setting and then extended by Chinis \cite{C} to the projective setting. \begin{thm}[\cite{C},\cite{R}] Let $q$ be odd. If $n$ is odd, then $\langle \Tr(\Theta_C^n)\rangle_{\Hh^{gen}_2(g)} =0$. Otherwise, if $n$ is even, then $$\langle \Tr(\Theta_C^n)\rangle_{\Hh^{gen}_2(g)} = \begin{cases} -1 & 0< n<2g \\ -1-\frac{1}{q-1} & n=2g \\ 0 & n>2g\end{cases} -D^{*}_2(g,n) + O\left(nq^{n/2-2g} + gq^{-g} \right) $$ where $D^{*}_2(g,n)$ is some explicit function such that $D^{*}_2(g,n)\ll nq^{-n/2}$ \end{thm} Now, we notice that the first part resembles that of the expected value of traces of $USp(2g)$. Namely, that $$\int_{USp(2g)} \Tr(U^n) dU = \begin{cases} 2g & n=0 \\ -1 & 0<n\leq 2g, n \mbox{ even} \\ 0 & \mbox{ otherwise} \end{cases}.$$ Therefore, one may express the above result and then a one-level density result in terms of the matrix group $USp(2g)$. \begin{cor}[\cite{C},\cite{R}] If $3\log_qg<n<4g-5\log_qg$, but $n\not=2g$, then $$\langle \Tr(\Theta_C^n)\rangle_{\Hh^{gen}_2(g)} = \int_{USp(2g)} \Tr(U^n) dU + O\left(\frac{1}{g}\right).$$ Hence, if we also incorporate $D_2(g,n)$, we get that for any even Schwartz test function $f$ with $\supp(\hat{f}) \subset (-2,2)$, then $$\langle\mathcal{D}(L_C,f)\rangle_{\Hh^{gen}_2(g)} = \int_{USp(2g)} \mathcal{D}(U,f) dU + \frac{dev^{*}_2(f)}{g} + o\left(\frac{1}{g}\right)$$ where $$dev^{*}_2(f) = \hat{f}(0)\sum_{P}\frac{\deg(P)}{|P|^2-1} -\hat{f}(1)\frac{1}{q-1}$$ and the sum is over all prime polynomials with $|P|=q^{\deg(P)}$. \end{cor} Subsequently, Bucur et al. \cite{BCDG+} consider the case where $r=\ell$ is an odd prime. As it turns out $\Hh^{gen}_\ell(g) \not=\emptyset$ if and only if $2g\equiv 0 \mod{\ell-1}$. Hence, we restrict only to those possible values of $g$. \begin{thm}[\cite{BCDG+}]\label{BCDthm} Let $\ell$ be an odd prime and suppose $q\equiv 1 \mod{\ell}$ and $2g\equiv 0 \mod{\ell-1}$. Then $$\langle \Tr(\Theta_C^n)\rangle_{\Hh^{gen}_\ell(g)} = -D^{*}_\ell(g,n) + O\left(\frac{n^{\ell-2}q^{n/\ell}}{gq^{n/2}} + q^{n(\frac{1}{2}+\epsilon) - (\frac{1}{2}-\epsilon)\frac{2g}{\ell-1}}\right) $$ where $D^{*}_\ell(g,n)$ is some explicit function such that $D^{*}_\ell(g,n)\ll nq^{-n/2}$ \end{thm} Thus we see in this case, the main term is actually $0$ and this resembles the expected value of traces of $U(2g)$. Namely, that $$\int_{U(2g)} \Tr(U^n)=\begin{cases} 2g & n=0 \\ 0 & n\not=0\end{cases}.$$ Therefore, one may express the above result and then a one-level density result in terms of the matrix group $U(2g)$. \begin{cor}[\cite{BCDG+}] Let $\ell$ be an odd prime, $q\equiv 1\mod{\ell}$ and $2g\equiv 0 \mod{\ell-1}$. Then, for any $\epsilon>0$ and any $n$ such that $6\log_qg < n< (1-\epsilon) \left(\frac{2g}{\ell-1}+2\right)$, as $g\to\infty$, $$\langle \Tr(\Theta_C^n)\rangle_{\Hh^{gen}_\ell(g)} = \int_{U(2g)} \Tr(U^n) dU + O\left(\frac{1}{g}\right).$$ Hence, if we also incorporate $D^{*}_\ell(g,n)$, we get that for any even Schwartz test function $f$ with $\supp(\hat{f}) \subset (-\frac{1}{\ell-1},\frac{1}{\ell-1})$, then $$\langle\mathcal{D}(L_C,f)\rangle_{\Hh^{gen}_\ell(g)} = \int_{U(2g)} \mathcal{D}(U,f) dU + \frac{dev^{*}_\ell(f)}{g} + O\left(\frac{1}{g^{2-\epsilon}}\right)$$ where $$dev^{*}_\ell(f) = -\hat{f}(0)\sum_{P}\frac{(\ell-1)\deg(P)}{(1+(\ell-1)|P|^{-1})(|P|^{\ell/2}-1)}$$ and the sum is over all prime polynomials with $|P|=q^{\deg(P)}$. \end{cor} \subsection{A Thin Family} In this paper, we wish to consider what happens for arbitrary, non-prime $r$. As it turns out, working with the family $\Hh_r^{gen}(g)$ when $r$ is not prime can be tricky. For instance, there is not a necessarily clean cut way to determine when the set is non-empty (see Remark \ref{thingenformrem}). Therefore, we will restrict to working with a smaller set that behaves more nicely. Since we assume that $q\equiv 1 \mod{r}$, we know by Kummer theory that all the curves of $\Hh_r$ will have affine models of the form $$Y^r = \alpha F(X)$$ with $F$ a monic, $r^{th}$-power free polynomial and $\alpha\in \Ff_q^*/(\Ff_q^*)^r$. Since $F$ is $r^{th}$-power free, we can write $F = f_1f_2^2\cdots f_{r-1}^{r-1}$ where the $f_i$ are monic, square-free and pairwise coprime. We will say that a curve admits a thin affine model, if it has an affine model of the form $$Y^r = \alpha \prod_{(i,r)=1} f_i^i \footnote{We will commonly write the argument for a sum or product as just $(i,r)=1$ which is to be interpreted as the sum or product from $i=1$ to $r$ such that $(i,r)=1$.}$$ with the $f_i$ being monic, square-free and pairwise coprime and $\alpha\in\Ff_q^*/(\Ff_q^*)^r$. Moreover, for any integers $n,m$ we denote $(n,m)$ as their greatest common divisor. Therefore, we define the following set \begin{align} \Hh^{thin}_r(g) := \{ (C,\pi)\in\Hh^{gen}_r(g) : C \mbox{ admits a thin affine model} \}. \end{align} Note that if $r=\ell$ is prime, then in fact $\Hh^{thin}_\ell(g) = \Hh^{gen}_{\ell}(g)$. So, all our results will include the previous results in Section \ref{background}. The condition for a curve to have a thin affine model can be seen as a restriction of the possible ramification types for finite primes. As we will see $\Hh^{thin}_r(g) \not=\emptyset$ if and only if $2g \equiv 1-s \mod{r-1}$ for some $s|r$. The value of $s$ corresponds to the different possible ramification types for the prime at infinity. Therefore, to ensure that the prime at infinity behaves like all the other primes we will restrict to the case $2g\equiv 0 \mod{r-1}$ (i.e. $s=1,r$). \begin{thm}\label{thinthm} Let $q\equiv 1 \mod{r}$ and $2g\equiv 0\mod{r-1}$. If $(r,n)=1$, then $\langle\Tr(\Theta_C^n) \rangle_{\Hh^{thin}_r(g)}=0$. Otherwise, for $n\not=0$, $$\langle\Tr(\Theta_C^n) \rangle_{\Hh^{thin}_r(g)} = \frac{-1}{q^{n/2}}\sum_{\substack{s|(r,n) \\ s\not=1}}\phi(s)q^{n/s} -D_r(g,n)+ O\left(\frac{1}{gq^{\frac{n}{2}}}+q^{\frac{n}{2}-(\frac{1}{2}+\epsilon)\frac{2g}{r-1}}\right)$$ where $\phi$ is the Euler totient function and $D_r(g,n)$ is an explicit function, given in \eqref{D_r(g,n)}. In particular, $D_r(g,n)\ll nq^{-n/2}$. \end{thm} Comparing this to the previous results in Section \ref{background}, we see that when $r=2$, our error term is not as good. This is due to the fact that in \cite{C} and \cite{R}, they are able to use the simplicity of the square-free sieve to improve the error term. Since it is not so obvious of how to extend that technique to a general $r^{th}$-power sieve, we do not get as good of an error term in general. However, comparing to the case of $r=\ell$, an odd prime, we see that our result is, in fact, stronger. While the error term in Theorem \ref{BCDthm} is $\frac{n^{\ell-2}q^{n/\ell}}{gq^{n/2}}$, we obtain a (secondary) main term of the order of $\frac{q^{n/\ell}}{q^{n/2}}$ and many more, in the case of $r$ non-prime. Further, we replicate the result that the average is exactly equal to zero if $(\ell,n)=1$ as was previously shown only for $\ell=2$. Also, note that if $\ell$ is prime, our value of $D_\ell(g,n)$ differs slightly from the previous results $D^{*}_\ell(g,n)$. In the case $\ell=2$, one can show that $D_2(g,n)\sim D^{*}_2(g,n)$ as $g$ tends to infinity. However, if $\ell$ is an odd prime, then we can show $D^{*}_{\ell}(g,n) \sim D_{\ell}(g,n)$ only if $n=o(g)$. This is still consistent with Theorem \ref{BCDthm} as $D^{*}_{\ell}(g,n)$ is only a true main term if $n\ll \log(g)$. Therefore we see that if $r$ is odd, then the expected value of the trace will always tend to $0$, behaving like the unitary ensemble. Whereas if $r$ is even then the expected value tends to $-1$ if $n$ is even and $0$ if $n$ is odd, behaving like the symplectic ensemble. Thus, we can restate the result in terms of random matrices and then prove a one-level density result. \begin{cor}\label{thincor} Let $q\equiv1\mod{r}$ and $2g\equiv 0\mod{r-1}$. If $r$ is even, and $C_r\log_qg<n<(1-\epsilon)\frac{2g}{r-1}$ then $$\langle\Tr(\Theta_C^n) \rangle_{\Hh^{thin}_r(g)} = \int_{USp(2g)} \Tr(U^n)dU + O\left( \frac{1}{g} \right)$$ and thus if $f$ is an even Schawrz test function with $\supp(\hat{f})\subset \left(\frac{-1}{r-1},\frac{1}{r-1}\right)$ then $$\langle \mathcal{D}(L_C,f) \rangle_{\Hh^{thin}_r(g)} = \int_{USp(2g)} \mathcal{D}(U,f) dU + O\left(\frac{1}{g^{1-\epsilon}}\right).$$ Whereas if $r$ is odd and $C_r\log_qg < n< (1-\epsilon)\frac{2g}{r-1}$, then $$\langle\Tr(\Theta_C^n) \rangle_{\Hh^{thin}_r(g)} = \int_{U(2g)} \Tr(U^n)dU + O\left( \frac{1}{g}\right)$$ and thus if $f$ is an even Schawrz test function with $\supp(\hat{f})\subset \left(\frac{-1}{r-1},\frac{1}{r-1}\right)$ then $$\langle \mathcal{D}(L_C,f) \rangle_{\Hh^{thin}_r(g)} = \int_{U(2g)} \mathcal{D}(U,f) dU + O\left(\frac{1}{g^{1-\epsilon}}\right).$$ \end{cor} \subsection{Refining one-level Density} We confirm the Katz-Sarnak predictions in Corollary \ref{thincor} by showing that the one-level density is controlled either by the unitary ensemble or the symplectic ensemble. However, this seems to only use the primary main term we obtain in Theorem \ref{thinthm}; namely $-1$ if $r$ and $n$ are even and $0$ otherwise. The secondary main terms of Theorem \ref{thinthm} appear to capture the inherent $r$-cyclic nature of the family $\Hh_r^{thin}(g)$, while the Katz-Sarnak predictions only appears to capture the parity of the family $\Hh_r^{thin}(g)$ (i.e. $r$ odd or even). This subsection will be devoted to hypothesizing on a possible refinement of the Katz-Sarnak predictions. With this in mind let $N,s$ be integers such that $\phi(s)|N$. Let $M_{(s)}(N)\subset U(N)$ be a hypothetical matrix group such that for all $n\leq \frac{N}{\phi(s)}$ $$\int_{M_{(s)}(N)} \Tr(U^n) dU = \begin{cases} -\phi(s) & s|n \\ 0 & \mbox{otherwise} \end{cases}.$$ We do not know as of now what this matrix group may be, or even that it should exist. However, it should be noted that setting $M_{(2)}(2N) = USp(2N)$ satisfies this. Then we could rewrite the result of Theorem \ref{thinthm} as \begin{align}\label{RefinedRMT} \langle\Tr(\Theta_C^n) \rangle_{\Hh^{thin}_r(g)}= \sum_{\substack{s|r \\ s\not=1}}\frac{q^{n/s}}{q^{n/2}}\int_{M_{(s)}\left(\frac{\phi(s)2g}{r-1}\right)}\Tr(U^n)dU -D_r(g,n)+ O\left(\frac{1}{gq^{\frac{n}{2}}}+q^{\frac{n}{2}-(\frac{1}{2}+\epsilon)\frac{2g}{r-1}}\right). \end{align} Note that the moment of the trace condition that defines $M_{(s)}(N)$ is only for $n\leq \frac{N}{\phi(s)}$. Thus, if we were able to determine explicitly the family $M_{(s)}(N)$, then we would likely be able to compute higher moments and hence form a conjecture for values of $n$ greater than $\frac{2g}{r-1}$. Now, we wish to combine all the matrix subgroups $M_{(s)}$ into one big subgroup of the unitaries. That is, if we have $N,r$ integers such that $(r-1)|N$ let $\{e_i : i=1,\dots,N\}$ be the standard basis for $\mathbb{C}^N$. For any $s|r$, $s\not=1$, let $$V_s = span_{\mathbb{C}} \left\{e_{\frac{r}{s}jk} : j=1,\dots,\frac{N}{r-1}, k=1,\dots,s, (k,s)=1\right\}.$$ For any $U\in U(N)$, denote $$U_s = U|_{V_s}.$$ Then we define $$M_r(N) := \left\{U \in U(N) : U_s \in M_{(s)}\left(\frac{\phi(s)N}{r-1}\right), s|r, s\not=1\right\}.$$ We would then like to relate $\langle \mathcal{D}(L_C,f) \rangle$ to $\int_{M_r(2g)} \mathcal{D}(U,f) dU$. However, since the expected traces of the matrices in \eqref{RefinedRMT} appear with weights, we need to massage $\mathcal{D}(U,f)$ slightly. We now define the one-level density of a $U\in M_r(N)$ weighted by $q$ as $$\mathcal{D}_q(U,f) := \sum_{\substack{s|r\\s\not=1}} \sum_{j=1}^{\frac{N}{r-1}} \sum_{(k,s)=1} \sum_{n\in\Z} f\left( N \left(\frac{\theta_{\frac{r}{s}jk} +i\log(q)\left(\frac{1}{s}-\frac{1}{2}\right)}{2\pi}-n \right)\right)$$ where the $\theta_{\frac{r}{s}jk}$ are the eigenangles of $U$. We see that in the case $r=2$, this is the same as \eqref{D(u,f)}. Moreover, for any $s|r$, we should think of the summand as a one-level density of $U_s$. \begin{thm}\label{refinedthm} Suppose $q\equiv 1 \mod{r}$ and $2g\equiv 0\mod{r-1}$. Then if $f$ is a Schwartz test function such that $\supp(\hat{f})\subset [0,\frac{1}{r-1})$, we get that $$\langle\mathcal{D}(L_C,f)\rangle_{\Hh_r^{thin}(g)} = \int_{M_r(2g)}\mathcal{D}_q(U,f) dU -\frac{dev_r(f)}{2g} + O\left(\frac{1}{g^2}\right)$$ where if we denote $d=\frac{2g+2r-2}{r-1}$ $$dev_r(f):=\hat{f}(0)\sum_{\substack{s|r \\ s\not=1}} \phi(s) \sum_{P} \frac{\deg(P)}{|P|^{s/2}-1} \sum_{a=1}^{\lfloor \frac{d}{\deg(P)}\rfloor} \left(\frac{-\phi(r)}{|P|}\right)^a \left(1-\frac{a\deg(P)}{d}\right)^{\phi(r)-1}$$ and the sum is over all prime polynomials with $|P|=q^{\deg(P)}$. \end{thm} Note that here we take $f$ such that $\supp(\hat{f})\subset[0,\frac{1}{r-1})$ and so, in particular, $f$ is not even. This is to remedy the fact that when we perform our poisson summation we will obtain summands of the form $\hat{f}(\frac{n}{2g})\frac{q^{n/s}}{q^{n/2}}$. Thus, if $n$ is negative, we would end up with a factor of $\frac{q^{n/2}}{q^{n/s}}$ in the calculation of the one-level density of the random matrices which no longer matches the one-level density of the family of $L$ functions. Again, we see that if $\ell$ is prime, then $dev_{\ell}(f)$ differs from $dev^{*}_{\ell}(f)$ from the previous results. However, as with $D_{\ell}(g,n)$, if $\deg(P) = o(g)$, then $$\sum_{a=1}^{\lfloor \frac{d}{\deg(P)}\rfloor} \left(\frac{-\phi(\ell)}{|P|}\right)^a \left(1-\frac{a\deg(P)}{d}\right)^{\phi(r)-1} \sim \frac{1}{1+(\ell-1)|P|^{-1}}$$ which would make the summand of $dev_{\ell}(f)$ consistent with that of $dev^{*}_{\ell}(f)$. \section{From Curves to Polynomials}\label{polysect} In this section we show that we can parameterize each of our families by polynomials. \subsection{Polynomials}\label{polysubsec} For any polynomial $F\in\Ff_q[X]$, denote by $C_{F,r}$ the curve such that \begin{align} \Ff_q(C_{F,r}) = \Ff_q(X)(F^{1/r}) \end{align} where we denote $\Ff_q(C_{F,r})$ as the field of functions of the curve $C$. Since we are assuming $q\equiv 1 \mod{r}$, then $\Ff_q(X)$ contains the $r^{th}$-roots of unity and so Kummer Theory tells us that all the curves in $\Hh_r$ are of this form. However, not all polynomials will give us a curve in $\Hh_r$. For example, if $F=G^s$, for some $s|r$, then the resulting curve $C_{F,r}$ will actually be an $\frac{r}{s}$ cyclic cover. Further not all polynomials will give different curves. For example, if $F$ and $G$ are two polynomials such that there exists an $H\in\Ff_q(X)$ and an $i$, coprime to $r$, with $F=G^iH^r$, the we would get that $C_{F,r}$ and $C_{G,r}$ would be birationally equivalent. It is easy to see that these are the only two restraints. Therefore, we define the set $$\F_r := \{F\in \Ff_q[X] : F \mbox{ is $r^{th}$-power free and not a power of $s$ for any $s|r$, $s\not=1$}\}$$ and we get the following lemma. \begin{lem}\label{setlem} There is a $\varphi(r):1$ map between the two sets \begin{align*} \F_r & \to \Hh_r \\ F & \mapsto C_{F,r} \end{align*} \end{lem} \subsection{Genus Formula}\label{genformsect} Let $F\in\F_r$. We can write $$F = \alpha f_1f_2^2\cdots f^{r-1}_{r-1}$$ where the $f_i$ are monic, squarefree and pairwise coprime and $\alpha\in\Ff_q^*/(\Ff_q^*)^r$. Then, we apply the Riemann Hurwitz formula (Theorem 7.16 of \cite{rose}) to get that the genus of $C_{F,r}$, $g$, satsifies \begin{align}\label{genform} 2g+2r-2 = \sum_{i=1}^{r-1} (r-(r,i))\deg(f_i) + r-(r,\deg(F)) \end{align} where we use the convention that for every pair of integers $m$ and $n$, $(m,n)$ denotes the greatest common divisor of $m$ and $n$. Therefore, define the set \begin{align}\label{polygen} \F^{gen}_r(g) = \left\{ F\in\F_r : 2g+2r-2 = \sum_{i=1}^{r-1} (r-(r,i))\deg(f_i) + r-(r,\deg(F)) \right\}. \end{align} Then we get an immediate lemma. \begin{lem}\label{gensetlem} As long as $\F^{gen}_r(g)\not=\emptyset$, then there is a $\varphi(r):1$ surjective map between the two sets $\F^{gen}_r(g)$ and $\Hh^{gen}_r(g)$. In particular as long as $\F^{gen}_r(g)\not=\emptyset$, then $$\langle \Tr(\Theta_C^n)\rangle_{\Hh^{gen}_r(g)} = \langle \Tr(\Theta_{C_{F,r}}^n) \rangle_{F^{gen}_r(g)}.$$ \end{lem} \begin{rem}\label{thingenformrem} We see that $\Hh^{gen}_r(g)$ is non-empty if and only if there is a solution to $$2g = \sum_{s|r} (r-s)d_s$$ which will have a solution if and only if $g$ is sufficiently large and $\gcd_{s|r}(r-s)|2g$. While this condition can likely be dealt with, it illustrates the difficulties that can arise in working with $\Hh^{gen}_r(g)$, of which there are more that are more cumbersome to handle. \end{rem} \subsection{Thin Family}\label{thinfam} Now if we consider the subset of $\F_r$ \begin{align}\label{polythin} \F^{thin}_r = \left\{ F\in\F_r : F=\alpha \prod_{ (i,r)=1} f_i^i, \alpha\in\Ff_q^*/(\Ff_q^*)^r \right\} \end{align} then we see that the genus formula for curves $C_{F,r}$ with $F\in\F^{thin}_r$ simplifies to \begin{align}\label{thingenform} 2g+2r-2 = (r-1)\sum_{(i,r)=1} \deg(f_i) + r-(r,\deg(F)). \end{align} And so we define the set \begin{align}\label{polythingen} \F^{thin}_r(g) = \left\{ F\in\F^{thin}_r : 2g+2r-2 = (r-1)\sum_{(i,r)=1} \deg(f_i) + r-(r,\deg(F)) \right\}. \end{align} Reducing the genus formula modulo $r-1$, we find that \begin{align}\label{redmodr-1} 2g \equiv r-(r,\deg(F)) \equiv 1 - (r,\deg(F)) \mod{r-1}. \end{align} Hence we have that $\F^{thin}_r(g)\not=\emptyset$ if and only if $2g\equiv 1-s \mod{r-1}$ for some $s|r$, in which case we would necessarily have $(r,\deg(F))=s$. This leads to an immediate lemma. \begin{lem}\label{gensetlem} If $2g\equiv 1-s \mod{r-1}$ for some $s|r$ then there is a $\varphi(r):1$ surjective map between the two sets $\F^{thin}_r(g)$ and $\Hh^{thin}_r(g)$. In particular $$\langle \Tr(\Theta_C^n)\rangle_{\Hh^{thin}_r(g)} = \langle \Tr(\Theta_{C_{F,r}}^n) \rangle_{F^{thin}_r(g)}.$$ \end{lem} \begin{rem}\label{redrem} From now on, we will restrict to the case $2g\equiv 0 \mod{r-1}$. We see from \eqref{redmodr-1} that this is equivalent to restricting the $F\in\F^{thin}_r$ to $(\deg(F),r)\equiv 1 \mod{r-1}$ which is then equivalent to saying $(\deg(F),r) = 1$ or $r$. \end{rem} \section{Trace Formula}\label{trformsec} \subsection{Characters}\label{charsect} Before we develop a formula for $\Tr(\Theta_C^n)$, we will need notation for certain characters. For any $n$ let $\beta\in\Ff_{q^n}^*$ be a generator. Then for any $s|r$, we define the character on $\Ff_{q^n}$ by \begin{align}\label{char} \chi_{s;n}(\alpha) = \begin{cases} \xi_s^t & \alpha = \beta^t \\ 0 & \alpha=0 \end{cases} \end{align} where $\xi_s$ is some primitive $s^{th}$ root of unity. This is well defined since we are assuming $q\equiv 1 \mod{s}$. Further, if $P\in\Ff_q[X]$ is any irreducible polynomial with $\alpha$ as a root, then we define the Legendre symbol of $F\in\Ff_q[X]$ mod $P$ as \begin{align}\label{legen} \left(\frac{F}{P}\right)_s := \chi_{s;\deg(P)}(F(\alpha)). \end{align} \begin{lem}\label{charlem} Let $\alpha\in\Ff_{q^n}$ and let $P_{\alpha}$ be its minimal polynomial. Then $$\chi_{s;n}(F(\alpha)) = \left(\frac{F}{P_{\alpha}}\right)_s^{n/\deg(P_{\alpha})}.$$ \end{lem} \begin{proof} If $P_{\alpha}|F$ this is trivially true as both sides are $0$. So now, assume $P_{\alpha}\nmid F$. Suppose $\deg(P_{\alpha})=d|n$ so that $\alpha\in\Ff_{q^d}$. Let $\beta$ be a generator of $\Ff_{q^n}^*$. Therefore $\beta^{\frac{q^n-1}{q^d-1}}$ is a generator of $\Ff_{q^d}^*$. Then $F(\alpha) = \beta^{\frac{q^n-1}{q^d-1}t}$ for some $t$ and hence $$\chi_{s;n}(F(\alpha)) = \xi_s^{\frac{q^n-1}{q^d-1}t} = \xi_s^{\frac{n}{d}t} =\left(\frac{F}{P_{\alpha}}\right)_s^{n/\deg(P_{\alpha})} $$ where the second equality is obtained from the fact the $q\equiv 1 \mod{s}$ and so $\frac{q^n-1}{q^d-1}\equiv \frac{n}{d} \mod{s}$. \end{proof} If we denote $P_{\infty}$ as the prime at infinity, then we can define an analogous character modulo the prime at infinity: \begin{align}\label{charP_inf} \left(\frac{F}{P_{\infty}}\right)_s = \begin{cases} \chi_{s;1}(\mbox{leading coefficient of $F$}) & s|\deg(F) \\ 0 & \mbox{otherwise} \end{cases}. \end{align} In particular, we set $\deg(P_\infty)=1$ and with a similar proof as in Lemma \ref{charlem} we get that if $s|\deg(F)$, \begin{align}\label{charP_inf2} \chi_{s;n}(\mbox{leading coefficient of $F$}) = \left( \frac{F}{P_{\infty}}\right)_s^n = \left(\frac{F}{P_{\infty}}\right)_s^{\frac{n}{\deg(P_{\infty})}}. \end{align} \subsection{Trace Formula}\label{trformsubsec} From \eqref{zetafunc},\eqref{Lfunc} and \eqref{Frob}, we have that \begin{align} \exp\left(\sum_{n=1}^{\infty} \#C(\Ff_{q^n}) \frac{u^n}{n} \right) = \frac{ \det(1-\sqrt{q}u\Theta_C) }{(1-u)(1-qu)}. \end{align} Taking logs and equating coefficients of $u$, we get the well known identity \begin{align}\label{numptsform} \#C(\Ff_q^n) = q^n+1-q^{n/2}\Tr(\Theta_C^n). \end{align} Therefore, to obtain a formula to $\Tr(\Theta_C^n)$ it is enough to obtain a formula for $\#C(\Ff_q^n)$. This was done in \cite{M1} in the case $n=1$. However, the same method applies for arbitrary $n$. That is, for any $$F = \prod_{i=1}^{r-1}f_i^i\in\F_r$$ then we define for any $s|r$ $$F_{(s)} = \prod_{i=1}^{s-1} \prod_{j=1}^{r/s-1} f_{sj+i}^i$$ and we can write $\#C(\Ff_{q^n})$ in terms of $F_{(s)}$. \begin{lem}\label{numptslem} If $C=C_{F,r}$ for some $F\in\F_r$, then $$\#C(\Ff_q^n) =q^n+1+ \sum_{\alpha\in\Pp^1_{\Ff_{q^n}}}\sum_{s|r}\sum_{\substack{i=1 \\ (i,s)=1}}^{s-1} \chi^i_{s;n}(F_{(s)}(\alpha))$$ where $\chi_{s;n}$ is defined in \eqref{char} and if we denote $\infty$ as the point at infinity, then $$F_{(s)}(\infty) := \begin{cases} \mbox{leading coefficient of $F$} & \deg(F)\equiv 0 \mod{s} \\ 0 & \mbox{otherwise} \end{cases}.$$ \end{lem} Therefore, combining Lemmas \ref{charlem} and \ref{numptslem}, we obtain a formula for $\Tr(\Theta_C^n)$. \begin{lem}\label{trformlem} If $C=C_{F,r}$ for some $F\in\F_r$, then $$-q^{n/2}\Tr(\Theta_C^n) = \sum_{s|r} \sum_{\substack{i=1 \\ (i,s)=1}}^{s-1} \sum_{\deg(P)|n} \deg(P) \left(\frac{F_{(s)}}{P} \right)_s^{\frac{in}{d}} $$ where the sum is over prime polynomials, including the prime at infinity $P_{\infty}$. \end{lem} \begin{proof} Lemma \ref{numptslem} and \eqref{numptsform} tell us that $$-q^{n/2}\Tr(\Theta_C^n) = \sum_{s|r}\sum_{\substack{i=1 \\ (i,s)=1}}^{s-1} \sum_{\alpha\in\Pp^1_{\Ff_q^n}} \chi^i_{s,n}(F_{(s)}(\alpha)) $$ Now if $\alpha\in\Pp^1_{\Ff_{q^n}}$ then Lemma \ref{charlem} (or \eqref{charP_inf2} for $\alpha=\infty$) tells us that $$\chi^i_s(F_{(s)}(\alpha)) = \left(\frac{F_{(s)}}{P_{\alpha}}\right)_s^{\frac{in}{\deg(P_{\alpha})}}$$ where $P_{\alpha}$ is the minimal polynomial of $\alpha$. Finally, as $\alpha$ runs over all $\Pp^1_{\Ff_{q^n}}$, then the primes runs over all primes with degree divisible by $n$, weighted by their degree. \end{proof} \subsection{Trace Formula for Thin Set} We note that if $F\in\F^{thin}_r$, then we get that $F_{(s)} = FH^s$ for some $H\in\Ff_q[X]$ with the property that $\rad(H)|\rad(F)$. Hence, we get $$\left(\frac{F_{(s)}}{P}\right)_s = \left(\frac{F}{P}\right)_s = \left(\frac{F}{P}\right)_r^{r/s}.$$ Therefore, we get a slightly easier formula for the trace for elements of the thin set. \begin{lem}\label{trformthinlem} If $C=C_{F,r}$ for some $F\in\F^{thin}_r$, then $$-q^{n/2} \Tr(\Theta_C^n) = \sum_{i=1}^{r-1} \sum_{\deg(P)|n} \deg(P) \left(\frac{F}{P}\right)^{\frac{in}{\deg(P)}}_r$$ where the sum is over prime polynomials, including the prime at infinity $P_{\infty}$. \end{lem} \subsection{Main Term and Error Term} Combining Lemma \ref{trformthinlem} with Section \ref{polysect}, we see that \begin{align*} \langle \Tr(\Theta_C^n) \rangle_{\Hh^{thin}_r(g)} = \langle \Tr(\Theta_{C_F}^n \rangle_{\F^{thin}_r(g)} = \frac{-q^{-n/2}}{|\F^{thin}_r(g)|} \sum_{F\in\F^{thin}_r(g)} \sum_{i=1}^{r-1} \sum_{\deg(P)|n} \deg(P) \left(\frac{F}{P}\right)^{\frac{in}{\deg(P)}}_r. \end{align*} Hence, we will define $$MT_r(g,n) := \frac{-q^{-n/2}}{|\F^{thin}_r(g)|} \sum_{\deg(P)|n} \deg(P) \sum_{\substack{i=1 \\ r|\frac{in}{\deg(P)}}}^{r-1} \sum_{\substack{F\in\F^{thin}_r(g) \\ P\nmid F}} 1$$ and $$ET_r(g,n):= \frac{-q^{-n/2}}{|\F^{thin}_r(g)|} \sum_{\deg(P)|n} \deg(P) \sum_{\substack{i=1 \\ r\nmid \frac{in}{\deg(P)}}}^{r-1} \sum_{F\in\F^{thin}_r(g) } \left(\frac{F}{P}\right)_r^{in/m}. $$ \begin{rem} We include the prime at infinity $P_{\infty}$ into our sum over primes in $MT_r(g,n)$ by saying $P_{\infty}|F$ if and only if $\deg(F)\not\equiv 0\mod{r}$. \end{rem} \section{Computing the Main Term}\label{mainterm} \begin{thm}\label{maintermthm} Assume $q\equiv1 \mod{r}$ and $2g\equiv 0\mod{r-1}$, then $MT_r(g,n)=0$ if $(r,n)=1$. Otherwise $$MT_r(g,n) = \frac{-1}{q^{n/2}}\sum_{\substack{s|(r,n) \\ s\not=1 }} \phi(s)q^{n/s} - D_r(g,n) + O\left(\frac{n}{gq^{n/2}}\right)$$ where $D_r(g,n)$ is given by \eqref{D_r(g,n)}. In particular, $$D_r(g,n) \ll \frac{n}{q^{n/2}}$$ \end{thm} We see immediately that if $(r,n)=1$ then $MT_r(g,n)=0$ as the condition $r|\frac{in}{\deg(P)}$ reduces down to $r|i$ which is impossible as $i=1,\dots,r-1$. So for now on we will always assume $(r,n)\not=1$. \subsection{Notation}\label{notation} We will first consider only the monic polynomials of $\F^{thin}_r$ and then add back the leading coefficients later. Therefore, define $$\widehat{\F}^{thin}_r = \{F\in\F^{thin}_r : F \mbox{ is monic} \} $$ $$\widehat{\F}^{thin}_r(d) = \{F \in \widehat{\F}^{thin}_r : \deg(\rad(F))=d\}$$ and $$\widehat{\F}^{thin}_{r;k}(d) := \left\{ F\in \F^{thin}_r(d) : \deg(F) \equiv k \mod{r}\right\}.$$ From now on, we will always assume $2g\equiv 0\mod{r-1}$ and set $d=\frac{2g+2r-2}{r-1}$. Then by Remark \ref{redrem}, we find \begin{align}\label{monic1} \frac{1}{r}|\F^{thin}_r(g)| =|\widehat{\F}^{thin}_{r;0} (d)| + \sum_{(k,r)=1} |\widehat{\F}^{thin}_{r;k} (d-1)|, \end{align} since there are $r$ different $\alpha\in\Ff_q^*/(\Ff_q^*)^r$. Further, for any $G\in\Ff_q[T]$, we define $$\F^{thin}_{r}(g;G) := \left\{F\in\F^{thin}_{r}(g) : (F,G)=1 \right\} $$ and $$\widehat{\F}^{thin}_{r;k}(d;G) := \left\{F\in\widehat{\F}^{thin}_{r;k}(d) : (F,G)=1 \right\}. $$ Consequently, we have \begin{align}\label{monic2} \frac{1}{r}|\F^{thin}_r(g;G)| =|\widehat{\F}^{thin}_{r;0}(d;G)| + \sum_{(k,r)=1} |\widehat{\F}^{thin}_{r;k} (d-1;G)|. \end{align} The key tool of proving Theorem \ref{maintermthm} is the following proposition. \begin{prop}\label{unramprop} Let $P$ be a finite prime of degree $n$, and let $d=\frac{2g+2r-2}{r-1}\in\mathbb{Z}$, then \begin{align}\label{unrampropeq} \frac{|\F^{thin}_r(g;P)|}{|\F^{thin}_r(g)|} = \sum_{a=0}^{\lfloor \frac{d}{n}\rfloor} \left(\frac{-\phi(r)}{q^n}\right)^a \left(1-\frac{an}{d}\right)^{\phi(r)-1} + O\left(\frac{1}{gq^n}\right) \end{align} \end{prop} \begin{rem} Note that if, $n>\frac{2g+2r-2}{r-1}$, then this Proposition implies that $$\frac{|\F^{thin}_r(g;P)|}{|\F^{thin}_r(g)|} = 1 + O\left(\frac{1}{gq^n}\right).$$ Indeed, it is fairly easy to see that this actually holds with equality as $\deg(\rad(F))\leq \frac{2g+2r-2}{r-1}$ for all $F\in\F^{thin}_r(g)$ and so is immediately coprime to any polynomial of greater degree. Moreover, if $n= o(d)$, then we can rewrite $$\left(1-\frac{an}{d}\right)^{\phi(r)-1} = 1 + o(1)$$ and then get $$\frac{|\F^{thin}_r(g;P)|}{|\F^{thin}_r(g)|} \sim \frac{q^n}{q^n+\phi(r)}.$$ Further, if $n=O(1)$, then we get the error above would be $O(\frac{1}{g})$. \end{rem} \subsection{Generating Series} Note that $\F^{thin}_r(g) = \F^{thin}_r(g;1)$. So it is enough to consider everything for arbitrary $G \in\Ff_q[T]$. That is, define the generating series $$\mathcal{G}^{thin}_{r;k}(u;G) = \sum_{d=0}^{\infty} |\widehat{\F}^{thin}_{r;k}(d;G)|u^d.$$ \begin{lem}\label{genserlem} For any $s|r$, and any primitive $s^{th}$ root of unity, $\xi_s$, define $$H_{r;s}(u;G) = \prod_{P\nmid G} \left(1+ \frac{\phi(r)}{\phi(s)} \sum_{(i,s)=1} (\xi_s^i u)^{\deg(P)} \right).$$ Then $$\mathcal{G}^{thin}_{r;k}(u;G) = \frac{1}{r} \sum_{s|r} \sum_{(j,s)=1} \xi_s^{-jk} H_{r;s}(u;G).$$ \end{lem} \begin{proof} Since every monic $F\in\widehat{\F}^{thin}_r$ can be written as $$F = \prod_{(i,r)=1}f_i^i$$ where the $f_i$ are monic, squarefree and pairwise coprime we can write $\mathcal{G}^{thin}_{r;k}(u;G)$ as a sum over the monic $f_i$: \begin{align*} \mathcal{G}^{thin}_{r;k}(u;G) & = \sum_{(f_i)_{(i,r)=1}} \mu^2\left(G\prod f_i\right) \frac{1}{r} \sum_{j=0}^r \xi_r^{j(\sum i\deg(f_i)-k)} u^{\sum \deg(f_i)}\\ & = \frac{1}{r} \sum_{j=0}^r \xi_r^{-jk} \sum_{(f_i)_{(i,r)=1}} \mu^2\left(G\prod f_i\right) \prod \left( \xi_r^{ij}u \right)^{\deg(f_i)} \\ & = \frac{1}{r} \sum_{j=0}^r \xi_r^{-jk} \prod_{P\nmid G} \left(1 + \sum_{(i,r)=1} \left( \xi_r^{ij}u \right)^{\deg(P)}\right) \end{align*} We see that since $(i,r)=1$, the Euler product only depends on the greatest common divisor of $j$ and $r$. Therefore, if we suppose $(j,r)=\frac{r}{s}$ for some $s|r$, then we can write $j=\frac{r}{s} j'$ with $(j',s)=1$ and so \begin{align*} \mathcal{G}^{thin}_{r;k}(u;G) & =\frac{1}{r} \sum_{s|r} \sum_{(j',s)=1} \xi_s^{-j'k} \prod_{P\nmid G} \left(1 + \sum_{(i,r)=1} \left( \xi_s^{i}u \right)^{\deg(P)}\right)\\ & = \frac{1}{r} \sum_{s|r} \sum_{(j,s)=1} \xi_s^{-jk} H_{r;s}(u;G) \end{align*} \end{proof} \subsection{Inclusion-Exclusion for $H_{r;s}(u,P)$} While the dependance on $G$ in $\mathcal{G}_{r;k}(u;G)$ is complicated, we can use the fact that the dependance on $H_{r;s}(u,G)$ is fairly straightforward (especially when $G=P$ is prime) to perform an inclusion exclusion. \begin{lem}\label{incexclem} Let $P$ be a prime of degree $n$. Then we have $$[u^d] H_{r;s}(u;P) = \sum_{a=0}^{\lfloor \frac{d}{n}\rfloor} \left(-\frac{\phi(r)}{\phi(s)}\right)^a \sum_{\substack{i_1,\dots,i_a \\ (i_j,s)=1}} \xi_s^{n\sum i_j } [u^{d-an}] H_{r;s}(u;1) $$ where for any analytic function $K$ we denote $[u^d]K(u)$ as the $d^{th}$ coefficient of the Taylor series centered around $0$. \end{lem} \begin{proof} By the definition of $H_{r;s}(u;G)$, we have that $$H_{r;s}(u;1) = \left(1+\frac{\phi(r)}{\phi(s)} \sum_{(i,s)=1} (\xi_s^iu)^{\deg(P)}\right) H_{r;s}(u;P)$$ from which we obtain $$[u^d]H_{r;s}(u;1) = [u^d]H_{r;s}(u;P) + \frac{\phi(r)}{\phi(s)} \sum_{(i,s)=1} \xi_s^{i\deg(P)} [u^{d-n}] H_{r;s}(u;P). $$ and so rearranging for $ [u^d]H_{r;s}(u;P)$ and recursively applying the formula, we get \begin{align*} [u^d]H_{r;s}(u;P) = & [u^d]H_{r;s}(u;1) - \frac{\phi(r)}{\phi(s)} \sum_{(i,s)=1} \xi_s^{i\deg(P)} [u^{d-n}] H_{r;s}(u;P)\\ = & [u^d]H_{r;s}(u;1) - \frac{\phi(r)}{\phi(s)} \sum_{(i,s)=1} \xi_s{^i\deg(P)} [u^{d-n}]H_{r;s}(u;1)\\ & + \left(\frac{\phi(r)}{\phi(s)}\right)^2 \sum_{\substack{(i_1,s)=1 \\ (i_2,s)=1}} \xi_s^{(i_1+i_2)\deg(P)} [u^{d-2n}] H_{r;s}(u;P) \\ = & \cdots \\ = & \sum_{a=0}^{\lfloor \frac{d}{n}\rfloor} \left(-\frac{\phi(r)}{\phi(s)}\right)^a \sum_{\substack{i_1,\dots,i_a \\ (i_j,s)=1}} \xi_s^{\sum i_j \deg(P)} [u^{d-an}] H_{r;s}(u;1) \end{align*} \end{proof} \subsection{Asymptotics of $[u^d]H_{r,s}(u;1)$} We see now, it suffices to determine the size of $[u^d]H_{r,s}(u;1)$. \begin{lem}\label{aymptlem} There is a polynomial $P_{r,s}$ of degree at most $\frac{\phi(r)}{\phi(s)}-1$ such that $$[u^d]H_{r,s}(u;1) = P_{r,s}(d) q^d + O\left(q^{\left(\frac{1}{2}+\epsilon\right)d}\right).$$ Moreover, $P_{r,1}$ is a polynomial of exact degree $\phi(r)-1$. \end{lem} \begin{proof} We have that \begin{align*} H_{r;s}(u;1) & = \prod_{P} \left(1+ \frac{\phi(r)}{\phi(s)} \sum_{(i,s)=1} (\xi_s^i u)^{\deg(P)} \right) \\ & = \prod_{(i,s)=1} \prod_P \left(1 - (\xi_s^iu)^{\deg(P)} \right)^{-\frac{\phi(r)}{\phi(s)}} \widetilde{H}_{r;s}(u;1) \end{align*} where $\widetilde{H}_{r;s}(u;1) = \prod_P \left(1+O(u^{2\deg(P)})\right)$ and so absolutely converges for $|u|<q^{-1/2}$. Further $$\prod_P \left(1 - (\xi_s^iu)^{\deg(P)} \right)^{-1} = \zeta_q(\xi_s^iu) = \frac{1}{1-q\xi_s^iu}$$ where $\zeta_q$ is the zeta function attached to $\Ff_q[X]$. Therefore, $H_{r;s}(u;1)$ can be meromorphically extended to the region $|u|<q^{-1/2}$ with poles of order $\frac{\phi(r)}{\phi(s)}$ when $u=(\xi_s^iq)^{-1}$. So, if $\Gamma = \{u : |u|=q^{-1/2-\epsilon}\}$, then by Cauchy residue formula, we get $$\frac{1}{2\pi i}\oint_{\Gamma} \frac{H_{r;s}(u;1)}{u^{d+1}}du = \Res_{u=0} \left(\frac{H_{r;s}(u;1)}{u^{d+1}}\right) + \sum_{(i,s)=1} \Res_{u=(\xi_s^iq)^{-1}} \left( \frac{H_{r;s}(u;1)}{u^{d+1}} \right)$$ By definition, we have $$\Res_{u=0} \left(\frac{H_{r;s}(u;1)}{u^{d+1}}\right) = [u^d]H_{r;s}(u;1).$$ Further, since $\widetilde{H}_{r;s}(u,1)$ absolutely converges on $\Gamma$, it will be absolutely bounded as well. Therefore $$\frac{1}{2\pi i}\oint_{\Gamma} \frac{H_{r;s}(u;1)}{u^{d+1}}du \ll q^{\left(\frac{1}{2} +\epsilon\right)d}.$$ So it remains to determine the residues at $(\xi_s^iq)^{-1}$. By the formula of higher order poles, if we denote $M:=\frac{\phi(r)}{\phi(s)}$, then \begin{align*} \Res_{u=(\xi_s^iq)^{-1}} \left( \frac{H_{r;s}(u;1)}{u^{d+1}} \right) & = \frac{1}{(M-1)!}\lim_{u\to (\xi_s^iq)^{-1}} \frac{d^{M-1}}{du^{M-1}} \left((u-(\xi_s^iq)^{-1})^M \frac{H_{r;s}(u;1)}{u^{d+1}} \right) \\ & = \frac{1}{(M-1)!}\lim_{u\to (\xi_s^iq)^{-1}} \frac{d^{M-1}}{du^{M-1}} \frac{K(u)}{u^{d+1}}\\ & = \frac{1}{(M-1)!} \sum_{m=0}^{M-1} \binom{M-1}{m} K^{(M-m)}\left((\xi_s^iq)^{-1}\right) (d+1)\cdots (d+m) (\zeta_s^iq)^{d+m+1}\\ & = Q_i(d)q^d \end{align*} where $$K(u) = (-(\xi_s^iq)^{-1})^M \prod_{\substack{(j,s)=1 \\ j\not=i}} \frac{1}{1-q\xi_s^ju} \widetilde{H}_{r;s}(u;1)$$ and $Q_i$ is a polynomial of exact degree $\frac{\phi(r)}{\phi(s)}-1$. Setting $P_{r,s} = \sum_{(i,s)=1} Q_i$ finishes the proof. \end{proof} \begin{cor}\label{aymptcor} Suppose $q\equiv 1 \mod{r}$ and $2g\equiv 0 \mod{r-1}$, then there is a polynomial $P_r$ of degree $\phi(r)-1$ such that $$|\F^{thin}_r(g)| = P_r(g)q^{\frac{2g+2r-2}{r-1}} + O\left(q^{\left(\frac{1}{2}+\epsilon\right)\frac{2g}{r-1}}\right).$$ In particular, the leading coefficient of $P_r$ will be $$C_r := C_{r,1}\left(\frac{2}{r-1}\right)^{\phi(r)-1} \frac{q+\phi(r)}{q} \not=0$$ where $C_{r,1}$ is the leading coefficient of $P_{r,1}$ as in Lemma \ref{aymptlem}. \end{cor} \begin{proof} Recall that if $d=\frac{2g+2r-2}{r-1}$ then \begin{align}\label{a=0form} \frac{1}{r}|\F^{thin}_r(g)| = & |\widehat{\F}^{thin}_{r;0}(d)| + \sum_{(k,r)=1} | \widehat{\F}^{thin}_{r;k}(d-1)| \nonumber\\ = & \left[u^{d}\right] \mathcal{G}^{thin}_{r;0}(u;1) + \sum_{(k,r)=1} \left[u^{d-1}\right] \mathcal{G}^{thin}_{r;k}(u;1) \nonumber \\ = & \frac{1}{r} \sum_{s|r} \sum_{(j,s)=1} \left[u^{d}\right] H_{r;s}(u;1) + \frac{1}{r} \sum_{s|r} \sum_{\substack{(k,r)=1 \\ (j,s)=1}} \xi_s^{-jk}\left[u^{d-1}\right] H_{r;s}(u;1)\nonumber \\ = & \frac{1}{r} \sum_{s|r}\phi(s) [u^{d}] H_{r;s}(u;1) + \frac{\phi(r)}{r} \sum_{s|r}\mu(s) [u^{d-1}] H_{r;s}(u;1)\\ = & \frac{1}{r} \sum_{s|r} \phi(s) P_{r,s}(d)q^{d} + \frac{\phi(r)}{r} \sum_{s|r} \mu(s) P_{r,s}(d-1) q^{d-1}+ O\left( q^{(\frac{1}{2}+\epsilon)d} \right)\nonumber \end{align} with $P_{r,s}$ as in Lemma \ref{aymptlem}. Hence, setting \begin{align}\label{P_r(g)} P_r(g) = \sum_{s|r} \phi(s) P_{r,s}(d) + \frac{\phi(r)}{q} \sum_{s|r} \mu(s) P_{r,s}(d-1) \end{align} we get that $P_r(g)$ will be a polynomial of degree at most $\phi(r)-1$. Further, we see that the $\phi(r)-1$ coefficient is obtained only when $s=1$ and so will be $$C_r = C_{r,1}\left(\frac{2}{r-1}\right)^{\phi(r)-1} \frac{q+\phi(r)}{q} \not=0 $$ where $C_{r,1}$ is the leading coefficient of $P_{r,1}$. \end{proof} \subsection{Proof of Proposition \ref{unramprop}} \begin{proof}[proof of Proposition \ref{unramprop}] Combining Lemmas \ref{genserlem} and \ref{incexclem} and recalling that $d=\frac{2g+2r-2}{r-1}$, \begin{align*} \frac{1}{r}|\F^{thin}_r(g;P)| = & \frac{1}{r} \sum_{s|r} \phi(s) [u^d] H_{r,s}(u;P) + \frac{\phi(r)}{r} \sum_{s|r}\mu(s)[u^{d-1}] H_{r,s}(u;P) \\ = & \frac{1}{r} \sum_{s|r}\phi(s) \sum_{a=0}^{\lfloor \frac{d}{n}\rfloor} \left(-\frac{\phi(r)}{\phi(s)}\right)^a \sum_{\substack{i_1,\dots,i_a \\ (i_j,s)=1}} \xi_s^{n\sum i_j } [u^{d-an}] H_{r;s}(u;1) \\ & + \frac{\phi(r)}{r} \sum_{s|r}\mu(s) \sum_{a=0}^{\lfloor \frac{d-1}{n}\rfloor} \left(-\frac{\phi(r)}{\phi(s)}\right)^a \sum_{\substack{i_1,\dots,i_a \\ (i_j,s)=1}} \xi_s^{n\sum i_j } [u^{d-1-an}] H_{r;s}(u;1). \end{align*} We will split this sum into three cases: \begin{enumerate} \item $a=0$ \item $s\not=1$, $a\not=0$ \item $s=1$, $a\not=0$ \end{enumerate} Case 1: $a=0$ In this case, we get a contribution of $$\frac{1}{r} \sum_{s|r}\phi(s) [u^{d}] H_{r;s}(u;1) + \frac{\phi(r)}{r} \sum_{s|r}\mu(s) [u^{d-1}] H_{r;s}(u;1)$$ which we see by \eqref{a=0form} is exactly $\frac{1}{r}|\F^{thin}_r(g)|$. Case 2: $s\not=1$, $a\not=0$ By Lemma \ref{aymptlem} we have that $$[u^{d-an}]H_{r;s}(u) \ll (d-an)^{\frac{\phi(r)}{\phi(s)}-1} q^{d-an} \ll d^{\phi(r)-2}q^{d-an}$$ and so since we are assume $q\equiv1 \mod{r}$, we get $r\leq q$ and the total contribution from these terms will be $O_r\left(d^{\phi(r)-2}q^{d-n}\right)$. Case 3: $s=1$, $a\not=0$ Finally, by Lemma \ref{aymptlem}, the rest is \begin{align*} &\frac{1}{r} \sum_{a=1}^{\lfloor \frac{d}{n}\rfloor} \left(-\phi(r)\right)^a\left( [u^{d-an}]H_{r;1}(u;1)+\phi(r) [u^{d-1-an}] H_{r;1}(u;1)\right)\\ = & \frac{q^d}{r}C_{r,1} \frac{q+\phi(r)}{q} \sum_{a=1}^{\lfloor \frac{d}{n}\rfloor} \left( \frac{-\phi(r)}{q^n} \right)^a (d-an)^{\phi(r)-1} + O\left( d^{\phi(r)-2}q^{d-n}\right). \end{align*} Now, using the Corollary \ref{aymptcor}, we have that $$|\F_r^{thin}(g)| = C_{r,1} \frac{q+\phi(r)}{q} d^{\phi(r)-1}q^d + O\left( d^{\phi(r)-2}q^d\right)$$ and so \begin{align*} \frac{|\F_r^{thin}(g;P)|}{|\F_r^{thin}(g)|} = 1 + \sum_{a=1}^{\lfloor \frac{d}{n}\rfloor} \left(\frac{-\phi(r)}{q^n}\right)^a \left(1-\frac{an}{d}\right)^{\phi(r)-1} + O\left(\frac{1}{gq^n}\right) \end{align*} \end{proof} \subsection{Prime at Infinity} Recall that if $P_{\infty}$ is the prime at infinity then we say $P_\infty|F$ if and only if $\deg(F)\not\equiv0\mod{r}$. Hence, we get that \begin{align}\label{infprimram} \widehat{\F}_r^{thin}(d,P_\infty) & := \{ F\in\widehat{\F}_r^{thin}(d) : (F,P_{\infty})=1 \} \\ & = \{ F\in\widehat{\F}_r^{thin}(d) : P_\infty \nmid F \} \nonumber \\ & = \widehat{\F}^{thin}_{r;0}(d) \nonumber \end{align} Thus, we can extend Propositon \ref{unramprop} to include the prime at infinity as well. \begin{lem}\label{unrinflem} If $q\equiv 1\mod{r}$ and $2g\equiv 0 \mod{r-1}$, then \begin{align}\label{unrinfeq} \frac{|\F^{thin}_{r}(g,P_{\infty})|}{|\F^{thin}_r(g)|} = \frac{q}{q+\phi(r)} + O\left( \frac{1}{g} \right). \end{align} \end{lem} \begin{proof} By \eqref{infprimram}, we see that since there are $r$ different possible leading coefficients, $|\F^{thin}_r(g,P_{\infty})| = r| \widehat{\F}^{thin}_{r;0}(d)|$ where $d=\frac{2g+2r-2}{r-1}$. Therefore, \begin{align*} \frac{|\F^{thin}_{r}(g,P_{\infty})|}{|\F^{thin}_r(g)|} & = \frac{r|\widehat{\F}^{thin}_{r;0}(d)|}{|\F^{thin}_r(g)|} = \frac{ \sum_{s|r}\phi(s) P_{r,s}(d)}{ P_r(g) } + O\left( q^{-(\frac{1}{2}-\epsilon)\frac{2g}{r-1}} \right) \\ & = \frac{C_{r,1}}{C_r} + O\left(\frac{1}{g}\right) \\ & = \frac{q}{q+\phi(r)} + O\left(\frac{1}{g}\right) \end{align*} where $P_{r,s}$ and $P_r$ are as in Lemma \ref{aymptlem} and Corollary \ref{aymptcor}, respectively. \end{proof} For homogeneity, we can rewrite the right hand side of \eqref{unrinfeq} to look more like \eqref{unrampropeq}. \begin{cor}\label{unrinfcor} Let $q\equiv 1 \mod{r}$ and $2g\equiv 0\mod{r-1}$. Then \begin{align} \frac{|\F^{thin}_r(g;P_{\infty})|}{|\F^{thin}_r(g)|} = \sum_{a=0}^{d } \left(\frac{-\phi(r)}{q}\right)^a \left(1-\frac{a}{d}\right)^{\phi(r)-1} + O_r\left(\frac{1}{gq}\right). \end{align} where $d=\frac{2g+2r-2}{r-1}$. Comparing this to Proposition \ref{unramprop} we see it is equivalent to setting $n=\deg(P_{\infty})=1$. \end{cor} \begin{proof} This follows from the fact that $$\sum_{a=0}^{ d } \left(\frac{-\phi(r)}{q}\right)^a \left(1-\frac{a}{d}\right)^{\phi(r)-1} = \frac{q}{q+\phi(r)} + O\left(\frac{1}{g}\right)$$ and that $O\left(\frac{1}{g}\right) = O\left(\frac{1}{gq}\right)$ since $q$ is constant. \end{proof} \subsection{Proof of Theorem \ref{maintermthm}} \begin{proof}[proof of Theorem \ref{maintermthm}] By Proposition \ref{unramprop} for finite primes and Corollary \ref{unrinfcor} for the infinite prime, we get \begin{align*} MT_r(g,n) = & \frac{-q^{-n/2}}{|\F^{thin}_r(g)|} \sum_{\deg(P)|n} \deg(P) \sum_{\substack{i=1 \\ r|\frac{in}{\deg(P)}}}^{r-1} \sum_{\substack{F\in\F^{thin}_r(g) \\ P\nmid F}} 1 \\ = & -q^{-n/2} \sum_{\deg(P)|n}\deg(P) \left(\left(r,\frac{n}{\deg(P)}\right)-1\right) \sum_{a=0}^{\lfloor \frac{d}{\deg(P)}\rfloor} \left(\frac{-\phi(r)}{q^{\deg(P)}}\right)^a \left(1-\frac{a\deg(P)}{d}\right)^{\phi(r)-1} \\ & +O\left( \frac{1}{gq^{n/2}} \sum_{\deg(P)|n}\frac{\deg(P)}{q^{\deg(P)}} \right) \end{align*} Now, setting \begin{align}\label{D_r(g,n)} D_r(g,n) := q^{-n/2} \sum_{\deg(P)|n}\deg(P) \left(\left(r,\frac{n}{\deg(P)}\right)-1\right) \sum_{a=1}^{\lfloor \frac{d}{\deg(P)}\rfloor} \left(\frac{-\phi(r)}{q^{\deg(P)}}\right)^a \left(1-\frac{a\deg(P)}{d}\right)^{\phi(r)-1} \end{align} we find $$D_r(g,n) \ll q^{-n/2} \sum_{\deg(P)|n} \frac{\deg(P)}{q^{\deg(P)}} \ll q^{-n/2} \sum_{m|n} \frac{m}{q^m} \pi_q(m) \ll q^{-n/2} \sum_{m|n} 1 \ll nq^{-n/2}$$ where $\pi_q(m)$ is the number of prime polynomials of degree $m$ and hence $\pi_q(m) = \frac{q^m}{m} + O(q^{m/2})$. Likewise, we then get that the error term will be $$\frac{1}{gq^{n/2}} \sum_{\deg(P)|n}\frac{\deg(P)}{q^{\deg(P)}} \ll \frac{n}{gq^{n/2}}$$ It remains to consider the contribution from the $a=0$ term: \begin{align}\label{a=0} -q^{-n/2} \sum_{\deg(P)|n}\deg(P) \left(\left(r,\frac{n}{\deg(P)}\right)-1\right). \end{align} We know that $$\sum_{\deg(P)|n}\deg(P)=q^n.$$ Therefore, we need only consider \begin{align}\label{MTsum1} \sum_{\deg(P)|n}\deg(P) \left(r,\frac{n}{\deg(P)}\right) & = \sum_{m|n} m\pi_q(m) \left(r,\frac{n}{m}\right) = \sum_{s|r} s \sum_{\substack{m|n \\ \left(r,\frac{n}{m}\right) =s }} m\pi_q(m) \end{align} Now, $\left(r,\frac{n}{m}\right)=s$ if and only if $m|\frac{n}{s}$ and $\left(\frac{n}{ms},\frac{r}{s}\right)=1$. Hence, we can rewrite \eqref{MTsum1} as \begin{align*} \sum_{s|r}s \sum_{m|\frac{n}{s}} m\pi_q(m) \sum_{s'|\left(\frac{n}{ms},\frac{r}{s}\right)}\mu(s') & = \sum_{ss'|r}s \sum_{m|\frac{n}{ss'}}\mu(s') m\pi_q(m)\\ & = \sum_{s''|r}s'' \sum_{m|\frac{n}{s''}} m\pi_q(m) \sum_{s'|s''}\frac{\mu(s')}{s'} \\ & = \sum_{s''|r} \phi(s'') \sum_{m|\frac{n}{s''}} m\pi_q(m) \\ & = \sum_{s''|(r,n)} \phi(s'') q^{n/s''} \end{align*} where the last equality follows from the fact that if $s''\nmid n$, then the inner sum is empty. Therefore, we can rewrite \eqref{a=0} to get that the $a=0$ term contributes a total of $$-q^{-n/2} \sum_{\deg(P)|n}\deg(P) \left(\left(r,\frac{n}{\deg(P)}\right)-1\right) = \frac{-1}{q^{n/2}}\sum_{\substack{s|(r,n) \\ s\not=1}} \phi(s) q^{n/s} $$ \end{proof} \section{Computing the Error Term} Recall \begin{align*} ET_r(g,n) &= \frac{-q^{-n/2}}{|\F^{thin}_r(g)|} \sum_{\deg(P)|n} \deg(P) \sum_{\substack{i=1 \\ r\nmid \frac{in}{\deg(P)}}}^{r-1} \sum_{F\in\F^{thin}_r(g) } \left(\frac{F}{P}\right)_r^{\frac{in}{\deg(P)}}\\ \end{align*} In this section we will prove the following theorem. \begin{thm}\label{ETthm} Let $q\equiv 1 \mod{r}$ and $2g\equiv 0 \mod{r-1}$. If $(r,n)=1$ we get $ET_r(g,n)=0$. Otherwise $$ET_r(g,n) \ll \frac{((r,n)-1)q^{n/2}}{q^{(\frac{1}{2}-\epsilon)\frac{2g}{r-1}}}$$ \end{thm} \subsection{The Prime at Infinity} Recall that if $P_{\infty}$ is the prime at infinity and $F\in\widehat{\F}_r^{thin}$ then $$\left( \frac{\alpha F}{P_{\infty}}\right)_r = \begin{cases} \chi_{r;1}(\alpha) & F\in\widehat{\F}^{thin}_{r;0} \\ 0 & \mbox{otherwise} \end{cases}.$$ Thus if $d=\frac{2g+2r-2}{r-1}$, we get the contribution to $ET_r(g,n)$ from the prime at infinity will be $$-\frac{|\widehat{\F}_{r;0}^{thin}(d)|}{q^{n/2}|\F_r^{thin}(g)} \sum_{\substack{i=1 \\ r\nmid in}}^{r-1}\sum_{\alpha\in\Ff_q^*/(\Ff_q^*)^r} \chi_{r;1}^{in}(\alpha).$$ Now, if we let $\beta$ be a generator of $\Ff_q^*$, then we find $$\sum_{\alpha\in\Ff_q^*/(\Ff_q^*)^r} \chi_{r;1}^{in}(\alpha) = \sum_{j=0}^{r-1} \chi_{r;1}^{in}(\beta^j) = \sum_{j=0}^{r-1} \xi_r^{ijn} = 0 $$ since we are assuming $r\nmid in$ and $\xi_r$ is a primitive $r^{th}$ root of unity. Hence, the prime at infinity doesn't contribute to $ET_r(g,n)$ and so we may only consider the finite primes. \subsection{Reducing to Monic Polynomials} We may rewrite \begin{align*} ET_r(g,n) &= \frac{-q^{-n/2}}{|\F^{thin}_r(g)|} \sum_{\deg(P)|n} \deg(P) \sum_{\substack{i=1 \\ r\nmid \frac{in}{\deg(P)}}}^{r-1} \sum_{\substack{F\in\F^{thin}_r(g) \\ monic}} \left(\frac{ F}{P}\right)_r^{\frac{in}{\deg(P)}} \sum_{\alpha\in \Ff_q^*/(\Ff_q^*)^r} \left(\frac{\alpha}{P}\right)_r^{\frac{in}{\deg(P)}} \end{align*} where here the sum of primes is just over finite primes. Now, if $\beta$ is a generator for $\Ff_{q^{\deg(P)}}^*$, then $\beta^{\frac{q^{\deg(P)}-1}{q-1}}$ will be a generator for $\Ff_q^*$ and so we may write \begin{align*} \sum_{\alpha\in \Ff_q^*/(\Ff_q^*)^r}\left(\frac{\alpha}{P}\right)_r^{\frac{in}{\deg(P)}}& = \sum_{j=0}^{r-1} \left(\frac{\beta^{j\frac{q^{\deg(P)}-1}{q-1}}}{P}\right)_r^{\frac{in} {\deg(P)}} = \sum_{j=0}^{r-1} \xi_r^{\frac{ijn}{\deg(P)}\frac{q^{\deg(P)}-1}{q-1}} = \sum_{j=0}^{r-1} \xi_r^{ijn}\\ & = \begin{cases} r & r|in \\ 0 & \mbox{otherwise} \end{cases}. \end{align*} Thus, we must have that $i = \frac{r}{(r,n)}j$ for some $j=1,\dots,(r,n)-1$ such that $(r,n)\nmid \frac{jn}{\deg(P)}$. Hence, we may rewrite \begin{align*} ET_r(g,n) &= \frac{-rq^{-n/2}}{|\F^{thin}_r(g)|} \sum_{\deg(P)|n} \deg(P) \sum_{\substack{j=1 \\(r,n)\nmid \frac{jn}{\deg(P)}}}^{(r,n)-1} \sum_{\substack{F\in\F^{thin}_r(g) \\ monic}} \left(\frac{ F}{P}\right)_{(r,n)}^{\frac{jn}{\deg(P)}} \end{align*} where, again, the prime sum is only over finite primes. In particular, if $(r,n)=1$, then we see there are no such $j$ and so $ET_r(g,n)=0$ which proves the first statement of Theorem \ref{ETthm} \subsection{Proof of Theorem \ref{ETthm}} With the same notation as in Section \ref{notation}, we define \begin{align} S_{j;k}(d;P) := \sum_{F\in\widehat{\F}^{thin}_{r;k}(d)} \left(\frac{F}{P}\right)_{(r,n)}^{\frac{jn}{\deg(P)}}. \end{align} Then if we denote $d=\frac{2g+2r-2}{r-1}$, we get $$ET_r(g,n) = \frac{-rq^{-n/2}}{|\F^{thin}_r(g)|} \sum_{\deg(P)|n} \deg(P) \sum_{\substack{j=1 \\(r,n)\nmid \frac{jn}{\deg(P)}}}^{(r,n)-1} \left(S_{j;0}(d;P) + \sum_{(k,r)=1} S_{j;k}(d-1;P) \right) $$ So it remains to determine the growth of $S_{j;k}(d;P)$. Define the generating series $$\mathcal{K}_{j;k}(u;P) := \sum_{d=0}^{\infty} S_{j;k}(d;P)u^d .$$ \begin{lem} The function $\mathcal{K}_{j;k}(u;P)$ is analytic in the region $|u|< q^{-1}$ and can be analytically continued to the region $|u|<q^{-1/2}$. \end{lem} \begin{proof} Since $\widehat{\F}^{thin}_{r;k}(d)$ can be given by tuples of square free polynomials we can write \begin{align*} \mathcal{K}_{j;k}(u;P) & = \sum_{(f_i)_{(i,r)=1}} \mu^2 \left(\prod f_i\right) \frac{1}{r} \sum_{t=0}^{r-1} \xi_r^{t\left(\sum i\deg(f_i)-k\right)} \left( \frac{\prod f_i^i}{P} \right)_{(r,n)}^{\frac{jn}{\deg(P)}} u^{\sum \deg(f_i)} \\ & = \frac{1}{r} \sum_{t=0}^{r-1} \xi_r^{-tk} \sum_{(f_i)_{(i,r)=1}} \mu^2 \left(\prod f_i\right) \prod_{(i,r)=1} \left(\left(\frac{f_i}{P}\right)_{(r,n)}^{\frac{ijn}{\deg(P)}} \left(\xi_r^{ti}u\right)^{\deg(f_i)}\right)\\ & = \frac{1}{r} \sum_{t=0}^{r-1} \xi_r^{-tk} \prod_Q \left( 1 + \sum_{(i,r)=1} \left(\frac{Q}{P}\right)_{(r,n)}^{\frac{ijn}{\deg(P)}} \left(\xi_r^{ti}u\right)^{\deg(Q)} \right)\\ & = \frac{1}{r} \sum_{t=0}^{r-1} \xi_r^{-tk} \prod_{(i,r)=1} \prod_Q \left(1 - \left(\frac{Q}{P}\right)_{(r,n)}^{\frac{ijn}{\deg(P)}} \left(\xi_r^{ti}u\right)^{\deg(Q)}\right)^{-1} \widetilde{\mathcal{K}}_{j;k}(u;P) \end{align*} where the product is over all monic prime polynomials and $\widetilde{\mathcal{K}}_{j;k}(u;P) = \prod_Q \left(1+O(u^{2\deg(Q)})\right)$ and so absolutely converges for $|u|<q^{-1/2}$. Further, since the first infinite product is of the form $\prod_Q \left(1+O(u^{\deg(Q)})\right)$, we get that $\mathcal{K}_{j;k}(u;P)$ absolutely converges for $|u|<q^{-1}$. Now, we see that $$\prod_Q \left(1 - \left(\frac{Q}{P}\right)_{(r,n)}^{\frac{ijn}{\deg(P)}} \left(\xi_r^{ti}u\right)^{\deg(Q)}\right)^{-1} = L\left(\xi_r^{ti}u, \left(\frac{\cdot}{P}\right)_{(r,n)}^{\frac{ijn}{\deg(P)}}\right)$$ is just the $L$-function of the Dirichlet character $\left(\frac{\cdot}{P}\right)_{(r,n)}^{\frac{ijn}{\deg(P)}}$. Further, since we always have $(r,n)\nmid \frac{jn}{\deg(P)}$ and $(i,r)=1$, this will be a non-trivial Dirichlet character. Therefore, this infinite product can be extended to an entire function and hence $\mathcal{K}_{j;k}(u;P)$ can be analytically extended to the region $|u|<q^{-1/2}$. \end{proof} \begin{cor} $$S_{j;k}(d;P) \ll q^{(\frac{1}{2}+\epsilon)d}$$ \end{cor}\label{ETcor} \begin{proof} Let $\Gamma = \{u : |u|= q^{-1/2-\epsilon}\}$. Then $\mathcal{K}_{j;k}(u;P)$ can be analytically extended to the interior of $\Gamma$ and so $$S_{j;k}(d;P) = \frac{1}{2\pi i} \oint_{\Gamma} \frac{\mathcal{K}_{j;k}(u;P)}{u^{d+1}}du \ll q^{(\frac{1}{2}+\epsilon)d}$$ \end{proof} \begin{proof}[proof of Theorem \ref{ETthm}] By Corollary \ref{ETcor}, we get that \begin{align*} ET_r(g,n) & = \frac{-rq^{-n/2}}{|\F^{thin}_r(g)|} \sum_{\deg(P)|n} \deg(P) \sum_{\substack{j=1 \\(r,n)\nmid \frac{jn}{\deg(P)}}}^{(r,n)-1} \left(S_{j;0}(d;P) + \sum_{(k,r)=1} S_{j;k}(d-1;P) \right) \\ & \ll \frac{q^{-n/2}}{|\F^{thin}_r(g)|} \sum_{\deg(P)|n} \deg(P) \sum_{\substack{j=1 \\(r,n)\nmid \frac{jn}{\deg(P)}}}^{(r,n)-1} q^{(\frac{1}{2}+\epsilon)d}\\ & \ll \frac{(r,n)-1}{q^{\frac{n}{2} + (\frac{1}{2}-\epsilon)d}} \sum_{\deg(P)|n}\deg(P) = \frac{((r,n)-1)q^{n/2}}{q^{(\frac{1}{2}-\epsilon)d}} \end{align*} \end{proof} \section{Proof of Main Results} \subsection{Proof of Theorem \ref{thinthm} and Corollary \ref{thincor}} \begin{proof}[Proof of Theorem \ref{thinthm}] By the definition of $MT_r(g,n)$ and $ET_r(g,n)$, we get \begin{align*} \langle \Tr(\Theta_C^n) \rangle_{\Hh^{thin}_r(g)} & = MT_r(g,n) + ET_r(g,n) \\ & = \frac{-1}{q^{n/2}}\sum_{\substack{s|(r,n) \\ s\not=1}}\phi(s)q^{n/s} -D_r(g,n)+ O\left(\frac{1}{gq^{\frac{n}{2}}}+q^{\frac{n}{2}-(\frac{1}{2}+\epsilon)\frac{2g}{r-1}}\right) \end{align*} where the second line follows from Theorems \ref{maintermthm} and \ref{ETthm}. Moreover, if $(r,n)=1$, then both $MT_r(g,n)=ET_r(g,n)=0$ and so $\langle \Tr(\Theta_C^n) \rangle_{\Hh^{thin}_r(g)}=0$ as well. \end{proof} \begin{proof}[Proof of Corollary \ref{thincor}] Applying Poisson summation one can show that for any unitary matrix $U$ and any even Schwartz test function, we have $$\mathcal{D}(U,f) = \frac{1}{2g}\hat{f}(0) + \frac{1}{g}\sum_{n=1}^{\infty} \hat{f}\left(\frac{n}{2g}\right) \Tr(U^n). $$ Now, since $D_r(g,n) \ll nq^{-n/2}$ then as long as $C_r\log_q(g) \leq n \leq (1-\epsilon)\frac{2g}{r-1}$, we can use Theorem \ref{thinthm} to write \begin{align*} \langle \Tr(\Theta_C^n) \rangle_{\Hh^{thin}_r(g)} & = \begin{cases} -1 & \mbox{ $r$ and $n$ even} \\ 0 & \mbox{ otherwise} \end{cases} + O\left(\frac{1}{g}\right)\\ & = \begin{cases} \int_{USp(2g)} Tr(U^n) dU & r \mbox{ even} \\ \int_{U(2g)} Tr(U^n) dU & r \mbox{odd} \end{cases} + O\left(\frac{1}{g}\right) \end{align*} Suppose $r$ is even. Then, if we assume $\supp(\hat{f}) \subset \left(-\alpha,\alpha\right)$, for some $\alpha<\frac{1}{r-1}$ we get \begin{align*} \langle \mathcal{D}(L_C,f) \rangle_{\Hh^{thin}_r(g)} & = \langle \mathcal{D}(\Theta_C,f) \rangle_{\Hh^{thin}_r(g)}\\ & = \hat{f}(0) + \frac{1}{g}\sum_{n=1}^{\infty} \hat{f}\left(\frac{n}{2g}\right) \langle \Tr(\Theta_C^n) \rangle_{\Hh^{thin}_r(g)}\\ & = \hat{f}(0) + \frac{1}{g}\sum_{n=1}^{2\alpha g} \hat{f}\left(\frac{n}{2g}\right) \int_{USp(2g)} Tr(U^n) dU + O\left(\frac{1}{g} \sum_{n=1}^{C_r\log_q(g)} \hat{f}\left(\frac{n}{2g}\right) \frac{n}{q^{n/2}} + \frac{1}{g^2}\right) \\ & = \int_{USp(2g)} \left(\hat{f}(0) + \frac{1}{g}\sum_{n=1}^{\infty} \hat{f}\left(\frac{n}{2g}\right) Tr(U^n) \right)dU + O\left(\frac{1}{g^{1-\epsilon}}\right) \\ & = \int_{USp(2g)} \mathcal{D}(U,f) dU + O\left(\frac{1}{g^{1-\epsilon}}\right). \end{align*} The same argument works for $r$ odd with $USp(2g)$ replaced with $U(2g)$. \end{proof} \subsection{Proof of Theorem \ref{refinedthm}} \begin{proof}[Proof of Theorem \ref{refinedthm}] For any $\theta,s$ let $$h(x) := f\left( 2g \left(\frac{\theta +i\log(q)\left(\frac{1}{s}-\frac{1}{2}\right)}{2\pi}-x \right)\right).$$ Then $$\hat{h}(\xi) = \frac{q^{\frac{\xi}{s}}}{q^{\frac{\xi}{2}}} \frac{e^{i \theta\xi}}{2g}\hat{f}\left(\frac{\xi}{2g}\right).$$ Now, applying Poisson summation, and using the restriction of the support of $\hat{f}$, we get \begin{align*} \sum_{n\in\mathbb{Z}}f \left( 2g \left(\frac{\theta +i\log(q)\left(\frac{1}{s}-\frac{1}{2}\right)}{2\pi}-n \right)\right) & = \sum_{n\in\mathbb{Z}} h(n) = \sum_{n\in\mathbb{Z}} \hat{h}(n) \\ & = \sum_{n\in\mathbb{Z}} \frac{q^{\frac{n}{s}}}{q^{\frac{n}{2}}} \frac{e^{i \theta n}}{2g}\hat{f}\left(\frac{n}{2g}\right) \\ & = \sum_{n=0}^{\frac{2g}{r-1}} \frac{q^{\frac{n}{s}}}{q^{\frac{n}{2}}} \frac{e^{i \theta n}}{2g}\hat{f}\left(\frac{n}{2g}\right) \end{align*} Therefore, for $U\in M_r(2g)$ with eigenangles $\theta_1,\dots,\theta_{2g}$, \begin{align*} \mathcal{D}_q(U,f) & = \sum_{\substack{s|r\\s\not=1}} \sum_{j=1}^{\frac{2g}{r-1}} \sum_{(k,s)=1} \sum_{n\in\Z} f\left( 2g \left(\frac{\theta_{\frac{r}{s}jk} +i\log(q)\left(\frac{1}{s}-\frac{1}{2}\right)}{2\pi}-n \right)\right) \\ & = \sum_{\substack{s|r\\s\not=1}} \sum_{j=1}^{\frac{2g}{r-1}} \sum_{(k,s)=1} \sum_{n=0}^{\frac{2g}{r-1}} \frac{q^{\frac{n}{s}}}{q^{\frac{n}{2}}} \frac{e^{i \theta_{\frac{r}{s}jk} n}}{2g}\hat{f}\left(\frac{n}{2g}\right) \\ & = \hat{f}(0) + \frac{1}{2g} \sum_{\substack{s|r\\s\not=1}} \sum_{n=1}^{\frac{2g}{r-1}}\frac{q^{\frac{n}{s}}}{q^{\frac{n}{2}}}\hat{f}\left(\frac{n}{2g}\right) \sum_{j=1}^{\frac{2g}{r-1}} \sum_{(k,s)=1} e^{i \theta_{\frac{r}{s}jk} n} \\ & = \hat{f}(0) + \frac{1}{2g} \sum_{\substack{s|r\\s\not=1}} \sum_{n=1}^{\frac{2g}{r-1}}\frac{q^{\frac{n}{s}}}{q^{\frac{n}{2}}}\hat{f}\left(\frac{n}{2g}\right) \Tr(U_s^n) \end{align*} where we recall that $U_s$ is defined to be $U$, restricted to the vector space with basis $\{e_{\frac{r}{s}jk}: j=1,\dots,\frac{2g}{r-1}, (k,s)=1 \}$, where the $e_i$ are the standard basis vectors. In particular, as $U$ runs over all $M_r(2g)$, then $U_s$ runs over all $M_{(s)}\left(\frac{\phi(s)2g}{r-1}\right)$. Hence, \begin{align*} \int_{M_r(2g)} \mathcal{D}_q(U,f) dU & = \hat{f}(0) + \frac{1}{2g} \sum_{\substack{s|r\\s\not=1}} \sum_{n=1}^{\frac{2g}{r-1}}\frac{q^{\frac{n}{s}}}{q^{\frac{n}{2}}}\hat{f}\left(\frac{n}{2g}\right) \int_{M_{(s)}\left(\frac{\phi(s)2g}{r-1}\right)} \Tr(U_s^n) dU \\ & = \hat{f}(0) - \frac{1}{2g} \sum_{\substack{s|r\\s\not=1}} \phi(s) \sum_{n=1}^{\frac{2g}{s(r-1)}}q^{n(1-\frac{s}{2})}\hat{f}\left(\frac{ns}{2g}\right) \end{align*} Combining everything, we then get \begin{align*} \langle \mathcal{D}(L_C,f) \rangle_{\Hh_r^{thin}(g)} & = \hat{f}(0) + \frac{1}{2g}\sum_{n=1}^{\frac{2g}{r-1}} \hat{f}\left(\frac{n}{2g}\right) \langle \Tr(\Theta_C^n) \rangle_{\Hh_r^{thin}(g)} \\ & = \hat{f}(0) - \frac{1}{2g} \sum_{n=1}^{\frac{2g}{r-1}} \hat{f}\left(\frac{n}{2g}\right)\left( \sum_{\substack{s|(n,r) \\ s\not=1 }} \phi(s)\frac{q^{n/s}}{q^{n/2}} + D_r(g,n)\right) + O\left(\frac{1}{g^2}\right) \\ & = \hat{f}(0) - \frac{1}{2g} \sum_{\substack{s|r \\ s\not=1}} \phi(s) \sum_{n=1}^{\frac{2g}{s(r-1)}} q^{n(1-\frac{s}{2})} \hat{f}\left(\frac{ns}{2g}\right) - \frac{1}{2g} \sum_{n=1}^{\frac{2g}{r-1}} \hat{f}\left(\frac{n}{2g}\right)D_r(g,n) + O\left(\frac{1}{g^2}\right) \\ & = \int_{M_r(2g)} \mathcal{D}_q(U,f) dU - \frac{1}{2g}\sum_{n=1}^{\frac{2g}{r-1}} \hat{f}\left(\frac{n}{2g}\right)D_r(g,n) + O\left(\frac{1}{g^2}\right) \end{align*} Finally, it remains to determine the contribution from $D_r(g,n)$. Recalling the definition of $D_r(g,n)$ from \eqref{D_r(g,n)}, we get that the contribution to the above will be \begin{align*} & \sum_{n=1}^{\frac{2g}{r-1}} \hat{f}\left(\frac{n}{2g}\right) \sum_{\deg(P)|n}\frac{\deg(P)}{q^{n/2}} \left(\left(r,\frac{n}{\deg(P)}\right)-1\right) \sum_{a=1}^{\lfloor \frac{d}{\deg(P)}\rfloor} \left(\frac{-\phi(r)}{q^{\deg(P)}}\right)^a \left(1-\frac{a\deg(P)}{d}\right)^{\phi(r)-1}\\ = & \sum_{m=1}^{\frac{2g}{r-1}} m \sum_{\deg(P)=m} \sum_{a=1}^{\lfloor \frac{d}{m}\rfloor} \left(\frac{-\phi(r)}{q^{m}}\right)^a \left(1-\frac{am}{d}\right)^{\phi(r)-1} \sum_{k=1}^{\frac{2g}{m(r-1)}} \hat{f}\left(\frac{mk}{2g}\right) \frac{(r,k)-1}{q^{mk/2}}. \end{align*} Now, we have $\hat{f}(\frac{mk}{2g}) = \hat{f}(0) + O\left(\frac{mk}{2g}\right)$, and so \begin{align*} \sum_{k=1}^{\frac{2g}{m(r-1)}} \hat{f}\left(\frac{mk}{2g}\right) \frac{(r,k)-1}{q^{mk/2}} & = \hat{f}(0)\sum_{k=1}^{\frac{2g}{m(r-1)}} \frac{(r,k)-1}{q^{mk/2}} + O\left(\frac{m}{2g} \sum_{k=1}^{\frac{2g}{m(r-1)}}k \frac{(r,k)-1}{q^{mk/2}}\right) \\ & = \hat{f}(0) \sum_{\substack{s|r \\ s\not=1}} \phi(s) \sum_{k=1}^{\frac{2g}{ms(r-1)}} \frac{1}{q^{msk/2}} +O\left(\frac{m}{gq^m}\right) \\ & = \hat{f}(0) \sum_{\substack{s|r \\ s\not=1}} \frac{\phi(s)}{q^{ms/2}-1} + O\left(\frac{m}{gq^m}\right) \end{align*} This error term contributes at most $$\frac{1}{2g} \sum_{m=1}^\frac{2g}{r-1} \frac{m^2}{q^m} \sum_{\deg(P)=m} \sum_{a=1}^{\lfloor \frac{d}{m}\rfloor} \left(\frac{\phi(r)}{q^{m}}\right)^a \left(1-\frac{am}{d}\right)^{\phi(r)-1} \ll \frac{1}{2g} \sum_{m=0}^\frac{2g}{r-1} \frac{m^2\pi_q(m)}{q^{2m}} \ll \frac{1}{2g} $$ The remaining is thus \begin{align*} & \hat{f}(0) \sum_{\substack{s|r \\ s\not=1}} \phi(s) \sum_{m=0}^{\frac{2g}{r-1}} \frac{m}{q^{ms/2}-1} \sum_{\deg(P)=m} \sum_{a=1}^{\lfloor \frac{d}{m}\rfloor} \left(\frac{-\phi(r)}{q^{m}}\right)^a \left(1-\frac{am}{d}\right)^{\phi(r)-1}\\ = & \hat{f}(0)\sum_{\substack{s|r \\ s\not=1}} \phi(s) \sum_{P} \frac{\deg(P)}{|P|^{s/2}-1} \sum_{a=1}^{\lfloor \frac{d}{\deg(P)}\rfloor} \left(\frac{-\phi(r)}{|P|}\right)^a \left(1-\frac{a\deg(P)}{d}\right)^{\phi(r)-1} + O\left(\frac{1}{g}\right) \end{align*} \end{proof}
\section{Introduction} Most images contain regions of "visual texture" - comprised of repeated elements, subject to some randomization in their location, size, color, orientation, etc. Humans are adept at recognizing and differentiating materials and objects based on their texture appearance, as well as using systematic variation in texture properties to recover surface shape and depth. At the same time, we are insensitive to the details of any particular texture example - to first approximation, different instances of any given class of texture are perceived as the same, as if they were "cut from the same cloth". This invariance is usually captured through the use of statistical models. Bela Julesz initiated the endeavor to build a statistical characterization of texture, hypothesizing that a texture could be modeled using n-th order joint co-occurrence statistics of image pixels \cite{julesz1962visual}. Subsequent models can be partitioned into three broad categories: 1) orderless pooling of handcrafted raw-pixel features such as local binary patterns \comment{(LBP)} \cite{ojala2002multiresolution, liu2016evaluation}, 2) local statistical models using Markov random fields \comment{(MRFs)} \cite{cross1983markov, chellappa1985classification, derin1987modeling, portilla2000parametric}, and 3) statistical characterization of fixed convolutional decompositions (i.e. wavelets, Gabor filters, multi-scale pyramids) \cite{bovik1990multichannel, bergen1986visual, heeger1995pyramid, portilla2000parametric, bruna2013invariant, sifre2013rotation}. More recent models are based on statistics of nonlinear features extracted from pre-trained deep convolutional neural networks (CNN's) \cite{cimpoi2015deep, gatys2015texture, ulyanov2017improved, song2017locally, xue2017differential}. A comprehensive review of these is available in \cite{liu2019bow}. The fixed-filter methods are generally chosen to capture features considered fundamental for early visual processing, such as local orientation and scale. Similar filters can be learned using methods such as sparse coding \cite{olshausen1996emergence} or independent components analysis \cite{bell1997independent}. On the other hand, deep learned methods provide great benefits in terms of extracting relevant complex features that are not so easily specified or even described. However, recent work in understanding the representation of texture in the primate brain has shown that texture selectivity arises in Area V2 of visual cortex \cite{freeman2013functional, ziemba2016selectivity}, which receives primary input from Area V1. Therefore, it seems that the brain can achieve selectivity for texture in far fewer stages than are commonly used in the deep CNNs. Motivated by this fact, we construct a simple, hybrid texture model that blends the benefits of the aforementioned fixed-filter image decompositions with the power of learned representations. There are two main contributions of our work. First, the model represents textures in a relatively low-dimensional feature space (in contrast to the extremely high-dimensional representations found in CNN models).We propose that this low-dimensional representation can be used to perform texture family discrimination with small amounts of training data when it is coupled with an interpretable non-linear decoder. Moreover, we show that a novel self-supervised learning objective plays an important role in achieving this result. Finally, while pre-trained deep CNNs can achieve better texture classification accuracy, we show that our learned model exhibits much stronger representational similarity to texture responses of real neural populations recorded in primate V2. \section{Methods} \subsection{V2Net Model Architecture} \label{sec:model} It is well-known that the primary inputs to V2 are feed-forward outputs from area V1 \cite{girard1989visual, sincich2005circuitry, schiller1977effect}. Inspired by these physiological results, we propose a computational texture model as a two-stage network that functionally mimics the processing in these two early visual areas. The V1 stage is implemented using a set of fixed convolutional basis filters that serve as a functional model for V1 receptive fields \cite{ringach2002spatial}. The filters are localized in orientation and scale, specifically utilizing a complex-steerable derivative basis \cite{simoncelli1995steerable, jacobsen2016structured}. We chose a specific set of 4 orientations and 5 scales (octave-spaced) with two phases (even and odd), for a total of $40$ filters. The full set of V1 responses are a combination of both half-wave rectified simple cells and $L_2$-pooled (square root of the sum of squares) complex cells, yielding a total of $60$ feature maps. The V1 responses provide input to a V2 stage that consists of a set of $D$ learned convolutional filters. In the macaque, V1 and V2 are known to have similar cortical surface area and output fibers \cite{wallisch2008structure}, so in our experiments we set D = 60 to match the dimensionality of the V1 and V2 stages of our model. The convolutional layer is then followed by half-wave rectification, spatial $L_2$-pooling and downsampling to produce V2 `complex cell' responses (Fig. \ref{fig:model-arch}). Unlike standard max-pooling, $L_2$-pooling is used in both stages of our model because it is more effective at capturing local energy of responses without introducing aliasing artifacts \cite{bruna2013invariant, henaff2015geodesics}. \begin{figure} \centering \includegraphics[scale=0.25]{model_arch.pdf} \caption{Proposed biologically-inspired texture model architecture. The V1 stage is built using a 5-scale 4-orientation complex steerable pyramid~\cite{portilla2000parametric}, followed by two nonlinearities to generate simple and complex cell responses. The latter uses specialized $L_2$ pooling. The V2 stage consists of convolution with $D$ filters followed by spatial $L_2$ pooling.} \vspace{-2\intextsep} \label{fig:model-arch} \end{figure} \subsection{Learning Objective} Consider the model in Fig. \ref{fig:model-arch} as a function $f(T ; \Theta)$ that takes as input a texture image $T$, and computes responses based on parameter vector $\Theta = [\Theta_1, ..., \Theta_D]$, which contains the $D$ V2 filters\footnote{each $\Theta_d$ is a 60 x 7 x 7 set of weights, as each V2 filter operates over the full set of 60 V1 channels}. Given a dataset of $N$ texture images ($T_n$) and their corresponding model responses $\vec{r}_n = f(T_n ; \Theta)$, we seek an objective function, $L(\cdot)$, for optimizing the V2 filter weights: $\Theta_{opt} = \argmin_\Theta L( \{f(T_n; \Theta)\})$. We assume a curated image dataset with two properties that underlie the formulation of the objective: 1) individual images contain a single texture type (homogeneous across their spatial extent) and 2) the $N$ images in the dataset represent a diverse set of texture types. Our learning objective is motivated by the experimental observations in \cite{ziemba2016selectivity} suggesting that V2 represents textures such that responses within texture families (i.e. classes) are largely invariant to variability within the texture families- the responses are less variable within texture families than across families. To learn such a representation, one could simply utilize an objective function that reduces variability of responses to each family while maintaining variability across all families. This can usually be achieved by supervised methods that optimize responses to predict the class identity for an image. However, we desire an objective that has no supervisory knowledge of which images correspond to which texture families. As a result, we propose a contrastive objective that seeks to 1) Minimize the variability of model responses ($\vec{r}_n(p)$) across locations $p$ within each individual texture image and 2) Maximize variability of these responses across neighborhoods sampled from the entire set of $N$ images. Therefore, rather than using labels to enforce grouping of similar texture families, we utilize the natural spatial homogeneity of \textit{individual texture images} as a form of `self-supervision'. To formulate this mathematically, we first model the distribution of V2 responses over positions $p$ within each image ($\vec{r}_n(p) \in \mathbb{R}^D$) as multivariate Gaussian, parameterized by the sample mean and covariance: $\vec{\mu}_n \in \mathbb{R}^{D}$ and $C_n \in \mathbb{R}^{D \times D}$. The global distribution of responses across all images is then a Gaussian mixture with mean and covariance: $\vec{\mu}_g = \frac{1}{N} \sum_{n=1}^{N}{\vec{\mu}_n } ~~ ; ~~ C_g = \frac{1}{N} \sum_{n=1}^{N} C_n + (\vec{\mu}_n - \vec{\mu}_g)(\vec{\mu}_n - \vec{\mu}_g)^\top$. Under this parameterization, the two goals for the objective can be achieved by maximizing the `discriminability' between the individual and global response distributions based on their covariances. A suitable measure of discriminability must capture the differences in both size (total variance) and shape \comment{(dimensionality)} of the distributions. There has been extensive work on developing measures that approximate the discriminability between Gaussian distributions based on their mean and/or covariance statistics \cite{bures1969extension, bhattacharyya1946measure, abou2010designing, de2005multimodal, nenadic2007information, dryden2009non, huang2015log}. In order to choose a distance for this problem we define a set of criteria the distance must satisfy. First, the distance must be \textit{scale invariant}: global rescaling of the image data should not change the value of the distance measure, which is meant to capture {\em relative} differences in variability. This is especially important for an objective function, as the responses can be arbitrarily scaled by the learned weights. Second, for maximization it is preferable that a distance \textit{have an upper bound} as this can stabilize optimization and avoid degenerate solutions where the distance can take on extremely large, unbounded values. Third, for any given texture image, not all of the V2 dimensions may be important (i.e. the covariance is low-rank), so the distance must be stable in this regime. Given these criteria, it is clear that many of the statistical distances and manifold-based log-Euclidean distances are problematic because the log transformation is unstable when covariances are low-rank. The work of \cite{faraki2016image} has shown that regularizing the log-Euclidean approach with standard covariance shrinkage can lead to large errors, and we have observed this in our experiments as well. A novel attempt to resolve this issue was proposed using a Riemannian optimization method \cite{faraki2016image}, but this method only works for fixed low-rank matrices. As a result, we construct our distance on the form $|| C_1^{1/2} - C_2^{1/2} ||_F$ corresponding to the Bures metric \footnote{Equivalent to the covariance term of the 2-Wasserstein distance between multivariate Gaussian distributions in the special case when the two covariance matrices commute} \cite{bures1969extension, muzellec2018generalizing} . We modify this to make it bounded and scale-invariant, arriving at a novel measure of distance between the global response covariance and that of image $T_n$: \begin{equation} \label{eqn:distance} d_n = \frac{|| ~ C_g^{1/2} - C_n^{1/2} ~ ||_F}{|| ~ C_g^{1/2} ~ ||_F} , \end{equation} where $(\cdot)^{1/2}$ indicates matrix square-root and $||\cdot||_F$ is the Frobenius norm. This may be seen as a normalized variant of the log-Euclidean distances \cite{huang2015log}, in which replacement of $\log(\cdot)$ by $(\cdot)^{1/2}$ retains the primary benefit of the log-Euclidean framework (transforming the covariance eigenvalues with a compressive nonlinearity), while remaining stable and well-defined in low-rank conditions. After calculating the distance in Eqn.~(\ref{eqn:distance}) for each individual image, we then combine over all images to obtain a single scalar objective. To force all distances to be as large as possible, we maximize the minimum of these distances. For stable optimization, we use a soft-minimum function, which yields our variability-based objective: \begin{equation} {\bf L_{\rm var}} = {\rm softmin}(d_1,d_2, \ldots , d_N) = \frac{\sum_n d_n e^{-d_n}}{\sum_n e^{-d_n}} . \label{eqn:softmin} \end{equation} \comment{Combining all of the above, our variability-based objective is: \begin{equation} {\bf L_{\rm var}} = {\rm softmin}(d_1,d_2, \ldots , d_N, \alpha) . \end{equation} To allow for robust estimation of the covariance, we make a diagonal approximation where $C_n$ and $C_g$ are each taken to be diagonal. Therefore, the matrix square-roots can be implemented as element-wise square roots of the individual response variances along the diagonal and the Frobenius norm becomes the standard vector $L_2$ norm. However, because a diagonal approximation can be poor if the covariances have strong co-variability, we use an additional orthogonal regularization term to encourage orthogonalization of the V2 filters \cite{bansal2018can}: \begin{equation} {\bf L_{\rm orth}} = ||~ \Theta \Theta^\top - I ~ ||_F . \end{equation} Minimizing this loss forces the responses of each channel to be roughly independent and thus more amenable to the diagonal approximation. The final objective is a weighted combination of the two terms: \begin{equation} \label{eqn:finalloss} \mathbf{\max_{\Theta}} \left[ \mathbf{L}_{\rm var} - \lambda \mathbf{L}_{\rm orth} \right] . \end{equation} \subsection{Evaluation Methodology} \label{sec:eval} After training the model with the self-supervised objective in Eqn.~(\ref{eqn:finalloss}), we use a separate labeled dataset to train and test a texture family classifier. We first compute the spatially global-average pooled (GAP) responses for each image in the new dataset, such that each image $T_n$ is represented by a single $D$-dimensional vector, $\vec{\mu}_n$. We again make a Gaussian assumption on the distribution of these mean response vectors for each texture family and fit and test a quadratic discriminant classifier (QDA) to predict the texture class labels. This process is shown in Fig. \ref{fig:qda} (a). Although the choice of a QDA classifier is not common, state-of-the-art texture classification methods generally use some form of quadratic feature encoding (Fisher vectors, bilinear layers, etc.) before applying a trained linear classifier (i.e. SVM) \cite{linbilinear, song2017locally, cimpoi2015deep}. Rather than compute all pairwise products, which can be prohibitively expensive in terms of number of parameters, we use mean pooling to produce a low-dimensional representation, followed by a bilinear readout. In our context, a quadratic discriminant is the optimal bilinear method for discrimination under the Gaussian assumption. \begin{wrapfigure}[17]{r}{0.5\linewidth} \centering \vspace{-\intextsep} \includegraphics[width=0.48\textwidth]{model_evaluation.jpg} \vspace{-\intextsep} \caption{(a) Evaluation method for our self-supervised model. (b) Evaluation method for the supervised networks} \label{fig:qda} \end{wrapfigure} One issue with QDA classification is that it requires the estimation of class-covariance matrices. These matrices can only be reasonably estimated when the number of samples per class is much larger than the dimensionality of the features, so QDA is only amenable to low-dimensional feature representations. In our experiments, we compare our model to supervised methods that use popular network architectures as the base feature extractor. However, most of these networks produce very high-dimensional output feature spaces that are usually evaluated with linear classifiers. As a result, we devise an evaluation protocol for these methods such that the dimensionality of the feature representation \textit{and} the expressivity of the classifiers is matched to that of our model (Fig. \ref{fig:qda}(b)). Specifically, we first reduce the dimensionality of the feature representation to match that of our V2Net model (D = 60) using a trained 1x1 convolutional layer (as is common in the literature \cite{howard2017mobilenets, xue2018deep}). This is followed by the same classification procedure as ours: spatial GAP followed by a bilinear classifier. However, because QDA cannot be implemented for supervised, end-to-end trained networks, we use a parameterizable bilinear layer of the form: $x^T A x + B x + c$. The model parameters, 1x1 conv layer, and bilinear are all trained end-to-end, in contrast with our model which is first trained separately with the self-supervised objective. One might ask if the dimensionality reduction of the existing network architectures is too restrictive and if our comparisons will be biased because of this. In fact, a similar methodology has shown minimal loss in performance for texture retrieval with PCA reduction down to $64$ dimensions \cite{valente2019comparison}. Therefore, it is unlikely that we are biasing our comparisons by stifling the capacity of the network. Moreover, the 1x1 convolution approach is arguably more effective than PCA because it allows this dimensionality reduction to be optimized in the context of the classification task. Nevertheless, we additionally verified that results for all tested networks were close to those achieved using a linear classifier on the full-dimensional feature space. The specific models we compare to are chosen to span a diverse set of methods from the literature: \textbf{ScatNet}: We implement the front-end two-stage scattering model as described in \cite{bruna2013invariant, sifre2013rotation} that has 5 scales and 8 angles. The scattering model is then fixed and the 1x1 convolution layer and the bilinear classifier are learned. The number of channnels before dimensionality reduction is 681. \textbf{DAWN(16-init)}: Recent work has performed a similar experiment using a hybrid deep adaptive wavelet network that is found to be more data-efficient than previous methods \cite{rodriguez2020deep}. We implemented the same model and regularization, with 16 initial convolutional layers, followed by the multi-scale representation. The number of channels before dimensionality reduction is 256. \textbf{ResNet-18}: Based on recent success as a feature extractor for texture recognition \citep{xue2018deep} we also included an 18-layer ResNet model. We extract features from the \textit{layer4} level of the network, as these have been deemed as the most powerful features for texture classification in previous work \cite{xue2018deep, zhai2019deep}. The number of channels before dimensionality reduction is 512. \textbf{VGG-16}: VGG networks and their variants have been the most common network architectures used for feature extraction in the literature. The work of \cite{cimpoi2014describing, cimpoi2015deep} demonstrated that a Fisher vector decoder, and even linear classification from pooled features of the last convolutional layer, can be effective for texture classification. Based on this work, we used features from the \textit{conv5} layer of a VGG-16 network. The number of channels before dimensionality reduction layer is 512. \section{Related Work} \textbf{Model Architecture.} Many fixed-filter, hierarchical image decompositions have been used in the construction of texture representations that are similar to our V1 stage \cite{bruna2013invariant, simoncelli1995steerable}. However, we note that our V1 responses include both rectified simple cells \textit{and} $L_2$-pooled complex cells. This formulation is motivated by physiological experiments studying the projections of V1 to V2 neurons \cite{el2013visual}, and represents a departure from the classical view of hierarchical visual modeling that assumes only pooled responses are transmitted to the downstream layers \cite{fukushima1980neocognitron,riesenhuber1999hierarchical,bruna2013invariant}. Recent deep learning approaches to representing texture have been heavily optimized and hand-crafted for specific tasks such as texture classification \cite{cimpoi2015deep, xue2018deep}, synthesis \cite{ulyanov2017improved, gatys2015texture}, and retrieval \cite{qian2017differential, valente2019comparison}. However, there are a few common themes in these methods that we highlight for their relevance to our model and the models we use for comparison. First, all SoA methods, regardless of task, rely on extraction of features or statistics from deep CNNs trained for object recognition, primarily the VGG and ResNet architectures \cite{simonyan2014very, he2016deep}. With the exception of a few studies \cite{fujieda2018wavelet, rodriguez2020deep}, performing texture classification with networks trained from scratch has been relatively understudied. Second, it has been consistently shown that "orderless" pooling of the features before classification layers results in a far better texture representation. Simple global average pooling (GAP) has been shown to be quite effective \cite{valente2019comparison, xue2018deep, zhang2020uncertainty, dumoulin2016learned} as well as methods that pool based on 2nd-order statistics \cite{cimpoi2015deep, gatys2015texture, linbilinear}. \textbf{Objective functions.} In the context of texture classification, current human-labeled homogeneous texture databases are few and small, so most deep learning methods transfer features from networks trained with full supervision on an alternative task (typically, object recognition). Some authors have developed limited unsupervised methods based on vector quantization \cite{greenspan1991texture, raghu1997unsupervised}, and non-negative matrix factorization \cite{qin2008unsupervised}. Nevertheless, in concert with CNN models, we believe ours is the first competitive self-supervised learning objective for this problem. Conceptually, our objective is inspired by principles of \textit{contrastive learning} that have recently seen much success at competing with more traditional supervised methods \cite{henaff2014local, wu2018unsupervised, oord2018representation, zhuang2019local, henaff2019data}. However, the specific construction of our learning objective differs substantially from these methods as it relies on a diagonal Gaussian parameterization of sample distributions that provides many computational benefits such as easy generalization to incremental learning where the sufficient statistics are updated online without use of large in-memory batches. \section{Results} \subsection{Data-Efficient Texture Classification} We hypothesized that our objective function enables the learning of a more powerful texture representation from small data. To test this, we used an experimental paradigm similar to \cite{henaff2019data}. We trained and tested all models on varying amounts of data from a texture dataset. We used a modified version of the challenging KTH-TIPS2-b dataset \cite{caputo2005class} for both training and evaluation. The original dataset includes 11 families of textured materials photographed with different viewpoints, illumination levels, and scales. The total dataset is relatively small (4752 images), so we augmented it with 3 rotated versions of each image (90, 180, and 270 degrees) to obtain a total of 19008 samples. As texture representations should be invariant to rotation, this is a sensible augmentation that increases the difficulty of the task. We used the original 4 splits of the KTH-TIPS2-b data (training on 3 splits and testing on the 4th). For all experiments we used a fixed validation set of 3256 images and each test set contained 4752 images. We then conducted three experiments varying the amount of training data (reducing evenly the number of images per texture family). We report results for the full training data (1000 images per family), 50 percent training (500 images per family), and 25 percent (250 images per family). \begin{wrapfigure}[17]{r}{0.5\textwidth} \centering \vspace{-2\intextsep} \includegraphics[width=0.48\textwidth]{scratch_train.pdf} \caption{Mean and standard error across the 4 train/test splits as a function of the percentage of training data used.} \label{fig:scratchtrain} \end{wrapfigure} All models (ours and those listed in Sec. \ref{sec:eval}) were trained from scratch without any pre-trained information. For the supervised networks we varied learning rates (from 0.0001 to 0.01) and batch sizes from (50 to 200) and chose the best model for each train/test split. For our model (V2Net (self-sup)), the objective function relies on calculating the global mean and variances over the entire dataset. However, because our training is done through stochastic gradient descent, we approximated these global statistics by the global statistics over batches of 275 images. We chose the batch size heuristically so that individual batch statistics do not deviate significantly from the statistics over the whole dataset. Interestingly, the batch size does not need to be as large as is necessary in most other contrastive learning approaches \cite{henaff2019data, chen2020simple}. We used a learning rate of 0.001 and additionally included a BatchNorm layer at the output of the network to stabilize the global statistics across batches. \begin{wrapfigure}[14]{l}{0.42\textwidth} \centering \vspace{-1.2\intextsep} \includegraphics[width=0.4\textwidth]{model_ablate.pdf} \caption{V1 and V2 model comparison based on ablating V1 simple cell contribution.} \label{fig:ablate} \end{wrapfigure} The results for the 3 training experiments are shown in Fig. \ref{fig:scratchtrain}. We report the mean and standard error for the 4 train/test splits within each experiment. First, we can see that just using the fixed V1 stage (V1Net) followed by QDA provides a reasonable baseline. \comment{This is in fact a reasonable baseline, especially in the 25 \% data experiment (where it is competitive with most of the networks).} This model has marginal performance difference across differing amounts of training data, which can be solely attributed to the estimation error of the class covariances when training the QDA classifier. Second, we find that the two-stage V2 model performs similarly to the VGG-16 network with full training data, but significantly outperforms all networks when using 50\% or 25\% of the training data, indicating much greater data-efficiency. To better understand the impact of our objective function, we also report results for a network with the same architecture as V2Net, but trained with a supervised cross-entropy loss (V2Net (sup)) \footnote{We use the same bilinear classifier model as was used for the other networks}. As seen in Fig. \ref{fig:scratchtrain}, this network performs comparably to the other supervised networks but still seems to overfit in the small-data regimes. This suggests that even small networks can overfit with small amounts of training data, implying that it is the design of our objective function that allows our network to remain data-efficient in these cases. To assess the impact of the inclusion of V1 simple cells in our network, we compared the V2Net classification accuracy to a model trained with V1 simple cells removed. The results are shown in Fig. \ref{fig:ablate}. The performance of both V1 models is roughly the same, and in both cases the V2 model improves on the V1 model. However, the gap between the V1 and V2 performance is noticeably larger when the V1 layer contains both simple and complex cells. This result suggests that a more effective V2 representation can be learned when the inputs come from both simple and complex cells. \subsection{Transfer Learning} \label{sec:transfer} To verify the generalization of our learning objective, we collected an unlabeled dataset of texture photographs. Original images were manually cropped to be globally homogeneous (by eye) over their entire spatial extent. The scale, viewpoint etc. were not controlled in any particular way, although most textures are on approximately front-parallel surfaces. The types of texture in the dataset span a wide range (including leaves, grass, wood bark, brick, ceramic tile mosaics, etc) that is far more diverse than the KTH-TIPS2-b dataset. We trained our model on 11000 of these images and re-evaluated the performance on the four KTH train/test splits by retraining the QDA classifier. Performance of this pre-trained model slightly improves on the performance of the models trained from scratch (average gain of 1.4 \% mean accuracy across the three experiments) and displays the same level of robustness to the reduction of training data. This demonstrates that our results are not specific to the training dataset and that our learning objective in fact generalizes across texture datasets with very different distributions of images. We additionally compared the performance of our pre-trained (but still self-supervised) network against the ResNet-18 and VGG-16 architectures pre-trained on ImageNet classification. The results of this experiment are given in Appendix \ref{sec:supppre}. Our network does not achieve the performance of these pre-trained networks, but the performance gap (~5-10\%) is surprisingly small given that our model is pre-trained without supervision, using two orders of magnitude fewer images (11k vs. 1M). \subsection{Selectivity for Natural Texture vs. Spectrally-shaped Noise} \label{sec:phasescram} Physiological results in \cite{freeman2013functional, ziemba2016selectivity} suggest that texture selectivity in the brain not only manifests as an ability to separate texture families, but also can also be used to distinguish natural textures from their phase-scrambled counterparts. We constructed a test along these lines to gain a deeper understanding of our learned model and its selectivities. We retrained our V2Net model using phase-scrambled versions of the images from our unlabeled texture dataset from Sec. \ref{sec:transfer}. By training on phase-scrambled images, the model no longer has access to the natural statistics that define textures beyond their spectral power. As a result, if our model is truly capturing higher-order texture statistics, its performance on natural images will drop significantly when trained on the phase-scrambled images. In fact, we find that the average test accuracy of the model trained on phase-scrambled images (V2Net (PS)) is 51.5\% vs. 67.4\% for the model trained on natural images (V2Net (Natural)). Upon further inspection, there are certain texture classes that have high accuracy for the V2Net (PS) model, indicating that these families are readily distinguished using spectral power statistics. We verified that this is also true perceptually: phase-scrambled versions of these classes are visually similar to the original images. However, the classes where there is a large deviation between V2Net (Natural) and V2Net (PS) are those where the phase-scrambled images carry little information about the original texture. For more details, see Appendix \ref{sec:suppps}. \subsection{Texture Representational Similarity} Having established that our learned texture model reproduces the qualitative texture selectivities seen in populations of V2 neurons, we explored this relationship quantitatively by comparing the representational similarity between our model and recorded responses of V2 neurons to texture images. We used the dataset described in \cite{freeman2013functional, ziemba2016selectivity}, which provides electrophysiological recordings of 103 V2 neurons responding to 15 samples of textures from 15 different texture families. To understand the representational similarity between our model and the neural data at the level of texture families, we first computed the averaged response (across samples) of both the model and neural responses to each of the 15 texture families. Next, for each representation, we constructed a dissimilarity matrix based on the pairwise correlation distance. There are many distances one could choose but the correlation distance is one of the most common and performs fairly robustly in comparison with distances such as euclidean distances \cite{mehrer2020individual, kriegeskorte2008representational}. As has been noted in the literature \cite{nili2014toolbox}, it is not common to assume a linear relationship between dissimilarity matrices, but it is rather more appropriate to assume the model RDM predicts the rank order of the dissimilarities \cite{nili2014toolbox}. Therefore, we computed the Spearman rank correlation between the dissimilarity matrices of our model and the V2 neural data. We repeated this process for our V2Net model that uses only V1 complex cells (V2Net (Comp)). Finally, we performed the same analysis for all of the major layers from pre-trained ResNet-18 and pre-trained VGG-16 networks, reporting results for the layer with the best correlation. The results are summarized in Table 1. For more details on the physiology data and image presentation see Appendix \ref{sec:suppneural}. We find that both V2Net representations are significantly more correlated with the V2 population representation than either deep CNN, and that the inclusion of simple cells again offers a noticeable improvement. Additionally, for both of the pre-trained deep networks we find that the best performance occurs in early layers (layer1 of ResNet and block1pool of VGG). These layers are arguably at the right level in the visual hierarchy (2 or 3 convolutional layers deep) to be matched to V2, but we note that previous work has suggested that texture classification improves when taking features from deeper layers (e.g., VGG conv5) \cite{cimpoi2015deep}. We hypothesize that this is a result of the supervised learning objective used to train these networks. Because of this, the pre-trained deep networks are able to achieve higher overall texture classification accuracy than our current model, but are not able to capture the physiology as well. This suggests that stacking a hierarchical model on top of our learned network may lead to an improvement in SoA classification performance while maintaining consistency with biological architectures. \begin{table} \begin{center} \begin{tabular}{||c | c | c | c | c||} \hline & V2Net & V2Net (Comp) & Res (layer1) & VGG (block1pool) \\ [0.5ex] \hline Spearman Corr. & \textbf{0.658} & 0.597 & 0.410 & 0.405 \\ [1ex] \hline \end{tabular} \end{center} \caption{Spearman correlation between model RDMs and the V2 neural data RDM representing texture families. V2Net (Comp) refers to the V2Net model trained with only V1 complex cells.} \vspace{-1\intextsep} \end{table} \section{Discussion} In this work, we demonstrate successful data-efficient self-supervised learning of a simple, yet powerful computational model for representing texture. Rather than learn a very high-dimensional representation followed by linear classification, we use a simpler two-stage model whose responses are then decoded with an \textit{interpretable} non-linear decoder (QDA). This provides the benefit that moving forward we can more easily probe the underlying learned feature space and understand explicitly how those features impact decoding of texture families (through their covariance structure). In fact, we are not the first to propose such a scheme in the context of neural decoding as QDA has been shown to provide a possible basis for a biologically-plausible non-linear decoding method that can explain quadratic transformations that have been observed between layers of processing in the visual system \cite{pagan2016neural, yang2020revealing}. Within this framework, we show that a modification of the common view of hierarchical visual processing (reminiscent of skip-connections \cite{he2016deep}), that includes both V1 simple and complex cells as input to a second V2-like processing stage can provide functional benefits in the learning of the texture representation both in terms of classification accuracy and representation similarity with recording neurons in primate area V2. More importantly, we demonstrate that smaller networks do not necessarily perform much better with small training data, but that learning robustly from small numbers of training examples required the development of a novel self-supervised learning objective. Our learning objective is inspired by recent unsupervised contrastive objectives (separating positive examples from a collection of negatives) \cite{zhuang2019local, oord2018representation, henaff2019data, wu2018unsupervised}. While these methods are general, in they are non-parametric with respect to the distribution of the data, we believe that our parameterization in terms of mean and covariance allows our method to 1) constrain learning in small data regimes and 2) provide opportunities to explore more biologically plausible on-line learning implementations. In particular, it is implausible that the brain can store all samples of the global distribution, and our parameterization allows for on-line sequential update of the mean and covariance statistics for each observed image. Finally, our model currently assumes a dataset of homogeneous textures as input, enabling a simple form of objective that minimizes spatial variability of the responses across each image. We are currently extending this to allow learning from whole natural scenes, by minimizing variability of responses within {\em local} spatial neighborhoods, while maximizing global variability. This is motivated by the local consistency of natural images - nearby spatial regions are more likely to be similar than distant ones. In fact, there have been some efforts to use spatial coherence as a learning signal \cite{becker1995spatial, ji2018invariant, danon2019unsupervised, jean2019tile2vec}, splitting the image into independent patches that are processed as inputs to the model during learning. Our objective offers an alternate methodology that can process full images while imposing the locality constraint in the response space. Because of the layer-wise nature of our objective, there is also the potential to extend the method to learn filters in multiple stages of a hierarchical model. \renewcommand\refname{\vskip -1cm} \section*{Broader Impact} The interplay between machine learning and neuroscience is something that has helped progress both fields throughout the previous decades. Our work lies at the intersection of these two fields and aims to provide new accounts of how the visual system processes information by utilizing computational methods and constraints from physiology. In the context of machine learning, achieving generalizable unsupervised learning is widely considered to be one of the most important open problems, and our work provides a novel unsupervised method for learning representations throughout a hierarchical model, that is additionally more biologically plausible due to its self-supervised and layer-wise nature. Our work also provides insight into understanding how the primate visual system encodes natural images. Much of the field of visual neuroscience has focused on building models of either early sensory areas through primary visual cortex, or late-sensory areas (i.e V4/IT) that can be to some extent captured by deep network models. Computational models of mid-visual areas are lacking in comparison. The model described here aims to bridge this gap, both from a perspective of understanding the feature representation in area V2, but also providing physiologists with stronger hypotheses and experimental design constraints for probing mid-visual areas. In terms of social and ethical implications, the high-level goal of generalizable unsupervised learning has the risk of creating uninterpretable AI models that will be used as replacements for more interpretable human-level decision-making. It is generally thought that lower dimensional models such as ours can allow for greater interpretability and analysis. Finally, to the extent that it provides a good description of primate mid-visual processing, our model offers potentially important societal value in the context of medical applications such as human visual prosthesis development. \comment{Visual prosthesis research will benefit substantially from detailed models of how prosthetic signals fed to early sensory areas are transformed through the visual hierarchy. } \section*{Acknowledgments} This work has been supported by the Howard Hughes Medical Institute (EPS and NP) and the NIH Training Grant in Visual Neuroscience (T32 EY007136-27) \section*{References} \comment{References follow the acknowledgments. Use unnumbered first-level heading for the references. Any choice of citation style is acceptable as long as you are consistent. It is permissible to reduce the font size to \verb+small+ (9 point) when listing the references. {\bf Note that the Reference section does not count towards the eight pages of content that are allowed.} } {\small \bibliographystyle{unsrtnat} \section*{\centering \Large Self-Supervised Learning of a Biologically-Inspired Visual Texture Model} \section*{Appendix} \label{sec:suppmaterials} \section{Transfer Learning with Pre-trained Networks} \label{sec:supppre} In addition to comparing networks trained from scratch on our modified KTH dataset, we also tested the performance of features transferred from pre-trained versions of our V2Net model, VGG-16, and ResNet-18. We pre-trained our model on a dataset of 11000 unlabeled image patches using our self-supervised objective. Example images from this dataset are provided in Fig. \ref{fig:tex-ims}: \begin{figure}[ht!] \centering \includegraphics[scale=0.4]{supplement/ex-texims.pdf} \caption{Example texture images from our hand-curated dataset, comprised of a large collection of natural textures that are unlabelled, but diverse in content and homogeneous across their spatial extent.} \label{fig:tex-ims} \end{figure} The VGG and ResNet networks are pre-trained on the supervised task of object recognition using 1 million images from the ImageNet database. We used these pre-trained networks as feature extractors, and retrained the respective classifiers (See Fig. \ref{fig:qda}) for texture classification. Results are shown in Fig. \ref{fig:pretrainplot}. \begin{figure}[ht!] \centering \includegraphics[scale=0.4]{supplement/model_pretrain.pdf} \caption{Mean and standard error computed across the 4 train/test splits on our KTH dataset (for each experiment where 25 \%, 50 \% and 100 \% of training data is used to train the classifier weights). N refers to the number of images used to pre-train each model.} \label{fig:pretrainplot} \end{figure} For all of the models, we find the classifier does not require large amounts of training data - performance is relatively constant across the different amounts of training data used. For the full (100\%) classifier training set, our model achieves 67\% - the performance gap (~5-10\%) relative to the pre-trained CNNs is surprisingly small given that our model is pre-trained without supervision, using two orders of magnitude fewer images (11k vs. 1M). \section{Selectivity for Natural Texture vs. Spectrally-shaped Noise} \label{sec:suppps} For each of the 11 texture families in the test dataset, we plot the mean accuracy our model trained on natural images (V2Net (Natural) vs. our model trained on phase-scrambled images V2Net (PS)). Fig. \ref{fig:psplot} shows that the model trained on natural images performs better for most texture families, since it is able to capture higher-order natural statistics. If we visualize an example of one of these classes (aluminum foil), we see that this is because the scrambling of phase destroys content that is critical in defining that texture. However, for a few families, the performance of the V2Net (PS) model is about the same as the V2Net (Natural) model because certain texture families (e.g. wood) are primarily defined by their spectral content (and thus not altered significantly by phase-scrambling). \begin{figure}[ht!] \centering \includegraphics[scale=0.45]{supplement/ps_plot.pdf} \caption{Left: Average KTH test accuracy (averaged over 4 splits with 100 \% training data) for the V2Net (Natural) vs. V2Net (PS) models. Right: example images (both natural and phase-scrambled) for two texture families. For the `aluminum foil' family, the phase-scrambled image removes the higher-order content that is necessary for identifying the texture. For the `wood' family, the phase-scrambling does not alter perception of the texture significantly, because its appearance is primarily determined by spectral content.} \label{fig:psplot} \end{figure} \section{Representational Similarity Methods and Data} \label{sec:suppneural} Here, we provide more details about the dataset and methods used for the representational similarity analysis presented in the main text. The neural data taken from \cite{ziemba2016selectivity} consists of electrophysiolgical recordings of 103 V2 neurons from anesthetized adult macaque monkeys. As is done in the original analysis, we averaged spike counts within 100-ms time windows aligned to the response onset for each single unit. To gaussianize the neural responses, we applied a variance-stabilizing transformation to the spike counts for each neuron ($r_{gauss} = \sqrt{r_{poiss}} + \sqrt{r_{poiss} + 1}$). The visual stimuli used in the experiment are synthetic texture stimuli generated using the procedure described in \cite{portilla2000parametric}. A set of 15 grayscale texture photographs are used as the examples for 15 different texture families. From these seed images, 15 samples are generated for each family to provide sample variation across the family. The original stimuli have a size of 320 x 320 pixels and are presented to every V2 unit at a size of $4^{\circ}$, within a raised cosine aperture (this window was larger than all of the receptive fields of the neurons at the recorded eccentricties). For our representational similarity experiments, we thus pre-processed the images for input to the models such that they are resized to the appropriate pixel dimensions (224 x 224) and presented within a $4^{\circ}$ raised cosine aperture. This ensures that the models receive inputs with content comparable to what is seen by the neurons in the V2 recordings.
\section{Guided Learning through Successive Functional Gradient Optimization} \label{sec:theory} In this section, after presenting the framework in general terms, we develop concrete algorithms and analyze them. \subsection{Framework} We first describe the framework in general terms so that the models to be trained are not limited to parameterized ones. Let $f$ be the model we are training. Starting from some initial $f$, training proceeds by repeating the following: \begin{enumerate}[itemsep=1pt,topsep=1pt] \item Generate a {\em guide function} $f^*$ by applying functional gradient descent for reducing the loss to the current model $f$, so that $f^*$ is an improvement over $f$ in terms of loss but not too far from $f$. \item Move the model $f$ in the direction of the guide function $f^*$ according to some distance measure. \end{enumerate} We use the Bregman divergence $\Bdiv$, defined in \eqref{eq:bdiv}, for representing the distances between models. \tightpara{Step 1: Guide going ahead} We formulate Step 1 % as \begingroup \thinmuskip=0mu \medmuskip=0mu \thickmuskip=0mu \begin{align} f^*(x,y) &:= \arg\min_q \left[ \Bdiv(q,f(x)) + \alpha \nabla \loss_y(f(x))^\top q \right ] , \label{eq:mirror0} \end{align} \endgroup where $\alpha$ is a meta-parameter. The second term pushes the guide function towards the direction of reducing loss, and the first term pulls back the guide function towards the current model $f$. Thus, $f^*$ is ahead of $f$ but not too far ahead. Note that we use the knowledge of the true output $y$ here; therefore, $f^*$ takes $y$ as the second argument. The function value for each data point $(x,y)$ can be found approximately by solving the optimization problem by SGD if there is no analytical solution. Also, this formulation is equivalent to finding $f^*$ such that \begin{align} \nabla \Bref(f^*(x,y)) = \nabla \Bref(f(x)) - \alpha \nabla \loss_y(f(x)) . \label{eq:mirror1} \end{align} This is mirror descent (see e.g., \cite{convex15}) performed in a function space. Due to the relation of the Bregman divergence to the Hessian matrix stated in \eqref{eq:bdivApprox}, \eqref{eq:mirror0} implies that \begin{align} f^*(x,y) \approx f(x) - \alpha (\hessian{\Bref(f(x))})^{-1} \nabla \loss_y(f(x)) . \label{eq:step} \end{align} Therefore, if we set $\Bref(f)=\loss_y(f)$, \eqref{eq:step} becomes \begin{align} f^*(x,y) \approx f(x) - \alpha (\hessian{\loss_y(f(x))})^{-1} \nabla \loss_y(f(x)), \label{eq:newton} \end{align} which is approximately a second-order functional gradient step (one step of the relaxed Newton method) with step-size $\alpha$ for minimizing the loss. If we set $\Bref(f)=\frac{1}{2}\|f\|^2$, then the optimization problem \eqref{eq:mirror0} has an analytical solution \[ f^*(x,y) = f(x) - \alpha \nabla \loss_y(f(x)), \] which is a first-order functional gradient step with step-size $\alpha$ for minimizing the loss. \tightpara{Taking $m$ steps in Step 1} For further generality, let us also consider $m$ steps of functional gradient descent by extending $f^*$ in \eqref{eq:mirror0} to $f^*_m$ recursively defined as follows. \begin{align*} f^*_0(x,y) &:= f(x) \\ f^*_{i+1}(x,y) &:= \arg\min_q \left[ \Bdiv(q,f^*_i(x)) + \alpha \nabla \loss_y(f^*_i(x))^\top q \right ]. % \end{align*} Then, in parallel to \eqref{eq:step}, we have \begin{align*} f^*_{i+1}(x,y) \approx f^*_i(x) - \alpha (\hessian{\Bref(f^*_i(x))})^{-1} \nabla \loss_y(f^*_i(x)) . \end{align*} \tightpara{Step 2: Following the guide} Using the Bregman divergence $\Bdiv$, we formulate Step 2 above as an update of the model $f$ to reduce \begin{align} \meanOverS{ \Bdiv(f(x), f^*(x,y)) } + R(f) \label{eq:fit} \end{align} so that the model $f$ approaches the guide function $f^*$ in terms of the Bregman divergence. $R(f)$ is a regularization term. \tightpara{Parameterization} Although there can be many variations of this scheme, in this work, we parameterize the model $f$ so that we can train neural networks. Thus, we replace $f(x)$ by $\net{\theta}{x}$ with parameter $\theta$. This does not affect Step 1, and to reduce \eqref{eq:fit} in Step 2, we repeatedly update the model parameter $\theta$ by descending the stochastic gradient \begin{align} \nabla_\theta \left[ \meanOverB { \Bdiv(\net{\theta}{x}, f^*(x,y)) } + R(\theta) \right] , \end{align} where $B$ is a mini-batch sampled from a training set $S$. \subsection{Algorithms} Putting everything together, we obtain Algorithm \ref{alg:Algm}, which performs mirror descent in a function space in Line 3. We call it (and its derivatives) a method of {\em GUided Learning through successive Functional gradient optimization (GULF)}. We now instantiate function $\Bref$ used by the Bregman divergence $\Bdiv$ to derive concrete algorithms. In general we allow $\Bref$ to vary for each data point. That is, it may depend on $(x,y)$. Here we use two functions discussed above, which correspond to the first-order and the second-order methods, respectively; however, note that choice of $\Bref$ is not limited to these two. \begin{algorithm}[h] \begin{small} \caption{ GULF\ in the most general form. {\bfseries Input:} % $\theta_0$, training set $S$. % Meta-parameters: $m$, $\alpha$, $ T $. {\bfseries Output:} $\theta_ T $. } \label{alg:Algm} \begin{algorithmic}[1] \STATE $\theta \leftarrow \theta_0$ \FOR{$t=0$ {\bfseries to} $ T -1$} % \STATE Define $\tarffx{m}$ by: $\tarffx{0}(x,y) := \net{\theta_t}{x}$, $\tarffx{i+1}(x,y) := $\\ $~~~~~~~~~~~~\arg\min_q \left[ \Bdiv(q,\tarffx{i}(x,y)) + \alpha \nabla \loss_y(\tarffx{i}(x,y))^\top q \right ]$ \REPEAT \STATE Sample a mini-batch $B$ from $S$. \STATE Update $\theta$ by descending the stochastic gradient \\ $\nabla_\theta \left[ \meanOverB{ \Bdiv(\net{\theta}{x}, \tarffx{m}(x,y)) } + R(\theta) \right]$ \\ $~~~~$for optimizing \\ $Q_t(\theta) := \meanOverS{ \Bdiv(\net{\theta}{x}, \tarffx{m}(x,y)) } + R(\theta)$. \UNTIL{some criteria are met} \STATE $\theta_{t+1} \leftarrow \theta$ \ENDFOR \end{algorithmic} \end{small} \end{algorithm} \tightpara{\ourssq\ (1st-order, Algorithm \ref{alg:Algsq})} With $\Bref(u)=\frac{1}{2}\| u \|^2$, % we obtain Algorithm \ref{alg:Algsq}. Derivation is straightforward. This algorithm performs $m$ steps of first-order functional gradient descent (Line 3) to push the guide function ahead of the current model and then let the model follow the guide by reducing the 2-norm between them. \begin{algorithm}[h] \begin{small} \caption{\ourssq\ ($\Bref(u)=\frac{1}{2}\|u\|^2$): {\bfseries Input:} % $\theta_0$, training set $S$. % Meta-parameters: $m$, $\alpha$, $ T $. {\bfseries Output:} $\theta_ T $. } \label{alg:Algsq} \begin{algorithmic}[1] \STATE $\theta \leftarrow \theta_0$ \FOR{$t=0$ {\bfseries to} $ T -1$} \STATE Define $\tarffx{m}$ by: $\tarffx{0}(x,y) = \net{\theta_t}{x}$, \\ $~~~~~~~~~~~~~~~~~~~~~~~~$$\tarffx{i+1}(x,y) = \tarffx{i}(x,y) - \alpha \nabla \loss_y(\tarffx{i}(x,y))$ \REPEAT \STATE Sample a mini-batch $B$ from $S$. \STATE Update $\theta$ by descending the stochastic gradient \\ $~~~~~~\nabla_\theta \left[ \meanOverB{ \frac{1}{2}\| \net{\theta}{x} - \tarffx{m}(x,y) \|^2 } + R(\theta) \right]$ \UNTIL{some criteria are met} \STATE $\theta_{t+1} \leftarrow \theta $ \ENDFOR \end{algorithmic} \end{small} \end{algorithm} \begin{algorithm}[h] \begin{small} \caption{\oursL\ ($\Bref(p)=\loss_y(p)$): {\bfseries Input:} % $\theta_0$, training set $S$. % Meta-parameters: $\alpha \in (0,1)$, $ T $. {\bfseries Output:} $\theta_ T $. Notation: $\netprm=\net{\prm}{x}$ and $\netprmt=\net{\prm_t}{x}$. } \label{alg:AlgL} \begin{algorithmic} \STATE $\theta \leftarrow \theta_0$ \FOR{$t=0$ {\bfseries to} $ T -1$} \REPEAT \STATE Sample a mini-batch $B$ from $S$. \STATE Update $\theta$ by descending the stochastic gradient \\ $\nabla_\theta \left[ \meanOverB{ \Bdivx{\loss_y}(\netprm, \netprmt) + \alpha \nabla \loss_y(\netprmt)^\top \netprm } + R(\theta) \right]$ \UNTIL{some criteria are met} \STATE $\theta_{t+1} \leftarrow \theta$ \ENDFOR \end{algorithmic} \end{small} \end{algorithm} \tightpara{\oursL\ (2nd order, Algorithm \ref{alg:AlgL})} We consider the case of $\Bref(p)=\loss_y(p)$ (i.e., $\Bref$ returns loss given prediction $p$). \eqref{eq:newton} has shown that in this case Step 1 becomes approximately the second-order functional gradient descent. Also, with this choice of $\Bref$, Algorithm \ref{alg:Algm}\ can be converted to a simpler form where we do not have to compute the values of the guide function $\tarffx{m}$ explicitly, and where we have one fewer meta-parameter. This simpler form is shown in Algorithm \ref{alg:AlgL}, which has the following relationship to Algorithm \ref{alg:Algm}. \begin{proposition} \label{pr:m} When $\Bref(p) = \loss_y(p)$ that returns loss given prediction $p$, Algorithm \ref{alg:Algm}\ with $\alpha=\gamma$ is equivalent to Algorithm \ref{alg:AlgL}\ with $\alpha=1 - (1-\gamma)^m$. \end{proposition} The proofs are all provided in the supplementary material. To simplify notation, let $\netprm=\net{\theta}{x}$, which is the model that we are updating, and $\netprmt=\net{\theta_t}{x}$, which is a model that was frozen when time changed from $t-1$ to $t$. In the stage associated with time $t$, Algorithm \ref{alg:AlgL}\ minimizes \begin{equation} \meanOverS{ \Bdivx{\loss_y}(\netprm,\netprmt) + \alpha \nabla \loss_y(\netprmt)^\top \netprm} + R(\theta) \label{eq:algLobj0} \end{equation} approximately through mini-batch SGD. The second term $\alpha \nabla \loss_y(\netprmt)^\top \netprm$ pushes the model $\netprm$ towards the direction of reducing loss, and the first term $\Bdivx{\loss_y}(\netprm,\netprmt)$ pulls it back towards the frozen model $\netprmt$. With a certain family of loss functions, \eqref{eq:algLobj0} can be further transformed as follows. \begin{proposition} \label{pr:distill} Let $y$ be a vector representation such as a $K$-dim vector representing $K$ classes. Assume that the gradient of the loss function can be expressed as \begin{equation} \nabla L(f,y) = \nabla \loss_y(f) = p(f) - y \label{eq:lossCond} \end{equation} with $p(f)$ not depending on $y$. Let \begin{align} J_t(\theta) =& \meanOverS{\Bdivx{\loss_y}(\netprm, \netprmt) + \alpha \nabla \loss_y(\netprmt)^\top \netprm} \label{eq:algLobj} \\ J'_t(\theta) =& \meanOverS{(1-\alpha)L(\netprm, p(\netprmt)) + \alpha \loss_y(\netprm)} \label{eq:distillobj} \end{align} Then we have \[ J_t(\theta) = J'_t(\theta) + c_t~, \] where $c_t$ is independent of $\theta$. This implies that \[ \arg\min_\theta \left[ J_t(\theta) + R(\theta) \right] = \arg\min_\theta \left[ J'_t(\theta) + R(\theta) \right] . \] \end{proposition} Both the cross-entropy loss and squared loss satisfy \eqref{eq:lossCond}. In particular, when $\loss_y(f)$ is the cross-entropy loss, $p(f)$ becomes the soft max function. In this case, \eqref{eq:distillobj} is the {\em distillation} formula with the frozen model $\netprmt$ playing the role of a cumbersome source model, and therefore, the parameter update rule of Algorithm \ref{alg:AlgL}\ involving \eqref{eq:algLobj} becomes that of distillation. Thus, Algorithm~\ref{alg:AlgL} can be regarded as a generalization of self-distillation for arbitrary loss functions. \subsection{Convergence Analysis} Let us define {\em $\alpha$-regularized loss} \begin{equation} \reglossx{\alpha}(\theta) := \meanOverSp{ \myloss{\net{\theta}{x}} } + \frac{1}{\alpha}R(\theta). \label{eq:reglossa} \end{equation} The following theorem shows that Algorithm \ref{alg:Algm} with step-size $\alpha$ always approximately reduces the $\alpha$-regularized loss if $\alpha$ is appropriately set. \newcommand{\tilde{\theta}}{\tilde{\theta}} \begin{theorem} \label{thm:L-conv} In the setting of Algorithm \ref{alg:Algm}\ with $m=1$, assume that there exists $\beta>0$ such that $\Bdivx{h}(f,f') \geq \beta \Bdivx{\loss_y}(f,f')$ for any $f$ and $f'$, and assume that $\alpha \in (0,\beta]$. Assume also that $Q_t(\theta)$ defined in Algorithm \ref{alg:Algm}\ is $1/\eta$ smooth in $\theta$: $ \|\nabla Q_t(\theta) - \nabla Q_t(\theta')\| \leq (1/\eta) \|\theta - \theta'\| . $ Assume that $\theta_{t+1}$ is an improvement of $\theta_t$ with respect to minimizing $Q_t$ so that $Q_t(\theta_{t+1}) \leq Q_t(\tilde{\theta})$ , where \begin{align} \tilde{\theta} = \theta_t - \eta \nabla Q_t(\theta_t) . \label{eq:algLupd} \end{align} Then we have \[ \reglossx{\alpha}(\theta_{t+1}) \le \reglossx{\alpha}(\theta_t) - \frac{\alpha \eta}{2} \|\nabla \reglossx{\alpha}(\theta_{t})\|^2 . \] \end{theorem} For Algorithm \ref{alg:AlgL}, we have $h(\cdot)=\loss_y(\cdot)$ and thus $\beta=1$, leading to $\alpha\in (0,1]$. \eqref{eq:algLupd} is the parameter update step of Algorithm \ref{alg:Algm}\ except that the algorithm stochastically estimates the mean over $S$ from a mini-batch $B$ sampled from $S$. Therefore, the theorem indicates that each stage (corresponding to $t$) of the algorithm approximately reduces the $\alpha$-regularized loss $\reglossx{\alpha}(\theta)$. In other words, while the guide function changes from stage to stage, a quantity that does {\em not} depend on the guide function goes down throughout training, namely, the $\alpha$-regularized loss $\reglossx{\alpha}$. Furthermore, we obtain from Theorem~\ref{thm:L-conv} that \[ \frac{1}{T} \sum_{t=0}^{T-1} \|\nabla \reglossx{\alpha}(\theta_{t})\|^2 \leq \frac{2( \reglossx{\alpha}(\theta_0)-\reglossx{\alpha}(\theta_{T}))}{\alpha \eta T} . \] Assuming $\reglossx{\alpha}(\theta) \ge 0$, this implies that as $ T $ goes to infinity, the right-hand side goes to zero, and so Algorithm \ref{alg:AlgL}\ converges with $\nabla \reglossx{\alpha}(\theta_{ T }) \to 0$. Therefore, when $ T $ is sufficiently large, $\theta_{ T }$ finds a stationary point of $\reglossx{\alpha}$. The convergence result indicates that having a regularization term $R(\theta)$ in the algorithm effectively causes minimization of the $\alpha$-regularized loss. However, our empirical results (shown later) indicate that GULF\ models are very different from standard models trained directly to minimize the $\alpha$-regularized loss. For example, standard models trained with $\reglossx{0.01}$ suffers from severe underfitting, but GULF\ model with $\alpha$=0.01 produces high performance. This is because each step of guided learning tries to find a good solution which is near the previous solution (guidance). The complexity of each iterate is better controlled, and hence this approach leads to better generalization performance. We will come back to this point in the next section. \section{On the Empirical Study} In this section, we first provide experimental details and additional figures regarding the experiments reported in the main paper, and then we report additional experiments using text data. Our code is provided at a repository under {\tt github.com/riejohnson}. \subsection{Details of the experiments in the main paper} \subsubsection{CIFAR10, CIFAR100, and SVHN} This section describes the experimental details of all but the ImageNet experiments. The mini-batch size was set to 128. We used momentum 0.9. The following learning rate scheduling was used: 200K steps with $\eta$, 40K steps with $0.1\eta$, and 40K steps with $0.01\eta$. The initial learning rate $\eta$ was set to 0.1 on CIFAR10/100 and 0.01 on SVHN, following \cite{Wresnet16}. The weight decay $\lambda$ was 0.0001 except that it was 0.0005 for (CIFAR100, WRN-28-10) and SVHN. We used the standard mean/std normalization on all and the standard shift and horizontal flip image augmentation on CIFAR10/100. We report the median of three runs with three random seeds. The meta-parameters were chosen based on the performance on the development set. All the results were obtained by using only the `train' portion (shown in Table \ref{tab:data-stat} of the main paper) of the official training set as training data. For label smoothing, the amount of probability taken away from the true class was chosen from $\{0.1, 0.2, 0.3, 0.4\}$. To obtain the results reported in Table \ref{tab:c10-c100-svhn} (with smaller networks), $ T $ was fixed to 25 for CIFAR10/100, and 15 for SVHN. $\alpha$ for ini:random\ was fixed to 0.3. For ini:base, we chose $\alpha$ from $\{ 0.3, 0.01 \}$. We excluded $\alpha=0.01$ for ini:random, as it takes too long. When dropout was applied in the SVHN experiments, the dropout rate was set to 0.4, following \cite{Wresnet16}. To obtain the results reported in Table \ref{tab:c10-c100-k10} (with larger networks), $ T $ was fixed to 1. For \oursL, $\alpha$ was chosen from $\{ 0.3, 0.01 \}$. For \ourssq, $\alpha$ was fixed to 0.3, and $m$ (the number of functional gradient steps) was chosen from $\{ 1, 2, 5 \}$. On CIFAR datasets, the choice of $\alpha$ or $m$ did not make much difference, and the chosen values tended to vary among the random seeds. On SVHN, $\alpha$=0.01 tended to be better when no dropout was used, and 0.3 was better when dropout was used. To perform random initialization of the parameter for ini:random\ and the baseline methods, we used Kaiming normal initialization \cite{HZRS15}, following the previous work. \subsubsection{ImageNet} Each stage of the training for ImageNet followed the code used for training the pre-trained models provided as part of TorchVision: {\tt https://github.com/pytorch/examples/blob/master/imagenet/main.py}. That is, for both ResNet-50 and WRN-50-2, the learning rate was set to $\eta$, $0.1\eta$, and $0.01\eta$ for 30 epochs each, i.e., 90 epochs in total, and the initial rate $\eta$ was set to 0.1. The mini-batch size was set to 256, and the weight decay was set to 0.0001. The momentum was 0.9. $\alpha$ was fixed to 0.5. We used two GPUs for ResNet-50 and four GPUs for WRN-50-2. We used the standard mean/std normalization and the standard image augmentation for ImageNet -- random resizing, cropping and horizontal flip, which is the same data augmentation scheme as used for training the pre-trained models provided as part of TorchVision. \clearpage \subsection{Additional figures} Figure \ref{fig:c100k1-joint-terr-with-legend} shows test error (\%) in relation to training loss with a small ResNet on CIFAR100. Additional examples of test-loss curves are shown in Figure \ref{fig:tloss}. Figure \ref{fig:c100k1-l2-alpha} shows the parameter size $\|\theta_t\|^2$ in relation to training loss, in the settings of Figure \ref{fig:c100k1-tloss-alpha} in the main paper. \begin{figure}[ht] \begin{center} \centerline{\includegraphics[width=0.25\linewidth]{aug-c100k1-joint-terr-with-legend}} \vskip -0.15in \caption{ \label{fig:c100k1-joint-terr-with-legend} Test error (\%) in relation to training loss. The arrows indicate the direction of time flow. \oursL. CIFAR100. ResNet-28. } \end{center} \vskip 0.2in \begin{center} \begin{subfigure}[b]{0.25\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c10k1-tloss-zoom-with-legend}} \label{fig:c10k1-tloss-zoom} \vskip -0.1in \caption{CIFAR10, ResNet-28} \end{center} \end{subfigure}% \quad \begin{subfigure}[b]{0.25\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{svhn-do-tloss-zoom-with-legend}} \label{fig:svhn-tloss-zoom} \vskip -0.1in \caption{SVHN, WRN-16-4.} \end{center} \end{subfigure}% \quad \begin{subfigure}[b]{0.25\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c10dense-tloss-with-legend}} \label{fig:c10dense-tloss} \vskip -0.1in \caption{CIFAR10,DenseNetBC-40-12.} \end{center} \end{subfigure}% \end{center} \vskip -0.35in \caption{ \label{fig:tloss} Additional examples of test loss curves of \oursL. The arrows indicate the direction of time flow. } \vskip 0.4in \centering \begin{subfigure}[b]{0.2\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-l2-a1}} \vskip -0.1in \caption{ \label{fig:c100k1-l2-a1} base-loop\ ($\alpha$=1) } \end{center} \end{subfigure}% \begin{subfigure}[b]{0.2\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-l2-a09}} \vskip -0.1in \caption{ \label{fig:c100k1-l2-a09} $\alpha$=0.9 } \end{center} \end{subfigure}% \begin{subfigure}[b]{0.2\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-l2-a03}} \vskip -0.1in \caption{ \label{fig:c100k1-l2-a03} $\alpha$=0.3 } \end{center} \end{subfigure}% \begin{subfigure}[b]{0.2\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-l2-a01}} \vskip -0.1in \caption{ \label{fig:c100k1-l2-a01} $\alpha$=0.1 } \end{center} \end{subfigure}% \begin{subfigure}[b]{0.2\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-l2-a001}} \vskip -0.1in \caption{ \label{fig:c100k1-l2-a001} $\alpha$=0.01 } \end{center} \end{subfigure}% \vskip -0.25in \caption{ \label{fig:c100k1-l2-alpha} Parameter size $\|\theta_t\|^2$ of ini:base (`$\triangle$') and ini:random(`$\circ$'). with five values of $\alpha$ (becoming smaller from left to right), in relation to training loss. \oursL. $ T $=25. CIFAR100. ResNet-28. Matching figures with Figure \ref{fig:c100k1-tloss-alpha}. As $\alpha$ becomes smaller, the (potential) meeting point shifts further away from the base model. The left-most figure is base-loop, which is equivalent to $\alpha$=1. The arrows indicate the direction of time flow. } \vskip -0.1in \end{figure} \input{breg-exp-text} \section{Proofs} In the proofs, we use abbreviated notation by dropping $x$ and $y$ and making $\theta$ a subscript, e.g., we write $\netprm$ for $\net{\prm}{x}$. \subsection{Proof of Proposition \ref{pr:m}} \paragraph{Proposition \ref{pr:m}} {\em When $\Bref(p) = \loss_y(p)$ that returns loss given prediction $p$, Algorithm \ref{alg:Algm}\ with $\alpha=\gamma$ is equivalent to Algorithm \ref{alg:AlgL}\ with $\alpha=1 - (1-\gamma)^m$. } \begin{proof} From Algorithm \ref{alg:Algm}\ with $\alpha=\gamma$, we have \begin{align} \tarffx{i} = \arg\min_q \left[ \Bdiv(q,\tarffx{i-1}) + \gamma \nabla \loss_y(\tarffx{i-1})^\top q \right ] . \label{eq:tarffxi} \end{align} From $\Bref(\cdot)=\loss_y(\cdot)$ and \eqref{eq:tarffxi}, we obtain \begin{align*} \nabla\loss_y(\tarffx{i}) &= \nabla\loss_y(\tarffx{i-1}) - \gamma\nabla\loss_y(\tarffx{i-1}) = (1-\gamma)\nabla\loss_y(\tarffx{i-1}) ~~\mbox{ for }i=1,\cdots,m . \end{align*} Since $\tarffx{0}=\netprmt$, we have \begin{align*} \nabla\loss_y(\tarffx{m}) &= (1-\gamma)^m \nabla\loss_y(\tarffx{0}) = (1-\gamma)^m \nabla\loss_y(\netprmt) , \end{align*} which implies % \begin{align*} \nabla_{\netprm} \left[ \Bdiv(\netprm,\tarffx{m}) \right ] &= \nabla\loss_y(\netprm) - \nabla\loss_y(\tarffx{m}) = \nabla\loss_y(\netprm) - (1-\gamma)^m \nabla\loss_y(\netprmt) \\ &= \nabla_{\netprm} \left[ \Bdivx{\loss_y}(\netprm, \netprmt) + ( 1 - (1-\gamma)^m) \nabla \loss_y(\netprmt)^\top \netprm \right] \end{align*} and therefore, $ \nabla_\theta \left[ \Bdiv(\netprm,\tarffx{m}) \right ] = \nabla_\theta \left[ \Bdivx{\loss_y}(\netprm, \netprmt) + ( 1 - (1-\gamma)^m) \nabla \loss_y(\netprmt)^\top \netprm \right] $. The rest is trivial. \end{proof} \subsection{Proof of Proposition \ref{pr:distill}} \paragraph{Proposition \ref{pr:distill}} {\em Let $y$ be a vector representation such as a $K$-dim vector representing $K$ classes. Assume that the gradient of the loss function can be expressed as \[ \nabla L(f,y) = \nabla \loss_y(f) = p(f) - y \] with $p(f)$ not depending on $y$. Let \begin{align*} J_t(\theta) =& \meanOverS{\Bdivx{\loss_y}(\netprm, \netprmt) + \alpha \nabla \loss_y(\netprmt)^\top \netprm} \\ J'_t(\theta) =& \meanOverS{(1-\alpha)L(\netprm, p(\netprmt)) + \alpha \loss_y(\netprm)} \end{align*} Then we have \[ J_t(\theta) = J'_t(\theta) + c_t, \] where $c_t$ is independent of $\theta$. This implies that \[ \arg\min_\theta \left[ J_t(\theta) + R(\theta) \right] = \arg\min_\theta \left[ J'_t(\theta) + R(\theta) \right] . \] } % \begin{proof} \begin{align*} \nabla_{\netprm} \left[ \Bdivx{\loss_y}(\netprm, \netprmt) + \alpha \nabla \loss_y(\netprmt)^\top \netprm \right ] &= \nabla\loss_y(\netprm) - (1-\alpha)\nabla\loss_y(\netprmt) \\ &= (p(\netprm)-y) - (1-\alpha)(p(\netprmt)-y) \\ &= (1-\alpha)(p(\netprm) - p(\netprmt)) + \alpha( p(\netprm) - y ) \\ &= \nabla_{\netprm} \left[ (1-\alpha)L(\netprm, p(\netprmt)) + \alpha\loss_y(\netprm) \right ] . \end{align*} This implies that $\nabla J_t(\theta) = \nabla J'_t(\theta)$. Therefore $J_t(\theta) - J'_t(\theta)$ is independent of $\theta$. \end{proof} \subsection{Proof of Theorem \ref{thm:L-conv}} \paragraph{Theorem \ref{thm:L-conv}} {\em In the setting of Algorithm \ref{alg:Algm}\ with $m=1$, assume that there exists $\beta>0$ such that $\Bdivx{h}(f,f') \geq \beta \Bdivx{\loss_y}(f,f')$ for any $f$ and $f'$, and assume that $\alpha \in (0,\beta]$. Assume also that $Q_t(\theta)$ defined in Algorithm \ref{alg:Algm}\ is $1/\eta$ smooth in $\theta$: \[ \|\nabla Q_t(\theta) - \nabla Q_t(\theta')\| \leq (1/\eta) \|\theta - \theta'\| . \] Assume that $\theta_{t+1}$ is an improvement of $\theta_t$ with respect to minimizing $Q_t$ so that \[ Q_t(\theta_{t+1}) \leq Q_t(\tilde{\theta}) , \] where \begin{align*} \tilde{\theta} = \theta_t - \eta \nabla Q_t(\theta_t) . \end{align*} Then we have \[ \reglossx{\alpha}(\theta_{t+1}) \le \reglossx{\alpha}(\theta_t) - \frac{\alpha \eta}{2} \|\nabla \reglossx{\alpha}(\theta_{t})\|^2 . \] } \begin{proof} We first define $\tilde{Q}_t(\theta)$ as follows: \[ \tilde{Q}_t(\theta) := \meanOverS{\Bdivx{h}(\netprm,\netprmt) + \alpha \nabla \loss_y(\netprmt)^\top \netprm } + R(\theta) . \] We can check that $Q_t(\theta) - \tilde{Q}_t(\theta)$ is independent of $\theta$. Therefore optimizing $\theta$ with respect to $Q_t(\theta)$ is the same as optimizing $\theta$ with respect to $\tilde{Q}_t(\theta)$, and $\nabla Q_t(\theta)=\nabla \tilde{Q}_t(\theta)$. The smoothness assumption implies that \[ \tilde{Q}_t(\theta- \Delta \theta) \leq \tilde{Q}_t(\theta) - \nabla {Q}_t(\theta)^\top \Delta \theta + \frac{1}{2\eta } \|\Delta \theta\|^2 . \] Therefore \begin{align*} \tilde{Q}_t(\theta_{t+1}) \leq& \tilde{Q}_t(\tilde{\theta}) = \tilde{Q}_t(\theta_t - \eta \nabla Q_t(\theta_t)) \\ \leq & \tilde{Q}_t(\theta_t) - \eta \|\nabla Q_t(\theta_t)\|^2 + \frac{1}{2\eta} \| \eta \nabla Q_t(\theta_t)\|^2 \\ =& \tilde{Q}_t(\theta_t) - \frac{\eta}{2} \|\nabla Q_t(\theta_t)\|^2 . \end{align*} Note also that \begin{align*} \tilde{Q}_t(\theta_{t+1}) - \tilde{Q}_t(\theta_t) \geq& \meanOverS{\beta \Bdivx \loss_y(f_{\theta_{t+1}},f_{\theta_t}) + \alpha \nabla \loss_y(f_{\theta_t})^\top (f_{\theta_{t+1}} -f_{\theta_t}) } + [R(\theta_{t+1}) - R(\theta_t)]\\ =& \meanOverS{ (\beta-\alpha) \Bdivx \loss_y(f_{\theta_{t+1}},f_{\theta_t}) + \alpha \loss_y(f_{\theta_{t+1}}) - \alpha \loss_y(f_{\theta_t})} + [R(\theta_{t+1}) - R(\theta_t)]\\ \geq& \meanOverS{ \alpha \loss_y(f_{\theta_{t+1}}) - \alpha \loss_y(f_{\theta_t})} + [R(\theta_{t+1}) - R(\theta_t)]\\ =& \alpha \reglossx{\alpha}(\theta_{t+1}) - \alpha \reglossx{\alpha}(\theta_{t}) . \end{align*} The second inequality is due to the non-negativity of the Bregman divergence. By combining the two inequalities, we obtain \[ \alpha \reglossx{\alpha}(\theta_{t+1}) \leq \alpha \reglossx{\alpha}(\theta_{t}) - \frac{\eta}{2} \|\nabla Q_t(\theta_t)\|^2 . \] Now, observe that $\nabla Q_t(\theta_t) = \nabla \tilde{Q}_t(\theta_t) =\alpha \nabla \reglossx{\alpha}(\theta_t)$, and we obtain the desired bound. \end{proof} \section{Empirical study} \label{sec:empirical} While the proposed framework is general, our empirical study places a major focus on \oursL\ (Algorithm \ref{alg:AlgL}) with the cross-entropy loss, due to its connection to distillation (Proposition \ref{pr:distill}). In particular, we set up our implementation so that one instance of \oursL\ coincides with self-distillation to provide empirical insight into it from a functional gradient viewpoint. First, with the goal of understanding the empirical behavior of the algorithm, we examine obtained models in reference to our theoretical findings. We use relatively small neural networks for this purpose. Next, we study the case of larger networks with consideration of practicality. \subsection{Implementation} \label{sec:implement} To implement the algorithms presented above, methods of parameter initialization and optimization need to be considered. To observe the basic behavior, our strategy in this work is to keep it as simple as possible. \tightpara{Initial parameter $\theta_0$} As the functions of interest are nonconvex, the outcome depends on the initial parameter $\theta_0$. The most natural (and simplest) choice is random parameters. This option is called `ini:random' below. We also considered two more options. % One is to start from a {\em base model} obtained by regular training, called `ini:base'. This option enables study of self-distillation. The other is to start from a shrunk version of the base model, and details of this option will be provided later. % \tightpara{Parameter update} To update parameter $\theta$ by descending the stochastic gradient, standard techniques can be used such as momentum, Rmsprop \cite{rmsprop}, Adam \cite{Adam15}, and so forth. As is the case for regular training, learning rate scheduling is beneficial. Among many possibilities, we chose to repeatedly use for each $t$, the same method that works well for regular training. For example, a standard method for CIFAR10 is to use momentum and decay the learning rate only a few times, and therefore we use this scheme for each stage on CIFAR10. That is, the learning rate is reset to the initial rate for each $t$; however note that $\theta$ is not reset. Although this is perhaps not the best strategy in terms of computational cost, its advantage is that at the end of each stage, we obtain ``clean'' intermediate models with $\theta_t$ that were optimized for intermediate goals. (If instead, we used one decay schedule from the beginning to the end, the convergence theorem still holds, but $\theta_t$ would be noisy when the learning rate is still high.) This strategy enables to study how a model changes as the guide function gradually goes ahead, and also relates the method to self-distillation. Since $\theta$ is not reset when the learning rate is reset, this schedule can be regarded as a simplified fixed-schedule version of {\em SGD with warm restarts (SGDR)} \cite{cosine17}. (SGDR instead does sophisticated scheduling with cosine-shape decay and variable epochs.) For comparison, we test the same schedule with the standard optimization objective (`base-loop'; Algorithm \ref{alg:baseLoop}). \tightpara{Enabling study of self-distillation} We study classification tasks with the standard cross-entropy loss, which satisfies the condition of Proposition \ref{pr:distill}. Combined with the choice of learning rate scheduling above, \oursL\ with the ini:base\ option (which initializes $\theta_0$ with a trained model) essentially becomes self-distillation. Thus, one aspect of our experiments is to study self-distillation from the viewpoint of functional gradient learning. \begin{algorithm}[t] \begin{small} \caption{base-loop\ (simplified SGDR): {\bfseries Input:} $\theta_0$, training set $S$. Meta-parameter: $ T $. {\bfseries Output:} $\theta_ T $. } \label{alg:baseLoop} \begin{algorithmic} \FOR{$t=0$ {\bfseries to} $ T -1$} \STATE $\theta_{t+1} \leftarrow \arg\min_\theta \left[ \meanOverSp{ \loss_y(\net{\theta}{x}) } + R(\theta) \right]$ \\ $~~~~~~~~~~~~~$ where $\theta$ is initialized by $\theta_t$. \ENDFOR \end{algorithmic} \end{small} \end{algorithm} \subsection{Experimental setup} \label{sec:setup} \begin{table}[t] \begin{center} \begin{small} \begin{tabular}{|c|r|r|r|r|} \hline & \#class & \multicolumn{1}{|c|}{train} & \multicolumn{1}{|c|}{dev.} & \multicolumn{1}{|c|}{test} \\ \hline CIFAR10 & 10 & 49000 & 1000 & 10000 \\ CIFAR100 & 100 & 49000 & 1000 & 10000 \\ SVHN & 10 & 599388 & 5000 & 26032 \\ ImageNet & 1000 & 1271167 & 10000 & 50000 \\ \hline \end{tabular} \end{small} \end{center} \vskip -0.15in \caption{\label{tab:data-stat} Data. For each dataset, we randomly split the official training set into a training set and a development set to use the development set for meta-parameter tuning. For ImageNet, following custom, % we used the official validation set as our `test' set. } \vskip -0.1in \end{table} Table \ref{tab:data-stat} summarizes the data we used. As for network architectures, we mainly used ResNet \cite{Resnet16a,Resnet16b} and wide ResNet (WRN) \cite{Wresnet16}. Following the original work, the regularization term $R(\theta)$ was set to be $R(\theta)= \frac{\lambda}{2}\| \theta \|^2$ where $\lambda$ is the weight decay. We fixed mini-batch size to 128 and used the same learning rate decay schedule for all but ImageNet. Due to the page limit, details are described in the supplementary material. However, note that the schedule we used for all but ImageNet is 3--4 times longer than those used in the original ResNet or WRN study for CIFAR datasets. This is because we used the ``train longer'' strategy \cite{HHS17}, and accordingly, the base model performance visibly improved from the original work. This, in fact, made it harder to obtain large performance gains over the base models (not only for GULF\ but also for all other tested methods) as the bar was set higher. We feel that this is more realistic testing than using the original shorter schedule. We applied the standard mean/std normalization to images and used the standard image augmentation. In particular, for ImageNet, we used the same data augmentation scheme as used for training the pre-trained models provided as part of TorchVision, since we used these models as our base model. The default value of $\alpha$ is 0.3. \begin{figure}[h] \begin{subfigure}[b]{0.5\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-tloss-with-legend}} \vskip -0.1in \caption{ \label{fig:c100k1-tloss-with-legend} \oursL } \end{center} \end{subfigure}% \begin{subfigure}[b]{0.5\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-a0-tloss-with-legend}} \vskip -0.1in \caption{ \label{fig:c100k1-a0-tloss-with-legend} Regular training } \end{center} \end{subfigure}% \vskip -0.3in \caption{ \label{fig:c100k1-tloss} Test loss in relation to training loss. The arrows indicate the direction of time flow. CIFAR100. ResNet-28. } \vskip -0.1in \end{figure} \begin{figure*} \centering \begin{subfigure}[b]{0.2\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-tloss-a1}} \vskip -0.1in \caption{ \label{fig:c100k1-tloss-a1} base-loop\ ($\alpha$=1) } \end{center} \end{subfigure}% \begin{subfigure}[b]{0.2\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-tloss-a09}} \vskip -0.1in \caption{ \label{fig:c100k1-tloss-a09} $\alpha$=0.9 } \end{center} \end{subfigure}% \begin{subfigure}[b]{0.2\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-tloss-a03}} \vskip -0.1in \caption{ \label{fig:c100k1-tloss-a03} $\alpha$=0.3 } \end{center} \end{subfigure}% \begin{subfigure}[b]{0.2\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-tloss-a01}} \vskip -0.1in \caption{ \label{fig:c100k1-tloss-a01} $\alpha$=0.1 } \end{center} \end{subfigure}% \begin{subfigure}[b]{0.2\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-tloss-a001}} \vskip -0.1in \caption{ \label{fig:c100k1-tloss-a001} $\alpha$=0.01 } \end{center} \end{subfigure}% \vskip -0.1in \vskip -0.25in \caption{ \label{fig:c100k1-tloss-alpha} Test loss % of ini:base (`$\triangle$') and ini:random(`$\circ$'). with five values of $\alpha$ (becoming smaller from left to right), in relation to training loss. \oursL. $ T $=25. CIFAR100. ResNet-28. As $\alpha$ becomes smaller, the (potential) meeting point shifts further away from the base model. The left-most figure shows base-loop, which is equivalent to $\alpha$=1. } \vskip -0.1in \end{figure*} \subsection{Smooth path} We start with examining training of a relatively small network ResNet-28 (0.4M parameters) on CIFAR100. In this setting, optimization is fast, and so a relatively large $ T $ (the number of stages) is feasible. We performed \oursL\ training with $ T $=25 starting from random parameters (ini:random) as well as starting from a base model obtained by regular training (ini:base). Figure \ref{fig:c100k1-tloss-with-legend} plots test loss of these two runs in relation to training loss. Each point represents a model $\net{\theta_t}{x}$ at time $t=1,3,5,\cdots,25$, and the arrows indicate the direction of time flow. We observe that training proceeds on a {\em smooth path}. ini:random ($\circ$), which starts from random parameters ($\square$), reduces both training loss and test loss. ini:base ($\triangle$) starts from the base model ($\times$) and increases training loss, but reduces test loss. ini:random\ and ini:base\ meet and complete one {\em smooth path} from a random state ($\square$) to the base model ($\times$). ini:random\ goes forward on this path while ini:base\ goes backward, and importantly, the path goes through the region where test loss is lower than that of the base model. The test error plotted against training loss also forms a U-shape path. Similar U-shape curves % were observed across datasets and network architectures. The supplementary material shows a test error curve and a few more examples of test loss curves including a case of DenseNet \cite{densenet17}. In the middle of this path, a number of models with good generalization performance lie. One might wonder if regular training also forms such a path. Figure \ref{fig:c100k1-a0-tloss-with-legend} shows that this is not the case. This figure plots the loss of intermediate models in the course of regular training so that the $i$-th point represents a model after 20K$\times i$ steps of mini-batch SGD with the learning rate being reduced twice. The path of regular training from random initialization ($\square$) to the final model ($\times$) is rather bumpy and the test loss generally stays as high as the final outcome. The bumpiness is due to the fact that the learning rate is relatively high at the beginning of training. Comparing Figures \ref{fig:c100k1-tloss-with-legend} and \ref{fig:c100k1-a0-tloss-with-legend}, GULF\ training clearly takes a very different path from regular training. \subsection{In relation to the theory} \tightpara{Going forward, going backward} It might look puzzling why ini:base\ goes {\em backward} in the direction of {\em increasing} the training loss. Theorem \ref{thm:L-conv} suggests that this is the effect of the regularization term $R(\theta)$, in this case $R(\theta)= \frac{\lambda}{2}\|\theta\|^2$ with weight decay $\lambda$. The theory indicates that for $\alpha \in (0,1]$, the $\alpha$-regularized loss \[ \reglossx{\ssa}(\prm) = \meanOverS{ \loss_y(\net{\theta}{x}) } + R(\theta)/\alpha \] goes down and eventually converges as \oursL\ proceeds. By contrast, The base model is a result of minimizing \[ \meanOverS{ \loss_y(\net{\theta}{x}) } + R(\theta). % \] As we always set $\alpha<1$ (0.3 in this case), i.e., $1/\alpha>1$, \oursL\ prefers smaller parameters than the base model does. Consequently, when \oursL\ (with small $\alpha$) starts from the base model (which has low training loss and high $R(\theta)$ ), \oursL\ is likely to reduce $R(\theta)/\alpha$ at the expense of increasing loss (going backward). When \oursL\ starts from random parameters, whose training loss is high, \oursL\ is likely to reduce loss (going forward) at the expense of increasing $R(\theta)/\alpha$. \tightpara{Effects of changing $\alpha$} With \oursL, the guide function $ \netfunc^* $ satisfies \begin{align*} \netfunc^* &\approx \netprmt - \alpha (\hessian{\loss_y(\netprmt)})^{-1} \nabla \loss_y(\netprmt), \end{align*} thus, $\alpha$ serves as a step-size of functional gradient descent for {\em reducing loss}. The effects of changing $\alpha$ are shown in Figure \ref{fig:c100k1-tloss-alpha} with $ T $ fixed to 25. The left-most graph is base-loop, which is equivalent to \oursL\ with $\alpha$=1 in this implementation. There are three things to note. First, with a very small step-size $\alpha$=0.01 (the right most), ini:random\ cannot reach far from the random state for $ T $=25. This is a straightforward effect of a small step size. Second, as step-size $\alpha$ becomes smaller (from left to right), the (potential) meeting/convergence point shifts further away from the base model; the convergence point of $\|\theta_t\|^2$ also shifts away from the base model and decreases (supplementary material). This is the effect of larger $R(\theta)/\alpha$ for smaller $\alpha$. Finally, with a large step-size (0.9 and 1), the curve flattens and it no longer goes through the high-performance regions {\em slowly} or {\em smoothly}, and the benefit diminishes/vanishes. \tightpara{$\alpha$-regularized loss $\reglossx{\ssa}(\prm)$} Figure \ref{fig:c100k1-ajl2l-alpha} confirms that, as suggested by the theory, $\reglossx{\ssa}(\prm)$ goes down and almost converges as training proceeds. This fact motivates examining standard models trained with this $\reglossx{\ssa}(\prm)$ objective, which we call base-$\lambda/\ssa$\ models. We found that base-$\lambda/\ssa$\ models do not perform as well as \oursL\ at all. In particular, with a very small $\alpha$=0.01, which 100 times tightens regularization, test error of base-$\lambda/\ssa$\ drastically degrades due to underfitting; in contrast, ini:base\ with $\alpha$=0.01 performs well. Moreover, base-$\lambda/\ssa$\ models are very different from \oursL\ models with corresponding $\alpha$ even with a moderate $\alpha$. For example, Figure \ref{fig:c100k1-l2-baselam-a03} plots the parameter size $\|\theta_t\|^2$ in relation to training loss for $\alpha$=0.3. base-$\lambda/\ssa$\ is clearly far away from where ini:base\ and ini:random\ converge to. \begin{figure}[h] \vskip -0.1in \begin{subfigure}[b]{0.5\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-ajl2l-alpha}} \vskip -0.1in \caption{ \label{fig:c100k1-ajl2l-alpha} } \end{center} \end{subfigure}% \begin{subfigure}[b]{0.5\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k1-l2-baselam-a03-with-legend}} \vskip -0.1in \caption{ \label{fig:c100k1-l2-baselam-a03} } \end{center} \end{subfigure}% \vskip -0.3in \caption{ \label{fig:c100k1-ajl2l-baselam-alpha} (a) $\alpha$-regularized loss $\reglossx{\ssa}(\prm)$ in relation to time $t$. \oursL\ ini:base. (b) $\|\theta_t\|^2$ and training loss of base-$\lambda/\ssa$\ in comparison with \oursL. $\alpha$=0.3. CIFAR100. ResNet-28. } \end{figure} \vskip -0.1in \tightpara{Benefit of guiding} This fact illustrates the merit of guided learning (including self-distillation). GULF\ (indirectly and locally) minimizes the $\alpha$-regularized loss $\reglossx{\ssa}(\prm)$, but it does this against the restraining force of {\em pulling the model back} to the current model. This serves as a form of regularization. Without such a force, training for, say, $\reglossx{0.01}$ would make a big jump to rapidly reduce the parameter size and end up with a radical solution that suffers severely from underfitting. This is what happens with base-$\lambda/\ssa$. By contrast, guided learning finds a more moderate solution with good generalization performance, and this is the benefit of extra regularization (in the form of pulling back) provided through the guide function. The regularization effect of distillation has been mentioned \cite{distill14}, and our framework formalizes the notion through the functional gradient learning viewpoint. \subsection{With smaller networks} \newcommand{\imp}{\em} % \begin{table}[b] \vskip -0.2in \begin{center} \begin{small} \begin{tabular}{c|c|c|c|c|c|c|} \cline{2-7} &\multicolumn{2}{|c|}{}& C10 & C100 & \multicolumn{2}{|c|}{SVHN} \\ \cline{2-7} 1 & \multirow{4}{*}{baselines} & base model & 6.42 & 30.90 & 1.86 & 1.64 \\ \cline{3-7} 2 && base-$\lambda/\ssa$ & 6.60 & 30.24 & 1.78 & 1.67 \\ % 3 && base-loop & 6.20 & 30.09 & 1.93 &{\bf 1.53}\\ 4 && label smooth & 6.66 & 30.52 & 1.71 & 1.60 \\ \cline{2-7} 5 & \multirow{2}{*}{\oursL} & ini:random & 5.91 &{\bf 28.83} & 1.71 &{\bf 1.53} \\ 6 && ini:base &{\bf 5.75}& 29.12 &{\bf 1.65}& 1.56 \\ \cline{2-7} \end{tabular} \end{small} \end{center} \vskip -0.125in \caption{\label{tab:c10-c100-svhn} Test error (\%). Median of 3 runs. Resnet-28 (0.4M parameters) for CIFAR10/100, and WRN-16-4 (2.7M parameters) for SVHN. Two numbers for SVHN are without and with dropout. base-$\lambda/\ssa$: weight decay $\lambda/\alpha$. base-loop: Algorithm \ref{alg:baseLoop}. } \vskip -0.1in \end{table} Now we review the test error results of using relatively small networks in Table \ref{tab:c10-c100-svhn}. $ T $ for \oursL\ and base-loop\ was fixed to 25 on CIFAR10/100 and 15 on SVHN. Step-size $\alpha$ was fixed to 0.3 for ini:random\ and chosen from $\{$ 0.01,0.03 $\}$ for ini:base. \oursL\ is consistently better than the base model (Row 1) and generally better than the three baseline methods (Row 2--4). The base-$\lambda/\ssa$\ results (Row 2) were obtained by $\alpha$=0.3, and they are generally not much different from the base model. base-loop\ (Row 3) generally makes small improvement over the base model, but it generally falls short of \oursL. A common technique, label smoothing (Row 4) \cite{inception16}, `softens' labels by taking a small amount of probability from the correct class and distributing it equally to the incorrect classes. It generally worked well, but the improvements were small. That is, the three baseline methods produced performance gains to some extent, but their gains are relatively small, and they are not as consistent as \oursL\ across datasets. \tightpara{ini:random} In these experiments, ini:random\ performed as well as ini:base. This fact cannot be explained from the knowledge-transfer viewpoint of distillation, but it can be explained from our functional gradient learning viewpoint, as in the previous section. \begin{figure}[t] \begin{subfigure}[b]{0.5\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c10k10-tloss-with-fcs}} \vskip -0.1in \caption{ \label{fig:c10k10-tloss-with-fcs} CIFAR10 } \end{center} \end{subfigure}% \begin{subfigure}[b]{0.5\linewidth} \begin{center} \centerline{\includegraphics[width=1\linewidth]{aug-c100k10-tloss-with-fcs}} \vskip -0.1in \caption{ \label{fig:c100k10-tloss-with-fcs} CIFAR100 } \end{center} \end{subfigure}% \vskip -0.25in \caption{ \label{fig:c10c100k10-tloss-with-fcs} Test loss in relation to training loss. WRN-28-10 on CIFAR10 and CIFAR100. \oursL. ini:base/2 (`$\diamond$') fills the gap between ini:random\ (`$\circ$') and ini:base\ (`$\triangle$'). } \end{figure} \begin{table}[t] \begin{center} \begin{small} \begin{tabular}{c|c|c|c|} \cline{2-4} & & CIFAR10 & CIFAR100 \\ \cline{2-4} 1&base model& 3.82 & 18.55 \\ \cline{3-4} 2&base-$\lambda/\ssa$ & 3.70 & 27.89 \\ 3&base-loop & 3.70 & 18.91 \\ % 4&lab smooth & 4.13 & 19.44 \\ % \cline{2-4} 5& \ourssq &{\bf 3.46}& 18.14 \\ % 6& \oursL & 3.63 &{\bf 17.95}\\ % \cline{2-4} \end{tabular} \end{small} \end{center} \vskip -0.15in \caption{\label{tab:c10-c100-k10} Test error (\%) results on CIFAR10 and CIFAR100. WRN-28-10 (36.5M parameters) without dropout. Median of 3 runs. } \vskip -0.1in \end{table} \subsection{With larger networks} The neural networks and the size of images (32$\times$32) used above are relatively small. We now consider computationally more expensive cases. % \tightpara{Parameter shrinking} ini:random, the most natural option from the functional gradient learning viewpoint, unfortunately, turned out to be too costly in this large-network situation. Moreover, in this setting, it is useful to have an option of starting somewhere between the two end points (`random' and `base') since that is where good models tend to lie according to our study with small networks. Therefore, we experimented with `rewinding' a base model by shrinking its weights and bias of the last fully-connected linear layer by dividing them with $\fcsmeta > 1$ (a meta-parameter). We use these partially-shrunk parameters as the initial parameter $\theta_0$ for GULF. Since doing so shrinks the model output $\net{\theta_0}{x}$ by the factor of $\fcsmeta$, this is closely related to {\em temperature scaling}, for {\em distillation} \cite{distill14} and post-training calibration \cite{GPSW17}. Parameter shrinking is, however, simpler than temperature scaling of distillation, which scales logits of both models, and fits well in our framework. Figure \ref{fig:c10c100k10-tloss-with-fcs} shows training loss (the $x$-axis) and test loss (the $y$-axis) obtained when parameter shrinking is applied to WRN-28-10 on CIFAR10 and CIFAR100. By shrinking with $\fcsmeta$=2, the loss values of the base model change from `base' ($\times$) to `base/2' ($+$). The location of base/2 is roughly the midpoint of two end points `base' and `random'. ini:base/2 ($\diamond$), which starts from the shrunk model, explores the space neither ini:random\ nor ini:base\ can reach in a few stages. \tightpara{Larger ResNets on CIFAR10 and CIFAR100} Table \ref{tab:c10-c100-k10} shows test error of ini:base/2 using WRN-28-10 on CIFAR10/100. $ T $ was fixed to 1. Compared with the base model, both \ours1 and 2 consistently improved performance, while the baseline methods mostly failed to make improvements. \ours1 and 2 produced similar performances. % This is the best WRN non-ensemble results on CIFAR10/100 among the self-distillation related studies that we are aware of. \tightpara{ImageNet} To test further scale-up, we experimented with ResNet-50 (25.6M parameters) and WRN50-2 (68.9M parameters) on the ILSVRC-2012 ImageNet dataset. As ImageNet training is resource-consuming, we only tested selected configurations, which are \oursL\ with ini:base\ and ini:base/2 options. In these experiments, $\alpha$ was set to 0.5, but partial results suggested that 0.3 works well too. We used models pre-trained on ImageNet provided as part of TorchVision\footnote{ https://pytorch.org/docs/stable/torchvision/models.html } as the base models. Table \ref{tab:imgnet} shows that \oursL\ consistently improves error rates over the base model. The best-performing ini:base/2 achieved lower error rates than a twice deeper counterpart of each network, ResNet-101 for ResNet-50 and WRN-101-2 for WRN-50-2 trained in a standard way (Rows 11--12). Thus, we confirmed that \oursL\ scales up and brings performance gains on ImageNet. To our knowledge, this is one of the largest-scale ImageNet experiments among the self-distillation related studies. \begin{table}[h] \begin{center} \begin{small} \begin{tabular}{c|c|c|cc|cc|} \cline{2-7} % &\multicolumn{2}{|c|}{methods} & \multicolumn{2}{|c|}{Resnet-50} & \multicolumn{2}{|c|}{WRN50-2} \\ \cline{2-7} \noalign{\vskip\doublerulesep \vskip-\arrayrulewidth} \cline{2-7} 1&\multicolumn{2}{|c|}{base model} & 23.87 & 7.14 & 21.53 & 5.91 \\ % \cline{2-7} 2&\multirow{3}{*}{base-loop} & $t$=1 & 23.73 & 6.95 & 21.99 & 6.11 \\ 3& & $t$=2 & 23.50 & 6.93 & \multicolumn{2}{|c|}{--} \\ 4& & $t$=3 & 23.36 & 6.78 & \multicolumn{2}{|c|}{--} \\ \cline{2-7} \noalign{\vskip\doublerulesep \vskip-\arrayrulewidth} \cline{2-7} 5&\multirow{3}{*}{ini:base} & $t$=1 & 22.79 & 6.43 & 21.17 & 5.65 \\ % 6& & $t$=2 & 22.49 & 6.27 & \multicolumn{2}{|c|}{--} \\ 7& & $t$=3 & 22.31 & 6.28 & & \\ \cline{2-7} \cline{2-7} 8&\multirow{3}{*}{ini:base/2} & $t$=1 & 22.50 & 6.25 &{\bf 20.69}&{\bf 5.35}\\ 9& & $t$=2 & 22.31 & 6.18 & \multicolumn{2}{|c|}{--} \\ 10& & $t$=3 &{\bf 22.08} &{\bf 6.10}& \multicolumn{2}{|c|}{--} \\ \cline{2-7} \noalign{\vskip\doublerulesep \vskip-\arrayrulewidth} \cline{2-7} 11&\multicolumn{2}{|c|}{Resnet-101$\dagger$} & 22.63 & 6.44 & \multicolumn{2}{|c|}{--} \\ 12&\multicolumn{2}{|c|}{WRN-101-2$\dagger$} & \multicolumn{2}{|c|}{--} & 21.16 & 5.72 \\ \cline{2-7} \end{tabular} \end{small} \end{center} \vskip -0.15in \caption{\label{tab:imgnet} ImageNet 224$\times$224 single-crop results on the validation set. \oursL. top-1 and top-5 errors (\%). \\ $\dagger$ The ResNet-101 and WRN-101-2 performances are from the description of the pre-trained torchvision models. } \vskip -0.1in \end{table} \tightpara{Additional experiments on text} Finally, the experiments in this section used image data. Additional experiments using text data are presented in the supplementary material. \section{Discussion} \tightpara{Guided exploration of landscape} GULF\ is an informed/guided exploration of the loss landscape, where the guidance is successively given as interim goals set in the neighborhood of the model at the time, and such guidance is provided by gradient descent in a function space. Another view of this process is an accumulation of successive greedy optimization. Instead of searching the entire space for the ultimate goal of loss minimization at once, guided learning proceeds with repeating a local search, which limits the space to be searched and leads to better generalization. Its benefit is analogous to that of $\varepsilon$-boosting. \tightpara{\ourssq} \oursL\ uses the second-order information of loss in the functional gradient step for generating the guide function, and \ourssq\ does not. \oursL's update rule is equivalent to that of distillation, and \ourssq's is not. \ourssq\ also differs from the logit least square fitting version of distillation. In our experiments (though limited due to our focus on self-distillation study), \ourssq\ performed as well as \oursL. % If this is a general trend, this indicates that inclusion of the second-order information is not particularly helpful. If so, this could be because the second-order information is useful for accelerating optimization, but we would like to proceed slowly to obtain better generalization performance. This motivates further investigation of \ourssq\ as well as other instantiations of the framework. \tightpara{Computational cost} From a practical viewpoint, a shortcoming of the particular setup tested here (but not the general framework of GULF) is computational cost. Since we used the same learning rate scheduling as regular training in each stage, GULF\ training with $ T $ stages took more than $ T $ times longer than regular training. It is conceivable that training in each stage can be shortened without hurting performance since optimization should be easier as a results of aiming at a nearby goal. Schemes that decay the learning rate throughout the training without restarts or hybrid approaches might also be beneficial for reducing computation. Note that Theorem \ref{thm:L-conv} does not require each stage to be performed to the optimum. On the other hand, testing (i.e., making predictions) of the models trained with GULF\ only requires the same cost as regular models. As shown in the ImageNet experiments, a model trained with GULF\ could perform better than a much larger (and so slow-to-predict) model; in that case, GULF\ can save the overall computational cost since the cost for making predictions can be significant for practical purposes. \tightpara{Relation to other methods} The proposed method seeks to improve generalization performances in a principled way that limits the searched parameter space. The relation to existing methods for similar purposes is at least two-fold. First, we view that this work gives theoretical insight into related methods such as self-distillation and label smoothing, which we hope can be used to improve them. Second, methods derived from this framework can be used {\em with} existing techniques that are based on different principles (e.g., weight decay and dropout) for {\em further} improvements. \tightpara{Distillation} Due to the connection discussed above, our theoretical and empirical analyses of \oursL\ provide a new functional gradient view of distillation. Here we discuss a few self-distillation studies from this new viewpoint. \cite{Ban18} showed that iterative self-distillation improves performance over the base model. They set $\alpha$ to 0 (in our terminology) and reported that there were no performance gains on CIFAR10. According to our theory, when $\alpha$ goes to 0, the quantity reduced throughout the process is not the $\alpha$-regularized loss but merely $R(\theta)$. Such an extreme setting might be risky. In {\em deep mutual learning} \cite{deepMutual18}, multiple models are simultaneously trained by reducing loss and aligning each other's model output. They were surprised by the fact that `no prior powerful teacher' was necessary. This fact can be explained by our functional gradient view by relating their approach to our ini:random. Finally, the regularization effect of distillation has been noticed \cite{distill14}. Our framework formalized the notion through the functional gradient learning viewpoint. \subsection{Additional experiments on text data} We tested GULF\ on sentiment classification to predict whether reviews are positive or negative, using the polarized Yelp dataset (\#train: 560K, \#test: 38K) \cite{ZZL15}. The best-performing models on this task are transformers pre-trained with language modeling on large and general text data such as Bert \cite{bert19} and XLnet \cite{xlnet19}. However, these models are generally large and time-consuming to train using a GPU (i.e., without TPUs used in the original work). Therefore, instead, we used the deep pyramid convolutional neural network (DPCNN) \cite{dpcnn17} as our base model. In these experiments, we used \oursL. Table \ref{tab:text-results} shows the test error results in five settings. The last three use relatively small training sets of 45K data points and validation sets of 5K data points, randomly chosen from the original training set, while the first two use the entire training set (560K data points) except for 5K data points held out for validation (meta-parameter tuning). DPCNNs optionally take additional features produced by embeddings of text regions that are trained with unlabeled data, similar to language modeling. Cases 1 and 3 exploited this option, training embeddings using the entire training set as unlabeled data; \ref{apx:text-details} below provides the details. As in the image experiments, we used the cross entropy loss with softmax except for Case 5, where the quadratic hinge loss $L_y(f) = \max(0,1-yf)^2$ for $y \in \{-1,1\}$ was used. This serves as an example of extending self-distillation (formulated specifically with the cross-entropy loss) to general loss functions. In all the five settings, GULF\ achieves better test errors than the baseline methods, which shows the effectiveness of our approach in these settings. On this task, dropout turned out to be not very effective, which is, however, a reminder that the effectiveness of regularization methods can be data-dependent in general. \begin{table}[h] \vskip -0.1in \begin{center} \begin{small} \begin{tabular}{|c|l|c|c|c|c|} \multicolumn{2}{r}{Case\#} & \multicolumn{1}{c}{1} & \multicolumn{1}{c}{2} & \multicolumn{1}{c}{} \\ \hline \multicolumn{2}{|c|}{} &\multicolumn{2}{|c|}{LM-like prep?} & Runtime &Text for \\ % \cline{3-4} \multicolumn{2}{|c|}{} &\multicolumn{1}{|c|}{$~\;$Yes$~\;$}&\multicolumn{1}{|c|}{$~\;$No$~\;$} & (sec/K) &prep (GB)\\ % \hline (J \& Z, 2017)&DPCNN &{\em 2.64}&{\em 3.30}&$~$0.1 &0.4\\%& 10M \\ \hline \multirow{2}{*}{This work} &Table \ref{tab:text-results} best& 2.34 & 2.70 &$~$0.1 &0.4 \\%&10M \\ % &Ensemble &{\bf 2.18}&{\bf 2.46}&$~$0.9 &0.4 \\%& 10M \\ % \hline \multirow{2}{*}{\cite{bert19}} &Bert base & 2.25 & 6.19 &$~$5.7 &13 \\%& 110M \\ % &Bert large&{\em 1.89}& -- & 17.9 &13 \\%& 335M \\ % \hline \multirow{2}{*}{\cite{xlnet19}} &XLnet base& 1.92 & 4.51 & 17.2 &13 \\%& 117M \\ % &XLnet large&{\em 1.55}& -- & 40.5 &126 \\%& 361M \\ % \hline \end{tabular} \end{small} \end{center} \vskip -0.1in \caption{\label{tab:text-results2} GULF\ ensemble results on Yelp in comparison with previous models. Test error (\%) with or without embedding learning (DPCNN) or language modeling-based pre-training (Bert and XLnet), respectively, corresponding to Cases 1 \& 2 of Table \ref{tab:text-results}. Runtime: real time in seconds for labeling 1K instances using a single GPU with 11GB device memory, measured in the setting of Case 1; the average of 3 runs. The last column shows amounts of text data in giga bytes used for pre-training or embedding learning in Case 1. \\ The test errors in {\em italics} were copied from the respective publications except that the Bert-large test error is from \cite{XDHLL19}; other test errors and runtime were obtained by our experiments. Our ensemble test error results are in bold. } \end{table} It is known that performance can be improved by making an ensemble of models from different stages of self-distillation, e.g., \cite{Ban18}. In Table \ref{tab:text-results2}, we report ensemble performances of DPCNNs trained with GULF, in comparison with the previous best models. Test errors with and without embedding learning (or language modeling-based pre-training for Bert and XLnet) are shown, corresponding to Cases 1 and 2 in Table \ref{tab:text-results}. The ensemble results were obtained by adding after applying softmax the output values of 20 DPCNNs (or 10 in Case 2) of last 5 stages of GULF\ training with different training options; details are provided in \ref{apx:text-details}. With embedding learning, the ensemble of DPCNNs trained with GULF\ achieved test error 2.18\%, which slightly beats 2.25\% of pre-trained Bert-base, while testing (i.e., making predictions) of this ensemble is more than 6 times faster than Bert-base, as shown in the `Runtime' column. (Note, however, that runtime depends on implementation and hardware/software configurations.) That is, using GULF, we were able to obtain a classifier that is as accurate as and much faster than a pre-trained transformer. \cite{xlnet19} and \cite{XDHLL19} report 1.55\% and 1.89\% using a pre-trained large transformer, XLnet-large and Bert-large, respectively. We observe that the runtime and the amounts of text used for pre-training (the last two columns) indicate that their high accuracies come with steep cost at every step: pre-training, fine-tuning, and testing. Compared with them, an ensemble of GULF-trained DPCNNs is a much lighter-weight solution with an appreciable accuracy. Also, our ensemble without embedding learning outperforms Bert-base and XLnet-base without pre-training, with relatively large differences (Case 2). A few attempts of training Bert-large and XLnet-large from scratch also resulted in underperforming DPCNNs, but we omit the results as we found it infeasible to complete meta-parameter tuning in reasonable time. On the other hand, it is plausible that the accuracy of the high-performance pre-trained transformers can be further improved by applying GULF\ to their fine-tuning, which would further push the state of the art. Though currently precluded by our computational constraints, this may be worth investigating in the future. \subsubsection{Details of the text experiments} \label{apx:text-details} \paragraph{Embedding learning} It was shown in \cite{dpcnn17} that classification accuracy can be improved by training an embedding of small text regions (e.g., 3 consecutive words) for predicting neighboring text regions (`target regions') on unlabeled data (similar to language modeling) and then using the learned embedding function to produce additional features for the classifier. In this work, we trained the following two types of models with respect to use of embedding learning. \begin{itemize} \item Type-0 did not use any additional features from embedding learning. \item Type-1 used additional features from the following two types of embedding simultaneously: \begin{itemize} \item the embedding of 3-word regions as a function of a bag of words to a 250-dim vector, and \item the embedding of 5-word regions as a function of a bag of word \{1,2,3\}-grams to a 250-dim vector. \end{itemize} \end{itemize} Embedding training was done using the entire training set (560K reviews, 391MB) as unlabeled data disregarding the labels. It is worth mentioning that our implementation of embedding learning differs from the original DPCNN work \cite{dpcnn17}, as a result of pursuing an efficient implementation in pyTorch (the original implementation was in C++). The original work used the bag-of-word representation for target regions (to be predicted) and minimized squared error with negative sampling. In this work we minimized the log loss without sampling where the target probability was set by equally distributing the probability mass among the words in the target regions. \paragraph{Table \ref{tab:text-results}} Optimization was done by SGD. The learning rate scheduling of the base model and each stage of base-loop\ and GULF\ was fixed to 9 epochs with the initial learning rate $\eta$ followed by 1 epoch with 0.1$\eta$. The mini-batch size was 32 for small training data and 128 for large training data. We chose the weight decay parameter from \{1e-4, 2e-4, 5e-4, 1e-3\} and the initial learning rate from \{0.25, 0.1, 0.05\}, using the validation data, except that for GULF\ on the large training data, we simply used the values chosen for the base model, which were weight decay 1e-4 and learning rate 0.1 (with embedding learning) and 0.25 (without embedding learning). For GULF, we chose the number of stages $T$ from \{1,2,\ldots,25\} and $\alpha$ from \{0.3, 0.5\}, using the validation data. $\alpha=0.5$ was chosen in most cases. \paragraph{Table \ref{tab:text-results2}} The ensemble performances were obtained by combining \begin{itemize} \item 20 DPCNNs ( $T \in$ \{21, 22, \ldots, 25\} $\times$ \{ini:random, ini:base\} $\times$ \{Type-0, Type-1\} ) in Case 1, and \item 10 DPCNNs ( $T \in$ \{21, 22, \ldots, 25\} $\times$ \{ini:random, ini:base\} $\times$ \{Type-0\}) in Case 2. \end{itemize} To make an ensemble, the model output values were added after softmax. \paragraph{Transformers} The Bert and XLnet experiments were done using HuggingFace's Transformers\footnote{ {\tt https://huggingface.co/transformers/} } in pyTorch. Following the original work, optimization was done by Adam with linear decay of learning rate. For enabling and speeding up training using a GPU, we combined the techniques of gradient accumulation and variable-sized mini-batches (for improving parallelization) so that weights were updated after obtaining the gradients from approximately 128 data points. 128 was chosen, following the original work. To measure runtime of transformer testing, we used variable-sized mini-batches for speed-up by improving the parallelism on a GPU. \section{Introduction} \label{sec:intro} This paper presents a new framework to train nonconvex models such as neural networks. The goal is to learn a vector-valued function $\net{\theta}{x}$ that predicts an output $y$ from input $x$, where $\theta$ is the model parameter. For example, for $K$-class classification where $y \in \{1,2,\ldots,K\}$, $\net{\theta}{x}$ is $K$-dimensional, and it can be linked to conditional probabilities via the soft-max logistic function. Given a set of training data $S$, % the standard method for solving this problem is to use stochastic gradient descent (SGD) for finding a parameter that minimizes on $S$ % a loss function $L(\net{\theta}{x},y)$ with a regularization term $R(\theta)$: $ \min_\theta \left[ \frac{1}{|S|}\sum_{(x,y)\inS} L(\net{\theta}{x},y) + R(\theta) \right]. $ In this paper, we consider a new framework % that % {\em guides training through successive functional gradient descent} so that training proceeds with alternating the following: \begin{itemize}[itemsep=1pt,topsep=1pt] \item Generate a guide function so that it is ahead (but not too far ahead) of the current model with respect to the minimization of the loss. This is done by functional gradient descent. \item `Push' the model towards the guide function. \end{itemize} Our original motivation was functional gradient learning of additive models in {\em gradient boosting} \cite{frie:01}. In our framework, essentially, training proceeds with repeating a local search, which limits the searched parameter space to the functional neighborhood of the current parameter at each iteration, instead of searching the entire space at once as the standard method does. This is analogous to $\varepsilon$-boosting where the use of a very small step-size (for successively expanding the ensemble of weak functions) is known to achieve better generalization \cite{frie:01}. For measuring the distances between models, % we use the Bregman divergence (see e.g., \cite{convex15}) by applying it to the model output. Given a convex function $\Bref$, the Bregman divergence $\Bdiv$ is defined by \begin{equation} \Bdiv(u,v) = \Bref(u) - \Bref(v) - \nabla \Bref(v)^\top (u-v). \label{eq:bdiv} \end{equation} This is the difference between $\Bref(u)$ and the approximation of $\Bref(u)$ based on the first-order Taylor expansion around $v$. This means that when $u-v$ is small, \begin{equation} \Bdiv(u,v) \approx \frac{1}{2} (u-v)^\top(\hessian{\Bref(v)})(u-v) , \label{eq:bdivApprox} \end{equation} where $\hessian{h(v)}$ denotes the Hessian matrix of $h$ with respect to $v$. Therefore, use of the Bregman divergence has the beneficial effect of utilizing the second-order information. We show that the parameter update rule of an induced method generalizes that of {\em distillation} \cite{distill14}. That is, our framework subsumes iterative {\em self-distillation} as a special case. Distillation was originally proposed to {\em transfer knowledge} from a high-performance but cumbersome model to a more manageable model. Various forms of self-distillation, which applies distillation to the models of the same architecture, has been empirically studied \cite{xl19,generation19,LZG18,Ban18,onlinedistill18,deepMutual18,meanTeachers17,gift17}. One trend is to add to the original scheme, e.g., adding a term to the update rule, data distortion/division, more models for mutual learning, and so forth. However, we are not aware of any work on theoretical understanding such as a convergence analysis of the basic self-learning scheme. Our theoretical analysis of the proposed framework provides a new functional gradient view of self-distillation, and we show a version of the generalized self-distillation procedure converges to a stationary point of a regularized loss function. Our empirical study shows that the iterative training of the derived method goes through a `smooth path' in a restricted region with good generalization performance. This is in contrast to standard training, where the entire (and therefore much larger) parameter space is directly searched, and thus complexity may not be well controlled. \tightpara{Notation} $\nabla h(v)$ denotes the gradient of a scalar function $h$ with respect to $v$. We omit the subscript of $\nabla$ when the gradient is with respect to the first argument, e.g., we write $\nabla \net{\theta}{x}$ for $\nabla_\theta \net{\theta}{x}$. $\hessian{h(v)}$ denotes the Hessian matrix of a scalar function $h$ with respect to $v$. We use $x$ and $y$ for input data and output data, respectively. We use $<>$ to indicate the mean, e.g., $ \meanOverXsmall{S}{F(x,y)} = \frac{1}{|S|}\sum_{(x,y)\inS} F(x,y). $ $L(u,y)$ is a loss function with $y$ being the true output. We also let $L_y(u) = L(u,y)$ when convenient. \section{Conclusion} This paper introduces a new framework for guided learning of nonconvex models through successive functional gradient optimization. A convergence analysis is established for the proposed approach, and it is shown that our framework generalizes the popular self-distillation method. Since the guided learning approach learns nonconvex models in restricted search spaces, we obtain better generalization performance than standard training techniques. \section*{Acknowledgements} We thank Professor Cun-Hui Zhang for his support of this research.
\section{Introduction} Difference-in-Differences (DID) models present a series of challenges for inference. There is a large number of inference methods for DID, but the effectiveness of different solutions depend crucially on the set of assumptions one is willing to make on the errors, and on many features of the empirical design, such as the number of treated and control units.\footnote{A non-exhaustive list of papers that proposed and/or analyzed different inference methods in the DID settings include \cite{Arellano}, \cite{Bertrand04howmuch}, \cite{cameron2008bootstrap}, \cite{IZA}, \cite{CT}, \cite{Donald} \cite{FP}, \cite{Canay}, \cite{MW}, and \cite{ferman2019simple}. } We consider a common setting in which a satisfactory solution is not yet available, when (i) there is a small number of treated units, (ii) the number of periods is fixed, and (iii) errors are possibly spatially correlated, but there is no available distance metric across units. Throughout, we refer to ``spatial correlation'' as any correlation in the cross section, not necessarily related to a geographical distance metric. Importantly, as we explain in detail below, our findings are relevant even for settings in which the number of treated units has been considered as large enough to rely on inference methods based on asymptotic approximations with a large number of both treated and control units. We first derive conditions in which the inference methods proposed by \cite{CT} (henceforth, CT) and \cite{FP} (henceforth, FP) remain asymptotically valid in the presence of spatial correlation when there is a single treated and many control units. The main assumptions are that (i) the post-pre difference in average errors for each unit has the same marginal distribution for all units --- we can relax this assumption by allowing for heteroskedasticity depending on observed covariates, as considered by FP ---, and (ii) the cross-section distribution of this post-pre difference in average errors is strongly mixing for the control units. Under these conditions, the asymptotic distribution of the DID estimator depends only on the post-pre difference in average errors of the treated unit (as originally shown by CT), and the residuals of the control units asymptotically recover the distribution of the errors of the treated unit even when there is spatial correlation (in contrast, both CT and FP assume independence across units for this result).\footnote{{CT} have in their appendix an example model that allows spatial dependence. However, their model requires an observed distance metric across units, and correct specification of the spatial correlation structure. We consider instead a setting in which such distance metric is not available, as is common in DID applications.} While a standard permutation test, as proposed by \cite{fisher}, would be valid under any structure on the potential outcomes \emph{if treatment is randomly assigned}, our result does not require random assignment. In particular, we find conditions in which the inference method proposed by FP is valid even when a standard permutation test would not be valid. However, when there is more than one treated unit, the inference methods proposed by CT and FP will not be asymptotically valid if there is spatial correlation. The intuition is the following: when we (mistakenly) assume errors are independent across clusters, we underestimate the volatility of the average of the errors for the treated units. We propose an alternative inference method that is asymptotically valid, though generally conservative in this setting. We also show that in common settings in which the outcome variable is the aggregate of unit $\times$ time individual-level observations, it is possible to leverage on such structure to derive an asymptotically valid test that is more powerful. While the methods proposed by CT and FP have been usually considered as good alternatives when the number of treated units is very small, our conservative tests may provide an interesting alternative even for settings in which applied researchers have been confidently using alternatives such as the cluster-robust variance estimator (CRVE). The rationale is the following: if we assume errors are independent across groups, then there is a trade-off between relying on CRVE relative to CT and FP. While CRVE relies on weaker assumptions on the errors, it relies on an asymptotic theory that depends on a large number of both treated and control units. With, say, 20 or more treated units, such asymptotic approximation required by CRVE is generally considered good enough so that the benefits of relying on weaker assumptions dominate.\footnote{\cite{ferman2019simple} proposes an assessment that can be used to evaluate such trade offs.} However, when we allow for spatial correlation (and considering the case with more than one treated unit), all of those methods will generally be invalid. In contrast, the inference methods we propose are robust to spatial correlation, even in settings in which a distance metric is not available. We analyze a Monte Carlo simulation based on the spatial correlation structure of the American Community Survey. Finally, we revisit the work by \cite{Sommers} and \cite{Kaestner}, who analyzed the effects of the Massachusetts 2006 health reform, in light of our results. This empirical application highlights some common misunderstandings in the use of randomization inference in DID applications, and illustrates how our results can be used to provide proper inference in this and other more complex settings. \section{Setting} Let $Y_{it}(0)$ ($Y_{it}(1)$) be the potential outcome of unit $i$ at time $t$ when this unit is untreated (treated) at this period. We consider that potential outcomes are given by \begin{eqnarray} \label{simple_did_equation} \begin{cases} Y_{it}(0) = \theta_i + \gamma_t + \eta_{it} \\ Y_{it}(1) = \alpha_{it} +Y_{it}(0), \end{cases} \end{eqnarray} where $\alpha_{it}$ is the (possibly heterogeneous) treatment effects for unit $i$ at time $t$, $\theta_i$ are time-invariant unobserved effects, and $\gamma_t$ are group-invariant unobserved effects. The error term $\eta_{it}$ represents unobserved determinants of $Y_{it}(0)$ that are not captured by the fixed effects. This structure for the potential outcomes, together with Assumption \ref{As_W}(i) below, is similar to assuming parallel trends for all periods. We can extend our results to consider alternative parallel trends assumptions \citep{Marcus} and alternative estimators. This implies a DID model \begin{eqnarray} \label{baseline} Y_{it} = \alpha d_{it} + \theta_i + \gamma_t + (\alpha_{it} - \alpha)d_{it}+ \eta_{it}, \end{eqnarray} where $Y_{it}$ is the observed outcome variable for unit $i$ at time $t$, $d_{it}$ is an indicator variable equal to one if unit $i$ is treated at time $t$, and zero otherwise. We focus on the case in which $d_{it}$ changes to 1 for all treated units starting after date $t^\ast$ (see Remark \ref{staggering} for the case with variation in adoption time). Therefore, we can let $D_i$ be an indicator variable equal to one if unit $i$ is treated. There are $N_1$ treated units, $N_0$ control units, and $T$ time periods. Let $\mathcal{I}_1$ ($\mathcal{I}_0$) be the set of indices for treated (control) units, while $\mathcal{T}_1$ ($\mathcal{T}_0$) be the set of indices for post- (pre-) treatment periods. In this case, we define $\alpha = \frac{1}{N_1} \frac{1}{T_1} \sum_{i \in \mathcal{I}_1}\sum_{t \in \mathcal{T}_1} \alpha_{it}$, where $\{ \alpha_{i1},...,\alpha_{iT} \}_{i \in \mathcal{I}_1}$ are fixed parameters.\footnote{CT and FP consider a setting with homogeneous treatment effects, so not only they consider $\{ \alpha_{i1},...,\alpha_{iT} \}_{i \in \mathcal{I}_1}$ as fixed, but also that $\alpha_{it} =\alpha$ for all $i$ and $t$ in their settings. Therefore, we consider a more general setting than the settings considered by CT and FP. Since we consider a setting with $N_1$ fixed, it would not be possible to assess the distribution of $\alpha_{it}$, if we considered this term as stochastic. Therefore, it would not be possible to provide valid inference if we consider $\alpha_{it}$ as stochastic and define the estimand as its expected value. } Following FP, for a generic variable $A_t$, define $\nabla A = \frac{1}{T-t^\ast} \sum_{t \in \mathcal{T}_1} A_{t} - \frac{1}{t^\ast} \sum_{t \in \mathcal{T}_0} A_{t}$. In particular, we consider $W_i = \nabla \eta_{it}$, which is the post-pre difference in average errors for each unit $i$. In this case in which treatment starts at the same period for all treated units, the DID estimator is numerically equivalent to the two-way fixed effects (TWFE) estimator of $\alpha$, which is given by \begin{eqnarray} \label{alpha} \widehat \alpha &=& \frac{1}{N_1} \sum_{i \in \mathcal{I}_1} \nabla Y_{i} - \frac{1}{N_0} \sum_{t \in \mathcal{I}_0} \nabla Y_{i}= \alpha + \frac{1}{N_1} \sum_{i \in \mathcal{I}_1} W_i - \frac{1}{N_0} \sum_{i \in \mathcal{I}_0} W_i. \end{eqnarray} Our results are also relevant and can be extended for alternative estimators.\footnote{For example, we can consider the first differences estimator, or the estimators proposed by \cite{chaisemartin2018twoway} and \cite{Pedro}.} We consider a repeated sampling framework over the distribution of $\{ W_i\}_{i \in \mathcal{I}_0 \cup \mathcal{I}_1 }$, in which treatment assignment is pre-determined (alternatively, we can consider that the analysis is conditional on the vector of treatment assignment). For simplicity, we consider first the homoskedastic case, as analyzed by CT, and we do not include covariates in model (\ref{baseline}). In Appendix \ref{Appendix_extensions} we allow for heteroskedasticity based on a set of covariates $Z_i$, as considered by FP, and for a set of covariates $X_{it}$ in model (\ref{baseline}). In this simpler case, we impose the following assumptions on the distributions of $W_i$. \begin{ass}{(distribution of $W_i$)} \label{As_W} \normalfont (i) $ \mathbb{E} \left[ W_i \right] =0$ for $i \in \mathcal{I}_1$ and for $i \in \mathcal{I}_0$, (ii) $W_i$ has the same marginal distribution for all $i \in \mathcal{I}_1 \cup \mathcal{I}_0$, with finite second moment and continuous distribution, and (iii) $\{W_i\}_{i \in \mathcal{I}_0}$ is such that $\frac{1}{N_0} \sum_{i \in \mathcal{I}_0} W_i \buildrel p \over \rightarrow 0 $ and $\frac{1}{N_0} \sum_{i \in \mathcal{I}_0} \mathbbm{1} \left\{ W_i \leq c \right\} \buildrel p \over \rightarrow F(c) $ when $N_0 \rightarrow \infty$, where $\mathbbm{1} \left\{ . \right\}$ is an indicator function and $F(c)$ is the cdf of $W_i$. \end{ass} Assumption \ref{As_W}(i) is a standard DID identification assumption. Assumption \ref{As_W}(ii) restricts the marginal distribution of the treated and control units to be the same. This is essentially an homoskedasticity assumption, as considered by CT. Importantly, we can relax this assumption to allow for heteroskedasticity based on a set of covariates $Z_i$ (see Appendix \ref{Appendix_extensions}). Finally, Assumption \ref{As_W}(iii) allows for spatially correlated shocks, but restricts such dependence so that we can apply a law of large numbers when we consider the control units. This will be satisfied, for example, if we assume strong mixing conditions in the cross section (see Theorem 3 from \cite{JENISH200986}). For simplicity, we refer in the text to Assumption \ref{As_W}(iii) as a strong mixing condition, even though strong mixing is not a necessary condition for this assumption. Importantly, Assumption \ref{As_W} allows for unrestricted spatial correlation among the treated units. Since we focus on settings in which the researcher does not have information on what generates the spatial correlation or he/she is not willing to assume such structure, we do not need to model in detail the sources of spatial correlation. As a concrete example, we can considered a setting in which the $N_1$ treated units are closely located geographically, but we have a larger number of control units in different locations. In this case, if spatial correlation goes to zero when geographical distance increases, then we would have Assumption \ref{As_W}(iii) satisfied, even though we may have arbitrarily strong spatial correlation among the $N_1$ treated units. The spatial correlation may also arise from other mechanisms not related to geographical distance (for example, units with similar industry shares may have more correlated errors). See also Appendix A2 from \cite{ferman2019inference} for an example of a spatial correlation model in a DID setting that would satisfy this strong mixing condition. Importantly, we consider a setting in which the applied researcher may be unaware or may not have information on the relevant distance metrics in the cross section, which is common in DID applications. Moreover, while we consider a setting in which the treatment allocation is fixed, we can think about an underlying model in which treatment assignment and errors are stochastic, and units that experience correlated shocks are more likely to receive the same treatment status. In this case, once we condition on the treatment allocation, we would have a setting in which the errors of the treated units are correlated. From Proposition 1 from CT, it follows from equation (\ref{alpha}) that the limiting distribution of $\widehat \alpha$ when $N_1$ is fixed and $N_0 \rightarrow \infty$ is given by $\widehat \alpha \buildrel p \over \rightarrow \alpha + \widetilde{W}$, where $\widetilde{W} \equiv {N_1}^{-1} \sum_{i \in \mathcal{I}_1} W_i$. The intuition is that, given the strong mixing condition (Assumption \ref{As_W}(iii)), the average of the control errors converges in probability to zero as $N_0 \rightarrow \infty$. However, since the number of treated units remain fixed, the distribution of $\widehat \alpha$ will still depend on the errors of the treated units even asymptotically. In this case, the estimator is unbiased, but not consistent. \section{Inference with spatially correlated shocks} \label{inference} CT propose an interesting inference method in this setting by noting that the residuals $\widehat W_i$ of the control units may be informative about the distribution of $W_i$ and, therefore, about the distribution of $\widehat \alpha$. The main idea is to estimate the distribution of $W_i$ using the empirical distribution of $\{\widehat W_i \}_{i \in \mathcal{I}_0}$. Intuitively, this works because, as $N_0 \rightarrow \infty$, $\widehat W_i \buildrel p \over \rightarrow W_i$ for $i \in \mathcal{I}_0$. Therefore, hypothesis tests and confidence intervals can be constructed based on the empirical distribution of $\{\widehat W_i \}_{i \in \mathcal{I}_0}$. They show validity of this inference method when $W_i$ is iid (Assumption 2 in CT).\footnote{CT have in their appendix an example model that allows spatial dependence. However, their model requires an observed distance metric across units, and correct specification of the spatial correlation structure. We consider instead a setting in which such distance metric is not available, as is common in DID applications. } It is easy to understand the importance of this independence assumption when $N_1>1$. Consider a simple case in which $N_1=2$, and $\{W_1,W_2\}$ is multivariate normally distributed with correlation $\rho$. In this case, $\widehat \alpha \buildrel p \over \rightarrow \alpha + \widetilde{W}$, where the variance of $\widetilde{W}$ is given by $2^{-1} (1 + \rho) var(W_i)$. However, given Assumption \ref{As_W}(iii), if we consider two random draws from $\{\widehat W_i \}_{i \in \mathcal{I}_0}$ to recover the distribution of $\widetilde{W}$, the correlation between these draws would converge to zero when $N_0 \rightarrow \infty$. As a consequence, the approach proposed by CT would recover a distribution for $\widetilde{W}$ that has a variance given by $2^{-1} var(W_i)$. Therefore, the variance of $\widehat \alpha$ would be underestimated if $\rho>0$, leading to over-rejection. The same problem applies for the inference method proposed by FP. When $N_1=1$, however, we show that the inference methods proposed by CT and FP can remain valid even if we allow for spatial correlation. The main intuition is that, under Assumption \ref{As_W}, the asymptotic distribution of $\widehat \alpha$ depends only on $W_1$, and the distribution of $W_1$ is still asymptotically approximated by the empirical distribution of $\{\widehat W_i \}_{i \in \mathcal{I}_0}$, even when errors are spatially correlated. Of course, the strong mixing condition is crucial for this argument. To formalize that, let $\widehat F (c) = {N_0}^{-1} \sum_{i \in \mathcal{I}_0} \mathbbm{1} \left\{ \widehat W_i \leq c \right\}$. \begin{prop} \label{Prop_N1} Under Assumption \ref{As_W}, as $N_0 \rightarrow \infty$, $\widehat F (c)$ converges in probability to $F(c)$ uniformly on any compact subset of the support of $W$. \end{prop} The proof is similar to the proof of Proposition 2 from CT, but allowing for spatial correlation. We present details in Appendix \ref{Proof_N1}. It immediately follows that the inference method proposed by CT remains valid for the case with $N_1=1$, even when we may have spatial correlation. \begin{cor} \label{Cor_N1} Consider the problem of testing the null hypothesis $H_0: \alpha =\alpha_0$, for some $\alpha_0 \in \mathbb{R}$. Under Assumption \ref{As_W}, if $N_1=1$, then the inference method proposed by CT is asymptotically valid when $N_0 \rightarrow \infty$. \end{cor} We show in Appendix \ref{Appendix_extensions} that these results remain valid when we include covariates in model (\ref{baseline}). We also show in Appendix \ref{Appendix_extensions} that the inference method proposed by FP remains asymptotically valid, in this setting with $N_1=1$ and spatial correlation, when we relax the assumption that $W_i$ has the same marginal distribution for all $i$. Therefore, we also have results that are valid when errors are heteroskedastic. {While a standard permutation test, as proposed by \cite{fisher}, would be valid under any structure on the potential outcomes \emph{if treatment is randomly assigned}, note that Assumptions \ref{As_W} and \ref{As_W_appendix} do not require random assignment. For example, Assumption \ref{As_W_appendix} allows for a setting in which the error of the treated unit has larger variance than the error of the control units. In this case, we show that FP would be valid, while a standard permutation test would lead to over-rejection. As explained above, however, the inference methods proposed by CT and FP would not be valid when $N_1>1$ and errors are spatially correlated. Given this potential problem, we consider the case in which the errors of all treated units are perfectly correlated as a worst-case scenario to provide an asymptotically valid, though conservative, inference method in this setting. More specifically, from Proposition \ref{Prop_N1}, $\widehat F(c)$ asymptotically recovers the distribution of $W_i$ even when we allow for spatial correlation. Given that, instead of considering independent draws from this distribution to put in place of the treated units, we sample only one $\widehat W_i$ and place it for all treated units, which would asymptotically recover the distribution of $\widehat \alpha$ if $\{W_i\}_{i \in \mathcal{I}_1}$ were perfectly correlated. When treated units are not perfectly correlated, though, we would recover a distribution for $\widehat \alpha$ that has a \emph{higher} variance relative to the true distribution of $\widehat \alpha$. To formalize this idea, we consider the following high-level assumption. \begin{ass}{(regularity condition)} \label{As_reg} \normalfont For any $\tau \in (0,1)$, let $c_{\tau}$ be the $\tau-$quantile of $W_i$, and define $\widetilde{W} = N_1^{-1} \sum_{i \in \mathcal{I}_1}W_i$. Then $\tilde p \equiv Pr\left( \{ \widetilde W \leq c_{\tau/2} \} \cup \{ \widetilde W > c_{1-\tau/2} \} \right) \leq \tau $. \end{ass} What Assumption \ref{As_reg} states is that, regardless of the spatial correlation among the treated units, the probability of having extreme values for the average of the treated units, $\widetilde W$, is weakly smaller than the probability of having extreme values for a single draw of $W_i$. While we can guarantee that $var(\widetilde W) \leq var(W_i)$ irrespectively of the spatial correlation among the treated units, this is not sufficient to guarantee Assumption \ref{As_reg} for a general distribution of $W_i$. Still, Assumption \ref{As_reg} is intuitively plausible, and it is satisfied when $\{W_i\}_{i \in \mathcal{I}_1}$ is multivariate normal. In this case, $\widetilde W$ will also be normal, and the fact that $var(\widetilde W) \leq var(W_i)$ guarantees that Assumption \ref{As_reg} holds. This is valid regardless of how strong the spatial correlation is. This assumption can also be justified in settings in which $Y_{it}$ represents the aggregate of individual-level observations in unit $i$ and time $t$, and we can apply a central limit theorem to these averages. In this case, $\{W_i\}_{i \in \mathcal{I}_1}$ would be approximately multivariate normal. To provide more intuition on this assumption, we present in Appendix \ref{Appendix_reg} an example in which this assumption may not hold. To engineer such example, we had to consider a distribution of $W_i$ that is bimodal, and such that the two peaks are very far apart, which is not something we should expect in common empirical applications. In this example, when the two peaks are not very far apart, then Assumption \ref{As_reg} would still hold. \begin{prop} \label{Prop_conservative} Consider testing the null hypothesis $H_0: \alpha = \alpha_0$ with a significance level $\tau$ by contrasting $\widehat \alpha - \alpha_0$ with the $\tau/2$ and $1-\tau/2$ quantiles of $\widehat F(c)$. Under Assumptions \ref{As_W} and \ref{As_reg}, as $N_0 \rightarrow \infty$, this test is asymptotically level $\tau$ for any $\tau \in (0,1)$. \end{prop} This result follows directly from Proposition \ref{Prop_N1} and Assumption \ref{As_reg}. Therefore, this conservative test provides a viable alternative in settings where $N_1 << N_0$ that is robust to strongly mixing spatial correlation. While we guarantee that this modified test does not over-reject (asymptotically), it will generally be conservative when $N_1 > 1$, unless the errors of treated units are perfectly correlated. In Appendix \ref{Appendix_extensions}, we extend the result from Proposition \ref{Prop_conservative} for settings in which we have heteroskedasticity, as considered by FP. Therefore, a valid test is possible even when we relax the assumption that $W_i$ has the same marginal distribution for all $i$. We also allow for covariates in model (\ref{baseline}). This conservative test may be an interesting alternative even when $N_1$ is such that applied researchers would usually rely on large $N_1$/large $N_0$ methods, such as CRVE. Once we relax the assumption that clusters are independent, CRVE would generally be invalid even when $N_1$ is reasonably large \citep{ferman2019inference}. In contrast, the method we propose remains valid when we have a strongly mixing spatial correlation. Of course, the cost of being robust to spatial correlation is that the conservative test will generally have lower power. If a distance metric is available and the researcher is willing to assume such distance metric is the relevant one for the spatial correlation, then other available alternatives might present better power (for example, the inference method proposed in the appendix of CT). In this case, there would be a trade-off between a test that is more powerful but requires correct specification of the spatial correlation, versus a test that is less powerful, but does not require correct specification of the spatial correlation. We also recall that the test we propose does not require observation of a distance metric in the cross section. In Section \ref{Conservative2} we consider an alternative test that will generally be more powerful in common DID applications relative to the test presented in this section, without relying on knowledge of the spatial correlation structure. \begin{rem} \normalfont The assumption that $W_i$ is strongly mixing would not be satisfied if there are unobserved shocks that affect all treated units differently from the control units. In this case, the DID residuals $\widehat W_i$ would not capture these group-specific shocks, and $\widehat F(c)$ would underestimate the dispersion of the marginal distribution of $W_i$. As a consequence, even the conservative test may over-reject. Importantly, however, the over-rejection of the conservative test in this case would be no larger than the over-rejection of CT (or FP). In contrast, this mixing assumption may be reasonable when units closer in some distance metric have more correlated errors, but such correlation goes to zero when this distance increases. Such distance metric does not need to coincide with geographical distance (for example, we may have that units with similar industry shares have more correlated errors), and we do not even need to have information on the relevant distance metrics. \end{rem} \begin{rem} \normalfont \label{staggering} Constructing a conservative test becomes substantially more complicated if treated units start treatment at different periods, as we discuss in Appendix \ref{Appendix_staggered}. \end{rem} \begin{rem} \normalfont Since CT and FP are valid when $N_1=1$ (Corollaries \ref{Cor_N1} and \ref{Cor_Appendix}), an alternative for the case with $N_1>1$ is to consider $N_1$ separate DID regressions --- one for each treated unit ---, and adjust the inference for multiple testing \citep{Romano2005}. In this case, however, we would be considering $N_1$ different hypotheses related to $\alpha_i = \frac{1}{T_1}\sum_{t \in \mathcal{T}_1} \alpha_{it}$ for $i \in \mathcal{I}_1$. In contrast, the inference methods we propose in Sections \ref{inference} and \ref{Conservative2} are valid for a single hypothesis related to the aggregate parameter $\alpha = \frac{1}{N_1} \frac{1}{T_1} \sum_{i \in \mathcal{I}_1}\sum_{t \in \mathcal{T}_1} \alpha_{it}$. \end{rem} \section{A less conservative test} \label{Conservative2} While the conservative test presented in Section \ref{inference} is valid even when we have strongly mixing spatial correlation, such test may be too conservative, implying low power. We now show that it is possible to construct a test that is asymptotically valid and less conservative in common settings in which $Y_{it}$ represents averages of individual-level observations in unit $i$ and time $t$. We can consider either the case in which we observe only the aggregates $Y_{it}$ or the individual-level data. This is the leading example considered by FP, where they show that variation in unit sizes generally generate heteroskedastiticy in $W_i$. More specifically, let $M_{it}$ be the number of observations used to construct the aggregate observations for unit $i$ at time $t$. For simplicity, assume that $M_{it} = M_i$ for all $t$. FP show that, under a wide range of structures for the within-unit correlation of the individual-level errors, the variance of $W_i$ conditional on $M_i$ is given by $var(W_i | M_i) = A + B{M_i}^{-1}$ for constants $A,B \geq 0$. The main idea of FP is that we can use the residuals from the control units to first estimate the parameters $A$ and $B$. Then, we can use $\hat A$ and $\hat B$ to re-scale the residuals from the control units, so that they become informative about the distribution of the errors of the treated units. More specifically, instead of considering the empirical distribution of $\{\widehat W_j\}_{j \in \mathcal{I}_0}$ to approximate the distribution of $W_i$ for a treated unit $i \in \mathcal{I}_1$, FP consider the empirical distribution of $\{\widehat W_j \times {(\hat A + \hat B M_i^{-1})^{1/2}/(\hat A + \hat B M_j^{-1})^{1/2}} \}_{j \in \mathcal{I}_0}$. FP provide conditions in which this re-scaled empirical distribution asymptotically recovers the distribution of a treated unit $W_i$ with $M_i$ observations. The problem, however, is that FP consider the case in which $W_i$ is independent across units, so their procedure would not be valid if we consider a setting with spatial correlation, following the same rationale as the one presented in Section \ref{inference}. Consider a simple setting with $N_1=2$, where the aggregate data of the treated units are constructed from $M_1$ and $M_2$ individual-level observations per period, and consider a TWFE estimator using $M_i$ as sampling weights. This would lead to the same estimator as if we used the individual-level data. Note that assuming that both treated units start treatment after $t^\ast$, and given the assumption that $M_{it} = M_i$, the estimand of the TWFE will be a well-defined weighted average of the (average across time) treatment effects of units 1 and 2. In this case, a naive version of the inference method proposed by FP ignoring spatial correlation would assume that $W_1$ and $W_2$ are independent, implying that it would asymptotically recover a distribution for $\widehat \alpha$ with variance equal to \begin{eqnarray} \sigma^2_{\mbox{\tiny naive}} = \left( \frac{M_1}{M_1+M_2} \right)^2 \left[ A + B{M_1}^{-1} \right] + \left( \frac{M_2}{M_1+M_2} \right)^2 \left[ A + B{M_2}^{-1} \right]. \end{eqnarray} As we discussed in Section \ref{inference}, this would generally lead to over-rejection if the treated units are spatially correlated. We can consider instead the conservative method proposed in Appendix \ref{Appendix_extensions}, which is an extension of the method proposed in Section \ref{inference}. We refer to this test as ``conservative test 1.'' Asymptotically, this test recovers a distribution with variance \begin{eqnarray} \sigma^2_{\mbox{\tiny cons1}} = \left[ \left( \frac{M_1}{M_1+M_2} \right)\left( A + B{M_1}^{-1} \right)^{\frac{1}{2}} + \left( \frac{M_2}{M_1+M_2} \right) \left( A + B{M_2}^{-1} \right)^{\frac{1}{2}} \right]^2. \end{eqnarray} It is clear that $\sigma^2_{\mbox{\tiny cons1}} \geq \sigma^2_{\mbox{\tiny naive}}$. Under the assumptions considered in Appendix \ref{Appendix_extensions}, this would lead to a valid, but generally conservative test. An alternative approach in this particular setting would be to consider that we have only one treated unit with $M_1 + M_2$ observations. In this case, we would asymptotically recover a distribution with variance equal to \begin{eqnarray} \sigma^2_{\mbox{\tiny cons2}} = A + B\left({M_1+M_2}\right)^{-1} . \end{eqnarray} We have that $\sigma^2_{\mbox{\tiny cons1}} \geq \sigma^2_{\mbox{\tiny cons2}} \geq \sigma^2_{\mbox{\tiny naive}}$. The main question is whether $\sigma^2_{\mbox{\tiny cons2}}$ is conservative for the true variance of $\widetilde W = \frac{M_1}{M_1+M_2} W_1 +\frac{M_2}{M_1+M_2} W_2$. This will be the case if two individuals in the same unit are more correlated than two individuals in different treated units, which is a plausible assumption. Intuitively, this approach would consider a scenario for the spatial correlation between individual-level observations of two different units by assuming they have the same spatial correlation as if we considered two individual-level observations in the same unit. Assuming individuals in the same unit are weakly more spatially correlated than individuals in different units, this would be a worst-case scenario for the spatial correlation, which would be much less stringent than the one considered in the conservative test 1. Importantly, we do not need individual-level data for this approach. We only need information on the number of observations used to construct the unit $\times$ time aggregates. We refer to this test as ``conservative test 2'', and we formalize this idea in Appendix \ref{Appendix_cons2}. Note that, if $A=0$, then $\sigma^2_{\mbox{\tiny cons2}} = \sigma^2_{\mbox{\tiny naive}}$. Therefore, in a setting in which there is no spatial correlation (whether we consider two individual-level observations in the same unit or in different units), then the conservative test 2 would be asymptotically equivalent to FP. There would not be a loss in power in this case. In contrast, the conservative test 1 would have lower power relative to FP even in this setting. When $M_{it}$ is constant across $t$, we can implement the inference method above by generating a single treated unit that is a weighted average of the $N_1$ treated units, $\widetilde{y}_{t} = \sum_{i \in \mathcal{I}_1}\frac{M_i}{\sum_{i' \in \mathcal{I}_1} M_{i'}}y_{it}$, with a number of observations $\widetilde{M} = \sum_{i \in \mathcal{I}_1}M_i$. In this case, the DID estimator of $\widehat{\alpha}$ using this collapsed treated unit with $\widetilde M$ and $\{M_i\}_{i \in \mathcal{I}_0}$ as weights is numerically the same as the one using the original data with $\{M_i\}_{i \in \mathcal{I}_0 \cup \mathcal{I}_1}$ as weights. Then we can apply FP for this DID model with a single treated unit. We also consider the case in which $M_{it}$ varies across $t$ in Appendix \ref{Appendix_cons2} \section{Simulations with Real Datasets} \label{simulations} We analyze the spatial correlation problem, and the proposed conservative tests, in simulations based on the American Community Survey (ACS) \citep{ipums}. We restrict the sample to women between the ages 25 and 50, and consider log wages as outcome variable. We construct a DGP with variance/covariance matrix estimated from this data. More specifically, with data from 2015 to 2018, we estimate the residuals $\widehat W_i$ at the PUMA level, considering a setting in which that treatment starts after 2016.\footnote{We compute the residuals from a PUMA $\times$ year regression using PUMA and time fixed effects, and then calculate $\widehat W_i = (\hat e_{i,2018} + \hat e_{i,2017})/2 - (\hat e_{i,2016} + \hat e_{i,2015})/2$.} Given $\widehat W_i$ for all PUMAs, we estimate a model for the spatial correlation in which the covariance between two PUMAs may depend on their distance, on whether they belong to the same state, and on their population sizes (details in Appendix \ref{Appendix_MC}). If we consider all pairs of PUMAs, the correlation between their errors in this estimated model is greater than $0.05$ in only $0.42\%$ of the cases. Therefore, the strong mixing condition we consider seems reasonable in this setting. Still, we have PUMAs with spatial correlation as strong as $0.30$. Therefore, we may have a setting in which the $N_1$ treated PUMAs exhibit strong spatial correlation. In line with our theoretical model, we consider first a setting in which we fix one PUMA as the treated one, and generate multivariate normal draws of $W_i$ with this estimated spatial dependence. For the results presented in Table \ref{Table_MC}, we selected a treated PUMA that has a strong spatial correlation with some other PUMAs. In Appendix \ref{Appendix_MC} we discuss how our results vary when we consider alternative treated PUMAs. When we consider the test proposed by FP, we find a rejection rate of approximately $5\%$ when we consider a $5\%-$level test when the null is true, despite the fact that PUMAs are spatially correlated (Panel A of Table \ref{Table_MC}). This is consistent with Corollary \ref{Cor_N1}. Note also that the treated PUMA is fixed and has a heterogeneous variance, so our setting is not consistent with random assignment of the treatment. \begin{table}[h!] \begin{center} \caption{{\bf MC simulations}} \label{Table_MC} \begin{tabular}{lccc} \hline \hline & Original FP & Conservative 1 & Conservative 2 \\ & (1) & (2) & (3) \\ \hline \multicolumn{4}{c}{\textit{Panel A: $N_1=1$} } \\ $\alpha=0$ & 0.054 & - & - \\ \\ $\alpha=0.1 \sigma$ & 0.434 & - & - \\ \\ $\alpha=0.15 \sigma$ & 0.759 & - & - \\ \\ \multicolumn{4}{c}{\textit{Panel B: $N_1=5$} } \\ $\alpha=0$ & 0.170 & 0.003 & 0.027 \\ \\ $\alpha=0.1 \sigma$ & 0.933 & 0.440 & 0.700 \\ \\ $\alpha=0.15 \sigma$ & 0.999 & 0.898 & 0.970 \\ \hline \end{tabular} \end{center} {\small{ Notes: This table presents rejection rates for 5\% tests using the FP inference method (column 1), the conservative test presented in Section \ref{inference} (column 2), and the conservative test presented in Section \ref{Conservative2} (column 3). Details of the simulations are presented in Appendix \ref{Appendix_MC}. In Panel A, we present results when there is a single treated unit, while in Panel B we consider the case in which there are five treated units. The true treatment effect $\alpha$ is based on the standard deviation of log wages in the individual-level data from 2018. }} \end{table} We then consider a setting in which four other PUMAs that are spatially correlated with the originally treated PUMA are also treated (so $N_1=5$). In this case, the test proposed by FP leads to relevant over rejection when the null is true ($\approx 17\%$), which is consistent with the conclusions from Section \ref{inference} (Panel B of Table \ref{Table_MC}). The two alternative tests, in contrast, control for size, although they are conservative (with rejection rates of $0.5\%$ and $2.7\%$). As expected from the discussion in Section \ref{Conservative2}, the conservative test 2 is less conservative than the conservative test 1. Moreover, the conservative test 2 is more powerful than the conservative test 1, although both tests present large power when the treatment effect is large. Overall, these simulations highlight the main messages of the paper. First, that the inference methods proposed by CT and FP remain valid when we have a single treated unit, even when errors are spatially correlated. Second, that the proposed conservative tests control well for size. Finally, these simulations also highlight that it is possible to explore the structure of common empirical applications in which units are aggregates of individual-level observations to construct a more powerful test (even if we do not have information on the individual-level observations). This is important, because we inherently have to accept a loss in power so that we can be robust to spatial correlation when $N_1>1$. Of course, if we have information on the relevant distance metrics in the cross section, then it would be possible to correct for spatial correlation with a more powerful test. Still, these simulations illustrate that it is possible to construct valid tests even when such information is unavailable or the researcher is not willing to impose a structure on the spatial correlation. \section{Empirical Illustration} \label{illustration} We illustrate our findings analyzing the effects of the Massachusetts 2006 health care reform. This reform was analyzed by \cite{Sommers} using a DID design comparing 14 Massachusetts counties with 513 control counties that were selected based on a propensity score to be more similar with the treated counties.\footnote{The propensity score used age distribution, sex, race/ethnicity, poverty rate, median income, unemployment, uninsured rate, and baseline annual mortality as predictors. We take this first selection step as given in our analysis. We find similar results if we consider a DID regression using all counties, so that there is no pre-selection of control counties. } \cite{Sommers} find a reduction of 2.9\%-4.2\% in mortality in Massachusetts relative to the controls after the reform (depending on whether covariates are included). \cite{Sommers} reported standard errors clustered at the state level, and also considered standard errors clustered at the county level in their online appendix. Given the recent findings that clustered standard errors may perform badly when there are few treated clusters, \cite{Kaestner} re-analyzed the findings from \cite{Sommers} using randomization inference techniques, which is essentially the same as the inference method proposed by CT. He found substantially larger p-values, ranging from 0.22 to 0.78, concluding that there is no evidence that the reform caused significant reductions in mortality. \cite{Kaestner} considered both randomization inference at the county and at the state levels. Overall, standard errors clustered at the state level can indeed lead to large distortions when there is only one treated state, while standard errors clustered at the county level could lead to distortions due to spatial correlation (see \cite{ferman2019inference} for a thorough discussion on that). In contrast, a permutation test in the DID setting is essentially the same as the method proposed by CT, which is based on homoskedastic and independent assumptions on the errors. As we show, however, spatial correlation can lead to substantial over-rejection if we consider CT at the county level. If we consider randomization inference at the state level, since we would have only one treated unit, spatial correlation would not generate problems if errors are strongly mixing (Corollary \ref{Cor_N1}). However, in both cases we may have distortions given that counties/states vary by population sizes, which would naturally lead to heteroskedasticity. We revisit the use of the method proposed by CT in this empirical application in light of our findings. We consider a DID estimator based on OLS TWFE regression with no covariates. Point estimates are slightly different than reported in the original paper because we use the publicly available data set (so we do not have death counts for cells with fewer than 10 deaths), and because we weight observations by population mean across years to avoid problems with TWFE estimand highlighted in recent papers.\footnote{See, for example, \cite{Bacon}, \cite{chaisemartin2018twoway}, and \cite{Pedro}. We also restrict to counties with information non-missing information for all years. We end up with 485 control counties, as compared to 513 from the original study. } We find a p-value of $0.437$ when we use CT method at the county level, which is similar to the findings from \cite{Kaestner} based on permutations, who found a p-value of $0.384$.\footnote{\cite{Sommers} report a p-value of 0.04 for the OLS unadjusted regression using CRVE at the state level (see their Appendix Table 4). } Note, however, that the average population of the treated counties is around 280,000, while the average population of the control counties is around 91,000. Therefore, following FP, we should expect these p-values to be very conservative, as the method proposed by CT would recover a distribution with larger variance relative to the distribution of the DID estimator. Correcting for that using the method proposed by FP, we find a p-value of $0.148$, which is much lower than the one using CT method. However, the FP p-value above does not take spatial correlation into account. In this setting, if we assume errors are independent across states, then considering an aggregate model at the state level would solve the problem. In this case, we find a p-value of 0.49 from CT and 0.42 from FP.\footnote{\cite{Kaestner} does not report p-value for the state-level OLS unadjusted regression. However, he finds a p-value of 0.404 for a state-level generalized linear model using a negative binomial distribution and log link, which is close to the p-value we found. } Comparing the p-values from FP at the county and state levels suggests that spatial correlation is a significant problem when we consider the county-level model. In Appendix \ref{test} we propose a test for spatial correlation, which reinforces that spatial correlation is important in this setting. When we consider the effects on amenable mortality rates, the differences in p-values become even more striking. We find a p-value of $0.314$ for CT at the county level, which goes down to $0.032$ when we correct for heteroskedasticity using FP. Considering FP at the state level, however, the p-value is up again to $0.238$. Overall, these results suggest that spatial correlation within states is important and, after taking that into account, it is not possible to reject the null that the reform had no effect on mortality. Finally, we also consider the conservative test 2, proposed in Section \ref{Conservative2}. While in this setting it would be possible to solve the problem by aggregating the data at the state level, our method would remain feasible if we had treated counties from different states, or even in applications in which there is no distance metric across units. In this case, we find a p-value of $0.381$ ($0.200$ considering amenable mortality rates), which are remarkably close to the FP p-values at the state level. This reinforces that the conservative test 2 would have worked well even if we did not have information on a distance metric, and despite the fact that we have spatial correlation across counties. Therefore, this test provides an interesting alternative, particularly for more complex applications in which it would not be possible to solve the inference problem by aggregating the data at the state level. \section{Conclusion} We consider the problem of inference in DID models when there are few treated units and errors are spatially correlated. We first show that, when there is a single treated unit, the inference methods proposed by CT and FP, which were designed for settings with few treated and many control units, remain asymptotically valid when errors are strongly mixing. This extends the set of possible applications in which the tests proposed by CT and FP can be reliably used when there is only a single treated unit. However, these methods can lead to over-rejection with more than one treated unit. We propose two alternative inference methods that are asymptotically valid, though generally conservative, in the presence of spatial correlation. These tests provide interesting alternatives when spatial correlation is likely relevant, but the researcher does not have information on a distance metric or is not willing to impose a structure on the spatial correlation. \pagebreak
\section{Introduction}\label{sec:intro} The defining property of topological insulators (TIs)~\cite{footnote} is the band gap in the energy spectrum of the bulk material and gapless conducting boundary states. They are edge states in the case of two-dimensional (2D) systems or surfaces states in the case of three-dimensional ones~\cite{Haldane2017}. The paradigmatic cases which gave rise to the main concepts~\cite{Hasan2010,Qi2011} in this field are: ({\em i}) quantum Hall insulator (QHI) in 2D electron gas which requires an external magnetic field to break the time-reversal invariance and whose edge states are {\em chiral} by allowing spin-unpolarized electron to propagate in only one direction; and ({\em ii}) quantum spin Hall insulator (QSHI)~\cite{Kane2005} which is time-reversal invariant, thereby requiring strong spin-orbit coupling effects instead of external magnetic field, and whose edge states appear in pairs with different chirality and spin polarization. The last experimentally discovered member of 2D TI family is quantum anomalous Hall insulator (QAHI), which requires both nonzero magnetization to break the time reversal invariance and strong spin-orbit coupling effects, with its edge states allowing only one spin species to flow unidirectionally~\cite{Liu2016}. \begin{figure} \includegraphics[width=8.5cm]{fig1.pdf} \caption{Schematic view of a two-terminal devices where an infinite ZGNR is attached to two macroscopic reservoirs with chemical potentials $\mu_\mathrm{L}$ and $\mu_\mathrm{R}$ on the left and right, respectively, so that $\mu_\mathrm{L}-\mu_\mathrm{R} = eV_b$ is externally applied dc bias voltage. In panel (a), the scattering region (blue shaded) in the middle of {\em finite length} $L = 30\sqrt{3}a$ and width $W=29a$ is Floquet TI generated by irradiating~\cite{Oka2009} segment of ZGNR by circularly polarized light of intensity $z$ and frequency $\omega$ [Eq.~\eqref{eq:pphase}]. In panel (b), the scattering region (shaded green) is quantum Hall, quantum anomalous Hall or quantum spin Hall insulator with their parameters tuned to produce the same topologically nontrivial band gap $\Delta_g$ [Fig.~\ref{fig:fig2}(a)] in the bulk of all such conventional time-independent TIs.} \label{fig:fig1} \end{figure} In theoretical analysis, edge states are found as eigenfunctions $\Psi_{k_x}(x,y)=e^{i k_x x}\psi(y)$ of the Hamiltonian of an infinite wire (periodic along the $x$-axis, so that eigenfunctions are labeled by the wavevector $k_x$) made of 2D TIs. The corresponding eigenenergies $\varepsilon(k_x)$ form subbands crossing the band gap~\cite{Halperin1982,MacDonald1984}. The width of the edge states is defined by the spatial region where the probability density is nonzero, \mbox{$|\psi(y)|^2 \neq 0$}, while decaying exponentially fast towards the bulk of the wire. Interestingly, their width~\cite{Prada2013,Chang2014} can also depend on the arrangement of atoms along the edge, such as in the case of graphene wires where edge states of QHI and QAHI or QSHI are narrower in the case of zigzag arrangement of carbon atoms along the edge than in the case of their armchair arrangement~\cite{Prada2013,Chang2014,Sheng2017}. In paradigmatic three-dimensional TIs like Bi$_2$Se$_3$, surface states actually have spatial extent of about $\sim 2$ nm~\cite{Chang2015}. The zigzag edge, which is employed in devices in Fig.~\ref{fig:fig1}, can also introduce a kink in the subband of edge state~\cite{Sheng2017}, so that subband intersects with the Fermi energy $E_F$ at $N_\mathrm{R}$ points with positive velocity and $N_\mathrm{L}$ points with negative velocity. However, only the difference $N_\mathrm{R} - N_\mathrm{L}=|\mathcal{C}|$ is topologically protected according to the {\em bulk-boundary correspondence}~\cite{Hasan2010,Qi2011}. Here $\mathcal{C}$ is an integer topological invariant (like the Chern number in the case of QHI and QAHI) associated with band structure in the bulk. This makes electronic transport through edge states of infinite length {\em perfectly quantized in a robust way}~\cite{Buttiker1988}---the zero-temperature two-terminal conductance is $G(E_F)=G_\mathrm{Q} |\mathcal{C}|$ for $E_F$ swept through the bulk band gap and insensitive to both magnetic and nonmagnetic disorder in the case of QHI and QAHI~\cite{Sheng2017}, or only nonmagnetic disorder in the case of QSHI. Although infinite ballistic wires, including those with topologically trivial edge states~\cite{Allen2015,Zhu2017,Marmolejo-Tejada2018}, also exhibit integer $G(E_F)/ G_\mathrm{Q}$, this is easily disrupted by disorder introduced around the edges or even within the bulk~\cite{Marmolejo-Tejada2018}. Here $G_\mathrm{Q}=2e^2/h$ or $G_Q=e^2/h$ is the conductance quantum for spin-degenerate or spin-polarized edges states, respectively. Thus, it has been considered that the key experimental signature of topology in 2D condensed matter is conductance quantization in transport through edge states, which persists even in the presence of disorder as long as it does not break underlying symmetries of the topological phase or generates energy scales larger than the bulk band gap. However, for QHI, QAHI and QSHI of finite length, the zero-temperature longitudinal conductance $G=I/V_b$, also denoted as `two-terminal' since current $I$ and small bias voltage $V_b$ are measured between the same normal metal (NM) leads, oscillates in Fig.~\ref{fig:fig2} just below the quantized plateau at $2e^2/h$ while remaining very close to it. We use zigzag graphene nanoribbon (ZGNR) within which 2D TI of finite length [Fig.~\ref{fig:fig1}(b)] is established using sufficiently large external magnetic field~\cite{Cresti2016}, or additional terms of the Haldane~\cite{Haldane1988} or the Kane-Mele~\cite{Kane2005} models, to generate QHI, QAHI and QSHI, respectively. Their parameters are tuned so that all three examples of conventional time-independent 2D TIs in Fig.~\ref{fig:fig2}(a) have identical topologically nontrivial bulk band gap $\Delta_g$. Even though $G(E_F)$, for $E_F$ swept through bulk band gap $\Delta_g$, is not perfectly quantized in Fig.~\ref{fig:fig2}(a), its oscillations zoomed in Figs.~\ref{fig:fig2}(b)--(g) are insensitive to nonmagnetic edge disorder (ED) introduced in the form of edge vacancies [illustrated in Fig.~\ref{fig:fig4}]. It is worth mentioning that imperfectly quantized two-terminal $G(E_F)$ was observed in early experiments on QSHI~\cite{Roth2009}, provoking a lively search for exotic many-body inelastic effects~\cite{Maciejko2009,Tanaka2011,Budich2012,Vayrynen2013,Kainaris2014,Vayrynen2018,Novelli2019} which can circumvent band-topology constraints and introduce backscattering of electrons as they propagate through edge states. On the other hand, Fig.~\ref{fig:fig2} demonstrates that imperfectly quantized $G(E_F)$ can be due to a much simpler mechanism---backscattering at the NM-lead/TI-region interface. Lacking perfectly quantized two-terminal conductance $G(E_F)$ as the experimental signature of 2D TI phase of finite length, one can resort to direct imaging of spatial profiles of local current density that should confirm electronic flux confined to a narrow region defined by the edge states. Continuous experimental advances have made this possible, such as by using superconducting interferometry in Josephson junction setup~\cite{Allen2015,Zhu2017} or scanning superconducting quantum interference device (SQUID)~\cite{Nowack2013}. In the latter case, one images magnetic field produced by the current from which one can reconstruct the local current density with $\sim \mu$m spatial resolution~\cite{Nowack2013}. Even higher resolution, with reconstructed images having spatial resolution of $\sim 10$ nm, has been achieved by using scanning tip based on electronic spin of a diamond nitrogen-vacancy (NV) centers~\cite{Tetienne2017,Chang2017,Ku2020}. Particularly {\em intriguing questions} that such images can answer is how electron flux transitions from topologically trivial NM lead present in every experimental device into the region of 2D TI of finite length where the flux is confined within narrow edge currents, as well as how processes at the NM-lead/2D-TI interface affect the total current and the corresponding conductance. \begin{figure*} \includegraphics[scale=1.1]{fig2.pdf} \caption{(a) The zero-temperature two-terminal conductance vs. the Fermi energy $E_F$ of device in Fig.~\ref{fig:fig1}(b) where central scattering region hosts {\em finite-length} conventional 2D time-independent TIs, such as QHI, QAHI and QSHI. The TIs are defined on pristine or edge disordered (denoted by ED) ZGNR due to vacancies illustrated in Figs.~\ref{fig:fig4}(d), ~\ref{fig:fig4}(f) and ~\ref{fig:fig4}(h). The zoom in of conductance values within the rectangle in panel (a) is shown in: (b)--(d) for pristine ZGNR; and (e)--(g) for edge-disordered ZGNR. The two NM leads, from which electrons are injected into the topologically protected edge states of finite length with the corresponding local current density profiles shown in Fig.~\ref{fig:fig4}(c)--(h), are also made of ZGNR of the same width as the scattering region [Fig.~\ref{fig:fig1}(b)]. The gap in the bulk of all three 2D TIs is tuned to $\Delta_g = 0.54 \gamma$ and marked in panel (a).} \label{fig:fig2} \end{figure*} Imaging of local current density could also offer new avenue for resolving a {\em crucial issue} for recently conjectured new class of 2D TIs---the so-called Floquet TI~\cite{Oka2009,Lindner2011,Oka2019,Rudner2020}---which is the connection between the Floquet quasi-energy spectrum and experimentally measurable dc transport properties. The Floquet TI phase arises in 2D electron systems driven out of equilibrium by strong light-matter interaction. For example, graphene~\cite{Oka2009,Lindner2011,Oka2019,Rudner2020}, as well as other 2D materials with honeycomb lattice structure like transition-metal dichalcogenides~\cite{Huaman2019}, subject to a spatially uniform and circularly polarized light are predicted to transmute into Floquet TI with quasi-energy spectrum~\cite{Shirley1965,Sambe1973}. Its multiple gaps share~\cite{Lindner2011} the same topological properties as the band gap of QAHI described by the Haldane model~\cite{Haldane1988}. This means that the laser induced band gaps, such as $\Delta_0$ in Fig.~\ref{fig:fig3}(a) emerging at the charge neutral point (CNP) of graphene and $\Delta_1$ away from CNP, are crossed by subbands of chiral edge states~\cite{Perez-Piskunow2014,Perez-Piskunow2014a}. The eigenfunctions of these subbands decay exponentially towards the bulk with a decay length that depends only on the ratio of the laser frequency and its intensity. The $\Delta_1$ gaps are called dynamical gaps~\cite{Syzranov2008} and they occur at energy $\hbar \omega/2$ above/below the CNP. They can be reached using experimentally accessible parameters. For example, the very recent experiment~\cite{McIver2020} has been interpreted in terms of creation of a transient Floquet TI by driving graphene flake by \mbox{$500$~fs} laser pulse at a frequency of \mbox{$\omega=46$~THz}, so that the photon energy is \mbox{$\hbar \omega \approx 191$ meV} and its wavelength is \mbox{$\lambda \approx 6.5$ $\mu$m}. However, the experiment of Ref.~\cite{McIver2020} did not observe either quantized longitudinal or transverse (Hall) conductance. Instead, they found that at the peak laser pulse fluence the transverse conductance within $\Delta_0$ gap saturated at plateau around \mbox{$G_{xy}=(1.8 \pm 0.4)e^2/h$}, while no such plateau of $G_{xy}$ was observed within $\Delta_1$ gap. The calculations of two-terminal [as in Figs.~\ref{fig:fig2} and ~\ref{fig:fig3}(b)] or multi-terminal conductance typically employ the Landauer-B\"{u}ttiker setup~\cite{Buttiker1988,Imry1999} depicted in Fig.~\ref{fig:fig1} where finite-size scattering region---time-dependent due to light irradiation in Fig.~\ref{fig:fig1}(a) or conventional time-independent in Fig.~\ref{fig:fig1}(b)---is attached to semi-infinite NM leads terminating at infinity into the macroscopic particle reservoirs. This is highly appropriate for Floquet TI since time-dependent potential applied in experiments~\cite{McIver2020} is confined to a finite region, either because of a finite laser spot or the screening inside metallic contacts. On the conceptual side, such setup ensures well-defined asymptotic states and their occupation far away from the irradiated region, thereby evading technical difficulties when using time-dependent leads or reservoirs~\cite{Gaury2014}. It also ensures {\em continuous energy spectrum} of the whole system which plays a key role in both the Landauer-B\"{u}ttiker and Kubo~\cite{Sato2019} formulation of quantum transport because it effectively introduces dissipation at infinity and thereby steady-state transport~\cite{Perfetto2010}, while not requiring~\cite{Esin2018} to explicitly model many-body inelastic scattering processes responsible for dissipation~\cite{Imry1999}. \begin{figure} \includegraphics[width=\linewidth]{fig3.pdf} \caption{(a) Quasi-energy spectrum $\xi_\mathrm{QE} (k_x)$ for an infinite ZGNR that is irradiated by circularly polarized monochromatic laser light of frequency \mbox{$\hbar \omega = 3 \gamma$} and intensity \mbox{$z=0.5$} over its whole length. The spectrum is obtained by diagonalizing the corresponding Floquet Hamiltonian [Eq.~\eqref{eq:floquet_ham}] truncated to $-N_\mathrm{ph}<n<N_\mathrm{ph}$ Floquet replicas where $N_\mathrm{ph}=7$ is chosen. The yellow shaded region marks the topological gap $\Delta_0$ around $\xi_\mathrm{QE} = 0$ corresponding to CNP, while the red shaded region marks the dynamical topological gap $\Delta_1$ around $\xi_\mathrm{QE} = \pm\hbar\omega/2$. (b) The zero-temperature two-terminal conductance vs. $E_F$ (computed using $N_\mathrm{ph} = 7$) of two-terminal device in Fig.~\ref{fig:fig1}(a) whose scattering region is Floquet TI of finite length due to irradiation by circularly polarized light. The pristine irradiated ZGNR is marked by FTI and irradiated edge-disordered ZGNR is marked by FTI-ED. The conductance of an infinite nonirradiated (NIR) pristine ZGNR is also show as a reference. (c) Total DOS for the same device marked by FTI in panel (b). (d) Convergence of lead currents $I_\mathrm{L}$ and $I_\mathrm{R}$ vs. $N_\mathrm{ph}$ at \mbox{$E_F = \hbar\omega/2$ }. } \label{fig:fig3} \end{figure} However, for the same two-terminal Landauer-B\"{u}ttiker setup with irradiated scattering region a plethora of conflicting theoretical conclusions have been reached~\cite{Rudner2020}. For example, Refs.~\cite{Kitagawa2011,Gu2011} predict quantization of longitudinal dc conductance within a few percent of $2e^2/h$, while Ref.~\cite{Kundu2014} finds its anomalous suppression. To recover the quantized value, Ref.~\cite{Kundu2013} proposed an {\em ad hoc} summation procedure over different energies in the lead. Without utilizing such ``Floquet sum rule''~\cite{Farrell2016,Yap2017,Kundu2020}, both Refs.~\cite{FoaTorres2014,Farrell2016} confirm nonquantized $G<2e^2/h$ within $\Delta_0$ gap and $G<4e^2/h$ within $\Delta_1$ gap which, however, are largely insensitive to disorder like vacancies or on-site impurities. The precise quantization could be disrupted by dc component of pumping current~\cite{Brouwer1998,Moskalets2002}, which appears~\cite{FoaTorres2014} even at zero bias voltage due to time-dependent potential in the Hamiltonian whenever the left-right symmetry of the device is broken statically or dynamically~\cite{FoaTorres2005,Bajpai2019}. The absence of quantization is explained~\cite{Esin2018,Rudner2020,FoaTorres2014,Farrell2016} by the mismatch between nonirradiated electronic states in the NM leads and edge states within the gaps of the Floquet TI. The mismatch between states in topologically trivial NM leads and TI scattering region exists also in conventional time-independent TI devices, but without significant disruption of quantized conductance in Fig.~\ref{fig:fig2}. However, specific to Floquet TIs is possibility of Floquet replicas to couple to bulk bands~\cite{FoaTorres2014,Fedorova2019}. That is, although edge states within the gap $\Delta_0$ are primarily built from states near the CNP of nonirradiated graphene, they also contain harmonic components near $\pm n\hbar \omega$ which open possibility for electronic photon-assisted tunneling into or out of states in the NM leads whose energies are far away from the CNP. Thus, engineering the density of state of the leads, in order to connect Floquet TI and macroscopic reservoirs through a narrow band of filter states, can recover longitudinal dc conductance within a few percent of $2e^2/h$~\cite{Esin2018}. The issue of experimentally detectable quantized conductance can be examined without resorting to time-independent Floquet formalism, that is, by performing direct time-dependent quantum transport simulations~\cite{Gaury2014}. Due to high computational demand, such calculations are rarely pursued, but some attempts yield longitudinal conductance reaching close to quantized value after sufficiently long time~\cite{Fruchart2016}. This then poses a question on the accuracy of truncation procedure that is inevitably done to reduce infinite matrices in the Floquet formalism where artifacts~\cite{Mahfouzi2012} can be introduced. One such artifact is dc current which is not conserved (i.e., different in the left and right lead)~\cite{Kitagawa2011,Wang2003}, or insufficient number of Floquet replicas is retained for achieving converged results. In this study, we employ {\em charge-conserving} solution~\cite{Mahfouzi2012} for the Floquet-nonequilibrium Green functions (Floquet-NEGF)~\cite{Kitagawa2011,Wang2003,Mahfouzi2012} which ensures that dc current in the left (L) and the right (R) lead are identical at each level of truncation of matrices in the Floquet formalism, i.e., the number of of ``photon'' excitations $N_\mathrm{ph}$ retained. As an overtire, Fig.~\ref{fig:fig3}(d) demonstrates $|I_\mathrm{L}| \equiv |I_\mathrm{R}|$ at each $N_\mathrm{ph}$, as well as that dc component of current converges at $N_\mathrm{ph}=7$. Nevertheless, the conductance in Fig.~\ref{fig:fig3}(b) remains nonquantized in both $\Delta_0$ and $\Delta_1$ gaps. We then proceed to compare spatial profiles of local current density in conventional and Floquet TIs in Fig.~\ref{fig:fig4} which offer detailed microscopic insight on how electrons propagate from one to another carbon atom as they transition from topologically trivial NM leads into the TI region, or within the TI region with possible edge or bulk vacancies introduced as disorder. The paper is organized as follows. Section~\ref{sec:mm_a} describes the Hamiltonian of Floquet TI defined on ZGNR, as well as charge-conserving Floquet-NEGF from Ref.~\cite{Mahfouzi2012}, which is extended here to nonzero bias voltage and to obtain local current density. The same ZGNR is used in Sec.~\ref{sec:mm_b} to define Hamiltonians for the conventional time-independent QHI, QAHI and QSHI, where we also provide steady-state NEGF expressions for local current density in these systems. Section~\ref{sec:results_a} presents results for two-terminal conductance of these four TIs, and Sec.~\ref{sec:results_b} compares spatial profiles of local current density as it flows from the NM leads into those four TIs. In Sec.~\ref{sec:exp} we discuss experimental schemes to quantify bulk vs. edge contributions to total current within Floquet TI using either a nanopore~\cite{Heerema2016,Chang2014,Chang2012} drilled in the interior of irradiated ZGNR, whose effect on the conductance is also explicitly calculated, or magnetic field imaging via diamond NV centers~\cite{Ku2020}. We conclude in Sec.~\ref{sec:conclusions}. \section{Models and Methods}\label{sec:models} \subsection{Hamiltonian and quantum transport formalism for Floquet TI}\label{sec:mm_a} The semi-infinite leads and the scattering region in Fig.~\ref{fig:fig1} combined constitute, prior to introducing light or external magnetic field or spin-orbit coupling into the scattering region, an infinite homogeneous ZGNR described by the nearest-neighbor tight-binding Hamiltonian \begin{equation}\label{eq:gr_ham_nir} \hat{H}_\mathrm{ZGNR} = - \sum_{\braket{ij}} \gamma_{ij} \hat{c}^\dagger_i\hat{c}_j, \end{equation} Here $\braket{ij}$ indicates the sum over the nearest-neighbor sites; $\hat{c}_i^\dagger$($\hat{c}_j$) creates (annihilates) an electron on site $i$ of the honeycomb lattice hosting a single $p_z$-orbital $\langle \mathbf {r}| i \rangle=\pi(\mathbf{r}-\mathbf{R}_i)$; and \mbox{$\gamma_{ij} = \gamma = 2.7$ eV} is the nearest-neighbor hopping from site $i$ to $j$. The width of the ZGNR is chosen as $W= 29a$, where $a$ is the distance between two nearest-neighbor carbon atoms in graphene. It is well-known that, in general, TIs thinner than twice the width of their boundary states will experience hybridization of those states and opening of a topologically trivial mini gap~\cite{Hasan2010,Qi2011,Chang2015} at the crossing point. For Floquet TI studied in Fig.~\ref{fig:fig3}(a) this would happen if $W \le 14a$, so that our choice of $W$ evades such size artifacts. This is also ensured in the cases for QHI, QAHI and QSHI in Fig.~\ref{fig:fig4} where ZGNR is always wider than the width of edge currents. The ZGNR terminates at infinity into the macroscopic reservoirs of electrons whose chemical potentials are $\mu_\mathrm{L} = E_{F} + eV_b/2$ and $\mu_\mathrm{R} = E_{F} - eV_b/2$ for $E_F$ as the Fermi energy and $V_b$ as the applied dc bias voltage. Note that zero-temperature two-terminal conductance $G(E_F)$ of an infinite homogeneous ZGNR described by Hamiltonian in Eq.~\eqref{eq:gr_ham_nir} is plotted for comparison in Fig.~\ref{fig:fig3}(b) and labeled as nonirradiated (NIR). In the case of Floquet TI, circularly polarized monochromatic laser light irradiates the scattering region (shaded blue) of finite length $L = 30\sqrt{3}a$ in Fig.~\ref{fig:fig1}(a). The electromagnetic field of light is introduced into the Hamiltonian through the vector potential \mbox{$\mathbf{A}(t) = A_0(\bold{e}_x \cos\omega t + \bold{e}_y \sin\omega t )$}, where $\bold{e}_x$ ($\bold{e}_y$) is the unit vector along the $+x$-axis ($+y$-axis). The corresponding electric field generated by $\mathbf{A}(t)$ is \mbox{$\bold{E}(t) = -\partial \bold{A}(t)/\partial t$}. We neglect the relativistic magnetic field of light, so that electronic spin degree of freedom maintains its degeneracy and it is excluded from our analysis. The vector potential modifies the Hamiltonian in Eq.~\eqref{eq:gr_ham_nir} via the standard Peierls substitution~\cite{Li2020} \begin{equation}\label{eq:pphase} \hat{c}^\dagger_i \hat{c}_j \longmapsto \exp\bigg[ i2z(\bold{e}_x \cos\omega t + \bold{e}_y \sin\omega t)\cdot \bold{r}_{ij}\bigg]\hat{c}^\dagger_i \hat{c}_j, \end{equation} which is rigorously proven~\cite{Panati2003} to be sufficient to capture the leading order effects due to the presence of the vector potential $\mathbf{A}(t)$. Here $z = eaA_0/2\hbar$ is a dimensionless measure of intensity of the circularly polarized light; $\omega$ is the frequency and $\bold{r}_{ij}$ is the position vector connecting site $i$ with site $j$. The new Hamiltonian $\hat{H}(t)$ with time-dependent hopping between sites $i$ and $j$, $\gamma_{ij}(t) = \gamma \exp\bigg[ i2z(\bold{e}_x \cos\omega t + \bold{e}_y \sin\omega t)\cdot \bold{r}_{ij}\bigg]$, is time-periodic, $\hat{H}(t+T)=\hat{H}(t)$, with period $T = 2\pi/\omega$. Any solution of the Schr\"{o}dinger equation, $i\hbar \partial \Psi(t)/\partial t = \hat{H}(t) \Psi(t)$, with time-periodic Hamiltonian $\hat{H}(t)=\hat{H}(t+T)$ can be expressed as a linear combination, $\Psi(t)=\sum_\alpha c_\alpha \phi_\alpha^\mathrm{F}(t)$, of the so-called Floquet functions~\cite{Shirley1965,Sambe1973} \begin{equation}\label{eq:eigenstates} \phi_\alpha^\mathrm{F}(t) = e^{-i \xi_\mathrm{QE}^\alpha t/\hbar} u_\alpha(t). \end{equation} Here $\xi_\mathrm{QE}^\alpha$ is the Floquet {\em quasi-energy} and \mbox{$u_\alpha(t+T)=u_\alpha(t)$} are periodic functions which can, therefore, be expanded into a Fourier series \begin{equation}\label{eq:ufunction} u_\alpha(\mathbf{r},t)=\sum_{n=-\infty}^{\infty} e^{i n \omega t} u_n^\alpha(\mathbf{r}). \end{equation} The time-periodic Hamiltonian $\hat{H}(t)=\hat{H}(t+T)$ can also be expanded into a Fourier series \begin{equation}\label{eq:ham_fourier} \hat{H}(t) = \sum_{n=-\infty}^{\infty} \hat{H}_n e^{i n \omega t}, \end{equation} where $\hat{H}_n$ is given in terms of the Bessel functions $J_{m}(z)$ of the first kind \begin{subequations}\label{eq:jmcs} \begin{eqnarray}\label{eq:jms} \exp(iz\sin x) = \sum_{m=-\infty}^{\infty} J_{m}(z)e^{i m x}, \end{eqnarray} \begin{eqnarray}\label{eq:jmc} \exp(iz\cos x) = \sum_{m=-\infty}^{\infty} i^m J_{m}(z)e^{i m x}. \end{eqnarray} \end{subequations} Using the matrix representation of the Fourier coefficients $\bold{H}_n$ in Eq.~\eqref{eq:ham_fourier} in the basis of orbitals $|i\rangle$, we construct the Floquet Hamiltonian~\cite{Shirley1965,Sambe1973} \begin{equation}\label{eq:floquet_ham} \check{\bold{H}}_\mathrm{F} = \begin{pmatrix} \ddots & \vdots & \vdots & \vdots & \iddots\\ \cdots & \bold{H}_0 & \bold{H}_1 & \bold{H}_2 & \cdots \\ \cdots & \bold{H}_{-1} & \bold{H}_0 & \bold{H}_1 & \cdots \\ \cdots & \bold{H}_{-2} & \bold{H}_{-1}& \bold{H}_0 & \cdots \\ \iddots & \vdots & \vdots & \vdots & \ddots \end{pmatrix}. \end{equation} which is time-independent but infinite. The time-dependent NEGF formalism~\cite{Gaury2014} operates with two fundamental quantities~\cite{Stefanucci2013}---the retarded $\mathbf{G}^r(t,t')$ and the lesser $\mathbf{G}^<(t,t')$ Green functions (GF)---which describe the density of available quantum states and how electrons occupy those states in nonequilibrium, respectively. They depend on two times, but solutions can be sought in other representations, such as the double-time-Fourier-transformed~\cite{Mahfouzi2012,Wang2003} GFs, ${\bf G}^{r,<}(E,E')$. In the case of periodic time-dependent Hamiltonian, they must take the form~\cite{Martinez2003} \begin{equation} {\bf G}^{r,<}(E,E')={\bf G}^{r,<}(E,E+n \hbar \omega)={\bf G}^{r,<}_n(E), \end{equation} in accord with the Floquet theorem~\cite{Shirley1965,Sambe1973}. The coupling of energies $E$ and $E+ n\hbar\omega$ ($n$ is integer) indicate ``multiphoton'' exchange processes. In the absence of many-body (electron-electron or electron-boson) interactions, currents can be expressed using solely the Floquet-retarded-GF $\check{\bold{G}}^r(E)$ \begin{equation}\label{eq:floquet_GF} [E + \check{\bold{\Omega}} - \check{\bold{H}}_\mathrm{F} - \check{\bold{\Sigma}}^r(E) ]\check{\bold{G}}^r(E) = \check{\bold{1}}, \end{equation} which is composed of ${\bf G}^r_n(E)$ submatrices along the diagonal. Here we use notation \begin{equation}\label{eq:omega_mtx} \check{\bold{\Omega}} = \begin{pmatrix} \ddots & \vdots & \vdots & \vdots & \iddots\\ \cdots & -\hbar\omega\bold{1} & 0 & 0 & \cdots \\ \cdots & 0 & 0 & 0 & \cdots \\ \cdots & 0 & 0 & \hbar\omega\bold{1}& \cdots \\ \iddots & \vdots & \vdots & \vdots & \ddots \end{pmatrix}, \end{equation} and $\check{\bold{\Sigma}}^r(E)$ is the retarded Floquet self-energy matrix \begin{equation}\label{eq:floquet_self} \check{\bold{\Sigma}}^r(E) = \begin{pmatrix} \ddots & \vdots & \vdots & \vdots & \iddots\\ \cdots & \bold{\Sigma}^r(E-\hbar\omega) & 0 & 0 & \cdots \\ \cdots & 0 & \bold{\Sigma}^r(E) & 0 & \cdots \\ \cdots & 0 & 0 & \bold{\Sigma}^r(E+\hbar\omega) & \cdots \\ \iddots & \vdots & \vdots & \vdots & \ddots \end{pmatrix}, \end{equation} composed of the usual self-energies of the leads~\cite{Velev2004}, $\bold{\Sigma}^r(E) = \sum_{p=\mathrm{L,R}}\bold{\Sigma}_p^r(E)$, on the diagonal. All matrices labeled as $\check{\mathbf{O}}$ are representations of operators acting in the Floquet-Sambe~\cite{Sambe1973} space, $\mathcal{H}_\mathrm{F} = \mathcal{H}_T \otimes \mathcal{H}_e$, where $\mathcal{H}_e$ is the Hilbert space of electronic states spanned by localized orbitals $|i \rangle$ and $\mathcal{H}_T$ is the Hilbert space of periodic functions with period $T=2\pi/\omega$ spanned by orthonormal Fourier vectors $\langle t|n \rangle = \exp(i n \omega t)$. The charge current $I_{p}(t)$ in the lead $p=\mathrm{L,R}$ is time-dependent due to Eq.~\eqref{eq:pphase}, and it also has periodicity $T=2\pi/\omega$ like the Hamiltonian itself. The dc component of current, either due to pumping by time-dependent potential~\cite{Brouwer1998,Moskalets2002,FoaTorres2005,Bajpai2019} or due to applied bias voltage $V_b$ or both, is given by \begin{equation} I_{p} = \frac{1}{T}\int_{t}^{t+T} I_p(t') dt'. \end{equation} Such dc component, or time-averaged current over one period $T$, that is injected into the lead $p$ is obtained from the following NEGF expression~\cite{Mahfouzi2012} \begin{equation}\label{eq:floq_chj} I_{p} = \frac{e}{2N_\mathrm{ph}}\int\limits_{-\infty}^{+\infty}dE\, \mathrm{Tr}[\check{\bold{\Gamma}}_p\check{\bold{f}}_p\check{\bold{G}}^r\check{\bold{\Gamma}}\check{\bold{G}}^a - \sum_{p=\mathrm{L,R}}\check{\bold{\Gamma}}_p\check{\bold{G}}^r\check{\bold{\Gamma}}_\alpha\check{\bold{f}}_\alpha\check{\bold{G}}^a ]. \end{equation} In our convention, $I_p>0$ indicates that charge current is flowing into the lead. Here $\check{\bold{f}}_p$ is the Floquet Fermi matrix \begin{equation}\label{eq:fermi_mtx} \check{\bold{f}}_p(E) = \begin{pmatrix} \ddots & \vdots & \vdots & \vdots & \iddots\\ \cdots & f_p(E-\hbar\omega)\bold{1} & 0 & 0 & \cdots \\ \cdots & 0 & f_p(E) & 0 & \cdots \\ \cdots & 0 & 0 & f_p(E+\hbar\omega)\bold{1}& \cdots \\ \iddots & \vdots & \vdots & \vdots & \ddots \end{pmatrix}, \end{equation} where $f_p(E)$ is the Fermi function of the macroscopic particle reservoir attached to lead $p$; \mbox{$\check{\bold{\Gamma}}_p(E) = i [\check{\bold{\Sigma}}_p^r(E) - (\check{\bold{\Sigma}}_p^r(E))^\dagger]$} is the Floquet level broadening matrix; \mbox{$\check{\bold{\Gamma}}(E) = \sum_{p=\mathrm{L,R}} \check{\bold{\Gamma}}_p(E)$}; the Floquet-advanced-GF is defined as $\check{\bold{G}}^a(E) = [\check{\bold{G}}^r(E)]^\dagger$; and $\mathbf{1}$ is the unit matrix in $\mathcal{H}_e$ space. We note that Eq.~\eqref{eq:floq_chj} is generalization of the expression for charge current in Ref.~\cite{Mahfouzi2012} to include the applied bias voltage $V_b$. The linear-response two-terminal conductance is then given by \begin{equation} \label{eq:conductance} G = \frac{I_\mathrm{R}}{V_b}, \end{equation} for small applied bias voltage $eV_b \ll E_F$. While the space $\mathcal{H}_e$ is finite-dimensional, with dimension equal to the number of sites $N_e$ within the scattering region, the space $\mathcal{H}_T$ is infinite-dimensional and has to be truncated using $|n| \le N_\mathrm{ph}$. For truncation we employ the following convergence criterion \begin{equation}\label{eq:convergence} \bigg| \frac{I_p(N_\mathrm{ph}) - I_p(N_\mathrm{ph}-1)}{I_p(N_\mathrm{ph}-1)}\bigg|\times 100 < \delta, \end{equation} where $\delta$ is the convergence tolerance. Since the operators acting in $\mathcal{H}_e$ are represented by matrices of dimension $N_e \times N_e$, the operators $\check{\mathbf{O}}$ acting on the truncated Floquet-Sambe space $\mathcal{H}_\mathrm{F}$ are represented by matrices of dimension $(2N_\mathrm{ph}+1)N_e \times (2N_\mathrm{ph}+1)N_e$. Note that the trace in Eq.~\eqref{eq:floq_chj}, $\mathrm{Tr} \equiv \mathrm{Tr}_e \mathrm{Tr}_T$, is summing over contributions from different subspaces of $\mathcal{H}_T$ so that the denominator includes $2N_\mathrm{ph}$ to avoid double counting. The part of the trace operating in $\mathcal{H}_T$ space ensures that at each chosen truncation $N_\mathrm{ph}$ of Floquet replicas charge current is conserved, $I_\mathrm{L} = - I_\mathrm{R}$, unlike other types of solutions~\cite{Wang2003,Kitagawa2011} of the Floquet-NEGF equations where current conservation is ensured only in the limit $N_\mathrm{ph} \rightarrow \infty$. The bond current operator~\cite{Nikolic2006} between sites $i$ and $j$ is time-dependent due to Eq.~\eqref{eq:pphase} and it is given by~\cite{Gaury2014} \begin{equation}\label{eq:bc_oper} \begin{split} \bold{J}_{ij}(t) &= \frac{e}{i\hbar} [\gamma_{ij}(t)\hat{c}_i^\dagger\hat{c}_j - \gamma_{ji}(t)\hat{c}_j^\dagger\hat{c}_i] \\ &= \sum_{n=-\infty}^{\infty} \bold{J}_{n}^{ij}e^{in\omega t}. \end{split} \end{equation} We define the Floquet bond current matrix as \begin{equation}\label{eq:floquet_curr} \check{\bold{J}}_{ij} = \begin{pmatrix} \ddots & \vdots & \vdots & \vdots & \iddots\\ \cdots & \bold{J}_0^{ij} & \bold{J}_{-1}^{ij} & \bold{J}_{-2}^{ij} & \cdots \\ \cdots & \bold{J}_{1}^{ij} & \bold{J}_0^{ij} & \bold{J}_{-1}^{ij} & \cdots \\ \cdots & \bold{J}_{2}^{ij} & \bold{J}_{1}^{ij}& \bold{J}_0^{ij} & \cdots \\ \iddots & \vdots & \vdots & \vdots & \ddots \end{pmatrix}, \end{equation} which yields nonequilibrium part~\cite{Nikolic2006} of dc bond (or local) charge current flowing between site $i$ and $j$ as \begin{equation}\label{eq:floquet_bc} J_{ij}^\mathrm{neq} = \frac{1}{2\pi i}\sum_{n=-N_\mathrm{ph}}^{N_\mathrm{ph}} \int_{E_F+n\hbar\omega-eV_b/2}^{E_F+n\hbar\omega + eV_b/2} dE\, \mathrm{Tr}[\check{\bold{G}}^<(E)\check{\bold{J}}_{ij}], \end{equation} where $\check{\bold{G}}^<(E) = \sum_{p=\mathrm{L,R}} i\check{\bold{G}}^r(E)\check{\bold{\Gamma}}_p(E)\check{\bold{f}}_p(E)\check{\bold{G}}^a(E)$. \subsection{Hamiltonian and quantum transport formalism for QHI, QAHI and QSHI}\label{sec:mm_b} The two-terminal setup in Fig.~\ref{fig:fig1}(b) hosts one of the three conventional time-independent TIs as the scattering region (shaded green) of finite length $L = 30\sqrt{3}a$. The QHI is realized by applying an external time-independent magnetic field perpendicular to ZGNR. The magnetic field is described by a static vector potential \mbox{$\bold{A} = (By,0,0)$} in the Landau gauge, which is then included into the Hamiltonian in Eq.~\eqref{eq:gr_ham_nir} via the Peierls substitution~\cite{Li2020,Panati2003} \begin{equation}\label{eq:qh} \hat{c}^\dagger_i \hat{c}_j \longmapsto \exp\bigg[ i \frac{\beta}{a_0^2}(x_i-x_j)(y_i+y_j)\bigg]\hat{c}^\dagger_i \hat{c}_j. \end{equation} Here $(x_i,y_i)$ indicates the position vector of a carbon atom at site $i$, and $\beta = eBa_0^2/\sqrt{3}\hbar \approx 0.07$ is a dimensionless measure of the magnetic field strength. The QAHI~\cite{Liu2016} is described by the Haldane model~\cite{Haldane2017,Haldane1988} on the honeycomb lattice \begin{eqnarray}\label{eq:qah} \hat{H}_\mathrm{QAHI} & = & \sum_{\braket{ij}}- \gamma_{ij} \hat{c}^\dagger_i\hat{c}_j + \sum_{\braket{\braket{ij}}} \widetilde{\gamma}_{ij}\hat{c}^\dagger_i\hat{c}_j \nonumber \\ && + \sum_{i \in A} m \hat{c}_i^\dagger\hat{c}_i + \sum_{i \in B} (-m) \hat{c}_i^\dagger\hat{c}_i. \end{eqnarray} Here $\braket{\braket{ij}}$ indicates the sum over the next-nearest-neighbor sites, and $\widetilde{\gamma}_{ij} = - \widetilde{\gamma}_{ji} = i \widetilde{\gamma}$ where we use $\tilde{\gamma}=0.14 \gamma$. The last two mass terms on the right hand side have different sign on the triangular sublattices A and B of the honeycomb lattice, where $m=0.2 \gamma$ specifies the ``mass'' term. Note that circularly polarized light employed in Eq.~\eqref{eq:pphase} is mandatory for Floquet TI to mimic QAHI phase of the Haldane model. In contrast, linearly polarized light, which is made of equal superposition of clockwise and anticlockwise circular polarizations, does not break time-reversal symmetry and cannot lead to Haldane ``mass'' term. Finally, the QSHI is described by the Kane-Mele model~\cite{Kane2005} \begin{equation}\label{eq:kane_mele_ham} \hat{H}_\mathrm{QSHI} = \sum_{\braket{ij}}-\gamma_{ij} \bold{c}_i^\dagger \bold{c}_j + \sum_{\braket{\braket{ij}}} it_\mathrm{SO} \bold{c}_i^\dagger \bm{\sigma} \cdot (\bold{d}_{kj}\times \bold{d}_{ik} )\bold{c}_j, \end{equation} whose edge states crossing the topological nontrivial band gap are both chiral and spin-polarized~\cite{Hasan2010,Qi2011}. Here $\bold{c}_i^\dagger = (\hat{c}_{i\uparrow}^\dagger,\hat{c}_{j\downarrow}^\dagger)$ is a row vector of creation operators $\hat{c}^\dagger_{i\sigma}$ that create an electron on site $i$ with spin $\sigma=\uparrow, \downarrow$; $\bold{c}_i$ is the corresponding column vector of annihilation operators; $\bold{d}_{ik}$ is the unit vector pointing from site $k$ to $i$; $\bm{\sigma} = (\hat{\sigma}_x, \hat{\sigma}_y, \hat{\sigma}_z)$ is the vector of the Pauli matrices; and $t_\mathrm{SO}$ is the strength of the intrinsic spin-orbit coupling~\cite{Kane2005,Chang2014}. The zero-temperature two-terminal conductance $G(E_F)=G_Q \mathcal{T}(E)$ of the setup in Fig.~\ref{fig:fig1}(b) is calculated using the Landauer transmission function~\cite{Imry1999,Stefanucci2013} \begin{equation} \mathcal{T}(E) = \mathrm{Tr}[\bm{\Gamma}_\mathrm{R}(E)\bold{G}^r(E)\bm{\Gamma}_\mathrm{L}(E)\bold{G}^a(E)], \end{equation} where the conductance quantum is $G_Q=2e^2/h$ for QHI and QAHI and $G_Q=e^2/h$ for QSHI. Here the retarded GF of the scattering region is given by \mbox{$\bold{G}^r(E) = [E - \bold{H} - \bm{\Sigma}^r(E)]^{-1}$}; the advanced GF is $\bold{G}^a(E) = [\bold{G}^r(E)]^\dagger$; and $\bold{\Gamma}_p(E) = i [\bm{\Sigma}^r_p(E) - \bm{\Sigma}^a_p(E)]$ are the level-broadening matrices. To compute the nonequilibrium bond current between sites $i$ and $j$ we use~\cite{Mahfouzi2013} \begin{equation}\label{eq:loc_j_ss} J_{ij}^\mathrm{neq} = \frac{eV_b}{2\pi} \Tr[\bold{G}^r(E_F)\bm{\Gamma}_\mathrm{L}(E_F)\bold{G}^a(E_F) \bold{J}_{ij}], \end{equation} where $\bold{J}_{ij}$ is the bond current operator in Eq.~\eqref{eq:bc_oper} but with time-independent hopping $\gamma_{ij}$. \begin{figure*} \includegraphics[width=\linewidth]{fig4.pdf} \caption{Spatial profiles of local current density in two-terminal devices of Fig.~\ref{fig:fig1} where the scattering region (dotted rectangle) of finite length is: (a) irradiated pristine ZGNR hosting Floquet TI; (b) irradiated edge-disordered ZGNR; (c) pristine QHI; (d) edge-disordered QHI; (e) pristine QAHI; (f) edge-disordered QAHI; (g) pristine QSHI; and (h) edge-disordered QSHI. In panels (a) and (b) we use $\hbar\omega = 3\gamma$, $z=0.5$, $N_\mathrm{ph} = 7$, and $E_F = \hbar \omega /2$ corresponding to the middle of $\Delta_1$ gap in Fig.~\ref{fig:fig3}(a). In panels (c)--(h), \mbox{$E_F = 0.2 \gamma$}, and in (g) and (h) \mbox{$t_\mathrm{SO} = 0.1 \gamma$}. The black solid arrows are guide to the eye to indicate the spatial region with large flux of local current density.} \label{fig:fig4} \end{figure*} \section{Results and Discussion}\label{sec:results} \subsection{Conductance within the topological gap: FTI vs. conventional TIs }\label{sec:results_a} By diagonalizing $\check{\mathbf{H}}_\mathrm{F}$ in Eq.~\eqref{eq:floquet_ham} for an infinite ZGNR that is periodic along the $x$-axis and irradiated by circularly polarized light over its {\em whole} length, we obtain the quasi-energy spectrum $\xi_\mathrm{QE}(k_x)$ shown in Fig.~\ref{fig:fig3}(a). The chiral edge states crossing the light-induced gap $\Delta_0$ at $\xi_\mathrm{QE} = 0$ (shaded yellow) and $\Delta_1$ at \mbox{$\xi_\mathrm{QE} = \pm \hbar\omega/2$} (shaded red) suggest naively that upon applying small bias voltage the zero-temperature linear-response two-terminal conductance in Eq.~\eqref{eq:conductance} should be quantized: \mbox{$G(E_F)=2e^2/h$} for $E_F$ within $\Delta_0$ gap; and \mbox{$G(E_F)=4e^2/h$} for $E_F$ within $\Delta_1$ gap due to one or two spin-degenerate conduction channels provided by the edge states, respectively. This is in analogy with chiral edge states of conventional time-independent TIs and their quantized conductance in Fig.~\ref{fig:fig2}. In contrast, the average conductance in Fig.~\ref{fig:fig3}(b) is $G(E_F) \approx 0.73 \times 2e^2/h$ within $\Delta_0$ gap and $G(E_F) \approx 1.87 \times 2e^2/h$ within $\Delta_1$ gap. We emphasize that these results are not an artifact of truncation of the Floquet Hamiltonian $\check{\mathbf{H}}_\mathrm{F}$ in Eq.~\eqref{eq:floquet_ham} since current in the L and R lead in Fig.~\ref{fig:fig3}(d) converge at $N_\mathrm{ph}=7$ using $\delta = 1\%$ criterion in Eq.~\eqref{eq:convergence}. Also, our Floquet-NEGF formalism~\cite{Mahfouzi2012} ensures $|I_\mathrm{L}| \equiv | I_\mathrm{R}|$ in Fig.~\ref{fig:fig3}(d) at each chosen $N_\mathrm{ph}$. We additionally plot the total density of states (DOS) $D(E) = \sum_j D_j(E)$ in Fig.~\ref{fig:fig3}(c) which is nonzero within the gaps $\Delta_0$ and $\Delta_1$ due to contributions from the local DOS (LDOS) $D_j(E)$ originating [Fig.~\ref{fig:fig6}(a)] from both edges and bulk of ZGNR. The LDOS is extracted from the Floquet-retarded-GF in Eq.~\eqref{eq:floquet_GF} using \begin{equation}\label{eq:ldos} D_j (E) = \frac{i}{2\pi} \bra{j} \mathrm{Tr}_T [\check{\bold{G}}^r(E) - \check{\bold{G}}^a(E)] \ket{j}, \end{equation} where $\mathrm{Tr}_T$ is the partial trace over states in $\mathcal{H}_T$. The issue of positivity of DOS and LDOS obtained from the Floquet-retarded-GF has been discussed extensively~\cite{Rudner2020,Uhrig2019}. Even though Floquet TI in irradiated ZGNR does not exhibit quantized conductance plateau in Fig.~\ref{fig:fig3}(b), its conductance is largely insensitive to ED. For example, $G(E_F)$ is reduced by $\sim 2$\% within $\Delta_0$ gap and by $\sim 15$\% within $\Delta_1$ gap upon introducing edge vacancies. Nevertheless, this is still less robust than conventional time-independent TIs whose conductance within the topologically nontrivial band gap is completely insensitive to ED, as shown in Figs.~\ref{fig:fig2}(e)--(g). The disorder is introduced by removing carbon atoms on the top and bottom edges of the scattering region, as illustrated in Fig.~\ref{fig:fig4}(b), while imposing the following conditions: (\emph{i}) ED introduced in NIR ZGNR leads to complete conductance suppression $G(E_F) \rightarrow 0$ within the same energy interval defined by $\Delta_0$ gap; ({\em ii}) ED preserves the left-right symmetry of the device, so that charge pumping is absent when the ED ZGNR is irradiated with circularly polarized light~\cite{FoaTorres2005,Bajpai2019,FoaTorres2014} in the absence of dc bias voltage $V_b=0$. Note that in the case of vacancies at the edges of QSHI, our tight-binding Hamiltonian in Eq.~\eqref{eq:kane_mele_ham} does not capture possibility of formation of a localized magnetic moment at the vacancy site which requires first-principles Hamiltonians~\cite{Vannucci2020}. This opens a possibility of backscattering involving spin flip which will disrupt~\cite{Vannucci2020} (nearly) quantized conductance in Fig.~\ref{fig:fig2}(g). \subsection{Spatial profiles of local current density: Floquet TI vs. QHI, QAHI and QSHI}\label{sec:results_b} The spatial profiles of local current density, i.e., bond current $J_{ij}^\mathrm{neq}$ defined in Eqs.~\eqref{eq:floquet_bc} and ~\eqref{eq:loc_j_ss} for Floquet TI and conventional time-independent TIs, respectively, allows us to visualize how electrons transition from topologically trivial NM leads into chiral edge states within the TI region. Figures~\ref{fig:fig4}(c), ~\ref{fig:fig4}(e) and ~\ref{fig:fig4}(g) shows that bulk states contribute to current density within the leads, but current density becomes confined to narrow flux near the edges of QHI, QAHI and QSHI. The width of the flux corresponds to spatial extent of the edge state. As expected due to chirality of edge states, current flows only along the top edge in QHI and QAHI, while in QSHI it flows on both the top and bottom edges~\cite{Nowack2013}. This is because boundaries of QSHI host a pair of spin-polarized edge states~\cite{Kane2005}, so that on the top edge electrons with spin $\sigma=\uparrow$ move from left to right while at the bottom edge electrons with spin $\sigma=\downarrow$ move from left to right. Upon introducing ED in Figs.~\ref{fig:fig4}(d), ~\ref{fig:fig4}(f) and ~\ref{fig:fig4}(h), topological protection and quantized transport through edge states manifest by local current density circumventing the disorder since any backscattering would require to cross over to the other edge which is forbidden due to the absence of bulk states~\cite{Buttiker1988}. In contrast, local current density is nonzero within the whole Floquet TI in Fig.~\ref{fig:fig4}(a), with larger flux near the edges [Fig.~\ref{fig:fig5}(a)]. Upon introducing ED, the edge flux circumvents the disorder but due to general nonlocality of quantum transport bulk flux is also reduced [Fig.~\ref{fig:fig5}(b)] which explains slight reduction of conductance in Fig.~\ref{fig:fig3}(b) within gaps $\Delta_0$ and $\Delta_1$. \begin{figure} \includegraphics[width=\linewidth]{fig5.pdf} \caption{Spatial profile of local current density in Figs.~\ref{fig:fig4}(a) and ~\ref{fig:fig4}(b) over the transverse cross section within: (a) pristine Floquet TI; or (b) Floquet TI with edge disorder. The position of the transverse cross section is marked by dashed vertical line in Figs.~\ref{fig:fig4}(a) and ~\ref{fig:fig4}(b), respectively. The horizontal dashed line in both panels marks the extent of the edge state.} \label{fig:fig5} \end{figure} Interestingly, SQUID-based imaging of QSHI made from HgTe quantum wells has found that gate tuning of bulk conductivity can lead to transport regime where edge and bulk local current densities {\em coexist}~\cite{Nowack2013}. The trace of local current density is scanned by detecting its magnetic field produced according to the Biot-Savart law, which is possible even through the top gate employed to tune the carrier density. In this regime, experimental images were analyzed to quantify contribution of edge and bulk local currents to the total current. We perform similar analysis in Fig.~\ref{fig:fig5} which shows that in pristine Floquet TI from Fig.~\ref{fig:fig4}(a), edge current contributes 44\% and bulk current contributes 56\% to the total current over the transverse cross section [marked by dashed line in Fig.~\ref{fig:fig4}(a)]. Conversely, in the presence of edge disorder in Fig.~\ref{fig:fig4}(b), edge current contributes 52\% and bulk current contributes 48\% to the total current over the same transverse cross section. \subsection{Proposed experimental schemes for probing edge vs. bulk transport within Floquet TI: Graphene nanopore and magnetic field imaging}\label{sec:exp} \begin{figure} \includegraphics[width=8.5cm]{fig6.pdf} \caption{(a) The LDOS [Eq.~\eqref{eq:ldos}] evaluated at $E = \hbar\omega/2$ in the center of $\Delta_1$ gap in Fig.~\ref{fig:fig3}(a) for irradiated pristine ZGNR. (b) The LDOS evaluated at $E=\hbar\omega/2$ for irradiated ZGNR with a nanopore drilled in the interior of the nanoribbon. (c) Time-averaged local bond current [Eq.~\eqref{eq:floquet_bc}] in the same irradiated ZGNR with a nanopore as in (b). (d) Zero-temperature two-terminal conductance $G(E_F)$ of irradiated ZGNR with a nanopore (orange line) vs. conductance of irradiated pristine ZGNR (blue line) within the gap $\Delta_1$ in Fig.~\ref{fig:fig3}(a). The former is reduced by $\sim 28\%$ with respect to the latter. In all panels we use $\hbar\omega = 3\gamma$, $z=0.5$ and $N_\mathrm{ph} = 7$.} \label{fig:fig6} \end{figure} The spatial profiles of local current density of conventional time-independent TIs in Figs.~\ref{fig:fig4}(c)--(h) indicate that any disorder introduced in the interior of ZGNR will have no effect on the two-terminal conductance in Fig.~\ref{fig:fig2}. This was explicitly demonstrated in Ref.~\cite{Chang2014} for the case of QSHI (based on graphene plus heavy adatoms). Therefore, we propose to employ a nanopore in the ZGNR interior as the simplest technique that can detect the presence of bulk current density in Figs.~\ref{fig:fig4}(a) and ~\ref{fig:fig4}(b) in the case of Floquet TI. We introduce nanopore in Figs.~\ref{fig:fig6}(b) and ~\ref{fig:fig6}(c) in such a way that it preserves the left-right symmetry of the device in order to avoid any charge pumping by time-dependent potential of light~\cite{FoaTorres2005,Bajpai2019,FoaTorres2014}. In experiments, nanopores are routinely drilled, without disrupting the surrounding honeycomb lattice of graphene, for applications like DNA sequencing~\cite{Heerema2016}, and they could also be deployed to block phonon transport in thermoelectric applications~\cite{Chang2014,Chang2012}. Figures~\ref{fig:fig6}(a) and ~\ref{fig:fig6}(b) confirms that nanopore does not impair high LDOS [Eq.~\eqref{eq:ldos}] near the edges of the Floquet TI, which correspond to chiral edge states from Fig.~\ref{fig:fig3}(a). Figure~\ref{fig:fig6}(c) shows that local transport in the presence of nanopore utilizes {\em both} left-to-right moving chiral edge states and bulk states. Since electrons flowing through the bulk are backscattered by the nanopore, presence of nanopore reduces conductance by about $\simeq 28$\% in Fig.~\ref{fig:fig6}(d) within the gap $\Delta_1$. A more detailed probing of edge vs. bulk transport in $\sim\mu$m-sized devices, such as those employed in recent experiments~\cite{McIver2020} to convert graphene into Floquet TI, could be achieved using diamond NV centers. The device can be fabricated on a diamond containing high-density, near-surface NV ensemble~\cite{Tetienne2017,Ku2020}, along with a graphite top gate separated by hexagonal boron nitride to tune the carrier density~\cite{Ku2020}. The spin state of NV centers, which serve as the sensor of magnetic field produced by local current density, can be optically initialized and readout via imaging the NV photoluminescence onto a camera. Such a setup has the advantages of being able to operate over a wide range of temperatures, from cryogenic to room temperature (e.g., the experiment in Ref.~\cite{McIver2020} was done at 80 K); it can be readily integrated with an optical cryostat necessary for experiments involving THz radiation; and it has less stringent vibrational requirement compared to scanning setups. We note that THz radiation is far detuned from any of the NV orbital/spin transitions and hence it will not affect NV centers at all. In Ref.~\cite{McIver2020}, a constant DC bias generates a current \mbox{$I \simeq 125$ $\mu$A}, and THz pulses drive the system into Floquet TI state for about \mbox{$3$ ps} at \mbox{$\sim 210$ kHz} repetition rate. Hence, one has a time-averaged typical current density \mbox{$\bar{J}_{\mathrm{F}}\sim 80$ pA/$\mu$m} in a 1-$\mu$m-wide device. This corresponds to a typical stray magnetic field \mbox{$\mu_0 \bar{J}\sim 0.1$ nT}, where $\mu_0$ is the permeability of free space. While it is a small field, its measurement is attainable with existing NV sensing technologies. For example, a single NV can sense $\sim$ nT field with a Hahn-echo sequence over 100 seconds signal averaging at room temperature~\cite{Maze2008}. Detection of \mbox{$\sim 0.1$ nT} field is attainable in combination with entanglement-assisted repetitive readout~\cite{Neumann2010,Lovchinsky2016}, which is available for NV ensemble, as well as with enhanced coherence at cryogenic temperatures and with dynamical decoupling sequences~\cite{BarGill2013}. One can measure the differential current density \mbox{$\Delta J(x,y)\equiv J_{\mathrm{FTI}}(x,y)-J_{\mathrm{NIR}}(x,y)$}, where $J_{\mathrm{FTI}}(x,y)$ [$J_{\mathrm{NIR}}(x,y)$] is current density within the Floquet TI [nonirradiated normal phase], by pulsing on the THz radiation during one free precession time of the Hahn-echo and keeping the THz drive off during the other free precession. The current density $J_{\mathrm{NIR}}(x,y)$ can be measured separately in a Hahn-echo measurement without any THz pulses to enable one to extract $J_{\mathrm{FTI}}(x,y)$. Diffraction-limited optical imaging of magnetic field has resolution $\sim$ 400 nm~\cite{Ku2020}, which is enough to resolve edge currents separated by a width of 1 $\mu$m. With further improvement in spatial resolution, we anticipate that $\sim$ 10 nm resolution can be achieved by using the Fourier gradient imaging~\cite{Arai2015}. \section{Conclusions}\label{sec:conclusions} In conclusion, using steady-state NEGF formalism applied to two-terminal Landauer-B\"{u}ttiker setup [Fig.~\ref{fig:fig1}(b)] with scattering region consisting of conventional time-independent TIs---such as QHI, QAHI and QSHI defined on graphene nanoribbon in order to generate chiral edge states of {\em finite} length---we demonstrate that their conductance is never perfectly quantized [Fig.~\ref{fig:fig2}]. This is due to backscattering at the NM-lead/2D-TI interface. Nevertheless, it remains very close to perfect plateau at $2e^2/h$ within the topologically nontrivial band gap, and it is completely insensitive to edge disorder. The spatial profiles of local current density visualize how electrons flow from bulk states within topologically trivial NM leads into the narrow flux defined by edge states within the TI region, while circumventing any edge disorder within the TI region. In contrast, when the scattering region is converted into the Floquet TI by irradiating graphene nanoribbon by circularly polarized light, conductance within light-induced topologically nontrivial band gaps is not quantized, but it changes little with edge disorder. This results confirm previous findings in the literature~\cite{FoaTorres2014,Farrell2016} while ensuring proper convergence and charge current conservation in the solution of Floquet-NEGF equations~\cite{Mahfouzi2012}. Furthermore, we employ such charge-conserving Floquet-NEGF formalism to compute spatial profiles of local current density. They are higher along the edges [Fig.~\ref{fig:fig5}(a)], following high LDOS near the edges [Fig.~\ref{fig:fig6}(a)], but they remains nonzero also in the interior of the Floquet TI [Fig.~\ref{fig:fig4}(a)]. Such spatial profiles make it also possible to refine previous qualitative estimates of edge vs. bulk contribution to current through Floquet TI~\cite{Esin2018} with precise measure from Figs.~\ref{fig:fig4}(a), ~\ref{fig:fig4}(b) and ~\ref{fig:fig5} which show that edge currents and bulk currents contribute nearly equally to the total current. Thus, observing quantized transport in Floquet TI would require to minimize coupling to bulk states. We propose a very simple experimental technique to detect presence or absence of bulk states in quantum transport through Floquet TI---conductance measurements under laser irradiation should be performed using uniform graphene flake, as in the very recent experiments~\cite{McIver2020}, as well as repeated after a nanopore~\cite{Heerema2016} is drilled in the interior of the flake. If local current density is nonzero in the bulk, it will be scattered by the nanopore which leads to $\simeq 28$\% reduction [Fig.~\ref{fig:fig6}(d)] of the two-terminal conductance when compared to graphene nanoribbon without the nanopore. Finally, we delineate more sophisticated experimental schemes for direct imaging~\cite{Ku2020} of magnetic field produced by edge and bulk local current densities based on diamond NV centers whose orbital/spin transitions are far detuned from THz radiation employed~\cite{McIver2020} in recent experiments to convert graphene into Floquet TI. \begin{acknowledgments} We thank L. E. F. Foa Torres, J. Gong and L. Vannucci for insightful discussions. This research was supported by the US National Science Foundation (NSF) under Grant No. ECCS 1922689. \end{acknowledgments}
\section{Introduction} The discovery of superconductivity in doped nickel oxides Nd$_{0.8}$Sr$_{0.2}$NiO$_2$~\cite{Li_2019,Sawatzky19} has attracted intensive interests both in experiment~\cite{Hepting_2020,Q_Li_2020,Zhou_2020,Fu_arXiv,Lee_2020,D_Li_2020,Zeng_arXiv,Goodge_arXiv,BX_Wang_2020,Q_Gu_arXiv,Osada_2020} and theory~\cite{Hepting_2020,Botana_2020,Sakakibara_2020,Hirsch_2019, Nomura_2019,Hirayama_2020,Gao_arXiv,Singh_arXiv, Jiang_2020,Ryee_2020,HuZhang_2020,GM_Zhang_2020,Z_Liu_2020, Wu_2020,Been_arXiv,Lang_arXiv,Leonov_2020,Leonov_arXiv_2, Werner_2019,Petocchi_arXiv,Y_Gu_2020,Liang_Si_2020,Lechermann_2020,Lechermann_arXiv,Karp_2020,Kitatani_arXiv,Y_Wang_arXiv Zhang_2020,LH_Hu_2019,Chang_arXiv, Z_Wang_arXiv, P_Jiang_2019,Choi_2020, Geisler_2020,He_2020,Bernardini_2020c, Talantsev_2020,T_Zhou_2020,Bernardini_2020, Bernardini_2020b,Olevano_2020,Choi_arXiv,Adhikary_arXiv,Nica_arXiv}, because the nickelate might be an analog of the well known high-$T_{\rm c}$ superconductor, cuprates. Recently, the doping dependence has been explored both theoretically~\cite{Kitatani_arXiv} and experimentally~\cite{D_Li_2020,Zeng_arXiv}, and the presence of the superconducting dome has been confirmed~\cite{D_Li_2020,Zeng_arXiv}. The maximum superconducting transition temperature $T_{\rm c}$ is about 15 K, not very high compared to that of the high-$T_{\rm c}$ cuprates. However, because the Bardeen-Cooper-Schrieffer (BCS) phonon mechanism cannot explain the observed $T_{\rm c}$~\cite{Nomura_2019}, the superconducting mechanism is most likely unconventional, in which the electron correlations play an important role~\cite{Sakakibara_2020,Wu_2020,Kitatani_arXiv,Adhikary_arXiv}. A recent observation of $d$-wave like superconducting gap also supports this scenario~\cite{Q_Gu_arXiv}. Here, a natural question arises: is there any possibility to realize $T_{\rm c}$ as high as the cuprates in nickelates? In the cuprates, the superconductivity emerges by doping carriers into the antiferromagnetic Mott insulator having a large magnetic exchange coupling $J$ ($\sim$130 meV)~\cite{Lee_Nagaosa_Wen_2006}. One of the reasons for the large $J$ is because the cuprates belong to the charge-transfer type in the Zaanen-Sawatzky-Allen diagram~\cite{Zaanen_1985}, and the charge-transfer energy $\Delta_{dp}$ (the energy difference between the copper $3d$ and oxygen 2$p$ orbitals) is small among transition metal oxides. Although the mechanism of the high-$T_{\rm c}$ superconductivity is highly controversial, the large $J$ is a plausible factor in enhancing the $d$-wave superconductivity in the cuprates~\cite{Ogata_2008}. This large value of $J$ is certainly a characteristic feature of the cuprates, which makes the cuprates very different from other transition metal oxides. On the other hand, in the case of the nickelate NdNiO$_2$, $\Delta_{dp}$ is larger than that of the cuprates~\cite{Lee_2004}. Thus, naively, we expect smaller $J$ for nickelates. Indeed, a recent experimental estimate using the Raman spectroscopy gives $J = 25$ meV~\cite{Fu_arXiv}. However, it should be noted that the origin of small $J$ in NdNiO$_2$ may be ascribed to another notable difference from the cuprates, namely, NdNiO$_2$ is not a Mott-insulator due to the self-doping effect. In NdNiO$_2$, orbitals in the Nd layer form extra Fermi pockets on top of the large Fermi surface formed by the Ni 3$d_{x^2-y^2}$\xspace orbital, and the Ni 3$d_{x^2-y^2}$\xspace orbital is hole-doped, i.e., the filling of the Ni $3d$ orbitals deviates from $d^9$~\cite{Lee_2004,Botana_2020,Sakakibara_2020,Gao_arXiv,Liang_Si_2020,Olevano_2020}. The self-doping naturally explains the absence of Mott-insulating behavior in NdNiO$_2$. Although it has been shown that the Ni 3$d_{x^2-y^2}$\xspace orbital forms a two-dimensional strongly-correlated system~\cite{Nomura_2019}, $J$ at the $d^9$ configuration with half-filled $d_{x^2-y^2}$\xspace orbital is masked by the self-doping. The experimental estimate should be understood as the $J$ value including the effect of the self-doping, not the $J$ value at the ideal $d^9$ configuration. One of the reasons for the controversy in theory about the size of $J$~\cite{Jiang_2020,Ryee_2020,HuZhang_2020,GM_Zhang_2020,Z_Liu_2020,Wu_2020,Been_arXiv,Lang_arXiv,Leonov_2020,Leonov_arXiv_2} is ascribed to the ambiguity in calculating $J$ (whether we calculate $J$ at $d^9$ filling or $J$ including the self-doping effect). In any case, it is a non-trivial problem whether we can justify the mapping onto a simple spin model to understand the property of NdNiO$_2$. This fact makes NdNiO$_2$ an imperfect analog of the cuprates. Recently, there was a proposal to design cuprate-analog nickelates without the complication of the self-doping~\cite{Hirayama_2020} \footnote{See also Refs.~\cite{Bernardini_2020b,Nica_arXiv} for other attempts to find nickelate superconductors.}. Since NdNiO$_2$ is a layered material, one can systematically propose nickelate family materials by changing the composition of the ``block-layer" \cite{Tokura_1990} between NiO$_2$ layers. Proposed dynamically stable nickelates have smaller Fermi pockets of the block-layer orbitals than NdNiO$_2$. In some materials, the self-doping is completely suppressed, and the ideal $d^9$ system with half-filled 3$d_{x^2-y^2}$\xspace orbital is realized. An {\it ab initio} estimate of Hubbard $U$ using the constrained random-phase approximation (cRPA)~\cite{Aryasetiawan_2004} shows that the correlation strength $U/t$ ($t$: nearest-neighbor hopping) is comparable to that of cuprates~\cite{Hirayama_2020}. Therefore, once such nickelates are synthesized, the mother compounds will be a Mott insulator similarly to the cuprates, and the effective model becomes the Heisenberg model, which gets rid of the ambiguity in calculating $J$. In this paper, we study the strength of $J$ in the two ideal $d^9$ nickelates, which are free from the self-doping (see Sec~\ref{sec_materials} for the details of the materials). We estimate the $J$ value by the following three methods~\cite{Lichtenstein_2013}. First, we start from a single-orbital Hubbard model derived in Ref.~\onlinecite{Hirayama_2020} and then evaluate $J$ by the expansion in terms of $t/U$. Second, we perform an energy mapping between the classical Heisenberg model and the total energy of different magnetic configurations calculated by the LDA+$U$ (LDA: local density approximation) method. Third, we employ a scheme based on the so-called local force theorem. Hereafter, we simply call these three methods ``strong-coupling expansion", ``energy mapping method", and ``local force approach", respectively. We show that the three independent estimates show reasonable agreement and conclude that the $d^9$ nickelates have sizeable $J$ (about 100 meV), which is not far smaller than that of the cuprates. Therefore, the proposed $d^9$ nickelates provide an interesting playground to explore the cuprate-analog high-$T_{\rm c}$ superconductivity. The paper is organized as follows. In Sec.~\ref{sec_materials}, we introduce two ideal $d^9$ nickelates, RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$: a cation with the valence of $2.5+$) and discuss the advantage over NdNiO$_2$. In Sec.~\ref{sec_methods}, we explain the three methods employed in the present study, and we show the results in Sec.~\ref{sec_results}. Section~\ref{sec_summary} is devoted to the summary. \begin{figure*}[tb] \vspace{0.0cm} \begin{center} \includegraphics[width=0.98\textwidth]{fig_structure_band.pdf} \caption{ Crystal structure of (a) RbCa$_2$NiO$_3$\xspace and (c) $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$: a cation with the valence of $2.5+$) and the paramagnetic DFT band structure [(b) RbCa$_2$NiO$_3$\xspace and (d) $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace)]. The blue dotted curves are the Wannier band dispersion of the Ni 3$d_{x^2-y^2}$\xspace single-orbital Hamiltonian. In (b) and (d), the consistent ${\bf k}$ path is employed: $(0,0,0)$ $\rightarrow$ $(\pi/a,0,0)$ $\rightarrow$ $(\pi/a,\pi/a,0)$ $\rightarrow$ $(0,0,0)$ $\rightarrow$ $(0,0,\pi/c)$ $\rightarrow$ $(\pi/a,0,\pi/c)$ $\rightarrow$ $(\pi/a,\pi/a,\pi/c)$ $\rightarrow$ $(0,0,\pi/c)$ (The symbols are different because the primitive cells of RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace are tetragonal and bace-centered tetragonal, respectively). } \label{Fig_crystal_structure} \end{center} \end{figure*} \section{Materials: $d^9$ nickelates} \label{sec_materials} In Ref.~\cite{Hirayama_2020}, various layered nickelates have been systematically proposed. They are classified into ``1213", ``1214", ``H$_2$", and ``G" families, depending on the composition and the type of the block-layer~\cite{Tokura_1990}. Among the four families, the compounds without the self-doping exist in the 1213 and G families. We here take RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$: a cation with the valence of $2.5+$) for a representative of the ideal $d^9$ nickelates belonging to 1213 and G families, respectively (see Figs.~\ref{Fig_crystal_structure}(a) and (c) for the crystal structure). In the following, we employ Ba$_{0.5}$La$_{0.5}$\xspace as $A$. The phonon calculations have shown that both RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace) are dynamically stable~\cite{Hirayama_2020}. We take the crystal structure optimized in Ref.~\cite{Hirayama_2020}, and perform density-functional theory (DFT) calculations~\footnote{Here, we ignore the interface effect~\cite{Geisler_2020,He_2020,Bernardini_2020c} and consider the bulk property. Note that the thickness of the film reaches around 10 nm and there are several tens of NiO$_2$ layers in the sample~\cite{Lee_2020}.}. Figs.~\ref{Fig_crystal_structure}(b) and \ref{Fig_crystal_structure}(d) show the paramagnetic DFT band structure for RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace), respectively. As is shown in Ref.~\cite{Hirayama_2020}, only the Ni 3$d_{x^2-y^2}$\xspace orbital crosses the Fermi level. As far as the topology of the band structure is concerned, these systems are more similar to the cuprates than NdNiO$_2$. The advantages of studying these nickelates rather than NdNiO$_2$ are as follows. First, it is still controversial whether the role of Nd-layer (block-layer) orbitals is essential or not. If the hybridization between Ni $3d$ and Nd-layer orbitals is substantial, the Nd-layer orbitals are not only a charge reservoir, but they might give Kondo-like physics~\cite{Sawatzky19,Hepting_2020,GM_Zhang_2020,Z_Wang_arXiv,Y_Gu_2020}. In the cases of the $d^9$ nickelates, RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace), the block-layer orbitals do not show up at the Fermi level, and this controversy can be avoided. We can also exclude the possible role of the $4f$ orbitals with localized moments proposed in Refs.~\cite{P_Jiang_2019,Choi_2020}. Another controversial issue for NdNiO$_2$ is to which orbitals the doped holes go ($d^9 \underline{L}$ vs. $d^8$, where $\underline{L}$ denotes a hole in a ligand oxygen). In the case of the cuprates (charge-transfer insulator), the holes are doped into the oxygen $2p$ orbitals. On the other hand, the nickelates have larger $\Delta_{dp}$ and are classified as Mott-Hubbard type~\cite{Hepting_2020,Jiang_2020,Nomura_2019,HuZhang_2020,Fu_arXiv,Goodge_arXiv}. Because there is nonzero hybridization between Ni 3$d_{x^2-y^2}$\xspace and O $2p$ orbitals, some of the holes should be doped into oxygen $2p$ orbitals~\cite{Hirsch_2019,Karp_2020,Lang_arXiv}. However, the amount should be smaller than that of the cuprates. When the system is Mott-Hubbard type and the holes mainly reside in the Ni $3d$ orbitals, another issue arises: which model is more appropriate, the single-orbital or multi-orbital model? In other words, whether the doped $d^8$ configuration favors high-spin state or low-spin state. If the crystal field splitting between Ni 3$d_{x^2-y^2}$\xspace and the other $3d$ orbitals is much larger than the Hund's coupling, holes stay within the Ni 3$d_{x^2-y^2}$\xspace orbital, and the single-orbital model is justified. On this issue, several studies insist that Ni $3d$ multi-orbital nature cannot be ignored~\cite{Jiang_2020,Zhang_2020,Werner_2019,Petocchi_arXiv,LH_Hu_2019,Lechermann_2020,Lechermann_arXiv,Y_Wang_arXiv,Chang_arXiv,Choi_arXiv}. To resolve this issue, we certainly need more experimental evidences. In the cases of RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace), compared to NdNiO$_2$, the Ni 3$d_{x^2-y^2}$\xspace orbital is more isolated in energy space from the other $3d$ orbitals [see Figs.~\ref{Fig_crystal_structure}(b) and \ref{Fig_crystal_structure}(d)]: In the case of NdNiO$_2$, due to the dispersion along the $k_z$ direction, the position of the Ni $d_{3z^2-r^2}$\xspace band becomes close to the Fermi level on the $k_z = \pi/c$ plane; however, such $k_z$ dependence is much weaker in RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace). Considering also the above-mentioned absence of the complication from the self-doping, in this study, we adopt the single-orbital Hubbard model as a minimal model for RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace). In the absence of the carrier doping, we can further map onto the spin model with the exchange coupling $J$. \section{Methods} \label{sec_methods} Here, we introduce three different methods to estimate $J$ (see eg., Ref.~\cite{Lichtenstein_2013} for the ideas behind the three methods). We employ the following convention for the spin Hamiltonian: ${\mathcal H} = \sum_{\langle i,j \rangle } J_{ij} {\bf S}_i \cdot {\bf S}_j$, where $\langle i,j \rangle$ is the bond consisting of sites $i$ and $j$, and ${\bf S}_i$ is the spin-1/2 operator at site $i$. $J$ stands for the nearest-neighbor $J_{ij}$ interaction in the NiO$_2$ layer. \subsection{Strong-coupling expansion} \label{sec_method_superexchange} When the single-orbital Hubbard model is a good description, the magnetic interactions in the Mott insulating region can be obtained by strong-coupling perturbation expansion. The strong-coupling expansion becomes valid in the region $U \gtrsim W$ with the bandwidth $W$ (in the square lattice $W =8t$)~\cite{Otsuki_2019}. RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace) with $U/t = $9.522 and 10.637, respectively~\cite{Hirayama_2020}, satisfy the condition $U > W$. In the strong-coupling expansion, the superexchange interaction $J_{\rm s}$ (with $t^4$-order correction term) and cyclic ring-exchange interaction $J_{\rm c}$ are given by $J_{\rm s} = 4 t^2 / U - 24 t^4 / U^3$ and $J_{\rm c} = 80 t^4 / U^3$, respectively~\cite{Takahashi_1977,MacDonald_1988,Delannoy_2009}. If we effectively take into account the effect of the ring-exchange interaction in the nearest-neighbor interaction $J$, the $J$ value becomes \begin{eqnarray} J = J_{\rm s} - 2J_{\rm c} S^2 = \frac{4 t^2} {U} - \frac{64 t^4 }{U^3} \end{eqnarray} with $S=1/2$. \subsection{Energy mapping method} \label{sec_method_LDA+U} Within the LDA+$U$~\cite{Anisimov_1991,Anisimov_1993,Liechtenstein_1995,Cococcioni_2012}, we perform the magnetic calculations. Here, $U$ is introduced into the Ni 3$d$ orbital subspace. We employ $2\times2\times1$ supercell consisting of four conventional cells. We simulate two different magnetic solutions: one is N\'eel type [$(\pi/a,\pi/a,0)$ antiferromagnetic order] and the other is stripe type [$(\pi/a,0,0)$ antiferromagnetic order]. We calculate the energy difference $\Delta E$ between the two antiferromagnetic solutions. When we assume the two-dimensional classical spin-1/2 Heisenberg model up to next-nearest-neighbor magnetic interaction $J'$, $\Delta E$ per formula unit is given by $\Delta E = J/2 - J' \simeq J/2$. We estimate $J$ with this equation. \subsection{Local force approach} \label{sec_method_Liechtenstein} Based on the N\'eel-type solutions of the LDA+$U$ calculations, we estimate $J$ and $J'$ using the local force theorem~\cite{Lichtenstein_2013}. The local force approach estimates the magnetic interactions from the small energy change induced by the infinitesimal spin-rotation from the magnetic solutions (N\'eel-type in the present case). We employ the so-called Lichtenstein formula, which is recently developed in the low-energy Hamiltonian with the Wannier orbitals~\cite{Korotin_2015,Nomoto_2020_1,Nomoto_2020_2}, given by, \begin{align} (-1)^PJ_{ij}= 4T\sum_{\omega_n}{\rm Tr}[G_{ij}(\omega_n) M_j G_{ji}(\omega_n) M_i],\label{eq:licht} \end{align} where $\omega_n= (2n+1) \pi T$ denotes the Matsubara frequency. Here, we set $P=0$ (1) when the spins at $i$ and $j$ sites are aligned parallel (anti-parallel) to each other. The Green's function $G_{ij}$ is defined by $G_{ij}^{-1}(i\omega_n)=(i\omega_n+\mu)\delta_{ij}-{\mathcal H}^0_{ij}$, where ${\mathcal H}^0_{ij}$ is the hopping matrix of the Wannier tight-binding model, and $\mu$ is the chemical potential. Note that ${\mathcal H}^0_{ij}$ is a $N_{{\rm orb}_i}\times N_{{\rm orb}_j}$ matrix, where $N_{{\rm orb}_i}$ is the number of Wannier orbitals at $i$-site including the spin index. In the case of collinear magnets, one may write ${\mathcal H}^0_{ii}$ as ${\mathcal H}^0_{ii}= \varepsilon_{i}\otimes\sigma_0 + m_i\otimes\sigma_z$. Then, $M_i$ is defined by $M_i=m_i \otimes \sigma_x$ and proportional to the exchange splitting at $i$-site $m_i$. Here, we have neglected the spin-dependent hopping term of $M_i$ (see Ref.~\onlinecite{Nomoto_2020_1} for details~\footnote{Note that the $J_{ij}$ value in this paper is defined to be eight times as large as that in Ref. ~\onlinecite{Nomoto_2020_1}}). \subsection{Comparison among the three methods} \label{sec_method_comparison} The strong-coupling expansion gives local (in real-space) $J$, the energy mapping method sees the energy difference between the global and local minima of the magnetic solutions, and the local force method sees the low-energy excitations around the global minimum. These $J$ are complementary to each other, and hence we employ all the three methods. When the Coulomb repulsion is much larger than the bandwidth and the mapping to the Heisenberg model becomes valid, these three methods see the same $J$. As we will show in Sec.~\ref{sec_results}, the three results agree reasonably well as expected from a Mott insulating behavior of the proposed $d^9$ nickelates. \subsection{Calculation conditions} \label{sec_method_condition} The DFT band structure calculations are performed using {\textsc{Quantum ESPRESSO}}\xspace~\cite{QE-2017}. We employ Perdew-Burke-Ernzerhof (PBE)~\cite{Perdew_1996} norm-conserving pseudopotentials downloaded from PseudoDojo~\cite{Setten_2018} [the pseudopotentials are based on ONCVPSP (Optimized Norm-Conserving Vanderbilt PSeudopotential)~\cite{Hamann_2013}]. The energy comparison between the N\'eel- and stripe-type antiferromagnetic solutions is performed using $9\times 9 \times 7$ and $9\times 9 \times 3$ {\bf k}-mesh for RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace), respectively. We treat Ba$_{0.5}$La$_{0.5}$\xspace by the virtual crystal approximation. The energy cutoff is set to be 100 Ry for the Kohn-Sham wave functions, and 400 Ry for the electron charge density. For the estimate of $J$ based on the local force approach, we first construct the maximally localized Wannier functions~\cite{Marzari_1997,Souza_2001} for the N\'eel-type antiferromagnetic band structure using RESPACK~\cite{Nakamura_arXiv,RESPACK_URL}. For RbCa$_2$NiO$_3$\xspace, we use $5\times 5 \times 5$ {\bf k}-mesh for the construction of Wannier orbitals. We put Ni $d$, O $p$, Ca $d$, and interstitial-$s$ (located at the interstitial positions surrounded by Ni$^{+}$, Ca$^{2+}$, and Rb$^{+}$ cations) projections. The interstitial orbitals are stabilized because they feel attractions from the surrounded cations~\cite{Nomura_2019}. Then, we obtain 104 orbital (per spin) tight-binding Hamiltonian. For $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace), we employ $5\times 5 \times 3$ {\bf k}-mesh for constructing Wannier orbitals. We derive 232 orbital (per spin) tight-binding Hamiltonian using the projections of Ni $d$, O $p$, Br $p$, $A$ $d$, and interstitial-$s$ (located at the interstitial positions surrounded by Ni$^{+}$, $A^{2.5+}$, and Br$^{-}$ ions) orbitals. In the calculation of Eq.~\eqref{eq:licht}, we employ $16\times16\times16$ $\bf k$-mesh and set the inverse temperature $\beta= 200$~eV$^{-1}$ for both cases. We have confirmed that the difference of $J_{ij}$ values at $\beta= 200$ and 400~eV$^{-1}$ is less than 1 \%. We use the intermediate representation basis for the Matsubara frequency summation~\cite{Shinaoka_2017,Chikano_2019,Li_Shinaoka_2020}, and set the cutoff parameter $\Lambda=10^5$, which is sufficiently larger than $W\beta$ where $W$ is the band width. \begin{figure*}[tb] \vspace{0.0cm} \begin{center} \includegraphics[width=0.99\textwidth]{fig_LDA+U.pdf} \caption{ N\'eel-type antiferromagnetic band structure (red curves) and orbital-resolved density of states (per formula unit, per spin) for (a) RbCa$_2$NiO$_3$\xspace and (b) $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace), calculated with LDA+$U$ method ($\overline{U} = 3$ eV). The blue dotted curves are band dispersion calculated from the Wannier tight-binding Hamiltonian. The symbols for the high-symmetry ${\bf k}$ points with the underlines are defined based on $2\times2\times1$ supercell consisting of four conventional cells. The origin of the energy axis is set to be the middle of the gap. The orbital-resolved density of states is calculated from the Wannier tight-binding Hamiltonian. ``I-$s$" stands for the interstitial-$s$ orbitals (see Sec.~\ref{sec_method_condition} for the details of the projections used in the Wannier construction). (c) The energy difference $\Delta E$ per formula unit between N\'eel- and stripe-type antiferromagnetic solutions. The N\'eel-type solutions always show lower energy. } \label{Fig_LDA+U} \end{center} \end{figure*} \section{\mbox{\boldmath$J$} in $d^9$ nickelates} \label{sec_results} \begin{figure*}[tb] \vspace{0.0cm} \begin{center} \includegraphics[width=0.99\textwidth]{fig_J.pdf} \caption{ Estimated exchange coupling $J$ for (a) RbCa$_2$NiO$_3$\xspace and (b) $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace). $\overline{U}$ is the Hubbard interaction in the LDA+$U$ calculation (the Coulomb repulsion between the Ni 3$d$ orbitals), which we distinguish from the Hubbard $U$ in the single-orbital Hubbard model used in the strong-coupling expansion (the Coulomb repulsion between the Wannier orbitals made from the Ni 3$d_{x^2-y^2}$ orbital with O $2p$ tails). See text for details. } \label{Fig_J} \end{center} \end{figure*} In the previous study~\cite{Hirayama_2020}, the effective single-orbital Hamiltonians for RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace) are constructed using maximally-localized Wannier functions~\cite{Marzari_1997,Souza_2001} and cRPA~\cite{Aryasetiawan_2004}. The derived nearest-neighbor hopping and Hubbard parameters are $t = -0.352$ eV, $U = 3.347$ eV for RbCa$_2$NiO$_3$\xspace, and $t = -0.337$ eV, $U = 3.586$ eV for $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace). Then, the strong-coupling expansion described in Sec.~\ref{sec_method_superexchange} gives $J = 122$ meV and $J=109$ meV for RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace), respectively (see Appendix~\ref{Appendix_dp} for the estimate from three-orbital $d$-$p$ model). Figures~\ref{Fig_LDA+U}(a) and \ref{Fig_LDA+U}(b) show the band structure calculated by the LDA+$U$ method for the N\'eel-type antiferromagnetic state. While the Hubbard $U$ in the single-orbital Hubbard model is the Coulomb repulsion between the Wannier orbitals made from the Ni 3$d_{x^2-y^2}$ orbital with O $2p$ tails, the $U$ interaction in the LDA+$U$ calculation is the Coulomb repulsion between the Ni 3$d$ orbitals. To make the difference clearer, we call $U$ in the LDA+$U$ calculation $\overline{U}$. In Figs.~\ref{Fig_LDA+U}(a) and \ref{Fig_LDA+U}(b), we have used $\overline{U}$ = 3 eV. In contrast to the case of the LDA+$U$ calculation for NdNiO$_2$, where the system stays metal even in the presence of antiferromagnetic order~\cite{Botana_2020,HuZhang_2020,Z_Liu_2020}, both systems become insulating. The top of the valence band has mainly Ni $3d$ character, in agreement with the classification into the Mott-Hubbard type insulator. We see that both systems are insulating even at smaller $\overline{U}$ (= 1 eV). For all the $\overline{U}$ region we studied (1-5 eV), there exists well defined spin-1/2 Ni spin moment. The results suggest that, if these $d^9$ nickelates are synthesized, they become antiferromagnetic Mott insulator as in the cuprates. Figure~\ref{Fig_LDA+U}(c) shows the energy difference $\Delta E$ per formula unit between the N\'eel- and stripe-type antiferromagnetic solutions. $\Delta E$ decreases as $\overline{U}$ increases, which is a natural behavior given that $\Delta E$ is governed by $J$ and the origin of $J$ is the superexchange interaction. In Figs.~\ref{Fig_LDA+U}(a) and \ref{Fig_LDA+U}(b), the band dispersions obtained by the Wannier tight-binding Hamiltonian, which are used in the local force approach, are also shown. The Wannier bands well reproduce the LDA+$U$ magnetic band dispersions. From $\Delta E$ in Fig.~\ref{Fig_LDA+U}(c), we perform the order estimate of $J$ by the energy mapping method with assuming $J'/J = 0.05$ (Sec.~\ref{sec_method_LDA+U}) \footnote{We do not pay special attention to the precise value of the ratio $J'/J$ because we are only interested in the order estimate of $J$.}. Then $J$ is given by $J = \Delta E / 0.45 $. We also estimate $J$ using the local force approach (Sec.~\ref{sec_method_Liechtenstein}). These results on top of the $J$ value estimated by the strong-coupling expansion (see above) are summarized in Figs.~\ref{Fig_J}(a) and \ref{Fig_J}(b) for RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace), respectively. The $J$ value in the energy mapping method changes from about 140 meV ($\overline{U}=1$ eV) to 60 meV ($\overline{U}=5$ eV). The local force approach gives $J \simeq 70$-80 meV. These estimates give the same order of $J$ as the strong-coupling expansion results [$J = 122$ meV and $J=109$ meV for RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace), respectively]. Although the energy mapping method and local force approach are based on the same LDA+$U$ calculations, we see that there is a discrepancy between the two results at small $\overline{U}$ values (although the difference is no more than two times). It should be noted that the former method sees the global change of the energy between the completely different magnetic patterns, whereas the latter approach only sees the local landscape around the N\'eel-type solutions, as described in Sec.~\ref{sec_method_comparison}. For larger $\overline{U}$, the agreement between these two results becomes better as is expected: The system can be mapped to the classical spin model with a constant $J$ regardless of the assumed magnetic structure in the local force approach. Overall, all the three estimates of $J$ lie within 60-140 meV, and we conclude that the $d^9$ nickelates have a sizable $J$ of the order of 100 meV. The agreement in the order estimate of $J$ among three independent methods shows that RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace) are indeed Mott insulators with the effective model being the Heisenberg model, and the magnetic exchange coupling $J$ is governed by the superexchange interaction [if the materials were, for example, weakly correlated, the three methods would not agree well (see Sec.~\ref{sec_method_comparison})]. Finally, we compare the $J$ value with that of the cuprates. In the cuprates, the magnitude of $J$ is intensively studied by Raman spectroscopy in the early stage~\cite{Lyons_1988_1,Lyons_1988_2,Sugai_1988}. The $J$ value for La$_2$CuO$_4$ is estimated to be about 130 meV~\cite{Singh_1989}. Systematic investigations have shown that the material dependence of $J$ in the cuprates family is weak~\cite{Sulewski_1990,Tokura_1990_raman}. The numerical study on the $d$-$p$ model has also derived $J$ as large as about 130 meV~\cite{Hybertsen_1990}. Compared to the $J$ value of 130 meV for the cuprates, our estimate based on the $d$-$p$ model giving 90-100 meV (see Appendix~\ref{Appendix_dp}) is small, which is consistent with the fact that $\Delta_{dp}$ is larger in the nickelates. However, we note that the $J$ value of about 100 meV is still significantly large, and the $d^9$ nickelates would serve as interesting cuprate-analog materials. \section{Summary} \label{sec_summary} One of the remarkable features of the high $T_{\rm c}$ cuprates is the large exchange coupling $J$, whose size is as large as 130 meV~\cite{Lee_Nagaosa_Wen_2006}. In the present study, we have evaluated the size of $J$ for $d^9$ nickelates from first principles. While the cuprates having small $\Delta_{dp}$ belong to the charge-transfer type in the Zaanen-Sawatzky-Allen diagram~\cite{Zaanen_1985}, nickelates with larger $\Delta_{dp}$ belong to the Mott-Hubbard type. To answer how large $J$ can be expected in the Mott-Hubbard insulating $d^9$ nickelates, we studied RbCa$_2$NiO$_3$\xspace and $A_{2}$NiO$_{2}$Br$_2$\xspace ($A$ = Ba$_{0.5}$La$_{0.5}$\xspace), which were recently proposed theoretically and shown to be free from the self-doping in Ref.~\onlinecite{Hirayama_2020}. By means of the strong-coupling expansion, energy mapping method, and local force approach, we found that $J$ for these nickelates is as large as 100 meV, which is not far smaller than that of the cuprates. This result suggests that the $d^9$ nickelates and cuprates share a notable common feature in the Mott insulating phase, although the former and latter belong to the Mott-Hubbard and charge-transfer regime, respectively. Finally, we note that the proposed $d^9$ nickelates might give rare examples of realizing the square-lattice Hubbard model with sizeable $J$ in real materials. Recent numerical studies show that the phase diagram of the doped Hubbard model is under severe competition between the stripe state with charge/spin modulation and $d$-wave superconductivity~\cite{Zheng_2017,Darmawan_2018,Ohgoe_2020,HC_Jiang_2019}. Therefore, once synthesized, the $d^9$ nickelates will serve as a valuable test-bed system to understand the superconductivity in the Hubbard-like model. They are also an important reference to understand the superconducting mechanism in the cuprates, because they would tell us whether the charge-transfer nature in the cuprates is essential in the high-$T_{\rm c}$ superconductivity or not. \begin{acknowledgments} We acknowledge the financial support by JSPS KAKENHI Grant No. 16H06345 (YN, MH, and RA), 17K14336 (YN), 18H01158 (YN), 19K14654 (TN), 19H05825 (RA), 20K14390 (MH), and 20K14423 (YN). This work was supported by MEXT as ``Program for Promoting Researches on the Supercomputer Fugaku" (Basic Science for Emergence and Functionality in Quantum Matter). A part of the calculations was performed at Supercomputer Center, Institute for Solid State Physics, University of Tokyo. \end{acknowledgments}
\section{Introduction} Recently, machine learning has been infused in many solutions to notoriously difficult problems in robotics. These strategies have seen a wide array of success in visual sensing\cite{espiau1992new}, task learning\cite{nehaniv2007imitation}, and human-robot cooperation\cite{trautman2015robot}, etc. It is important to understand include learning in all levels of a robot's computation stack including common sub-components to solving these problems, e.g., subroutines for solving the motion planning problem. In this work, we apply machine learning to predict the validity of robot configurations, a common procedure in sampling-based motion planners. Sampling-based approaches have seen broad applicability to many high-dimensional and complex motion planning problems in robotics\cite{denny2013lazy}, computer graphics\cite{kobbelt2004survey}, and computational biology\cite{ekenna2016adaptive}. Most of these approaches rely on the classification of robotic configurations into valid, e.g., collision-free, and invalid samples, while they work to construct graph approximations of a state space, called a roadmap. Thus, these approaches avoid full representation of the topology of the state space. However, as the dimensionality of the robot and the complexity of the workspace increase, the primitive operations of sampling-based methods become computationally obstructive\cite{bialkowski2013efficient}. Prior research has focused on improved geometric analysis techniques for collision checking\cite{lin1998collision}, approximately modeling state space obstacles to predict the collision status of robot configurations, and lazily invoking the configuration validation subroutine\cite{denny2013lazy}, among others. While these methods have shown success in many applications, none have fully and permanently bounded the computational cost of validating configurations in sampling-based motion planners. We propose a novel framework to efficiently and effectively predict the validity of robot configurations in complex motion planning problems. Figure \ref{fig:framework} shows the two parts of our framework: (1) Offline training phase: a Contractive AutoEncoder (CAE)\cite{rifai2011contractive}, is trained to embed the robot's workspace into a latent space, and a Multilayer Perceptron (MLP), is trained to predict the validity of a robots' configurations given the CAE encoding of the workspace; (2) Online sampling validation phase: a workspace is encoded into latent space by CAE and its samples are validated by MLP using that encoded workspace. We examine the potential impact of such an approach with a variety of robots in complex 2D and 3D workspaces. For this work, we mainly focus on sampling because finding valid samples becomes paramount in narrow and cluttered passages. This work presents a first step towards applying our unique autoencoder variant to Sampling-based Motion Planning (SBMP). Our results indicate that: our framework is computationally efficient in all investigated problems, and our approach generalizes well to previously un-encoded workspaces. As such, our framework can be applied to many existing sampling-based routines to improve their computational efficiency. \begin{figure*}[htb!] \centering \begin{subfigure}{0.25\textwidth} \centering \includegraphics[width=\textwidth,height=100pt]{Figs/CAE.png} \caption{Offline: Contractive AutoEncoder} \end{subfigure} \hspace{1cm} \begin{subfigure}{0.25\textwidth} \centering \includegraphics[width=\textwidth,height=100pt]{Figs/MLP.png} \caption{Offline: Multilayer Perceptron} \end{subfigure} \hspace{1cm} \begin{subfigure}{0.25\textwidth} \centering \includegraphics[width=\textwidth,height=100pt]{Figs/validation.png} \caption{Online: Sample Validation} \end{subfigure} \caption{Overview of Proposed Framework} \label{fig:framework} \vspace{-4mm} \end{figure*} \section{RELATED WORK} \subsection{Motion Planning Primitives} Let $X \subset \mathbb{R}^d$ denote a given state space, where $d \in \mathbb{N}$ is the dimensionality of the state space. The obstacle and obstacle-free state spaces are defined as $X_{obs} \subset X$ and $X_{free} = X \backslash X_{obs}$ respectively. A path $\tau$ for the robot is defined as a series of states $\{x_0, ..., x_n\}$, where n is the number of time steps in the path. A path is said to be feasible if it lies entirely in the obstacle-free space $X_{free}$ The motion planning problem is defined as: given a state space $X = X_{free}\subset X_{obs}$, an initial state $x_{init} \in X_{free}$, and a goal region $X_{goal} \subseteq X_{free}$, find a feasible path $\tau \in X_{free}$ such that $\tau_{start} = x_{init}$ and $\tau_{end} \in X_{goal}$. If no such path exists, report failure. \subsection{Sampling-based Motion Planning (SBMP)} A common solution to the motion planning problem is the utilization of sampling-based methods. Most often, sampling-based motion planners randomly select and progressively expand and connect robot configurations to form approximate graph representations of $X_{free}$, called roadmaps. A roadmap encodes valid states as its nodes and transitions between them as its edges. In order to find a path, a starting state and goal region are connected to the roadmap, and a feasible path is extracted from it. These techniques employ the invocation of a "black box" collision detection module that classifies any state in either $X_{free}$ or $X_{obs}$ to avoid explicit construction of $X_{obs}$. This is used in the verification of both the nodes and the edges of any roadmap constructed using these methodologies. Commonly sampling-based strategies offer guarantees on probabilistic completeness and asymptotic optimality \cite{ichter2018robot}. The main paradigms of sampling-based motion planning are the Probabilistic RoadMap \cite{kavraki1994probabilistic} and the Rapidly-exploring Random Tree (RRT) algorithms \cite{lavalle1998rapidly}. Both PRM and RRT are known to be probabilistically complete, i.e., if a (robust) solution exists, then a solution will almost surely be found as the number of samples increases \cite{bialkowski2013efficient}. Many proposed variations on PRM and RRT improve their performance for a variety of scenarios. Inoue et al.\cite{inoue2019robot} proposed a robot path planning method that combines RRT and long short-term memory network, which recalls the path of a robot by training with a large number of paths generated by RRT. Zhang et.al.\cite{zhang2018path} improved RRT algorithm by using a target bias sampling strategy, considering both distance and rotation angle when choosing the nearest neighbor, and making the planned path as smooth as possible using radial basis function neural network. Hauser proposed Lazy-PRM$^*$\cite{hauser2015lazy} a lazy collision checking strategy, which avoids checking connections that have no chance to improve upon the current best path, thus reducing the per-sample computational cost and accelerating solution convergence. This work likewise aims to improve the performance of sampling-based approaches --- specifically through reducing the cost of collision detection routines. \subsection {Neural Network in Motion Planning} Representation learning~\cite{bengio2013representation} mainly aims to extract features from unstructured data, to either achieve a lower dimensional representation (often referred to as encoding) or learn features for supervised learning or reinforcement learning. There have been some recent works to utilize a learned low-dimensional latent model for motion planning. Ichter et al.~\cite{ichter2018learning} and Zhang et al~\cite{zhang2018learning} used the Conditional Variational Autoencoders to learn a non-uniform sampling methodology of a sampling-based motion planning algorithm. The work in \cite{ichter2019robot} provides a new SBMP method using the learned latent space and plan motions directly in that space. Moreover, Chen et al.~\cite{chen2016dynamic} proposed a time-dependent variational autoencoder to learn dynamic motion primitives for humanoids, which could be applied to sampling configurations in motion planning. Qureshi et al.~\cite{qureshi2018motion} learned a low-dimensional representation of the obstacle space by using a Contractive Autoencoder to encode a point cloud of the obstacles into a latent space and then used a feed-forward neural network to predict the next step an optimal planner would take given a start and goal. In this work, we aim to use a lower dimensional representation to reduce the cost of collision detection for use in motion planning algorithms. The neural network is becoming prominent in path planning for its outstanding non-linear mapping ability. The shortcomings of neural network models include hardware requirements to reduce training time and difficulty of obtaining the best parameters for learning. However, with the fast development of hardware computing capabilities and undemanding requirements of path planning, those shortcomings are fading steadily. Li et al.~\cite{li2018neural} addressed a motion planning problem for vehicles with non-linear dynamics in a clustered environment using near-optimal RRT, which utilizes a neural network to estimate the cost function considering non-linear kinodynamic constraints. Moreover, Shi et al.~\cite{shi2017motion} presented a motion planning system based on hybrid deep learning, which uses a convolutional neural network to reduce the dimension of the input image, a recurrent neural network to create a path tracking model, and a fully connected neural network to construct a control model. Chen et al.~\cite{chen2015optimal} proposed an optimal robot path planning system that builds a map, plans optimal paths, and maneuvers mobile robots, in which a simplified neural network is used to calculate the optimal trajectory for the robot. In this work, we make use of the multilayer perceptron to quickly and efficiently determine the validity of generated samples for the motion planning problem. \section{RESEARCH FRAMEWORK} This section introduces our proposed framework. It is a neural network based motion planner comprised of two phases. The first phase trains a Contractive AutoEncoder and a Multilayer Perceptrons in an offline, apriori fashion. The second phase performs path finding computations online using the trained CAE and MLP. \subsection{Offline Training} The proposed framework uses two neural network models to solve the motion planning problem. The first is a CAE that embeds a representation of the workspace, corresponding to a point cloud, into a latent space. The second is a MLP which predicts the validity of a given input sample and the CAE encoding of the workspace. Thus, instead of using the information of the whole workspace to decide whether a sample is valid or invalid, only the limited information from the encoded latent space is used. \subsubsection{Contractive AutoEncoder (CAE)} The standard construction of a CAE consists of training neural networks for the encoder and the decoder. The encoder and the decoder are trained together using the reconstruction error. The output of the encoder represents a reduced representation of the initial input, and the decoder reconstructs that initial input from an encoded representation by minimizing a cost or loss function. A CAE is used to embed workspace occupancy grids $X$ into an invariant and robust latent space $Z \subseteq \mathbb{R}^m$, where $m \in \mathbb{N}$ is the dimensionality of the latent space. Let $f(x, W^e)$ be an encoding function with weight matrix $W^e$ that encodes an input vector $x \in X$ into a vector in the latent space $z \in Z$. A decoding function $g(z, W^d)$, with weight matrix $W^d$, decodes a vector from the latent space $z \in Z$ back into a vector in the workspace $x \in X$. The objective function (loss function) for the CAE is: \begin{equation} L_{CAE} = \frac{1}{|D|} \sum_{x \in D} ||x - g(f(x,W^e),W^d)||^2 + \lambda \sum_{ij} (W_{ij}^e)^2 \end{equation} where $\lambda$ is a penalizing coefficient and $D \subseteq X $ is the occupancy grid data for different workspaces. The penalizing term forces the latent space $z = f(x, W^e)$ to be contractive in the neighborhood of the training data which results in an invariant and robust feature learning~\cite{rifai2011contractive}. Since we use linear encoder, the loss function of CAE is similar to the loss function of a regularized autoencoder. Moreover, our training data mainly consists of an unlabeled representation of the environment, we apply autoencoders to learn the low-dimensional representation of the training data instead of end-to-end architecture. By using the reconstruction (error) from the decoder, we could analyze a quantifiable metric used to decide which low-dimensional representation accurately replicates our environment the best. \subsubsection{Multilayer Perceptrons (MLP)} We use a multilayer perceptron to perform sample validity. Given a workspace encoding $z = f(x,W^e) \in Z$, the samples' information, MLP predicts whether a sample is valid or not. The training objective for the MLP is to minimize the classification loss between the predicted sample's label and its actual label. Thus we use Cross-Entropy as our loss function since it's been shown to perform excellently for classification problems \cite{covington2016deep,sainath2012auto}. \subsection{Online Sample Validation and Path Planning} The online phase exploits the neural models from the offline phase to do motion planning in cluttered and complex workspaces. Algorithm \ref{algo} presents the overall path generation procedure. First, using the offline-trained CAE, $W$ is encoded into a latent space $Z$. Then, a set of samples $S$ is generated based on the specification of a robot $R$ and its particular workspace $W$. Next, the offline-trained MLP takes the sample set $S$ and the encoded latent space $Z$ as input to determine a set of probably valid samples $S' \subseteq S$. Then, the probably valid sample set $S'$ is connected to create a roadmap $R$ by a proximity search function. If $R$ is not found, additional valid samples would be generated using auxiliary samplers. Finally, from $R$, a local planning function would return a feasible path between a given start and goal. We will discuss in more detail for each step in our algorithm in the following sections. \begin{algorithm} \caption{SBMP Variant}\label{algo} \begin{algorithmic}[1] \item[\algorithmicinput]{New workspace $X$ (point cloud data), Query $x_{init}$, $X_{goal}$} \STATE Use the CAE to encode $X$ into the latent space $Z$. \STATE Randomly sample a set of states, $S$. \STATE Feed $S$ and $Z$ into MLP, which predicts the validity of each sample in $S$. After this step $S'$ a set of most probably valid samples are retained. \STATE Feed $S'$ into a standard PRM approach to yield a valid roadmap $R$. If $R$ is not found, create additional valid samples using auxiliary samplers. \STATE Extract a path $\tau$ from $R$ between $x_{init}$ and $X_{goal}$. \end{algorithmic} \end{algorithm} \subsubsection{Sample Generation} We use the following auxiliary samplers to generate the initial sample set $S$ from each workspace. Basic PRM (BS)\cite{kavraki1994probabilistic} creates samples uniformly and randomly. Obstacle Based PRM (OB)\cite{amato1998obprm} creates samples near the boundary of obstacles. Gaussian Sampler (G)\cite{boor1999gaussian} also creates samples around obstacles using adaptive probability and collision data. Bridge Test (BT)\cite{hsu2003bridge} creates samples using a short segment with two configurations and their midpoint. \subsubsection{Workspace Encoder} The encoding function $f(x, W^e)$, trained in the offline phase, is used to map the workspace occupancy grid $x \in X$ into a latent space $Z \subseteq \mathbb{R}^m$. \subsubsection{Sample's Validity} The MLP, a feed-forward neural network from the offline phase, takes the workspace encoding $Z$, the samples' information $S$, and predict samples' validity to create $S'$. In short, MLP is a classifier distinguishing between valid and invalid samples. To introduce stochasticity into the MLP and to prevent over-fitting, some of the hidden units in each hidden layer of the MLP were dropped out with a probability $p$. Dropout is applied layer-wise to a neural network and it drops each unit in the hidden layer with a probability $p : [0, 1] \in \mathbb{R}$. \subsubsection{Connection and Path Planning} We use a straight line local planner. Particularly a PRM approach is applied to $S'$ to generate a roadmap $R$, and the path is extracted and verified. \section{IMPLEMENTATION DETAILS} This section gives the implementation details of our framework. The proposed neural models, CAE and MLP, are implemented in PyTorch\cite{paszke2017automatic}. \subsection{Data Collection} \subsubsection{Workspace Data} To generate different workspace for training and testing, a number of quadrilateral blocks were placed in the operating region of $31 \times 31$ for 2D simple workspaces (2DS), $41 \times 41 \times 6$ for 3D office-like workspaces (3DO), and $11 \times 11 \times 11$ for 3D clutter workspaces (3DC). The placement of these blocks was randomly chosen in the operating region. Each random placement of the obstacle blocks leads to a different workspace. For each environment, the locations and numbers and types of obstacles are generated randomly. First, the number of obstacles is chosen randomly in a pre-defined range. Then for each obstacle in that environment, the type is chosen among the pre-defined types (small box, big box,..) and its location is also randomly determined. Currently, we do not consider any rotation of the blocks, i.e., they are axis aligned. Figure \ref{fig:2D}, \ref{fig:3DO}, and \ref{fig:3DC} show some examples of our workspaces. We represent the workspaces as an occupancy grid with values of $-1$ and $1$, in which $1$ means there is an obstacle at that point, and $-1$ means the point is in free space. The input to the encoder is an occupancy grid of size $n \times m$ for 2D and $n \times m \times k$ for 3D, where $n$, $m$, and $k$ are the number of points along each dimension of the workspace. We use multiple workspace representations to train and test our CAE. The training data set of the 2D workspaces comprised of 30 workspaces, and for testing, two types of test data sets were created to evaluate the proposed method. The first test data set comprised of the 30 workspaces used in training, and the second test data set comprised of 10 previously unseen workspaces, i.e., 10 workspaces not from the training set. There are around $3$ to $5$ obstacle blocks with different shapes and sizes in each workspace. The training data set of the 3D office-like workspaces comprised of 100 workspaces, and for testing 100 known workspaces and 20 previously unseen workspaces with $25$ to $30$ obstacle blocks in each workspace were used. The training data set of the 3D clutter workspaces comprised of 50 workspaces, and for testing 30 known workspaces and 10 previously unseen workspaces with $110$ to $125$ same shape and size obstacle blocks in each workspace were used. To test the performance of our MLP, we generate multiple different workspaces with different starts and goals. For 2D simple and 3D office-like, we randomly generate 10 different workspaces with 10 different start and goal positions for each of them; and 100 3D clutter workspaces with 1 different start and goal positions for each of them to test the performance of our proposed framework in terms of time. \begin{figure}[!tbp] \centering \begin{minipage}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth, height = 70pt]{Figs/2D.png} \caption{Examples of 2D simple workspace} \label{fig:2D} \vspace{-4mm} \end{minipage} \hfill \begin{minipage}[b]{0.3\textwidth} \centering \includegraphics[width=\textwidth, height = 70pt]{Figs/kuka_robot.png} \caption{Examples of 3D office-like workspace with Kuka robot} \label{fig:3DO} \end{minipage} \hfill \begin{minipage}[b]{0.3\textwidth} \centering \includegraphics[width=90pt, height = 70pt]{Figs/cube.jpg} \caption{Example of 3D clutter workspace} \label{fig:3DC} \vspace{-4mm} \end{minipage} \end{figure} \subsubsection{Sample Data} For the 2D simple workspace, we use a point-mass robot with 2 degrees of freedom (DoF) that represents its $\{x, y\}$ position. The point robot is (0.5x0.5) in a (31x31) environment. For the 3D office-like, we use KuKa robot\cite{kuka-youbot}, which has 5 joints, with a total of 8 DoF. The 8 DoFs represent the robot's $\{x,y\}$ position, rotation, and each joint's rotation. The Kuka robot is the size of (1.5x1x1) in a (41x41x6) environment. For the 3D clutter workspaces, we use box robots with 7 DoF and 9 DoF. The DoFs represent the robot's $\{x, y, z\}$ position, $\{\alpha, \beta, \gamma\}$ rotation, and each joint's rotation. The box robots consist of 2 types of links: a small link of (0.1x0.1x0.1) and a big link of (0.4x0.1x0.1) in a (11x11x11) environment. The 7D box robot has 1 joint for 2 links, and the 9D box robot has 3 joints for 2 small links and 2 big links. We generate 100 samples for each 2D workspace and 200 samples for each 3D workspace for training and testing our MLP separately. This is evaluated as seen scenarios. Those samples are approximately distributed 50/50 between valid and invalid samples. Since our approach mainly focuses on verifying the sample's validity, we incorporate it into the standard PRM approaches using algorithm \ref{algo} to test its effectiveness. However, instead of having a large set of samples $S'$, we provide a small set of samples $S'$ and let the algorithm decide whether those supplied samples are enough or there is a need to generate more samples. We think that providing the algorithm with too many samples would negatively impact the performance of neighborhood finding routines in sampling-based planners. Thus, we generate 200 samples regardless of their validity for each 2D simple workspace, 2000 samples for each 3D office-like workspace, and 400 samples for each 3D clutter workspace. This is evaluated as unseen scenarios \subsection{Model Architecture} \subsubsection{Contractive AutoEncoder} Since the structure of the decoders is the inverse of the encoder, we only describe the structure of the encoder. For the 2D workspaces, the encoding function $f(x, W^e)$ and decoding function $g(f(x,W^e), W^d)$ consist of five linear layers and one output layer, where each layer uses Parametric Rectified Linear Unit (PReLU)\cite{trottier2017parametric} as its activation function, for loss function, we use mean square error with weight-decay. The layers 1 to 5 transforms the input vector $31 \times 31$ to 512, 256, 128, 64, and 32 hidden units, respectively. The output layer takes 32 units as input and outputs 12 units. Hence the workspace representation in the latent space is a vector of size 12. Then, those 12 units are used by the decoder to reconstruct the $31 \times 31$ space. For the 3D office-like workspaces, the encoding function $f(x,W^e)$ and decoding function $g(f(x,W^e),W^d)$ are the same as in 2D simple workspace but consist of seven linear layers and one output layer. Layers one to seven transform the input vectors to 5043, 3125, 1600, 800, 400, 200, 100 hidden units, respectively. The output layer takes the 100 units from the seventh layer and transforms them into 50 units. For the 3D clutter workspaces, layers one to six transform the input vectors to 1000, 800, 600, 400, 200, 100 hidden units, the output layer transforms the input 100 units to output 50 units. \subsubsection{Multi-layer Perceptrons} The input is given by concatenating the encoded workspace’s representation $Z$, and the DoF for each robot from a given state. Each of the layers is a sandwich of a linear layer, a Parametric Rectified Linear Unit (PReLU), and Dropout ($p$). For the 2D workspaces, MLP is a 4-layer neural network. Layers one and two map the input vectors to 6, 4 units, respectively. The output layer takes the 4 units and transforms them into the validity of each sample, which is either valid or invalid. For the 3D workspaces, MLP is a 7-layer neural network. Layers one to six map the input vectors to 50, 40, 30, 20, 10, 5 units, respectively. The output layer takes the 5 units from the sixth layer and transforms them into the validity of each sample. \subsubsection{Parameters} To train the neural models CAE and MLP for both 2D and 3D workspace, the Adagrad\cite{duchi2011adaptive} optimizer was used with the learning rate of $0.1$. The Dropout probability $p$ and penalizing term $\lambda$ were set to $0.5$ and $0.001$, respectively. \section{RESULTS} This section presents the results of the framework for the motion planning of a point robot in the 2D workspaces and the KuKa robot and a box robot in 3D workspaces. \begin{wraptable}{r}{1.55in} \protect\scriptsize \centering \begin{tabular}{| c | c | c |} \hline & Seen & Unseen \\ [0.5ex] \hline 2DS & 100\% & 100\% \\ 3DO & 96\% & 94\% \\ 3DC & 98\% & 95\% \\ \hline \end{tabular} \caption{Performance of CAE} \label{table:CAE} \vspace{-4mm} \end{wraptable} Table \ref{table:CAE} shows the performance for the CAE. For 2DS, the average accuracy of our CAE is $100\%$ with the variance of $0.4\%$ for both already seen workspaces and unseen workspaces. For 3DO, the average accuracy of our CAE is $96\%$ with the variance of $3\%$ for already seen workspaces and the average accuracy is $94\%$ with the variance of $5\%$ for unseen workspaces. The accuracy and variance are $98\%$ and $1\%$ and $95\%$ and $3\%$ for seen and unseen 3D clutter, respectively. Overall, the accuracy of our CAE is excellent. Thus, we are able to learn the underlying structure of the workspaces quite well. \begin{table}[h] \centering \begin{tabular}{|l|l|l|l|l|l|l|} \hline \multirow{2}{*}{} & \multicolumn{3}{c|}{Seen} & \multicolumn{3}{c|}{Unseen} \\ \cline{2-7} & Acc & TPR & TNR & Acc & TPR & TNR \\ \hline 2DS & 92\% & 96\% & 88\% & 88\% & 90\% & 85\% \\ \hline 3DO & 76\% & 88\% & 64\% & 73\% & 85\% & 60\% \\ \hline 3DC-7 & 75\% & 87\% & 64\% & 71\% & 85\% & 61\% \\ \hline 3DC-9 & 73\% & 82\% & 66\% & 72\% & 82\% & 62\% \\ \hline \end{tabular} \caption{Accuracy, True Positive Rate, and True Negative Rate of MLP} \label{table:MLP} \vspace{-4mm} \end{table} Table \ref{table:MLP} shows the accuracy, true positive rate (TPR), and true negative rate (TNR) for the MLP, with false negative rate = 1–TPR and false positive rate = 1–TNR. For 2D workspaces, the average accuracy of our MLP is $92\%$ with the variance of $2\%$ for already seen workspaces and the average accuracy is $88\%$ with the variance of $4\%$ for unseen workspaces. For 3DO workspace, the average accuracy of our MLP is $76\%$ with the variance of $6\%$ for already seen workspaces, and the average accuracy is $73\%$ with the variance of $8\%$ for unseen workspaces. The average accuracy is $73\%$ with $5\%$ variance (seen), and $71\%$ with $9\%$ variance (unseen) for 3DC-7. The average accuracy is $73\%$ with $6\%$ variance (seen), and $72\%$ with $10\%$ variance (unseen) for 3DC-9. Additionally, the true positive rates and true negative rates are quite good for our MLP, thus most of the valid samples and invalid samples are successfully validated by MLP. Overall, the accuracy of our MLP is acceptable. \begin{table}[h] \begin{center} \begin{tabular}{|l|l|l|l|l|l|l|l|l|} \hline \multirow{2}{*}{} & \multicolumn{4}{c|}{Sampling Time} & \multicolumn{4}{c|}{Total Time} \\ \cline{2-9} & BS & OB & G & BT & BS & OB & G & BT \\ \hline 2DS & 53\% & 57\% & 63\% & 74\% & 17\% & 18\% & 11\% & 8\% \\ \hline 3DO & 45\% & 58\% & 41\% & 56\% & 1\% & 9\% & 10\% & -8\%\\ \hline 3DC-7 & 49\% & 58\% & 51\% & 61\% & -2\% & 14\% & -9\% & 54\% \\ \hline 3DC-9 & 39\% & 59\% & 48\% & 62\% & 18\% & 20\% & 13\% & 37\%\\ \hline \end{tabular} \end{center} \caption{Average time improvement ratio with and without applying our proposed framework for sampling time and total time.} \label{table:tab3} \vspace{-4mm} \end{table} \begin{figure}[!tbp] \centering \begin{minipage}[b]{0.5\textwidth} \centering \includegraphics[width=\textwidth, height = 90pt]{Figs/3DO.jpg} \caption{Time performance with and without applying our method in 3DO workspaces} \label{fig:3DO-8} \end{minipage} \hfill \begin{minipage}[b]{0.5\textwidth} \centering \includegraphics[width=\textwidth, height = 90pt]{Figs/3DC7.jpg} \caption{Time performance with and without applying our method in 3DC-7 workspaces} \label{fig:3DC-7} \end{minipage} \hfill \begin{minipage}[b]{0.5\textwidth} \centering \includegraphics[width=\textwidth, height = 90pt]{Figs/3DC9.jpg} \caption{Time performance with and without applying our method in 3DC-9 workspaces} \label{fig:3DC-9} \vspace{-4mm} \end{minipage} \end{figure} Table \ref{table:tab3} show the average time improvement ratio comparison for sampling time and total time with and without applying our method with Basic PRM (BS), Obstacle Based PRM (OB), Gaussian (G), and Bridge Test (BT) for solving motion planning problems. In 2D workspaces, the average time to validate samples without and with using our method are: $0.0004 \pm 0.0002$ and $0.0002 \pm 0.0002$ for BS, $0.05 \pm 0.01$ and $0.03 \pm 0.01$ for OB, $0.04 \pm 0.01$ and $0.02 \pm 0.01$ for G, $0.26 \pm 0.23$ and $0.11 \pm 0.03$ for BT. There are significant time improvement when using our method for classify valid samples. Moreover, the average total execution time for each query without and with using our method are: $0.12 \pm 0.01$ and $0.10 \pm 0.01$ for BS, $0.38 \pm 0.05$ and $0.31 \pm 0.03$ for OB, $0.09 \pm 0.01$ and $0.09 \pm 0.01$ for G, $0.13 \pm 0.01$ and $0.13 \pm 0.01$ for BT. Notable, our framework has good performance. Additionally, we notice there is a nearly $20\%$ improvement when applying our framework to OB. In 3DO workspaces, the average time to validate samples without and with using our method are: $0.11 \pm 0.01$ and $0.06 \pm 0.02$ for BS, $1.13 \pm 0.08$ and $0.56 \pm 0.25$ for OB, $0.21 \pm 0.04$ and $0.12 \pm 0.02$ for G, $0.76 \pm 0.13$ and $0.32 \pm 0.02$ for BT. The time improvements when using our method for classifying valid samples are quite good. Additionally, the average total execution time for each query without and with using our method are: $40.86 \pm 36.47$ and $40.51 \pm 25.91$ for BS, $43.74 \pm 22.01$ and $39.88 \pm 18.72$ for OB, $42.32 \pm 41.99$ and $38.22 \pm 30.01$ for G, $40.40 \pm 33.92$ and $43.13 \pm 28.87$ for BT. There are improvements when using our framework with OB ($9\%$) and G ($10\%$), but there is a small improvement for BS ($1\%$) and a slow-down for BT ($8\%$). We suspect that it could be that the supplied samples are not good enough, thus there is the need for re-sampling. The average time to validate samples without and with using our method for 3DC-7 are: $0.007 \pm 0.003$ and $0.003 \pm 0.001$ for BS, $0.20 \pm 0.03$ and $0.09 \pm 0.01$ for OB, $0.09 \pm 0.01$ and $0.04 \pm 0.02$ for G, $0.42 \pm 0.04$ and $0.17 \pm 0.02$ for BT; and for 3DC-9 are: $0.015 \pm 0.005$ and $0.008 \pm 0.003$ for BS, $0.08 \pm 0.01$ and $0.04 \pm 0.01$ for OB, $0.04 \pm 0.01$ and $0.02 \pm 0.01$ for G, $0.10 \pm 0.02$ and $0.04 \pm 0.02$ for BT. Overall, our method reduces the sampling classification time notably. Moreover, the average total execution time for each query without and with using our method for 3DC-7 are: $0.53 \pm 0.03$ and $0.54 \pm 0.03$ for BS, $0.65 \pm 0.35$ and $0.56 \pm 0.13$ for OB, $0.45 \pm 0.40$ and $0.49 \pm 0.12$ for G, $0.95 \pm 0.64$ and $0.44 \pm 0.05$ for BT; and for 3DC-9 are: $0.73 \pm 0.48$ and $0.60 \pm 0.19$ for BS, $3.27 \pm 3.62$ and $2.60 \pm 0.19$ for OB, $3.90 \pm 4.73$ and $3.40 \pm 0.41$ for G, $7.10 \pm 0.77$ and $4.50 \pm 0.50$ for BT. There are quite notable time improvements when using our framework to augment the motion planning algorithms for 3DC workspaces. In 3DC workspaces, the BT samplers perform the worst because of the open nature of our testing workspaces. Figure \ref{fig:3DO-8}, \ref{fig:3DC-7}, \ref{fig:3DC-9} show the performance with (BSF, OBF, GF, BTF) and without (BS, OB, G, BT) applying our proposed framework in second for 3DO, 3DC-7, 3DC-9 workspace. Overall, there is a notable improvement in performance in most cases. The standard deviations when using our framework decreased compared to not using it. Thus, our framework augments the algorithms perfectly and makes them more stable in solving queries reliably. Although we only test our approach using fixed size workspaces, it is robust to varying sizes. By splitting the workspace into parts with a pre-defined size, the proposed approach would still be able to validate samples. Moreover, by adjusting the number of samples in the sampling validation phase and the number of samples generated by the auxiliary sampler, our method guarantees probabilistic completeness for any motion planning problem. Therefore, our approach is applicable to most of sampling based planners. \section{Conclusion} In this paper, we present a fast and efficient neural network framework for sampling-based motion planners. The framework consists of a Contractive AutoEncoder that encodes a point cloud representation of a robot's workspace into a latent feature space and a feed-forward neural network that takes that encoded workspace and robot configuration details to predict the validity of that configuration. The main advantage of our framework is that we use an encoded workspace and neural network to reduce or even remove expensive collision detection operations. In this paper, we focus on the sampling phase of SBMP and how we can reduce number of collision checks made. Our proposed method is quite robust such that it can be integrated into any sampling strategy. In the future, we plan to research models that increase the accuracy of our MLP by pre-processing a configuration's information before training. Furthermore, since our method considers the environment’s and robot’s information when performing collision checks, we could train them on regions of the environments. Thus, instead of using our method for the whole environment, an SBMP algorithm could use our method when it reaches certain potions of that environment. Additionally, we could apply this approach to other aspects of SBMP, e.g., edge prediction, and path validation. \setcounter{page}{1} \bibliographystyle{IEEEtran}
\section{Introduction}\label{sec:intro} \subsection{Schubert polynomials and pipe dreams} Schubert polynomials $\mathfrak S_w\in{\mathbb{Z}}[x_1,x_2,\dots]$ were defined by I.\,N.\,Bernstein, I.\,M.\,Gelfand and S.\,I.\,Gelfand \cite{BernsteinGelfandGelfand73} and by A.\,Lascoux and M.-P.\,Schützenberger \cite{LascouxSchutzenberger82}. They can be viewed as ``especially nice'' polynomial representatives of classes of Schubert varieties $[X_w]\in H^*(G/B)$, where $G=\GL_n({\mathbb{C}})$ is a general linear group, $B$ is a Borel subgroup in $G$, and $G/B$ is a full flag variety. It is well known that their coefficients are nonnegative, and there exists a manifestly positive combinatorial rule for computing these coefficients. One can also be interested in the $K$-theory $K_0(G/B)$. Instead of Schubert classes $[X_w]\in H^*(G/B)$, one would consider the classes of their structure sheaves $[{\mathcal{O}}_w]\in K_0(G/B)$. These classes also have a nice presentation, known as Grothendieck polynomials $\mathfrak G^{(\beta)}_w\in{\mathbb{Z}}[\beta,x_1,x_2,\dots]$, depending on an additional parameter $\beta$. They also have integer nonnegative coefficients, but, as opposed to Schubert polynomials, they are not homogeneous in the usual sense; however, they become homogeneous if we set $\deg\beta=-1$. They can be viewed as ``deformations'' of the Schubert polynomials $\mathfrak S_w$: evaluating $\mathfrak G^{(\beta)}_w$ at $\beta=0$, we recover the corresponding Schubert polynomial $\mathfrak S_w=\mathfrak G^{(0)}_w$. Schubert and Grothendieck polynomials can be described combinatorially by means of diagrams called \emph{pipe dreams}, or \emph{rc-graphs}. These diagrams are configurations of pseudolines associated to a permutation; to each such diagram one can assign a monomial. A pipe dream is said to be \emph{reduced} if each pair of pseudolines intersects at most once. The Schubert (resp. Grothendieck) polynomial for a permutation $w$ is obtained as the sum of the corresponding monomials for reduced (resp. not necessarily reduced) pipe dreams associated to $w$. This theorem, due to S.\,Billey and N.\,Bergeron \cite{BilleyBergeron93} and to S.\,Fomin and An.\,Kirillov \cite{FominKirillov96}, is an analogue of Littlewood's presentation of Schur polynomials as sums over Young tableaux. In particular, this implies positivity of the coefficients of Schubert and Grothendieck polynomials. A brief reminder on pipe dreams is given in \S~\ref{ssec:pipedreams}. In \cite{KnutsonMiller05}, A.\,Knutson and E.\,Miller proposed a geometric interpretation of pipe dreams for a permutation $w$: they correspond to the irreducible components of a ``deep'' Gröbner degeneration of the corresponding matrix Schubert variety $\overline{X_w}$ to a union of affine subspaces. A combinatorial structure of this union of subspaces is encoded by a certain simplicial complex, known as the \emph{pipe dream complex} for $w$. From this, one can deduce that the multidegree of $\overline{X_w}$ with respect to the maximal torus $T\subset B\subset G$ equals the Schubert polynomial $\mathfrak S_w$. In the subsequent paper \cite{KnutsonMiller04} the same authors put the notion of a pipe dream complex into a more general context, defining \emph{subword complexes} for an arbitrary Coxeter system, and proved that such complexes are shellable and, moreover, homeomorphic to balls or, in certain ``rare'' cases, to spheres. This implies many interesting results about the geometry of the corresponding Schubert varieties, both matrix and usual ones, including new proofs for normality and Cohen--Macaulayness of Schubert varieties in a full flag variety. \subsection{Slide and glide polynomials} Recently, S.\,Assaf and D.\,Searles \cite{AssafSearles17} defined \emph{slide polynomials} $\mathfrak F_Q$. This is another family of polynomials with properties similar to Schubert polynomials: in particular, they form a basis in the ring of polynomials in countably many variables and enjoy a \emph{manifestly positive} Littlewood--Richardson rule. They are indexed by pipe dreams $Q$ with an extra combinatorial condition, usually called the \emph{quasi-Yamanouchi pipe dreams}. This condition is similar to the Yamanouchi condition for skew Young tableaux; the precise definitions are given in \S~\ref{ssec:slidepoly}. Moreover, there exist combinatorial positive formulas for expressing Schubert polynomials in the slide basis: each Schubert polynomial is expressed as a linear combination of slide polynomials with coefficients 0 or 1. Slide polynomials also have a $K$-theoretic counterpart: \emph{glide polynomials} $\mathcal G^{(\beta)}_Q$, defined by O.\,Pechenik and D.\,Searles in \cite{PechenikSearles19} (note that the names ``Schubert'' and ``Grothendieck'' also start with S and G, respectively). Similarly, there are explicit expressions of Grothendieck polynomials via glide polynomials. \subsection{Slide complexes} The main objects defined in this paper are analogues of subword complexes corresponding to slide polynomials. We call them \emph{slide complexes}. Each subword complex can be subdivided into slide complexes. We show that these complexes are shellable (Theorem~\ref{thm:shellable-slides}). Our main result, Theorem~\ref{thm:main}, states that each slide complex arising as a stratum in a subword complex is homeomorphic to a ball or a sphere. In the case of pipe dream complexes, from a slide complex we can recover the corresponding slide and glide polynomials: the slide (resp. glide) polynomial is obtained as the sum of monomials corresponding to facets (resp. all interior faces) of the corresponding complex. This provides us with a topological interpretation of the combinatorial expression for $\mathfrak S_w$ via $\mathfrak F_Q$ and of $\mathfrak G^{(\beta)}_w$ via $\mathcal G_Q^{(\beta)}$ (Corollaries~\ref{cor:glide} and~\ref{cor:slide}). \subsection{Possible relation with degenerations of matrix Schubert varieties} In this paper we are dealing only with combinatorial constructions and do not address the geometric picture. It would be interesting to explore the relation of slide polynomials with degenerations of matrix Schubert varieties. A natural question is as follows: for a matrix Schubert variety $\overline{X_w}$, does there exist an ``intermediate degeneration'' $\overline{X_w}\to \bigcup \overline{Y_{w,Q}}$, with the irreducible components indexed by quasi-Yamanouchi pipe dreams of shape $w$, such that the multidegree of each irreducible component $\overline{Y_{w,Q}}$ is equal to the slide polynomial $\mathfrak F_Q$? This would, in particular, provide a geometric interpretation of the Littlewood--Richardson coefficients for slide polynomials, studied by S.\,Assaf and D.\,Searles in~\cite{AssafSearles17}. \subsection{Structure of the paper} This text is organized as follows. In Sec.\,\ref{sec:poly} we recall the definitions of Schubert and Grothendieck polynomials, provide their description using pipe dreams, and describe slide and glide polynomials in terms of pipe dreams. Sec.\,\ref{sec:subword} contains the definition of a subword complex for an arbitrary Coxeter system. We also recall the proof of its shellability and that it is homeomorphic either to a ball or to a sphere. Then we focus on the most important particular case of pipe dream complexes. The main results of this paper are contained in Sec.\,\ref{sec:sc}: in \S~\ref{ssec:sc-gen} we define a decomposition of a subword complex for an arbitrary Coxeter system into strata called slide complexes and show that these strata are shellable and homeomorphic either to balls or to spheres. In~\S~\ref{ssec:scpd} we show that the decomposition of a pipe dream complex into slide complexes corresponds to the presentation of the corresponding Schubert (resp. Grothendieck) polynomial as a sum of slide (resp. glide) polynomials. The last subsection, \S~\ref{ssec:pilaud}, describes the relation of slide complexes with the flip graphs considered in~\cite{PilaudStump13}. \subsection*{Acknowledgements} We are indebted to Sami Assaf, Alexander Gaifullin, Valentina Kiritchenko and Allen Knutson for fruitful discussions. We are especially grateful to Oliver Pechenik for pointing out a simpler proof of the main result. We would like to thank the anonymous referee whose valuable remarks significantly improved the exposition. This research was supported by the HSE University Basic Research Program and by the Theoretical Physics and Mathematics Advancement Foundation ``BASIS''. E.S. was also partially supported by the RFBR grant 20-01-00091-a and the Simons--IUM Fellowship. \section{Schubert, Grothendieck, slide and glide polynomials}\label{sec:poly} \subsection{The symmetric group}\label{ssec:symgroup} We will denote by $\mathbf{S}_n$ the symmetric group on $n$ letters, i.e. the group of bijective maps from $\{1,\dots,n\}$ onto itself. It is generated by the simple transpositions $s_i=(i\leftrightarrow i+1)$ for $1\leq i\leq n-1$, modulo the Coxeter relations: \begin{itemize} \item $s_i^2=Id$; \item $s_is_j=s_js_i$ for $|i-j|\geq 2$ (far commutativity); \item $s_is_{i+1}s_i=s_{i+1}s_is_{i+1}$ for each $i=1,\ldots, n-2$ (braid relation). \end{itemize} We will use the one-line notation for permutations: for example, $w=\overline{1423}$ brings $1$ to $1$, $2$ to $4$, $3$ to $2$, and $4$ to $3$. Each permutation $w\in \mathbf{S}_n$ can be expressed as a product $w=s_{i_1}\dots s_{i_k}$ of simple transpositions. We will say that $w$ is presented by the \emph{word} $(s_{i_1},\dots,s_{i_k})$. The minimal length of a word presenting $w$ is called the \emph{length} of $w$ and denoted by $\ell(w)$. The word presenting $w$ is said to be \emph{reduced} if its length equals $\ell(w)$. It is well known that $\ell(w)$ is equal to the number of inversions in $w$, i.e. \[ \ell(w)=\#\{(i,j)\mid 1\leq i<j\leq n, w(i)>w(j)\}. \] The longest permutation in $\mathbf{S}_n$ will be denoted by $w_0$. This is the permutation that maps $i$ into $n+1-i$ for each $i$; clearly, $\ell(w_0)=\binom{n}{2}=\frac{n(n-1)}{2}$. This permutation has several reduced presentations; later we will need the following one: \[ w_0=(s_{n-1}\dots s_3s_2s_1)(s_{n-1}\dots s_3s_2)(s_{n-1}\dots s_3)\dots(s_{n-1}s_{n-2})(s_{n-1}). \] \subsection{Schubert and Grothendieck polynomials}\label{ssec:schubpoly} Denote the set of variables $x_1,\ldots, x_n$ by~$\mathbf x$ and consider the polynomial ring ${\mathbb{Z}}[\mathbf x]$. The group $\mathbf{S}_n$ acts on this ring by interchanging variables: \[ w\circ f(x_1,\ldots, x_n)=f(x_{w(1)},\ldots,x_{w(n)}). \] \begin{definition} For $i=1,\ldots,n-1$, we define the \emph{divided difference operators} $\partial_i:{\mathbb{Z}}[\mathbf x]\to{\mathbb{Z}}[\mathbf x]$ as follows: \[ \partial_i f(\mathbf x)=\frac{f(\mathbf x)-s_i\circ f(\mathbf x)}{x_i-x_{i+1}}. \] \end{definition} Since the numerator is antisymmetric with respect to $x_i$ and $x_{i+1}$, it is divisible by the denominator, so the ratio is indeed a polynomial with integer coefficients. The divided difference operators satisfy the Coxeter relations: \begin{itemize} \item $\partial_i^2=0$, \item $\partial_{i}\partial_j=\partial_j\partial_i$ if $|i-j|\geq 2$, \item $\partial_{i} \partial_{i+1} \partial_{i}=\partial_{i+1} \partial_{i} \partial_{i+1}$ for each $i=1,\ldots, n-2$. \end{itemize} \begin{definition} \emph{Schubert polynomials} $\mathfrak S_w$ are defined as the elements of ${\mathbb{Z}}[\mathbf x]$ indexed by permutations $w\in\mathbf{S}_n$ and satisfying the relations $$ \mathfrak S_{Id}=1, $$ $$ \partial_{i} \mathfrak S_{w}=\begin{cases} \mathfrak{S}_{w s_{i}}, & \text { if } \ell\left(w s_{i}\right)<\ell(w), \\ 0, & \text { otherwise} \end{cases} $$ for each $i=1,\ldots, n-1$. \end{definition} A.\,Lascoux and M.-P.\,Schützenberger \cite{LascouxSchutzenberger82} have shown that the Schubert polynomials are uniquely determined by these relations. Equivalently, they can be constructed by using the recurrence relation \[ \mathfrak{S}_{w s_{i}}(\mathbf{x})=\partial_{i} \mathfrak{S}_{w}(\mathbf{x}), \text{ if } \ell(ws_i)<\ell(w), \] with the initial condition \[ \mathfrak{S}_{w_0}(\mathbf x)=x_1^{n-1}x_2^{n-2}\ldots x_{n-2}^2x_{n-1}. \] This recurrence relation can be written as follows: if $s_{i_k}\ldots s_{i_1}$ is a reduced word for a permutation $w_0w$, then \[ \mathfrak{S}_w=\partial_{i_1}\ldots\partial_{i_k}\mathfrak{S}_{w_0}. \] Since the divided difference operators satisfy the far commutativity and braid relations, and every reduced word for $w_0w$ can be transformed into any other reduced word just by these two operations, $\mathfrak S_w$ is well defined (i.e. does not depend upon a choice of the reduced word). Grothendieck polynomials were introduced by A.\,Lascoux in~\cite{Lascoux90}. We will use their deformation, $\beta$-Grothendieck polynomials, introduced by S.\,Fomin and An.\,Kirillov in~\cite{FominKirillov94}. Sometimes we will refer to them simply as to Grothendieck polynomials. Their definition is similar to the definition of Schubert polynomials, but instead of $\partial_i$ we need to use the \emph{isobaric divided difference operators} $\pi^{(\beta)}_i$. \begin{definition} Let $\beta$ be a formal parameter. For $i=1,\ldots,n-1$ define the \emph{$\beta$-isobaric divided difference operators} $\pi^{(\beta)}_i:{\mathbb{Z}}[\beta,\mathbf x]\to{\mathbb{Z}}[\beta,\mathbf x]$: \[ \pi^{(\beta)}_if(\mathbf x)=\frac{(1+\beta x_{i+1})f(\mathbf x)-(1+\beta x_i)s_i\circ f(\mathbf x)}{x_i-x_{i+1}}. \] \end{definition} Just like the divided difference operators, their isobaric counterparts also satisfy the Coxeter relations: \begin{itemize} \item $\pi^{(\beta)}_{i}\pi^{(\beta)}_j=\pi^{(\beta)}_j\pi^{(\beta)}_i$ for $|i-j|\geq 2$, \item $\pi^{(\beta)}_{i} \pi^{(\beta)}_{i+1} \pi^{(\beta)}_{i}=\pi^{(\beta)}_{i+1} \pi^{(\beta)}_{i} \pi^{(\beta)}_{i+1}$ for each $i=1,\ldots, n-2$. \end{itemize} \begin{definition} Define \emph{$\beta$-Grothendieck polynomials} $\mathfrak G^{(\beta)}_w$ using the initial condition $$\mathfrak G^{(\beta)}_{w_0}(\mathbf x)=x_1^{n-1}x_2^{n-2}\ldots x_{n-2}^2x_{n-1}$$ and the recurrence relation \[ \mathfrak G^{(\beta)}_w=\pi^{(\beta)}_{i_1}\ldots\pi^{(\beta)}_{i_k}\mathfrak G^{(\beta)}_{w_0}, \] where $s_{i_k}\ldots s_{i_1}$ is a reduced word for the permutation $w_0w$. \end{definition} Since the operators $\pi^{(\beta)}_i$ satisfy the Coxeter relations, these polynomials are also well-defined. One can immediately see that, since $\pi^{(0)}_i=\partial_i$ and $\mathfrak G^{(\beta)}_{w_0}=\mathfrak S_{w_0}$, we have $\mathfrak G^{(0)}_w=\mathfrak S_w$ for each $w\in\mathbf{S}_n$. So setting in $\mathfrak G^{(\beta)}$ the parameter $\beta=0$, we recover the Schubert polynomials. \subsection{Pipe dreams}\label{ssec:pipedreams} In this subsection we discuss pipe dreams: the main combinatorial tool for dealing with Schubert and Grothendieck polynomials. \begin{definition} Consider an $(n\times n)$-square and fill it with the elements of two types: \emph{crosses} $\includegraphics[scale=0.5]{cross}$ and \emph{elbows} $\includegraphics[scale=0.5]{elbows}$ in such a way that all the crosses are situated strictly above the antidiagonal. We will omit the elbows situated below the antidiagonal. This diagram is called a \emph{pipe dream}, or an \emph{rc-graph} (``RC'' stands for ``reduced compatible''). Each pipe dream can be viewed as a configuration of $n$ strands joining the left edge of the square with the top edge. Let us index the initial and terminal points of these strands by the numbers from 1 to $n$, going from top to bottom and from left to right. Pipe dream is said to be \emph{reduced} if every pair of strands crosses at most once and \emph{nonreduced} otherwise. \end{definition} The following figure provides an example of reduced and non-reduced pipe dreams. \begin{figure}[ht] $$ \begingroup \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{0.07} \begin{matrix} & 1 & 2 & 3 & 4 & 5 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow}& \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow}& \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow}& \\ 4 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow}&\\ 5 & \includegraphics[scale=0.5]{elbow}& \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 & 5 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow}& \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow}& \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow}& \\ 4 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow}& \\ 5 & \includegraphics[scale=0.5]{elbow}& \\ \end{matrix} \endgroup $$ \caption{\label{pipedreams} A reduced and a non-reduced pipe dream} \end{figure} \begin{definition} Each pipe dream can be viewed as a bijective map from the set of the initial points of the strands to the set of its terminal points. Let us assign to each \emph{reduced} pipe dream $P$ the corresponding permutation $w(P)\in\mathbf{S}_n$. It will be called the \emph{shape} of $P$. Moreover, to each pipe dream $P$ we associate the set $D_P$ of the coordinates of its crosses (the first and the second coordinates stand for the row and the column numbers, respectively). \end{definition} For example, the shape of the left pipe dream $P$ at Fig.\,\ref{pipedreams} equals $w(P)=\overline{15423}$, and the set $D_P$ is equal to $ D_P=\{(1,3),(2,1),(2,2),(2,3),(3,1)\}$. \begin{definition} Define the \emph{reduction} operation $\mathrm{reduct}$ on the set of pipe dreams as follows: we read the rows of a pipe dream from top to bottom, reading each row from right to left. Each time we find a crossing of two strands that have already crossed before (i.e. above), we replace this cross by an elbow. \end{definition} \begin{figure}[ht] $$ \begingroup \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{0.07} \quad\begin{matrix} & 1 & 2 & 3 & 4 & 5 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 5 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \overset{\mathrm{reduct}}{\mapsto} \quad \begin{matrix} & 1 & 2 & 3 & 4 & 5 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 5 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \endgroup $$ \caption{\label{reduct} The reduction operation $\mathrm{reduct}$ applied to a non-reduced pipe dream} \end{figure} Obviously, $\mathrm{reduct}(P)$ is reduced for each $P$, and the operation acts trivially on reduced pipe dreams: $\mathrm{reduct}(P)=P$. We say that the \emph{shape} of a nonreduced pipe dream $P$ is the shape $w(\mathrm{reduct}(P))$ of its reduction. The set of all pipe dreams of a given shape $w\in\mathbf{S}_n$ will be denoted by $\PD(w)$. We will also denote the subset of reduced pipe dreams of this shape by $\PD_0(w)\subset\PD(w)$. The following theorem was proved by S.\,Billey and N.\,Bergeron and independently by S.\,Fomin and An.\,Kirillov. \begin{theorem}\cite{BilleyBergeron93,FominKirillov96}\label{thm:FK} The Schubert polynomials satisfy the equality \[ \mathfrak S_w=\sum_{P \in \PD_0(w)}\mathbf x^P, \] where \[ \mathbf x^P:=\prod_{(i,j)\in D_P}x_i. \] \end{theorem} \begin{example}\label{ex:1432} Consider the permutation $w=\overline{1432}$. There are five reduced pipe dreams of shape~$w$: \[ \begingroup \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{0.06} \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix}\quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad\begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad\begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad\begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \endgroup \] Hence the Schubert polynomial for $w$ looks as follows: \[ \mathfrak S_{\overline{1432}}(x_1,x_2,x_3)=x_1^2x_2+x_1^2x_3+x_1x_2^2+x_1x_2x_3+x_2^2x_3. \] \end{example} This theorem has the following modification for Grothendieck polynomials. \begin{definition} Denote by $\mathrm{ex}(P)$ the \emph{excess} of $P$, i.e. the number of ``redundant'' crosses in a (non-reduced) pipe dream $P$. Namely, set $\mathrm{ex}(P)=\#\left(D_P\smallsetminus D_{\mathrm{reduct}(P)}\right)$. \end{definition} \begin{theorem}\cite{FominKirillov93,FominKirillov94}\label{thm:gFK} The Grothendieck polynomials satisfy the following identity: \[ \mathfrak G^{(\beta)}_w=\sum_{P\in\PD(w)}\beta^{\mathrm{ex}(P)}\mathbf x^P. \] \end{theorem} \begin{example} To continue Example~\ref{ex:1432}, let us compute the Grothendieck polynomial for $w=\overline{1432}$. The set $\PD(w)$ consists of 11 pipe dreams, 5 of them being reduced and 6 non-reduced. \[ \begingroup \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{0.07} \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \endgroup \] \[ \begingroup \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{0.07} \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \endgroup \] \[ \begingroup \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{0.07} \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \endgroup \] The corresponding Grothendieck polynomial is equal to \[ \mathfrak G^{(\beta)}_{(1432)} =x_{1}^{2}x_{2}+x_{1}^{2}x_{3}+x_{1}x_{2}^{2}+x_{1}x_{2}x_{3}+x_{2}^{2}x_{3}+ \beta x_{1}^{2}x_{2}^{2}+2\beta x_{1}^{2}x_{2}x_{3}+2\beta x_{1}x_{2}^{2}x_{3}+\beta^{2}x_{1}^{2}x_{2}^{2}x_{3}. \] \end{example} Since $\mathrm{ex}(P)=0$ if and only if $P$ is reduced, we have $\mathfrak G_w^{(\beta)}=\mathfrak S_w+\beta(\ldots)$. This implies the equality $\mathfrak G_w^{(0)}=\mathfrak S_w$ we mentioned above. \subsection{Slide and glide polynomials}\label{ssec:slidepoly} S.\,Assaf and D.\,Searles~ \cite{AssafSearles17} introduced another basis in the ring of polynomials: the \emph{slide polynomials}. One of their main features is that each Schubert polynomial can be represented as a sum of slide polynomials with the coefficients 0 or 1. The subsequent paper by O.\,Pechenik and D.\,Searles~\cite{PechenikSearles19} provides a similar construction for Grothendieck polynomials. Let us recall these constructions here. \begin{definition} Let $P$ be a (possibly non-reduced) pipe dream. Denote a \emph{slide move} $S_i$ as follows. Suppose that the leftmost cross in the $i$-th row of $P$ is located strictly to the right of the rightmost cross in the $(i+1)$-st row (in particular, the row $i+1$ can contain only elbows). In this case, the leftmost cross in the $i$-th row can be shifted one step southwest: $\begingroup \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{0.07} \begin{matrix} \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross}\\ \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} \end{matrix} \mapsto \begin{matrix} \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows}\\ \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} \end{matrix} \endgroup $. If the initial pipe dream was non-reduced, this move can look as follows: $\begingroup \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{0.07} \begin{matrix} \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross}\\ \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} \end{matrix} \mapsto \begin{matrix} \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows}\\ \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} \end{matrix} \endgroup $. If the leftmost cross in the $i$-th row is either in the first column or weakly left of a cross in the $(i+1)$-st row, we will say that $S_i$ acts on $P$ identically. \end{definition} Note that a slide move preserves the shape of a pipe dream. Indeed, $\mathrm{reduct}(S_i(P))$ and $\mathrm{reduct}(P)$ either coincide or are obtained one from the other by a shape-preserving move of one cross: $\begingroup \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{0.07} \begin{matrix} \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross}\\ \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} \end{matrix} \mapsto \begin{matrix} \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows}\\ \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} \end{matrix} \endgroup $. Moreover, the number of crosses in a reduced pipe dream is preserved by a slide move. This means that a slide move sends a reduced pipe dreams to a reduced one. \begin{definition}\label{def:quasiyamanouchi} If all slide moves act on $P$ identically: i.e., for each $i$ we either have the $i$-th row starting with a cross, or the leftmost cross in the $i$-th row is located weakly left of a cross from the $(i+1)$-st row, then $P$ is said to be \emph{quasi-Yamanouchi}. Denote the set of all quasi-Yamanouchi pipe dreams of shape $w$ by $\QPD(w)\subset\PD(w)$, and the subset of all reduced quasi-Yamanouchi pipe dreams by $\QPD_0(w)=\PD_0(w)\cap\QPD(w)$. \end{definition} \begin{definition}\label{def:destand} The \emph{destandardization} operations $\dst\colon\PD(w)\to\QPD(w)$ and $\dst_0\colon\PD_0(w)\to\QPD_0(w)$ are defined as repeated applications of slide moves to a pipe dream until it becomes quasi-Yamanouchi. \end{definition} In~\cite[Lemma~3.12]{AssafSearles17} it is shown that every pipe dream can be sent into a quasi-Yamanouchi one by repeated applications of slide moves, and that the resulting quasi-Yamanouchi pipe dream does not depend on the order of slide moves and hence is well-defined. Both operations $\dst\colon\PD(w)\to\QPD(w)$ and $\dst_0\colon\PD_0(w)\to\QPD_0(w)$ are obviously surjective, since they are projectors to the sets of quasi-Yamanouchi and reduced quasi-Yamanouchi pipe dreams respectively. \begin{definition} Let $Q\in\QPD_0(w)$ be a reduced quasi-Yamanouchi pipe dream. The set $\dst_0^{-1}(Q)$ is called the \emph{slide orbit} of $Q$. If $Q\in\QPD(w)$ is a not necessarily reduced quasi-Yamanouchi pipe dream, then $\dst^{-1}(Q)$ is called the \emph{glide orbit} of $Q$. \end{definition} \begin{definition} For $Q\in\QPD_0(w)$, the \emph{slide polynomial} $\mathfrak F_Q$ is defined as the sum of monomials over the corresponding slide orbit of pipe dreams: \[ \mathfrak F_Q=\sum_{P\in\dst_0^{-1}(Q)}\mathbf x^P. \] For $Q\in\QPD(w)$, the \emph{glide polynomial} $\mathcal G^{(\beta)}_Q$ is defined as the sum of monomials over the glide orbit of pipe dreams: $$\mathcal G^{(\beta)}_Q=\sum_{P\in\dst^{-1}(Q)}\beta^{\mathrm{ex}(P)-\mathrm{ex}(Q)}\mathbf x^P.$$ \end{definition} This definition together with Theorems~\ref{thm:FK} and~\ref{thm:gFK} implies that \[ \mathfrak S_w=\sum_{Q\in\QPD_0(w)} \mathfrak F_Q\qquad\text{and}\qquad\mathfrak G^{(\beta)}_w=\sum_{Q\in\QPD(w)}\beta^{\mathrm{ex}(Q)}\mathcal G^{(\beta)}_Q. \] \begin{example} There are five quasi-Yamanouchi pipe dreams of shape $w=\overline{1432}$. This means that $\PD(w)$ splits into 5 glide orbits. One of them consists of seven pipe dreams (the quasi-Yamanouchi pipe dream is shown in parentheses): \[ \begingroup \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{0.07} \begin{pmatrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{pmatrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \endgroup \] \[ \begingroup \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{0.1} \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \begin{matrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{matrix} \quad \endgroup \] Consequently, the corresponding glide polynomial equals \[ \mathcal G^{(\beta)}_{s_3s_2s_3}= 2\beta x_{1}^{2}x_{2}x_{3}+\beta x_{1}x_{2}^{2}x_{3}+x_{1}^{2}x_{2}+x_{1}^{2}x_{3}+x_{1}x_{2}x_{3}+x_{2}^{2}x_{3}. \] Each of the remaining four glide orbits consists of one pipe dream: \[ \begingroup \setlength\arraycolsep{0pt} \renewcommand{\arraystretch}{0.07} \begin{pmatrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{pmatrix} \quad \begin{pmatrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{pmatrix} \quad \begin{pmatrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{pmatrix} \quad \begin{pmatrix} & 1 & 2 & 3 & 4 \\ 1 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 2 & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{cross} & \includegraphics[scale=0.5]{elbow} & \\ 3 & \includegraphics[scale=0.5]{elbows} & \includegraphics[scale=0.5]{elbow} & \\ 4 & \includegraphics[scale=0.5]{elbow} & \\ \end{pmatrix} \quad \endgroup \] Hence each of the corresponding glide polynomials has only one term: \[ \mathcal G^{(\beta)}_{s_2s_3s_2s_3}=x_1x_2^2x_3;\qquad\mathcal G^{(\beta)}_{s_3s_2s_3s_2}=x_1^2x_2^2;\qquad\mathcal G^{(\beta)}_{s_3s_2s_3s_2s_3}=x_1^2x_2^2x_3;\qquad\mathcal G^{(\beta)}_{s_2s_3s_2}=x_1x_2^2. \] \end{example} \section{Subword complexes and pipe dream complexes}\label{sec:subword} \subsection{Subword complexes}\label{ssec:subword} Consider an arbitrary Coxeter system $(\Pi, \Sigma)$, where $\Pi$ is a Coxeter group, and $\Sigma$ a system of simple reflections minimally generating $\Pi$. We will be particularly interested in the situation where $\Pi=\mathbf{S}_n$ is a symmetric group and $\Sigma=\{s_1,\dots,s_{n-1}\}$ is the set of simple transpositions. \begin{definition} A \emph{word} of length $m$ is a sequence ${\mathcal{Q}}=(\sigma_1, \ldots, \sigma_m)$ of simple reflections. A subsequence ${\mathcal{P}}=(\sigma_{i_1},\sigma_{i_2}, \ldots, \sigma_{i_k})$, where $1\leqslant i_1<i_2<\ldots<i_k\leqslant m$, is a \emph{subword} of ${\mathcal{Q}}$. We say that ${\mathcal{P}}$ \emph{represents} $\pi \in \Pi$ if $\sigma_{i_1} \sigma_{i_2} \ldots \sigma_{i_k}$ is a reduced decomposition of $\pi$. If some subword of ${\mathcal{P}}$ represents $\pi$, we will say that ${\mathcal{P}}$ \emph{contains} $\pi$. The \emph{subword complex} $\Delta({\mathcal{Q}}, \pi)$ is a set of nonempty subwords ${\mathcal{Q}}\smallsetminus {\mathcal{P}}$ whose complements ${\mathcal{P}}$ contain $\pi$. It is a simplicial complex; one of its faces belongs to the boundary of another if and only if the first of the corresponding subwords is a subset of the second one. \end{definition} All reduced subwords for $\pi \in \Pi$ have the same length. So the complex $\Delta({\mathcal{Q}}, \pi)$ is pure of dimension $m-\ell(\pi)$. The words ${\mathcal{Q}} \smallsetminus {\mathcal{P}}$ such that ${\mathcal{P}}$ represents $\pi$ are its facets. \begin{remark} To distinguish between words in an arbitrary Coxeter system and pipe dreams, we use the calligraphic font, such as in ${\mathcal{P}}$, ${\mathcal{Q}}$ for words and the regular font, such as in $P$, $Q$, for pipe dreams. \end{remark} \begin{example} Let $\Pi=\mathbf{S}_4, \pi=\overline{1432}, {\mathcal{Q}}=s_3s_2s_1s_3s_2s_3$. The permutation $\pi$ has two reduced decompositions $s_2s_3s_2$ and $s_3s_2s_3$. Let us label the center of a pentagon with $s_1$ and its vertices with reflections $s_3,s_2,s_3,s_2,s_3$ in the cyclic order. Then the facets of $\Delta({\mathcal{Q}}, \pi)$ are the triples that consist of two adjacent vertices and the center of the pentagon. \begin{figure}[ht] \centering \includegraphics[width=5cm]{complex1432-white.png} \caption{\label{complex-example} Subword complex $\Delta(s_3s_2s_1s_3s_2s_3, s_2s_3s_2)$.} \end{figure} \end{example} \begin{definition} Let $\Delta$ be a simplicial complex and $F\in\Delta$ a face. The \emph{deletion} of $F$ from $\Delta$ is the complex \[ \del(F, \Delta)=\{G \in \Delta \mid G \cap F = \varnothing\}. \] The \emph{link} of $F$ in $\Delta$ is the complex \[ \link(F, \Delta)=\{G \in \Delta \mid G \cap F = \varnothing, G \cup F \in \Delta\}. \] \end{definition} \begin{definition} An $n$-dimensional complex $\Delta$ is said to be \emph{vertex decomposable} if it is pure and satisfies one of the following properties: \begin{itemize} \item $\Delta$ is an $n$-dimensional simplex; or \item there exists a vertex $v \in \Delta$ such that $\del(v, \Delta)$ is a vertex decomposable $n$-dimensional complex, while $\link(v, \Delta)$ is an $(n-1)$-dimensional vertex decomposable complex. \end{itemize} \end{definition} \begin{definition}\label{def:shelling} A \emph{shelling} of a simplicial complex $\Delta$ is a total order on the set of its facets with the following property: for each $i,j$, such that $1 \leqslant i < j \leqslant t$, there exist $k$, where $1 \leqslant k < j$, and a vertex $v \in F_j$ such that $F_i \cap F_j \subseteq F_k \cap F_j = F_j \smallsetminus \{v\}$. A complex admitting a shelling is said to be \emph{shellable}. \end{definition} The definition of shelling can be restated in the following way: for each $j$ such that $2\leqslant j \leqslant t$, the complex $(\bigcup\limits_{i<j}F_i)\cap F_j$ is pure of dimension $\dim F_j-1$. The notion of vertex decomposability was introduced in~\cite{vertex-dec}; in the same paper it is shown that it implies the shellability. \begin{proposition}[\cite{vertex-dec}] Vertex decomposable complexes are shellable. \end{proposition} The following statement was proved in~\cite[Thm~2.5]{KnutsonMiller04}. \begin{theorem}\label{thm:subword-shellable} Subword complexes are vertex decomposable, and hence shellable. \end{theorem} \begin{definition} The \emph{Demazure product} $\delta({\mathcal{Q}})\in\Pi$ of a word ${\mathcal{Q}}$ is defined by induction as follows: $\delta(\sigma)=\sigma$ for $\sigma\in \Sigma$, and \[ \delta({\mathcal{Q}},\sigma)=\begin{cases} \delta({\mathcal{Q}})\sigma, &\text{if }\ell(\delta({\mathcal{Q}})\sigma)>\ell(\delta({\mathcal{Q}})),\\ \delta({\mathcal{Q}}), &\text{otherwise}.\end{cases} \] In other words, we multiply the elements in ${\mathcal{Q}}$ from left to right, omitting the letters that decrease the length of the product obtained at each step. One can also think about the Demazure product as the product in the monoid generated by $\Sigma$ subject to the relations of the Coxeter group with the relation $s_i^2=e$ being replaced by $s_i^2=s_i$, cf.\,\cite[Def.\,3.1]{KnutsonMiller04}. \end{definition} Now let us recall the main results from~\cite{KnutsonMiller04}. \begin{theorem}[{\cite[Thm~3.7]{KnutsonMiller04}}]\label{thm:ball-or-sphere} The complex $\Delta({\mathcal{Q}}, \pi)$ is either a ball or a sphere. A face ${\mathcal{Q}}\smallsetminus {\mathcal{P}}$ is contained in its boundary iff $\delta({\mathcal{P}})\ne \pi$. \end{theorem} \begin{corollary}[{\cite[Cor.\,3.8]{KnutsonMiller04}}] $\Delta({\mathcal{Q}}, \pi)$ is a sphere if $\delta({\mathcal{Q}})=\pi$, and a ball otherwise. \end{corollary} \subsection{Pipe dream complexes}\label{ssec:pdc} Pipe dreams are closely related to subword complexes of a certain form. Let $\Pi=\mathbf{S}_n$, and let us fix the following word for the longest permutation: \[ {\mathcal{Q}}_{0,n}=(s_{n-1} s_{n-2}\ldots s_3 s_2 s_1) (s_{n-1} s_{n-2} \ldots s_3 s_2) (s_{n-1} s_{n-2} \ldots s_3) \ldots( s_{n-1} s_{n-2}) (s_{n-1}). \] This word is obtained by reading the table $$ \begin{matrix} s_1 & s_2 & s_3 &\dots & s_{n-2}& s_{n-1}&\\ s_2 & s_3& \dots &s_{n-2}&s_{n-1}&\\ s_3& \dots & s_{n-2} &s_{n-1}\\ \vdots &\vdots &\iddots\\ s_{n-2} &s_{n-1}\\ s_{n-1} \end{matrix} $$ from right to left, from top to bottom. Let $P\in\PD_0(w)$ be a reduced pipe dream of shape $w\in\mathbf{S}_n$. For each of the crosses occuring in $P$, let us take the simple transposition from the corresponding cell of the table. We obtain a subword $\word(P)$ in ${\mathcal{Q}}_{0,n}$. It is clear that $\word(P)$ represents the permutation $w$. The converse is also true: if ${\mathcal{T}}$ is a subword in ${\mathcal{Q}}_{0,n}$ representing $w$, then the pipe dream with crosses corresponding to the letters of ${\mathcal{T}}$ is reduced and has the shape $w$. We obtain a bijection betwen the elements of $\PD_0(w)$ and facets of the complex $\Delta({\mathcal{Q}}_{0,n},w)$. \begin{definition} The complex $\Delta({\mathcal{Q}}_{0,n},w)$ is called a \emph{pipe dream complex}. \end{definition} The reduction of a pipe dream corresponds naturally to the Demazure product of the related subword: for each pipe dream $P$, we have $w(\mathrm{reduct}(P))=\delta(\mathrm{word}(P))$. Moreover, if $P$ is a nonreduced pipe dream of shape $w$, then $\mathrm{word}(P)$ contains $\mathrm{word}(\mathrm{reduct}(P))$ as a subword and hence contains the permutation $w$. Using these facts and Theorem~\ref{thm:ball-or-sphere}, we see that the pipe dreams from $\PD(w)$ bijectively correspond to the interior faces of the pipe dream complex $\Delta({\mathcal{Q}}_{0,n},w)$. The following description of Grothendieck polynomials in terms of pipe dream complexes is essentially due to A.\,Knutson and E.\,Miller, cf.~\cite[Cor.~5.5]{KnutsonMiller04}. Sometimes, as in~\cite{EscobarMeszaros18}, it is used as an equivalent definition of Grothendieck polynomials. \begin{corollary}\label{groth-sum} The Grothendieck polynomial $\mathfrak G_w^{\beta}$ is obtained as the sum of monomials corresponding to the interior faces of the corresponding pipe dream complex. Namely, for $w\in\mathbf{S}_n$, we have $$\mathfrak G_w^{(\beta)}=\sum_{P\in\mathrm{int}(\Delta(Q_{0,n}, w))} \beta^{\mathrm{codim}(P)}\mathbf x^P$$ (By $\mathbf x^P$ we denote the monomial of the pipe dream corresponding to a face $P$). \end{corollary} \begin{example}\label{ex:pentagon} Fig.\,\ref{pd-complex} represents the pipe dream complex for $w=\overline{1432}$. The pipe dreams are split into groups corresponding to their shapes; each pipe dream is indexed by the corresponding monomial $\beta^{\mathrm{ex}(P)}\mathbf x^P$ occuring in the Grothendieck polynomial. \begin{figure}[ht!] $$\includegraphics[width=17cm]{pd-complex.png}$$ \caption{The pipe dream complex for $w=\overline{1432}$} \label{pd-complex} \end{figure} \end{example} For $k\in \mathbb Z_{\geq 0}$, we introduce the following notation: $\PD_k(w)=\{P\in \PD(w)\mid \mathrm{ex}(P)=k\}$. \begin{corollary}\label{euler} For each permutation $w\in\mathbf{S}_n$, we have \[ \sum_{k=0}^{n(n-1)/2}(-1)^k |\PD_k(w)|=1. \] \end{corollary} \begin{proof} Specializing the Grothendieck polynomial at $\mathbf x=(1,1,\ldots,1)$ and $\beta=-1$, we obtain the following relation: \begin{multline*} \mathfrak G_w^{(-1)}(1,1,\ldots,1)=\sum_{P\in\PD(w)} (-1)^{\mathrm{ex}(P)}=\sum_{k=0}^{n(n-1)/2}(-1)^k |\PD_k(w)|=\sum_{P\in\mathrm{int}(\Delta({\mathcal{Q}}_{0,n}, w))} (-1)^{\mathrm{codim}(P)}=\\ =\sum_{P \in \Delta({\mathcal{Q}}_{0,n},w)}(-1)^{\mathrm{codim}(P)}+\sum_{P \in \partial\Delta({\mathcal{Q}}_{0,n},w)}(-1)^{\mathrm{codim}(P)}=(-1)^d\chi_{\Delta({\mathcal{Q}}_{0,n},w)}+(-1)^{d-1}\chi_{\partial\Delta({\mathcal{Q}}_{0,n},w)}. \end{multline*} Here $d=n(n-1)/2-\ell(w)$ is the dimension of the pipe dream complex, and $\chi_\Delta$ stands for the Euler characteristic of $\Delta$. For each $w\ne\delta({\mathcal{Q}}_{0,n})=w_0$, the pipe dream complex $\Delta({\mathcal{Q}}_{0,n}, w)$ is homeomorphic to a $d$-dimensional ball, and its boundary is homeomorphic to a $(d-1)$-dimensional sphere (for $w=w_0$, the corresponding pipe dream complex is a point). This means that \[ \chi_{\Delta({\mathcal{Q}}_{0,n},w)}=1,\] \[\chi_{\partial\Delta({\mathcal{Q}}_{0,n},w)}=1-(-1)^d, \] and hence \[ \mathfrak G^{(-1)}(1,1,\ldots,1)=\sum_{k=0}^{n(n-1)/2}(-1)^k |\PD_k(w)|=(-1)^d\left(1-(1-(-1)^d)\right)=(-1)^{2d}=1. \] \end{proof} \section{Slide complexes}\label{sec:sc} In this section we provide the main construction of this paper: we define the stratification of subword complexes into strata corresponding to slide (or glide) orbits. These strata are called \emph{slide complexes}. We show that, just like subword complexes, all such strata are homeomorphic to balls or spheres. \subsection{Slide complexes in general}\label{ssec:sc-gen} As before, let $(\Pi, \Sigma)$ be a Coxeter system. \begin{definition} Let ${\mathcal{Q}}, {\mathcal{S}}$ be two words in the alphabet $\Sigma$. By \emph{slide complex of subwords} $\widetilde{\Delta}({\mathcal{Q}}, {\mathcal{S}})$ we denote the set of subwords ${\mathcal{Q}}\smallsetminus {\mathcal{P}}$, such that their complements ${\mathcal{P}}$ contain ${\mathcal{S}}$ as a subword. Similarly to the case of subword complexes, this set of subwords has a natural structure of a simplicial complex. \end{definition} The following theorem is similar to Theorem~\ref{thm:subword-shellable}. \begin{theorem}\label{thm:shellable-slides} Slide complexes are vertex decomposable and hence shellable. \end{theorem} \begin{proof} It is clear that slide complexes are pure. Let ${\mathcal{Q}}=(\sigma, \sigma_2, \ldots, \sigma_m)$ and ${\mathcal{S}}=(s_{j_1},s_{j_2},\ldots,s_{j_l})$ be two words in the alphabet $\Sigma$. Let ${\mathcal{Q}}'=(\sigma_2, \ldots, \sigma_m)$ and ${\mathcal{S}}'=(s_{j_2},\ldots, s_{j_l})$. Then $\link(\sigma, \widetilde{\Delta}({\mathcal{Q}}, {\mathcal{S}}))=\widetilde{\Delta}({\mathcal{Q}}',{\mathcal{S}})$. If the word ${\mathcal{S}}$ starts with the letter $\sigma$, then $\del(\sigma, \widetilde{\Delta}({\mathcal{Q}}, {\mathcal{S}}))= \widetilde{\Delta}({\mathcal{Q}}', {\mathcal{S}}')$. Otherwise we have $\del(\sigma, \widetilde{\Delta}({\mathcal{Q}}, {\mathcal{S}}))=\link(\sigma, \widetilde{\Delta}({\mathcal{Q}}, {\mathcal{S}}))= \widetilde{\Delta}({\mathcal{Q}}', {\mathcal{S}})$. This means that for a vertex $\sigma$, the result of its deletion and its link in $\widetilde{\Delta}({\mathcal{Q}}, {\mathcal{S}})$ are slide complexes. Then we use the induction by the length of ${\mathcal{Q}}$. \end{proof} Let us introduce an analogue of the Demazure product for subwords. \begin{definition} Denote by $\widetilde{\delta}({\mathcal{Q}})$ the word obtained from ${\mathcal{Q}}$ by replacing each maximal subsequence of consecutive identical letters $s_i\ldots s_i$ by one letter $s_i$. For example, $\widetilde\delta(s_1s_1s_2s_1s_2s_2s_2)=s_1s_2s_1s_2$. \end{definition} \begin{remark} It is clear from the definition that for any word ${\mathcal{Q}}$, one has $\widetilde\delta(\delta({\mathcal{Q}}))=\delta(\widetilde\delta({\mathcal{Q}}))=\delta({\mathcal{Q}})$. \end{remark} The following result is the main theorem of this paper. It is analogous to~Thm~\ref{thm:ball-or-sphere} due to Knutson and Miller. \begin{theorem}\label{thm:main} Let ${\mathcal{Q}}$ and ${\mathcal{S}}$ be two words in the alphabet $\Sigma$, and let $\widetilde{\delta}({\mathcal{S}})={\mathcal{S}}$. Then the slide complex $\widetilde{\Delta}({\mathcal{Q}}, {\mathcal{S}})$ is homeomorphic to a sphere if $\widetilde{\delta}({\mathcal{Q}})={\mathcal{S}}$ and to a ball otherwise. A face ${\mathcal{Q}}\smallsetminus {\mathcal{P}}$ belongs to the boundary of this complex if and only if $\widetilde{\delta}({\mathcal{P}})\ne {\mathcal{S}}$. \end{theorem} \begin{proof} Consider the \emph{free Coxeter group} $\widehat \Pi$ generated by $\Sigma$ modulo the relations $s_i^2=e$, without any other relations (this corresponds to all marks at the edges of the Coxeter graph being equal to $\infty$). The elements of $\widehat \Pi$ can be naturally identified with words in the alphabet $\Sigma$ without identical consecutive letters. Under this identification, $\widetilde\delta({\mathcal{S}})$ is just the Demazure product of the word ${\mathcal{S}}$, and $\widetilde\delta({\mathcal{S}})={\mathcal{S}}$ if and only if ${\mathcal{S}}$ is reduced when considered as a word in $\widehat \Pi$. This means that the slide complex $\widetilde{\Delta}({\mathcal{Q}},{\mathcal{S}})$ is nothing but the subword complex $\Delta({\mathcal{Q}},{\mathcal{S}})$ for the group $\widehat\Pi$. The desired statement follows directly from~\cite[Thm~3.7, Cor.~3.8]{KnutsonMiller04}. \end{proof} \begin{remark} If $\widetilde{\delta}({\mathcal{S}})\ne {\mathcal{S}}$, a slide complex is not necessarily homeomorphic to a ball or to a sphere. For instance, if ${\mathcal{Q}}=s_1s_1s_1s_1$ and ${\mathcal{S}}=s_1s_1$, the complex $\widetilde{\Delta}({\mathcal{Q}},{\mathcal{S}})$ is the 1-skeleton of a tetrahedron. \end{remark} \begin{remark} Another proof of Theorem~\ref{thm:main} can be obtained by repeating the steps used in the proof of~\cite[Thm~3.7]{KnutsonMiller04}; essentially all the statements used in the latter theorem for the subword complexes also hold for the slide complexes. This proof is outlined in our short announcement~\cite{SmirnovTutubalina20}. \end{remark} Example~\ref{ex:pentagon} shows that the interior of the pipe dream complex for $w=\overline{1432}$ is decomposed into slide complexes; this can be viewed as a topological interpretation of the decomposition of the Schubert polynomial $\mathfrak S_{1432}$ (resp. the Grothendieck polynomial $\mathfrak G_{1432}^{(\beta)}$) into the sum of slide (resp. glide) polynomials. The following proposition generalizes it for the case of arbitrary subword complexes; in the next subsection we will apply this proposition to the case of pipe dream complexes. \begin{proposition} The interior part of the subword complex $\mathrm{int}\left(\Delta({\mathcal{Q}},w)\right)$ can be decomposed into the disjoint union of the interior parts of slide complexes: \begin{equation} \mathrm{int}\left(\Delta({\mathcal{Q}},w)\right)=\bigsqcup_{\substack{S \textrm{ word in } \Sigma\\\widetilde{\delta}({\mathcal{S}})={\mathcal{S}}\\\delta(S)=w}}\mathrm{int}\left(\widetilde\Delta({\mathcal{Q}},{\mathcal{S}})\right). \label{eq:decomp}\end{equation} \end{proposition} \begin{proof} Let ${\mathcal{Q}}\smallsetminus {\mathcal{P}}$ be an internal face of the subword complex of $w$. This means that $\delta({\mathcal{P}})=w$. Let ${\mathcal{S}}=\widetilde{\delta}({\mathcal{P}})$. It is clear that $\delta({\mathcal{S}})=\delta({\mathcal{P}})=w$, $\widetilde{\delta}({\mathcal{S}})={\mathcal{S}}$, and hence ${\mathcal{Q}}\smallsetminus {\mathcal{P}}$ belongs to the interior of the slide complex $\widetilde\Delta({\mathcal{Q}},{\mathcal{S}})$. Let us show the converse. If ${\mathcal{Q}}\smallsetminus {\mathcal{P}}$ is an interior face for the slide complex $\widetilde\Delta({\mathcal{Q}},{\mathcal{S}})$, with $\widetilde{\delta}({\mathcal{S}})={\mathcal{S}}$ and $\delta({\mathcal{S}})=w$, then $\widetilde\delta({\mathcal{P}})={\mathcal{S}}$. This means that $\delta({\mathcal{P}})=\delta(\widetilde{\delta}({\mathcal{P}}))=\delta({\mathcal{S}})=w$ and ${\mathcal{Q}}\smallsetminus {\mathcal{P}}$ is an interior face of the subword complex $\Delta({\mathcal{Q}},w)$. \end{proof} \subsection{Slide complexes in pipe dream complexes}\label{ssec:scpd} In this subsection we study the relation between the slide and glide orbits of pipe dreams and the slide complexes. As we have seen, the pipe dreams of shape $w\in\mathbf{S}_n$, both reduced and non-reduced, bijectively correspond to the internal faces of the pipe dream complex $\Delta({\mathcal{Q}}_{0,n}, w)$. This complex is homeomorphic to a ball unless $w=w_0$. \begin{proposition} This decomposition of the interior part of $\Delta({\mathcal{Q}}_{0,n}, w)$ into the interior parts of slide complexes is consistent with the decomposition of the set $\PD(w)$ into glide orbits: the pipe dreams from each glide orbit bijectively correspond to the pipe dreams from the interior part of the corresponding slide complex. \end{proposition} \begin{proof} Let $P\in\PD(w)$ be a pipe dream corresponding to the subword $\mathrm{word}(P)$ in ${\mathcal{Q}}_{0,n}=(\sigma_1,\sigma_2,\ldots,\sigma_{n(n-1)/2})$. Suppose that the action of the slide move $S_i$ on $P$ is not identical: it moves a cross $(i,j)$ southwest to the position $(i+1,j-1)$. Let $\sigma_k$ and $\sigma_{k+m}$ be two letters corresponding to the old and the new positions of this cross in ${\mathcal{Q}}_{0,n}$ (both these letters are equal to $s_{i+j-1}$). Since the pipe dream $P$ has no crosses in the $i$-th row to the left of the $j$-th column, and the row $i+1$ does not contain crosses to the right of the $(j-1)$-st column, this means that the letters $\sigma_{k+1},\ldots,\sigma_{k+m-1}$ do not occur in the subword $\word(P)$. The slide move $S_i$ acts on $\word(P)$ as follows: $\word(P)$ contains either both letters $\sigma_k$ and $\sigma_{k+m}$, or only $\sigma_k$. In the meantime, $\word(S_i(P))$ contains only the letter $\sigma_{k+m}$, but not $\sigma_k$. So each slide move either does not change the word $\word(P)$ or replaces two identical consecutive letters $s_{i+j-1}s_{i+j-1}$ in it by $s_{i+j-1}$. Thus slide moves preserve $\widetilde\delta$: we have $\widetilde{\delta}(\word(P))=\widetilde{\delta}(\mathrm{word}(S_i(P)))$ and for any two pipe dreams from the same glide orbit the corresponding faces belong to the interior of the same slide complex. The converse is also true. Consider $P\in\PD(w)$. Suppose that $\sigma_k$ and $\sigma_{k+m}$ are two identical letters in ${\mathcal{Q}}_{0,n}$, such that \begin{itemize} \item the subword $\word(P)$ contains either $\sigma_k$ or both of them; \item the interval $\sigma_{k+1},\ldots,\sigma_{k+m-1}$ does not contain letters equal to $\sigma_k=\sigma_{k+m}$; \item the letters $\sigma_{k+1},\ldots,\sigma_{k+m-1}$ do not occur in the subword $\word(P)$. \end{itemize} Then replacing $\sigma_k$ or the pair of letters $(\sigma_k,\sigma_{k+m})$ in the subword $\word(P)$ by the letter $\sigma_{k+m}$ corresponds to a slide move applied to $P$ (and preserves $\widetilde{\delta}(\word(P))$). Now it is easy to note that a pipe dream $Q$ is quasi-Yamanouchi if and only if $\word(Q)={\mathcal{S}}$ does not contain consecutive identical letters and the subword $\word(Q)$ is the rightmost appearance (this means that no letter can be moved to the right by the described operation) of the word ${\mathcal{S}}$ in ${\mathcal{Q}}_{0,n}$. Of course, this rightmost appearance is unique. So if $\widetilde{\delta}({\mathcal{S}})={\mathcal{S}}$ and ${\mathcal{Q}}_{0,n}$ contains ${\mathcal{S}}$ as a subword, then there exists exactly one quasi-Yamanouchi pipe dream $Q$ such that $\word(Q)={\mathcal{S}}$. For a pipe dream $P\in\PD(w)$ such that $\widetilde{\delta}(\word(P))={\mathcal{S}}$ it can be easily seen that $\word(\dst(P))={\mathcal{S}}$ and thus $\dst(P)=Q$, so $P\in\dst^{-1}(Q)$. Equivalently, if $\word(P_1)$ and $\word(P_2)$ belong to the interior of the same slide complex, then $\widetilde{\delta}(\word(P_1))=\widetilde{\delta}(\word(P_2))$ and $P_1$ and $P_2$ belong to the same glide orbit. \end{proof} This implies the following corollary, which is similar to Corollary~\ref{groth-sum}: it states that a glide polynomial is obtained as the sum of monomials over the interior faces of the corresponding slide complex. \begin{corollary}\label{cor:glide} Let $Q\in\QPD(w)$. Then \[ \mathcal G_Q^{(\beta)}=\sum_{P\in\mathrm{int}(\widetilde\Delta({\mathcal{Q}}_{0,n}, \mathrm{word}(Q)))} \beta^{\mathrm{codim}(P)}\mathbf x^P. \] Here by $\mathbf x^P$ we denote the monomial for the pipe dream corresponding to the face $P$. \end{corollary} By specializing at $\beta=0$, we recover a similar statement for slide polynomials. \begin{corollary}\label{cor:slide} Let $Q\in\QPD_0(w)$. Then \[ \mathfrak F_Q=\sum_{P} \mathbf x^P, \] where the sum is taken over all facets $P$ of the complex $\widetilde\Delta({\mathcal{Q}}_{0,n}, \mathrm{word}(Q))$. \end{corollary} \begin{figure}[ht] $$\includegraphics[width=17cm]{glide-complex.png}$$ \caption{Pipe dream complex $w=\overline{1432}$ represented as a union of the interiors of slide complexes} \label{slide-complex} \end{figure} \begin{example} Fig.\,\ref{slide-complex} represents the pipe dream complex for the permutation $w=\overline{1432}$ as a disjoint union of the interiors of slide complexes. The quasi-Yamanouchi pipe dreams are depicted in blue. For each pipe dream, we have the monomial $\beta^{\mathrm{ex}(P)-\mathrm{ex}(Q)}\mathbf x^P$ from the corresponding glide polynomial. \end{example} For $k\in\mathbb Z_{\geq 0}$, let $\QPD_k(w)=\{Q\in\QPD(w)\mid\mathrm{ex}(Q)=k\}$. The following corollary states that the alternating sum of the numbers of quasi-Yamanouchi pipe dreams with a given excess is 1. \begin{corollary} For each permutation $w\in \mathbf{S}_n$, we have the following equality: \[ \sum_{k=0}^{n(n-1)/2}(-1)^k |\QPD_k(w)|=1. \] \end{corollary} \begin{proof} Since the slide complexes are homeomorphic to balls, and the Euler characteristic of a ball is equal to 1, we obtain similarly to Corollary~\ref{euler} that \[ \mathcal G^{(-1)}_Q(1,\ldots,1)=1 \] for each $Q\in \QPD(w)$. Let us specialize the equality \[ \mathfrak G^{(\beta)}_w(\mathbf x)=\sum_{Q\in\QPD(w)}\beta^{\mathrm{ex}(Q)}\mathcal G^{(\beta)}_Q(\mathbf x) \] at $\beta=-1,\mathbf x=(1,\ldots, 1)$, and use the fact that $\mathfrak G^{(-1)}_w(1,\ldots,1)=\mathcal G^{(-1)}_Q(1,\ldots,1)=1$ for each $w\in\mathbf{S}_n, Q\in\QPD(w)$. We obtain the desired formula: \[ 1=\sum_{Q\in\QPD(w)}(-1)^{\mathrm{ex}(Q)}=\sum_{k=0}^{n(n-1)/2}(-1)^k |\QPD_k(w)|. \] \end{proof} \subsection{Remark on flip graphs}\label{ssec:pilaud} V.\,Pilaud and C.\,Stump~\cite{PilaudStump13} describe an algorithm\footnote{We are grateful to the referee for bringing the paper~\cite{PilaudStump13} to our attention.} for indexing all the facets of a subword complex. This is done by constructing the so-called \emph{flip graph} of this complex. This graph, first defined in ~\cite[Rem.~4.5]{KnutsonMiller04}, is the facet adjacency graph of a subword complex: its vertices corresponding to facets of a subword complex, and two vertices are connected by an edge if the two corresponding facets share a codimension 1 face. This graph admits a canonical orientation, turning it into a poset. The arrows in this orientation are called \emph{increasing flips}. This poset has a unique maximal and a unique minimal element, called the \emph{positive} (resp.~\emph{negative}) \emph{greedy facet}. The arrows of the opposite graph are called \emph{decreasing flips}; cf.~\cite[\S~4.2]{PilaudStump13}. This construction is applicable to any Coxeter system, in particular, to the free Coxeter group $(\widehat Pi,\Sigma)$. It turns out that for this Coxeter system, one recovers the notion of slide moves. The following two propositions are immediate. \begin{proposition} Let $Q$ be a reduced quasi-Yamanouchi pipe dream. Slide moves on the set $\dst_0^{-1}(Q)$ are precisely the decreasing flips of facets of $\Delta({\mathcal{Q}}_{0,n},\mathrm{word}(Q))$ (or, equivalently, facets of $\int(\Delta({\mathcal{Q}}_{0,n},\mathrm{word}(Q)))$). \end{proposition} \begin{proposition} A reduced pipe dream $P$ is quasi-Yamanouchi if and only if the corresponding face of the slide complex $\Delta({\mathcal{Q}}_{0,n},\mathrm{word}(P))$ is its positive greedy facet. \end{proposition} \def$'${$'$}
\subsection{Running with full top quark mass dependence ({\tt mtdep=3})} \label{sec:appendix1} In this appendix we give some further details about the running mode with full top quark mass dependence. The two-loop virtual amplitudes in the NLO calculation with full top quark mass dependence are computed via a grid which encodes the dependence of the virtual two-loop amplitude on the kinematic invariants $\hat{s}$ and $\hat{t}$~\cite{Heinrich:2017kxx}. We emphasize that the numerical values $m_H=125$\,GeV and $m_t=173$\,GeV are hardcoded in this grid and therefore should not be changed in {\tt powheg.input-save} when running in the {\tt mtdep=3} mode. The grid is generated using python code and is directly interfaced to the \POWHEGBOX{} fortran code via a python/C API. In order for the grid to be found by the code, the files ({\tt events.cdf, createdgrid.py, Virt\_full\_*E*.grid}) from the folder {\tt Virtual} need to be copied into the local folder where the code is run. Instead of copying the files, we suggest to create a symbolic link to the needed files. All this is done automatically if you use the script {\tt run.sh}. To do this manually: assuming the code is run from a subfolder (e.g. {\tt testrun}) of the process folder, the link can be created in this subfolder as follows: \begin{description} \item{\tt ln -s ../Virtual/events.cdf events.cdf} \item{\tt ln -s ../Virtual/creategrid.py creategrid.py} \item{\tt for grid in ../Virtual/Virt\_full\_*E*.grid; do ln -s \$grid; done} \end{description} Once the links are in place, the code can be run with {\tt mtdep=3} as usual. The python code {\tt creategrid.py} will then combine the virtual grids generated with the 23 combinations of coupling values to produce a new file {\tt Virt\_full\_*E*.grid} corresponding to the values of $c_{hhh}, c_t, c_{tt}, c_{ggh}, c_{gghh}$ defined by the user in the {\tt powheg.input-save} file. The python code for the grid relies on the {\tt numpy} and {\tt sympy} packages, which the user should install separately. When building the {\tt ggHH} process the Makefile will find the embedded python 3 library via a call to {\tt python3-config}, which the user should ensure is configured correctly and points to the correct library. Note that on some systems the python/C API does not search for packages (such as {\tt numpy} and {\tt sympy}) in the same paths as the python executable would, the user should ensure that these packages can be found also by an embedded python program. To ensure that the linked files are found, we recommend to add the run subfolder to {\tt PYTHONPATH}. \subsection{Powheg input and run scripts} The {\tt run.sh} script in the {\tt testrun} folder allows the different stages of \POWHEG{} to be run easily. By typing {\tt ./run.sh} without any argument a menu with the 4 {\tt mtdep} running modes described above is shown. For all {\tt mtdep} running modes, {\tt run.sh} will make the code go through the various steps (parallel stages) of the calculation: \begin{description} \item[{\tt parallelstage=1}:] generation of the importance sampling grid for the Monte Carlo integration; \item[{\tt parallelstage=2}:] calculation of the integral for the inclusive cross section and an upper bounding function of the integrand; \item[{\tt parallelstage=3}:] upper bounding factors for the generation of radiation are computed; \item[{\tt parallelstage=4}:] event generation, i.e. production of {\tt pwgevents-*.lhe} files. \end{description} \noindent Please note: if you use the script {\tt run.sh [mtdep]}, the value for {\tt mtdep} given as an argument to {\tt run.sh} will be used, even if you specified a different value for {\tt mtdep} in {\tt powheg.input-save}. After running {\tt parallelstage=4}, the LHE files produced by \POWHEG{} can be directly showered by either \pythia{} or \herwig{}. We provide a minimal setup for producing parton-shower matched distributions in {\tt test-pythia8}, respectively {\tt test-herwig7}. Both the angular-ordered and the dipole-shower implemented in \herwig{} can be used by changing the {\tt showeralg} flag to either {\tt default} or {\tt dipole} in {\tt HerwigRun.sh}. Further, we should point out that \POWHEG{} offers the possibility to use a damping factor $h=\texttt{hdamp}$ of the form~\cite{Alioli:2008tz,Alioli:2009je} \begin{align} F=\frac{h^{2}}{(p_{T}^{hh})^2+h^{2}}\,, \end{align} where $p_{T}^{hh}$ is the transverse momentum of the Higgs boson pair, to limit the amount of hard radiation which is exponentiated in the Sudakov form factor. The setting $F\equiv1$, corresponding to {\tt hdamp}$=\infty$, results in quite hard tails for observables like $p_{T}^{hh}$~\cite{Heinrich:2017kxx,Heinrich:2019bkc}. Changing the damping factor $F$ by setting the flag {\tt hdamp} to some finite value in the input card softens the high transverse momentum tails. Varying {\tt hdamp} allows shower uncertainties to be assessed within the \POWHEG{} matching scheme. However, {\tt hdamp} should not be so low that it starts to cut into the Sudakov regime. In fact, a too low value for {\tt hdamp} could spoil the logarithmic accuracy of the prediction. For this reason we suggest not to choose values for {\tt hdamp} below $\sim 200$. Our default value is {\tt hdamp=250}. \section{Introduction} \input{intro.tex} \section{Anomalous couplings in Higgs boson pair production} \label{sec:couplings} \input{couplings.tex} \section{Description of the code} \label{sec:usage} \input{usage.tex} \section{Phenomenological results} \label{sec:results} \input{results.tex} \clearpage \section{Conclusions} \label{sec:conclusions} We have presented a publicly available implementation of Higgs boson pair production in gluon fusion within an Effective Field Theory framework, calculated at full NLO QCD, in the \POWHEGBOXV{}. The code allows five anomalous couplings relevant for di-Higgs production to be varied and offers the possibility to produce fully differential final states. We have also investigated the behaviour of the shape of the invariant mass distribution of the Higgs boson pair, $m_{hh}$, for seven benchmark points representing characteristic $m_{hh}$-shapes based on an NLO analysis~\cite{Capozi:2019xsi}. In addition, for one of the benchmark points (benchmark 4), characterised by an enhanced tail in the $m_{hh}$ distribution, we carried out a comparison to the full NLO SM result as well as to the $m_t\to \infty$ approximation, including scale uncertainties, for both the $m_{hh}$ and the $p_{T}^{hh}$ distributions. We found that the two distributions show different characteristics concerning the distinction of the BSM curve from the SM (and approximate SM) curves: while in the $m_{hh}$ distribution the enhanced tail of benchmark 4 is clearly outside the uncertainty bands of the SM predictions, in the $p_{T}^{hh}$ distribution the bands for benchmark 4 and the SM in the $m_t\to \infty$ approximation overlap. This again demonstrates the importance of using full NLO predictions, particularly in trying to resolve partly degenerate directions in the space of anomalous couplings. We further produced results for the $p_{T}^{hh}$ distribution matched to three different parton showers: \pythia{} and two different \herwig{} parton showers. The two \herwig{} parton showers show very similar results. From previous SM results, it is known that loop-induced processes like $gg\to HH$ in \POWHEG{} matched to \pythia{} can show a harder tail than with other parton showers. However, in the case of benchmark point 4, \pythia{} produces less additional hard radiation than in the SM case, such that the \pythia{} and \herwig{} results are much more similar. Our studies show that the behaviour of higher-order effects known from the SM does not necessarily carry over to the BSM case, such that precise predictions for both cases are necessary to clearly identify new physics effects. With our code, fully exclusive studies of anomalous couplings in Higgs boson pair production at NLO QCD are possible. \section*{Acknowledgements} We would like to thank Gerhard Buchalla for useful discussions and Matteo Capozi and Gionata Luisoni for collaboration on earlier versions of this code. We also are grateful to Tom\'a\v{s} Je\v{z}o and Emanuele Re for very useful comments about the \POWHEGBOX. This research was supported in part by the COST Action CA16201 (`Particleface') of the European Union and by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under grant 396021762 - TRR 257. LS is supported by the Royal Society under grant number RP\textbackslash R1\textbackslash 180112. MK acknowledges support by the Swiss National Science Foundation (SNF) under grant number 200020-175595 and by the Forschungskredit of the University of Zurich, grant no. FK-19-102. We also acknow\-ledge resources provided by the Max Planck Computing and Data Facility (MPCDF). \renewcommand \thesection{\Alph{section}} \renewcommand{\theequation}{\Alph{section}.\arabic{equation}} \setcounter{section}{0} \setcounter{equation}{0} \section{Appendix} \input{appendix.tex} \bibliographystyle{JHEP} \subsection{Structure of the code} The code is an extension of the one presented in Ref.~\cite{Heinrich:2019bkc} to include the possibility of varying all five anomalous couplings rather than only the trilinear Higgs coupling. For the virtual two-loop corrections, we have built on the results of the calculations presented in Refs.~\cite{Borowka:2016ehy,Borowka:2016ypz}. These results were obtained by performing a (partial) reduction of the two-loop amplitude to master integrals based on {\sc Reduze}~\cite{Studerus:2009ye,vonManteuffel:2012np} and a subsequent numerical evaluation of the master integrals using the program {\sc SecDec}~\cite{Borowka:2015mxa,Borowka:2017idc}. This has been done with the top quark- and Higgs masses fixed to a numerical value. Therefore these mass values should not be changed in the {\tt ggHH} code. The real radiation matrix elements were implemented using the interface between \textsc{GoSam}{}~\cite{Cullen:2011ac,Cullen:2014yla} and the \POWHEGBOX~\cite{Alioli:2010xd,Luisoni:2013cuh}. The extra matrix elements occurring in the EFT framework have been generated by \textsc{GoSam}{}{} via a model file in {\tt UFO} format~\cite{Degrande:2011ua} which has been developed in Ref.~\cite{Buchalla:2018yce}, derived from the effective Lagrangian in Eq.~(\ref{eq:ewchl}) using {\sc FeynRules}~\cite{Alloul:2013bka}. The framework presented in Ref.~\cite{Heinrich:2019bkc} to interface the two-loop virtual contribution in {\tt POWHEG} is generalised in the following way: instead of a second-order polynomial (as for variations of $c_{hhh}$ only), at NLO we can write the squared matrix element for variations of all five anomalous couplings as in Eq.~(\ref{eq:AcoeffsNLO}), following Refs.~\cite{Azatov:2015oxa,Carvalho:2015ttv,Buchalla:2018yce}. \begin{align} |\mathcal{M}_{\rm BSM}|^2 &= a_1\, c_t^4 + a_2 \, c_{tt}^2 + a_3\, c_t^2 c_{hhh}^2 + a_4 \, c_{ggh}^2 c_{hhh}^2 + a_5\, c_{gghh}^2 + a_6\, c_{tt} c_t^2 + a_7\, c_t^3 c_{hhh} \nonumber\\ & + a_8\, c_{tt} c_t\, c_{hhh} + a_9\, c_{tt} c_{ggh} c_{hhh} + a_{10}\, c_{tt} c_{gghh} + a_{11}\, c_t^2 c_{ggh} c_{hhh} + a_{12}\, c_t^2 c_{gghh} \nonumber\\ & + a_{13}\, c_t c_{hhh}^2 c_{ggh} + a_{14}\, c_t c_{hhh} c_{gghh} + a_{15}\, c_{ggh} c_{hhh} c_{gghh}\, + a_{16}\, c^3_t c_{ggh} \nonumber\\ & + a_{17}\, c_t c_{tt} c_{ggh} + a_{18}\, c_t c_{ggh}^2 c_{hhh} + a_{19}\, c_t c_{ggh} c_{gghh} \, + a_{20}\, c_t^2 c_{ggh}^2 \nonumber\\ &+ a_{21}\, c_{tt} c_{ggh}^2 + a_{22}\, c_{ggh}^3 c_{hhh} + a_{23}\, c_{ggh}^2 c_{gghh} \,. \label{eq:AcoeffsNLO} \end{align} For the Born-virtual interference term, we produce grids using 6715 points (5194 points at $\sqrt{s}=14$ TeV and 1521 points at $100$ TeV) for 23 linearly independent sets of couplings. This enables us to derive, for each phase-space point, the coefficients $a_1, \dots, a_{23}$ by interpolation. Once the user has chosen a set of anomalous couplings, the 23 grids are combined into one using Eq.~(\ref{eq:AcoeffsNLO}). This step is performed only once, in the first {\tt POWHEG} parallel stage. The Born and real contributions are evaluated exactly for the chosen anomalous couplings without relying on a grid or interpolation. Note that the $a_i$ coefficients of Eq.~(\ref{eq:AcoeffsNLO}) are not equal to the $A_i$ coefficients of Ref.~\cite{Buchalla:2018yce}, which are derived for the (normalised) cross-section and not for the Born-virtual interference term. The original phase space points were produced with SM couplings, therefore some regions, for example the low $m_{hh}$-region, are less populated than the peak of the $m_{hh}$-distribution in the SM. The statistical uncertainty on the input data induces a systematic uncertainty on the 23 grids. We have checked the relative size of the uncertainties of the virtual corrections in each bin of the $m_{hh}$ distributions for all seven benchmark points. This uncertainty is below 2\% throughout the whole $m_{hh}$ range, except for the first bin. This bin is poorly populated in the SM and therefore the uncertainties in this bin are larger for coupling configurations where the low-$m_{hh}$ region is very different from the SM case or where the relative size of the virtual contribution is large. Hence we find uncertainties in the first $m_{hh}$ bin of about 6\% for all benchmarks except for benchmark 5, which has a 12\% uncertainty in this bin. \subsection{Usage of the code} The code can be found at the web page \begin{center} \url{http://powhegbox.mib.infn.it} \end{center} under {\tt User-Processes-V2} in the {\tt ggHH} process directory. An example input card ({\tt powheg.input-save}) and a run script ({\tt run.sh}) are provided in the {\tt testrun} folder accompanying the code. In the following we only describe the input parameters that are specific to the process $gg\to HH$ including five anomalous couplings. The parameters that are common to all \POWHEGBOX{} processes can be found in the \POWHEG{} manual {\tt V2-paper.pdf} in the \POWHEGBOXV{}/{\tt Docs} directory. \subsubsection*{Running modes} The code contains the SM NLO QCD amplitudes with full top quark mass dependence. A detailed description of the different approximations can be found in Ref.~\cite{Borowka:2016ypz}. For the Standard Model case as well as for BSM-values of the trilinear Higgs coupling $c_{hhh}$, the code can be run in four different modes, either by changing the flag {\tt mtdep} in the \POWHEGBOX{} run card {\tt powheg.input-save}, or by using the script {\tt run.sh [mtdep mode]}. If all five anomalous couplings are varied, there is only the possibility of either calculating at \begin{itemize} \item NLO with full top quark mass dependence, or \item LO (setting {\tt bornonly=1}) in either the full theory or in the $m_t\to\infty$ limit. \end{itemize} In more detail, the following choices are available: \begin{description} \item[{\tt mtdep=0}:]{all amplitudes are computed in the $m_t\to\infty$ limit (HTL).} {\em This option is only available at NLO in the SM case or if only $c_{hhh}$ is varied, or at LO.} \item[{\tt mtdep=1}:]{computation using Born-improved HTL. In this approximation the fixed-order part is computed at NLO in the heavy top limit and reweighted pointwise in the phase-space by the LO matrix element with full mass dependence divided by the LO matrix element in the HTL.} {\em This option is only available at NLO in the SM case or if only $c_{hhh}$ is varied, or at LO.} \item[{\tt mtdep=2}:]{computation in the approximation FT$_{\mathrm{approx}}$. In this approximation the matrix elements for the Born and the real radiation contributions are computed with full top quark mass dependence, whereas the virtual part is computed as in the Born-improved HTL. }{\em This option is only available at NLO in the SM case or if only $c_{hhh}$ is varied, or at LO.} \item[{\tt mtdep=3}:]{NLO computation with full top quark mass dependence.} \end{description} \subsubsection*{Input parameters} The bottom quark is considered massless in all four {\tt mtdep} modes. The Higgs bosons are generated on-shell with zero width. A decay can be attached through the parton shower in the narrow-width approximation. However, the decay is by default switched off (see the {\tt hdecaymode} flag in the example {\tt powheg.input-save} input card in {\tt testrun}). The masses of the Higgs boson and the top quark are set by default to $m_h=125$\,GeV, $m_t=173$\,GeV, respectively, and their widths have been set to zero. The full SM two-loop virtual contribution has been computed with these mass values hardcoded, therefore they should not be changed when running with {\tt mtdep = 3}, otherwise the two-loop virtual part would contain a different top or Higgs mass from the rest of the calculation. It is no problem to change the values of $m_h$ and $m_t$ via the {\tt powheg.input-save} input card when running with {\tt mtdep} set to $0$, $1$ or $2$. The Higgs couplings as defined in the context of the Electroweak Chiral Lagrangian (see~\cite{Buchalla:2018yce} and references within), can be varied directly in the {\tt powheg.input} card. These are, with their SM values as default: \begin{description}[leftmargin=!,labelwidth=\widthof{{\tt cgghh=0.0}:}] \item[{\tt chhh=1.0}:] { the ratio of the Higgs trilinear coupling to its SM value,} \item[{\tt ct=1.0}:] { the ratio of the Higgs Yukawa coupling to the top quark to its SM value,} \item[{\tt ctt=0.0}:] { the effective coupling of two Higgs bosons to a top quark pair,} \item[{\tt cggh=0.0}:] { the effective coupling of two gluons to the Higgs boson,} \item[{\tt cgghh=0.0}:] { the effective coupling of two gluons to two Higgs bosons.} \end{description} The possibility of varying all Higgs couplings (rather than $c_{hhh}$ only) is only available in the mode {\tt mtdep=3} (full NLO). More details about the {\tt mtdep=3} running mode are given in Appendix \ref{sec:appendix1}. The runtimes are dominated by the evaluation of the real radiation part. When run in the full NLO mode, the runtimes we observed were in the ballpark of 100 CPU hrs for an uncertainty of about 0.1\% on the total cross section.
\section{Introduction} Let $(Y,\omega)$ be a compact K\"ahler manifold, and $d\mu$ be a measure on $Y$. We say $(Y,\omega, d\mu)$ satisfies the \emph{Skoda type inequality}, if for any K\"ahler potential $u \in PSH(Y,\omega)$ normalised to $\sup u=0$, \begin{equation}\label{Skodaassumption} \int_Y e^{-\alpha u} d\mu \leq A, \end{equation} where $\alpha, A$ are independent of $u$. A prototype theorem is \begin{thm}\label{Skodastandardversion}\cite{Tian} On a fixed compact K\"ahler $(Y, \omega)$, the Skoda type inequality holds for $d\mu=\omega^n$. \end{thm} \begin{rmk} Here the supremum of all such $\alpha$ is known as Tian's alpha invariant, important for existence questions of K\"ahler-Einstein metrics. \end{rmk} We are interested in keeping track of these constants $\alpha, A$ as $(Y,\omega,d\mu)$ varies. The main theme of this paper is that oftentimes the Skoda constants can be chosen uniformly for quite flexible choices of probability measures $d\mu$, even when the complex structure degenerates severely. In the literature $\alpha$ is much studied (\cf \cite{Tian}\cite{GZ}), and a very recent preprint \cite{Eleonora} made aware to the author after the completion of this work contains a uniform estimate for both $\alpha, A$ in the related context of K\"ahler-Einstein manifolds. Our main application is to algebraic degenerations of Calabi-Yau manifolds. We work over $\C$. Let $S$ be a smooth affine algebraic curve, with a point $0\in S$. An \emph{algebraic degeneration family} is given by a submersive projective morphism $\pi: X\to S\setminus \{0\}$ with smooth connected $n$-dimensional fibres $X_t$ for $t\in S\setminus \{0\}$. A \emph{polarisation} is given by an ample line bundle $L$ over $X$; the sections of a sufficiently high power of $L$ induces an embedding $X\to \mathbb{CP}^N$, hence a Fubini-Study metric $\omega_X$ on $(X, L)$. For $0<|t|\ll 1$, a fixed choice of $\omega_X$ induces \emph{rescaled} background metrics $\omega_t= \frac{1}{ |\log |t| | } \omega_X|_{ X_t }$ on $X_t$ in the class $\frac{1}{|\log |t| | }c_1(L) $. A \emph{model} of $X$ is a normal flat projective $S$-scheme $\mathcal{X}$ which agrees with $\pi: X\to S\setminus \{0\}$ over the punctured curve. It is called a \emph{semistable snc model} if $\mathcal{X}$ is smooth, the central fibre over $0\in S$ is \emph{reduced} and is a simple normal crossing divisor in $\mathcal{X}$. By the semistable reduction theorem \cite[chapter 2]{ToroidalembeddingsI}, after finite base change to another smooth algebraic curve $S'$, we can always find some semistable snc model for the degeneration family $X\times_S (S'\setminus \{0\})$. Everything here is quasi-projective. We say the degeneration family is \emph{Calabi-Yau} if there is a trivialising section $\Omega$ of the canonical bundle $K_X$. Over a small disc $\mathbb{D}_t$ around $0\in S$, this induces holomorphic volume forms $\Omega_t$ on $X_t$ via $\Omega= dt\wedge \Omega_t$. The \emph{normalised Calabi-Yau measure} on $X_t$ is the probability measure \begin{equation}\label{CalabiYaumeasureeqn} d\mu_t= \frac{ \Omega_t \wedge \overline{\Omega}_t }{ \int_{X_t} \Omega_t \wedge \overline{\Omega}_t }. \end{equation} Our main result is \begin{thm}(Uniform Skoda estimate)\label{UniformSkodamaintheorem} Given a polarised algebraic Calabi-Yau degeneration family $\pi: X\to S\setminus \{0\}$ as above. Then there are uniform positive constants $\alpha, A$ independent of $t$ for $0<|t|\ll 1$, such that for the normalised Calabi-Yau measures $d\mu_t$, \[ \int_{X_t} e^{-\alpha u} d\mu_t \leq A, \quad \forall u\in PSH(X_t,\omega_t) \text{ with } \sup_{X_t} u=0. \] \end{thm} This is proved by reducing to the semistable snc model case, and prove a general Skoda type estimate there (\cf Theorem \ref{UniformSkodasemistable}). A major consequence, readily reaped using Kolodziej's estimate (\cf Theorem \ref{pluripotentialthm1}), is \begin{thm}\label{UniformLinfty} (Uniform $L^\infty$-estimate) Let $\phi_t$ be the K\"ahler potential of the Calabi-Yau metric in the class $(X_t, [\omega_t])$, namely \[ \frac{(\omega_t+ \sqrt{-1} \partial\bar{\partial}\phi)^n }{ \int_{X_t} \omega_t^n }= d\mu_t,\quad \sup_{X_t} \phi_t=0. \] Then $\norm{ \phi_t}_{L^\infty} \leq C$ independent of $t$ for $0<|t|\ll 1$. \end{thm} \begin{rmk} Applications of pluripotential theory to Calabi-Yau metrics when the K\"ahler class is degenerating can be found in \cite{EGZ2}, which is used further in \cite{Tosatti}. Our main results generalize certain aspects of \cite{LiSYZ} which focuses on degenerating projective hypersurfaces near the large complex structure limit. \end{rmk} \begin{Acknowledgement} The author is a 2020 Clay Research Fellow, currently based at the Institute for Advanced Study. He thanks Song Sun and Simon Donaldson for discussions, and Sebastien Boucksom, Eleonora Di Nezza, and Valentino Tossati for comments. \end{Acknowledgement} \section{Uniform Skoda inequality}\label{UniformSkodachapter} We work in the context of semistable simple normal crossing (snc) models. Concretely, let $\pi: \mathcal{X}\to \mathbb{D}_t$ be a flat projective family of $n$-dimensional varieties over a small disc $\mathbb{D}_t$, such that the total space $\mathcal{X}$ is smooth, $\pi$ is a submersion over the punctured disc with connected fibres, the central fibre $X_0$ is \emph{reduced} and is an snc divisor in $\mathcal{X}$. Denote the components of $X_0$ as $E_i$ with $i\in I$. We equip $\mathcal{X}$ with a fixed background K\"ahler metric $\omega_{\mathcal{X}}$, inducing a distance function $d_{\omega_{\mathcal{X}}}$. This induces a family of \emph{rescaled} K\"ahler metrics $\omega_t= \frac{1}{ |\log |t|| } \omega_{ \mathcal{X} }|_{X_t }$. We shall derive a uniform Skoda type estimate (\ref{Skodaassumption}) for $(X_t, \omega_t, d\mu_t)$, where $d\mu_t$ belongs to a natural class of measures. The main result is Theorem \ref{UniformSkodasemistable}. \subsection{Quantitative stratification and good test functions} There is a \emph{quantitative stratification} on any smooth fibre $X_t$ induced by the intersection pattern of $E_i$: for $J\subset I$ such that $E_J=\cap_{i\in J} E_i\neq \emptyset$, the corresponding statum is \[ E_J^0= \{ x\in X_t | d_{\omega_{\mathcal{X}}}( x, E_J )\lesssim \epsilon \} \setminus \{ x\in X_t | d_{\omega_{\mathcal{X}}}( x, E_{J'} )\lesssim \epsilon , \text{ some } J'\supsetneq J \}, \] namely a small `$\epsilon$-tubular neighbourhood' of $E_J$ minus the deeper strata. For $J=\{ i\}$ we write $E_i^0= E_{\{i\} }^0$. Here the disc $\mathbb{D}_t$ and the small parameter $\epsilon\ll 1$ can be shrinked for convenience; the essential thing is that all parameters should be independent of the coordinate $t$. It is useful to introduce local coordinates $\{ z_i \}_0^{n}$ around $E_J\subset \mathcal{X}$, such that $z_0, \ldots, z_p$ with $p=|J|-1$ are the local defining equations of $E_j$ for $j\in J$, and locally the fibration map is $t=z_0\ldots z_p$. Then up to uniform equivalence, locally \begin{equation* \omega_{ \mathcal{X} }\sim \sum_0^{n} \sqrt{-1}dz_i\wedge d\bar{z}_i. \end{equation*} The rest of this section is devoted to the construction of good test functions. Given any of these divisors $E_0$, we can find a nonnegative function $h=h_{E_0}$ on $\mathcal{X}$, such that \begin{itemize} \item In the local charts near $E_0$ with $z_0$ being the defining function for $E_0$, \[ h= |z_0|^2 \tilde{h}(z_0, \ldots z_n) \] for some positive smooth function $\tilde{h}$; \item Away from $E_0$ the function $h$ is comparable to 1. \end{itemize} We observe \begin{itemize} \item The form $\partial \bar{\partial} \log h= \partial \bar{\partial} \log \tilde{h}$ extends smoothly; \item For $|t|^2\ll h\lesssim \delta\ll 1$ inside $X_t$, so that $|z_0|\gg |t|$, by a local calculation near $E_J$ with $0\in J$, \[ \begin{split} &\sqrt{-1} \partial \log h \wedge \bar{\partial } \log h \wedge \omega_{ \mathcal{X} }|_{X_t}^{n-1} \geq \frac{ \sqrt{-1} }{2|z_0|^2} dz_0\wedge d\bar{z}_0\wedge\omega_{ \mathcal{X} }|_{X_t}^{n-1} \\ &\gtrsim \min\{ \frac{1}{|z_0|^2}, \max_{1\leq i\leq p} |z_i|^{-2} \} \omega_{ \mathcal{X} }|_{X_t}^n \\ & \gtrsim \min\{ \frac{1}{h}, h^{1/p} |t|^{-2/p} \}\omega_{ \mathcal{X} }|_{X_t}^n \\ & \gtrsim \min\{ \frac{1}{h}, h^{1/n} |t|^{-2/n} \}\omega_{ \mathcal{X} }|_{X_t}^n . \end{split} \] Here in the first line we need to fix $\delta\ll 1$ so that the effect of $\partial \log h$ is dominated by $d\log z_0$. The second line uses that for $1\leq k\leq p$, the volume forms on $X_t$ \[ \frac{1}{|z_0|^2} dz_0\wedge d\bar{z}_0\wedge \prod_{j\neq k, 1\leq j\leq n} \sqrt{-1}dz_j\wedge d\bar{z}_j \sim \frac{1}{|z_k|^2} \prod_{ 1\leq j\leq n} \sqrt{-1}dz_j\wedge d\bar{z}_j, \] and the third line uses $|t|=|z_0\ldots z_p|\sim h^{1/2}|z_1\ldots z_p|$. \item On $X_t$ the function $h\gtrsim |t|^2$. The region $\{ |t|^2\sim h \}\subset X_t$ can be identified as $E_0^0$, namely the vicinity of $E_0$ away from deeper strata. Here \[ \begin{split} &\sqrt{-1} \partial \log h \wedge \bar{\partial } \log h \wedge \omega_{ \mathcal{X} }|_{X_t}^{n-1} \geq 0, \\ & \sqrt{-1} \partial \bar{\partial } \log h \wedge \omega_{ \mathcal{X} }|_{X_t}^{n-1} \gtrsim -\omega_{ \mathcal{X} }|_{X_t}^{n} . \end{split} \] \end{itemize} \begin{lem}\label{goodtestfunction} (Good test function) Given the divisor $E_0$, we can choose a $C^2$ test function $v$ on $X_t$ such that the following hold uniformly for small $t\neq 0$: \begin{itemize} \item $v$ is zero for $h\geq \delta$. \item Globally $0\leq v\leq -\log |t|$. \item For any divisor $E_j$ intersecting $E_0$, there is a subset of $E_j^0$ with measure at least $C_2$ on which $\sqrt{-1} \partial \bar{\partial}v \wedge \omega_{ \mathcal{X} }|_{X_t}^{n-1} \geq C_3\omega_{ \mathcal{X} }|_{X_t}^n $. \item For $C_4 |t|^2 \leq h\leq \delta$, the form $\sqrt{-1}\partial \bar{\partial} v\wedge \omega_{ \mathcal{X} }|_{X_t}^{n-1} \geq 0$. \item For $h\leq C_4 |t|^2$, the form $\sqrt{-1}\partial \bar{\partial} v \wedge \omega_{ \mathcal{X} }|_{X_t}^{n-1}\geq -C_5\omega_{ \mathcal{X} }|_{X_t}^n $. \end{itemize} \end{lem} \begin{proof} We seek the test function in the form $v=\Phi\circ \log h$ for some convex, non-increasing, non-negative $C^2$-function $\Phi$. Compute \[ \partial \bar{\partial} v= \Phi'' \partial \log h \wedge \bar{\partial } \log h + \Phi' ( \partial \bar{\partial } \log \tilde{h}), \] so using the properties of $h$ above, \[ \sqrt{-1} \partial \bar{\partial}v \wedge \omega_{ \mathcal{X} }|_{X_t}^{n-1} \geq \begin{cases} \left( \Phi'' C_1' \min\{ \frac{1}{h}, h^{1/n} |t|^{-2/n} \} +\Phi'C_2' \right) \omega_{ \mathcal{X} }|_{X_t}^n , \quad &|t|^2\lesssim h\leq \delta, \\ C_3' \Phi' \omega_{ \mathcal{X} }|_{X_t}^n, \quad & h\lesssim |t|^2. \end{cases} \] To satisfy our conditions on $v$, it is enough to have \begin{itemize} \item $\Phi(x)=0$ for $x\geq \log \delta$. \item $|\Phi'(x)|\lesssim 1$ for $2\log |t|\lesssim x\leq \log \delta$. \item $ -\frac{d}{dx} \log |\Phi'|= \frac{\Phi''}{|\Phi'| } \geq C_4' \max\{ h, h^{-1/n} |t|^{2/n} \}$ for $ h=e^x\leq \delta,$ where $C_4'> C_2'/C_1'$. Morever, for $x<\delta$, we need $\Phi'<0$ so that $\sqrt{-1} \partial \bar{\partial}v \wedge \omega_{ \mathcal{X} }|_{X_t}^{n-1}$ has some strict positivity for $\delta/2<h<\delta$. Notice convexity of $\Phi$ is a consequence of these conditions. \end{itemize} To construct such $\Phi$, we can prescribe the behaviour near $x=\log \delta$ by $ \Phi'(x)= -e^{1/(x-\log \delta )} $ for $x< \log \delta$, and match this with a solution to \[ -\frac{d}{dx} \log |\Phi'| = C_4' \max\{e^x, e^{-x/n} |t|^{2/n} \}, \quad x<\log \delta \] for some large enough $C_4'$, such that $\Phi'$ remains $C^1$ at the matching point. Integration shows that $ |\Phi'|$ remains uniformly bounded at $h\sim |t|^2$, or equivalently $x\sim 2\log |t|$. \end{proof} \subsection{Convexity} Consider $u\in PSH(X_t, \omega_t)$ normalised to $\sup_{X_t} u=0$. Equivalently, we can cover $X_t$ by a bounded number of charts as before, and use the local potentials of $\omega_{\mathcal{X} }$ to represent $u$ as a collection of local plurisubharmonic (psh) functions $\{ u_\beta\}$ with $|u_\beta-u|\leq C$. \begin{lem}(Convexity)\label{pshconvexity} Let $\phi$ be any psh function on the open subset of $ \{ 1<|z_i|<\Lambda, i=1,\ldots p, |z_k|<1, k=p+1, \ldots n \}\subset (\C^*)^p\times \C^{n-p}$. Then the function \[ \bar{\phi}(x_1, \ldots x_n)= \frac{1}{(2\pi)^n} \int_{D(1)^{n-p} } \prod_{p+1}^n \sqrt{-1} dz_k \wedge d\bar{z}_k \int_{T^p} \phi( e^{x_1+i\theta_1}, \ldots e^{x_p+i\theta_p}) d\theta_1\ldots d\theta_p \] is convex. \end{lem} \begin{proof} For any choice of $\theta_i$ the function $\phi(z_1 e^{i\theta_1}, \ldots z_p e^{i\theta_n}, z_{p+1},\ldots, z_n)$ is psh, since the $T^p$-action on $(\C^*)^p$ is holomorphic. Thus the average function $\bar{\phi}$ is also psh as a function of $z_1,\ldots z_p$. Any $T^p$-invariant psh function must be convex in the log coordinates, because for $x_i=\log |z_i|$, \[ \sqrt{-1}\partial \bar{\partial} \bar{\phi}= \frac{1}{4} \sum \frac{\partial^2 \bar{\phi}}{ \partial x_i \partial x_j } \sqrt{-1} d\log z_i \wedge d\overline{\log z_j} \geq 0. \] \end{proof} \subsection{Harnack type inequality} \begin{lem} (Almost maximum on top strata) For $u\in PSH(X_t, \omega_t)$ normalised to $\sup_{X_t} u=0$, there is some $i\in I$, such that \[ \sup_{E_i^0} u \geq -C, \quad \int_{E_i^0} u \omega_{ \mathcal{X} }|_{X_t}^n \geq -C'. \] \end{lem} \begin{proof} Let the global maximum of $u$ be achieved at $q_0\in E_J^0$, and denote the local potential of $u$ as $u_\beta$. Without loss of generality $u_\beta\leq 0$. We have $u_\beta(q_0) \geq -C$ since $|u-u_\beta|\leq C$. Applying the mean value inequality around $q_0$, we find that the local average function $\bar{u}_\beta$ produced in Lemma \ref{pshconvexity} satisfies $\sup \bar{u}_\beta\geq -C$ for another uniform constant $C$. By the convexity of $\bar{u}_\beta$ its sup is almost achieved at the boundary of the chart, which is contained in a union of less deep strata $E_{J'}^0$ with $J'\subsetneq J$. Thus we can find a point $q'$ with $u(q')\geq -C$ that belongs to a less deep stratum; an induction shows that there is some $i\in I$, such that $\sup _{E_i^0} u \geq -C$. For the $L^1$-bound we recall the following Harnack inequality argument. Suppose a coordinate ball $B(q, 3R)$ is contained in a local chart in a small neighbourhood of $E_i^0$. Applying the mean value inequality to the local psh function associated to $u$, we see for $y\in B(q,R)$ that \[ u(y) \leq C+ \dashint_{B(y,2R)} u \lesssim 1+ \dashint_{B(q,R)} u. \] hence the Harnack inequality \[ \dashint_{B(q,R)} |u |\lesssim 1+ \inf_{B(q, R)} (-u). \] Applying this to a chain of balls connecting any two points in $E_i^0$ gives the $L^1$-bound $\int_{E_i^0} u \omega_{ \mathcal{X} }|_{X_t}^n \geq -C'$; the bound is uniform because the number of balls involved in the chain can be controlled independent of $t$. \end{proof} \begin{prop}(Almost maximum on top strata II)\label{AlmostmaximumII} There is a uniform lower bound for all $|t|\ll 1$ and all $i\in I$: \begin{equation} \sup_{E_i^0} u \geq -C, \quad \int_{E_i^0} u \omega_{ \mathcal{X} }|_{X_t}^n \geq -C'. \end{equation} \end{prop} \begin{proof} The $L^1$-estimate follows from the sup estimate as above, so the real problem is to transfer bounds between different $E_i^0$. This is nontrivial because the necks connecting $E_i^0$ with each other are highly degenerate. Given one divisor $E_0$ such that $ \int_{E_0^0} u \omega_{ \mathcal{X} }|_{X_t}^n \geq -C, $ we produce a good test function $v$ by Lemma \ref{goodtestfunction}. Integrating by parts, \[ \int_{X_t} v \sqrt{-1}\partial \bar{\partial} u \wedge \omega_{\mathcal{X} }|_{X_t}^{n-1} = \int_{X_t} u \sqrt{-1}\partial \bar{\partial} v \wedge \omega_{\mathcal{X} }|_{X_t}^{n-1}. \] The LHS is the difference of $\int_{X_t} v(\omega_t+ \sqrt{-1}\partial \bar{\partial} u) \wedge \omega_{\mathcal{X} }|_{X_t}^{n-1}$ and $\int_{X_t} v\omega_t \wedge \omega_{\mathcal{X} }|_{X_t}^{n-1}$, and since $-\log |t|\gtrsim v\geq 0$ both terms are bounded between $0$ and $C$. Thus \[ |\int_{X_t} u \sqrt{-1}\partial \bar{\partial} v \wedge \omega_{\mathcal{X} }|_{X_t}^{n-1}|\leq C. \] Now the form $\sqrt{-1}\partial \bar{\partial} v \wedge \omega_{ \mathcal{X} }|_{X_t}^{n-1}$ can only be negative on $\{ h\sim |t|^2 \}=E_0^0$, and is bounded below by $-C \omega_{ \mathcal{X} }|_{X_t}^{n}$. Thus the positive part of the signed measure $u \sqrt{-1}\partial \bar{\partial} v \wedge \omega_{\mathcal{X} }|_{X_t}^{n-1}$ has total mass controlled by $ \int_{E_0^0} |u| \omega_{ \mathcal{X} }|_{X_t}^n \leq C$. Consequently, the negative part of the signed measure must also have total mass $\leq C$. By construction, for any divisor $E_j$ intersecting $E_0$ there is a nontrivial amount of $\sqrt{-1}\partial \bar{\partial} v \wedge \omega_{\mathcal{X} }|_{X_t}^{n-1}$-measure inside $E_j^0$. This forces $\sup_{E_j^0} u \geq -C$. To summarize, we have transferred the sup bound from $E_0^0$ to any $E_j^0$ with $E_j\cap E_0\neq \emptyset$. Since the central fibre $X_0$ is connected, in at most $|I|$ steps this sup bound is transferred to all $E_i^0$ with $i\in I$. \end{proof} \begin{rmk} This proof is inspired by the intersection theoretic argument of \cite[section 6.1]{Boucksomsemipositive}, which can be viewed as a non-archimedean analogue. \end{rmk} \subsection{Local $L^1$ estimate} Given a local chart on $E_J^0$ with $\C^*$-coordinates $z_1,\ldots z_p$ and $\C$-coordinates $z_{p+1}, \ldots, z_n$, and a point $q$ therein, we shall refer to the subregion \[ \{ \frac{1}{2} |z_i(q)| \lesssim|z_i| \lesssim 2|z_i(q)| , \quad 1\leq i\leq p \} \] as a \emph{log scale}. \begin{lem}\label{LocalL1estimate} (Local $L^1$-estimate) Within every log scale there is a uniform bound on the $L^1$-average integral \[ \dashint_{loc} |u| \prod_1^p \sqrt{-1}d\log z_i \wedge d\log \bar{z}_i \wedge \prod_{p+1}^n \sqrt{-1}d z_k \wedge d \bar{z}_k \leq C. \] \end{lem} \begin{proof} We induct on the depth of the strata. For $p=0$ this follows from Prop. \ref{AlmostmaximumII}. So let us assume the bound is achieved for depth $<p$. For a given chart, we consider the local psh function $u_\beta$ associated to $u$ and produce the convex average function $\bar{u}_\beta$ as in Lemma \ref{pshconvexity}. Since a definite neighbourhood of the boundary of the chart lies inside less deep strata, we know that near the boundary $|\bar{u}_\beta|\leq C$ by the induction hypothesis and the convexity condition. Using convexity again in the interior of the chart we see $|\bar{u}_\beta|\leq C$ in the whole chart. Within any log scale, by construction the local average $ \dashint_{loc} (u_\beta- \bar{u}_\beta)=0. $ But $u_\beta\leq C$ by $u\leq 0$, hence \[\dashint_{loc} |u_\beta-\bar{u}_\beta| \lesssim \dashint_{loc} (u_\beta- \bar{u}_\beta )_+ \leq C. \] Using $|u-u_\beta|\leq C$ we conclude the local $L^1$-estimate on $u$. \end{proof} \subsection{Local Skoda estimate}\label{Skodainequalitybackgroundsection} We recall a basic version of the \emph{Skoda inequality}: \begin{prop}\label{Skodabasicversion} (\cf \cite[Thm 3.1]{Zeriahi}) If $\phi$ is psh on $B_2\subset \C^n$, with $\int_{B_2} |\phi| \omega_E^n \leq 1$ with respect to the standard Euclidean metric $\omega_E$, then there are dimensional constants $\alpha$, $C$, such that \[ \int_{B_1} e^{-\alpha \phi} \omega_E^n \leq C. \] \end{prop} Applying this with Lemma \ref{LocalL1estimate}, \begin{cor} (Local Skoda estimate) Within every log scale, there are uniform positive constants $\alpha$ and $C$, such that \[ \dashint_{loc} e^{-\alpha u} \prod_1^p \sqrt{-1}d\log z_i \wedge d\log \bar{z}_i \wedge \prod_{p+1}^n \sqrt{-1}d z_k \wedge d \bar{z}_k \leq C. \] \end{cor} \subsection{Uniform global Skoda estimate} We are interested in the following class of measures, motivated by Calabi-Yau measures (\cf section \ref{CalabiYaumeasure}). Let $a_i$ be non-negative real numbers assigned to $i\in I$, with $\min a_i=0$. Let \[ m= \max\{ |J|-1: E_J\neq \emptyset, a_i=0 \text{ for } i\in J \}. \] We say the measures $d\mu_t$ on $X_t$ satisfy a \emph{uniform upper bound of class $(a_i)$}, if on the local charts of each $E_J^0$, \begin{equation}\label{measureupperbound} d\mu_t \leq \frac{ C}{ |\log |t||^m } |z_0|^{2a_0}\cdots |z_p|^{2a_p} \prod_1^p \sqrt{-1}d\log z_i \wedge d\log \bar{z}_i \wedge \prod_{p+1}^n \sqrt{-1}d z_k \wedge d \bar{z}_k. \end{equation} The normalisation factor ensures $\int_{X_t}d\mu_t \leq C$ independent of $t$, by a straightforward local calculation. \begin{thm}\label{UniformSkodasemistable} (Uniform Skoda estimate) Suppose the measures $d\mu_t$ on $X_t$ satisfy a uniform upper bound of class $(a_i)$. Then there are uniform positive constants $\alpha$ and $A$, such that \[ \int_{X_t} e^{-\alpha u} d\mu_t \leq A, \quad \forall u\in PSH(X_t,\omega_t) \text{ with } \sup_{X_t} u=0. \] \end{thm} \begin{proof} We choose the charts so that each point on $X_t$ is covered by $\leq C$ log scales. Summing over the local Skoda estimates from all log scales, $\int_{X_t} e^{-\alpha u}d\mu_t$ is bounded by \[ \begin{split} &\frac{C}{ |\log |t||^m } \sum_{\text{log scales}} \int_{loc} |z_0|^{2a_0}\ldots |z_p|^{2a_p} \prod_1^p \sqrt{-1}d\log z_i \wedge d\log \bar{z}_i \wedge \prod_{p+1}^n \sqrt{-1}d z_k \wedge d \bar{z}_k \\ &\leq C. \end{split} \] \end{proof} \section{Application to Calabi-Yau degeneration} We work in the setting of polarised algebraic degeneration of Calabi-Yau manifolds, as in the Introduction. \subsection{Calabi-Yau measure}\label{CalabiYaumeasure} The Calabi-Yau measure (\ref{CalabiYaumeasureeqn}) is studied thoroughly in \cite{Boucksom1}, but it is illustrative to recall it explicitly on a semistable snc model $\mathcal{X}$. The discussion is local on the base, and we will follow the notations of section \ref{UniformSkodachapter}, e.g. the components of the central fibre are denoted as $E_i$ for $i\in I$. The canonical divisor $K_{ \mathcal{X} }=\sum_i a_i E_i$ is supported on the central fibre, since $K_X$ is trivialised. Multiplying $\Omega$ by a power of $t$, which does not change $d\mu_t$, we may assume $\min a_i=0$. In the local coordinates around $E_J$ away from the deeper strata, \[ \Omega= f_J \prod_0^p z_i^{a_i} dz_i \wedge \prod_{p+1}^n dz_j \] for some nowhere vanishing local holomorphic function $f_J$. Since $t= z_0\ldots z_p$, \[ \Omega_t= f_J z_0^{a_0}\ldots z_p^{a_p} \prod_1^p d\log z_i \wedge \prod_{p+1}^n dz_j, \] hence \[ \sqrt{-1}^{n^2}\Omega_t \wedge \overline{\Omega}_t= |f_J|^2 |z_0|^{2a_0}\ldots |z_p|^{2a_p} \prod_1^p \sqrt{-1}d\log z_i \wedge d\overline{\log z_i} \wedge \prod_{p+1} ^n\sqrt{-1}d z_j \wedge d\overline{z}_j. \] The total measure $\int_{X_t} \sqrt{-1}^{n^2}\Omega_t \wedge \overline{\Omega}_t$ is of the order $O(|\log |t| |^m )$ where \[ m= \max\{ |J|-1: E_J\neq \emptyset, a_i=0 \text{ for } i\in J \}. \] Thus $d\mu_t $ satisfies a uniform upper bound of class $(a_i)$ (\cf (\ref{measureupperbound})). \subsection{Uniform Skoda estimate} We now prove the main theorem \ref{UniformSkodamaintheorem}. \begin{proof} First we observe that the choice of the Fubini-Study metric $\omega_X$ is immaterial. Given any two choices, the relative K\"ahler potential between them is bounded by $O(|\log |t| |)$ for $0<|t|\ll 1$, because the pole order of a section near $t=0$ must be finite. Thus the relative K\"ahler potential between two choices of $\omega_t$ is bounded by $O(1)$ independent of $t$, which affects the Skoda constant $A$ but not its uniform nature. We now pass to a finite base change and find a semistable reduction. The Calabi-Yau measure $d\mu_t$ on $X_t$ is independent of the parametrisation of the base, and is preserved under finite base change. Thus it is enough to prove it assuming $\omega_X$ agrees with a smooth K\"ahler metric on a semistable snc model $\mathcal{X}$; this is a special case of Theorem \ref{UniformSkodasemistable}. \end{proof} \subsection{Uniform $L^\infty$-estimate}\label{Toolsfrompsh} We recall the following result proved using Kolodziej's pluripotential theoretic methods (\cf \cite[section 2.2]{LiSYZ} for an exposition based on \cite{EGZ}\cite{EGZ2}): \begin{thm}\label{pluripotentialthm1} Let $(Y, \omega)$ be a compact K\"ahler manifold, and the K\"ahler potential $\phi$ solves the complex Monge-Amp\`ere equation \[ \frac{ (\omega+\sqrt{-1} \partial \bar{\partial} \phi )^n}{ \int_Y \omega^n }=d\mu, \quad \sup \phi=0. \] Assume there are positive constants $\alpha, A$, such that the Skoda type estimate (\ref{Skodaassumption}) holds for $(Y,\omega, d\mu)$: \begin{equation*} \int_Y e^{-\alpha u} d\mu \leq A, \quad \forall u\in PSH(Y,\omega) \text{ with } \sup_Y u=0. \end{equation*} Then $\norm{\phi}_{C^0} \leq C(n,\alpha,A)$. \end{thm} The uniform $L^\infty$-estimate for the Calabi-Yau potentials in Theorem \ref{UniformLinfty} is an immediate consequence.
\section{Introduction} The COVID-19 pandemic \emph{started} in Switzerland on February 25\textsuperscript{th} 2020, when the first infection was officially reported in the Italian-speaking canton of Ticino~\cite{FirstCase:EN,FirstCase:DE}. Soon the pandemic spread around the country on all cantons, and Switzerland became one of the most infected countries on a per-capita basis~\cite{Vaud:DE,Spread:EN}. The Swiss government started putting in place various measures to control and suppress the pandemic. Gatherings were limited and later totally banned, following by closure of all except essential business, and finally closing land borders with neighbouring countries~\cite{Measures:DE}. These measures helped control the spread of the virus and significantly decreased the number of active and daily new cases in Switzerland. With the success confirmed, government started gradually lifting the established restrictions from late April~\cite{Lifting}. Finally, the June 15\textsuperscript{th} re-opening land borders with the neighbouring countries marked the \emph{"end"} of the pandemic in Switzerland, at least for the first wave~\cite{BorderOpening}. Since the first recorded case of the COVID-19 virus in Switzerland and far before as it was gaining attention around the world, The Swiss media started covering the topic from various aspects, including the everyday news about the state of the country, the immediate effects, and longer-term consequences of the pandemic. Given the multi-lingual and multi-cultural nature of Switzerland, interesting analyses can be accomplished to see how the media coverage of the pandemic has been managed and what topics in respect to the pandemic have been important to the Swiss media, and hopefully, by proxy to the Swiss public. In order to help the research community and the public be able to analyse and seek answers to the above questions, we at ELCA decided to release our COVID-19 news dataset, containing more than 10,000 links to news articles related to the Coronavirus pandemic published in the Swiss media since early January 2020. We hope this dataset helps researchers make insightful analyses on the reaction of the Swiss public to the pandemic and deliver results that help shape a better response in the prospective future cases. \section{The Data} We tried to cover the most popular Swiss newspapers and news websites. Therefore, we chose a total of 10 news sources in German, five in French, three in Italian, and also two English-speaking Swiss news websites in order to make the data more accessible to to researchers outside Switzerland. Table \ref{tab11} depicts the list of venues and some information about them. \begin{table}[htbp] \caption{Selected News Sources} \begin{center} \begin{tabular}{|c|c|c|} \hline \textbf{News Source} & \textbf{Language}& \textbf{Number of Articles} \\ \hline Blick & German & 2080 \\ \hline Neue Zürcher Zeitung & German & 1961 \\ \hline Tages Anzeiger & German & 1109 \\ \hline Aargauer Zeitung & German & 1099 \\ \hline Basler Zeitung & German & 859 \\ \hline SRF & German & 718 \\ \hline 20 Minuten & German & 553 \\\hline Berner Zeitung & German & 281 \\\hline 20 Minutes & French & 225 \\\hline Tribune de Genève & French & 223 \\\hline Corriere del Ticino & Italian & 199 \\\hline 24 heures & French & 189 \\\hline World Radio Switzerland & English & 176 \\\hline Il portale del Ticino & Italian & 156 \\\hline RTS & French & 188 \\\hline SWI swissinfo.ch & English & 112 \\\hline Le Temps & French & 89 \\\hline SWI swissinfo.ch & French & 71 \\\hline SWI swissinfo.ch & German & 55 \\\hline SWI swissinfo.ch & Italian & 52 \\\hline \end{tabular} \label{tab11} \end{center} \end{table} \subsection{Selection of Relevant Articles} We backdated our data collection to late 2019, and started scanning front pages of the selected news sources in consecutive days, extracting headlines of the articles. Initially, articles with any of the following \emph{keywords} in the title were deemed \emph{"Coronavirus-related"}: \begin{itemize} \item Coronavirus, \item Covid, \item Lockdown, \item Pandem* (To account for different spellings of the concept in different languages). \end{itemize} This inevitably leads to false negatives. In order to reduce such false negatives, we read at a later stage the synopsis of the article and searched for the keywords also in the body, yielding more positive results. The distribution of the languages in the dataset is depicted in Figure \ref{fig:my_label}. \begin{figure} \centering \begin{tikzpicture} [ pie chart, slice type={comet}{blu}, slice type={legno}{rosso}, slice type={coltello}{giallo}, slice type={sedia}{viola}, slice type={caffe}{verde}, pie values/.style={font={\small}}, scale=2 ] \pie{}{85.19/comet,8/legno,3.9/sedia,2.8/coltello} \legend[shift={(0cm,-1.2cm)}]{{German}/comet, {French}/legno, {Italian}/coltello, {English}/sedia} \end{tikzpicture} \caption{Language Distribution of Articles in the Dataset} \label{fig:my_label} \end{figure} The first article we could find in the Swiss media has been published on January 8\textsuperscript{th} in the French-speaking news portal \emph{20 Minutes}, titled \emph{"A new Coronavirus appears in China"}~\cite{FirstArticle}. We have made a web application to simplify exploring and browsing the data, and reading the collected news articles. The web application is available at \url{https://covidnewsdataset.herokuapp.com/}. \section*{Summary} We explained in this article our Swiss COVID-19 dataset and how it has been collected. We publish the dataset hereby for public use, along with an online visualisation application to help explore and look at the news articles of Swiss media during the pandemic in Switzerland. We hope this dataset proves useful in analysis of the pandemic era and the public response to it in Switzerland. \def\do\/\do-{\do\/\do-} \Urlmuskip=0mu plus 1mu\relax \bibliographystyle{./bibliography/IEEEtran}
\section{Introduction} Recently XENON 1T Collaboration reported that they found electron recoil excess around 2-3 keV with 3.5 $\sigma$ significance analyzing data for an exposer of 0.65 ton-year \cite{Aprile:2020tmw}. There is an issue on the tritium contamination to be resolved. This energy region is sensitive to solar axion search, but the interpretation of this excess in terms of solar axion is in conflict with astrophysical bounds on the axion coupling to electron. XENON1T Collaboration also interprets the excess in the context of magnetic moment of solar neutrino and absorption of light bosonic dark matter \cite{Aprile:2020tmw}. After the accouncement of XENON1T Collaboration, there appeared a number of papers that address various issues related with this excess \cite{Takahashi:2020bpq,OHare:2020wum,Kannike:2020agf,Alonso-Alvarez:2020cdv,Fornal:2020npv,Amaral:2020tga,Boehm:2020ltd,Harigaya:2020ckz,Bally:2020yid,Su:2020zny,Du:2020ybt,DiLuzio:2020jjp,Dey:2020sai,Chen:2020gcl,Bell:2020bes,AristizabalSierra:2020edu,Buch:2020mrg,Choi:2020udy,Paz:2020pbc,Lee:2020wmh,Cao:2020bwd,Robinson:2020gfu,Khan:2020vaf,Primulando:2020rdk,Nakayama:2020ikz,Gelmini:2020xir,Jho:2020sku,Bramante:2020zos,Baryakhtar:2020rwy,An:2020bxd,Zu:2020idx,Gao:2020wer,Budnik:2020nwz,Lindner:2020kko,Bloch:2020uzh,Chala:2020pbn,DeRocco:2020xdt,Dent:2020jhf,McKeen:2020vpf, Coloma:2020voz,An:2020tcg,DelleRose:2020pbh,Dessert:2020vxy,Bhattacherjee:2020qmv,Ge:2020jfn,Chao:2020yro,Gao:2020wfr,Ko:2020gdg,Hryczuk:2020jhi}. In this paper, we interpret this electron recoil excess in terms of exothermic DM scattering on atomic electron bound to Xe in the inelastic DM models. We shall consider both complex scalar \cite{Baek:2014kna} and Dirac fermion DM models \cite{Ko:2019wxq} with local $U(1)$ dark gauge symmetry which is spontaneously broken into its $Z_2$ subgroup by Krauss-Wilczek mechanism \cite{Krauss:1988zc}. In this framework, the mass difference ($\delta$) between the DM and the excited DM (XDM) is generated by dark Higgs mechanism, and there is no explicit violation of local gauge symmetry related with the presence of dark photon. On the other hand, in a number of literature, the mass difference $\delta$ is often introduced by hand in terms of dim-2 (3) operators for scalar (fermion) DM. Then local gauge symmetry is broken explicitly and softly. Introducing dark gauge boson (or dark photon) in such a case would be theoretically inconsistent, since the current dark gauge fields couple is not a conserved current. There will appear some channels where high energy behavior of the scattering amplitudes violate perturbative unitarity, in a similar way with the $W_L W_L \rightarrow W_L W_L$ scattering violates unitarity if $W$ boson mass is put in by hand. One of the present authors pointed out this issue in fermionic DM model (see Appendix A of Ref.~\cite{Ko:2019wxq}). Local $Z_2$ scalar \cite{Baek:2014kna} and fermion DM models \cite{Ko:2019wxq} have been studied by authors for the $O(100)$ GeV -- O(1) TeV WIMP scenarios. In this paper we explore the same models for light DM mass $\lesssim O(1)$ GeV in order to evade the strong bounds from direct detections experiments searching for signals of DM scattering on various nuclei. In particular we will emphasize that the DM thermal relic density and the XENON1T electron recoil excess with a few keV could be simultaneously accommodated if dark Higgs boson is light enough that ${\rm DM} + {\rm XDM} \rightarrow Z^{' *} \rightarrow Z' \phi$ is kinematically open. This channel will play an important role when $m_{DM} < m_{Z'}$, as we shall demonstrate in the following. In order to explain the XENON1T excess in terms of ${\rm XDM} + e_{atomic} \rightarrow {\rm DM} + e_{free}$ with a kinetic mixing, both dark photon and (X)DM mass should be sub-GeV, more specifically $\sim O(100)$ MeV, in order to avoid the stringent bounds on the kinetic mixing parameter. For such a light DM, one has to consider the DM annihilation should be mainly in $p$-wave, and not in $s$-wave, in order to avoid strong constraints from CMB (see \cite{Slatyer:2015jla,Leane:2018kjk} and references therein). For this purpose it is crucial to have dark Higgs $(\phi)$, since they can play a key roles in the $p$-wave annihilations of DM at freeze-out epoch: \begin{eqnarray*} X X^\dagger & \rightarrow & Z^{' *} \rightarrow Z^{'} \phi , \\ \chi \overline{\chi} & \rightarrow & \phi \phi , \end{eqnarray*} where $X$ and $\chi$ are complex scalar and Dirac fermion DM, respectively. At freeze-out epoch, the mass gap is too small ($\Delta m \ll T$) and we can consider DM as complex scalar or Dirac fermion. In the present Universe, we have $T \ll \Delta m$ and so we have to work in the two component DM picture for XENON1T electron recoil. It can not be emphasized enough that these channels would not be possible without dark Higgs $\phi$, and it would be difficult to make the DM pair annihilation be dominated by the $p$-wave annihilation. \section{Models for (excited) DM} \subsection{Scalar DM model} The dark sector has a gauged $U(1)_X$ symmetry. There are two scalar particles in the dark sector $X$ and $\phi$ with $U(1)_X$ charges 1 and 2, respectively. They are neutral under the SM gauge group. After $\phi$ gets VEV, $\langle \phi \rangle = v_\phi/\sqrt{2}$, the gauge symmetry is spontaneously broken down to discrete $Z_2$. The $Z_2$-odd $X$ becomes the DM candidate. The model Lagrangian is in the form~\cite{Baek:2014kna} \begin{eqnarray} {\cal L} & = & {\cal L}_{\rm SM} - \frac{1}{4} \hat{X}_{\mu\nu} \hat{X}^{\mu\nu} - \frac{1}{2} \sin \epsilon \hat{X}_{\mu\nu} \hat{B}^{\mu\nu} + D^\mu \phi^\dagger D_\mu \phi + D^\mu X^\dagger D_\mu X - m_X^2 X^\dagger X + m_\phi^2 \phi^\dag \phi \nonumber \\ && - \lambda_\phi \left( \phi^\dagger \phi \right)^2 - \lambda_X \left( X^\dagger X \right)^2\ - \lambda_{\phi X} X^\dagger X \phi^\dagger \phi - \lambda_{\phi H} \phi^\dagger \phi H^\dagger H - \lambda_{HX} X^\dagger X H^\dagger H \nonumber\\ &&- \mu \left( X^2 \phi^\dagger + H.c. \right), \label{eq:model} \end{eqnarray} where $\hat{X}_{\mu\nu}$ ($B_{\mu\nu}$) is the field strength tensors of $U(1)_X$ ($U(1)_Y$) gauge boson in the interaction basis. We decompose the $X$ as \begin{align} X ={1 \over \sqrt{2}} (X_R + i X_I), \end{align} and $H$ and $\phi$ as \begin{align} H = \begin{pmatrix} 0 \\ {1 \over \sqrt{2}} (v_H + h_H) \end{pmatrix}, \quad \phi = {1 \over \sqrt{2}} (v_\phi + h_\phi), \label{eq:ScalarDecomp} \end{align} in the unitary gauge. The dark photon mass is given by \begin{align} m_{Z'}^2 \simeq (2 g_X v_\phi)^2, \end{align} where we neglected the corrections from the kinetic mixing, which is second order in $\epsilon$ parameter. The masses of $X_R$ and $X_I$ are obtained to be \begin{align} m_R^2 &= m_X^2+{1 \over 2} \lambda_{HX} v_H^2 + {1 \over 2} \lambda_{\phi X} v_\phi^2 + {\mu \over \sqrt{2}} v_\phi, \nonumber\\ m_I^2 &= m_X^2+{1 \over 2} \lambda_{HX} v_H^2 + {1 \over 2} \lambda_{\phi X} v_\phi^2 - {\mu \over \sqrt{2}} v_\phi, \end{align} and the mass difference, $\delta \equiv m_R - m_I \simeq \mu v_\phi/\sqrt{2} m_X$. Since the original $U(1)_X$ symmetry is restored by taking $\mu=0$, small $\mu$ does not give rise to fine-tuning problem. The mass spectrum of the scalar Higgs sector can be calculated by diagonalising the mass-squared matrix \begin{align} \begin{pmatrix} 2 \lambda_H v_H^2 & \lambda_{\phi H} v_H v_\phi \\ \lambda_{\phi H} v_H v_\phi &2 \lambda_\phi v_\phi^2 \end{pmatrix}, \label{eq:H-Mass} \end{align} which is obtained in the $(h_H, h_\phi)$ basis. We denote the mixing angle to be $\alpha_H$ and the mass eigenstates to be $(H_1,H_2)$, where $H_1$ is the SM Higgs-like state and $H_2 (\equiv \phi)$ is mostly dark Higgs boson. Since we work in the small $\alpha_H$ in this paper, the VEV of $\phi$ is approximated to be, $v_\phi \simeq {m_{H_2} / \sqrt{2 \lambda_\phi}}$, while $\alpha_H \simeq \lambda_{\phi H} v_\phi / 2 \lambda_H v_H$. The mass eigenstates $Z_\mu$ and $Z'_\mu$ of the neutral gauge bosons can be obtained using the procedure shown in Ref.~\cite{Babu:1997st}. In the linear order approximation in $\epsilon$ we can write the covariant derivative as \begin{align} D_\mu \simeq \partial_\mu + i e Q_{\rm em} A_\mu + i \Big( g_Z (T^3 -Q_{\rm em} s_W^2) + \epsilon g_X Q_X s_W \Big) Z_\mu + i \Big( g_X Q_X - \epsilon e Q_{\rm em} c_W \Big) Z'_\mu, \end{align} where $Q_{\rm em}$ ($Q_X$) is the electric ($U(1)_X$) charge and $A_\mu$ is the photon field. We note that $Z'$ couples to the electric charge but not to the weak isospin component $T^3$. For example, $Z'$ does not couple to neutrinos at this order of $\epsilon$. To evade the bound from the DM scattering off the nuclei we are considering sub GeV scale DM. To calculate the relic abundance of the DM we take the $X$ as the physical state with mass $m_X$ instead of $X_I$ and $X_R$, {\it i.e.} $m_X \simeq m_R \simeq m_I$, because the mass difference $\delta$ is much smaller than the freezeout temperature $T_f \sim m_X/10$~\cite{Harigaya:2020ckz}. For this light DM the CMB constraint rules out the $s$-wave annihilation of the DM pair. So the contribution to the DM annihilation should start from $p$-wave. We suppress the $X X^\dagger \to Z' Z'$ by choosing $m_{Z'} > m_X$. We also make $X X^\dagger \to H_2 H_2$ subdominant. To achieve this we suppress the direct coupling of the DM to $\phi$ and $H$ by taking small $\lambda_{\phi X}$ and $\lambda_{HX}$. We also take small $\lambda_{\phi H}$ to evade the bound from the Higgs invisible decay. However, the coupling $\lambda_{\phi H}$ should not be too small to make the DM in thermal contact with the SM plasma. Too small $\lambda_{\phi H}$ also makes the $H_2$ lifetime too long, causing cosmological problems. For example, $H_2$ with mass $\sim 1$ GeV decays dominantly into muon (or strange quark) pairs through mixing $\lambda_{\phi H}$, whose decay with is given by \begin{align} \Gamma(H_2 \to \mu^+ \mu^-) &\simeq \frac{\alpha_H^2}{8 \pi} m_{H_2} \left(m_\mu \over v_H \right)^2 \left(1 -{4 m_\mu^2 \over m_{H_2}^2} \right)^{3/2} \nonumber\\ &\approx \left( {1.1 \times 10^{16} \, {\rm sec}^{-1}} \right) \alpha_H^2 \left(m_{H_2} \over 1\, {\rm GeV}\right). \label{eq:Gmm} \end{align} We require that $H_2$ lives shorter than 1 sec to evade the constraints from Big Bang nucleosynthesis (BBN) and the mixing angle is small. For $m_{H_2}=1$ GeV it is translated into $\alpha_H > 9.5 \times 10^{-9}$. When the muon channel is kinematically forbidden but $m_{H_2} > 2 m_e$, it decays into electron-positron pair. The decay rate is obtained by replacing $m_\mu$ by $m_e$ in (\ref{eq:Gmm}). For example, for $m_{H_2} = 10$ MeV, we need $\alpha_H > 2.0 \times 10^{-5}$. When $m_{H_2} < 2 m_e$, the scalar particle decays into two photons. In this paper we consider $m_{H_2} \gtrsim 2 m_e$. The small mixing parameters are also technically natural by extending the Poincar\'e symmetry~\cite{Foot:2013hna,Baek:2019wdn}. The $Z'$ can also decay into charged SM particles through mixing $\epsilon$. The decay width for $Z' \to e^+ e^-$ is given by \begin{align} \Gamma(Z' \to e^+ e^-) &=\frac{Q_f^2 \epsilon^2 e^2 c_W^2}{12 \pi} m_{Z'} \left(1+ {2 m_e^2 \over m_{Z'}^2}\right) \left(1- {4 m_e^2 \over m_{Z'}^2}\right)^{1/2} \nonumber\\ & \approx 1.87 \times 10^{-11} \, {\rm GeV} \left(\epsilon \over 10^{-4} \right)^2 \left(m_{Z'} \over 1 \, {\rm GeV} \right)^2. \end{align} Its lifetime is much shorter than 1 sec in the parameter space of our interest. The light $\phi$ and/or $Z'$ may contribute to the effective neutrino number $N_{\rm eff}$, which is another possible constraint in the model. Since the mediators $Z'$ and $\phi$ decay before 1 sec, there is no relativistic extra degree freedom which mimics the neutrino at the recombination era ($T_{\rm CMB} \approx$ 4 eV). Another potential source for $\Delta N_{\rm eff}$ is light mediator with mass below 1 MeV. It mainly decays into $e^\pm$ or $\gamma$ not into $\nu$, making the difference between the temperatures $T_\gamma$ and $T_\nu$ larger than the one given by the standard cosmology by imparting its entropy only to $\gamma$~\cite{Matsumoto:2018acr}. This also causes $\Delta N_{\rm eff} \not= 0$. We evade this problem by taking their masses greater than 1 MeV. In this restricted region of parameter space the main channel for the relic density is $X X^\dagger \to Z^{\prime *}\to Z' \phi$ (see the left panel in Fig. \ref{SDM} ) \footnote{From now on we call $H_2$ as $\phi$.}. The leading contribution to cross section is $p$-wave with the cross section \begin{align} \sigma v & \simeq \frac{g_X^4 v^2}{384 \pi \,m_X^4 (4 m_X^2-m_{Z'}^2 )^2}\left(16 m_X^4 + m_{Z'}^4 + m_\phi^4+40 m_X^2 m_{Z'}^2 -8 m_X^2 m_\phi^2 -2 m_{Z'}^2 m_\phi^2\right) \nonumber\\ &\times \Big[\left\{4 m_X^2-(m_{Z'}+m_\phi)^2\right\}\left\{4 m_X^2-(m_{Z'}-m_\phi)^2\right\}\Big]^{1/2}+{\cal O}(v^4), \end{align} where $m_\phi \equiv \sqrt{2 \lambda_\phi} v_\phi \simeq m_{H_2}$. The resulting dark matter density is obtained by~\cite{Griest:1990kh} \begin{align} \Omega_X h^2 = \frac{2 \times 8.77 \times 10^{-11} \, {\rm GeV}^{-2} \,x_f}{g_*^{1/2} (a+3 b/x_f)}, \label{eq:Omega} \end{align} where $a$ and $b$ are defined by $\sigma v = a + b v^2$, and the additional factor 2 comes from the fact that $X$ is a complex scalar instead of real scalar. For example, with $m_X =1$ GeV, $m_{Z'} =1.2$ GeV, $m_\phi=0.2$ GeV, $\lambda_\phi = 4.5 \times 10^{-5}$, $g_* \approx 10$, and $x_f \approx 10$, we can explain the current DM relic abundance: $\Omega_X h^2 \approx 0.12$. Other $p$-wave contributions include $X X^\dagger \to Z^{\prime *} \to f \bar{f}$ where $f$ is an SM fermion. But these contributions are suppressed by $\epsilon^2$ compared to the above annihilation, and we neglect them. The SM $Z$ boson contributions are further suppressed by both small mixing angle $\epsilon^2$ and small mass ratio $m_{Z'}^4/m_{Z}^4$. To calculate the inelastic down-scattering cross section for the XENON1T anomaly, instead of $X$ and $X^\dagger$ we now consider two real scalars $X_R, X_I$ with mass difference $\delta$. With the kinetic mixing term given in (\ref{eq:model}) we get the dark-gauge interactions with the DM and the electron~\cite{Babu:1997st} \begin{align} {\cal L} \supset g_X Z^{\prime\mu} (X_R \partial_\mu X_I - X_I \partial_\mu X_R) - \epsilon\, e c_W Z^\prime_\mu \overline{e} \gamma^\mu e, \end{align} where $c_W$ is the cosine of the Weinberg angle, $Z$ and $Z'$ are mass eigenstates, and we assumed that $\epsilon(\sim 10^{-4})$ is small. The cross section for the inelastic scattering $X_R e \to X_I e$ for $m_X \gg m_e$ and small momentum transfer is given by \begin{align} \sigma_e = \frac{16 \pi \epsilon^2 \alpha_{\rm em} \alpha_X c_W^2 m_e^2}{m_{Z'}^4}, \label{eq:sigma_e} \end{align} where $\alpha_{\rm em}\simeq 1/137$ is the fine structure constant and $\alpha_X \equiv g_X^2/4 \pi$. This can be used to predict the differential cross section of the dark matter scattering off the xenon atom for the DM velocity $v$, which reads \begin{align} \frac{d \sigma v}{d E_R}=\frac{\sigma_e}{2 m_e v} \int_{q_-}^{q_+} a_0^2 q dq K(E_R,q), \end{align} where $E_R$ is the recoil energy, $q$ is the momentum transfer, $K(E_R,q)$ is the atomic excitation factor. From energy conservation we obtain the relation~\cite{Harigaya:2020ckz}, \begin{align} E_R = \delta + v q \cos\theta -\frac{q^2}{2 m_R}, \end{align} where $\theta$ is the angle between the incoming $X_R$ and the momentum transfer $\boldsymbol{q}=\boldsymbol{p'}_e -\boldsymbol{p}_e$. The integration limits are~\cite{Harigaya:2020ckz}, \begin{align} q_\pm &\simeq m_R v \pm \sqrt{m_R^2 v^2 - 2 m_R (E_R -\delta)}, \quad \text{for} \; E_R \ge \delta, \nonumber\\ q_\pm &\simeq \pm m_R v +\sqrt{m_R^2 v^2 - 2 m_R (E_R -\delta)}, \quad \text{for} \; E_R \le \delta. \end{align} Then we can obtain the differential event rate for the inelastic scattering of DM with electrons in the xenon atoms given by \begin{align} \frac{d R}{d E_R} = n_T {n_R} \frac{d \sigma v}{d E_R}, \end{align} where $n_T \approx 4 \times 10^{27}/$ton is the number density of xenon atoms and $n_R \approx 0.15 \, {\rm GeV}/m_R/{\rm cm}^3$ is the number density of the heavier DM component $X_R$, assuming $n_R =n_I$. Integrating over $E_R$, we get the event rate \begin{align} R \approx 3.69 \times 10^9 \, \epsilon^2 \, g_X^2 \left( 1 {\rm GeV} \over m_R \right) \left( 1 {\rm GeV} \over m_{Z'} \right)^4 /\text{ton}/\text{year}. \end{align} Since $X_R$ is a dark matter component in our model with the same abundance with $X_I$, its lifetime should be much longer than the age of the universe. It can decay via $X_R \to X_I \gamma \gamma \gamma$ as shown in~\cite{Harigaya:2020ckz}. Its decay into three-body final state, $X_R \to X_I \nu \overline{\nu}$, is also possible in our model. The relevant interactions are \begin{align} {\cal L} \supset \epsilon g_X s_W Z^\mu (X_R \partial_\mu X_I -X_I \partial_\mu X_R) -{g_Z \over 2} Z_\mu \overline{\nu}_L \gamma^\mu \nu_L. \end{align} The decay width is given by \begin{align} \Gamma \simeq \frac{\epsilon^2 \alpha_X s_W^2}{5\sqrt{2} \pi^2} \; \frac{G_F \delta^5 }{m_Z^2} \simeq 1.9 \times 10^{-49} \,\text{GeV} \left(\epsilon \over 10^{-4}\right)^2 \left(\alpha_X \over 0.078\right)\left(\delta \over 2\,\text{keV}\right)^5. \label{eq:GammaX} \end{align} Although this channel is much more effective than $X_R \to X_I \gamma\gamma\gamma$ considered in~\cite{Harigaya:2020ckz}, the lifetime of $X_R$ is still much longer than the age of the universe. In the right panel of Fig. \ref{SDM} , we show the allowed region in the $(m_{Z'}, \epsilon)$ plane where we can explain the XENON1T excess with correct thermal relic density of DM within the standard freeze-out scenario. For illustration, we chose the DM mass to be $m_R = 0.1$ GeV, and varied the dark Higgs mass $m_\phi = 20, 40, 60, 80$ MeV denoted with different colors. The sharp drops on the right allowed region is from the kinematic boundary, $m_{Z'} + m_\phi < 2 m_R$. It is nontrivial that we could explain the XENON1T excess with inelastic DM models with spontaneously broken $U(1)_X \rightarrow Z_2$ gauge symmetry. In particular it is important to include light dark Higgs for this explanation. It would be straightfoward to scan over all the parameters to get the whole allowed region. \begin{figure} \includegraphics[width=0.40\linewidth]{Relic_ScalarDM.pdf} \includegraphics[width=0.50\linewidth]{mZp_VS_eps_ScalarDM100MeV.pdf} \caption{ \label{SDM} ({\it left}) Feynman diagrams relevant for thermal relic density of DM: $X X^\dagger \rightarrow Z' \phi$ and ({\it right}) the region in the $( m_{Z'}, \epsilon)$ plane that is allowed for the XENON1T electron recoil excess and the correct thermal relic density for scalar DM case for $\delta = 2$ keV : (a) $m_{\rm DM} = 0.1$ GeV. Different colors represents $m_\phi = 20,40,60,80$ MeV. The gray areas are excluded by various experiments, from BaBar \cite{Lees:2014xha}, E774 \cite{Bross:1989mp}, E141 \cite{Riordan:1987aw}, Orasay \cite{Davier:1989wz}, and E137 \cite{Batell:2014mga}, assuming $Z' \rightarrow X_R X_I$ is kinematically forbidden. } \end{figure} \subsection{Fermion DM model } We start from a dark $U(1)$ model, with a Dirac fermion dark matter (DM) $\chi$ appointed with a nonzero dark $U(1)$ charge $Q_\chi$ and dark photon. We also introduce a complex dark Higgs field $\phi$, which takes a nonzero vacuum expectation value, generating nonzero mass for the dark photon. We shall consider a special case where $\phi$ breaks the dark $U(1)$ symmetry into a dark $Z_2$ symmetry with a judicious choice of its dark charge $Q_\phi$. Then the gauge invariant and renormalizable Lagrangian for this system is given by \begin{eqnarray} \mathcal{L} & = & -\frac{1}{4} \hat{X}^{\mu \nu} \hat{X}_{\mu \nu} - \frac{1}{2} \sin \epsilon \hat{X}_{\mu\nu}B^{\mu\nu} + \overline{\chi} \left( i\slashed{D} - m_{\chi} \right) \chi + D_{\mu} \phi^\dagger D^{\mu} \phi \label{Lag_fermion} \\ & - & \mu^2 \phi^\dagger \phi - \lambda_{\phi} |\phi|^4 - \frac{1}{\sqrt{2}} \left( y \phi^\dagger \overline{\chi^C} \chi + \text{h.c.} \right) - \lambda_{\phi H} \phi^\dagger \phi H^\dagger H \nonumber \end{eqnarray} where $\hat{X}_{\mu \nu} = \partial_{\mu} \hat{X}_{\nu} - \partial_{\nu} \hat{X}_{\mu}$. $D_{\mu} = \partial_{\mu} + i g_X Q_X \hat{X}_{\mu}$ is the covariant derivative, where $g_X$ is the dark coupling constant, and $Q_X$ denotes the dark charge of $\phi$ and $\chi$: $Q_{\phi} = 2, Q_{\chi} = 1$, respectively. Then $U(1)_X$ dark gauge symmetry is spontaneously broken into its $Z_2$ subgroup, and the Dirac DM $\chi$ is split into two Majorana DM $\chi_R$ and $\chi_I$ defined as \begin{eqnarray} \chi & = & \frac{1}{\sqrt{2}} ( \chi_R + i \chi_I ) , \\ \chi^c & = & \frac{1}{\sqrt{2}} ( \chi_R - i \chi_I ) , \\ \chi_R^c & = & \chi_R , \ \ \ \chi_I^c = \chi_I , \end{eqnarray} with \begin{equation} m_{R,I} = m_\chi \pm y v_\phi = m_\chi \pm \frac{1}{2} \delta . \end{equation} We assume $y>0$ so that $\delta \equiv m_R - m_I = 2 y v_\phi > 0$. Then the above Lagrangian is written as \begin{eqnarray} {\cal L} & = & \frac{1}{2} \sum_{i=R,I} \overline{\chi_i} \left( i \slashed{\partial} - m_i \right) \chi_i - i \frac{g_X}{2} ( Z'_\mu+\epsilon s_W Z_\mu) \left( \overline{\chi_R} \gamma^\mu \chi_I - \overline{\chi_I} \gamma^\mu \chi_R \right) \\ & - & {1 \over 2} y h_\phi \left( \overline{\chi_R} \chi_R - \overline{\chi_I} \chi_I \right), \end{eqnarray} where $h_\phi$ is neutral CP-even component of $\phi$ as defined in (\ref{eq:ScalarDecomp}). When we calculate the DM relic density, we can assume the mass difference is small compared to the DM mass as in the case of the scalar DM, {\it i.e.} $m_\chi \simeq m_R \simeq m_I$. For the fermionic DM the annihilation processes into the scalar pair, $\stackrel{(-)}{\chi} \stackrel{(-)}\chi \to \phi \phi$, are $p$-wave. To evade the CMB constraint we suppress the $s$-wave annihilation by assuming $2 m_\chi<2m_{Z'}, m_{Z'}+m_\phi$. The calculation of the annihilation process (the top panel of Fig. \ref{FDM}) yields \begin{align} \sigma v = \frac{y^2 v^2 \, \sqrt{m_\chi^2-m_\phi^2}}{96\pi m_\chi} \Bigg[\frac{27 \lambda_\phi^2 v_\phi^2}{(4 m_\chi^2 -m_\phi^2)^2} +\frac{4 y^2 m_\chi^2 (9 m_\chi^4 -8 m_\chi^2 m_\phi^2 +2 m_\phi^4)}{(2 m_\chi^2 -m_\phi^2)^4} \Bigg] +{\cal O}(v^4), \end{align} where $m_\phi \equiv \sqrt{2 \lambda_\phi} v_\phi \simeq m_{H_2}$. The current DM relic abundance is obtained by (\ref{eq:Omega}). Since the annihilation cross section for the fermion DM case if proportional to $y^2 \propto (\delta/v_\phi )^2$ and $\delta \sim 2$ keV, the $v_\phi$ should be not too large. If we ignore $m_\phi$ in the above equation, we find that $m_\chi \sim O(1-10)$ MeV will be required to get the correct thermal relic density, and dark Higgs $\phi$ should be even lighter. Therefore dark sector particles in this case should be lighter than the scalar DM case. Later for illustration, we will consider $m_\chi \sim O(10)$ MeV. and $m_\phi \sim O(1)$ MeV to get the correct DM relic density and explain the XENON1T excess. Now let's consider the inelastic scattering of DM with the electron in the xenon atom to explain the XENON1T anomaly. The scattering occurs through the interactions \begin{align} {\cal L} \supset - i \frac{g_X}{2} Z'_\mu \left( \overline{\chi_R} \gamma^\mu \chi_I - \overline{\chi_I} \gamma^\mu \chi_R \right) - \epsilon\, e c_W Z^\prime_\mu \overline{e} \gamma^\mu e, \end{align} It turns out that in the limit $m_\chi \gg m_e$, $\sigma_e$ has exactly the same form with (\ref{eq:sigma_e}) of the scalar DM case. We require the $\chi_R$ to be long-lived so that it is also a main component of the dark matter. It decays mainly via the SM $Z$-mediating $\chi_R \to \chi_I \nu \overline{\nu}$, using the interactions \begin{align} {\cal L} \supset -{i \over 2} \epsilon s_W g_X Z_\mu (\overline{\chi}_R \gamma^\mu \chi_I -\overline{\chi}_I \gamma^\mu \chi_R) -{1 \over 2} g_Z Z_\mu \overline{\nu}_L \gamma^\mu \nu_L. \end{align} The expression for the decay with, $\Gamma(\chi_R \to \chi_I \nu \overline{\nu})$, also agrees exactly with (\ref{eq:GammaX}). As shown in (\ref{eq:GammaX}), the lifetime of $\chi_R$ is much longer than the age of the universe, which guarantees the $\chi_R$ is as good a dark matter as $\chi_I$. \begin{figure} \includegraphics[width=0.40\linewidth]{Relic_FermionDM1.pdf} \hspace{0.5cm} \includegraphics[width=0.40\linewidth]{Relic_FermionDM2.pdf} \\ \vspace{0.5cm} \includegraphics[width=0.50\linewidth]{mZp_VS_eps_FermionDM10MeV.pdf} \caption{ \label{FDM} ({\it top}) Feyman diagrams for $\chi \bar{\chi} \rightarrow \phi\phi$. ({\it bottom}) the region in the $( m_{Z'}, \epsilon)$ plane that is allowed for the XENON1T electron recoil excess and the correct thermal relic density for fermion DM case for $\delta = 2$ keV and the fermion DM mass to be $m_R = 10$ MeV. Different colors represents $m_\phi = 2, 4, 6, 8$ MeV. The gray areas are excluded by various experiments, assuming $Z' \rightarrow \chi_R \chi_I$ is kinematically allowed, and the experimental constraint is weaker in the $\epsilon$ we are interested in, compared with the scalar DM case in Fig. 1 (right). We also show the current experimental bounds by NA64 \cite{NA64:2019imj}. } \end{figure} In the bottom panel of Fig. \ref{FDM}, we show the allowed region in the $(m_{Z'}, \epsilon)$ plane where we can explain the XENON1T excess with correct DM thermal relic density within the standard freeze-out scenario. For illustration, we choose the fermion DM mass to be $m_\chi = m_R = 10$ MeV, and varied the dark Higgs mass $m_\phi = 2, 4, 6, 8$ MeV denoted with different colors. Note that the kinetic mixing $\epsilon \sim 10^{-7 \pm 1}$, which is much smaller than the scalar DM case. We have checked if the gauge coupling $g_X$ and the quartic coupling of dark Higgs ($\lambda_\phi$) remain in the perturbative regime. The solid (dashed) lines denote the region where $g_X$ satisfy (violate) perturbativity condition, depending $\alpha_X < 1$ or not. Within this allowed region, $\lambda_\phi$ remain perturbative. Again it is nontrivial that we could explain the XENON1T excess with inelastic fermion DM models with spontaneously broken $U(1)_X \rightarrow Z_2$ gauge symmetry. In particular it is important to include light dark Higgs for this explanation as in the scalar DM case. \section{Conclusion} In this paper, we showed that the electron recoil excess reported by XENON1T Collaboration could be accounted for by exothermic DM scattering on atomic electron in Xe, with sub-GeV light DM: $m_X \sim O(100)$ MeV for the scalar and $m_\chi \sim O(10)$ MeV for the fermion DM, and dark Higgs $\phi$ neing even lighter that DM particle for both cases. Dark photon should be heavier than DM in order that we can forbid the DM pair annihilation into the $Z' Z'$ channels. This scenario could be described by DM models with dark $U(1)$ gauge symmetry broken into its $Z_2$ subgroup by Krauss-Wilczek mechanism. And dark photon $Z'$ and dark Higgs $\phi$ in such dark gauge models play important roles in DM phenomenology. In particular in the calculation of thermal relic density, new channels involving a dark Higgs can open $X X^\dagger \rightarrow \phi Z'$ and $\chi \bar{\chi} \rightarrow \phi \phi$, which are $p$-wave annihilations. Then one could evade the stringent constraints from CMB for such light DM. Other dangerous $s$-channel annihilations can be kinematically forbidden by suitable choice of parameters. Thus the exothermic scattering in inelastic $Z_2$ DM models within standard freeze-out scenario can explain the XENON1T excess without modifying early universe cosmology. We emphasize again that the existence of dark Higgs $\phi$ is crucial for us to get the desired DM phenomenology to explain the XENON1T excess with the correct thermal relic density in case of both scalar and fermion DM models within the standard freeze-out scenario. \section*{Note Added} While we were preparing this manuscript, there appeared a few papers which explain the XENON1T excess in terms of scalar or fermion exothermic DM \cite{Harigaya:2020ckz,Su:2020zny,Lee:2020wmh,Bramante:2020zos,Baryakhtar:2020rwy,An:2020tcg}. Our paper is different from these previous works in that we consider dark $U(1)$ gauge symmetry broken to its $Z_2$ subgroup by dark Higgs mechanism, and include the light dark Higgs in the calculations of thermal relic density for the two component DM in the standard freeze-out scenario: $X X^\dagger \rightarrow Z' \phi$ for scalar DM and $\chi \overline{\chi} \rightarrow \phi\phi$. Other $s$-wave channels are kinematically forbidden by suitable choice of mass parameters. This possibility of dark Higgs in the final state in the (co)annihilation channels are not included in other works. By including these new channels, we could achieve the correct thermal relic density and the desired heavier DM fluxes on the Xe targets simultaneously, without conflict with strong constraints on light DM annihilations from CMB. And the models considered in this paper is renormalizable and DM stability is guaranteed by underlying $U(1)$ dark gauge symmetry and its unbroken $Z_2$ subgroup. \begin{acknowledgments} The work is supported in part by KIAS Individual Grants, Grant No. PG021403 (PK) and Grant No. PG074201 (JK) at Korea Institute for Advanced Study, and by National Research Foundation of Korea (NRF) Grant No. NRF-2018R1A2A3075605 (SB) and No. NRF-2019R1A2C3005009 (PK), funded by the Korea government (MSIT). \end{acknowledgments} \bibliographystyle{utphys}
\section{Introduction} \setcitestyle{numbers} Algorithmic tools are increasingly prevalent in domains such as health care, education, lending, criminal justice, and child welfare \cite{caruana2015intelligible, smith2012predictive, khandani2010consumer, kehl2017algorithms, chouldechova2018case}. In many cases, the tools are not intended to replace human decision-making, but rather to distill rich case information into a simpler form, such as a risk score, to inform human decision makers \cite{bezemer2019human, de2020case}. The type of information that these tools need to convey is often \textit{counterfactual} in nature. Decision-makers need to know what is likely to happen if they choose to take a particular action. For instance, an undergraduate program advisor determining which students to recommend for a personalized case management program might wish to know the likelihood that a given student will graduate if enrolled in the program. In child welfare, case workers and their supervisors may wish to know the likelihood of positive outcomes for a family under different possible types of supportive service offerings. A common challenge to developing valid counterfactual prediction models is that all the data available for training and evaluation is observational: the data reflects historical decisions and outcomes under those decisions rather than randomized trials intended to assess outcomes under different policies. If the data is confounded---that is, if there are factors not captured in the data that influenced both the outcome of interest and historical decisions---valid counterfactual prediction may not be possible.\accomment{I'm saying ``may not'' because I'm not ruling out the possibility of things like instruments existing that would still enable one to draw valid inferences. What do you think?} \amcomment{I think this is reasonable. Another alternative would be "is not possible without further assumptions"} In this paper we consider the setting where all relevant factors are captured in the data, and so historical decisions and outcomes are unconfounded, but where it is infeasible, undesirable, or impermissible to use some such factors in the prediction model. We refer to this setting as \textbf{runtime confounding}. Runtime confounding naturally arises in a number of different settings. First, relevant factors may not yet be available at the desired runtime. For instance, in child welfare screening, call workers decide which allegations coming in to the child abuse hotline should be investigated based on the information in the call and historical administrative data \citep{chouldechova2018case}. The call worker's decision-making process can be informed by a risk assessment if the call worker can access the risk score in real-time. Since existing case management software cannot run speech/NLP models in realtime, the call information (although recorded) is not available at runtime, thereby leading to runtime confounding. Second, runtime confounding arises when historical decisions and outcomes have been affected by sensitive or protected attributes which for legal or ethical reasons are deemed ineligible as inputs to algorithmic predictions. We may for instance be concerned that call workers implicitly relied on race in their decisions, but it would not be permissible to include race as a model input. Third, runtime confounding may result from interpretability or simplicity requirements. For example, a university may require algorithmic tools used for case management to be interpretable. While information conveyed during student-advisor meetings is likely informative both of case management decisions and student outcomes, natural language processing models are not classically interpretable, and thus the university may wish instead to only use structured information like GPA in their tools. \amcomment{ Runtime confounding naturally arises in a number of different settings. First, relevant factors may not yet be available at the desired runtime. Consider an in-person parole hearing, where the parole board makes a recommendation after reviewing documents and hearing spoken testimony. The testimony may provide information that both influences the board's decision and reveals drivers of the offender's likelihood to succeed if released. But the parole board would generally wish to see the predictions of a criminal risk and needs assessment tool prior to the hearing. Any such tool could not therefore use spoken testimony as a model input, thereby leading to runtime confounding. Second, runtime confounding arises when historical decisions and outcomes have been affected by sensitive or protected attributes which for legal or ethical reasons are deemed ineligible as inputs to algorithmic predictions. We may for instance be concerned that parole boards implicitly relied on race in their decisions, but it would not be permissible to include race as a model input. Third, runtime confounding may result from interpretability or simplicity requirements. For example, a university may require algorithmic tools used for case management to be interpretable. While information conveyed during student-advisor meetings is likely informative both of case management decisions and student outcomes, natural language processing models are not classically interpretable, and thus the university may wish instead to only use structured information like GPA in their tools.} In practice, when it is undesirable or impermissible to use particular features as model inputs at runtime, it is common to discard the ineligible features from the training process. This can induce considerable bias in the resulting prediction model when the discarded features are significant confounders. To our knowledge, the problem of learning valid counterfactual prediction models under runtime confounding has not been considered in the prior literature, leaving practitioners without the tools to properly incorporate runtime-ineligible confounding features into the training process. \textbf{Contributions:} Drawing upon techniques used in low-dimensional treatment effect estimation \citep{van2003unified, zimmert2019nonparametric, chernozhukov2018generic}, we propose a procedure for the full pipeline of learning and evaluating prediction models under runtime confounding. We (1) formalize the problem of counterfactual prediction with runtime confounding [\textsection~\ref{sec:notation}]; (2) propose a solution based on doubly-robust techniques that has desirable theoretical properties [\textsection~\ref{sec:dr}]; (3) theoretically and empirically compare this solution to an alternative counterfactually valid approach as well as the standard practice, describing the conditions under which we expect each to perform well [\textsection~\ref{sec:methods} \&~\ref{sec:experiments}]; and (4) provide an evaluation procedure to assess performance of the methods in the real-world [\textsection~\ref{sec:eval}]. Proofs, code and results of additional experiments are presented in the Supplement. \subsection{Related work} Our work builds upon a growing literature on counterfactual risk assessments for decision support that proposes methods for the unconfounded prediction setting \cite{schulam2017reliable, coston2020counterfactual}. Following this literature, our goal is to predict outcomes under a proposed decision (interchageably referred to as `treatment' or `intervention') in order to inform human decision-makers about what is likely to happen under that treatment. Our proposed prediction (Contribution 2) and evaluation methods (Contribution 4) draw upon the literature on double machine learning and doubly-robust estimation, which uses the efficient influence function to produce estimators with reduced bias \citep{van2003unified, robins1994estimation, robins1995semiparametric, kennedy2016semiparametric, chernozhukov2018double, kennedy2020optimal}. These techniques are commonly used for treatment effect estimation, and of particular note for our setting are methods for estimating treatment effects conditional on only a subset of confounders \citep{semenova2017estimation, chernozhukov2018generic, zimmert2019nonparametric, fan2020estimation}. \citet{semenova2017estimation} propose a two-stage doubly-robust procedure that uses series estimators in the second stage to achieve asymptotic normality guarantees. \citet{zimmert2019nonparametric} propose a similar approach that uses local constant regression in the second stage, and \citet{fan2020estimation} propose using a local linear regression in the second stage. These approaches can obtain rate double-robustness under the notably strict condition that the product of nuisance errors to converge faster than $\sqrt{n}$ rates. In a related work, \citet{foster2019orthogonal} proposes an orthogonal estimator of treatment effects which, under certain conditions, guarantees the excess risk is second-order but not doubly robust.\footnote{A second order but not doubly robust guarantee requires sufficiently fast rates on \emph{both} nuisance functions. By contrast, rate double robustness imposes a weaker assumption on the \emph{product} of nuisance function errors, allowing e.g., fast rates on the propensity function and slow rates on the outcome regression function.} Our work is most similar to the approach taken in \citet{kennedy2020optimal}, which proposes a model-agnostic two-stage doubly robust estimation procedure for conditional average treatment effects that attains a model-free doubly robust guarantee on the prediction error. Treatment effects can be identified under weaker assumptions than required to individual the potential outcomes, and prior work has proposed a procedure to find the minimal set of confounders for estimating conditional treatment effects \citep{makar2019distillation}. Our prediction task is different from the common causal inference problem of treatment effect estimation, which targets a contrast of outcomes under two different treatments \citep{wager2018estimation,shalit2017estimating}. Treatment effects are useful for describing responsiveness to treatment. While responsiveness is relevant to some types of decisions, it is insufficient, or even irrelevant, to consider for others. For instance, a doctor considering an invasive procedure may make a different recommendation for two patients with the same responsiveness if one has a good probability of successful recovery without the procedure and the other does not. In lending settings, the responsiveness to different loan terms is irrelevant; all that matters is that the likelihood of default be sufficiently small under feasible terms. In such settings, we are interested in \textit{predictions} conditional on only those features that are permissible or desirable to consider at runtime. Our methods are specifically designed for minimizing prediction error, rather than providing inferential guarantees such as confidence intervals, as is common in the treatment effect estimation setting. The practical challenge that we often need to make decisions based on only a subset of the confounders has been discussed in the policy learning literature \citep{zhang2012robust, athey2017efficient, kitagawa2018should}. For instance, it may be necessary to use only a subset of confounders to meet ethical requirements, model simplicity desiderata, or budget limitations \citep{athey2017efficient}. Doubly robust methods for learning treatment assignment policies have been proposed for such settings \citep{zhang2012robust, athey2017efficient}. Our work is also related to the literature on marginal structure models (MSMs) \citep{robins2000amarginal,robins2000bmarginal}. An MSM is a model for a marginal mean of a counterfactual, possibly conditional on a subset of baseline covariates. The standard MSM approach is semiparametric, employing parametric assumptions for the marginal mean but leaving other components of the data-generating process unspecified \citep{van2003unified}. Nonparametric variants were studied in the unconditional case for continuous treatments by \citet{rubin2006extending}. In contrast our setting can be viewed as a nonparametric MSM for a binary treatment, conditional on a large subset of covariates. This is similar in spirit to partly-conditional treatment effect estimation \citep{van2014targeted}; however we do not target a contrast since our interest is in predictions rather than treatment effects. Our results are also less focused on model selection \citep{van2003bunified}, and more on error rates for particular estimators. We draw on techniques for sample-splitting and cross-fitting, which have been used in the regression setting for model selection and tuning \citep{gyorfi2006distribution, van2003unified} and in treatment effect estimation \citep{robins2008higher, zheng2010asymptotic, chernozhukov2018generic}. Our method is relevant to settings where the outcome is selectively observed. This \emph{selective labels} problem \citep{lakkaraju2017selective, kleinberg2018human} is common in settings like lending where the repayment/default outcome is only observed for applicants whose loan is approved. Runtime confounding can arise in such settings if some factors that are used for decision-making are unavailable for prediction. Recent work has considered methods to accommodate confounding due to sources other than missing confounders at runtime. A line of work has considered how to use causal techniques to correct runtime dataset shift \cite{subbaswamy2018preventing, magliacane2018domain, subbaswamy2018counterfactual}. In our case the runtime setting is different from the training setting not because of distributional shift but because we can no longer access all confounders. These methods also differ from ours in that they are not seeking to predict outcomes under specific decisions. There is also a line of work that considers confounding in the \emph{training} data \cite{kallus2018confounding, madras2019fairness}. While confounded training data is common in various applications, our work targets decision support settings where the factors used by decision-makers are recorded in the training data but are not available for prediction. Lastly, there are connections between runtime confounding and the literature on privileged learning and algorithmic fairness that use features during training time that are not available for prediction. Learning using Privileged Information (LUPI) has been proposed for settings in which the training data contains additional features that are not available at runtime \citep{vapnik2009new}. In algorithmic fairness, disparate learning processes (DLPs) use the sensitive attribute during training to produce models that achieve a target notion of parity without requiring access to the protected attribute at test time \cite{lipton2018does}. LUPI and DLPs both make use of variables that are only available at train time, but if these variables affect the decisions under which outcomes are observed, predictions from LUPI and DLPs will be confounded because neither accounts for how these variables affect decisions. By contrast, our method uses confounding variables during training to produce valid counterfactual predictions. \section{Problem setting} \label{sec:notation} Our goal is to predict outcomes under a proposed treatment $A=a \in \{0,1\}$ based on runtime-available predictors $V \in \mathcal{V} \subseteq \mathbb{R}^{d_\mathrm{V}}$.\footnote{For exposition, we focus on making predictions for a single binary treatment $a$. To make predictions under multiple discrete treatments, our method can be repeated for each treatment using a one-vs-all setup.} Using the potential outcomes framework \citep{rubin2005causal, neyman1923applications}, our prediction target is ${\nu_a(v) := \mathbb{E}[Y^a \mid V = v]}$ where $Y^a \in \mathcal{Y} \subseteq \mathbb{R}$ is the potential outcome we would observe under treatment $A = a$. We let $Z \in \mathcal{Z} \subseteq \mathbb{R}^{d_\mathrm{Z}}$ denote the runtime-hidden confounders, and we denote the propensity to receive treatment $a$ by ${\pi_a(v, z) := \mathbb{P}(A = a \mid V = v, Z = z)}$. We also define the outcome regression by ${\mu_a(v, z) := \mathbb{E}[Y^a \mid V = v, Z = z]}$. For brevity, we will generally omit the subscript, using notation $\nu$, $\pi$ and $\mu$ to denote the functions for a generic treatment $a$. \begin{definition} \label{def:problem_setting} Formally, the task of counterfactual prediction under \textbf{runtime-only confounding} is to estimate ${\nu(v)}$ from iid training data $(V, Z, A, Y)$ under the following two conditions: \begin{condition}[Training Ignorability] \label{condition:ign} Decisions are unconfounded given $V$ and $Z$: ${Y^a \perp A \mid V, Z}$. \end{condition} \begin{condition}[Runtime Confounding] \label{condition:conf} Decisions are confounded given only $V$: $Y^a \not \perp A \mid V$; equivalently, $A \not \perp Z \mid V$ and $Y^a \not \perp Z \mid V$ \end{condition} \end{definition} To ensure that the target quantity is identifiable, we require two further assumptions, which are standard in causal inference and not specific to the runtime confounding setting. \begin{condition}[Consistency] \label{condition:consistency} A case that receives treatment $a$ has outcome $Y = Y^a$. \end{condition} \begin{condition}[Positivity] \label{condition:positivity} $\mathbb{P}(\pi_a( V, Z) \geq \epsilon > 0) = 1 \quad \forall a$ \end{condition} \paragraph{Identifications.} Under conditions 2.1.1-2.1.4, we can write the counterfactual regression functions $\mu$ and $\nu$ in terms of observable quantities. We can identify $\mu(v,z) = \mathbb{E}[Y \mid V = v, Z = z, A = a] $ and our target $\nu(v) =\mathbb{E} [ \mathbb{E}[Y \mid V = v, Z = z, A = a] \mid V = v] = \mathbb{E}[ \mu(V, Z) \mid V = v]$. The iterated expectation in the identification of $\nu$ suggests a two-stage approach that we propose in \textsection~\ref{sec:pl} after reviewing current approaches. \paragraph{Miscellaneous notation.} Throughout the paper we let $p(x)$ denote probability density functions; $\hat f$ denote an estimate of $f$; $L \lesssim R$ indicate that $L \leq C \cdot R$ for some universal constant $C$; $\mathbb{I}$ denote the indicator function; and define ${\norm{f}^2 := \int (f(x))^2 p(x) dx}$. \section{Prediction methods} \label{sec:methods} \subsection{Standard practice: Treatment-conditional regression (TCR\xspace)} \label{sec:method_conf} Standard counterfactual prediction methods train models on the cases that received treatment $a$ \citep{schulam2017reliable, coston2020counterfactual}, a procedure we will refer to as \textbf{treatment-conditional regression} (TCR). This procedure estimates ${\omega(v) = \mathbb{E}[Y \mid A = a, V =v]}$. This method works well given access to all the confounders at runtime; if ${A \perp Y^a \mid V}$, then ${\omega(v) = \mathbb{E}[Y^a \mid V = v]} = \nu(v)$. However, under runtime confounding, ${\omega(v) \neq \mathbb{E}[Y^a \mid V = v]}$, so this method does not target the right counterfactual quantity, and may produce misleading predictions.\footnote{Runtime imputation of $Z$ will not eliminate this bias since ${E[Y \mid A = a, V =v, f(v)] = \omega(v)}$.} For instance, consider a risk assessment setting that historically assigned risk-mitigating treatment to cases that have higher risk under the null treatment ($A=0$). Using TCR\xspace to predict outcomes under the null treatment will underestimate risk since ${\mathbb{E}[Y \mid V, A= 0] = \mathbb{E}[Y^0 \mid V, A= 0] < \mathbb{E}[Y^0 \mid V]}$. We can characterize the bias of this approach by analyzing $b(v) := \omega(v) - \nu(v)$, a quantity we term the pointwise \emph{confounding bias.} \begin{proposition} \label{prop:btr-bias} Under runtime confounding, $\omega(v)$ has pointwise confounding bias \begin{equation} b(v) = \int_{\mathcal{Z}} \mu(v,z) \Big(p(z \mid V = v, A = a) - p(z \mid V = v) \Big) dz \quad \neq \quad 0 \end{equation} \end{proposition} By Condition~\ref{condition:conf}, this confounding bias will be non-zero. Nonetheless we might expect the TCR\xspace method to perform well if $b(v)$ is small enough. We can formalize this intuition by decomposing the error of a TCR\xspace predictive model $\hat{\nu}_{\mathrm{TCR}}$ into estimation error and confounding bias: \begin{proposition} \label{thm:tcr} The pointwise regression error of the TCR method can be bounded as follows: \begin{align*} \mathbb{E}[(\nu(v) - \hat \nu_{\mathrm{TCR}} (v))^2] &\lesssim \mathbb{E}[(\omega(v) - \hat \nu_{\mathrm{TCR}} (v))^2] + b(v)^2 \end{align*} \end{proposition} The first term gives the estimation error and the second term bounds the bias in targeting the wrong counterfactual quantity. \subsection{A simple proposal: Plug-in (PL\xspace) approach} \label{sec:pl} \begin{algorithm}[t] \caption{The plug-in (PL\xspace) approach} \label{alg:pl} \begin{algorithmic \scriptsize \STATE \emph{Stage 1:} Learn $\hat \mu(v,z)$ by regressing $Y \sim V, Z \mid A = a$ \STATE \emph{Stage 2:} Learn $\hat \nu_{\mathrm{PL}} (v)$ by regressing $\hat \mu(V,Z) \sim V$ \end{algorithmic} \end{algorithm} We can avoid the confounding bias of TCR through a simple two-stage procedure we call the \textbf{plug-in} approach that targets the proper counterfactual quantity. This approach, described in Algorithm~\ref{alg:pl}, first estimates $\mu$ and then uses $\mu$ to construct a pseudo-outcome which is regressed on $V$ to yield prediction $\hat{\nu}_{\mathrm{PL}}$. Cross-fitting techniques (Alg.~\ref{alg:pl_cf}) can be applied to prevent issues that may arise due to potential overfitting when learning both $\hat \mu$ and $\hat \nu_{\mathrm{PL}}$ on the same training data. Sample-splitting (or cross-fitting) also enables us to get the following upper bound on the error of the PL\xspace{} approach. \begin{algorithm}[t] \caption{The plug-in (PL\xspace) approach with cross-fitting} \label{alg:pl_cf} \begin{algorithmic \scriptsize \STATE Randomly divide training data into two partitions $\mathcal{W}^1$ and $\mathcal{W}^2$. \FOR{ $(p,q) \in \{(1,2), (2,1)\}$} \STATE \emph{Stage 1:} On partition $\mathcal{W}^p$, learn $\hat \mu^p(v,z)$ by regressing $Y \sim V, Z \mid A = a$ \STATE \emph{Stage 2:} On partition $\mathcal{W}^{q}$, learn $\hat \nu^q_{\mathrm{PL}}(v)$ by regressing $\hat \mu^p(V,Z) \sim V$ \ENDFOR \STATE \textbf{PL\xspace{} prediction:} $\hat \nu_{\mathrm{PL}} (v) = \frac{1}{2} \sum_{i =1}^2 \hat{\nu}^i_{\mathrm{PL}}(v)$ \end{algorithmic} \end{algorithm} \begin{proposition}\label{thm:pl} Under sample-splitting for stages 1 and 2 and stability conditions on the 2nd stage estimators (appendix), the PL\xspace{} method has pointwise regression error bounded by \begin{align*} \mathbb{E} \Big[\big(\hat \nu_{\mathrm{PL}} (v) - \nu(v)\big)^2 \Big] \lesssim & \ \mathbb{E} \Big[\big(\tilde \nu(v) - \nu(v)\big)^2\Big] + \mathbb{E} \Big[ \big(\hat \mu(V, Z) - \mu(V, Z)\big)^2 \mid V = v \Big] \end{align*} where the oracle-quantity $\tilde \nu(v)$ describes the function we would get in the second-stage if we had oracle access to $Y^a$. \end{proposition} This simple approach can consistently estimate our target $\nu(v)$. However, it solves a harder problem (estimation of $\mu(v,z)$) than what our lower-dimensional target $\nu$ requires. Notably the bound depends \emph{linearly} on the MSE of $\hat \mu$. We next propose an approach that avoids such strong dependence. \subsection{Our main proposal: Doubly-robust (DR\xspace) approach} \label{sec:dr} Our main proposed method is what we call the \textbf{doubly-robust} (DR\xspace) approach, which improves upon the PL\xspace{} procedure by using a bias-corrected pseudo-outcome in the second stage (Alg.~\ref{alg:dr}). The DR\xspace{} approach estimates both $\mu$ and $\pi$, which enables the method to perform well in situations in which $\pi$ is easier to estimate than $\mu$. We propose a cross-fitting (Alg.~\ref{alg:dr_cf}) variant that satisfies the sample-splitting requirements of Theorem~\ref{thm:bc}. \begin{algorithm}[t] \caption{The proposed doubly-robust (DR\xspace) approach} \label{alg:dr_cf} \begin{algorithmic \scriptsize \STATE \emph{Stage 1:} Learn $\hat \mu(v,z)$ by regressing $Y \sim V, Z \mid A = a$. \\ \quad \qquad \ \ Learn $\hat \pi(v,z)$ by regressing $\mathbb{I}\{A=a\} \sim V, Z$ \STATE \emph{Stage 2:} Learn $\hat \nu_{\mathrm{DR}} (v)$ by regressing $\Big( \frac{\mathbb{I}\{A=a\}}{\hat \pi(V,Z)}(Y - \hat \mu(V,Z)) + \hat \mu(V,Z) \Big) \sim V$ \end{algorithmic} \end{algorithm} \begin{algorithm}[t] \caption{The proposed doubly-robust (DR\xspace) approach with cross fitting} \label{alg:dr} \begin{algorithmic \scriptsize \STATE Randomly divide training data into three partitions $\mathcal{W}^1$, $\mathcal{W}^2$, $\mathcal{W}^3$. \FOR{$(p, q, r) \in \{(1,2,3), (3,1,2), (2,3,1)\}$} \STATE \emph{Stage 1:} On $\mathcal{W}^p$, learn $\hat \mu^p(v,z)$ by regressing $Y \sim V, Z \mid A = a$. \\ \quad \qquad \ \ On $\mathcal{W}^{q}$, learn $\hat \pi^{q}(v,z)$ by regressing $\mathbb{I}\{A=a\} \sim V, Z$ \STATE \emph{Stage 2:} On $\mathcal{W}^{r}$, learn $\hat{\nu}_{\mathrm{DR}}^r$ by regressing $\Big( \frac{\mathbb{I}\{A=a\}}{\hat \pi^{q}(V,Z)}(Y - \hat \mu^p(V,Z)) + \hat \mu^p(V,Z) \Big) \sim V$ \ENDFOR \STATE \textbf{DR\xspace{} prediction:} $\hat \nu_{\mathrm{DR}} (v) = \frac{1}{3} \sum_{i =1}^3 \hat{\nu}_{\mathrm{DR}}^i(v)$ \end{algorithmic} \end{algorithm} \begin{theorem} \label{thm:bc} Under sample-splitting to learn $\hat \mu$, $\hat \pi$, and $\hat{\nu}_{\mathrm{DR}}$ and stability conditions on the 2nd stage estimators (appendix), the DR\xspace{} method has pointwise error bounded by: \begin{align*} \label{eqn:bc-rate} \mathbb{E} \Big[\big(\hat \nu_{\mathrm{DR}} (v) - \nu(v)\big)^2 \Big] \lesssim \ & \mathbb{E} \Big[\big(\tilde \nu(v) - \nu(v)\big)^2\Big] \\ &+ \mathbb{E} \Big[ (\hat \pi(V, Z) - \pi(V, Z))^2 \mid V = v\Big] \mathbb{E} \Big[ (\hat \mu(V, Z) - \mu(V, Z))^2 \mid V = v\Big] \end{align*} This implies a similar bound on the integrated MSE (given in appendix). \end{theorem} The DR\xspace error is bounded by the error of an oracle with access to $Y^a$ and a \emph{product} of nuisance function errors.\footnote{The term \emph{nuisance} refers to functions $\mu$ and $\pi$.} This product can be substantially smaller than the error of $\hat \mu$ in the PL\xspace bound. When this product is less than the oracle error, the DR\xspace{} approach is oracle-efficient, in the sense that it achieves (up to a constant factor) the same error rate as an oracle. This model-free result provides bounds that hold for \emph{any} regression method. It is nonetheless instructive to consider the form of these bounds in a couple common contexts. The next result is specialized to the sparse high-dimensional setting, and subsequently we consider the smooth non-parametric setting. \begin{corollary} \label{cor:lasso} Assume stability conditions on the 2nd stage regression estimator (appendix) and that a $k$-sparse model can be estimated with squared error $k^2 \sqrt{\frac{\log d}{n}}$ (e.g. \cite{chatterjee2013assumptionless}).\footnote{We use the sparsity parameter $k$ to indicate $k$ covariates have non-zero coefficients in the model.} With $k_{\omega}$-sparse $\omega$, the pointwise error for the TCR\xspace method is \begin{align*} \mathbb{E} \Big[\big(\hat \nu_{\mathrm{TCR}} (v) - \nu(v)\big)^2 \Big] \lesssim &\ \ k_{\omega}^2 \sqrt{\frac{\log d_\mathrm{V}}{n}} + b(v)^2 \end{align*} With $k_{\mu}$-sparse $\mu$ and $k_{\nu}$-sparse $\nu$, the pointwise error for the PL\xspace{} method is \begin{align*} \mathbb{E} \Big[\big(\hat \nu_{\mathrm{PL}} (v) - \nu(v)\big)^2 \Big] \lesssim & \ \ k_{\nu}^2 \sqrt{\frac{\log d_\mathrm{V}}{n}} + k_{\mu}^2\sqrt{\frac{\log d}{n}} \end{align*} Additionally with $k_{\pi}$-sparse $\pi$, the pointwise error for the DR\xspace{} method is \begin{align*} \mathbb{E} \Big[\big(\hat \nu_{\mathrm{DR}} (v) - \nu(v)\big)^2 \Big] \lesssim &\ \ k_{\nu}^2 \sqrt{\frac{\log d_\mathrm{V}}{n}} + k_{\mu}^2k_{\pi}^2 \frac{\log d}{n} \end{align*} The DR\xspace approach is therefore oracle efficient when $\Big(\frac{k_{\mu} k_{\pi}}{k_{\nu}}\Big)^2 \lesssim \Big(\frac{\sqrt{n \logd_\mathrm{V}}}{\log d} \Big)$. \end{corollary} Based on the upper bound, we cannot claim efficiency for the PL\xspace approach because $k_\mu > k_\nu$ and $d > d_\mathrm{V}$. For exposition, consider the simple case where $k_{\nu} \approx k_{\mu} \approx k_{\pi}$. Corollary~\ref{cor:lasso} indicates that when $d_\mathrm{V} \approx d$, the DR\xspace{} and PL\xspace{} methods will perform similarly. When $d_\mathrm{V} \ll d$, we expect the DR\xspace{} to outperform the PL\xspace{} method because the second term of the PL bound dominates the error whereas the first term of the DR bound dominates in high-dimensional settings. When $d_\mathrm{V} \ll d$ and the amount of confounding is small, we expect the TCR\xspace to perform well. \begin{corollary} \label{cor:smooth} Assume stability conditions on the 2nd stage regression estimator (appendix) and that a $\beta$-smooth function of a $p$-dimensional vector can be estimated with squared error $n^{\frac{-2\beta}{2\beta + p}}$. With $\beta_{\omega}$-smooth $\omega$, the pointwise error for the TCR\xspace method is \begin{align*} \mathbb{E} \Big[\big(\hat \nu_{\mathrm{TCR}} (v) - \nu(v)\big)^2 \Big] \lesssim &\ \ n^{-2\beta_{\omega}/(2\beta_{\omega} + d_\mathrm{V})} + b(v)^2 \end{align*} With $\beta_{\mu}$-smooth $\mu$ and $\beta_{\nu}$-smooth $\nu$, the pointwise error for the PL\xspace{} method is \begin{align*} \mathbb{E} \Big[\big(\hat \nu_{\mathrm{PL}} (v) - \nu(v)\big)^2 \Big] \lesssim & \ \ n^{-2\beta_{\nu}/(2\beta_{\nu} + d_\mathrm{V})} + n^{-2\beta_{\mu}/(2\beta_{\mu} + d)} \end{align*} Additionally with $\beta_{\pi}$-smooth $\pi$, the pointwise error for the DR\xspace{} method is \begin{align*} \mathbb{E} \Big[\big(\hat \nu_{\mathrm{DR}} (v) - \nu(v)\big)^2 \Big] \lesssim &\ \ n^{-2\beta_{\nu}/(2\beta_{\nu} + d_\mathrm{V})} + n^{\frac{-2\beta_{\mu}}{2\beta_{\mu} + d} + \frac{-2\beta_{\pi}}{2\beta_{\pi} + d}} \end{align*} The DR\xspace approach is therefore oracle efficient when $\frac{\beta_{\nu}}{\beta_{\nu} + d_\mathrm{V}/2} \leq \frac{\beta_{\mu}}{\beta_{\mu} + d/2} + \frac{\beta_{\pi}}{\beta_{\pi} + d/2}$ which simplifies to $s \geq \frac{d/2}{1 + \frac{d_\mathrm{V}}{\beta_{\nu}}}$ when $\beta_{\pi} = \beta_{\mu} = s$. \end{corollary} As in the sparse setting above, we cannot claim oracle efficiency for PL\xspace approach based on this upper bound because $\beta_\mu \leq \beta_\nu$ and $d > d_\mathrm{V}$. For exposition, consider an example where $\beta_{\nu} \approx \beta_{\mu} \approx \beta_{\pi}$. Corollary~\ref{cor:smooth} indicates that when $d_\mathrm{V} \approx d$, the DR\xspace{} and PL\xspace{} methods will perform similarly. When $d_\mathrm{V} \ll d$, we expect the DR\xspace{} to outperform the PL\xspace{} method because the second term of the PL bound dominates the error whereas the first term of the DR bound dominates. When $d_\mathrm{V} \ll d$ and the amount of confounding is small, we expect the TCR\xspace to perform well. This theoretical analysis helps us understand when we expect the prediction methods to perform well. However, in practice, these upper bounds may not be tight and the degree of confounding is typically unknown. To compare the prediction methods in practice, we require a method for counterfactual model evaluation. \section{Evaluation method} \label{sec:eval} We describe an approach for evaluating the prediction methods using observed data. In our problem setting (\textsection~\ref{def:problem_setting}), the prediction error of a model $\hat \nu$ is identified as $\mathbb{E}[(Y^a - \hat \nu(V))^2] = \mathbb{E}[\mathbb{E}[(Y-\hat{\nu}(V))^2 \mid V, Z, A= a]]$. We propose a doubly-robust procedure to estimate the prediction error that follows the approach in \cite{coston2020counterfactual}, which focused on classification metrics and therefore did not consider MSE. Defining the error regression $\eta(v, z) \coloneqq \mathbb{E}[(Y^a-\hat{\nu}(V))^2|V = v, Z = z]$, which is identified as $\mathbb{E}[(Y-\hat{\nu}(V))^2 \mid V = v, Z = z, A= a]$, the \textbf{doubly-robust estimate of the MSE of $\nu$} is \begin{equation*} \frac{1}{n}\sum_{i=1}^{n}\Bigg[\frac{\mathbb{I}\{A_i = a\}}{\hat \pi(V_i,Z_i)} \Big(\big(Y_i-\hat{\nu}(V_i)\big)^2 - \hat{\eta}(V_i,Z_i)\Big) + \hat{\eta}(V_i,Z_i)\Bigg] \end{equation*} The doubly-robust estimation of MSE is $\sqrt{n}$-consistent under sample-splitting and $n^{1/4}$ convergence in the nuisance function error terms, enabling us to get estimates with confidence intervals. Algorithm~\ref{alg:eval} describes this procedure.\footnote{The appendix describes a cross-fitting approach to jointly learn and evaluate the three prediction methods.} This evaluation method can also be used to select the regression estimators for the first and second stages. \begin{algorithm}[t] \caption{Cross-fitting approach to evaluation of counterfactual prediction methods} \label{alg:eval} \begin{algorithmic \scriptsize \STATE \textbf{Input:} Test samples $\{(V_j, Z_j, A_j, Y_j)\}_{j=1}^{2n}$ and prediction models $\{\hat{\nu}_1, ... \hat{\nu}_h\}$ \STATE Randomly divide test data into two partitions $\mathcal{W}^0 = \{(V^0_j, Z^0_j, A^0_j, Y^0_j)\}_{j=1}^n$ and $\mathcal{W}^1 = \{(V^1_j, Z^1_j, A^1_j, Y^1_j)\}_{j=1}^n$. \FOR{$(p, q) \in \{(0,1), (1,0)\}$} \STATE On $\mathcal{W}^p$, learn $\hat \pi^p(v,z)$ by regressing $\mathbb{I}\{A=a\} \sim V, Z$. \FOR{$m \in \{1,...., h\}$} \STATE On $\mathcal{W}^p$, learn $\hat \eta^p_{m}(v,z)$ by regressing $(Y-\hat{\nu}_{m}(V))^2 \sim V, Z \mid A= a$ \STATE On $\mathcal{W}^q$, for $j \in \{1,..., n\}$ compute ${\phi^q_{m, j} = \frac{\mathbb{I}\{A^q_j = a\}}{\hat \pi^{p}(V^q_j,Z^q_j)} ((Y^q_j-\hat{\nu}_{m}(V^q_j))^2 - \hat{\eta}^p_{m}(V^q_j,Z^q_j)) + \hat{\eta}^p_{m}(V^q_j,Z^q_j)}$ \ENDFOR \ENDFOR \STATE \textbf{Output error estimate confidence intervals:} for $m \in \{ 1,..., h \}$: \\ $\mathrm{MSE}_m = \Big(\frac{1}{2n} \displaystyle \sum_{i =0}^1 \displaystyle \sum_{j=1}^n \phi^i_{m, j} \Big) \pm 1.96 \sqrt{\frac{1}{2n} \mathrm{var}(\phi_{m})}$ \end{algorithmic} \end{algorithm} \section{Experiments} \label{sec:experiments} We evaluate our methods against ground truth by performing experiments on simulated data, where we can vary the amount of confounding in order to assess the effect on predictive performance. While our theoretical results for PL\xspace{} and DR\xspace{} are obtained under sample splitting, in practice there may be a reluctance to perform sample splitting in training predictive models due to the potential loss in efficiency. In this section we present results where we use the full training data to learn the 1st-stage nuisance functions and 2nd-stage regressions for DR\xspace{} and PL\xspace{} and we use the full training data for the one-stage TCR\xspace.\footnote{We report error metrics on a random heldout test set.} This allows us to examine performance in a setting outside what our theory covers. We first analyze how the methods perform in a sparse linear model. This simple setup enables us to explore how properties like correlation between $V$ and $Z$ impact performance. We simulate data as \begin{align*} V_i & \sim \mathcal{N}(0,1) \hspace{50pt} ;\ 1 \leq i \leq d_\mathrm{V}\\ Z_i & \sim \mathcal{N}(\rho V_i, 1-\rho^2) \hspace{19pt} ;\ 1 \leq i \leq d_\mathrm{Z}\\ \mu(V, Z) &= \frac{k_{v}}{k_{v}+\rho k_{z}} \Big(\sum_{i =1}^{k_{v}} V_i + \sum_{i =1}^{k_{z}} Z_i \Big) \hspace{28pt} \ \ Y^a = \mu(V,Z) + \epsilon \hspace{3pt} ;\ \epsilon \sim \mathcal{N}\Bigg(0, \frac{1}{2n}\norm{\mu(V,Z)}_2^2 \Bigg) \\ \nu(V) &= \frac{k_{v}}{k_{v}+\rho k_{z}}\Big( \sum_{i =1}^{k_{v}} V_i + \rho \sum_{i =1}^{k_{z}} V_i \Big) \\ \pi(V, Z) &= 1 - \sigma\Bigg(\frac{1}{\sqrt{k_{v} + k_{z}}} \Big( \sum_{i=1}^{k_{v}} V_i + \sum_{i=1}^{k_{z}} Z_i \Big) \Bigg) \hspace{20pt} \ \ A \sim \mathrm{Bernoulli}(\pi(V,Z)) \end{align*} where $\sigma(x) = \frac{1}{1 + e^{-x}}$. We normalize $\pi(v,z)$ by $\frac{1}{\sqrt{ k_{v} + k_{z}}}$ to satisfy Condition~\ref{condition:positivity} and use the coefficient $k_{v}/(k_{v}+\rho k_{z})$ to facilitate a fair comparison as we vary $\rho$. For all experiments, we report test MSE for 300 simulations where each simulation generates $ n = 2000$ data points split randomly and evenly into train and test sets.\footnote{Source code is available at \href{https://github.com/mandycoston/confound_sim}{https://github.com/mandycoston/confound\_sim}} In the first set of experiments, for fixed $d = d_\mathrm{V} + d_\mathrm{Z} = 500$, we vary $d_\mathrm{V}$ (and correspondingly $d_\mathrm{Z}$). We also vary $k_{z}$, which governs the runtime confounding. Larger values of $k_{z}$ correspond to more confounding variables. The theoretical analysis (\textsection~\ref{sec:methods}) suggests that when confounding ($k_{z}$) is small, then the TCR\xspace and DR\xspace{} methods will perform well. More confounding (larger $k_{z}$) should increase error for all methods, and we expect this increase to be significantly larger for the TCR\xspace method that has confounding bias. We expect the TCR\xspace and DR\xspace{} methods to perform better at smaller values of $d_\mathrm{V}$; by contrast, we expect the PL\xspace{} performance to vary less with $d_\mathrm{V}$ since the PL\xspace{} method suffers from the full $d$-dimensionality in the first stage regardless of $d_\mathrm{V}$. For large values of $d_\mathrm{V}$, we expect the PL\xspace{} method to perform similarly to the DR\xspace{} method. Fig.~\ref{fig:uncor} plots the MSE in estimating $\nu$ for $\rho = 0$ and $k_{v} = 25$ using LASSO and random forests. The LASSO plots in Fig.~\ref{fig:uncor}a and~\ref{fig:uncor}b show the expected trends. Random forests have much higher error than the LASSO (compare Fig.~\ref{fig:uncor}a to~\ref{fig:uncor}c) and we only see a small increase in error as we increase confounding (Fig.~\ref{fig:uncor}c) because the random forest estimation error dominates the confounding error. In this setting, the TCR\xspace method may outperform the other methods, and in fact the TCR\xspace performs best at low levels of confounding. \begin{figure} \centering \includegraphics[width=0.2\linewidth]{img/legend.pdf}\\ \includegraphics[width=0.03\textwidth, trim=300 0 220 0]{img/axis.pdf} \begin{subfigure}[t]{0.31\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 15]{img/uncor/vary_zeta_p400_LASSO.pdf} \caption{LASSO} \end{subfigure}% ~ \begin{subfigure}[t]{0.31\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 15]{img/uncor/vary_p_q_zeta20_LASSO.pdf} \caption{LASSO} \end{subfigure}% ~ \begin{subfigure}[t]{0.31\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 15]{img/uncor/vary_zeta_p400_RF.pdf} \caption{Random forests} \end{subfigure} \caption{\textbf{(a)} MSE as we vary $k_{z}$ using cross-validated LASSO to learn $\hat \pi$, $\hat \mu$, $\hat{\nu}_{\mathrm{TCR}}$, $\hat{\nu}_{\mathrm{PL}}$, $\hat{\nu}_{\mathrm{DR}}$ for $\rho = 0$, $d_\mathrm{V} = 400$ and $k_{v} = 25$. At low levels of confounding ($k_{z}$), the TCR\xspace method does well but performance degrades with $k_{z}$. For any non-zero confounding, our DR\xspace{} method performs best. \\ \textbf{(b)} MSE against $d_\mathrm{V}$ using cross-validated LASSO and $\rho = 0$, $k_{v} = 25$ and $k_{z} = 20$. The DR\xspace{} method performs the best across the range of $d_\mathrm{V}$. When $d_\mathrm{V}$ is small, the TCR\xspace method also does well since its estimation error is small. The PL\xspace{} method has higher error since it suffers from the full $d$-dimensional estimating error in the first stage. \textbf{(c)} MSE as we vary $k_{z}$ using random forests and $\rho = 0$, $d_\mathrm{V} = 400$ and $k_{v} = 25$. Compared to LASSO in (a), there is a relatively small increase in error as we increase $k_{z}$, suggesting that estimation error dominates the confounding error. The TCR\xspace method performs best at lower levels of confounding and on par with the DR\xspace{} method for larger values of $k_{z}$. \\ Error bars denote $95\%$ confidence intervals.} \label{fig:uncor} \end{figure} \begin{figure} \centering \includegraphics[width=0.2\linewidth]{img/legend.pdf}\\ \includegraphics[width=0.03\textwidth, trim=300 0 220 0]{img/axis.pdf} \begin{subfigure}[t]{0.31\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 15]{img/cor/vary_rho_LASSO_zeta20.pdf} \caption{LASSO} \end{subfigure}% ~ \begin{subfigure}[t]{0.31\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 15]{img/cor/vary_zeta_p400_LASSO.pdf} \caption{LASSO} \end{subfigure}% ~ \begin{subfigure}[t]{0.31\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 15]{img/cor/vary_p_q_zeta20_LASSO.pdf} \caption{LASSO} \end{subfigure} \caption{\textbf{(a)} MSE against correlation $\rho_{V_i, Z_i}$ for $k_{z} = 20$, $k_{v} = 25$, and $d_\mathrm{V} = 400$. Error decreases with $\rho$ for all methods. Our DR\xspace{} method achieves the lowest error under confounding ($\rho < 1$). \textbf{ (b)} MSE as we increase $k_{z}$ for $\rho = 0.25$, $k_{v} = 25$, and $d_\mathrm{V} = 400$. Compare to Figure~\ref{fig:uncor}a; the weak positive correlation reduces MSE, particularly for $k_{v} < i \leq k_{z}$ when $V_i$ is only a correlate for the confounder $Z_i$ but not a confounder itself. \textbf{(c)} MSE against $d_\mathrm{V}$ for $\rho = 0.25$, $k_{z} = 20$, and $k_{v} = 25$. The DR\xspace{} method is among the best-performing for all $d_\mathrm{V}$. As with the uncorrelated setting (\ref{fig:uncor}b), the DR\xspace{} and TCR\xspace methods are better able to take advantage of low $d_\mathrm{V}$ than the PL\xspace{} method. \\ Error bars denote $95\%$ confidence intervals. } \label{fig:cor} \end{figure} We next consider the case were $V$ and $Z$ are correlated. If V and Z are perfectly correlated, there is no confounding. For our data where higher values of $V$ and $Z$ both decrease $\pi$ and increase $\mu$, a positive correlation should reduce confounding, and a negative correlation may exacerbate confounding by increasing the probability that $Z$ is small given $A = a$ and $V$ is large and therefore increasing the gap $\mathbb{E}[Y^a \mid V = v] - \mathbb{E}[Y^a \mid V = v, A = a]$. Fig.~\ref{fig:cor} gives MSE for correlated V and Z. As expected, error overall decreases with $\rho$ (Fig.~\ref{fig:cor}a). Relative to the uncorrelated setting (Fig.~\ref{fig:uncor}), the weak positive correlation reduces MSE for all methods, particularly for large $k_{z}$ and $d_\mathrm{V}$. The DR\xspace{} method achieves the lowest error for settings with confounding, performing on par with the TCR\xspace when $d_\mathrm{V} = 50$. \paragraph{Experiments with Second-Stage Misspecification} Next, we explore a more complex data generating process through the lens of model interpretability. Interpretability requirements allow for a complex training process as long as the final model outputs interpretable predictions \citep{tan2018distill, zeng2017interpretable, rudin2019stop}. Since the PL\xspace{} and DR\xspace{} first stage regressions are only a part of the training process, we can use any flexible model to learn the first stage functions as accurately as possible without impacting interpretability. Constraining the second-stage learning class to interpretable models (e.g. linear classifiers) may cause misspecification since the interpretable class may not contain the true model. We simulate such a setting by modifying the setup (for $\rho = 0$): \begin{align*} V_i & \sim \mathcal{N}(0,1) \mathrm{\ \ for \ } \ 1 \leq i \leq \frac{d_\mathrm{V}}{2} \hspace{15pt} \\ V_i &\coloneqq V_j^2 \mathrm{\ \ for \ \ } \frac{d_\mathrm{V}}{2} < i \leq d_\mathrm{V}, \hspace{7pt} j = i - \frac{d_\mathrm{V}}{2}\\ \mu(V, Z) & = \sum_{i =1}^{k_{v}/2} \Big( V_i + (2(i \bmod 2) -1) V_i^2 \Big) + \sum_{i=1}^{k_{z}} Z_i \hspace{8pt} \\ \nu(V) &= \sum_{i =1}^{k_{v}/2} \Big( V_i + (2(i \bmod 2) -1) V_i^2 \Big) \end{align*} We restrict our second stage models and the TCR\xspace model to predictors $V_i$ for $1 \leq i \leq \frac{d_\mathrm{V}}{2}$ to simulate a real-world setting where we are constrained to linear classifiers using only $V$ at runtime. We allow the first stage models access to the full $V$ and $Z$ since the first stage is not constrained by variables or model class. We use cross-validated LASSO models for both stages and compare this setup to the setting where the model is correctly specified. The DR\xspace{} method achieves the lowest error for both settings (Table~\ref{fig:mse_misspec}), although the error is significantly higher for all methods under misspecification. \begin{table}[ht] \centering \begin{tabular}{c} Mean-Squared Error $\mathbb{E}[\big(\nu(V) - \hat{\nu}(V)\big)^2]$ \\ \end{tabular} \begin{tabular}{rlr} \hline Method & Correct specification & 2nd-stage misspecification \\ \hline TCR & 16.64 (16.28, 17.00) & 35.52 (35.18, 35.85) \\ PL & 12.32 (12.03, 12.61) & 32.09 (31.82, 32.36) \\ DR (ours) & \textbf{11.10 (10.84, 11.37)} & \textbf{31.33 (31.06, 31.59)} \\ \hline \end{tabular} \caption{MSE $\mathbb{E}[\big(\nu(V) - \hat{\nu}(V)\big)^2]$ under correct specification vs misspecification in the 2nd stage for $d= 500$, ${d_\mathrm{V} = 400}$, ${k_{v} = 24}$, ${k_{z} = 20}$ and $n=3000$ (with 95\% confidence intervals). Our DR method has the lowest error in both settings. Errors are larger for all methods under misspecification.} \label{fig:mse_misspec} \end{table} \subsection{Experiments on real-world child welfare data} In the US, each year over 4 million calls are made to child welfare screening hotlines with allegations of child neglect or abuse \citep{usdhhs}. Call workers must decide which allegations coming in to the child abuse hotline should be investigated. In agencies that have adopted risk assessment tools, the worker relies on (immediate risk) information communicated during the call and an algorithmic risk score that summarizes (longer term) risk based on historical administrative data \citep{chouldechova2018case}. The call is recorded but is not used as a predictor for three reasons: (1) the inadequacy of existing case management software to run speech/NLP models on calls in realtime; (2) model interpretability requirements; and (3) the need to maintain distinction between immediate risk (as may be conveyed during the call) and longer-term risk the model seeks to estimate. Since it is not possible to use call information as a predictor, we encounter runtime confounding. Additionally, we would like to account for the disproportionate involvement of families of color in the child welfare system \cite{dettlaff2011disentangling}, but due to its sensitivity, we do not want to use race in the prediction model. The task is to predict which cases are likely to be offered services under the decision $a = $ ``screened in for investigation'' using historical administrative data as predictors ($V$) and accounting for confounders race and allegations in the call ($Z$). Our dataset consists of over 30,000 calls to the hotline in Allegheny County, PA. We use random forests in the first stage for flexibility and LASSO in the second stage for interpretability. Table~\ref{table:child_welfare} presents the MSE using our evaluation method (\textsection~\ref{sec:eval}).\footnote{We report error metrics on a random heldout test set.} The PL\xspace and DR\xspace methods achieve a statistically significant lower MSE than the TCR\xspace approach, suggesting these approaches could help workers better identify at-risk children than standard practice. \begin{table}[ht] \centering \begin{tabular}{rlrrr} \hline & MSE \\ \hline TCR\xspace & 0.290 (0.287, 0.293) \\ PL\xspace & \textbf{0.249 (0.246, 0.251)} \\ DR\xspace (ours) & \textbf{0.248 (0.245, 0.250)} \\ \hline \end{tabular} \caption{MSE estimated via our evaluation procedure (\textsection~\ref{sec:eval}) for child welfare screening task. The PL\xspace and DR\xspace approaches achieve lower MSE than the TCR\xspace approach. $95\%$ confidence intervals given.} \label{table:child_welfare} \end{table} \section{Conclusion} We propose a generic procedure for learning counterfactual predictions under runtime confounding that can be used with any parametric or nonparametric learning algorithm. Our theoretical and empirical analysis suggests this procedure will often outperform other methods, particularly when the level of runtime confounding is significant. \section*{Acknowledgements} This research was made possible through support from the Tata Consultancy Services (TCS) Presidential Fellowship, the K\&L Gates Presidential Fellowship, and the Block Center for Technology and Society at Carnegie Mellon University. This material is based upon work supported by the National Science Foundation Grants No. DMS1810979, IIS1939606, and the National Science Foundation Graduate Research Fellowship Program under Grant No. DGE1745016. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation. We are grateful to Allegheny County Department of Human Services for sharing their data. Thanks to our reviewers for providing useful feedback about the project and to Siddharth Ancha for helpful discussions. \clearpage \bibliographystyle{plainnat} \section{Details on Proposed Learning Procedure} We describe a joint approach to learning and evaluating the TCR\xspace, PL\xspace, and DR\xspace prediction methods in Algorithm~\ref{alg:joint}. This approach efficiently makes use of the need for both prediction and evaluation methods to estimate the propensity score $\pi$. \begin{algorithm} \caption{Cross-fitting procedure to learn and evaluate the TCR\xspace, PL\xspace, and DR\xspace prediction methods} \label{alg:joint} \begin{algorithmic \scriptsize \STATE \textbf{Input:} Data samples $\{(V_j, Z_j, A_j, Y_j)\}_{j=1}^{4n}$ \STATE Randomly divide training data into four partitions $\mathcal{W}^1$, $\mathcal{W}^2$, $\mathcal{W}^3$, $\mathcal{W}^4$ where $\mathcal{W}^1 = \{(V^1_j, Z^1_j, A^1_j, Y^1_j)\}_{j=1}^n$ (and similarly for $\mathcal{W}^2$, $\mathcal{W}^3$, $\mathcal{W}^4$). \FOR{$(p,q,r,s) \in \{(1,2,3,4), (4,1,2,3), (3,4,1,2), (2,3,4,1)\}$} \STATE \emph{Stage 1:} On $\mathcal{W}^p$, learn $\hat \mu^p(v,z)$ by regressing $Y \sim V, Z \mid A = a$. \\ \quad \qquad \ \ On $\mathcal{W}^q$, learn $\hat \pi^q(v,z)$ by regressing $\mathbb{I}\{A=a\} \sim V, Z$ \STATE \emph{Stage 2:} On $\mathcal{W}^r$, learn $\hat{\nu}^r_{\mathrm{DR}}$ by regressing $\Big( \frac{\mathbb{I}\{A=a\}}{\hat \pi^q(V,Z)}(Y - \hat \mu^p(V,Z)) + \hat \mu^p(V,Z) \Big) \sim V$ \\ \quad \qquad \ \ On $\mathcal{W}^r$ and $\mathcal{W}^q$, learn $\hat{\nu}^r_{\mathrm{PL}}$ by regressing $\hat \mu^p(V,Z) \sim V$ \\ \quad \qquad \ \ On $\mathcal{W}^r$, $\mathcal{W}^q$, and $\mathcal{W}^p$, learn $\hat{\nu}^r_{\mathrm{TCR}}$ by regressing $Y \sim V \mid A = a$ \STATE \emph{Evaluate} for $m$ in \{ TCR\xspace, PL\xspace, DR\xspace \}: \\ \quad \qquad \ \ On $\mathcal{W}^q$, learn $\hat \eta^q_{m}(v,z)$ by regressing $(Y-\hat{\nu}^r_{m}(V))^2 \sim V, Z \mid A= a$ \\ \quad \qquad \ \ On $\mathcal{W}^s$, for $j = 1,...n$ compute ${\phi^s_{m,j} = \frac{\mathbb{I}\{A_j = a\}}{\hat \pi^q(V_j,Z_j)} ((Y_j-\hat{\nu}^r_{m}(V_j))^2 - \hat{\eta}^q_{m}(V_j,Z_j)) + \hat{\eta}^q_{m}(V_j,Z_j)}$ \ENDFOR \STATE \textbf{Output prediction models:} $\hat \nu_{\mathrm{DR}} (v) = \frac{1}{4} \displaystyle \sum_{j =1}^4 \hat{\nu}_{\mathrm{DR}, j}(v))$; \quad $\hat \nu_{\mathrm{PL}} (v) = \frac{1}{4}\displaystyle \sum_{j =1}^4 \hat{\nu}_{\mathrm{PL}, j}(v)$ ; \quad $\hat \nu_{\mathrm{TCR}} (v) = \frac{1}{4} \displaystyle \sum_{j =1}^4 \hat{\nu}_{\mathrm{TCR}, j}(v)$ \STATE \textbf{Output error estimate confidence intervals:} for $m$ in \{ TCR\xspace, PL\xspace, DR\xspace \}: \\ $\mathrm{MSE}_m = \Big(\frac{1}{4n} \displaystyle \sum_{i =1}^4 \displaystyle \sum_{j=1}^n \phi^i_{m,j} \Big) \pm 1.96 \sqrt{\frac{1}{4n} \mathrm{var}(\phi_{m})}$ \end{algorithmic} \end{algorithm} \section{Proofs and derivations} In this section we provided detailed proofs and derivations for all results in the main paper. \subsection{Derivation of Identifications of $\mu$ and $\nu$} \label{sec:ident} We first show the steps to identify $\mu(v,z)$: \begin{align*} \mu(v,z) &= \mathbb{E}[Y^a \mid V = v, Z = z] \\ \mathbb{E}[Y^a \mid V = v, Z = z] &= \mathbb{E}[Y^a \mid V = v, Z = z, A = a] \\ &= \mathbb{E}[Y \mid V = v, Z = z, A = a] \\ \end{align*} The first line applies the definition of $\mu$.. The second line follows from training ignorability (Condition~\ref{condition:ign}). The third line follows from consistency (Condition~\ref{condition:consistency}). Next we show the identification of $\nu(v)$: \begin{align*} \nu(v) &= \mathbb{E}[Y^a \mid V = v] \\ \mathbb{E}[Y^a \mid V = v] &= \mathbb{E} [ \mathbb{E}[Y^a \mid V = v, Z = z] \mid V = v] \\ &= \mathbb{E} [ \mathbb{E}[Y^a \mid V = v, Z = z, A = a] \mid V = v] \\ &= \mathbb{E} [ \mathbb{E}[Y \mid V = v, Z = z, A = a] \mid V = v] \\ \end{align*} The first line applies the definition of $\nu$ from Section~\ref{sec:notation}. The second line follows from iterated expectation. The third line follows from training ignorability (Condition~\ref{condition:ign}). The fourth line follows from consistency (Condition~\ref{condition:consistency}). Note that we can concisely rewrite the last line as $\mathbb{E}[\mu(V,Z) \mid V = v]$ since we have identified $\mu$. \subsection{Proof that TCR\xspace method underestimates risk under mild assumptions on a risk assessment setting} \label{sec:proof_btr_under} \begin{proof} In Section~\ref{sec:method_conf} we posited that the TCR\xspace method will often underestimate risk in a risk assessment setting. We demonstrate this for the setting with a binary outcome $Y \in \{0,1\}$, but the logic extends to settings with a discrete or continuous outcome. We assume larger values of $Y$ are adverse i.e. $Y = 0$ is desired and $Y = 1$ is adverse. The decision under which we'd like to estimate outcomes is the baseline decision $A = 0$. We start by recalling runtime confounding condition (\ref{condition:conf}): $\mathbb{P}(A= 0 \mid V, Y^0 =1) \neq \mathbb{P}(A= 0 \mid V, Y^0 =0)$. Here we further refine this by assuming we are in the common setting where treatment $A =1$ is more likely to be assigned to people who are higher risk. Then $\mathbb{P}(A= 1 \mid V, Y^0 =1) > \mathbb{P}(A= 1 \mid V, Y^0 =0)$. Equivalently $\mathbb{P}(A= 0 \mid V, Y^0 =1) < \mathbb{P}(A= 0 \mid V, Y^0 =0)$. By the law of total probability, $$\mathbb{P}(A = 0 \mid V) = \mathbb{P}(A = 0 \mid V, Y^0 = 1) \mathbb{P}(Y^0 = 1 \mid V) + \mathbb{P}(A = 0 \mid V, Y^0 = 0) \mathbb{P}(Y^0 = 0 \mid V)$$ Assuming $\mathbb{P}(Y^0 = 1 \mid V) > 0$, this implies \begin{equation} \label{eqn:btr_proof1} \mathbb{P}(A= 0 \mid V, Y^0 =0) > \mathbb{P}(A = 0 \mid V) \end{equation} By Bayes' rule, $$\mathbb{P}(A= 0 \mid V, Y^0 =0) = \mathbb{P}(Y^0= 0 \mid V, A =0)\frac{ \mathbb{P}(A= 0 \mid V)}{\mathbb{P}(Y^0 = 0 \mid V)} $$ Using this in the LHS of Equation~\ref{eqn:btr_proof1} and dividing both sides of Equation~\ref{eqn:btr_proof1} by $\mathbb{P}(A = 0 \mid V)$, we get $$ \frac{\mathbb{P}(Y^0= 0 \mid V, A =0)}{\mathbb{P}(Y^0 = 0 \mid V)} > 1 $$ Equivalently ${ \mathbb{E}[Y^0 \mid V, A= 0] < \mathbb{E}[Y^0 \mid V]}$. \end{proof} \subsection{Derivation of Proposition~\ref{prop:btr-bias} (confounding bias of the TCR\xspace method)} We recall \textbf{Proposition~\ref{prop:btr-bias}}: \\ Under runtime confounding, a model that perfectly predicts $\omega(v)$ has pointwise confounding bias $b(v) = \omega(v) - \nu(v) =$ \begin{equation} \int_{\mathcal{Z}} \mu(v,z) \Big(p(z \mid V = v, A = a) - p(z \mid V = v) \Big) dz \quad \neq \quad 0 \end{equation} \begin{proof} By iterated expectation and the definition of expectation we have that \begin{align*} \omega(v) &= \int_{\mathcal{Z}}\mathbb{E}[Y \mid V = v , Z = z, A = a] \ p(z \mid V = v, A =a) dz \\ & = \int_{\mathcal{Z}}\mu(v,z) p(z \mid V = v, A =a) dz \end{align*} In the identification derivation above we saw that $\nu(v) = \mathbb{E}[\mu(V,Z) \mid V = v]$. Using the definition of expectation, we can rewrite $\nu(v)$ as \begin{align*} &= \int_{\mathcal{Z}} \mu(v,z) p(z \mid V = v) dz \\ \end{align*} Therefore the pointwise bias is \begin{equation} \omega(v) - \nu(v) = \int_{\mathcal{Z}} \mu(v,z) \Big(p(z \mid V = v, A = a) - p(z \mid V = v) \Big) dz \end{equation} We can prove that this pointwise bias is non-zero by contradiction. Assuming the pointwise bias is zero, we have $\omega(v) = \nu(v) \implies Y^a \perp A \mid V = v$ which contradicts the runtime confounding condition~\ref{condition:conf}. \end{proof} We emphasize that the confounding bias does not depend on the treatment effect. This approach is problematic whenever treatment assignment depends on $Y^a$ to an extent that is not measured by $V$, even for settings with no treatment effect (such as selective labels setting \cite{lakkaraju2017selective, kleinberg2018human}). \subsection{Proof of Proposition~\ref{thm:tcr} (error of the TCR\xspace method)} \label{sec:proof_thm_tcr} We can decompose the pointwise error of the TCR\xspace method into the estimation error and the bias of the TCR\xspace target. \begin{proof} \begin{align*} \mathbb{E}[(\nu(v) - \hat \nu_{\mathrm{TCR}} (v))^2] &=\mathbb{E}[\Big((\nu(v) - \omega(v)) + (\omega(v) - \hat \nu_{\mathrm{TCR}} (v) )\Big)^2] \\ &\leq 2\Bigg( \mathbb{E}[(\nu(v) - \omega(v))^2] + \mathbb{E}[(\omega(v) - \hat \nu_{\mathrm{TCR}} (v) )^2] \Bigg) \\ &\lesssim (\nu(v) - \omega(v))^2 + \mathbb{E}[(\omega(v) - \hat \nu_{\mathrm{TCR}} (v) )^2] \\ & = b(v)^2 + \mathbb{E}[(\omega(v) - \hat \nu_{\mathrm{TCR}} (v) )^2] \end{align*} Where the second line is due to the fact that $(a+b)^2 \leq 2(a^2 + b^2)$. In the third line, we drop the expectation on the first term since there is no randomness in two fixed functions of $v$. \end{proof} \subsection{Proofs of Proposition~\ref{thm:pl} and Theorem~\ref{thm:bc} (error of the PL\xspace and DR\xspace methods)} \label{sec:proof_thms} We begin with additional notation needed for the proofs of the error bounds. For brevity let $W = (V, Z, A, Y)$ indicate a training observation. The theoretical guarantees for our methods rely on a two-stage training procedure that assumes independent training samples. We denote the first-stage training dataset as $\mathcal{W}^1 := \{W^1_{1}, W^1_{2} ,W^1_{3}, ... W^1_{n} \}$ and the second-stage training dataset as $\mathcal{W}^2 := \{W^2_{1}, W^2_{2} ,W^2_{3}, ... W^2_{n} \}$. Let $\hat{\mathbb{E}}_n[Y \mid V = v]$ denote an estimator of the regression function $\mathbb{E}[Y \mid V = v]$. Let $L \asymp R$ denote $L \lesssim \ R $ and $R \lesssim \ L$. \begin{definition}(Stability conditions) \label{condition:stab} The results assume the following two stability conditions on the second-stage regression estimators: \begin{condition} $\hat{\mathbb{E}}_n[Y \mid V = v] + c = \hat{\mathbb{E}}_n[Y + c \mid V = v]$ for any constant $c$ \end{condition} \begin{condition} For two random variables $R$ and $Q$, if $\mathbb{E}[R \mid V = v] = \mathbb{E}[Q \mid V = v]$, then $$\mathbb{E} \Bigg[ \Big( \hat{\mathbb{E}}_n[R \mid V = v] - \mathbb{E}[R \mid V = v] \Big)^2 \Bigg] \asymp \mathbb{E} \Bigg[ \Big( \hat{\mathbb{E}}_n[Q \mid V = v] - \mathbb{E}[Q \mid V = v] \Big)^2 \Bigg]$$ \end{condition} \end{definition} The second condition is satisfied for instance by local estimation techniques. While global methods (such as linear regression) may not satisfy this property, a weaker stability condition (see \citet{kennedy2020optimal}) can be used to achieve a bound on the integrated mean squared error. \subsubsection{Proof of Proposition~\ref{thm:pl} (error of the PL\xspace method)} The theoretical results for our two-stage procedures rely on the theory for pseudo-outcome regression in \citet{kennedy2020optimal} which bounds the error for a two-stage regression on the full set of confounding variables. However, our setting is different since our second-stage regression is on a subset of confounding variables. Therefore, Theorem 1 of \citet{kennedy2020optimal} does not immediately give the error bound for our setting, but we can use similar techniques in order to get the bound for our V-conditional second-stage estimators. \begin{proof} As our first step, we define an error function. The error function of the PL\xspace approach is $\hat{r}_{\mathrm{PL}}(v)$ \begin{align*} &= \mathbb{E}[\hat \mu(V, Z) \mid V = v, \mathcal{W}^1] - \nu(v) \\ &= \mathbb{E}[\hat \mu(V, Z) \mid V = v, \mathcal{W}^1] - \mathbb{E}[ \mu(V, Z) \mid V = v] \\ &= \mathbb{E}[\hat \mu(V, Z) - \mu(V, Z) \mid V = v, \mathcal{W}^1] \\ \end{align*} The first line is our definition of the error function (following \cite{kennedy2020optimal}). The second line uses iterated expectation, and the third lines uses the fact that $\mathcal{W}^1$ is a random sample of the training data. Next we square the error function and apply Jensen's inequality to get \begin{align*} \hat{r}_{\mathrm{PL}}(v)^2 = \Big(\mathbb{E}[\hat \mu(V, Z) - \mu(V, Z) \mid V = v, \mathcal{W}^1]\Big)^2 \leq \mathbb{E}\Big[ \Big(\hat \mu(V, Z) - \mu(V, Z)\Big)^2 \mid V = v, \mathcal{W}^1 \Big] \end{align*} Taking the expectation over $\mathcal{W}^1$ on both sides, we get \begin{align*} \mathbb{E} [\hat{r}_{\mathrm{PL}}(v)^2 \mid V = v] &\leq \mathbb{E} \Bigg[ \mathbb{E}\Big[\Big(\hat \mu(V, Z) - \mu(V, Z)\Big)^2 \mid V = v, \mathcal{W}^1\Big] \mid V = v \Bigg] \\ &= \mathbb{E} \Bigg[ \Big(\hat \mu(V, Z) - \mu(V, Z)\Big)^2 \mid V = v \Bigg] \end{align*} Next, under our stability conditions(\textsection~\ref{condition:stab}), we can apply Theorem 1 of \citet{kennedy2020optimal} (stated in the next section for reference) to get the pointwise bound \begin{align*} \mathbb{E} \Bigg[\Big(\hat \nu_{\mathrm{PL}} (v) - \nu(v)\Big)^2 \Bigg] \lesssim & \mathbb{E} \Bigg[\Big(\tilde \nu(v) - \nu(v)\Big)^2\Bigg] + \mathbb{E} \Bigg[ \Big(\hat \mu(V, Z) - \mu(V, Z)\Big)^2 \mid V = v\Bigg] \end{align*} Theorem 1 of Kennedy also implies a bound on the integrated MSE of the PL\xspace approach: \begin{align*} & \mathbb{E}\norm{\hat \nu_{\mathrm{PL}} (v) - \nu(v)}^2 \lesssim \mathbb{E} \norm{\tilde \nu(v) - \nu(v)}^2 + \int_{\mathcal{V}} \mathbb{E} \Big[ (\hat \mu(V, Z) - \mu(V, Z))^2 \mid V = v\Big] p(v) dv \end{align*} \end{proof} \subsubsection{Theorem for Pseudo-Outcome Regression (Kennedy)} The proofs of Proposition~\ref{thm:pl} and Theorem~\ref{thm:bc} rely on Theorem 1 of \citet{kennedy2020optimal} which we restate here for reference. In what follows we provide the proof for Theorem~\ref{thm:bc}. \begin{theorem}[Kennedy]\label{thm:kennedy} Recall that $\mathcal{W}^1$ denotes our $n$ first-stage training data samples. Let $\hat f(w) := \hat f(w; \mathcal{W}^1)$ be an estimate of the function $f(w)$ using the training data $\mathcal{W}^1$. Denote an independent sample as $W$. The true regression function is $m(v) := \mathbb{E}[f(W) \mid V = v]$. Denote the second stage regression as ${\hat m(v) := \hat \mathbb{E}_n[\hat f(W) \mid V = v]}$. Denote its oracle equivalent (if we had access to $Y^a$) as ${\tilde m(v) := \hat \mathbb{E}_n[f(W) \mid V = v]}$. Under stability conditions(\textsection~\ref{condition:stab}) on the regression estimator $\hat \mathbb{E}_n$, we have the following bound on the pointwise MSE: \vspace{-0.1pt} $$ \mathbb{E} \Big[\Big(\hat m(v) - m(v)\Big)^2 \Big] \lesssim \mathbb{E} \Big[\Big(\tilde m(v) - m(v)\Big)^2\Big] + \mathbb{E} \Big[ \hat r(v)^2 \Big] $$ where $\hat r(v)$ describes the error function $ \hat r(v) := \mathbb{E}[\hat f(W) \mid V = v, \mathcal{W}^1] - m(v) $. This implies the following bound for the integrated MSE: $$\mathbb{E}\norm{\hat m(v) - m(v)}^2 \lesssim \mathbb{E} \norm{\tilde m(v) -m(v)}^2 + \int \mathbb{E} \big[ \hat r(v)^2 \big]p(v) dv$$ \end{theorem} \subsubsection{Proof of Theorem~\ref{thm:bc} (error of the DR\xspace method)} \label{sec:proof_bc} Here we provide the proof for our main theoretical result which bounds the error of our proposed DR\xspace method. \begin{proof} As for the PL\xspace error bound above, the first step is to derive the form of the error function for our DR\xspace approach. For clarity and brevity, we denote the measure of the expectation in the subscript. \begin{align*} \hat r_{\mathrm{DR}}(v) &= \mathbb{E}_{W \mid V= v, \mathcal{W}^1} \Bigg[\frac{\mathbb{I}\{A = a\}}{\hat \pi(v,Z)}(Y - \hat \mu(v, Z)) + \hat \mu(v, Z)\Bigg] - \nu(v) \\ &= \mathbb{E}_{Z, A \mid V= v, \mathcal{W}^1} \Bigg[ \mathbb{E}_{W \mid A = a, V= v, Z = z, \mathcal{W}^1} \Bigg[\frac{\mathbb{I}\{A = a\}}{\hat \pi(v,Z)}(Y - \hat \mu(v, z)) + \hat \mu(v, z)\Bigg] \Bigg] - \nu(v) \\ &= \mathbb{E}_{Z ,A \mid V= v, \mathcal{W}^1} \Bigg[ \mathbb{E}_{Y \mid A = a, V= v, Z = z, \mathcal{W}^1} \Bigg[\frac{\mathbb{I}\{A = a\}}{\hat \pi(v,Z)}(Y - \hat \mu(v, z))\Bigg] + \hat \mu(v, Z)\Bigg] - \nu(v) \\ &= \mathbb{E}_{Z, A \mid V= v, \mathcal{W}^1} \Bigg[ \frac{\mathbb{I}\{A = a\}}{\hat \pi(v,Z)}(\mathbb{E}_{Y \mid A = a, V= v, Z = z, \mathcal{W}^1}[Y] - \hat \mu(v, Z)) + \hat \mu(v, Z)\Bigg] - \nu(v) \\ &= \mathbb{E}_{W \mid V= v, \mathcal{W}^1} \Bigg[ \frac{\mathbb{I}\{A = a\}}{\hat \pi(v,Z)}(\mu(v,Z) - \hat \mu(v, Z)) + \hat \mu(v, Z)\Bigg] - \nu(v) \\ &= \mathbb{E}_{Z \mid V= v, ,\mathcal{W}^1} \Bigg[ \mathbb{E}_{W \mid V= v, Z = z, \mathcal{W}^1} \Bigg[\frac{\mathbb{I}\{A = a\}}{\hat \pi(v,Z)}(\mu(v,z) - \hat \mu(v, z)) + \hat \mu(v, z)\Bigg] \Bigg] - \nu(v) \\ &= \mathbb{E}_{Z \mid V= v, \mathcal{W}^1} \Bigg[ \frac{\mathbb{P}(A =a \mid V= v, Z = z)}{\hat \pi(v,Z)}(\mu(v,Z) - \hat \mu(v, Z)) + \hat \mu(v, Z) \Bigg] - \nu(v) \\ &= \mathbb{E}_{Z \mid V= v, \mathcal{W}^1} \Bigg[ \frac{\pi(v, Z)}{\hat \pi(v,Z)}(\mu(v,Z) - \hat \mu(v, Z)) + \hat \mu(v, Z) \Bigg] - \nu(v) \\ &= \mathbb{E}_{Z \mid V= v, \mathcal{W}^1} \Bigg[ \frac{\pi(v, Z)}{\hat \pi(v,Z)}(\mu(v,Z) - \hat \mu(v, Z)) + \hat \mu(v, Z) - \mu(v, Z) \Bigg] \\ &= \mathbb{E} \Bigg[ \frac{(\mu(v,Z) - \hat \mu(v,Z))(\pi(v,Z) - \hat \pi(v,Z))}{ \hat \pi(v,Z)} \mid V = v, \mathcal{W}^1 \Bigg] \end{align*} Where the first line holds by definition of the error function $\hat r$ and the second line by iterated expectation. The third line uses the fact that conditional on $Z = z, V =v, A = a$, then the only randomness in $W$ is $Y$ (and therefore $\hat \mu$ is constant). The fourth line makes use of the $(\mathbb{I}\{A = a\})$ term to allow us to condition on only $A = a$ ( since the term conditioning on any other $a' \neq a$ will evaluate to zero). The fifth line applies the definition of $\mu$. \\ The sixth line again uses iterated expectation and the seventh makes use of the fact that conditional on $Z$, the only randomness now is in $A$ and that $\mathcal{W}^1$ is an independent randomly sampled set. The seventh line applies the definition of ${\pi(v,z) = \mathbb{P}(A = 1 \mid V= v, Z = z)}$ which since $A \in \{0,1\}$ is equal to $\mathbb{E}[A \mid V = v, Z = z]$. The eight line uses iterated expectation and the fact that $\mathcal{W}^1$ is an independent randomly sampled set to rewrite ${\nu(v) = E_{Z \mid V =v, \mathcal{W}^1 } [\mu(v, Z)}] $. The ninth line rearranges the terms. By Cauchy-Schwarz and the positivity assumption, \begin{align*} &\hat{r}_{\mathrm{DR}}(v)\leq C \sqrt{\mathbb{E}[(\mu(v,Z) - \hat \mu(v,Z))^2 \mid V = v, \mathcal{W}^1]}\sqrt{\mathbb{E}[(\pi(v,Z) - \hat \pi(v,Z))^2 \mid V = v, \mathcal{W}^1]} \end{align*} for a constant $C$. Squaring both sides yields \begin{align*} &\hat{r}_{\mathrm{DR}}^2(v)\leq C^2 \ \mathbb{E}[(\mu(v,Z) - \hat \mu(v,Z))^2 \mid V = v, \mathcal{W}^1] \ \mathbb{E}[(\pi(v,Z) - \hat \pi(v,Z))^2 \mid V = v, \mathcal{W}^1] \end{align*} If $\hat \pi$ and $\hat \mu$ are estimated using separate training samples, then taking the expectation over the first-stage training sample $\mathcal{W}^1$ yields: \begin{align*} &\mathbb{E}[\hat{r}_{\mathrm{DR}}^2(v)] \leq C^2 \ \mathbb{E}[(\mu(v,Z) - \hat \mu(v,Z))^2] \mid V = v] \ \mathbb{E}[(\pi(v,Z) - \hat \pi(v,Z))^2] \mid V = v] \end{align*} Applying Theorem 1 of \citet{kennedy2020optimal} gets the pointwise bound: \begin{align*} \mathbb{E} \Bigg[\Big(\hat \nu_{\mathrm{DR}} (v) - \nu(v)\Big)^2 \Bigg] \lesssim & \ \mathbb{E} \Bigg[\Big(\tilde \nu(v) - \nu(v)\Big)^2\Bigg] \\ &+ \mathbb{E} \Big[ (\hat \pi(V, Z) - \pi(V, Z))^2 \mid V = v\Big] \mathbb{E} \Big[ (\hat \mu(V, Z) - \mu(V, Z))^2 \mid V = v\Big] \end{align*} and the bound on integrated MSE of the DR\xspace approach: \begin{align*} & \mathbb{E}\norm{\hat \nu_{\mathrm{DR}} (v) - \nu}^2 \lesssim \ \mathbb{E} \norm{\tilde \nu(v) - \nu(v)}^2 \\ &+ \int_{\mathcal{V}} \mathbb{E} \Big[ (\hat \pi(V, Z) - \pi(V, Z))^2 \mid V = v\Big] \mathbb{E} \Big[ (\hat \mu(V, Z) - \mu(V, Z))^2 \mid V = v\Big] p(v)dv \end{align*} \end{proof} \subsection{Efficient influence function for DR\xspace method} We provide the efficient influence function of the DR\xspace method. The efficient influence function indicates the form of the bias-correction term in the DR\xspace method. The efficient influence function $\phi(A, V, Z, Y)$ for parameter $ {\psi(V) := \mathbb{E}[ Y^a \mid V] = \mathbb{E}[ \mathbb{E}[ Y \mid V, Z, A =a] \mid V]}$ is \begin{equation*} \phi(A, V, Z, Y) = \frac{\mathbb{I}\{A = a\}}{\pi(V,Z)}(Y - \mu(V,Z)) + \mu(V,Z) - \psi(V) \end{equation*} \section{Synthetic experiment details and additional results} In this section we present details on the synthetic experiments and present additional results. We present the random forests graphs omitted from the main paper, results on calibration-type curves that show where the errors are distributed, and experiments on our evaluation procedure. \subsection{Experimental details} \paragraph{More details on data-generating process} We designed our data-generating process in order to simulate a real-world risk assessment setting. We consider both $V$ and $Z$ to be risk factors whose larger values indicate increased risk and therefore we construct $\mu$ to increase with $V$ and $Z$. Our goal is to assess risk under the null (or baseline) treatment as per \cite{coston2020counterfactual}, and we construct $\pi$ such that historically the riskier treatments were more likely to get the risk-mitigating treatment and the less risky cases were more likely to get the baseline treatment. We now provide further details on the choices of coefficients and variance parameters. In the first set of experiments presented in the main paper, we simulate $V_i$ from a standard normal, and in the uncorrelated setting (where $\rho = 0$) we also simulate $Z_i$ from a standard normal. In the correlated setting, we sample $Z_i$ from a normal with mean $\rho V_i$ and variance $1- \rho^2$ so that the Pearson's correlation coefficient between $V_i$ and $Z_i$ is $\rho$ and so that the variance in $Z_i = 1$. We simulate $\mu$ to be a sparse linear model in $V$ and $Z$ with coefficients of 1 when $\rho = 0$. When $\rho \neq 1$, the coefficients are set to $\frac{k_{v}}{k_{v}+\rho k_{z}}$ so that the $L_1$ norm of the $\nu$ coefficients equals $k_{v}$ for all values of $\rho$. Without this adjustment, changing $\rho$ would impact error by also changing the signal-to-noise ratio in $\nu$. We simulate the potential outcome $Y^a$ to be conditionally Gaussian and the choice of variance $\frac{1}{2n}\norm{\mu(V,Z)}_2^2 $ yields a signal-to-noise ratio of 2. The specification for $\nu$ follows from the marginalization of $\mu$ over $Z$. The propensity score $\pi$ depends on the sigmoid of a sparse linear function in $V$ and $Z$ that uses coefficients $\frac{1}{\sqrt{k_{v} + k_{z}}}$ in order to satisfy our positivity condition. We use $d = 500$, $n = 1000$, $k_{v} = 25$, and $0 \leq k_{z} \leq 45$ to simulate a sparse high-dimensional setting with many measured variables in the training data, of which only 5\%-15\% are predictive of the outcomes. In one set of experiments, we vary the value of $k_{z}$ to assess impact of various levels of confounding on performance. In other experiments, where we vary $\rho$ or the dimensionality of $V$ ($d_\mathrm{V}$), we use $k_{z} = 20$ so that $V$ has slightly more predictive power than the hidden confounders $Z$. \paragraph{Hyperparameters} Our LASSO presents are presented for cross-validated hyperparameter selection using the \texttt{glmnet} package in R. The random forests results use $1000$ trees and default \emph{mtry} and splitting parameters in the \texttt{ranger} package in R. \paragraph{Training runs} Defining a training run as performing a learning procedure such as LASSO, for a given hyperparameter selection and given simulation, the TCR\xspace method trains in one run, the PL\xspace method trains in two runs, and the DR\xspace method trains in three runs. For a given simulation, the exact number of runs depends on the hyperparameter tuning. Since we only ran random forests (RF) for the default parameters, the TCR\xspace method with RF trained in one run, the PL\xspace method with RF trained in two runs, and the DR\xspace method with RF trained in three runs. The LASSO results using \texttt{cv.glmnet} were tuned over $\leq 100$ values of $\lambda$; the TCR\xspace method with LASSO trained in $\leq 100$ runs, the PL\xspace method with LASSO trained in $\leq 200$ runs, and the DR\xspace method with LASSO trained in $\leq 300$ runs. \paragraph{Sample size and error metrics} For experiments in the main paper, we trained on $n= 1000$ datapoints. We test on a separate set of $n = 1000$ datapoints and report the estimated mean squared error (MSE) on this test set using the following formula: $$ \frac{1}{n} \sum_{i=1}^n (\nu(V_i) - \hat \nu(V_i))^2 $$ \paragraph{Computing infrastructure} We ran experiments on an Amazon Web Serivces (AWS) c5.12xlarge machine. This parallel computing environment was useful because we ran thousands of simulations. The traintime of each simulation, entailing the LASSO and RF experiments, took 1.8 seconds. In practice for most real-world decision support settings, our method can be used in standard computing environments; relative to existing predictive modeling techniques, our method will require $\leq 3X$ the current train time. Our runtime depends only on the regression technique used in the second stage and should be competitive to existing models. \subsection{Random forest results} Figure~\ref{fig:uncor-rf} presents the results when using random forests for the first and second stage estimation in the uncorrelated V-Z setting. Figure~\ref{fig:uncor-rf}a was provided in the main paper, and we include it here again for ease of reference. Figure~\ref{fig:uncor-rf}b shows how method performance varies with $d_\mathrm{V}$. At low $d_\mathrm{V}$, the TCR\xspace method does significantly better than the two counterfactually valid approaches. This suggests that the estimation error incurred by the PL\xspace and DR\xspace methods outweighs the confounding bias of the TCR\xspace method. \begin{figure} \centering \includegraphics[width=0.25\linewidth]{img/legend.pdf}\\ \includegraphics[width=0.03\textwidth, trim=300 0 220 0]{img/axis.pdf} \begin{subfigure}[t]{0.40\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 10]{img/uncor/vary_zeta_p400_RF.pdf} \caption{Random forests} \end{subfigure}% ~ \begin{subfigure}[t]{0.40\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 10]{img/uncor/vary_p_q_zeta20_RF.pdf} \caption{Random forests} \end{subfigure} \caption{\textbf{(a)} MSE as we vary $k_{z}$ using random forests to learn $\hat \pi$, $\hat \mu$, $\hat{\nu}_{\mathrm{TCR}}$, $\hat{\nu}_{\mathrm{PL}}$, $\hat{\nu}_{\mathrm{DR}}$ for $\rho = 0$, $d_\mathrm{V} = 400$ and $k_{v} = 25$. \\ \textbf{(b)} MSE against $d_\mathrm{V}$ using random forests and $\rho = 0$, $k_{v} = 25$ and $k_{z} = 20$. \\ Error bars denote $95\%$ confidence intervals.} \label{fig:uncor-rf} \end{figure} \begin{figure} \centering \includegraphics[width=0.2\linewidth]{img/legend.pdf}\\ \includegraphics[width=0.03\textwidth, trim=300 0 220 0]{img/axis.pdf} \begin{subfigure}[t]{0.31\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 15]{img/cor/vary_rho_RF_zeta20.pdf} \caption{Random forests} \end{subfigure}% ~ \begin{subfigure}[t]{0.31\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 15]{img/cor/vary_zeta_p400_RF.pdf} \caption{Random forests} \end{subfigure}% ~ \begin{subfigure}[t]{0.31\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 15]{img/cor/vary_p_q_zeta20_RF.pdf} \caption{Random forests} \end{subfigure} \caption{\textbf{(a)} MSE against correlation $\rho_{V_i, Z_i}$ for $k_{z} = 20$, $k_{v} = 25$, and $d_\mathrm{V} = 400$. For all methods, error decreases with $\rho \leq 0.5$, at which point the error does not change with increasing $\rho$. \textbf{ (b)} MSE as we increase $k_{z}$ for $\rho = 0.25$, $k_{v} = 25$, and $d_\mathrm{V} = 400$. Compare to Figure~\ref{fig:uncor-rf}a; the weak positive correlation reduces MSE, particularly for $k_{v} < i \leq k_{z}$ when $V_i$ is only a correlate for the confounder $Z_i$ but not a confounder itself. \textbf{(c)} MSE against $d_\mathrm{V}$ for $\rho = 0.25$, $k_{z} = 20$, and $k_{v} = 25$. As with the uncorrelated setting (\ref{fig:uncor-rf}b), the DR\xspace{} and TCR\xspace methods are better able to take advantage of low $d_\mathrm{V}$ than the PL\xspace{} method. \\ Error bars denote $95\%$ confidence intervals. } \label{fig:cor-rf} \end{figure} \subsection{Evaluation experiments} To empirically assess our proposed doubly-robust evaluation procedure, we generated one sample of training data with $n= 1000$, $d = 500$, $d_\mathrm{V} = 200$, $k_{v} =25$, and $k_{z} = 30$ as well as a "ground-truth" test set with $n = 10,000$. We trained the TCR\xspace, PL\xspace, and DR\xspace methods on the training data and estimated their true performance on the large test set. The true prediction error $$\frac{1}{n} \displaystyle \sum_{i=1}^n \big(Y_i^a - \hat{\nu}(V_i)\big)^2$$ was 77.53, 74.12, and 72.68 respectively for the TCR\xspace, PL\xspace and DR\xspace methods. We then ran 100 simulations where we sampled a more realistically sized test set of $n = 2000$. In each simulation we performance the evaluation procedure to estimate prediction error on the observed data. The MSE estimator with $95\%$ CI covered the true MSE 94 times for the DR approach and 93 times for the PL. 81\% of the simulations correctly identified the DR\xspace procedure as having the lowest error, $14\%$ suggested that the PL\xspace procedure had the lowest error and $5\%$ suggested that the TCR\xspace had the lowest error. For additional experimental results on using doubly-robust evaluation methods for predictive models, we recommend \cite{coston2020counterfactual}. \subsection{Calibration-styled analysis of the error} Above we analytically showed that in a standard risk assessment setting the TCR\xspace method underestimates risk. We empirically demonstrate this in Figure~\ref{fig:reg_calib} where the calibration curve (Figure~\ref{fig:reg_calib}a) shows that TCR\xspace underestimates risk for all predicted values. Figure~\ref{fig:reg_calib}b plots the squared error against true risk $\nu(V)$, illustrating that errors are extremely large for high-risk individuals, particularly for the TCR\xspace model. This highlights a danger in using confounded approaches like the TCR\xspace model: they make misleading predictions about the highest risk cases. In high-stakes settings like child welfare screening, this may result in dangerously deciding to \emph{not} investigate the cases where the child is at high risk of adverse outcomes \cite{coston2020counterfactual}. The counterfactually valid PL\xspace and DR\xspace models mitigate this to some effect, but future work should investigate why the errors are still large on high-risk cases and propose procedures to further mitigate this. \begin{figure} \centering \includegraphics[width=0.15\linewidth]{img/legend.pdf}\\ \begin{subfigure}[t]{0.5\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 2]{img/calib_calib.pdf} \caption{LASSO} \end{subfigure}% ~ \begin{subfigure}[t]{0.5\textwidth} \centering \includegraphics[width=\linewidth, trim=23 20 14 2]{img/calib_errors_nu.pdf} \caption{LASSO} \end{subfigure} \caption{(a) Calibration plot for LASSO regressions with $p = 400$, $q = 100$, $k_{z} = 20$ and $k_{v} = 25$. A well-calibrated model will track the dotted $y = x$ line. Our DR\xspace model is the best calibrated. As expected from its confounding bias, the TCR\xspace method underestimates risk for all predicted values. Interestingly the PL\xspace and DR\xspace methods also underestimate risk for higher predicted risk values. \\ (b) Squared error against true risk $\nu(V)$ for LASSO regressions with $p = 400$, $q = 100$, $k_{z} = 20$ and $k_{v} = 25$. All models have highest error on the riskiest cases (those with large values of $\nu(V)$); this is particularly pronounced for the TCR\xspace model, suggesting that the TCR\xspace model would make misleading predictions for the highest risk cases.} \label{fig:reg_calib} \end{figure} \section{Real-world experiment details and additional results} In this section we elaborate on the details of our evaluation of the methods on a real-world child welfare screening task. \subsection{Child welfare dataset details} We use a dataset of over 30,000 calls to the child welfare hotline in Allegheny County, Pennsylvania. Each call contains more than 1000 features, including information on the allegations in the call as well as county records for all individuals associated with the call. The call features are categorical variables describing the allegation types and worker-assessed risk and danger ratings. The county records include demographic information such as age, race and gender as well as criminal justice, child welfare, and behavioral health history. The outcome we wish to predict is whether the family would be offered services if the case were screened in for investigation. \subsection{Child welfare experimental details} We perform the first stage regressions using random forests to allow us to flexibly estimate the nuisance function $\pi$ and $\mu$. For the second stage regressions, we use LASSO to yield interpretable prediction models. \paragraph{Hyperparameters} The first stage random forest regressions use $500$ trees and the default \emph{mtry} and splitting parameters in the \texttt{ranger} package in R. For our LASSO second stage regressions, we use cross-validation in the \texttt{glmnet} package in R to select the LASSO penalty parameters. \paragraph{Training runs} Each of the two nuisance function estimations in the first stage trains in one run. The LASSO cross-validation using \texttt{cv.glmnet} tunes over $\leq 100$ values of $\lambda$. Therefore, the TCR\xspace method trains in $\leq 100$ runs, the PL\xspace method with LASSO trains in $\leq 101$ runs, and the DR\xspace method with LASSO trains in $\leq 102$ runs. \paragraph{Sample size and error metrics} The dataset consists of 30,000 calls involving over 70,000 unique children. We partitioned the children into train and test partitions using a graph partitioning procedure that ensured that all siblings were contained within the same partition to avoid the contamination problem discussed in \cite{chouldechova2018case}. In order to enable more precise estimation of the counterfactual outcomes in this real-world setting, we perform a 1:2 train-test split such that the train split contains 27000 unique children and the test split contains 50000 unique children. We use the evaluation procedure in \textsection~\ref{sec:eval} to obtain estimates of the MSE with confidence intervals. \paragraph{Computing infrastructure} All real-world experiments were run on a MacBook Pro with an 8-core i9 processor and 16 GB of memory. Each first stage regression trained in 15 seconds. Each second stage regression trained in 4.5 minutes. \subsection{Modeling human decisions} Algorithmic tools used in decision support settings often estimate the likelihood of an event (outcome) under a proposed decision. This is the setting for which our method is tailored. By contrast, another paradigm trains algorithms to predict the human decision. We present here the results of such an algorithm when evaluated against the downstream outcome of interest (services offered). To train this model, we used the historical screening decision as the outcome. We allowed this model to access all confounders (both $V$ and $Z$, as if we did not have runtime confounding), yet this approach achieves a significantly higher MSE of $0.3207$ with $95\%$ confidence interval $(0.3143, 0.3271)$. It should not be surprising that a model trained on human decisions performs worse than models trained on downstream outcomes when we are evaluating against the downstream outcomes. This highlights the importance of using downstream outcomes in decision support settings when the goal is related to the downstream outcome e.g. to mitigate the risk of a downstream outcome or to prioritize cases that will benefit from the decision treatment.
\section*{Acknowledgments} We thank \emph{Apple}, \emph{BlueKitchen}, \emph{Broadcom}, \emph{Cypress}, \emph{Google}, \emph{Qualcomm}, and \emph{Samsung} for handling the responsible disclosure requests. \iftoggle{blinded}{ Further acknowledgments are blinded for review. } { We also thank Jakob Link for enabling remote access to the \emph{Samsung Galaxy S8} for further testing. Moreover, we thank Maximilian Tschirschnitz for pointing out a detail within the Bluetooth specification. Furthermore, we thank Matthias Ringwald and Teal Starsong for the paper feedback. This work has been funded by the German Federal Ministry of Education and Research and the Hessen State Ministry for Higher Education, Research and the Arts within their joint support of the National Research Center for Applied Cybersecurity ATHENE, as well as by the Deutsche Forschungsgemeinschaft (DFG) -- SFB 1119 -- 236615297. } \section*{Availability} The \ac{RNG} measurement assembler patches and scripts for the \emph{Broadcom} and \emph{Cypress} Bluetooth chips are openly available on \emph{GitHub}. They are hosted as examples for \emph{InternalBlue} on \url{https://github.com/seemoo-lab/internalblue}. \bibliographystyle{plain} \section{RNG Usage Within Bluetooth} \label{sec:background} A predictable or known \ac{RNG} has a severe impact on security-relevant functions in Bluetooth. The Bluetooth 5.2 specification only vaguely mentions that this is the case~\cite[p.~953]{bt52}, but does not provide any context which functions break if the \ac{RNG} does not meet the requirements. Thus, we outline concrete examples where the \ac{RNG} matters. These examples are not a complete list---this would exceed the scope of this paper. In general, random numbers are used in many more places within the Bluetooth specification, and an unknown number of applications within host applications. \subsection{Active \acs{MITM} Attack on Pairing with Numeric Comparison} \label{ssec:numericComparison} During the initial pairing of two Bluetooth devices, the protocol requires user input to prevent an active \ac{MITM} attack, as no previous key material exists on any of the devices to identify the other one. Bluetooth \ac{SSP} provides different methods for this kind of authentication, a commonly used one is \emph{Numeric Comparison}~\cite[p. 985]{bt52}: Both devices display a 6-digit number to the user and the user checks whether both numbers are equal. While \emph{Numeric Comparison} was introduced for Classic Bluetooth with \ac{SSP}, it is also supported by \ac{BLE} under the name \emph{LE Secure Connections} since Bluetooth 4.2~\cite[p. 269]{bt52}, because the previous \emph{LE Legacy Pairing} is broken by design~\cite{ryan2013bluetooth}. \todo{Teal says: LE in LE Secure Connections not defined. It's a name, though?} \emph{Numeric Comparison} happens in the second stage of authentication, after both parties have exchanged their \ac{ECDH} public keys. Device $B$, the non-initiating party, starts by generating a random number $Nb$ and sending a commitment $Cb$ of $Nb$ and both public keys to device $A$. Device $A$ answers by generating a random number, $Na$, as well, which it sends to $B$. Finally, $B$ sends $Nb$ to $A$, $A$ checks whether $Cb$ is indeed a commitment of $Nb$ and both parties hash $Na$, $Nb$ and both public keys to a 6-digit number, which is then displayed on both devices. If there was an active \ac{MITM} attacker, the public keys that are fed into the hash function would differ and the two devices would display different values with high probability. However, this depends on the attacker not being able to change either $Na$ or $Nb$ to search for a second pre-image of the hash function, as the 6-digit output does not protect against brute-force attacks. Therefore, the protocol is designed in a way that no party can decide on their random number after seeing the random number of the other party---$A$ by sending its number first and $B$ by committing to its randomness before seeing $Na$. The security of the \emph{Numeric Comparison} protocol crucially relies on the hiding property of the commitment, i.e., that no party can calculate $Nb$ from the commitment $Cb$. As the commitment is deterministic, this requires $Nb$ to be a number with high entropy. Now, if an attacker can predict $Nb$ or small set of possible $Nb$s, they can check for $Nb$ by calculating the commitment again and comparing it to $Cb$. If successful, they can use their knowledge of $Nb$ to create a value $Na^\prime$, sent to $B$, such that both devices display the same 6-digit code even though the public keys fed into the hash function differ. For the full attack, see \autoref{fig:numericcomp}. \subsection{LE Randomness Within Android} \label{ssec:androidle} \ac{BLE} uses the \ac{SMP} for pairing in \emph{LE Secure Connections} and \emph{LE Legacy Pairing}~\cite[p. 1666]{bt52}. \ac{SMP} resides on top of \ac{LE} data \acp{PDU} and initiates secure keys. Encryption is then started and stopped with \ac{LE} link control \acp{PDU} independent from \ac{SMP}. When initiating a \ac{BLE} pairing on \emph{Android 6--10}, the \ac{HCI} command \path{LE_Rand} is called multiple times. This way, \emph{Android} receives specification-compliant random numbers within its Bluetooth stack, but keeps control over the keys itself. We further investigate the current \emph{Android} \texttt{master} branch as of April 2020~\cite{androidbt}. All randomness-related function calls originate from the file \path{smp_keys.cc}. During a \ac{BLE} pairing in \emph{Just Works} mode, the functions \path{smp_create_private_key} and \path{smp_start_nonce_generation} are called. These use random inputs from the Bluetooth chip's \ac{RNG}. \path{smp_create_private_key} directly fills the \ac{ECDH} private key by calling the Bluetooth \ac{RNG} via \ac{HCI} four times in a row and then calculates a public key based on this. Thus, an attacker who knows the internal \ac{RNG} state can infer the \ac{ECDH} private key. After creating the \ac{ECDH} key pair, the value generated with \path{smp_start_nonce_generation} is sent in plaintext over-the-air and also contains \ac{RNG} data. Then, an \ac{LE} link control \ac{PDU} \path{LL_ENC_REQ} is sent~\cite[p. 2898]{bt52}, which also contains values from the Bluetooth \ac{RNG}, but is generated locally on the chip without \emph{Android} interaction. This means that on \emph{Android}, directly after using the Bluetooth \ac{RNG} for creating a private key, further \ac{RNG} values that could leak the internal \ac{RNG} state are sent in plaintext over-the-air. Note that this behavior is not required by the Bluetooth specification, e.g., \emph{iOS 13} does not call the Bluetooth \ac{RNG} upon \ac{SMP} key generation. \todo{BLE p. 3029, encryption start procedure, states the hard requirement of a compliant rng for the iv and skd (session key diversifier). p. 1679 explains things but wtf this is a big mess mixing le secure connections and le legacy pairing all over -.- the security manager specification for LE is on p. 1618ff. le legacy pairing is broken anyway, so only le secure connections is relevant. le secure connections: p. 1699 shows diagram. le uses l2cap that's why it's not in lcp except the encryption start req.} \section{Conclusion} \label{sec:conclusion} The development over a decade within the \emph{Broadcom} and \emph{Cypress} chips indicates that the \ac{RNG} is indeed a central component. The firmware history shows how the \ac{PRNG} fallback was first improved and then removed completely. However, removing it might also be harmful. If the \ac{PRNG} fallback had been missing in the \emph{Samsung Galaxy S8}, it might have simply returned static values. Another interesting detail in the firmware history is that \emph{Cypress} independently developed the \ac{PRNG} code after acquiring the \ac{IoT} branch of \emph{Broadcom} in 2016~\cite{cypressbroadcom}. This indicates that also the patching process might differ depending on which company is assigned to which chip, even though the firmware has similar issues. Overall, the \ac{RNG} provided by a Bluetooth chip remains a black box without intensive analysis. The Bluetooth specification requires an \ac{RNG} that passes tests such as the \emph{Dieharder} test suite. This requirement leads to the potentially false assumption that a Bluetooth chip's \ac{RNG} can be trusted for security-relevant operations, including the \ac{HCI} \path{LE_Rand} command exposing the \ac{RNG} to energy-constrained embedded devices and the \emph{Android} Bluetooth stack. Our \ac{RNG} testing scripts are publicly available, allowing benchmarks of future or not yet tested \emph{Broadcom} and \emph{Cypress} chips as well as porting these concepts to chips of other manufacturers. We tested many Bluetooth chips on our own. However, it would be helpful if manufacturers made details about the \ac{RNG} openly accessible. During our research, we only found that the non-Bluetooth \emph{Broadcom} main \ac{SoC} on the \emph{Raspberry Pi} might include an \ac{HRNG} that is based on thermal noise~\cite{bcmrng}. More transparency, i.e., statements whether a chip includes an \ac{HRNG} or a \ac{PRNG} and which type exactly, would be helpful when making design decisions on embedded and mobile devices. \section{Discussion} \label{sec:discussion} Initially, we only measured the \ac{PRNG} fallback on the \emph{Cypress} evaluation boards and the \emph{Google Nexus 5}. However, we found that the \ac{PRNG} was not accessed during regular usage on those devices. Nonetheless, we suspected it being used in other chips due to the observed code changes, and, thus, reported it to \emph{Broadcom}, \emph{Cypress}, \emph{Apple}, \emph{Google}, and \emph{Samsung} on January 12, 2020. We also informed the maintainer of \emph{BTstack}~\cite{btstack} on the same date, because we observed that they were excessively using the \ac{HCI} \path{LE_Rand} function during initialization of the Bluetooth stack for key generation. After a discussion with the \emph{BTstack} maintainer, we decided to test if the \ac{PRNG} was accessed on the \emph{Raspberry Pi 3/3+} when constantly calling \path{LE_Rand} for more than a day, but luckily, the results were negative. After this first round of responsible disclosure, \emph{Broadcom} claimed that the \ac{PRNG} fallback would not be used on any of their devices. This is when we started analyzing \num{20} different firmware versions. We informed \emph{Broadcom}, \emph{Samsung}, and \emph{Google} about the missing \ac{HRNG} in the \emph{Samsung Galaxy S8} on February 1, and also updated the others about the possibility that there are indeed chips without \ac{HRNG}. \emph{Google} closed the issue as \emph{Won't Fix (Infeasible)} on February 4, because it is up to \emph{Broadcom} to fix the firmware and none of their products is affected. A patch for the \emph{Samsung Galaxy S8} as well as its variants \emph{S8+} and \emph{Note 8} was released in May. There are a few \emph{iPhone} models that we did not test, and the \emph{iOS 13.5} release contains a patch for a model that also missed a proper \ac{RNG}. Since a test requires a jailbroken \emph{iPhone} and we do not have all \emph{iPhone} models available for testing, we could not identify the precise model and also could not perform any measurements. However, we performed tests for the registers used by the fallback on other devices and they provide similar properties as those on the \emph{Samsung Galaxy S8}. As \emph{Samsung} is using \emph{Broadcom} as well as \emph{Qualcomm} chips on their smartphones, depending on the market and device model, they asked if they could forward our report. Since we did not find anything on \emph{Qualcomm} chips ourselves and \emph{Qualcomm} has an \ac{NDA} with \emph{Samsung} possibly allowing them to include confidential information, we asked \emph{Samsung} to forward the report and exclude us if needed. We received the following answer on March 3: \begin{displayquote} \emph{``We haven't found any indicators that our Bluetooth implementations are affected by the PRNG issue after internally discussing the research results that were shared with us.''} \newline \vspace*{-0.5em}\hspace*{14.5em}QPSIIR-1329 \end{displayquote} What remains unclear is how the \emph{Samsung Galaxy S8} happened to miss an \ac{HRNG} in the first place. The code for accessing the \ac{HRNG} is already missing in the firmware, indicating that this issue was most likely known to developers during compilation---if not optimized and automated by another process. Yet, the \emph{BCM4347B0} chip made it into such a popular smartphone. \section{Firmware Variant Analysis} \label{sec:firmware} In the following, we compare the \ac{RNG} function across 20 firmware versions of even more devices. Sales numbers are rather vague and older devices might no longer be in use, but in total, the chips we analyzed are used in hundreds of millions if not even in a billion of devices. An overview of these is shown in \autoref{tab:fwvariants}. Since the firmware is located in the ROM and built during device development, the firmware build date is at least a year before the device release date. For some \emph{MacBooks} and the \emph{Raspberry Pi 4}, it is even five years. Moreover, some build dates do not represent the exact state of the libraries that were compiled into it. Thus, the table is sorted by firmware variants. We obtain firmware dumps and locate the \ac{RNG} function as described in \autoref{ssec:fwsymbols}. Based on this analysis, we identify five variants (see \autoref{ssec:fwvariants}). We provide a pseudo-code description of the main variants in \autoref{ssec:fwimpl}. \subsection{Firmware Symbols and Comparison Methods} \label{ssec:fwsymbols} \emph{InternalBlue} enables firmware ROM and RAM dumps on various operating systems to extract the firmware from \emph{Broadcom} and \emph{Cypress} chips~\cite{mantz2019internalblue}. The extraction requires physical device access and rooting or jailbreaking of mobile devices. Moreover, such firmware dumps do not contain any symbols or strings. Thus, reverse-engineering the \ac{RNG} is not straightforward. The \emph{Cypress} evaluation kits allow to develop an \ac{IoT} application with \emph{WICED Studio}~\cite{wiced}. This application is running on the same ARM core as the Bluetooth firmware. Thus, \emph{WICED Studio} includes a file called \texttt{patch.elf} to link the application during the build process. This patch file contains global function and variable names. Furthermore, each board's \path{*map*.h} file contains hardware register names. \emph{WICED Studio} also includes symbols in an \ac{ARM} compiler specific format for the \emph{Broadcom} \emph{BCM20703A2} Wi-Fi/Bluetooth combo chip in the files \path{ram_ext.symdefs} and \path{20703mapa0.h}. We use these partial symbols for static firmware analysis of the \ac{RNG}, which is internally provided by the function \path{rbg_rand}. Since the \ac{HRNG} is only mapped to two different locations throughout all variants, we can locate these in further firmware variants. The oldest variant is mapped to previously unknown addresses, but uses the same magic value \texttt{0x200FFFFF} when accessing the \ac{HRNG}. \subsection{Identified Variants} \label{ssec:fwvariants} \autoref{tab:fwvariants} compares the implementations of the function \path{rbg_rand}. Regardless of the implementation variant, \path{rbg_rand} always returns a \SI{4}{\byte} random number. Overall, we identify five different variants within firmware released over more than a decade. \paragraph{1. Minimal PRNG Fallback} The oldest variant contains the worst \ac{PRNG} fallback. If no \ac{HRNG} is available, it skips waiting for a new random number and performs a static calculation based on the current time---which might lead to zero entropy. \paragraph{2. Advanced PRNG Fallback} This variant is similar to variant \emph{(1)} but the \ac{PRNG} implementation is more advanced and does not only consider time. \paragraph{3. Cache and Advanced PRNG Fallback} \emph{Cypress} introduced a cache that is constantly filled with \num{32} \SI{4}{\byte} random numbers, probably to increase performance. Within this variant, also the registers used by the \ac{PRNG} vary and some that tend to be static were removed. \paragraph{4. Advanced PRNG Only} This variant is similar to variant \emph{(2)} but has the \ac{PRNG} as \emph{only} option. The \ac{HRNG} access is missing within the firmware and dynamic analysis reveals that it is not mapped at all. \paragraph{5. Asynchronous Cache and No PRNG} The newest variant is a complete rewrite of the \texttt{rbg} library by \emph{Broadcom}. The cache is filled asynchronously in the background, the \ac{HRNG} has an additional register, and the \ac{PRNG} fallback was removed. \begin{figure}[b!] \tikzstyle{myarrow}=[->, >=open triangle 90, thick] \tikzstyle{func_node}=[rectangle, draw=black, rounded corners, fill=white, text centered, anchor=north, text=black, font=\ttfamily] \begin{tikzpicture} \draw[draw=darkblue,thick,fill=darkblue!10](0.27,-0.45) rectangle (7.5, -1.6); \draw[draw=darkblue,thick,fill=darkblue!10](0.55,-2.1) rectangle (7.5,-3.55); \draw[draw=darkblue,thick,fill=darkblue!10](0.27,-4.35) rectangle (7.5,-5); \draw (0,0) node[inner sep=0,anchor=north west] { \begin{lstlisting}[language=C, label=lst:rbg_rand_mac,caption={Variant 1--4: \texttt{rbg\_rand} on the \emph{BCM20703A2 MacBook}.}] uint32 rbg_rand(void){ uint32 RBG_CONST_READY = 0x200FFFFF; uint32 RBG_CONST_STATUS_OK = 0xFFFFF000; uint32 _rbg_ret_val; uint32 *prng_store; if (*rbg_status << 12 == RBG_CONST_STATUS_OK) { while (*rbg_status != RBG_CONST_READY) { wdog_restart(); *hrng_control = 1; } _rbg_ret_val = *rbg_random_num; } else { // rbg_get_psrng (inline) } *prng_store = _rbg_ret_val; return (uint32) _rbg_ret_val; } \end{lstlisting}}; \node[func_node, text width= 1.3cm, text height=0.7em, xshift=7.8cm, yshift = -0.2cm](init) {\scriptsize init}; \node[func_node, text width= 1.3cm, text height=0.7em, yshift = -0.15cm, below=of init](get_rbg) {\scriptsize get\_rbg}; \node[func_node, text width= 1.3cm, text height=0.7em, yshift = -0.75cm, below=of get_rbg](teardown) {\scriptsize teardown}; \end{tikzpicture} \end{figure} \begin{figure}[b!] \begin{lstlisting}[language=C,caption={Variant 2--4: Advanced PRNG fallback on the \emph{BCM20703A2 MacBook}.}, label=lst:rbg_get_psrng_mac] bcs_waitForBTclock() data_array[0] = *@\textbf{dc\_nbtc\_clk}@ // Bluetooth clock data_array[1] = *@\textbf{timer1value}@ // System clock data_array[2] = *@\textbf{dc\_fhout}@ data_array[3] = *@\textbf{agcStatus}@ data_array[4] = *@\textbf{rxInitAngle}@ data_array[5] = *@\textbf{spurFreqErr1}@ data_array[6] = *@\textbf{rsPskPHErr5}@ if (*rgb_psrng_control == 0){ __rt_memcpy(data_array[7], mm_top, 4) len = 0x2c } else { len = 0x20 data_array[7] = *@\textbf{psrng\_store}@ } _rbg_ret_val = @\textbf{crc32\_update}@(0xFFFFFFFF, data_array, len) bcs_releaseBTclock() *rgb_psrng_control = 1 \end{lstlisting} \end{figure} \begin{figure}[b!] \begin{lstlisting}[language=C,caption={Variant 1: Minimal PRNG fallback on the \emph{BCM2046A2 iMac}.}, label=lst:rbg_get_psrng_imac] return clock ^ ((16 * static_register + 180) << 20) ^ static_value[4 * static_register] \end{lstlisting} \end{figure} \subsection{Implementation Details} \label{ssec:fwimpl} Variant \emph{(2)}, the \emph{Advanced \ac{PRNG} Fallback}, is the most common variant that we found. Since we have partial symbols for this variant, we can reconstruct the original logic of the \ac{HRNG} access (\autoref{lst:rbg_rand_mac}) and \ac{PRNG} implementation (\autoref{lst:rbg_get_psrng_mac}). Note that except from the complete rewrite in variant \emph{(5)}, the code throughout all variants is very similar. The \ac{HRNG} is accessed with the three mapped registers \path{rbg_control}, \path{rbg_status}, and \path{rbg_random_num}. A new random number is requested by writing \texttt{1} to \path{rbg_control}. The \path{rbg_status} indicates if the \ac{HRNG} is available in general and if it currently has a fresh random number. The random number itself is accessible via \path{rbg_random_num}. If the \ac{HRNG} is available in general, the \path{rbg_rand} function enters an endless loop until a new random value is available. As this loop might take longer, it pets the watchdog. The \ac{PRNG} depends on two timing values, which are the Bluetooth clock \path{dc_nbtc_clk} and system clock \path{timer1value}. The \SI{4}{\byte} Bluetooth clock is comparably slow, runs in steps of \SI{312.5}{\micro\second}~\cite[p. 415]{bt52}, and is shared over-the-air. In comparison, the system clock passes faster and is not directly known. Depending on the platform, it is either \SI{2}{\byte} or \SI{4}{\byte}. The remaining \ac{PRNG} values are acquired from signal reception characteristics. If the \ac{PRNG} was not used before, it is initialized based on the current memory contents. Otherwise, the last value within the \ac{PRNG} store is taken. Since the \path{rbg_rand} function only returns \SI{4}{\byte}, the entropy of these values is combined by calculating a \ac{CRC}. The older variant \emph{(1)}, the \emph{Minimal \ac{PRNG} Fallback}, is even worse. The fallback only performs a static calculation based on the current time, as shown in \autoref{lst:rbg_get_psrng_imac}. The \SI{4}{\byte} time register is increased by one every \SI{0.005}{\second}. \section{HRNG and PRNG Tests} \label{sec:hardware} The function \path{rbg_rand} can be analyzed statically based on firmware dumps, however, it must also be validated on physical hardware. For example, the code accessing the \ac{HRNG} was missing in the firmware of the \emph{Samsung Galaxy S8}. However, the code might be present and the test if the \ac{HRNG} register is available could still return \texttt{false}. Furthermore, if the \ac{PRNG} is accessed in absence of the \ac{HRNG}, the entropy of the registers that it is accessing becomes relevant. In the following, we first measure the \ac{HRNG} in \autoref{ssec:hrngmes} and then measure the \ac{PRNG} fallback for the devices using it in \autoref{ssec:prngmes}. Additionally, we discuss specification-compliant attacks to change \ac{PRNG} inputs and infer the current \ac{PRNG} state over-the-air in \autoref{ssec:prngattack}. \subsection{HRNG Measurements} \label{ssec:hrngmes} The only existing interface to acquire random numbers of the Bluetooth chip is the \acf{HCI} command \path{LE_Rand}~\cite[p. 2521]{bt52}. After successful execution, this command is answered with an \ac{HCI} event containing an \SI{8}{\byte} random number. In theory, this could already be used on any off-the-shelf device to measure the \ac{RNG} quality. However, access via \path{LE_Rand} has two drawbacks. First, the \emph{Dieharder} test suite requires at least \SI{1}{\giga\byte} of random data to successfully complete all tests. Second, further functions within the Bluetooth firmware might access the \ac{RNG} in parallel and influence the results. Utilizing \emph{InternalBlue}~\cite{mantz2019internalblue}, we make the following modifications to \emph{Broadcom} and \emph{Cypress} chips to collect \ac{HRNG} data. We substitute the original \path{rbg_rand} routine with \texttt{return 0} to gain exclusive \ac{HRNG} access. Except from the evaluation boards, all chips are Wi-Fi/Bluetooth combo chips. Thus, we also disable Wi-Fi to exclude further side-effects. Then, we collect random data in chunks. The chunk size depends on the memory available on the specific device, but on most devices, we found free chunks of \SI{20.480}{\kilo\byte}. This allows to collect \num{4096} measurements of \SI{5}{\byte} values. After each \SI{4}{\byte} returned by the \ac{HRNG}, we insert one static check byte, which we remove before running \emph{Dieharder}. This ensures that no other process was using this memory area in parallel and is faster to insert than a checksum. Once collection of a chunk is finished, we issue an asynchronous \ac{HCI} event to notify the host. Then, the host collects the random data using the vendor-specific command \path{Read_RAM}, which can read \SI{251}{\byte} chunks. The \emph{Dieharder} test suite usually expects an endless source of randomness, such as \path{/dev/urandom} on UNIX-like operating systems. In contrast, the Bluetooth \ac{HRNG} results are stored in files. As a baseline, we run \emph{Dieharder} on files produced with \path{/dev/urandom} as input and find that at least \SI{1}{\giga\byte} of random data is required to pass all tests. Therefore, this is the lower bound of data collected for each chip. With the modifications listed above, data collection takes approximately one day, depending on the chip's interface and operating system. \autoref{tab:hrng} shows how much data was collected per chip and that the \acp{HRNG} in all chips passed the \emph{Dieharder} tests. Each data extraction for the \emph{Dieharder} test suite still takes comparably long and requires custom patches. However, given that the extensively tested \acp{HRNG} passed all tests, already checking if a \ac{HRNG} is present on a chip is an important information. \emph{InternalBlue} implements everything required for such a basic check out-of-the-box---reading chip memory and sending \ac{HCI} commands. The hardware registers listed in \autoref{tab:fwvariants} must contain one \SI{4}{\byte} random number. This number is indeed the one used by the \path{rbg_rand} function if it changes with actions like pairing. On devices supporting \ac{BLE}, the \ac{HRNG} can be triggered with the \ac{HCI} command \path{LE_Rand}. Firmware versions implementing a cache are required to get a call to \path{LE_Rand} multiple times before the \ac{HRNG} is used. The second half of \autoref{tab:hrng} contains devices from which we could not collect samples but that indeed have an \ac{HRNG}. These devices include the \emph{iMac Late 2009}, the newest \emph{Samsung Galaxy S} series, and the \emph{iPhone 11} and \emph{SE2}. On the \emph{iMac Late 2009}, we were not able to program custom patches because RAM is very limited on that chip. Moreover, its interface is slow~\footnote{One specification-compliant \ac{HCI} randomness event contains \SI{8}{\byte}, while our events fill the maximum possible event payload of \SI{251}{\byte}. The timing of \ac{HCI} events is almost constant independent on their size. Assuming that our \SI{251}{\byte} data extraction runs one day, the \SI{8}{\byte} data extraction would require a month per device. The exact \ac{HCI} speed depends on the \emph{InternalBlue} and host-specific implementation of each device.}, making it unrealistic to extract \SI{1}{\giga\byte} of data. The \emph{Samsung Galaxy S10} and \emph{S20} series use the same chip. However, \emph{Broadcom} improved firmware security and added stack canaries, which prevent calling functions out of context without additional modifications within our patches. As of now, there is no \emph{InternalBlue} support for \ac{PCIe} Bluetooth chips as on the most recent \emph{iPhone 11} and \emph{SE2}. Nonetheless, the chip can be tested with \emph{BlueTool} on jailbroken \emph{iPhones}. \emph{BlueTool} is an \emph{Apple}-internal tool included on \emph{iOS}. It is utilized for driver initialization, but it also has a rudimentary command-line interface with \ac{HCI} support. \begin{table}[!b] \renewcommand{\arraystretch}{1.3} \caption{\ac{PRNG} inputs on the \emph{Samsung Galaxy S8}.} \label{tab:prng} \centering \scriptsize \begin{tabular}{|c|l|p{4.7cm}|} \hline \textbf{Address} & \textbf{Register} & \textbf{Entropy} \\ \hline --- & \path{Rand} & \textcolor{darkred}{Previous \SI{4}{\byte} random value (leaks over-the-air)}\\ \texttt{0x318088} & \path{dc_nbtc_clk} & \textcolor{darkred}{Bluetooth clock, publicly available over-the-air}\\ \texttt{0x32A004} & \path{timer1value} & \textcolor{darkred}{Hardware clock, \SI{4}{\byte} ``random'' before first leak, \newline unpatched attacks for clock reset available}\\ \texttt{0x3186A0} & \path{dc_fhout} & \textcolor{orange!70!red}{Changes a bit (\texttt{0x02}--\texttt{0x50})}\\ \texttt{0x410434} & \path{agcStatus} & \textcolor{orange!70!red}{Changes a bit (\texttt{0xc00} during whole measurement, slight changes within \texttt{0xc$nn$} after reboot)} \\ \texttt{0x41079C} & \path{rxInitAngle} & \textcolor{orange!70!red}{Changes a bit but within similar range}\\ \texttt{0x4100AC} & \path{spurFreqErr1} & \textcolor{darkred}{Constant \SI{2}{\byte} value (\texttt{0x04ed}, also after reboot)}\\ \texttt{0x410548} & \path{rxPskPhErr5} & \textcolor{darkred}{Always 0}\\ \hline \end{tabular} \end{table} \subsection{PRNG Measurements} \label{ssec:prngmes} The \emph{Samsung Galaxy S8} series and an \emph{iPhone} are missing an \ac{HRNG}. As there is a \ac{PRNG} fallback, the firmware is still able to generate somewhat random numbers instead of being obviously broken for an outsider without firmware knowledge. Most likely the \ac{RNG} test required to pass the specification did not include a firmware review, and, thus, only the checksumed combination of the registers the \ac{PRNG} uses was measured. The \ac{PRNG} is accessing multiple hardware registers, listed in \autoref{tab:prng}. While we do not have any symbols for the \emph{Samsung Galaxy S8} firmware, it is using the same registers as the \emph{BC20703A2 MacBook} chip, and also the same code as previously shown in \autoref{lst:rbg_get_psrng_mac}. \begin{figure}[!b] \begin{tikzpicture}[every node/.style={font=\footnotesize}] \begin{axis}[ybar stacked, bar width=1.6pt, minor y tick num = 3, xtick={2,10,...,80},height=5cm, width=0.52\textwidth,xmin=-1,xmax=83] \addplot[style = {darkblue, fill=darkblue!30}] coordinates { (2, 6062) (3, 6224) (4, 5904) (5, 6142) (6, 8595) (7, 5808) (8, 8238) (9, 7545) (10, 5901) (11, 3703) (12, 4186) (13, 6167) (14, 8289) (15, 5971) (16, 5879) (17, 4170) (18, 6064) (19, 7789) (20, 6480) (21, 8095) (22, 6314) (23, 8146) (24, 8134) (25, 11726) (26, 6146) (27, 9854) (28, 6160) (29, 3956) (30, 8003) (31, 4096) (32, 6177) (33, 6947) (34, 3963) (35, 5974) (36, 4200) (37, 8381) (38, 10626) (39, 8250) (40, 4096) (41, 6111) (42, 6083) (43, 6063) (44, 6290) (45, 6786) (46, 4236) (47, 6062) (48, 8020) (49, 5242) (50, 4489) (52, 6317) (54, 6225) (56, 6226) (58, 6121) (60, 4022) (62, 5502) (64, 5825) (66, 6226) (68, 6387) (70, 6384) (72, 4006) (74, 8325) (76, 6205) (78, 3992) (80, 10094) }; \end{axis} \end{tikzpicture} \caption{Histogram of values of \texttt{dc\_fhout} observed on a \emph{Samsung Galaxy S8}.} \label{fig:dc_fhout} \end{figure} \input{pics/s8_rxInitAngle.tex} We measure the \ac{PRNG} registers with similar firmware modifications as for the \ac{HRNG} measurements and also disable \mbox{Wi-Fi}. Over \num{1000} rounds, we store \num{4096} \SI{4}{\byte} values to the chip's internal RAM. Then, we collect them via \ac{HCI}. Due to the current \emph{InternalBlue} implementation on \emph{Android 9}, \ac{HCI} introduces a delay, which is \SI{3.075}{\second} on average in our measurements. Thus, data about each register is collected over a time span of approximately \SI{51}{\minute}. Each measurement round takes roughly \SI{2.58}{\milli\second} on the chip itself. During the whole experiment, \path{spurFreqErr1} and \path{rxPskPhErr5} stayed constant. The only non-clock hardware registers that changed are \path{dc_fhout}, \path{rxInitAngle}, and \texttt{agcStatus}. As shown in the histograms (\autoref{fig:dc_fhout}--\ref{fig:agcStatus}), these registers have very little variation. Moreover, they typically stay constant within one round and often even constant over multiple rounds. \autoref{fig:s8_dcfhout} shows \path{dc_fhout} over time. In addition to the comparably slow change in its value, it also shows a pattern. The clock registers \path{dc_nbtc_clk} and \texttt{timer1value} change, but they are also not random. The Bluetooth clock, \path{dc_nbtc_clk}, is shared over-the-air. This is required to keep connections synchronous. In addition, the current Bluetooth clock value is used in substantial parts of the protocol, i.e., as encryption algorithm input. As shown in \autoref{fig:s8_clocks}, the hardware and Bluetooth clock are aligned. However, the hardware clock has a \SI{205}{times} higher granularity than the Bluetooth clock, meaning that even for a known Bluetooth clock and a hardware clock value that leaked once, future hardware clock values still have a slight variance. \begin{figure}[!b] \begin{tikzpicture}[every node/.style={font=\footnotesize}] \begin{axis}[ybar stacked, bar width=5.4pt, minor y tick num = 3, height=5cm, width=0.52\textwidth, xticklabel style={rotate=90}, xticklabels={\texttt{0x0000}, \texttt{0x4cc2}, \texttt{0x4ccc}, \texttt{0x4cd8}, \texttt{0x4ce2}, \texttt{0x4cee}, \texttt{0x4cf8}, \texttt{0x4d04}, \texttt{0x4d0e}, \texttt{0x4d18}, \texttt{0x4d24}, \texttt{0x4d2e}, \texttt{0x4d3a}, \texttt{0x4d44}, \texttt{0x4d4e}, \texttt{0x4d5a}, \texttt{0x4d64}, \texttt{0x4d6e}, \texttt{0x4d7a}, \texttt{0x4d84}, \texttt{0x4d8e}, \texttt{0x4d9a}, \texttt{0x4df2}, \texttt{0x4dfc}, \texttt{0x4e08}, \texttt{0x4e12}, \texttt{0x4e1c}, \texttt{0x4e26}, \texttt{0x4e30}, \texttt{0x4e3c}, \texttt{0x4e46}, \texttt{0x4e50}, \texttt{0x4e5a}}, xtick={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}, xmin=-1, xmax=33.25] \addplot[style = {darkblue, fill=darkblue!30}] coordinates { (0, 69632) (1, 135168) (2, 135168) (3, 118784) (4, 155648) (5, 114688) (6, 126976) (7, 106496) (8, 122880) (9, 122880) (10, 126976) (11, 118784) (12, 126976) (13, 143360) (14, 139264) (15, 131072) (16, 118784) (17, 131072) (18, 110592) (19, 135168) (20, 118784) (21, 118784) (22, 135168) (23, 122880) (24, 143360) (25, 122880) (26, 122880) (27, 139264) (28, 110592) (29, 122880) (30, 98304) (31, 143360) (32, 106496) }; \end{axis} \end{tikzpicture} \caption{Histogram of values of \texttt{rxInitAngle} observed on a \emph{Samsung Galaxy S8}.} \end{figure} \begin{figure}[!b] \begin{tikzpicture}[every node/.style={font=\footnotesize}] \begin{axis}[ybar stacked, bar width=8pt, minor y tick num = 3, height=5cm, width=0.52\textwidth, xticklabel style={rotate=90}, xticklabels={\texttt{0xc00}, \texttt{0xc93}, \texttt{0xc94}, \texttt{0xc95}, \texttt{0xc96}, \texttt{0xc97}, \texttt{0xc98}, \texttt{0xc99}, \texttt{0xc9a}, \texttt{0xc9b}, \texttt{0xc9c}, \texttt{0xc9d}, \texttt{0xc9e}, \texttt{0xc9f}, \texttt{0xca0}, \texttt{0xca1}, \texttt{0xca2}, \texttt{0xca4}, \texttt{0xca5}, \texttt{0xca6}, \texttt{0xca7}}, xtick={0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}, xmin=-1, xmax=21.25] \addplot[style = {darkblue, fill=darkblue!30}] coordinates { (0, 4599808) (1, 4096) (2, 12288) (3, 53248) (4, 20480) (5, 20480) (6, 53248) (7, 53248) (8, 81920) (9, 135168) (10, 53248) (11, 69632) (12, 114688) (13, 151552) (14, 61440) (15, 36864) (16, 12288) (17, 16384) (18, 225280) (19, 397312) (20, 114688) }; \end{axis} \end{tikzpicture} \caption{Histogram of values of \texttt{agcStatus} observed on a \emph{Samsung Galaxy S8}, two measurements, first one was constant \texttt{0xc00}.} \label{fig:agcStatus} \end{figure} \clearpage \subsection{PRNG Attacks} \label{ssec:prngattack} All variants, including the newest variant 5, access the \path{rbg_rand} function in the same way. An overview of the calling structure is shown in \autoref{fig:callgraph_to_rbg_rand_}. How \path{rbg_rand} is used becomes relevant when attacking the \ac{PRNG}. Attacks on the \ac{PRNG} can be divided into predicting (\autoref{sssec:predict}) and influencing (\autoref{sssec:influence}) its inputs as well as extracting its current state (\autoref{sssec:extract}). Combining all of these provides the strongest attack vector. However, an attacker can opt to not actively manipulate the \ac{PRNG} inputs, resulting in more bits to brute-force within random numbers or to infer the precise internal \ac{PRNG} state. We describe how an attacker can predict \ac{PRNG} outputs due to its weak implementation in \autoref{sssec:predictOutput}. \subsubsection{Predicting PRNG Inputs} \label{sssec:predict} While some functions access \path{rbg_rand} directly, others use the wrapper \path{sha_get_128b_rand} that returns a \SI{16}{\byte} random number. This wrapper calls \path{rbg_rand} 16 times in a row and applies the SHA-1 function. Note that SHA-1 is outdated and the Bluetooth specification recommends using SHA-256 within \acp{RNG}~\cite[p. 953]{bt52}. Since the timing of subsequent calls in a loop is predictable, \ac{PRNG} inputs that depend on time do not provide any additional entropy in this context. Moreover, \path{dc_fhout}, \path{rxInitAngle}, and \texttt{agcStatus} stayed constant within one measurement round in most cases, and, thus, also do not add any entropy except from the value in the first round. \subsubsection{Influencing PRNG Inputs} \label{sssec:influence} An attacker who has a crash-only over-the-air attack can reset the hardware clock to \texttt{0xFFFFFFFF}. Since the Patchram slots in the \emph{Broadcom} and \emph{Cypress} chips are rare, only severe security issues can be patched. Crash-only attacks, such as \emph{CVE-2019-6994}, often remain unpatched~\cite{classen2019inside}. The Bluetooth and hardware clock stay correlated over time, meaning that an attacker does not necessarily need to crash the chip while the user is pairing a new device or initiating an encrypted session, but any time before. In addition to control and knowledge about the clock, a timed crash and following packet calling the \ac{PRNG} might also set the current \ac{PRNG} status to a less random value. The very first \ac{PRNG} round is initialized by copying memory from RAM (see line 11 in \autoref{lst:rbg_get_psrng_mac}), which this is likely filled with predictable contents during chip initialization. \begin{figure}[!b] \begin{center} \hspace*{-0.5em}\scalebox{0.76}{ \tikzstyle{myarrow}=[->, >=latex', shorten >=1pt, thick] \tikzstyle{func_node}=[rectangle, draw=black, rounded corners, fill=white, text centered, anchor=north, text=black, font=\ttfamily \footnotesize] \begin{tikzpicture}[node distance=2mm and 4mm, auto] \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, func_node] (ape_rand_other) {\dots}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, func_node,below= of ape_rand_other] (sp_generate_PPKeyPair) {sp\_generate\_PPKeyPair}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, func_node, yshift=-3mm, below= of sp_generate_PPKeyPair] (ulp_rand_other) {\dots}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, func_node,below= of ulp_rand_other, fill=darkred!10, draw=darkred, thick] (smulp_genIV) {smulp\_genIV}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, func_node, yshift=-3mm, below= of smulp_genIV] (sha_others) {\dots}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, func_node,below= of sha_others] (lm_HandleHCIMasterLinkKey) {lm\_HandleHCIMasterLinkKey}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, func_node,below= of lm_HandleHCIMasterLinkKey] (ap_action_txStartEncryptReq) {ap\_action\_txStartEncryptReq}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, func_node,below= of ap_action_txStartEncryptReq] (lm_HandleHciPinCodeReqReply) {\_ape\_action\_txCombKey}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, yshift= 4mm, func_node,right= of sp_generate_PPKeyPair] (ape_rand) {ape\_rand}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, yshift= 4mm, func_node, right= of smulp_genIV, fill=darkred!10, draw=darkred, thick] (ulp_rand) {ulp\_rand}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, yshift= 4mm, func_node,right= of ap_action_txStartEncryptReq, fill=darkblue!10, draw=darkblue, thick] (sha_get_128b_rand) {sha\_get\_128b\_rand}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, yshift= -4mm, func_node,below= of sha_get_128b_rand] (lculp_createAccessAddress) {lculp\_createAccessAddress}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, yshift= -3mm, func_node,below = of lculp_createAccessAddress] (lculp_initSetConnDefaultParam) {lculp\_initSetConnDefaultParam}; \node[minimum height=2em, minimum width=12.5em, text height=1em, align=center, func_node, yshift=3mm, above= of ape_rand] (rbg_rand_other) {\dots}; \node[minimum height=2em, minimum width=4em, text height=1em, align=center, func_node, yshift=-1.6cm, right= of ulp_rand, fill=darkblue!10, draw=darkblue, thick] (rbg_rand) {rbg\_rand}; \draw[myarrow] (ape_rand_other.east) -- (ape_rand.west); \draw[myarrow] (sp_generate_PPKeyPair.east) -- (ape_rand.west); \draw[myarrow] (ulp_rand_other.east) -- (ulp_rand.west); \draw[myarrow] (smulp_genIV.east) -- (ulp_rand.west); \draw[myarrow] (sha_others.east) -- (sha_get_128b_rand.west); \draw[myarrow] (lm_HandleHCIMasterLinkKey.east) -- (sha_get_128b_rand.west); \draw[myarrow] (ap_action_txStartEncryptReq.east) -- (sha_get_128b_rand.west); \draw[myarrow] (lm_HandleHciPinCodeReqReply.east) -- (sha_get_128b_rand.west); \draw[myarrow] (rbg_rand_other.east) -- (rbg_rand.west); \draw[myarrow] (ape_rand.east) -- (rbg_rand.west); \draw[myarrow] (ulp_rand.east) -- (rbg_rand.west); \draw[myarrow] (sha_get_128b_rand.east) -- (rbg_rand.west); \draw[myarrow] (lculp_createAccessAddress.east) -- (rbg_rand.west); \draw[myarrow] (lculp_initSetConnDefaultParam.east) -- (rbg_rand.west); \draw[myarrow] (lculp_initSetConnDefaultParam.north) -- (lculp_createAccessAddress.south); \end{tikzpicture} } \caption{Call graph to \texttt{rbg\_rand} on the \emph{CYW20735B1} evaluation board.} \label{fig:callgraph_to_rbg_rand_} \end{center} \end{figure} \subsubsection{Extracting PRNG Outputs} \label{sssec:extract} An attacker needs to know the current \ac{PRNG} state including the previous random value \path{Rand} to get full knowledge about future \ac{PRNG} values. Assuming that the firmware already accesses the \ac{PRNG} a few times during initialization, even a chip reset might leave the attacker with some variability. Moreover, an attacker might not be able to reset the chip and, thus, does not have any knowledge about the internal \ac{PRNG} state and needs to brute-force it. All \ac{BLE}-related functions access \path{ulp_rand}, which in turn calls \path{rbg_rand}. Thus, the \path{LE_Rand} \ac{HCI} command allows direct access to the current \ac{RNG} state. However, an attacker typically acts over-the-air and does not have access to the host. The current state of the \ac{RNG} can be leaked over-the-air as follows. An attacker can send an \path{LL_ENC_REQ}~\cite[p. 2898]{bt52}, which is answered with an \path{LL_ENC_RSP}~\cite[p. 2899]{bt52}. The \path{LL_ENC_RSP} by the device under attack contains the fields \path{SKDs} and \path{IVs}. Within the firmware, these are generated by the functions \path{smulp_genSKD} and \path{smulp_genIV}, which both call \path{ulp_rand} that directly accesses the \ac{PRNG}. This implementation is the same for the \emph{CYW20735B1} evaluation board, which is shown in the call graph in \autoref{fig:callgraph_to_rbg_rand_}, and the \emph{Samsung Galaxy S8}. Regarding the \emph{Samsung Galaxy S8}, the \emph{Android} implementation mentioned in \autoref{ssec:androidle} is vulnerable to passive \ac{MITM} attacks. An attacker does not need to establish a connection and send an \path{LL_ENC_REQ} \ac{PDU}---\emph{Android} transmits the \ac{BLE} \ac{RNG} state within various packet types. An attacker who inferred the current \ac{PRNG} state and has knowledge or control about the hardware clock can calculate upcoming values provided by the \ac{PRNG}. \todo{maybe be explicit and say that BLE and Classic use the same RNG and so attacking either of them is the same} \todo{crc32 backwards calculation? or at least we have so few inputs that we can build some tables. we know which value might follow after which.} \subsubsection{Predicting PRNG Outputs} \label{sssec:predictOutput} We will now describe how to predict randomness generated by the \ac{PRNG} based on previous outputs. For each \SI{4}{\byte} randomness, the \ac{PRNG} uses the previous output concatenated with the internal clock, the Bluetooth clock, and a number of registers. Then, it hashes them using a \acf{CRC}. Note that the input state consists of \SI{32}{\byte}, therefore, it is infeasible to determine the full state based on outputs of the \ac{PRNG}, even if we know that some of the values are not uniformly random. However, an attacker can exploit the fact that CRC32 is an affine function, using an initialization value of $IV=$\texttt{0xFFFFFFFF}. For two inputs $a$ and $b$, \[\text{CRC32}(a)\oplus\text{CRC32}(b)=\text{CRC32}(a\oplus b)\oplus\text{CRC32}(IV).\] \noindent Due to this affinity of CRC32, if we know the two previous outputs of the \ac{PRNG}, we only need to guess the difference in the inputs to the \ac{PRNG}. For the Bluetooth clock, we know its value as it is included in every transmission, and for the system clock, only the lowest bits will change with high probability. Further, as shown in the previous sections, the entropy in the other registers is quite low. Let $out_0$ and $out_1$ be the two previous outputs, then \[out_2 = out_1 \oplus \text{CRC32}( C || R || P ) \oplus \text{CRC32}(IV),\] where $C$ is the guessed bit difference in both clocks, $R$ is the guessed bit difference in the registers, and $P$, the bit difference to the previous output field, is given by \[ P = \text{CRC32}(out_0) \oplus \text{CRC32}(out_1) \oplus \text{CRC32}(IV).\] We estimate the difference entropy of the registers to be less than \SI{18}{\bit}. If we assume we have a synchronization between the Bluetooth clock and the hardware clock as described in \autoref{sssec:influence}, we need \SI{8}{\bit} for the hardware clock, resulting in a total of \SI{26}{\bit}. Note that further calls to the \ac{PRNG} afterward are deterministic with high probability. For example, for Numeric Comparison, we start by choosing a \SI{128}{\bit} random number $Nb$, which is generated by \num{16} successive calls to the \ac{PRNG}. As we have shown in \autoref{ssec:numericComparison}, the knowledge of $Nb$ would enable an \ac{MITM} attack on the pairing process. Further, due to the deterministic commitment, we can check as an \ac{MITM} attacker whether we found the correct $Nb$. A brute force attack to check all possible outputs of the \ac{PRNG} would take about \SI{5}{\minute} on a single CPU core. As this is trivially parallelizable, this is a realistic attack given enough computing power. Similar efficiency is to be expected in the case of generated private keys using randomness from the \ac{PRNG}, as discussed in \autoref{ssec:androidle}. \section{Introduction} High-quality random numbers ensure security within cryptographic methods. The Bluetooth 5.2 specification makes no exception to this---it requires a Bluetooth chip to provide at least a \ac{PRNG} compliant to \emph{FIPS PUB 140-2}~\cite[p.~953]{bt52,fips1402}. Various security-relevant functions depend on random numbers, such as generating authentication and encryption keys, nonces within \ac{SSP}, or passkeys used in authentication. Moreover, embedded and \ac{IoT} devices with \ac{BLE} can request random numbers locally from the chip~\cite[p.~2521]{bt52}. Thus, a Bluetooth chip's \ac{RNG} quality can also be relevant to external applications. According to the specification, the \ac{RNG} shall be tested against \emph{FIPS SP800-22}~\cite{fipssp80022}. Recommended test suites are \emph{Diehard}, \emph{Dieharder}, and the \emph{NIST tools}~\cite{dieharder,nisttest}. We choose the \emph{Dieharder} suite, as it implements the most extensive tests. Verification of the randomness properties is not straightforward. Even though these test suites exist, the local \ac{HCI} that enables the operating system to request random numbers from the chip introduces a lot of overhead per request and only returns an \SI{8}{\byte} number. In contrast, the \emph{Dieharder} test suite requires at least \SI{1}{\giga\byte} of unique data to return meaningful results, making randomness tests a challenge. Statistical tests might not uncover all issues within an \ac{RNG}. The underlying implementation can be a \ac{HRNG} or \ac{PRNG}. The latter is part of the chip's firmware and could have flaws only detectable by reverse-engineering the implementation. While the \ac{HRNG} could also have flaws that stay undetected by statistical tests, this goes beyond the analysis of this paper. The according datasheets, which are only available for a few of the older chips, do not cover any details about the \ac{HRNG}. In this paper, we reverse-engineer and measure the \ac{RNG} implementations of \emph{Broadcom} and \emph{Cypress} Bluetooth chips\footnote{\emph{Cypress} acquired parts of \emph{Broadcom} in 2016~\cite{cypressbroadcom}, and the code bases diverged since then.}. In particular, we analyze the \acp{RNG} on \num{20} chips, including those on the most recent \emph{iPhones} and \emph{Samsung Galaxy S} series. To this end, we root or jailbreak those devices, dump their firmware with the \emph{InternalBlue} framework~\cite{mantz2019internalblue}, and reverse-engineer these. Moreover, we write custom patches that increase the \ac{RNG} output to make measurements with the \emph{Dieharder} test suite feasible. These patches need to be customized for each chip and the according operating systems, which are \emph{Android}, \emph{Linux}, \emph{iOS}, and \emph{macOS}. Our main findings are as follows: \todo{if time allows: measure the HRNG speed} \todo{if time allows: btstack le rand usage?} \begin{itemize} \item All chips (except the \emph{Samsung Galaxy S8} variants and an \emph{iPhone}) contain a \ac{HRNG}. Yet, most implement a \ac{PRNG} fallback in case the \ac{HRNG} is not available. \item The \ac{PRNG} is based on various predictable inputs, which significantly reduces its entropy. We show that an active over-the-air attacker can infer and manipulate \ac{PRNG} values. \item Multiple patches were applied to the \ac{RNG} implementation over time, such as adding a cache. The \ac{PRNG} fallback is no longer present in the most recent \emph{Broadcom} chips but \emph{Cypress} still maintains this code. \item An \ac{HRNG} is missing on the European version of the \emph{Samsung Galaxy S8} and its variants in the \emph{S8+} and \emph{Note 8}, which was sold approximately \SI{40}{million} times. \item After responsibly disclosing the issue, the firmware was patched in May 2020 in \emph{Samsung}'s \emph{Android} release as well as in \emph{iOS 13.5} for an unspecified \emph{iPhone}. \end{itemize} Flaws in the \ac{RNG} allow attacks on Bluetooth authentication and encryption mechanisms. Recently, attacks on the \ac{ECDH} key exchange and key negotiation showed how sensitive these mechanisms are~\cite{2018:biham, knob, antonioli20bias, confusion}. While these flaws were in the specification itself, \ac{RNG} issues are implementation-specific and rather opaque. We initiated responsible disclosure with \emph{Broadcom}, \emph{Cypress}, and a selection of their customers on January 12, 2020. The weak \ac{PRNG} implementation was assigned \emph{CVE-2020-blinded}\xspace. \emph{Broadcom} denied that the \ac{PRNG} fallback was used on any of their devices despite it being present in their firmware---until we found and reported that the \ac{HRNG} code and register mappings were missing on the \emph{Samsung Galaxy S8} on February 1, 2020. This paper is structured as follows: In \autoref{sec:background}, we provide background information how the \ac{RNG} is used within security-critical parts of the Bluetooth specification. We reverse-engineer 20 firmware variants in \autoref{sec:firmware} and continue with \ac{HRNG} and \ac{PRNG} measurements as well as \ac{PRNG} attacks in \autoref{sec:hardware}. We discuss further aspects in \autoref{sec:discussion}. We conclude our findings in \autoref{sec:conclusion}. \begin{figure*}[!t] \center \begin{center} \begin{tikzpicture}[minimum height=0.55cm, scale=0.8, every node/.style={scale=0.8}, node distance=0.7cm] \node[inner sep=0pt] (iphonea) at (5,0.5) {\includegraphics[height=1.5cm]{pics/nexus.pdf}}; \node[inner sep=0pt] (nexusx) at (5,0.5) {\includegraphics[height=1.3cm]{pics/nexus5.png}}; \node[inner sep=0pt] (iphone) at (16,0.5) {\includegraphics[height=1.5cm]{pics/iphone.pdf}}; \node[inner sep=0pt] (iphonex) at (16,0.5) {\includegraphics[height=1.2cm]{pics/iphone.jpg}}; \node[inner sep=0pt] (attack) at (13,0.5) {\includegraphics[height=1.5cm]{pics/sdr.pdf}}; \node[below=of iphone.south, anchor=south, yshift=0.3cm] (iphonetxt) {Device $B$}; \node[below=of iphonea.south, anchor=south, yshift=0.3cm] (iphonetxt) {Device $A$}; \node[below=of attack.south, anchor=south, yshift=0.3cm] (attacktxt) {MITM $E$}; \draw[-,gray,dashed,thick] (5,-0.8) -- (5,-10); \draw[-,gray,dashed,thick] (16,-0.8) -- (16,-10); \draw[-,darkred!30,dashed,thick] (13,-0.8) -- (13,-7.25); \node[align=right,left] at (4.5, -2.5) {Select $Na$ randomly \\ \\ Set $ra$ and $rb$ to \num{0} \\ \\ \\}; \node[align=left,right] at (16.5, -2.5) {\textcolor{darkred}{Select $Nb$ randomly} \\ \\ Set $rb$ and $ra$ to \num{0} \\ \\ Compute commitment: \\ $Cb = f1(PKbx, $\textcolor{darkred}{$PKex$}$, Nb, 0)$}; \node[align=right,left] at (13, -2.5) {\textcolor{darkred}{Guess $Nb$}}; \path[<-] (13.2,-3.5) edge node[sloped, anchor=center, above, text width=0.5cm,yshift=-0em] {$Cb$} (15.8,-3.5); \path[-,color=darkred] (13.3,-3.7) edge node[sloped, anchor=center, above, text width=0.5cm,yshift=-0em] {} (14,-3.3); \node[align=right,left] at (13, -4) {\textcolor{darkred}{Check if $Cb==f1(PKbx, PKex, Nb, 0)$} \\ \textcolor{darkred}{$Cb'=f1(PKex, PKax, Nb, 0)$ }}; \path[<-,color=darkred] (5.2,-5) edge node[sloped, anchor=left, above, text width=5cm,yshift=-0em] {\textcolor{darkred}{$Cb'$}} (12.8,-5); \path[->] (5.2,-5.75) edge node[sloped, anchor=left, above, text width=5cm,yshift=-0em] {$Na$} (12.8,-5.75); \path[-,color=darkred] (5.3,-5.95) edge node[sloped, anchor=center, above, text width=0.5cm,yshift=-0em] {} (6,-5.55); \node[align=right,left] at (13, -6.5) {\textcolor{darkred}{Choose $Na'$ s.t. $g(PKax, PKex, Na, Nb)$} \\ \textcolor{darkred}{$==g(PKex, PKbx, Na', Nb)$ }}; \path[->,color=darkred] (13.2,-6.75) edge node[sloped, anchor=center, above, text width=0.5cm,yshift=-0em] {\textcolor{darkred}{$Na'$}} (15.8,-6.75); \path[<-] (5.2,-7.5) edge node[sloped, anchor=left, above, text width=8cm,yshift=-0em] {$Nb$} (15.8,-7.5); \node[align=right,left] at (4.5, -8) {Check if \textcolor{darkred}{$Cb'$}$==f1($\textcolor{darkred}{$PKex$}$, PKax, Nb, 0)$\\ Abort if check fails!}; \node[align=right,left] at (4.5, -9) {$Va=g(PKax, $\textcolor{darkred}{$PKex$}$, Na, Nb)$}; \node[align=left,right] at (16.5, -9) {$Vb=g($\textcolor{darkred}{$PKex$}$, PKbx, $\textcolor{darkred}{$Na'$}$, Nb)$}; \draw[draw=darkblue,thick,fill=darkblue!10](5.2,-8) rectangle (15.8, -10); \node[align=left,right, text width=9.8cm] at (5.5, -9) {$Va$ and $Vb$ are 6-digit numbers displayed on both devices. The user confirms with \emph{yes} or \emph{no}. \\ \emph{Just Works} mode is the same as \emph{Numeric Comparison} but without displaying a number, thus, it does not have active MITM protection. }; \end{tikzpicture} \end{center} \caption{\emph{Numeric Comparison} protocol attack vector~\cite[p. 986]{bt52}.} \label{fig:numericcomp} \end{figure*} \subsection{Link Key Extraction via Combination Key LMP Packets} The key management of Classic Bluetooth is described in Section 2.H.3 of the specification~\cite[p. 954ff]{bt52}. Section 2.H.6 lists all algorithms in detail, including how random numbers are used within them~\cite[p. 976ff]{bt52}. Classic Bluetooth has various types of link keys. The key types explained in the following are relevant for the outlined attack. During initialization, $K_{init}$ is used. This is immediately withdrawn after creating the permanent link key, also called combination key, $K_{AB}$. $K_{AB}$ is shared between a device $A$ and another device $B$ and stored on the host. $K_{AB}$ authenticates connections between $A$ and $B$. Encryption is separated from authentication by deriving an encryption key $K_C$ for each session. Bluetooth works offline and without pre-installed certificates. Thus, the trust concept is \ac{TOFU}. If no PIN entry and no \ac{SSP} are present, a passive \ac{MITM} can intercept an initial pairing and derive the same keys. Note that \ac{SSP} can prevent passive and active \ac{MITM} attacks by adding a \ac{ECDH} key exchange. Typically, devices prevent active \ac{MITM} attacks using the \ac{SSP} numeric comparison. During numeric comparison, a 6-digit number is displayed on both devices and the user needs to actively confirm that these numbers are identical. In the following, we assume that the attacker was not present when $K_{AB}$ was established insecurely or that the attacker could not intercept $K_{AB}$ due to \ac{SSP}. However, the \ac{LMP} allows to refresh the permanent link key with the same combination key method as in the upgrade from $K_{init}$ to $K_{AB}$. In contrast to the initial pairing, this happens in the background and the user is not required to confirm authenticity. When the link key is changed, the encryption is paused and continued after completion~\cite[p. 637]{bt52}, meaning that a passive \ac{MITM} can intercept all traffic. The combination key procedure is depicted in \autoref{fig:combkey}. An attacker who intercepts $C_A$ and knows the random number $LK\_RAND_A$ can undo the $\oplus$ operation to infer the old link key $K$ and also calculate the new link key $K_{AB}$. $C_A$ is sent within the \path{LMP_COMB_KEY} \ac{PDU}~\cite[p. 625]{bt52}. Note that if the attacker has additional access to a plaintext-ciphertext pair of the previous or next link key, the attack is even possible if the randomness can only be predicted to be in a small set, as each possible key can be checked against the plaintext-ciphertext pair. According to the specification, the encryption key $K_C$ should be refreshed at least every \SI{23.3}{\hour}~\cite[p. 952]{bt52}. One of the two options to refresh the encryption keys is to update the link key $K_{AB}$ as described above. \todo{fr: What are the other methods? How common is this method used to update the Key?} Thus, even if the initial key exchange was secured by the \ac{TOFU} principle, a passive \ac{MITM} that observes a plaintext \path{LMP_COMB_KEY} \ac{PDU} and knows the current \ac{RNG} state can extract the previous and next permanent link key. This breaks the encryption and authentication of a Classic Bluetooth connection. We want to emphasize that due to this dependency on good randomness, the key update, a mechanism designed to increase the security of the Bluetooth connection, actually increases the risk of an attack, and unnecessarily so. Being able to recover the previous permanent link key during a key update means that an attacker can use the key update to decrypt data which would have been inaccessible if no further key update would have been performed. Using a \ac{KDF} on the previous permanent link key before using it to encrypt the randomness sent over the communication channel would have prevented this attack, and the overhead of a single call to a \ac{KDF} should be negligible. Further, if the key update protocol would have used a known-plaintext secure encryption function (i.e., basically anything more sophisticated than a simple XOR-encryption) to encrypt the randomness, neither the previous nor the next permanent link key would have leaked to the attacker even if they can predict the output of the \ac{RNG} perfectly.
\subsection{\ensuremath{\ALCQ^\smallplus}\xspace, single role, UCQ} As usual, we will show that existence of a counter-example is equivalent to existence of a special tree. \subsubsection{From finite counter-example to tree} Lets start with finite interpretation \I. We will proceed with a variant of a standard unravelling. We will assume that every vertex in partially constructed tree \T is labelled by a path of elements of \I. Moreover each vertex will have exactly the same concepts as the last element of its path. Two vertices are connected if path of the source is the path of the target without the last element. Consider a vertex $v\in \T$ such that $v$ does not have all required witnesses in \T . From the path $p_v$ labelling $v$ we extract the last element $a_v\in \I$. We will construct witnesses for $v$ from witnesses for $a_v$. Let $b$ be a witness for $a_v$. It is reachable form $a_v$ by some path $p_b$ (possibly just element $b$). For every nonempty prefix $p'\preceq p_b$ we add a new vertex to the tree \T labelled by path $p_v\cdot p'$ with the same concepts as the last element in $p'$. The construction above obviously guarantees that all at-least requirements are satisfied. We have to check whether the at most restrictions are satisfied. Consider a vertex $v\in \T$ and let $a_v$ be the last element in the label of $v$. By construction $v$ has the same concepts as $a_v$ and successors of $v$ map injectivelly into successors of $a_v$. Therefore any at-most restriction for $v$ cannot be violated, since any such restriction was not violated for $a_v$. There is a natural homomorphism from \T into \I , so no query not satisfied it \I can be satisfied in \T . \subsubsection{From trees to finite couter-exaples} Folding tree into finite structure will be a bit more complicated than in the case \ensuremath{\ALCI^\smallplus}\xspace due to long at-least restrictions. For each concept $A$ we will introduce finite number of {\em shades} such that \begin{itemize} \item every vertex with concept $A$ will get exactly one shade of $A$ as a new concept \item if a vertex has a restriction $\geq ^nr^+.A$ then among its descendants there are $n$ different shades of $A$ \end{itemize} This will be done inductively in a greedy fashion. We will keep the following invariant: In the tree rooted in an unprocessed vertex each shade of each concept $A$ is used at most once. In a tree without any concept shades the invariant is trivially satisfied. Take a n unprocessed vertex $v$ closest to the root. Suppose $v$ has a restriction of the form $\geq ^nr^+.A$. If at least $n$ of its descendants have assigned shades of $A$, then we proceed. Otherwise use some unused shades to color descendants of $v$. Notice, that we will never have to use more shades that the highest number used in the T-box. For each concept (including shades) $C$ add a new concept $C_{\exists r\trans. C}$ axiomatizated by two inclusions: $C_{\exists r\trans. C} \sqsubseteq \exists r\trans. C$ and $\overline{C_{\exists r\trans. C}} \sqsubseteq \forall r\trans. \bar C$. Finally, we add colours for coloured blocking principle. Now consider a level $l$ in this tree such that all neighborings large enough for coloured blocking principle realized in the model are present above this level. For all nodes above level $l$ and each applicable concept choose any witness. Preserve this witnesses and paths to them; fold the rest of the tree, redirecting the edges above level $l$. The only nontrivial thing to check at this point is whether long at-least restrictions are satisfied. But that follows from the observations that each element satisfies its long existential restrictions for shades of concepts. \subsubsection{Complexity} Existence of appropriate tree will be checked by automaton. The information needed for automaton contains: \begin{itemize} \item unary type of a vertex \item for each $A\in CN(\ensuremath{{\cal{K}}}\xspace)$, the minimum number of elements with concept $A$ in a given subtree \item for each $A\in CN(\ensuremath{{\cal{K}}}\xspace)$, an indicator whether we made progress looking for elements in concept $A$. \end{itemize} All together the size of automaton is equal to $(2\cdot 2 \cdot t)^{|CN(\ensuremath{{\cal{K}}}\xspace)|}$. As usual, we take the product of above automaton with automaton recognizing the query. \subsubsection{Concepts for the query} Assume that there are no inverse roles in the atoms of $Q$; that is, replace each $r^-(x, y)$ with $r(y, x)$ and each $(r^-)\refltrans(x, y)$ with $r\refltrans(y, x)$.\nb{In this section I use reflexive transitive closure.} Consider an \ensuremath{\ALCOI^\smallplus}\xspace-tree. The idea is to enrich the interpretation with concepts $C_{P, W}$ for $P$ being a \ensuremath{\CQ^\smallplus}\xspace from some class of queries and $W$ being a nonempty subset of $\textit{var}(P)$. Such a concept will be present in all elements $x$ for which there exists a match for $P$ such that all variables from $W$ are mapped to $x$ and the whole match is contained in the subtree of $\mn{Bag}(x)$ (that is, all variables are mapped to elements in this subtree and all witnessing paths are in this subtree). Then we will also introduce a concept $C_P$ present in the elements in which any $C_{P, W}$ is true. We want to do it in a way possible to verify by the procedure above: that is, the new concepts will be axiomatized by concept inclusions and by forbidding some patterns in a bag (by a \ensuremath{\UCQ^\smallplus}\xspace). \begin{definition} We say that a \ensuremath{\CQ^\smallplus}\xspace $Q$ is \emph{connected} if for any two variables $x, y \in \textit{var}(Q)$ there is a sequence of variables $a_1, a_2, \dots, a_n$ such that $a_1 = x$, $a_n = y$ and for each pair of subsequent variables $a_i, a_{i+1}$ there is a role name $r$ such that one of the following atoms is in $Q$: $r(a_i, a_{i+1})$, $r(a_{i+1}, a_i)$, $r\refltrans(a_i, a_{i+1})$ or $r\refltrans(a_{i+1}, a_i)$. \end{definition} Reduce the entailment problem for arbitrary \ensuremath{\UCQ^\smallplus}\xspace to the problem for a single, connected \ensuremath{\CQ^\smallplus}\xspace. Assume that $Q$ is a \ensuremath{\UCQ^\smallplus}\xspace and $Q = Q_1 \lor Q_2 \lor \dots \lor Q_n$, where each $Q_i$ is a \ensuremath{\CQ^\smallplus}\xspace. First, we will show that we can assume that each $Q_i$ is connected. Take any $Q_i$ and let $P_1, P_2, \dots, P_m$ be its connected components. Choose one connected component for each $Q_i$ and ask for the query entailment of the disjunction of the chosen connected components; if for any choice of connected components the query is not entailed, then the whole query $Q$ is not entailed (with the same counter-model). On the other hand, if $Q$ is not entailed, there exists a counter-model, and there is a choice of the connected components of each $Q_i$ which do not have a match in this counter-model. Now, the reduction from a disjunction of connected queries to a single \ensuremath{\CQ^\smallplus}\xspace: assume we have already defined concepts $C_{Q_i}$ for each $Q_i$. We can forbid some patterns inside a bag. Thus, we can forbid a CQ $C_{Q_i}(x) \land \overline{C_Q}(x)$ for each $Q_i$ (and a fresh variable $x$) in every bag, thus assuring that if any element of the interpretation has concept $C_{Q_i}$ for any $i$, it also has concept $C_Q$. Now we can assume that $Q$ is a single, connected \ensuremath{\CQ^\smallplus}\xspace. We will define a class $C$ of queries (\ensuremath{\CQ^\smallplus}\xspace) for which the above concepts will be defined. The description of the class $C$ is quite simple: first, replace each transitive atom $r\refltrans(x, y)$ in $Q$ with $r\refltrans(x, z) \land r\refltrans(z, y)$ for a fresh variable $z$ (we distinguish one node on each witnessing path; the intended meaning is that the distinguished node is some element of the highest bag through which the witnessing path passes). We will call each such variable $z$ a \emph{distinguished variable}. Note that each transitive atom has exactly one endpoint being a distinguished variable. The class $C$ consists of all subqueries of $Q$ (including itself). Now we want to axiomatize concepts for a query $P \in C$ and $W \subseteq \textit{var}(P)$. Recall that the concept $C_{P, W}$ is supposed to be satisfied in an element $x$ if that there is a match of $P$ contained in the subtree of $\mn{Bag}(x)$, mapping all variables from $W$ to $x$. We will define the axiomatization and prove this implication at the same time. The left column of the table below corresponds to the proof, and the right one to the axiomatization of $C_{P, W}$. We will look at a match for the query as a graph consisting of all witnessing paths and edges required by the query. \begin{center} \begin{tabular}{ m{2in} | m{1.3in} } Assume there is a match $M$ for $P$. Let $v$ be the highest (closest to the root) bag with nonempty intersection with the match. Note that any witnessing path has the image of a distinguished variable as one of its endpoints. For all witnessing paths passing through $v$, if the distinguished endpoint is not mapped to an element of $v$, let us remap it to some element of $v$ on the path (as each distinguished variable occurs only in two atoms, it is easy to see that the match is still correct). Let $V$ be the set of elements of $v$ to which any variable is mapped. & Consider all possible subsets of variables $V' \subseteq \textit{var}(P)$. \\ \hline For any witnessing path with one endpoint inside $V$ and the other outside $V$ (thus, outside of the bag $v$), mark the last element of $v$ on this path (that is, for a witnessing path beginning in $x \in V$, consider its longest prefix that is contained in the bag $v$ and mark the last element of this prefix). Add all marked elements to $V$. & For any transitive atom $r\trans(x, y)$ with one endpoint inside $V'$ and the other outside, take a fresh variable $z$ and replace the atom with $r\trans(x, z) \land r\trans(z, y)$. Add $z$ to $V'$. \\ \hline & Guess which variables are mapped to the same element (i.e. consider all possible contractions; we will discard some of them). Let $R$ be such a ``contracted'' query.\\ \hline Let $M_{in}$ be the match $M$ restricted to $V$ (viewed as graphs, $M_{in}$ is the subgraph induced by $V$). Note that $M_{in}$ is connected. Let $M_{out}$ be $M$ without the edges from $M_{in}$. & Consider $R$ restricted to $V'$ (call it $R_{in}$) and the rest of the query $R_{out}$. If $R_{in}$ is not connected, discard the query $R$. \comment{(maybe we don't need this?)} \\ \hline Let $M_x$ denote a connected component of $x$ in $M_{out}$. Consider any two different elements $x, y \in V$. Note that $M_x$ and $M_y$ are disjoint (their elements, apart from $x$ and $y$, are in different subtrees and there are no witnessing paths between them, as they would pass through $v$, and we made sure that all such paths are split by the distinguished variables). & For each variable $x \in V'$, let $R_x$ be the query $R_{out}$ restricted to the connected component of $x$. If for any distinct $x, y \in V'$, $R_x$ and $R_y$ are not disjoint, discard the query R. \\ \hline Now consider $M'_x$ as $M_x$ with $x$ removed. $M'_x$ might consist of several connected components. Each component is contained in the subtree of some child of $v$, connected directly to $x$. Thus, all witnessing paths from $x$ to this connected component must pass through the entrance node of this child. & Let $R'_x$ be $R_x$ with $x$ (and all atoms involving it) removed. $R'_x$ might consist of several connected components. Let $X$ be one such component. All atoms in $R_x$ involving $x$ and one of the variables from $X$ must concern the same role; if this is not the case, discard $R$. \end{tabular} \end{center} It should be clear that each match $M$ has a corresponding ``contracted'' query $R$ which captures the structure of $M$ in the bag $v$. For each query $R$ that was not discarded, we will create auxiliary concepts $C_{R,x}$ for $x \in \textit{var}(R)$, intended to capture the corresponding matches $M$. Now we will describe these concepts. Recall that $R = R_{in} \land R_{out}$, as described above. The match for the part $R_{in}$ has to be contained inside one bag. As for $R_{out}$, for each variable $x$ from $\textit{var}(R)$, consider each connected component $X$ of $R'_x$. Let $N(x)$ be the set of all variables $y \in \textit{var}(X)$ such that there is a non-transitive role atom in $R_x$ involving $x$ and $y$. Furthermore, for each transitive atom involving $x$ and a variable from $X$, let $z$ be the distinguished variable corresponding to that atom \todo{describe the correspondence; the atom was probably created by splitting some transitive atom from $P$, and it had a distinguished variable as one endpoint} (think of $z$ as a fresh variable); add this atom to $X$, but with $z$ instead of $x$. Let $D(x)$ be the set of all such distinguished variables. Then the query for the connected component $X$ is $C_{X, N(x) \cup D(x)}$ (and it is intended to be present in the entrance node of the appropriate child bag of $v$). It is easy to see that $X$ constructed this way is in the class $C$. \comment{The distinguished variables magic probably requires some comment; we do it just to assure that the resulting query is in our class (we could introduce a fresh variable for the entrance node and then show that the resulting query is isomorphic to some query from the class, but it is exactly the query above).} Thus, to deal with $R_{out}$ we just need to assure that if an element is connected to children bags with appropriate $C_{X, N(x) \cup D(x)}$ concepts in the entrance node, it has a concept denoting it. This can be done by introducing some auxiliary concepts and simple universal CIs speaking about the complementary concepts (or just hardcoded into the local correctness conditions in the procedure above, specifically into legal children types). This allows us to rewrite $R$ as $R_{in}$ with some additional concept atoms. To deal with the whole query $R$, for each $x \in \textit{var}(R)$, we forbid the pattern $R \land \overline{C_{R, x}}(x)$ (note that this is an auxiliary concept, used only inside one bag; it does not need to belong to the class $C$; we also do not consider sets of variables mapped to $x$, as in $R$ the variables are already contracted). Finally, if $R_1, R_2, \dots, R_k$ are the contracted queries which were not discarded, the target concept $C_{P, W}$ is a disjunction of all $C_{R_i, x}$ such that the variable $x$ in $R_i$ was constructed by gluing the set $W$, possibly along with some fresh variables not present in $R$. And, again, this disjuntion is realized as a forbidden pattern: $C_{R_i, x}(y) \land \overline{C_{P, W}}(y)$ for a fresh variable $y$. We need to also show that if there is any counter-model, there exists its conservative extension with an empty interpretation of $C_Q$. This is straightforward: just let $C_{P, W}$ be true in an element $x$ iff there is a match of $P$ with all variables from $W$ being matched to $x$ (and $C_P$ be true if any of $C_{P, W}$ is true). As it was a counter-model, $C_Q$ will not be satisfied, and if some part of axiomatization of $C_{P, W}$ is violated in some element $x$ (i.e. some of the forbidden patterns are violated -- note that without them all concepts $C_{P, W}$ might as well be interpreted as the whole domain), it is straightforward to construct a match for $P$ with all variables from $W$ being matched to $x$. \subsection{Folding back the model} \begin{definition} An interpretation is \emph{$\ell$-bounded} if each simple directed path has length at most $\ell$. \end{definition} Having the concept $C_Q$, we can add to all considered KBs a CI $C_Q \sqsubseteq \bot$. Then the procedure decides whether there exists a strong counter-example. If it exists, there is a regular witness $(\Imc, T)$ with $T$ having bounded degree $d$ and a bound $m$ on the length of a simple directed path. Because the tree $T$ is regular, $\Imc$ also has bounded degree and is $\ell$-bounded for some $\ell$ (there are finitely many non-isomorphic subinterpretations in the tree partition $T$ and all of them are finite). Assume that $\Imc$ is infinite (otherwise there is no need to fold back). Let $Q\refltrans$ be obtained from $Q$ by replacing each transitive atom $r\refltrans(x, y)$ with a disjunction: \[ \bigvee_{i\leq \ell} r^i(x, y), \] where $r^i(x, y)$ expresses existence of an $r$-path of length $i$ from $x$ to $y$ (i.e. for $i=0$ it states that $x = y$; for $i = 1$ it is $r(x, y)$, and for $i > 1$ it is $r(x, z_1) \land r(z_1, z_2) \land \dots \land r(z_{i-1}, y)$ for fresh variables $z_1, \dots, z_{i-1}$). Rewrite $Q\refltrans$ as a UCQ (in the disjunct for $i = 0$, all occurences of the variable $y$ are replaced with $x$). Let $k$ be a bound on the number of binary atoms in one CQ in $Q\refltrans$. \begin{lemma} For all $\ell$-bounded interpretations $\Jmc$, $\Jmc \models Q$ iff $\Jmc \models Q\refltrans$. \end{lemma} For any $n$, let $\Imc_n$ be any $n$-proper colouring of $\Imc$. \todo{write the definition of $n$-proper colourings} Fix $n = \max(\ell^2, k^2)$. \todo{verify the bounds} On each infinite branch $\pi$ of $T$, consider the set of nodes (bags) $V_\pi$ on $\pi$ such that $v \in V_\pi$ if the role of $v$ if $r$, but the role of its parent is $r^-$ (there are infinitely many such bags, because lengths of simple directed paths in $T$ are bounded and $\pi$ is infinite). Let $D_\pi \in V_\pi$ be the first node for which there exists an earlier node $E_\pi \in V_\pi$ such that $N^{{\cal{I}}_n}_n(d_\pi)\simeq N^{{\cal{I}}_n}_n(e_\pi)$, where $d_\pi \in D_\pi$ and $e_\pi\in E_\pi$ are entrance nodes. An interpretation ${\cal{F}}_n$ is obtained by including the branch $\pi$ up to the predecessor of $D_\pi$ and the edge originally leading to $d_\pi$ is redirected to $e_\pi$. \begin{lemma} After any number of redirections, there are no paths of lengths greater than $\ell$. \end{lemma} \begin{proof} There can be no directed path passing through more than one redirected edge -- each edge is redirected to a bag over role $r$, and at all times all edges leaving this bag are by $r^-$. For a single redirect, for any path passing through the redirected edge, a corresponding path of the same length can be easily found in the model before the redirection. \end{proof} \begin{lemma} ${\cal{F}}_n \models {\cal{K}}$. \end{lemma} \begin{proof} We need to be sure that there is no $r$-path from $e_\pi$ to $d_\pi$ (otherwise the KB could be violated, as $e_\pi$ might require some witness below $d_\pi$). This is guaranteed by taking neighbourhoods of size larger than $l$ (bound on the length of a simple directed path). \end{proof} By the coloured blocking principle, ${\cal{F}}_n \not\models Q\refltrans$, and as it is $\ell$-bounded, ${\cal{F}}_n \not\models Q$. Thus, there exists a finite counter-model. \subsection{Finding a strong counter-example} First we will assume some additional properties of the strong counter-example that we will look for. \begin{lemma} If there is any strong counter-example, there is also one with the following property: for every element $x$, in the subtree of $\mn{Bag}(x)$ there are all witnesses required for $x$ by existential CIs in the TBox of ${\cal{K}}$. \end{lemma} \begin{proof} (sketch) For any element $x$ we can duplicate the subtree of $\mn{Bag}(x)$ (there is an obvious homomorphism, so nothing changes wrt. KB and query). We can also root the tree in another bag, duplicate some subtree and restore the original root. Thus, if the required witnesses are not in the subtree, we can just duplicate whole interpretation apart from the subtree and add the copy as a fresh child. \end{proof} \begin{definition} A \emph{bag type} of a non-root bag $v$ of an SCC-partition is the following triple: \begin{itemize} \item the role $r_v$ on the label of the incoming edge in the tree (this is either $r$ or $r^-$, where $r$ is the unique role used by ${\cal{K}}$); \item the unary type $\tau_v$ of its entrance node $e_v$; \item the set $\mn{Reach}$ of concept names reachable from $e_v$ by $r_v$ (in the subtree of $v$ -- this is implicit, because the only edge pointing upwards the tree is by role $r_v^-$). \end{itemize} \end{definition} \begin{lemma} If there is any strong counter-example $(\Imc, T)$, there is also one with the following property: for any element $x \in \Delta^\Imc$, bag types of children of $\mn{Bag}(x)$ such that there is an edge from $x$ to the entrance node of this bag are distinct. \todo{state it more clearly} \end{lemma} \begin{proof} If there are two children of $\mn{Bag}(x)$ with the same bag type and with edges from $x$ to the entrance nodes of both of them, one of these edges (and one of the children, along with its whole subtree) can be removed. Removing some elements cannot make the query satisfied; and as the bag type contains information about the unary type of the entrance node and all concepts reachable from it by the role of the incoming edge, all the witnesses required by CIs in subtree of one of the children can be found also in the subtree of the other one. \end{proof} Consider some strong counter-example $(\Imc, T)$ and any bag $v$ from $T$. One can look at the subtree rooted in $v$ (and the corresponding subinterpretation of $\Imc$, along with the nominals) as a strong counter-example for the same query and different KB, with ABox containing only one individual with fully specified unary type (corresponding to the entrance node of $v$) and the same TBox as ${\cal{K}}$. The intermediate goal is to develop a procedure calculating the set of bag types for which such a strong counter-example exists. At the end we want to reduce this problem to the existence of an interpretation corresponding to a single bag, assuring some simple local conditions between the bag and its children. We will describe the procedure determining existence of a strong counter-example by describing simpler procedures and gradually getting nearer the goal. Begin with assuming that the query is trivial; thus, we want to find any safe model of ${\cal{K}}$. The strategy is to search for an appropriate \ensuremath{\ALCOI^\smallplus}\xspace-tree (we will still call it a strong counter-example, even though the query is trivial). Let $\tau = (r, \sigma, R)$\vic{THis notation needs to be introduced} be a bag type and $T$ be a set of bag types. The situation we consider is a bag of type $\tau$ with children of types from the set $T$ (the types of children can repeat and not all types from $T$ has to be used). We want to define some \emph{local correctness conditions} that must be satisfied in such a situation (essentially: existence of a model of a single bag; but as some witnesses required by the TBox might be present in the subtrees of its children, it depends on the bag types of children). Namely, we will construct an \ensuremath{\ALCOI^\smallplus}\xspace-knowledge base ${\cal{K}}_{\tau, T}$ and a non-transitive UCQ $Q_\tau$ such that if ${\cal{K}}_{\tau, T} \models_{\mathsf{fin}} Q_\tau$, there is no strong counter-example in which the considered situation occurs (i.e. there is a bag of type $\tau$ with children of types from $T$). We will first construct an auxiliary knowledge base ${\cal{K}}_\tau$, independent of $T$. Begin with the copy of the TBox of ${\cal{K}}$ restricted to the role $r$. For every concept $B$ add fresh concepts $B_{in}, B_{out}, B_{exit}, B_{any}$ and the following CIs: \begin{itemize} \item $B_{in} \sqsubseteq \exists r\trans. B$, \item $B_{out} \sqsubseteq \exists r\trans. B_{exit}$, \item $B_{any} \sqsubseteq B_{in} \sqcup B_{out} \sqcup B_{exit}$, \end{itemize} and replace every CI of the form $A \sqsubseteq \exists r\trans. B$ by a CI $A \sqsubseteq B_{any}$. The concepts $B_{in}$ are supposed to be satisfied in the elements that can reach concept $B$ inside the bag; $B_{exit}$ -- in the elements from which there exists an $r$-edge going to some child bag with reachable concept $B$; $B_{out}$ -- the ones that can reach $B$ outside the bag through $B_{exit}$; $B_{any}$ -- any of the above. Finally, set the ABox of ${\cal{K}}_\tau$ to $\{A(b) \mid A \in \sigma\} \cup \{A_{any}(b) \mid A \in R \}$ (recall that $R$ is the third component of the bag type $\tau$ -- the set of concepts reachable from the entrance node by $r$). Now construct ${\cal{K}}_{\tau, T}$. Begin with a copy of the ABox and all non-existential CIs of ${\cal{K}}_\tau$. We need to know which existential CIs need to be satisfied inside the bag, and which ones will have witnesses in the children (or their subtrees). To deal with this, we will assume that each element $x$ of the resulting model has edges to all possible bag types from $T$, as long as this does not invalidate the knowledge base. Checking whether adding an edge to the model invalidates the knowledge base requires just looking at the unary types of its endpoints. As a result, for each unary type $\sigma$ in ${\cal{K}}_\tau$ we can easily calculate the set of its \emph{legal children types}: the bag types for which the edge from an element with unary type $\sigma$ to the entrance node of such a bag type does not invalidate the knowledge base. Add to ${\cal{K}}_{\tau, T}$ a fresh concept $A_\sigma$ for each unary type $\sigma$ in ${\cal{K}}_\tau$, with the natural axiomatization. For each such unary type $\sigma$ and each existential CI $C$ of the form $A \sqsubseteq \exists r. B$ from ${\cal{K}}_{\tau}$ (where $A \in \sigma$), check whether $C$ is witnessed in any of its legal children types (i.e. if the unary type of its entrance node contains $B$). If not, add to ${\cal{K}}_{\tau, T}$ a new CI $A_\sigma \sqsubseteq \exists r. B$. Similarly add all transitive existential CIs not witnessed in the legal children types (i.e. if no legal children bag type has an appropriate concept in the set $\mn{Reach}$ of reachable concepts). Additionally, there are two cases in which the unary type $\sigma$ becomes forbidden. If $\sigma$ contains a concept $B_{exit}$ for some $B$, check whether any of its legal children types by role $r$ has $B$ in the set of reachable nodes; if not, this unary type is forbidden. Also, for the existential CIs involving roles other than $r$, if there is at least one of them which is not witnessed by the legal children types, $\sigma$ is forbidden. Forbidding a type means that we add to $Q_\tau$ a simple CQ $\bigwedge_{A \in \sigma} A(x)$ for a fresh variable $x$.\nb{This can be either in the query or we can use the finite entailment modulo types; I'm not sure how it influences the complexity.} \subsubsection{The procedure}\vic{What are the realizability/compatibility conditions to decide when to eliminate a type} The algorithm will be a variant of type elimination \cite{Pratt79,abs-1202-0914}.\textcolor{green}{(?)} Begin with the set of all possible bag types $T_0 = \mn{rol}({\cal{K}}) \times \mn{Tp}({\cal{K}}) \times {\cal{P}}(\mn{Tp}({\cal{K}}))$. For $T \subseteq T_0$ let $F(T)$ be the set of types $\tau \in T$ such that there exists a finite model of ${\cal{K}}_{\tau, T}$. Note that $F$ is a monotone operator on subsets of $T_0$. Consequently, $F$ has the greatest fixed point and it can be obtained by iterating $F$ on $T_0$: \[T_0 \supseteq F(T_0) \supseteq F^2(T_0) \supseteq \dots \supseteq F^i (T_0) = F^{i+1} (T_0) \] for some $i\leq |T_0|$. Let $T = F^{i}(T_0)$. Removal of some bag type $\tau$ during this procedure witnesses that if an \ensuremath{\ALCOI^\smallplus}\xspace-tree contains a bag $v$ of such type, if we consider the subtree of $v$ as an \ensuremath{\ALCOI^\smallplus}\xspace-tree of bag type $\tau$, it has to violate some local correctness conditions and therefore the whole \ensuremath{\ALCOI^\smallplus}\xspace-tree cannot model ${\cal{K}}$. Now we want to check whether there exists an interpretation corresponding to the root bag, realizing the ABox of ${\cal{K}}$ with children bag types from $T$. For this, simply check the local conditions as in the case of ${\cal{K}}_{\tau, T}$, but this time copy the ABox from ${\cal{K}}$. If the above procedure is successful, there is an \ensuremath{\ALCOI^\smallplus}\xspace-tree with root bag realizing the ABox of ${\cal{K}}$. However, it might not be safe, and therefore might not even model ${\cal{K}}$ (the transitive existential CIs might not be satisfied -- each bag type on some infinite path may have some concept in its set of reachable concepts, but it might never be actually reached). Assuring safety requires the following modification of the above procedure. Instead of adding each bag separately, we will add whole (finite) connected components by one role at once and assure that we add such components for alternating roles. By a connected component by role $r$ we mean all bags reachable by role $r$ (\emph{not} by role $r^-$) from a given bag $v$, where the role of $v$ is $r$ and the role of parent of $v$ is different than $r$. Once again, we are interested in local correctness conditions for such a connected component. More precisely, now we are given a role $r$ and a set of bag types $S$ by roles different than $r$ (possibly $r^-$) and we consider a finite connected component of bags by role $r$ such that all edges leaving this component lead to bags of types from $S$. This component, of course, is a tree. We want to first calculate the set of bag types that could be the leaves of such a tree (without violating the local correctness conditions), and then, inductively, other realizable bags. Begin with an empty set of bag types $T_0 = \emptyset$ -- allowed types of children by role $r$. For \[ T \subseteq \{r\} \times \mn{Tp}({\cal{K}}) \times {\cal{P}}(\mn{Tp}({\cal{K}})) \] and \[ S \subseteq (\mn{rol}({\cal{K}})\setminus\{r\}) \times \mn{Tp}({\cal{K}}) \times {\cal{P}}(\mn{Tp}({\cal{K}})) \] let $F_S(T)$ be the set of bag types $\tau \in T$ such that there exists a finite model of ${\cal{K}}_{\tau, T\cup S}$. As $F$ is a monotone operator on sets of bag types with role $r$, it has the lowest fixed point and it can be obtained by iterating $F_S$ on an empty set. The whole procedure for deciding existence of a strong counter-example (for a trivial query) works as follows. Begin with the set $T_0$ of all bag types. Let $T[r]$ denote the set of all elements of $T$ (bag types) with the first coordinate (role) equal to $r$. Let $F_r(T)$ be the set of types $\tau \in T[r]$ realizable by a finite connected component by role $r$ in ${\cal{K}}_{\tau, T \setminus T[r]}$. Take any order of the roles and apply each $F_r$ to the set under construction $T$. Repeat this procedure until $T$ stabilizes (it must happen, as each $F_r$ is monotone). Take the resulting set of types $T$ and check, as before, whether the root bag realizing ABox of ${\cal{K}}$ has a model satisfying the local correctness conditions with children bag types from $T$. \subsubsection{Correctness and regularity} It is easy to see that, if there exists any strong counter-example, its tree of bag types is a witness that the procedure will be successful. Assuming the contrary, if $S$ is the set of all bag types occuring in this tree, consider the first moment when any $\tau \in S$ would be removed from the set $T$ of the types considered by the procedure. It must mean that for some set $T \supseteq S$, the type $\tau$ is not realizable by any finite connected component by role $r$ in ${\cal{K}}_{\tau, T \setminus T[r]}$, where $r$ is the role of $\tau$. However, $\tau$ is a part of some finite connected component in the strong counter-example. By considering all bag types in this connected component, bottom-up, one can easily check that the procedure will not remove $\tau$ from the set of considered bag types. For the other direction: if the above procedure is successful, it essentially calculates a regular infinite tree of bag types, such that there exists an interpretation for each of these bags which is locally correct. For each bag type $\tau$ and each set of bag types $T$ such that in this tree there is a bag type $\tau$ with children of types $T$, fix some model $\Imc_{\tau, T}$ of ${\cal{K}}_{\tau, T}$. Fix also any model of the KB for the root bag. \todo{Define it earlier properly and name it somehow?} Let $\Imc$ be the interpretation consisting of all chosen interpretations for single bags (with all instances of nominals merged), along with the edges between elements of parent bags and entrance nodes of their children (according to the assumptions inside the procedure: if an edge from $x$ to some bag type does not invalidate the knowledge base, add an edge from $x$ to one of the children with this bag type). $\Imc$ is a model of ${\cal{K}}$: all universal CIs are satisfied inside the bags and, by the construction of the edges between the bags, cannot be violated by them. The existential CIs are either satisfied inside bags, or are guaranteed to be satisfied in a subtree of one of the children; for the transitive ones it can be proved by a simple induction in one connected component. \subsubsection{Bounded degree} There are finitely many interpretations $\Imc_{\tau, T}$ of single bags that we used to construct $\Imc$. If $k$ is the size of the biggest of them and $l$ is the number of possible bag types, the degree of the tree is bounded by $kl$ (and $l \leq |{\cal{K}}|\cdot 2^{|{\cal{K}}|} \cdot 2^{|{\cal{K}}|}$). \subsubsection{Non-trivial queries} For non-trivial queries only some details of the procedure change. We will extend the knowledge base with some concepts related to the query; in particular, we will add a concept $C_Q$ such that, if there is any match for concept $Q$, the interpretation of $C_Q$ will not be empty. To assure this, apart from the standard CIs, we will need to forbid some patterns inside the bags. This will be handled by adding these patterns to all the queries $Q_\tau$ used when verifying local correctness conditions for a single bag and its children bag types. \section{Eliminating multiple roles}~\label{sec:app:mulroles} \subsection{Unravelling} Let $\Imc$ be a finite counter-model. Let $\Imc_r$ for $r \in \mn{rol}({\cal{K}})$ be a projection of $\Imc$ to the signature containing only one role name $r$. We construct a tree-like model $\Jmc$. We will maintain a homomorphism $h: \Delta^\Jmc \to \Delta^\Imc$ -- each element will be added to $\Jmc$ as a copy of some element of $\Imc$. Choose any role $r \in \mn{rol}({\cal{K}})$; the root bag is a copy of $\Imc_r$, identifying the individual with its copy. Then, recursively, for each added element $x$ proceed as follows: let $r$ be the role name of the bag in which $x$ was created; for each role name $s \in \mn{rol}({\cal{K}})\setminus \{r\}$, add a fresh copy of $\Imc_s$ as a child bag, identifying $x$ with its fresh copy in $\Imc_s$. Repeat the procedure for each created element. $\Jmc \models {\cal{K}}$, as the ABox is satisfied by the root bag and each CI from the TBox concerns only one role. The homomorphism $h$ from $\Jmc$ to $\Imc$ witnesses that \Jmc does not satisfy $Q$. \subsection{Proof of Lemma~\ref{lem:multirolesconsistent}} \subsubsection{The correct $Q$-labelling is consistent.} Assume the contrary: that a labelling ${\cal{I}}'$ is correct and inconsistent. Inconsistency means that for some bag there exists a subquery $p'$ of $Q$, its partition $p, p_1, p_2, \dots, p_k$ with $\textit{var}(p_i)\cap\textit{var}(p_j) = \emptyset$ for all $i \neq j$, $V_i = \textit{var}(p_i)\cap\textit{var}(p)$, $\emptyset \neq V \subseteq \textit{var}(p)$, and a match $\eta$ for $p$ in the bag, such that $\eta(V_i) = \{e_i\} \subseteq A_{p_i, V_i}^{{\cal{I}}'}$ for all $i$, but $\eta(V) \subseteq \{e\} \not\subseteq A_{p', V}^{{\cal{I}}'}$. As each $e_i \in A_{p_i, V_i}^{{\cal{I}}'}$, there is a match $\eta_i$ witnessing this, with $\eta_i(V_i) = \{e_i\}$. The matchings $\eta, \eta_1, \eta_2, \dots, \eta_k$ are consistent with each other (i.e. each variable of $p'$ is mapped to the same element in all matchings in which it occurs), so they can be combined into a match $\eta'$ for $p'$ in ${\cal{I}}'$ (i.e. $\eta' = \eta \cup \bigcup_{i=1}^k \eta_i$) such that $\eta'(V) = \eta(V) \subseteq \{e\}$, thus contradicting the correctness of ${\cal{I}}'$. \subsubsection{If ${\cal{I}}$ admits a consistent $Q$-refutation, then the correct $Q$-labelling of ${\cal{I}}$ is a $Q$-refutation.} We will show that if a $Q$-labelling ${\cal{I}}'$ is consistent and $e \notin A_{p, V}^{{\cal{I}}'}$, then in the correct $Q$-labelling ${\cal{I}}''$ also $e \notin A_{p, V}^{{\cal{I}}''}$. Assume the contrary: that ${\cal{I}}'$ is a consistent $Q$-labelling, but for some connected fragment $p'$ of $Q$, some $\emptyset \neq V \subseteq \textit{var}(p')$, there exists an element $e$ of ${\cal{I}}'$ such that $e \notin A_{p', V}^{{\cal{I}}'}$, even though there exists a match $\eta$ for $p'$ in ${\cal{I}}'$ such that $\eta(V) \subseteq \{e\}$. From all values of $p', V$ and $e$ for which this happens, choose ones where $p'$ is minimal. Fix a corresponding match $\eta$ for $p'$. The image of $\eta$ is not contained inside one bag: assuming it is, for a trivial partition of $p'$ into one part $p$, the consistency condition is clearly violated in this bag -- there exists a match for $p$ in the bag, but $\eta(V) \subseteq \{e\} \not\subseteq A_{p',V}^{{\cal{I}}'}$. Notice that for any binary atom from $p'$, $r(x, y), r^*(x, y)$ or $x = y$, there is a bag to which both $\eta(x)$ and $\eta(y)$ belong; for $r(x, y)$ and $x = y$ this is trivial, and for $r^*(x, y)$ this is true because any two neighbouring bags (i.e. sharing an element) have edges over different roles. Take any atom from $p'$ mentioning any element of $V$. Take a bag containing the image of variables mentioned by this atom under $\eta$ (i.e. if it mentions just one variable $x$, take any bag containing $\eta(x)$; if it mentions two variables $x, y$, take any bag containing $\eta(x)$ and $\eta(y)$). We claim that the compatibility condition in this bag is violated. Let $p$ be a maximal connected subquery of $p'$ such that $e \in \eta(\textit{var}(p))$ and $\eta(\textit{var}(p))$ is contained in the chosen bag. It is easy to see that $p' \setminus p$ seen as a set of connected components $p_1, \dots, p_k$ satisfies the required conditions: the components have disjoint variables by definition; by the definition of the tree structure of the bags (specifically, by condition (1): two bags share a single element if they are neighbours and are disjoint if they are not neighbours), $\eta(\textit{var}(p_i)\cap\textit{var}(p)) = \{e_i\}$ for some $e_i$; and by minimality of $p'$, $e_i \subseteq A_{p_i,V_i}^{{\cal{I}}'}$. \subsection{Proof of Fact~\ref{fact:emptiness}} Let $\mathsf{step}_{\cal{B}}(X) = \left \{ q \in S \bigm | (X,q) \in \mathsf{step}_{\cal{B}}\right\}$. Consider the mapping $G(X) = X \cup \mathsf{step}_{\cal{B}}(X) $. Because $G$ is monotone and inflationary, for each $P$ it has the least fixed point $\mathsf{step}^*_{\cal{B}}(P) $ that contains $P$, and the fixed point can be computed by iterating $G$ over $P$. It is straightforward to see that $\mathsf{step}^*_{\cal{B}}(P)$ is the set of states $q$ such that there exists a \emph{finite} partial run of $A$, whose leaves are labelled with elements of $P$ and the root is labelled with $q$. Consider now the mapping $H(X) = \mathsf{step}^*_{\cal{B}}(X \cap F)$. It is monotone and its greatest fixed point $R$ can be computed by iterating it on $S$. Again, it is not difficult to see that ${\cal{B}}$ accepts some tree iff $I \cap R \neq \emptyset$. As all the sets and functions above are computable in polynomial time using the available oracle for $\mathsf{step}_{\cal{B}}$, this gives a polynomial algorithm for non-emptiness. \section{Eliminating Nominals, Trivializing ABoxes}~\label{sec:ABoxesNom} We prove three results: for the logic $\ensuremath{\ALCOI^\smallplus}\xspace$, for a restricted variant of $\ensuremath{\ALCOQ^\smallplus}\xspace$ logic (without at-most restrictions over transitive closures of roles), and for the full $\ensuremath{\ALCOQ^\smallplus}\xspace$ logic. We start with the simplest proof, and then describe additional components needed in the subsequent proofs. \subsection{$\ensuremath{\ALCOI^\smallplus}\xspace$} As there is no counting in the logic, for a role $r$ and a concept name $A$, we will use the standard notation \[ \forall r. A\,, \quad \forall r^*. A\,, \quad \exists r. A\,, \quad \exists r^*. A\,, \] instead of \[ \qnrleq 0 r {\overline{A}}\,, \quad \qnrleq 0 {r^*} {\overline{A}}\,, \quad \qnrgeq 1 r A\,, \quad \qnrgeq 1 {r^*} A\,, \] respectively. Note that restrictions of the form $\qnrleq n {r^*} A$ for $n = 0$ can be eliminated using stickiness, and for $r$ being an inverse role they are not present in the normal forms that we assume throughout the paper. In this section we will use them for the sake of brevity, highlighting the places where it might create confusion. Let ${\cal{K}} = ({\cal{T}}, {\cal{A}})$ be an $\ensuremath{\ALCOI^\smallplus}\xspace$ knowledge base, $Q \in \ensuremath{\UCQ^\smallplus}\xspace$ with $\ensuremath{\CQ^\smallplus}\xspace$s of size at most $m$. One can decide if ${\cal{K}} \models_{\mathsf{fin}} Q$ in time $\mathrm{poly}(\|{\cal{K}}\|, (2m)^{|Q|\cdot\|{\cal{K}}\|^{O(m)}})$ using oracle calls to finite entailment over $\ensuremath{\ALCI^\smallplus}\xspace$ KBs of size at most $\mathrm{poly}(\|{\cal{K}}\|)$, with trivial ABoxes and unions of at most $|Q| \cdot \|{\cal{K}}\|^{O(m)}$ $\ensuremath{\CQ^\smallplus}\xspace$s of size $O(m)$. We present the result as an oracle reduction; however, it is worth noting that it can be seen as a \emph{truth-table reduction}~\cite{post1944,LADNER1975103}; that is, the calls to the oracle are not adaptive. \subsubsection{Modifying the KB} \begin{itemize} \item Replace each transitive role atom $r^*(a, b)$ in the ABox with a CI in the TBox: $\{a\} \sqsubseteq \exists r^*. \{b\}$. \item For each nominal $\{a\}$ and role $r$ introduce fresh concept names $A_a \equiv \{a\}$, $A_{r,a} \equiv \exists r. \{a\}$ and $A_{r^*, a} \equiv \exists r^*. \{a\}$. \item Normalize the knowledge base. We will denote all concept names present in the KB after the normalization as \emph{original} concept names. \item Introduce \emph{auxiliary} concept names: for each original concept name $A$ and each role $r$ introduce concept names $C_{\exists r. A}$ and $C_{\exists r^*. A}$, with the following axiomatization: \[ C_{\exists r. A} \sqsubseteq \exists r. A\,,\quad \overline{C_{\exists r. A}} \sqsubseteq \forall r. \overline{A}\,, \] \[ C_{\exists r^*. A} \sqsubseteq \exists r^*. A\,,\quad \overline{C_{\exists r^*. A}} \sqsubseteq \forall r^*. \overline{A}\,. \] To preserve the normal form, the last CI is split into two: $\overline{C_{\exists r^*. A}} \sqsubseteq \overline{A}$ and $\overline{C_{\exists r^*. A}} \sqsubseteq \forall r. \overline{C_{\exists r^*. A}}$. \end{itemize} From now on, let ${\cal{K}}$ denote the KB after above modifications. \subsubsection{Unravelling} \begin{definition} Let ${\cal{I}}$ be a model of ${\cal{K}}$ and $x \in \Delta^{\cal{I}}$. A \emph{witnessing set} for $x$ is a set $S$ of pairs $(y, r)$, where $y \in \Delta^{\cal{I}}$ and $r$ is a role, such that: \begin{itemize} \item for every $(y, r) \in S$, $y$ is a direct $r$-successor of $x$; \item for each CI of the form $A \sqsubseteq \exists r. B$ such that $A \in \mn{tp}^{{\cal{I}}}(x)$, there exists $(y, r) \in S$ such that $y$ is in concept $B$; \item for each CI of the form $A \sqsubseteq \exists r^*. B$ such that $A \in \mn{tp}^{{\cal{I}}}(x)$, either $B \in \mn{tp}^{{\cal{I}}}(x)$ or there exists $(y, r)\in S$ such that $y$ is in concept $C_{\exists r^*. B}$. \end{itemize} \end{definition} Observe that in any minimal witnessing set there are at most as many elements as there are CIs in the TBox. We will call an element $y$ a \emph{required witness} for $x$ if $y$ is present in every witnessing set for $x$. \begin{lemma} If ${\cal{K}} \not\models_{\mathsf{fin}} Q$, there exists a counter model $\Imc$ which can be decomposed into domain-disjoint intepretations ${\cal{I}}\upharpoonright \mn{ind}({\cal{K}})$ and ${\cal{I}}_1, \dots, {\cal{I}}_n$ for some $n \leq \|{\cal{K}}\| \cdot |\mn{ind}({\cal{K}})|$ with two kinds of additional edges: arbitrary edges connecting elements from $\bigcup_i\Delta^{{\cal{I}}_i}$ with elements from $\mn{nom}({\cal{K}})$, and a single edge connecting a distinguished element $d_i\in\Delta^{{\cal{I}}_i}$ with a corresponding element $e_i \in \mn{ind}({\cal{K}})$ for each $i\leq n$. Moreover, one can assume that: \begin{itemize} \item if $e_i$ is not a nominal, $e_i$ is not a required witness for $d_i$, \item for any nominal $a$, $\{(b, r): b \in \mn{ind}({\cal{K}}), (a, b) \in r^{\cal{I}}\} \cup \{(d_i, r_i): e_i = a\}$ is a witnessing set for $a$. \end{itemize} \end{lemma} \begin{proof} This can be achieved by routine one-step unravelling from the individuals. Let ${\cal{J}}$ be any counter-model. ${\cal{I}}$ is constructed as follows. Take a copy of ${\cal{J}} \upharpoonright \mn{ind}({\cal{K}})$. For every individual $x \in \mn{ind}({\cal{K}})$, take any minimal witnessing set $S$ for $x$ in ${\cal{J}}$. For each $(y, r) \in S$, add a fresh copy of the whole interpretation ${\cal{J}}$ to ${\cal{I}}$, identifying the nominals, and add an $r$-edge from $x$ to the newly created copy of $y$. As each element and each edge in ${\cal{I}}$ was created as a copy of some element or edge in ${\cal{J}}$, there is a homomorphism from ${\cal{I}}$ to ${\cal{J}}$ witnessing that ${\cal{I}} \not\models Q$. \end{proof} \subsubsection{Constructing KBs for ${\cal{I}}_i$.} We search for a counter-model admitting the described decomposition. We will refer to ${{\cal{I}}\upharpoonright \mn{ind}({\cal{K}})}$ as $\ensuremath{{\cal{I}}_0}$. Iterate through all possible interpretations $\ensuremath{{\cal{I}}_0}$ \comment{($4^{|\mn{ind}({\cal{K}})|^2\cdot|\mn{rol}({\cal{K}})|}\cdot 2^{|\mn{ind}({\cal{K}})|\cdot|\mn{CN}({\cal{K}})|}$ options)} and perform the rest of the procedure for a fixed $\ensuremath{{\cal{I}}_0}$; a counter-model exists iff it exists for some of these choices. We will construct KBs representing abstractly ${\cal{I}}_i$ for $1 \leq i \leq n$; these KBs will have some additional concept names: $D_{\exists r. A} \equiv \exists r. A$ and $D_{\exists r^*. A} \equiv \exists r^*. A$, for each role $r$ and original concept name $A$. Their meaning is similar to the auxiliary concept names, but they are supposed to represent having appropriate (direct) $r$-successor \emph{inside one interpretation ${\cal{I}}_i$}, while the auxiliary concept names speak about the whole interpretation ${\cal{I}}$. We will call them \emph{local auxiliary concept names}. For any choice of a unary type $\tau$ containing both concept names from ${\cal{K}}$ and the local auxiliary concept names (or their complements), let ${\cal{K}}_\tau$ be the KB ${\cal{K}}$ with the following modifications: \begin{itemize} \item the ABox is $\left\{A(b) \bigm | A \in \tau\right\}$ for a fresh individual $b$; \item remove the axiomatization of concept names $A_{r, a}$; \item replace the axiomatization of the auxiliary concept names: \[ C_{\exists r. A} \equiv \exists r. A \sqcup \bigsqcup_{\substack{a \in \Nom({\cal{K}})\\A(a) \in {\cal{A}}}} A_{r, a}\,, \] \[ C_{\exists r^*. A} \equiv \exists r^*. A \sqcup \bigsqcup_{\substack{a \in \Nom({\cal{K}})\\ C_{\exists r^*. A}(a) \in {\cal{A}}}} \exists r^*. A_{r, a}\,, \] \item for each nominal $\{a\}$, each $A$ such that $A(a) \in {\cal{A}}$ and each role $r$: \begin{itemize} \item for each CI of the form $A \sqsubseteq \forall r. B$ add a new CI $A_{r^-, a} \sqsubseteq B$ to the TBox; \item for each CI of the form $A \sqsubseteq \forall r^*. B$ add a new CI $A_{r^-, a} \sqsubseteq \forall r^*. B$ to the TBox; \end{itemize} \item remove all CIs with a nominal on the left-hand side; \item replace CIs by the following rules, for any original concept names $A$, $B$ and any role $r$ (by the previous point, $A$ is not a nominal): \begin{itemize} \item $A \sqsubseteq \exists r. B \longrightarrow A \sqsubseteq C_{\exists r. B}$; \item $A \sqsubseteq \forall r. B \longrightarrow A \sqsubseteq \overline{C_{\exists r. \overline{B}}}$; \item $A \sqsubseteq \exists r^*. B \longrightarrow A \sqsubseteq C_{\exists r^*. B}$; \item $A \sqsubseteq \forall r^*. B \longrightarrow A \sqsubseteq \overline{C_{\exists r^*. \overline{B}}}$; \end{itemize} \item for any CI of the form $\bigsqcap_i A_i \sqsubseteq \bigsqcup_j B_j$, remove all nominals from the right-hand side (i.e. if $B_j$ is a nominal, remove $B_j$ from the disjunction); \item add the axiomatization of concept names $D_{\exists r. A}$ and $D_{\exists r^*. A}$. \end{itemize} Iterate through all possible choices of a number ${n \leq \|{\cal{K}}\| \cdot |\mn{ind}({\cal{K}})|}$, and sequences of: unary types $\tau_i$ (containing concept names from ${\cal{K}}$ and the local auxiliary concept names), individuals $e_i$ and roles $r_i$ for $i = 1, \dots, n$. \comment{($\|{\cal{K}}\|\cdot |\mn{ind}({\cal{K}})| \cdot 4^{|\mn{CN}({\cal{K}})|\cdot \|{\cal{K}}\| \cdot |\mn{ind}({\cal{K}})|} \cdot (|\mn{ind}({\cal{K}})| \cdot 2|\mn{rol}({\cal{K}})|)^{\|{\cal{K}}\| \cdot |\mn{ind}({\cal{K}})|}$ options)} We will consider an interpretation obtained by taking a union of $\ensuremath{{\cal{I}}_0}$ and all ${\cal{I}}_i$ for $i = 1, \dots, n$, where ${\cal{I}}_i$ is any model of ${\cal{K}}_{\tau_i}$, and adding two kinds of additional edges: between $e_i$ and $d_i$ (the only individual of ${\cal{K}}_{\tau_i}$) by role $r_i$ and from all elements in concept $A_{r, a}$ to $a$ by role $r$. Perform the rest of the procedure for a fixed choice of $n$ and all $\tau_i$, $e_i$ and $r_i$ for $i = 1, \dots, n$; there is a counter-model iff there is a counter-model consistent with one of such choices. We will see that the following procedure verifying that the resulting interpretation is a model of ${\cal{K}}$ does not depend on the choices of models ${\cal{I}}_i$. Regardless of the exact shape of ${\cal{I}}_i$, the local auxiliary concept names $D_{\exists r^*. A_{r^-, a}}$ present in $\tau_i$ determine the set of nominals $r$-reachable from $d_i$ through ${\cal{I}}_i$. Knowing also ${\cal{I}}_0$, we can calculate for each individual the set of $r$-reachable nominals and verify that it corresponds to the auxiliary concept names $C_{\exists r^*. A_{a}}$ present in the unary type of this individual. This reachability information is the crucial part that needs to be verified; the rest is a number of straightforward conditions. Namely, one needs to check that: \begin{itemize} \item for each individual, each auxiliary concept name $C_{\exists r^*. A}$ present in its unary type is witnessed, either by an $r$-reachable element of ${\cal{I}}_0$ in concept $A$ or by the local auxiliary concept name $D_{\exists r^*. A}$ present in some $\tau_i$ for an $r$-reachable $d_i$; \item for each individual, verify that it belongs to each auxiliary concept of the form $C_{\exists r. A}$ and $\overline{C_{\exists r. A}}$ present in its unary type; each of its direct successors is either inside ${\cal{I}}_0$ or is some $d_i$ (with unary types $\tau_i$) for $1 \leq i \leq n$, so this can be done by simply checking direct successors one by one; \item CIs of the form $\bigsqcap_i A_i \sqsubseteq \bigsqcup_j B_j$ are satisfied in all elements of ${\cal{I}}_0$; \item no universal CIs are violated in ${\cal{I}}_0$ and by the edges between $e_i$ and $d_i$; in particular, for any element being subject to restriction $\forall {r^*}. A$ (i.e. in concept $\overline{C_{\exists {r^*}. \overline{A}}}$), all its direct $r$-successors must be subject to the same restriction (stickiness). \end{itemize} Every counter-model admitting the described decomposition can be constructed this way. If the verification procedure fails, there is no counter-model consistent with the choices made. If it succeeds, the only thing left to do is to check if there are models of ${\cal{K}}_{\tau_i}$ for which $Q$ does not have a match in the resulting interpretation ${\cal{I}}$. \subsubsection{Adjusting the query.} We want to reduce reasoning about matches of $Q$ in the whole interpretation ${\cal{I}}$ to reasoning about matches of some query in the interpretations ${\cal{I}}_i$. To achieve this, for each $q \in Q$ we will construct a $\ensuremath{\UCQ^\smallplus}\xspace$ $Q'$ mentioning $d_i$ for $i = 1, \dots, n$ as individuals such that, for any interpretation ${\cal{I}}$ admitting the described decomposition, ${\cal{I}} \models q$ iff there is some $q' \in Q'$ such that each connected component of $q'$ has a match in some ${\cal{I}}_i$ for some $i = 1, \dots, n$. Each disjunct $q' \in Q'$ will correspond to some way in which a match of $q$ can be distributed among interpretations ${\cal{I}}_i$ for $i = 0, 1, \dots, n$. Existence of an $r$-path between any two individuals $a, b$ can be deduced from $\ensuremath{{\cal{I}}_0}$ alone: any $r$-path from $a$ to $b$ is either contained entirely in $\ensuremath{{\cal{I}}_0}$ (which can be easily verified), or it passes through at least one nominal, so its existence can be checked by comparing the sets of nominals $r$-reachable from $a$ and $r^-$-reachable from $b$ (these sets in turn can be deduced from the unary types of $a$ and $b$). \begin{definition} Let $\Imc$ be an interpretation and $q \in \ensuremath{\CQ^\smallplus}\xspace$. An \emph{enhanced match} for $q$ in $\Imc$ is a match $\eta:\textit{var}(q)\to\Delta^\Imc$ along with \emph{witnessing paths}: for each transitive atom $r^*(x, y)$ in $q$ there is one chosen $r$-path in $\Imc$ from $\eta(x)$ to $\eta(y)$. \end{definition} The crucial observation is that any path witnessing a transitive atom $r^*(x, y)$ is either contained entirely in one of the interpretations ${\cal{I}}_i$ for $0 \leq i \leq n$, or can be split into three parts: $r^*(x, a) \land r^*(a, b) \land r^*(b, y)$, where $a$ and $b$ are individuals and the paths witnessing the first and the third atom do not pass through individuals (i.e. each of them is contained inside one interpretation ${\cal{I}}_i$ for $1 \leq i \leq n$). Thus, a $\ensuremath{\UCQ^\smallplus}\xspace$ $Q'$ capturing all possible distributions of an enhanced match of some $q \in Q$ is a disjunction of all possible results of the following procedure: \begin{itemize} \item for each transitive atom $r^*(x, y)$ in $q$, either leave it unmodified or choose two individuals $a, b \in \mn{ind}({\cal{K}})$ and replace it with $r^*(x, a) \land r^*(a, b) \land r^*(b, y)$; \item choose a subset of variables, a mapping from this subset to $\mn{ind}({\cal{K}})$ and replace the chosen variables with individuals in the whole query (we assume that no other variable will be mapped to an individual); \item evaluate all atoms involving only individuals (this can be done, as ${\cal{I}}_0$ is already fixed, and the reachability between the individuals is known); \item replace atoms involving one individual from $\mn{ind}({\cal{K}})$ with equivalent ones mentioning either some $d_i$ or no individual at all; this requires considering several simple cases, which we will omit here, such as: for each atom $r(x, a)$ where $a$ is an individual, choose to replace it either with $A_{r, a}(x)$ (only if $a$ is a nominal) or with $x = d_i$ for some $i$ such that $e_i = a$. \end{itemize} Thus, if $m$ is the number of transitive atoms in $q$, we can replace $q$ with a disjunction of $\ensuremath{\CQ^\smallplus}\xspace$s $q_1, \dots, q_k$ for $k \leq (|\mn{ind}({\cal{K}})|^2+1)^m \cdot (|\mn{ind}({\cal{K}})|+n+1)^{|\textit{var}(q)|}$, and assume that each connected component of each $q_j$ is contained entirely inside one interpretation ${\cal{I}}_i$ for $1 \leq i \leq n$. Let $Q'$ be the $\ensuremath{\UCQ^\smallplus}\xspace$ being a disjunction of all resulting $\ensuremath{\CQ^\smallplus}\xspace$s for all $q \in Q$. Now we just need a standard reduction of finite entailment to the case where one assumes that each $\ensuremath{\CQ^\smallplus}\xspace$ is connected. In any counter-model, for each of $q \in Q'$, for at least one connected component of $q$ there must be no match (contained entirely in ${\cal{I}}_i$ for some $1 \leq i \leq n$). For each possible choices of one connected component from each $q \in Q'$, check the entailment of their disjunction in each ${\cal{K}}_{\tau_i}$ for $1 \leq i \leq n$. There is a counter-model for $Q$ and ${\cal{K}}$ iff for some choice of the connected components there are counter-models for the resulting $\ensuremath{\UCQ^\smallplus}\xspace$ and each ${\cal{K}}_{\tau_i}$ for $1 \leq i \leq n$; there are at most $(2m)^{k\cdot |Q|}$ such choices, where $k$ is the bound on the number of $\ensuremath{\CQ^\smallplus}\xspace$s $q_1, \dots, q_k$ above. \subsection{$\ensuremath{\ALCOQ^\smallplus}\xspace$ without at-most restrictions over transitive closures} We present only the modifications needed to be done in the proof for $\ensuremath{\ALCOI^\smallplus}\xspace$. Let ${\cal{K}} = ({\cal{T}}, {\cal{A}})$ be an $\ensuremath{\ALCOQ^\smallplus}\xspace$ knowledge base without at-most restrictions over transitive closures of roles, with counting threshold $N$, and $Q \in \ensuremath{\UCQ^\smallplus}\xspace$ with $\ensuremath{\CQ^\smallplus}\xspace$s of size at most $m$. One can decide if ${\cal{K}} \models_{\mathsf{fin}} Q$ in time $\mathrm{poly}(\|{\cal{K}}\|, (2m)^{|Q|\cdot (N \cdot \|{\cal{K}}\|)^{O(m)}})$ using oracle calls to finite entailment modulo types over $\ensuremath{\ALCQ^\smallplus}\xspace$ KBs of size at most $\mathrm{poly}(N, \|{\cal{K}}\|)$, with trivial ABoxes and unions of at most $|Q| \cdot (N \cdot \|{\cal{K}}\|)^{O(m)}$ $\ensuremath{\CQ^\smallplus}\xspace$s of size $O(m)$. \subsubsection{Auxiliary concepts.} Introduce new auxiliary concept names $C_{\qnrleq k r A}$, $C_{\qnrgeq k r A}$ and $C_{\qnrgeq k {r^*} A}$ for each $k < N$, role name $r$ and original concept name $A$; they are supposed to denote that, if an element $x$ is in such a concept, it belongs to the concept in the subscript (in the whole interpretation ${\cal{I}}$). That is, their axiomatization is simply $C_{\qnrleq k r A} \sqsubseteq {\qnrleq k r A}$, $C_{\qnrgeq k r A} \sqsubseteq {\qnrgeq k r A}$, $C_{\qnrgeq k {r^*} A} \sqsubseteq {\qnrgeq k {r^*} A}$. \subsubsection{Unravelling.} The unravelling procedure lifts easily to the case with counting, without inverses. Assume that the auxiliary concept names have the intended meaning in the original counter-model; for example, an element is in concept $C_{\qnrgeq k {r^*} A}$ iff it has at least $k$ $r$-successors in concept $A$. The definition of a witnessing set for $x$ is modified to be $S$ such that: \begin{itemize} \item for every $(y, r) \in S$, $y$ is a direct $r$-successor of $x$; \item for each CI of the form $A \sqsubseteq \qnrgeq k r B$ such that $A \in \mn{tp}^{{\cal{I}}}(x)$, there exist at least $k$ distinct $(y, r) \in S$ such that $y$ is in concept $B$; \item for each CI of the form $A \sqsubseteq \qnrgeq k {r^*} B$ such that $A \in \mn{tp}^{{\cal{I}}}(x)$: \begin{itemize} \item if $B \in \mn{tp}^{{\cal{I}}}(x)$, at least $k-1$ distinct $r$-successors of $x$ in concept $B$ are $r$-reachable from the elements $\{y: (y, r) \in S\}$, \item if $B \not\in \mn{tp}^{{\cal{I}}}(x)$, at least $k$ distinct $r$-successors of $x$ in concept $B$ are $r$-reachable from the elements ${\{y: (y, r) \in S\}}$. \end{itemize} \end{itemize} \comment{(any minimal witnessing set has size at most $N \cdot \|{\cal{K}}\|$)} Let ${\cal{J}}$ be any counter-model. A counter-model ${\cal{I}}$ admitting the desired decomposition is constructed as follows. Take a copy of ${\cal{J}} \upharpoonright \mn{ind}({\cal{K}})$. For every individual $x \in \mn{ind}({\cal{K}})$, take any minimal witnessing set $S$ for $x$ in ${\cal{J}}$. For each $(y, r) \in S$, add a fresh copy of the whole interpretation ${\cal{J}}$ to ${\cal{I}}$, identifying the nominals and \emph{removing all outgoing edges from the nominals} and add an $r$-edge from $x$ to the newly created copy of $y$. As each element and each edge in ${\cal{I}}$ was created as a copy of some element or edge in ${\cal{J}}$, there is a homomorphism from ${\cal{I}}$ to ${\cal{J}}$ witnessing that ${\cal{I}} \not\models Q$. To argue that ${\cal{I}} \models {\cal{K}}$, we will show that the satisfaction of all the required restrictions is preserved. Recall that there are no inverses and no at-most restrictions over transitive closures. For any element $x$ in ${\cal{I}}$ created as a copy of some $x'$ in ${\cal{J}}$, and for any role name $r$, all direct $r$-successors of $x$ were created as copies of distinct direct $r$-successors of $x'$, which preserves all at-most restrictions. All required restrictions of the form $\qnrgeq k r A$ are clearly satisfied in ${\cal{I}}$, as the copies of appropriate elements and edges are added explicitly during the procedure. As for restrictions of the form $\qnrgeq k {r^*} A$, consider an individual that has $m$ $r$-reachable elements in concept $A$ in ${\cal{J}}$: \begin{itemize} \item if $m < N$, at least one copy of each of them is $r$-reachable in ${\cal{I}}$ from this individual (recall the assumption that the concepts $C_{\qnrgeq k {r^*} A}$ have the intended meaning in ${\cal{J}}$ and the definition of the witnessing set); \item if $m \geq N$, then copies of at least $N-1$ of them are reachable (by the argument above), which is enough to satisfy any counting restriction. \end{itemize} Therefore, for any element $x$ in ${\cal{I}}$ created as a copy of $x'$ from ${\cal{J}}$, any role name $r$ and any concept name $A$, it can be easily seen that either: \begin{itemize} \item there is a nominal in concept $C_{\qnrgeq {N-1} {r^*} A}$ $r$-reachable from $x$; \item at least one copy of every element in concept $A$ $r$-reachable from $x'$ (in ${\cal{J}}$) is $r$-reachable from $x$ (in ${\cal{I}}$). \end{itemize} This is enough for all required restrictions to be satisfied in ${\cal{I}}$. Note that, as there are no inverse roles, the edges between $e_i$ and $d_i$ are always directed towards $d_i$. \subsubsection{Local auxiliary concepts.} For $\ensuremath{\ALCOI^\smallplus}\xspace$, when describing KBs ${\cal{K}}_{\tau_i}$, we defined local auxiliary concepts $D_{\exists r. A}$ and $D_{\exists r^*. A}$. Here we will define analogous concepts $D_{\qnrleq k r A}$, $D_{\qnrgeq k r A}$ and $D_{\qnrgeq k {r^*} A}$, although this time we additionally need to be prepared to distinguish elements $r_i$-reachable from $d_i$ to avoid counting them twice later in the process. For each role name $r$ we introduce a concept name $R_r$; if an element $x$ in ${\cal{I}}_i$ is $r$-reachable from $d_i$, it is supposed to be in this concept. The axiomatization is simple: $R_r(d_i)$ is present in the ABox, and $R_r \sqsubseteq \forall r. R_r$ is present in the TBox. Then, for each original concept name $A$, introduce a concept name $C_{A\sqcap \overline{R_r}} \equiv A \sqcap \overline{R_r}$. Introduce local auxiliary concept names $D_{\qnrleq k r A}$, $D_{\qnrgeq k r A}$ and $D_{\qnrgeq k {r^*} A}$ for each $k < N$, role name $r$ and $A$ being either an original concept name or $C_{B\sqcap \overline{R_r}}$ for an original concept name $B$; if an element $x \in \Delta^{{\cal{I}}_i}$ is in such concept, it belongs to the concept in the subscript in ${\cal{I}}_i$. When constructing KBs ${\cal{K}}_\tau$, rewrite CIs to use the auxiliary concept names; that is, replace: \begin{itemize} \item $A \sqsubseteq \qnrleq k r A$ with $A \sqsubseteq C_{\qnrleq k r A}$; \item $A \sqsubseteq \qnrgeq k r A$ with $A \sqsubseteq C_{\qnrgeq k r A}$; \item $A \sqsubseteq \qnrgeq k {r^*} A$ with $A \sqsubseteq C_{\qnrgeq k {r^*} A}$. \end{itemize} Also, remove the axiomatization of the auxiliary concepts altogether. \subsubsection{Verifying being a model of ${\cal{K}}$.} For each choice of ${\cal{I}}_0$, $n$, $e_i$, $r_i$, $\tau_i$ for $i = 1, \dots, n$, we need to verify whether there exists a counter-model admitting a decomposition consistent with their values. For $\ensuremath{\ALCOI^\smallplus}\xspace$, to perform this verification, we solved multiple instances of finite entailment problem for ${\cal{K}}_{\tau_i}$ for each $i = 1, \dots, n$ and the modified query $Q'$. Now we will need to solve instances of finite entailment modulo types; we will define sets $\Theta_i$ (which will depend on ${\cal{I}}_0$, $n$, $e_i$, $r_i$ and $\tau_i$) of unary types allowed for ${\cal{K}}_{\tau_i}$ to make sure that whenever an element of a model ${\cal{I}}_i$ of ${\cal{K}}_{\tau_i}$ is in concept $C_{\qnrgeq k {r^*} A}$, it is also in concept $\qnrgeq k {R^*} A$ in the whole interpretation ${\cal{I}}$. For a given element $x$ of some ${\cal{I}}_i$, we will be talking about \emph{local successors}: successors reachable from $x$ without leaving the model ${\cal{I}}_i$ (without passing through any nominal) and \emph{global successors}: ones that are reachable by paths passing through some nominal. Note that the sets of local successors and global successors are not necessarily disjoint. For a nominal $a$, define $\mathsf{globsuc}_{a,r,A}$ to be the set of $r$-successors of $a$ in concept $A$. Note that, even though this exact set depends on choices of models ${\cal{I}}_i$, the local auxiliary concepts $D_{\qnrgeq k {r^*} A}$ present in $\tau_i$ for $i = 1, \dots, n$ along with ${\cal{I}}_0$ give a lower bound on its cardinality. Moreover, assuming that they have the intended meaning in the interpretations ${\cal{I}}_i$, one can deduce from them (and from ${\cal{I}}_0$) the exact cardinality of $\mathsf{globsuc}_{a,r,A}$ up to $N$. For a set of nominals $S$, let $\mathsf{globsuc}_{S,r,A} = \bigcup_{a \in S} \mathsf{globsuc}_{a,r,A}$. For each $i = 1, \dots, n$ define the set $\Theta_i$ of allowed unary types $\tau$ such that, for every $k < N$, role name $r$ and original concept name $A$: \begin{itemize} \item if $C_{\qnrgeq k r A} \in \tau$, then $\max\{\ell: D_{\qnrgeq \ell r A} \in \tau\} + |\{a \in \mn{nom}({\cal{K}}): A_{r,a} \in \tau \land A(a) \in {\cal{A}}\}| \geq k$; \item if $C_{\qnrleq k r A} \in \tau$, then $\min\{\ell: D_{\qnrleq \ell r A} \in \tau\} + |\{a \in \mn{nom}({\cal{K}}): A_{r,a} \in \tau \land A(a) \in {\cal{A}}\}| \leq k$; \item if $C_{\qnrgeq k {r^*} A} \in \tau$, then: \begin{itemize} \item if $d_i$ is not $r$-reachable from an element of type $\tau$ through any nominal (this depends only on ${\cal{I}}_0$, $r_i$ and the set of nominals $r$-reachable from an element of type $\tau$), then the sets of local and global $r$-successors in concept $A$ are disjoint, so the condition is: $\max\{\ell: D_{\qnrgeq \ell {r^*} A} \in \tau\} + |\mathsf{globsuc}_S| \geq k$, where $S = \{a \in \mn{nom}({\cal{K}}): C_{\qnrgeq 1 {r^*} {A_a}} \in \tau\}$; \item if $d_i$ is $r$-reachable from an element of type $\tau$ through any nominal, then these sets are intersecting, but we can avoid double counting thanks to the concept names $C_{A \sqcap \overline{R_r}}$ introduced in ${\cal{K}}_{\tau_i}$: $\max\{\ell: D_{\qnrgeq \ell {r^*} {C_{A \sqcap \overline{R_r}}}} \in \tau\} + |\mathsf{globsuc}_S| \geq k$, where $S = \{a \in \mn{nom}({\cal{K}}): C_{\qnrgeq 1 {r^*} {A_{r,a}}} \in \tau\}$. \end{itemize} \end{itemize} We cannot calculate the exact cardinality of $|\mathsf{globsuc}_S|$ used above, but we can use the described lower bound instead. If the local auxiliary concept names have the intended interpretations in all ${\cal{I}}_i$, the conditions will be correctly verified. If not, they will be lower bounds, so $\Theta_i$ might contain less unary types, which only reduces the space of considered models and does not affect the resulting model of ${\cal{K}}$; notice that the local auxiliary concept names are introduced by the procedure and are not present in the original KB ${\cal{K}}$. As in the $\ensuremath{\ALCOI^\smallplus}\xspace$ case, calculate for each individual the set of $r$-reachable nominals for each role name $r$. For each element of ${\cal{I}}_0$, all its direct successors are either inside ${\cal{I}}_0$ or are $d_i$ (with unary types $\tau_i$), so verifying whether an element of ${\cal{I}}_0$ is in a concept of the form $\qnrleq k r A$ or $\qnrgeq k r A$ can be done by simply counting the appropriate successors. Concepts of the form $\qnrgeq k {r^*} A$ can be easily verified using the information about the nominals reachable from individuals and the local auxiliary concept names. \subsubsection{Adjusting the query.} The only change with respect to the $\ensuremath{\ALCOI^\smallplus}\xspace$ case regarding the query is the method of calculating whether a path between two individuals exist. Before we used the sets of nominals $r$-reachable and $r^-$-reachable from the individuals; now we need to use the fact that there are no inverses and the edges between $e_i$ and $d_i$ are always directed towards $d_i$. Therefore, any (forward) path between individuals is either contained entirely in ${\cal{I}}_0$, or it passes through some nominal and can be decomposed into two parts: the beginning up to the last nominal on the path and the rest (possibly empty), contained entirely in ${\cal{I}}_0$. Existence of such parts is easy to verify; the first part relies on the set of nominals $r$-reachable from an individual, which can be deduced from the auxiliary concept names of the form $C_{\qnrgeq 1 {r^*} A_a}$. \subsection{$\ensuremath{\ALCOQ^\smallplus}\xspace$} Let ${\cal{K}} = ({\cal{T}}, {\cal{A}})$ be an $\ensuremath{\ALCOQ^\smallplus}\xspace$ knowledge base with counting threshold $N$, and $Q \in \ensuremath{\UCQ^\smallplus}\xspace$ with $\ensuremath{\CQ^\smallplus}\xspace$s of size at most $m$. One can decide if ${\cal{K}} \models_{\mathsf{fin}} Q$ in time $\mathrm{poly}(\|{\cal{K}}\|, (2m)^{|Q|\cdot (\|{\cal{K}}\| \cdot N^{|\mn{RCN}({\cal{K}})|})^{O(m)}})$ using oracle calls to finite entailment modulo types over $\ensuremath{\ALCQ^\smallplus}\xspace$ KBs of size at most $\mathrm{poly}(\|{\cal{K}}\|, N^{1+|\mn{RCN}({\cal{K}})|})$, with trivial ABoxes and unions of at most $|Q| \cdot (\|{\cal{K}}\| \cdot N^{|\mn{RCN}({\cal{K}})|})^{O(m)}$ $\ensuremath{\CQ^\smallplus}\xspace$s of size $O(m)$. Without loss of generality, assume that ${\cal{K}}$ is sticky. In this case, $\ensuremath{{\cal{I}}_0}$ becomes ${\cal{I}}$ restricted not just to the individuals, but to individuals and all their relevant successors. For this reason, at the very beginning of the reduction, we do the following. Iterate through all possible sizes of the set of relevant successors of all individuals (by Fact~\ref{fact:relevant}, it is of size at most $|\mn{ind}({\cal{K}})|\cdot |\mn{rol}({\cal{K}})|\cdot N^{|\mn{RCN}({\cal{K}})|}$). As usual, there is a counter-model iff there is one consistent with one of these choices. For a fixed choice $t$ of this number, add $t$ fresh individuals to the ABox. For each role name $r$ and each pair of individuals $(a, b)$, choose whether there exists an $r$-path from $a$ to $b$; if so, add a CI $\{a\} \sqsubseteq \exists r^*. \{b\}$ to the TBox. Note that this might introduce new nominals, which are treated as such throughout the whole procedure; in particular, appropriate concept names of the form $A_{r, a}$ are introduced. The construction extends the one from the case without at-most restrictions over transitive closures; below we describe only the newly introduced concepts and verification steps. \subsubsection{Auxiliary concepts.} Add auxiliary concept names $C_{\qnrleq k {r^*} A}$ for all $k < N$, role names $r$ and relevant concept names $A$. Additionally, for each role name $r$ and relevant concept name $A$, choose a subset $\mathsf{full}_{r, A} \subseteq \Delta^{\ensuremath{{\cal{I}}_0}}$; it is supposed to denote the set of elements having at least $N$ $r$-successors in concept $A$ (one could express it using the concept $C_{\qnrgeq N {r^*} A}$, but we want to avoid increasing the counting threshold in the produced KBs). \subsubsection{Unravelling.} Unravelling works the same as in the case of $\ensuremath{\ALCOQ^\smallplus}\xspace$ without at-most restrictions over transitive closures. Correctness follows easily from the fact that all relevant successors of individuals are inside ${\cal{I}}_0$ and that the at-most restrictions are sticky, therefore no additional interaction between the interpretations ${\cal{I}}_i$ is introduced. \subsubsection{Local auxiliary concepts.} Introduce concept names $D_{\qnrleq k {r^*} A}$ for $k < N$, any role name $r$ and any relevant concept name $A$. \subsubsection{Verifying being a model of ${\cal{K}}$.} By the assumption that $\ensuremath{{\cal{I}}_0}$ is closed under taking relevant successors, if any element of $\ensuremath{{\cal{I}}_0}$ is in the interpretation of a concept name $C_{\qnrleq k {r^*} A}$ for $k > 0$, all appropriate witnesses (i.e. its $r$-successors in concept $A$) need to also be in $\ensuremath{{\cal{I}}_0}$. For any fixed role name $r$ and relevant concept name $A$, we verify that if an element of $\ensuremath{{\cal{I}}_0}$ is not in such concept for any $k$, then it is in the set $\mathsf{full}_{r, A}$. For all $r$-edges from $e_i$ to $d_i$, if $e_i$ has an at-most restriction over transitive closure of $r$, $d_i$ needs to have the same restriction with number $0$. We will again construct the sets $\Theta_i$ of unary types allowed in models of ${\cal{K}}_{\tau_i}$: the allowed types $\tau$ need to satisfy all the conditions listed in the case without at-most restrictions over transitive closures. Additionally, if $C_{\qnrleq k {r^*} A} \in \tau$, then: if any nominal \emph{without} the same type of restriction ($C_{\qnrleq \ell {r^*} A}$ for any $\ell$) is $r$-reachable, the restriction is violated (this nominal is in $\mathsf{full}_{r, A}$ and has at least $N$ $r$-successors in concept $A$), so then $\tau$ is forbidden; otherwise, all reachable nominals have the same type of restriction, so all relevant successors reachable through nominals are also nominals and can be counted explicitly. The upper bound on the number of local witnesses is $\min\{k: D_{\qnrleq k {r^*} A} \in \tau\}$, and, if the local auxiliary concept names have the intended meaning, these numbers are equal. \section{Eliminating transitive atoms} \subsection{Proof of Lemma~\ref{lem:unravelling}} Let us check that the decomposition is well formed for ${\cal{K}}$. We start the unravelling from the individual mentioned in the ABox, so ${\cal{I}}_\varepsilon \models {\cal{A}}$. Item \ref{item:types} of Definition~\ref{def:well-formed} is satisfied because elements in each bag inherit their unary types from their originals in ${\cal{J}}$. For item \ref{item:roots}, note that each neighbour of $\mn{cmp}_{\cal{J}}(d)$ outside of $\mn{rel}_{\cal{J}}(d) \cup \mn{cmp}_{\cal{J}}(d)$ can have either only outgoing edges to $\mn{cmp}_{\cal{J}}(d)$ or only incoming edges from $\mn{cmp}_{\cal{J}}(d)$: if it had both, it would belong to $\mn{cmp}_{\cal{J}}(d)$. Items \ref{item:external} follow directly from the construction. For item \ref{item:rel-consistent}, note that $\Gamma_u$ and $\Gamma_w$ are copies of $\mn{rel}_{\cal{J}}(e_u)$ and $\mn{rel}_{\cal{J}}(e_w)$ for the originals $e_u$ and $e_w$ of $f_u$ and $f_w$, which implies that $e_u \in \mn{rel}_{\cal{J}}(e_w)$, and this gives $\mn{rel}_{\cal{J}}(e_u) \subseteq \mn{rel}_{\cal{J}}(e_w)$ by the definition of relevant successors. It follows by construction that $\Gamma_u \subseteq \Gamma_w$. It remains to prove item \ref{item:rel-contained}. By construction, local elements in bag $u$ are exactly those in the copy of $\mn{cmp}_{\cal{J}}(e_u)$. By stickyness, all local elements have the same relevant concept names. Hence, the concept name $A$ mentioned in item \ref{item:rel-contained} is relevant for $f_u$. Because $d$ mentioned in item \ref{item:rel-contained} is local, it is reachable from $f_u$. Hence, if $d\in A^{{\cal{I}}_u}$, then $d$ is a relevant successor of $f_u$, which means it belongs to $\Gamma_u$. (The only case when this can happen is when $d=f_u$, but this is irrelevant here.) Consider $v\in T$ such that $f_v$ is a sink in ${\cal{I}}_u$ or $f_u$ is a non-isolated source in ${\cal{I}}_v$. In either case, the original $e_v$ of $f_v$ is reachable from the original $e_u$ of $f_u$ in ${\cal{J}}$. Consider an element $e' \in \Gamma_v$. Then, the original $e$ of $e'$ is a (relevant) successor of the original $e_v$ of $f_v$, which implies that it is also reachable from the original $e_u$ of $f_u$. If $e' \in A^{{\cal{I}}_v}$, then $e \in A^{{\cal{J}}}$ and $e \in \mn{rel}_{\cal{J}}(e_u)$. From the construction of the unravelling it follows that $e' \in \Gamma_u$, and we are done. If ${\cal{K}}$ does not use inverse roles, we add only direct successors of $f_v$, rather than all neighbours, so items \ref{item:roots} and \ref{item:external} hold with ``sink or source'' replaced with ``sink''. Because we remove all edges outgoing from $\Gamma_u\setminus \{f_u\}$, these elements are indeed sinks. If ${\cal{K}}$ does not use counting restrictions, $\mn{rel}_{\cal{J}}(e) = \emptyset$ for each $e \in \Delta^{{\cal{J}}}$, so $\Gamma_u = \emptyset$ for each $u\in T$. To see that the decomposition is well connected, observe that each ${\cal{I}}_u$ consists of a strongly connected component, a set of elements attached to it, and possibly a set of isolated elements. This is precisely how a well-connected interpretation looks. Safety is proved by contradiction. Consider an infinite path of nodes $u_0, u_1, \dots, $ such that for all $i$, either $f_{u_{i+1}}$ is a sink in ${\cal{I}}_{u_{i}}$ or $f_{u_i} $ is a non-isolated source in ${\cal{I}}_{u_{i+1}}$. By construction, in this case, the original $e_{u_{i+1}}$ of $f_{u_{i+1}}$ is a successor of the original $e_{u_{i}}$ of $f_{u_{i}}$ in ${\cal{J}}$ for all $i$. Once a simple directed path in ${\cal{J}}$ leaves some strongly connected component (SCC) of ${\cal{J}}$ it never goes back. Because the number of SCCs in ${\cal{J}}$ is finite, there exists $i_0$ such that for $i\geq i_0$, all $e_{u_{i}}$ belong to the same strongly connected component $Z$ in ${\cal{J}}$. By stickiness, the sets $\mn{rel}_{\cal{J}}(e_{u_{i}})$ coincide for all $i\geq i_0$; let $\mn{rel}_{{\cal{J}}}(Z)$ be their common value. From the construction of $T$ it follows that $\Gamma_{u_i}$ also coincide for $i\geq i_0$. Because all $f_{u_{i}}$ are different, there exists $i_1 \geq i_0$ such that $f_{u_{i}} \notin \Gamma_{u_i}$ for all $i\geq i_1$. This implies that $e_{u_i} \notin \mn{rel}_{{\cal{J}}}(Z)$ for $i\geq i_1$. By the construction of the unravellng, $e_{u_{i+1}}$ is reachable from $e_{u_i}$ without passing through $\mn{rel}_{{\cal{J}}}(Z)$, and $e_{u_{i+1}} \notin \mn{cmp}_{\cal{J}}(e_{u_i})$. It follows that $e_{u_{j}} \notin \mn{cmp}_{\cal{J}}(e_{u_i})$ for $j>i \geq i_1$, because $e_{u_{j}} \in \mn{cmp}_{\cal{J}}(e_{u_i})$ implies that $e_{u_{j'}} \in \mn{cmp}_{\cal{J}}(e_{u_i})$ for all $ j \geq j' \geq i$, which is in contradiction with $e_{u_{i+1}} \notin \mn{cmp}_{\cal{J}}(e_{u_i})$. But $e_{u_{j}} \notin \mn{cmp}_{\cal{J}}(e_{u_i})$ implies $e_{u_{j}} \neq e_{u_i}$ for $j>i \geq i_1$, which is impossible because ${\cal{J}}$ is finite. Checking that ${\cal{I}}\models {\cal{K}}$ is entirely routine. \subsection{Proof of Lemma~\ref{lem:correct}} By the compostionality of $Q$-types, that the correct $Q$-labelling $\sigma$ satisfies the condition \[ \sigma(d) = \bigg(\mn{tp}^{{\cal{I}}_u}_Q\big(\{d\} \cup \Gamma_u \cup \widetilde\Gamma_u\big) \oplus \bigoplus_{e\in \widetilde\Gamma_u} \sigma(e)\bigg) \upharpoonright \{d\}\cup\Gamma_u \] for each node $u \in T$ and each element $d$ local in $u$. It remains to show that for each $Q$-labelling $\sigma'$ satisfying the condition above we have $\sigma(d) \subseteq \sigma'(d)$. Let us fix such $\sigma'$. We first show an auxiliary fact. \begin{fact} \label{fact:aux} For each descendent $v$ of $u$ and each $d$ local in $u$, $\sigma'(f_v) \upharpoonright \{d\} \cup \Gamma_u \subseteq \sigma'(d)$. \end{fact} \begin{proof} This is proved by induction on the distance between $u$ and $v$. If $v$ is a child of $u$ the claim follows directly from the initial assumption on $\sigma'$. Otherwise, let $w$ be the unique child of $u$ that is an acestor of $v$. By the inductive hypothesis, \[\sigma'(f_v) \upharpoonright \{f_w\} \cup \Gamma_w \subseteq \sigma'(f_w)\,.\] Like in the base case, we get \[ \big (\sigma'(f_v) \upharpoonright \{f_w\} \cup \Gamma_w \big) \upharpoonright \{d\} \cup \Gamma_u \subseteq \sigma'(d)\,. \] The left-hand side is equal to $ \sigma'(f_v) \upharpoonright \{d\} \cup \Gamma_u$, beacause \[\Delta_v \cap \big(\{d\} \cup \Gamma_u\big)\subseteq \Delta_v \cap \Delta_u \subseteq \{f_w\} \cup \Gamma_w\] holds in each hybrid decomposition. \end{proof} We need to show that for each node $u$, element $d \in \Delta_u$ local in $u$, and $(p, \eta)$ with $ \emptyset \neq \mathsf{img}(\eta) \subseteq \{d\} \cup \Gamma_u$, if there exists a match for $p$ in $\widehat{\cal{I}}_u$ that extends $\eta$, then $(p, \eta) \in \sigma'(d)$. We prove it by induction on the size of a minimal connected set $V$ of nodes from the subtree rooted at $u$ such that there exists a match for $p$ in $\bigcup _{v\in V} {\cal{I}}_v$, extending $\eta$. The base case is when $V = \{v\}$. If $v=u$, then \[(p, \eta) \in \mn{tp}^{{\cal{I}}_u}_Q\big(\{d\} \cup \Gamma_u) \subseteq \sigma'(d)\,.\] If $v \neq u$, using Fact~\ref{fact:aux}, \begin{align*} (p, \eta) \in \mn{tp}^{{\cal{I}}_v}_Q\big(\{f_v\} \cup \Gamma_v) \upharpoonright \{d\} \cup \Gamma_u \subseteq &\\ \subseteq \sigma'(f_v) \upharpoonright \{d\} \cup \Gamma_u \subseteq \; & \sigma'(d)\,. \end{align*} If $|V| > 1$, let $v$ be the minimal node in $V$. Let us choose a local element $e$ in $v$ as follows: if $d \in {\cal{I}}_v$ take $e=d$, otherwise take $e=f_v$. We will prove that $(p, \eta) \in \sigma'(e)$. This will yield $(p, \eta) \in \sigma'(d)$ either directly, or by way of Fact~\ref{fact:aux}. Let $v_1, v_2, \dots, v_k$ be the children of $v$ that belong to $V$. Our goal now is to split $(p, \eta)$ into $\tau, \tau_1, \dots, \tau_k$ such that \begin{itemize} \item $\textit{var}(p')\setminus \dom(\eta')$ are pairwise disjoint for $(p', \eta') \in \tau\cup\tau_1\cup\dots \cup \tau_k$; \item $\mathsf{img}(\eta') \subseteq \{e\}\cup\Gamma_v\cup\widetilde\Gamma_v$ for $(p', \eta') \in \tau\cup\tau_1\cup\dots \cup \tau_k$; \item for each $(p',\eta') \in \tau$, an extension of $\eta'$ matches $p'$ in ${\cal{I}}_v$; \item for each $i$ and each $(p',\eta') \in \tau_i$, an extension of $\eta'$ matches $p'$ in $\widehat{\cal{I}}_{v_i}$; \item there is a homomorphism $\tilde \eta$, extending $\eta$, from $p$ into \[\bigcup_{(p',\eta') \in \tau\cup\tau_1\cup\dots \cup \tau_k} \eta'(p')\,;\] \end{itemize} and use the inductive hypothesis. An obstacle is that a path witnessing a transitive atom $r^*(x,y)$ of $p$ for the match $\widehat \eta$ may visit multiple bags among $v, v_1, \dots, v_k$. Let us subdivide each transitive atom $r^*(x,y)$ of $p$ into $r^*(x,z_1), r^*(z_1,z_2), \dots, r^*(z_\ell,y)$ in a minimal way ensuring that in the induced matching each atom is witnessed by a path within ${\cal{I}}_v$ or within a single $\widehat{\cal{I}}_{v_i}$, with endpoints in $\{\widehat\eta(x), \widehat\eta(y), f_v\} \cup \Gamma_v \cup \widetilde\Gamma_v$. We can now obtain the desired $\tau, \tau_1, \dots, \tau_k$ by partitioning the resulting query into maximal fragments matched within ${\cal{I}}_v$ or some $\widehat{\cal{I}}_{v_i}$. For each such fragment $p'$, the corresponding $\eta'$ is obtained by restricting the matching to variables matched in $\{f_v\} \cup \Gamma_v \cup \widetilde\Gamma_v$. \subsection{Proof of Lemma~\ref{lem:regularity}} We now know that ${\cal{K}}$ is an $\ensuremath{\ALCI^\smallplus}\xspace$ KB or an $\ensuremath{\ALCQ^\smallplus}\xspace$ KB, but in the construction of the automaton we shall only assume that in well-formed decompositions for each bag $u$, all elements in $\Gamma_u \setminus \{f_u\}$ are sinks. This is explicitly assumend for $\ensuremath{\ALCQ^\smallplus}\xspace$ KBs in Definition~\ref{def:well-formed}, and it holds vacuously for $\ensuremath{\ALCI^\smallplus}\xspace$ KBs, because $\Gamma_u = \emptyset$. Let $N$ be the counting threshold in ${\cal{K}}$. Without loss of generality we can assume that there is an equivalent concept name for each concept \begin{align*} &\qnrleq n r A \,, &&\qnrgeq n r A \,, \\ &\qnrleq n {r^*} B\,, &&\qnrgeq n {r^*} B \,,\\ &\qnrleq 0 {r^-} A \,, &&\qnrgeq 1 {r^-} A \,, \\ &\qnrleq 0 {(r^-)^*} A\,, &&\qnrgeq 1 {(r^-)^*} A \end{align*} where $n \leq N$, $A \in \mn{CN}({\cal{K}})$, and $B \in \mn{RCN}({\cal{K}})$. If ${\cal{K}}$ does not have this property, we add these concepts and build an automaton over a richer alphabet. The automaton for the original KB is obtained by projecting to the smaller alphabet in a natural way. We first describe the construction of the automaton and then discuss the additional computability claims. The automaton ${\cal{B}}_{{\cal{K}}, Q, \Theta}$ consists of three components. The first one verifies that the input tree encodes a safe ${\cal{K}}$-decomposition of an interpretation that only uses types from $\Theta$, the second deals with the concept inclusions of ${\cal{K}}$, and the last checks that the decomposition admits a $Q$-refutation. In what follows, $M=N^{|\mn{RCN}({\cal{K}})|}$ where $N$ is the counting threshold in ${\cal{K}}$ and $[i,j] = \{i, i+1, \dots, j\}$. \subsubsection*{Correctness of decomposition, safety, types} The first thing to check is that the input tree is an encoding of a hybrid decomposition. Correctness of the encoding amounts to checking that $|\tup{g}_u|$ is equal to the length of the tuple on the edge from $u$ to the parent; the latter is passed down the tree and compared with $|\tup{g}_u|$. Conditions \ref{item:hybrid-union}--\ref{item:hybrid-disjoint} of Definition~\ref{def:hybrid} are ensured by the way the decomposition is represented. Ensuring that branching is at most $N^{\mn{CN}({\cal{K}})}$ is done locally, based on the label of the current node and the edges connecting it to its children, without relying on any kind of in formation stored in the states. Let us see how to verify that the hybrid decomposition is well-formed for ${\cal{K}}$. Whether ${\cal{I}}_\varepsilon \models {\cal{A}}$ is tested locally based on the label of the current node and recorded in the state; a state is initial iff the result of this test is positive. Because fresh nodes in ${\cal{I}}_u$ are exactly the ones that do not occur in $f_u$ and $\tup{g}_u$, conditions \ref{item:roots} and \ref{item:external} can also be checked locally. To check condition \ref{item:types}, it suffices to pass the unary ${\cal{K}}$-type of $f_u$ up the tree, and check that it coincides with the unary ${\cal{K}}$-type of the node specified in the label on the edge between $u$ and its parent. To check condition \ref{item:rel-consistent} it is enough to maintain for each $e \in \Gamma_u$ the information about which elements of $\Gamma_u$ belong to $\Gamma_v$ where $e=f_v$, and make sure none of these elements is dropped unless $e$ is dropped. This involves guessing in each node $w$ if $f_w$ belongs to $\Gamma_{w'}$, where $w'$ is the parent of $w$: if so, $\tup{g}_w$ must list all elements of $\Gamma_w$; the guess is passed up the tree to be verified. It remains to check condition \ref{item:rel-contained}. The first part of condition \ref{item:rel-contained} states that for each local element $d$ in ${\cal{I}}_u$ and each concept name $A$ relevant for $d$, if $d \in A^{{\cal{I}}_u}$ then $d\in\Gamma_u$. This can be be verified locally by just looking at the label of the current node. The second part of condition \ref{item:rel-contained} states that for each local element $d$ in ${\cal{I}}_u$ and each concept name $A$ relevant for $d$, $\Gamma_v \cap A^{{\cal{I}}_v} \subseteq \Gamma_u$ for all $v\in T$ such that $f_v$ is a sink in ${\cal{I}}_u$ or $f_u$ is a non-isolated source in ${\cal{I}}_v$. If $f_v \in \Gamma_{u}$, then by condition \ref{item:rel-consistent}, the entire $\Gamma_v$ is contained in $\Gamma_u$. And should $f_u$ belong to $\Gamma_v$, it would be a sink, so not a non-isolated source in ${\cal{I}}_v$. Combining these two observations we see that the automaton only needs to verify the second part of condition \ref{item:rel-contained} for $v$ such that $f_v\notin\Gamma_u$ is a sink in ${\cal{I}}_u$ or $f_u \notin \Gamma_v$ is a non-isolated source in ${\cal{I}}_v$, which implies that $v$ is a neighbour of $u$. Towards this goal, the automaton passes from parent $w'$ to child $w$ the information on whether $f_w$ is a sink or a non-isolated source in ${\cal{I}}_{w'}$, and the information about all concept names relevant for some local elements in ${\cal{I}}_{w'}$. The information about relevant concept names is also passed up the tree: it is guessed in $w'$ and the guess is passed down in the state to $w$, where it is verified. Based on this information the automaton can ensure the second part of condition \ref{item:rel-contained} as follows. If $f_v$ is a sink in the parent of $v$, the automaton checks that for each concept name $A$ passed to $v$ from the parent, all elements of $\Gamma_v \cap A^{{\cal{I}}_v}$ are listed in $\tup{g}_v$. Similarly, for each child $u$ of $v$ reachable via an edge labelled with a non-isolated source in ${\cal{I}}_v$, and each concept name passed from $u$ to $v$, all elements from $\Gamma_v \cap A^{{\cal{I}}_v}$ should be listed in the tuple on the edge between $v$ and $u$. If ${\cal{K}}$ does not use inverse roles, the modified conditions \ref{item:roots} and \ref{item:external} can be checked locally, too, as can be the additional requirement that all elements of $\Gamma_u\setminus \{f_u\}$ are sinks. The condition that $\Gamma_u = \emptyset$, imposed when ${\cal{K}}$ does not use counting restrictions, is also local. To check safety it suffices to ensure that on each infinite branch, after each node $v$ such that $f_v$ is a sink in the parent of $v$, there is a node $w$ such that $f_w$ is a non-isolated source in the parent of $w$. The automaton already has access, in node $v$, to the information on whether $f_v$ is a sink or a non-isolated source in the parent $v'$ of $v$. Additionally, we shall maintain the same information about the parent $v'$ of $v$. With that, it suffices to declare as accepting those states of the automaton, where $f_v$ is a sink and $f_{v'}$ is a non-isolated source, or the other way around. Verifying that only unary types from $\Theta$ are realized is also done locally; when an element realizing a type not in $\Theta$ is detected, the automaton rejects immediately. Including additional information that will be useful later on, we let the state $q$ at the node $v$ represent the following information: \begin{enumerate} \item \label{item:aut:rt} a type $\tau_q \in \mn{Tp}({\cal{K}})$, storing the unary ${\cal{K}}$-type of $f_v$; \item \label{item:aut:Gamma} a tuple $(\tau^1_q, \dots, \tau^k_q) \in \mn{Tp}({\cal{K}})^k$ for some $k\leq M$, storing the unary ${\cal{K}}$-types of elements of $\Gamma_v$ (according to some arbitrary fixed order on $\Delta$); \item\label{item:aut:rt-in-Gamma} a value $i_q \in [0, k]$, where $i_q \in [1, k]$ indicates that $f_v$ is the $i_q$th element in $\Gamma_v$ and $i_q=0$ means that $f_v \notin \Gamma_v$; \item \label{item:aut:map} a partial function $\iota_q$ from $[1,k]$ to $[1, M]$, indicating which elements of $\Gamma_v$ are listed in $\tup{g}_v$ and their positions in the tuple of ${\cal{K}}$-types in the parent (this also provides $|\tup{g}_v|$); \item \label{item:aut:luggage} a binary reflexive relation $\leadsto_q$ over $[1,k]$ representing for each element in $\Gamma_v$, a subset of $\Gamma_v$ containing this element; \item \label{item:aut:relevant} a subset $R_q$ of $\mn{RCN}({\cal{K}})$ indicating concept names relevant for local elements in $v$; \item \label{item:aut:relevant-parent} a subset $R'_q$ of $\mn{RCN}({\cal{K}})$ indicating concept names relevant for local elements in the parent $v'$ of $v$; \item \label{item:aut:parent} a binary flag $\mathsf{sink}_q$ indicating whether $f_v$ is a sink or a source in the parent $v'$ of $v$; \item \label{item:aut:grandparent} a binary flag $\mathsf{sink}'_q$ indicating whether $f_{v'}$ is a sink or a source in the parent $v''$ of $v'$; \item a binary flag $\mathsf{abox}_q$ indicating whether ${\cal{I}}_v \models {\cal{A}}$. \end{enumerate} Moreover, we only allow combinations of these values that satisfy the following consistency conditions: \begin{itemize} \item if $i_q \neq 0$, then $\tau_q = \tau_q^{i_q}$ and $i_q \leadsto_q j$ for all $j \in [1,k]$; \item if $i \in \dom(\iota_q)$ and $i \leadsto_q j$, then $j \in \dom(\iota_q)$; \item if $\mathsf{sink}_q = 1$, then for each $A\in R'_q$ and $j \in [1,k]$ it holds that $A \in \tau_q^j$ implies $j \in \dom(\iota_q)$. \end{itemize} \subsubsection{KB automaton} Concept inclusions that involve only concept names are verified locally. For the remaining checks, apart from the information stored in the first component, it suffices to pass some aggregated information about each element that is shared between nodes; that is, $f_v$ and $\Gamma_v$ for each $v$. In what follows, by an $A$-successor we mean a successor that belongs to the extension of the concept $A$. Similarly for predecessors, direct successors, and direct predecessors. The second component of state $q$ at node $v$ stores: \begin{enumerate} \item a subset of $\dom(\iota_q)$, representing elements of $\Gamma_v$ shared with the parent of $v$ that are \emph{successors} of $f_v$ in the current subtree; \item a subset of $\dom(\iota_q)$, representing elements of $\Gamma_v$ shared with the parent of $v$ that are \emph{direct successors} of $f_v$ in the current subtree; \item for each $A\in \mn{CN}({\cal{K}})$, the counts of \begin{itemize} \item $A$-predecessors and direct $A$-predecessors (up to $1$), \item $A$-successors and direct $A$-successors (up to $N$) \end{itemize} of $f_v$ appearing in the current subtree as local elements; \item for each $i\in [1,k]$ and $A\in \mn{CN}({\cal{K}})$, the counts of \begin{itemize} \item $A$-successors and direct $A$-successors (up to $N$) \end{itemize} of the $i$th element of $\Gamma_v$ appearing as local elements in the subtree rooted at the node $w$ such that $f_w$ is the $i$th element of $\Gamma_v$. \end{enumerate} If $i_q \neq 0$, then the counts for the $i_q$th element of $\Gamma_v$ must be consistent with those for $f_v$. It is not difficult to maintain this information when processing the tree, detecting violations of ${\cal{K}}$ along the way. The latter is done when an element is \emph{forgotten}; that is, its record is not passed up the tree any more. This happens exactly in the node where the said element is fresh. Assuming that the current node is $v$, this includes elements internal in ${\cal{I}}_v$ and $f_w$ for each child $w$ of $v$ (among the latter, all elements of $\Gamma_v$ that are not listed in $\tup{g}_v$). For each such element we compute the current counts, based on ${\cal{I}}_v$ and the information passed from the children and the parent (including the information on elements of $\Gamma_v$ that are reachable from each $f_v$ and from other elements of $\Gamma_v$): because all counts refer to local elements in disjoint parts of the tree, there is no danger of counting anything twice. If the computed counts violate some restriction imposed by ${\cal{K}}$, the automaton rejects immediately. The maintanance amounts to updating the records for those elements $e$ that are not getting forgotten in the current node. Note that this requires accounting for those elements of $\Gamma_v$ that are reachable from $e$ and are getting forgotten in $v$. \todo{Finish maintanance.} Observe that correctness of this construction relies on the safety condition. Witnesses for positive counts of $A$-successors or $A$-predecessors must be found among elements reachable or backwards reachable from the elements in the current bag. Safety implies that these elements are contained within a finite fragment of the decomposition. \subsubsection{Query automaton} The automaton guesses a $Q$-refutation and verifies that it is consistent. The consistency condition, as given in Definition~\ref{def:consistency}, can be easily checked based on the label of the current node and the labels of the edges connecting it with its children, provided that we are given the values $\sigma(f_v)$ for all children $v$ of the current node. In fact, note that in the condition of Definition~\ref{def:consistency}, one can replace $\sigma(e)$ with $\sigma(e) \upharpoonright \{e\} \cup \Gamma_u$. This is precisely the information the automaton will pass between nodes: states of the query automaton are $Q$-types with parameters $[0, M]$, where $0$ represents $f_v$ and each $i > 0$ represents $\tup{g}_v^i$. Moreover, we only allow $Q$-types in which no $q \in Q$ occurs. \subsubsection{Computability} The set of states, initial states, and accepting states of the product automaton ${\cal{B}}_{{\cal{K}}, Q, \Theta}$ can be clearly computed within the desired complexity bounds. Let us see how to deal with $\mathsf{step}_{{\cal{B}}_{{\cal{K}}, Q, \Theta}}$. Let $P$ be a set of states of ${\cal{B}}_{{\cal{K}}, Q, \Theta}$ and $q$ a single state of ${\cal{B}}_{{\cal{K}}, Q, \Theta}$. As a first step we remove from $P$ all states that are incompatible with $q$. That is, we only keep states $p$ such that \begin{itemize} \item $\tau^i_p = \tau^{\iota_p(i)}_q$ for all $i \in \dom(\iota_p)$; \item $R'_p = R_q$; \item $\mathsf{sink}'_p = \mathsf{sink}_q$; \item if $\mathsf{sink}_p = 0$, then $A \notin \tau^i_q$ for all $A \in R_p$, $i \notin \mathsf{img}(\iota_p)$; \item $\left \{\iota_p(j) \bigm | i \leadsto_p j\right\} = \left \{j' \bigm | \iota_p(i) \leadsto_q j'\right\}$ for $i\in \dom(\iota_p)$; \item for all $i\in \dom(\iota_p)$ and all $A \in \mn{CN}({\cal{K}})$, the counts of $A$-successors and direct $A$-successors for $i$ in $p$ are equal to the respective counts for $\iota_p(i)$ in $q$. \end{itemize} Now, we shall construct a single-role $\ensuremath{(\ALCOIQfwd)^\smallplus}\xspace$ KB ${\cal{K}}'$ without at-most restrictions over closures of roles, a query $Q' \in\ensuremath{\mathcal{U\hspace{-0.15ex}C\hspace{-0.25ex}Q}}\xspace$, and a type set $\Theta'$ such that $(P, q) \in \mathsf{step}_{{\cal{B}}_{{\cal{K}},Q,\Theta}}$ iff ${\cal{K}}' \notmodels_{\!\!\mathsf{fin}}^{\Theta'} Q'$. For ${\cal{K}}$ in $\ensuremath{\ALCI^\smallplus}\xspace$, the construction almost directly gives ${\cal{K}}'$ in $\ensuremath{\ALCI^\smallplus}\xspace$: nominals are not needed because the sets $\Gamma_u$ are empty in ${\cal{K}}$-decompositions, and CIs using counting will not be added. If ${\cal{K}}$ is a $\ensuremath{\ALCQ^\smallplus}\xspace$ KB, ${\cal{K}}'$ will be in $\ensuremath{\ALCOQ^\smallplus}\xspace$. Nominals can be eliminated as explained in Appendix~\ref{sec:ABoxesNom}, but because the ABox is already trivial, there is no need of unravelling and the reduction will give only one instance of $\ensuremath{\ALCQ^\smallplus}\xspace$. \newcommand{\mathsf{Root}}{\mathsf{Root}} \newcommand{\mathsf{Sink}}{\mathsf{Sink}} \newcommand{\mathsf{Source}}{\mathsf{Source}} \newcommand{\mathsf{Internal}}{\mathsf{Internal}} \newcommand{\mathsf{Local}}{\mathsf{Local}} \newcommand{\mathsf{Gamma}}{\mathsf{Gamma}} \newcommand{\mathsf{External}}{\mathsf{External}} Let us start with ${\cal{K}}'$. The ABox mentions a single individual $a_0$ and specifies its unary type as $\tau_q$. The TBox uses nominals $a_1, \dots, a_k$ and specifies the unary type of $a_i$ as $\tau^i_q$. If $i_q = 0$, then $a_0 \notin \{a_1, \dots, a_k\}$; otherwise, $a_0 = a_{i_q}$. We include into ${\cal{K}}'$ the axioms \begin{align*} \mathsf{Root} & \equiv \{a_0\}\,,\\ \mathsf{Gamma} & \equiv \{a_1, \dots, a_k\}\,,\\ \mathsf{Sink} & \equiv \forall r. \bot \,,\\ \mathsf{Source} & \equiv \forall r^-. \bot \sqcap \exists r.\top\,,\\ \mathsf{Internal} & \equiv \lnot(\mathsf{Sink} \sqcup \mathsf{Source}) \,,\\ \mathsf{Local} & \equiv \mathsf{Internal} \sqcup \mathsf{Root} \,,\\ \mathsf{Gamma} & \sqsubseteq \mathsf{Sink} \sqcup \mathsf{Root} \end{align*} for fresh concept names $\mathsf{Root}$, $\mathsf{Gamma}$, $\mathsf{Sink}$, $\mathsf{Source}$, $\mathsf{Internal}$, and $\mathsf{Local}$. (If ${\cal{K}}$ does not use inverse roles, let $\mathsf{Source} \equiv \bot$.) For each CI $A \sqsubseteq \qnrleq n {r^*} B$ in ${\cal{K}}$ with $n>0$, if $B \in R_q$, then add \begin{align*} A \sqcap B \sqcap \mathsf{Local} & \sqsubseteq \mathsf{Gamma} \,, \end{align*} and otherwise add \begin{align*} A \sqcap \mathsf{Local} & \sqsubseteq \bot \,. \end{align*} Using these, we reformulate the CIs of ${\cal{K}}$ taking into account that some neighbours of non-internal elements are outside of the current bag. Aiming at reducing the number of cases, we model $\exists s. B$ as $\qnrgeq 1 s B$ and $\forall s. B$ as $\qnrleq 0 s {\overline B}$ for $s \in \big\{r^-, (r^-)^*\big\}$. To model neighbours inside and outside the current bag, for each $B \in \mn{CN}({\cal{K}}) \cup \{ \{a_i\} \bigm| 0\leq i \leq k\}$ and $n\leq N$ we introduce fresh concept names \[E_{\qnrleq n r B} \,, \quad E_{\qnrgeq n r B}\,, \quad E_{\qnrleq n {r^*} B} \,, \quad E_{\qnrgeq n {r^*} B}\,, \] \[E_{\qnrleq 0 {r^-} B} \,, \;\; E_{\qnrgeq 1 {r^-} B}\,, \;\; E_{\qnrleq 0 {(r^-)^*} B} \,, \;\; E_{\qnrgeq 1 {(r^-)^*} B} \,.\] Let $s \in\{r, r^-\}$. For each CI of the form $A \sqsubseteq \qnrgeq n s B$ in ${\cal{K}}$, we add \begin{align*} A &\sqsubseteq \bigsqcup_{i \leq n} {\qnrgeq i s B} \sqcap E_{\qnrgeq {n-i} s B} \,, \end{align*} and analogously for CIs of the form $A \sqsubseteq \qnrleq n s B$. For each CI of the form $A \sqsubseteq \qnrgeq 1 {s^*} B$, we add \begin{align*} % A \sqsubseteq \qnrgeq 1 {s^*} {E_{\qnrgeq 1 {s^*} B}} \,, \end{align*} and for each CI of the form $A \sqsubseteq \qnrleq {0} {s^*} B$, we add \begin{align*} A & \sqsubseteq \qnrleq 0 {s^*} {E_{\qnrgeq1 {s^*} {B}}} \,. \end{align*} For each CI of the form $A \sqsubseteq \qnrgeq {n} {r^*} B$, we add \begin{align*} % A \sqsubseteq \; \bigsqcup_{\alpha_0 + \sum_{i=1}^n \alpha_i\cdot i = n} \; F_{\qnrgeq {\alpha_0} {r^*} B} \sqcap \bigsqcap_{i=1}^n F_{\qnrgeq {(\alpha_i, i)} {r^*} B} \,,\\ \hspace{-7ex} F_{\qnrgeq {\alpha} {r^*} B} \sqsubseteq\; \bigsqcup _{I \subseteq [1,k]\colon \alpha \leq \sum_{i\in I} \ell^B_i} \;\bigsqcap_{i \in I} F_{\qnrgeq 1 {r^*} {\{a_i\}}} \,,\\ F_{\qnrgeq 1 {r^*} {\{a_i\}}} \sqsubseteq \qnrgeq 1 {r^*} {E_{\qnrgeq 1 {r^*} {\{a_i\}}}} \,,\\ F_{\qnrgeq {(\alpha,\beta)} {r^*} B} \sqsubseteq \qnrgeq {\alpha} {r^*} {\lnot \mathsf{Gamma} \sqcap E_{\qnreq {\beta}{r^*} B}} \,,\\ E_{\qnreq {\beta} {r^*} B} \sqsubseteq E_{\qnrleq {\beta} {r^*} B} \sqcap E_{\qnrgeq {\beta} {r^*} B} \end{align*} for $\alpha,\beta \leq N$, $i\in [1,k]$, where $\ell_i^B$ is the count of $B$-successors of $a_i$ stored in $q$. For each CI of the form $A \sqsubseteq \qnrleq {n} {r^*} B$ where $n>0$ and $B \in R_q$, we add \begin{align*} \mathsf{Local} \sqcap A &\sqsubseteq \bigsqcup_{O \subseteq \widehat B \colon |O| \leq n} \; \bigsqcap_{o \in \widehat B \setminus O} F_{\qnrleq 0 {r^*} {\{o\}}} \,,\\ F_{\qnrleq 0 {r^*} {\{a_i\}}} & \sqsubseteq \qnrleq 0 {r^*} { E_{\qnrgeq 1 {r^*} {\{a_i\}}}} \,, \end{align*} where $\widehat B = \left\{a_i \bigm | B \in \tau_q^i\right\}$. We need to ensure that the concepts modelling neighbours are interpreted in a way consistent with the information in the states. First, we ensure that internal elements do not have any external neighbours by adding \begin{align*} \mathsf{Internal} & \sqsubseteq \bigsqcap_{n \geq 0} E_{\qnrleq n s B} \,,\\ \mathsf{Internal} & \sqsubseteq E_{\qnrgeq 0 s B} \sqcap \bigsqcap_{n > 0} \lnot E_{\qnrgeq n s B} \,,\\ \lnot B \sqcap \mathsf{Internal} & \sqsubseteq \bigsqcap_{n \geq 0} E_{\qnrleq n {s^*} B} \,,\\ \lnot B \sqcap \mathsf{Internal} & \sqsubseteq E_{\qnrgeq 0 {s^*} B} \sqcap \bigsqcap_{n > 0} \lnot E_{\qnrgeq n {s^*} B} \,,\\ B \sqcap \mathsf{Internal} & \sqsubseteq \lnot E_{\qnrleq 0 {s^*} B} \sqcap \bigsqcap_{n > 0} E_{\qnrleq n {s^*} B} \,,\\ B \sqcap \mathsf{Internal} & \sqsubseteq \bigsqcap_{n \leq 1} E_{\qnrgeq n {s^*} B} \sqcap \bigsqcap_{n > 1} \lnot E_{\qnrgeq n {s^*} B} \end{align*} for all $B \in \mn{CN}({\cal{K}}) \cup \{ \{a_i\} \bigm| 0\leq i \leq k\}$ and $s \in \left\{r, r^-\right\}$. Next, we take care of sinks. For those not in $\{a_0, a_1\dots, a_k\}$ we let \begin{align*} \mathsf{Sink} \sqcap \lnot (\mathsf{Gamma}\sqcup \mathsf{Root})\sqsubseteq \;\bigsqcup_{\substack{p \in P \colon i_p \notin \dom(\iota_p)\\ \mathsf{sink}_p=1}} \;\bigsqcap_{A \in \widehat\tau_p}\; A \,, \end{align*} where $\widehat \tau_p$ is the extension of $\tau_p$ to concept names $E_{\qnrleq n t B}$ and $E_{\qnrgeq n t B}$ that reflects the counts of neighbours in the current subtree stored in $p$. For $a_i$ with $i \notin \dom(\iota_q)$ the condition is similar: \begin{align*} \{a_i\} \sqsubseteq \;\bigsqcup_{p \in P \colon \iota_p(i_p) =i} \;\bigsqcap_{A \in \widehat\tau_p}\; A \,. \end{align*} \todo{Finish backwards requirements for local nominals. } For $a_i$ with $i \in \dom(\iota_q)$, different from $a_0$, the condition is extracted exclusively from the counts stored in $q$; an appropriate subtree will be provided in the bag where the element corresponding to $a_i$ is fresh. For sources different from $a_0$, shared elements might be successors or direct successors both in the current bag and outside. To handle that, for each conjunction $C$ choosing either $\qnrleq 0 t {\{ a_i\}}$ or $\qnrgeq 1 t {\{ a_i\}}$ for each $t\in\{r, r^*\}$ and $i\in [1,k]$, we add a separate conditions \begin{align*} C \sqcap \mathsf{Source} \sqcap \lnot \mathsf{Root} \sqsubseteq \;\bigsqcup_{\substack{p \in P \colon i_p \notin \dom(\iota_p)\\ \mathsf{sink}_p = 0}} \;\bigsqcap_{A \in \widehat\tau_p^C}\; A \,, \end{align*} in which $\widehat \tau_p^C$ accounts for the connections to $a_i$ with $i \in \mathsf{img}(\iota_p)$ described in $C$. Finally, we let \begin{align*} \{a_0\} \sqsubseteq \bigsqcap_{A \in \widehat\tau_q}\; A \,, \end{align*} where $\widehat \tau_q$ extracts information about counts of external neighbours from the counts in the current subtree stored in $q$ and the total counts represented in the ${\cal{K}}$-type $\tau_q$. Note that many disjunctions above have doubly exponential length. To avoid blowup, instead of actually putting them into ${\cal{K}}'$ we encode them in the type set $\Theta'$, by filtering out types that do not satisfy them. Of course, $\Theta'$ also filters out types that are not extensions of types from $\Theta$. Let us deal with the query now. \begin{definition}[unary $Q$-type] A unary $Q$-type with parameters $\Gamma$ is a set of triples of the form $(p, V, \eta)$ such that $p$ is a fragment of $Q$, $V \subseteq \textit{var}(p)$, and $\eta$ is a partial mapping from $\textit{var}(p) \setminus V$ to $\Gamma$. \end{definition} The definition below captures the condition relating the the $Q$-type stored in state $q$ with $Q$-types stored in states from $P$. The function $\Sigma$ it mentions in our case maps each $\tau \in \mn{Tp}({\cal{K}}')$ to the set $\Sigma(\tau)$ of unary $Q$-types with parameters $\{a_1, a_2, \dots, a_k\}$, \[\left\{ \big( f, \eta^{-1}(\{0\}), a_*\circ \iota_p \circ \eta\upharpoonright [1,k] \setminus \{i_p\} \big) \bigm | (f, \eta) \in \tau^Q_p \right\},\] where $a_*$ is a function mapping $i$ to $a_i$, $\tau^Q_p$ is the $Q$-type the stored in state $p$, and $p$ ranges over states in $ P$ that are compatible with $\tau$; that is, satisfy one of the following conditions: \begin{itemize} \item $\left\{\mathsf{Sink}, \overline{\mathsf{Gamma}}, \overline{\mathsf{Root}}\right\} \cup \widehat \tau_p\subseteq \tau$, $\mathsf{sink}_p \!=\! 1$, $i_p \!\notin\! \dom(\iota_p)$, \item $\left\{\mathsf{Source}, \overline{\mathsf{Root}}\right\} \cup \widehat \tau_p^C \cup C \subseteq \tau$, $\mathsf{sink}_p = 0$, $i_p \notin \dom(\iota_p)$, \item $\left\{\{a_i\}\right\} \cup \tau_p \subseteq \tau$, $\iota_p(i_p) =i \notin \dom(\iota_q)$. \end{itemize} \begin{definition} [weak realizability modulo] Consider a KB ${\cal{K}}'$, a $Q$-type $\tau$ with parameters $\Gamma \subseteq \mn{ind}({\cal{K}}')$, and a function $\Sigma$ mapping unary ${\cal{K}}'$-types to sets of unary $Q$-types with parameters $\Gamma$. The $Q$-type $\tau$ is \emph{weakly realized modulo $\Sigma$} in a ${\cal{K}}'$-interpretation ${\cal{M}}$ if \[\tau \supseteq \bigg(\mn{wtp}^{\cal{M}}_Q\big(\Gamma\cup\dom(\sigma)\big) \oplus \bigoplus_{d\in \dom(\sigma)} \sigma(d) \bigg) \upharpoonright \Gamma\,.\] for some partial function $\sigma$ mapping elements $d\in\Delta^{\cal{M}}$ to $Q$-types $\sigma(d)$ with parameters $\{d\} \cup \Gamma$ such that $ \left \{ \left(p, \eta^{-1}(d), \eta\upharpoonright \Gamma\right) \bigm | (p,\eta)\in\sigma(d) \right\} \in \Sigma\big(\mn{tp}^{{\cal{K}}'}_{\cal{M}}(d)\big)$. \end{definition} \begin{lemma} Given $Q\in\ensuremath{\UCQ^\smallplus}\xspace$, a KB ${\cal{K}}'$, a set $\Theta' \subseteq \mn{Tp}({\cal{K}}')$, a $Q$-type $\tau$ with parameters $\Gamma \subseteq \mn{ind}({\cal{K}}')$, and a function $\Sigma$ mapping unary ${\cal{K}}'$-types to sets of unary $Q$-types with parameters $\Gamma$, one can construct $Q'\in \ensuremath{\mathcal{U\hspace{-0.15ex}C\hspace{-0.25ex}Q}}\xspace$ and $\Theta''$ such that ${\cal{K}}' \models_{\mathsf{fin}}^{\Theta''} Q'$ if $\tau$ is weakly realizable modulo $\Sigma$ in a finite model of ${\cal{K}}'$ realizing only types from $\Theta'$. \end{lemma} \begin{proof} For each triple of the form $(p, V, \eta)$ such that $p$ is a subquery of a query from $Q$, $V \subseteq \textit{var}(p)$, and $\eta$ is a partial mapping from $\textit{var}(p) \setminus V$ to $\Gamma$, introduce a concept $A_{p, V, \eta}$. This adds $|Q|\cdot 2^m\cdot (|\Gamma|+1)^n$ concepts, where $m = \max_{q\in Q}|q|$ and $n = \max_{q\in Q} |\textit{var}(q)|$. Let $\Theta''$ be the set of all unary types (over the extended set of concept names) of the form $\theta \cup \theta'$ where $\theta \in \Theta'$ and there exists a unary $Q$-type $\upsilon \in \Sigma(\theta)$ such that $\overline{A_{p, V, \eta}} \in \theta'$ for all $(p, V, \eta) \in \upsilon$. In the model we seek, we shall allow only unary types from $\Theta''$. We now define a query $Q' \in \ensuremath{\mathcal{U\hspace{-0.15ex}C\hspace{-0.25ex}Q}}\xspace$ that will be forbidden in the model we seek. Choose \begin{itemize} \item a fragment $p$ of $Q$ and a partial mapping from $\textit{var}(p)$ to $\Gamma$ such that $(p, \eta) \notin \tau$; \item a partition of $p$ into fragments $p'$ and $p_1, \dots, p_k$ such that $\textit{var}(p_i) \cap \textit{var}(p_j) \subseteq \textit{var}(p') \cup \eta^{-1}(\Gamma)$ for all $i \neq j$; \item a localization $p''$ of $p'$. \end{itemize} For each choice, add to $Q'$ the query $\eta(p'' \land \bigwedge_{i=1}^k \widetilde p_i)$, where \begin{align*} \widetilde p_i &= A_{p_i, V_i, \eta_i}(y_i) \land \bigwedge_{x \in V_i} x = y_i\,,\\ \eta_i &= \eta\upharpoonright \textit{var}(p_i)\,,\\ V_i &= \textit{var}(p_i) \cap \textit{var}(p') \setminus \eta^{-1}(\Gamma)\,, \end{align*} and $y_i$ is a fresh variable. With $m = \max_{q \in Q} |q|$, we have \[|Q'| \leq \big(|Q|\cdot 2^m \cdot (|\Gamma|+1)^n\big) \cdot m^m \cdot 2^m \] and, after eliminating equality atoms in the usual, way each conjunctive query in $Q'$ has size $O(m)$. \end{proof} \subsection{Proof of Lemma~\ref{lem:folding-correct}} Let us call an interpretion \emph{$\ell$-bounded} if the length of simple directed paths in this interpretation is at most $\ell$. \begin{lemma} \label{lem:bounded-transfer} ${\cal{F}}$ is $\ell$-bounded. \end{lemma} \begin{proof} Redirected edges orginate in ${\cal{I}}_u$ such that $f_u$ is a source in ${\cal{I}}_{u'}$ for the parent $u'$ of $u$, and lead to $f_{\hat v}$ that is a sink in ${\cal{I}}_{\hat v'}$ for the parent $\hat v'$ of $\hat v$. Consequently, a simple directed path $\pi$ taking an edge redirected from $f_v$ to $f_{\hat v}$ (as the first redirected edge) cannot reach the origin of another redirected edge. Hence, the suffix of $\pi$ starting in $f_{\hat v}$ is a path in ${\cal{I}}'$, and its length is bounded by $\ell$. Because $N^{{\cal{I}}_n}_n(f_{v})\simeq N^{{\cal{I}}_n}_n(f_{\hat v})$ and $n\geq \ell$, a simple directed path originating in $f_{v}$, of the same length as the suffix, can be found in ${\cal{I}}'$. Consequently, there exists a simple path in ${\cal{I}}'$ of the same length as $\pi$: instead of taking the redirected edge, take the original edge to $f_v$ and continue from there; because $\pi$ enters $f_v$ from ${\cal{I}}_{v'}$ for the parent $v'$ of $v$, and $f_v$ is a sink in ${\cal{I}}_{v'}$, the resulting path is indeed simple. It follows that the length of the whole $\pi$ is bounded by $\ell$. \end{proof} \begin{lemma} ${\cal{F}} \models {\cal{K}}$. \end{lemma} \begin{proof} Because the unary types of $f_v$ and $f_{\hat v}$ coincide, redirections of edges do not violate concept inclusions of ${\cal{K}}$ that do not involve transitive closure. In $\ell$-bounded interpretations, each universal restriction is equivalent to not satisfying a UCQ with at most $\ell$ binary atoms per CQ. Consequently, ${\cal{F}}$ satisfies all universal restrictions by Fact~\ref{fact:coloured-blocking}. It remains to verify existential restrictions involving transitive closure. Consider a forward path $\pi$ witnessing an existential restriction in ${\cal{I}}'$ and suppose that the origin of this path is still in still in ${\cal{F}}$. Because ${\cal{I}}'$ is $\ell$-bounded, the path has length at most $\ell$. If this path does not pass through a redirected edge, we are done. Suppose that it does pass an edge redirected from $f_v$ to $f_{\hat v}$. Then we can transfer the suffix of the path after $f_v$ to $f_{\hat v}$, because $N^{{\cal{I}}_n}_n(f_{v})\simeq N^{{\cal{I}}_n}_n(f_{\hat v})$ and $n\geq \ell$. Like in the proof of Lemma~\ref{lem:bounded-transfer}, the transferred suffix cannot take another redirected edge, and we are done. \end{proof} \section{Outlook} This paper provides first positive results on finite entailment of non-local queries over DLs knowledge bases. The main technical contribution is optimal \ensuremath{\textsc{2ExpTime}}\xspace upper bounds for finite entailment of $\ensuremath{\UCQ^\smallplus}\xspace\!$s over \ensuremath{\ALCOI^\smallplus}\xspace and \ensuremath{\ALCOQ^\smallplus}\xspace knowledge bases. To obtain these results, we have shown intermediate reductions that are interesting in their own, and could be applied to similar settings. \smallskip There are several directions to follow for future work. A first possibility is to vary the DL language. One could consider lightweight DLs from the $\mathcal{EL}$ and \textsl{DL-Lite} families or extensions of \ensuremath{\ALCOI^\smallplus}\xspace with e.g. role inclusions. For the latter, a different approach to the one proposed here is needed because our techniques rely on the lack of interaction between different roles. Another option is to allow for controlled interaction of inverses and number restrictions as e.g.\ in \ensuremath{(\ALCIQfwd)^\smallplus}\xspace. A second possibility is to consider more expressive non-local queries, such as positive regular path queries. In this case new techniques seem to be needed, e.g.\ the coloured blocking principle does not work for PRPQs. \section{Hardness} \par \noindent {\bf Theorem~\ref{thm:LoweBound}} Finite entailment of $\ensuremath{\CQ^\smallplus}\xspace\!$s over \ALC knowledge bases is \ensuremath{\textsc{2ExpTime}}\xspace-hard. \newcommand{\ensuremath{\Kmc_{(\Mmc, w)}}}{\ensuremath{\Kmc_{(\Mmc, w)}}} \newcommand{\ensuremath{q_{\Mmc,w}}}{\ensuremath{q_{\Mmc,w}}} \begin{proof} We reduce the word problem of exponentially space bounded alternating Turing machines. For each input word $w$ to $\Mmc= (Q, \Sigma, q_0, \delta)$, we define an \ALC knowledge base $\ensuremath{\Kmc_{(\Mmc, w)}}$ and a $\ensuremath{\CQ^\smallplus}\xspace\!$ $q$ such that $\Mmc$ accepts $w$ iff there is a counter-model of $\ensuremath{\Kmc_{(\Mmc, w)}}$ and $\ensuremath{q_{\Mmc,w}}$. Each finite forest counter-model of $\ensuremath{\Kmc_{(\Mmc, w)}}$ and $\ensuremath{q_{\Mmc,w}}$ will represent an accepting computation of $\Mmc$ and $w$. Our encoding follows closely the one use in~\cite{EiterLOS09} to show that (arbitrary) entailment of CQs over $\mathcal{SH}$ knowledge bases is \ensuremath{\textsc{2ExpTime}}\xspace-hard. In particular, each tree model of $\ensuremath{\Kmc_{(\Mmc, w)}}$ encodes an accepting \emph{computation tree} in which each node is the root of a \emph{configuration tree} (see Figure~\ref{fig:comp-tree}). Notably, there are two consecutive edges connecting a configuration tree and any of its successor configurations. Further, each configuration tree is a complete binary tree of depth equal to the length of the input word $|w|$, and whose leaves shall store the tape contents using a \emph{cell gadget} as illustrated in Figure~\ref{fig:conf-tree}. Each \emph{cell gadget} records the current (right descendants) and the previous (left descendants) configuration of $\Mmc$. The particular structure of a cell gadget is illustrated in Figure~\ref{fig:cell-gadget}. The root of each gadget cell is labelled with concepts names $B_1, \dots, B_m$ that encode (in binary) the position of the cell in the tape. The node labelled with concept name $E_h$ records pairs $(q,a)$ (not) satisfied in the current configuration, whereas $F_h$ records all possible pairs $(q,a)$ with $q \in Q$ and $a \in \Sigma$ using concept names $Z_{q,a}$. The actual content of the cell in the current (previous) configuration is recorded in the node labelled by $G_h$ ($G_p$) using a concept name for each symbol in $\Sigma$; symmetrically, the node $F_p$ records the pairs (not) satisfied in the previous configuration and $E_p$ all possible pairs $(q,a)$. Concept inclusions in $\ensuremath{\Kmc_{(\Mmc, w)}}$ to enforce the structure fo configuration trees are rather standard and use a single role $r$. They ensure locally that in every gadget the current configuration is indeed a successor of the previous configuration. All the relevant axioms to ensure this from the encoding in ~\cite{EiterLOS09} can be expressed in \ALC. \medskip We will use a $\ensuremath{\CQ^\smallplus}\xspace\!$ $q_w$ to ensure that computation trees are \emph{proper}, i.e., that the previous configuration recorded in each configuration tree $T$ coincides with the current configuration recorded in all its successors $T'$. This property can be characterised as follows: \begin{lemma}[Proposition 4 in~\cite{EiterLOS09}]\label{lemma:ProperLB} A computation tree is not proper iff there exists a cell gadget $n$ in some configuration tree $T$ and a cell gadget $n'$ in a successor configuration of $T$ such that for all $A \in \Bbf \cup \Zbf$ \begin{itemize} \item[$(\dagger)$] $A$ is true at the $E_h$-node of $n$ and the $E_p$-node of $n'$, or \item[$(\ddagger)$] $A$ is true at the $F_h$-node of $n$ and the $F_p$-node of $n$. \end{itemize} \end{lemma} where $\Bbf = \{B_1, \dots, B_m\}$ is the set of all concept names used to encode the cell addresses, and $\Zbf = \{ Z_{q,a} \mid q \in Q, a\in \Sigma \}$ is the set of concept names used as markers in the cell gadgets. Notably, (the proof of) Lemma~\ref{lemma:ProperLB} does not rely on the use of role inclusions not transitive roles in the encoding. Thus, the query $q_w$ should be able to test properties $(\dagger)$ and $(\ddagger)$ for each $A \in \Bbf \cup \Zbf$. We achieve this by taking a copy of the query shown in Figure~\ref{fig:BasicQ}, for each $A \in \Bbf \cup \Zbf$. Possible matches of one of these copies in a computation tree are illustrated on Figure~\ref{fig:BasicQ}. The required query $q_w$ is the conjunction of all these copies. \end{proof} \begin{figure}\caption{ATM computations}\label{fig:comp-tree} \centerline{% \begin{tikzpicture}[>=latex,point/.style={circle,draw=black,minimum size=1.4mm,inner sep=0pt}] \node[point, fill=black] (t1) at (0,2){}; \node[point, fill=black] (t12) at (1.5,1.5){}; \node[point, fill=black] (t22) at (3,1){}; \node[point, fill=black] (t13) at (4.5,0.5){}; \node[point, fill=black] (t23) at (6,0){}; \node[point,fill=black] (t14) at (4.5,2){}; \node[point, fill=black] (t24) at (6,3){}; \draw[thin] (0,2) -- (-1,0) -- (1,0) -- cycle; \draw[->,out=10,in=130](t1) to node[pos=0.5,sloped, above] {$r$} (t12); \draw[->,out=10,in=130](t12) to node[pos=0.5,sloped, above] {$r$} (t22); \draw[->,out=10,in=130](t22) to node[pos=0.5,sloped, above] {$r$} (t13); \draw[->,out=10,in=130](t13) to node[pos=0.5,sloped, above] {$r$} (t23); \draw[->,out=70,in=180](t14) to node[pos=0.5,sloped, above] {$r$} (t24); \draw[->,out=70,in=180](t22) to node[pos=0.5,sloped, above] {$r$} (t14); \draw[thin] (3,1) -- (2,-1) -- (4,-1) -- cycle; \draw[thin] (6,3) -- (5,1) -- (7,1) -- cycle; \draw[thin] (6,0) -- (5,-2) -- (7,-2) -- cycle; \end{tikzpicture}% } \end{figure} \begin{figure}\caption{Configuration Tree}\label{fig:conf-tree} \centerline{ \begin{tikzpicture}[>=latex,thick,point/.style={circle,draw=black,minimum size=1.4mm,inner sep=0pt}] \coordinate (A) at (0,3); \coordinate (B) at (-4,0); \coordinate(C) at (4,0); \draw[color=gray] (A) -- (B) -- (C) -- cycle; \foreach \x in {-4, 0, 4}{ \node[point, fill=black] (cp) at (\x,0) {}; \node[point, fill=black] (lp) at (\x-0.5,-0.7) {}; \node[point, fill=black] (llp) at (\x-0.5,-1.4) {}; \node[point, fill=black] (lllp) at (\x-0.5,-2.1) {}; \node[point, fill=black] (rp) at (\x+0.5,-0.7) {}; \node[point, fill=black] (rrp) at (\x+0.5,-1.4) {}; \node[point, fill=black] (rrrp) at (\x+0.5,-2.1) {}; % \draw[->] (cp) to node[pos=0.5,sloped, above] {$r$} (lp); \draw[->] (cp) to node[pos=0.5,sloped, above] {$r$} (rp); \draw[->] (lp) to node[pos=0.5, left] {$r$} (llp); \draw[->] (llp) to node[pos=0.5, left] {$r$} (lllp); \draw[->] (rp) to node[pos=0.5, right] {$r$} (rrp); \draw[->] (rrp) to node[pos=0.5, right] {$r$} (rrrp); } \node at (-2,-1.4){$\dots$}; \node at (2,-1.4){$\dots$}; \draw[color=gray, zigzag] (A) to node[pos= 0.5, right]{$|w|$} (0,0); \end{tikzpicture}% } \end{figure} \begin{figure}\caption{Cell gadget}\label{fig:cell-gadget} \centerline{% \begin{tikzpicture}[>=latex,thick,point/.style={circle,draw=black,minimum size=1.4mm,inner sep=0pt}] \node[point, fill=black, label=above:{$L_m$}] (cp) at (0,0) {}; \node[point, fill=black, label=left:{$E_P,X$}] (lp) at (-1,-1) {}; \node[point, fill=black, label=left:{$F_P,X$}] (llp) at (-1,-2.3) {}; \node[point, fill=black, label=left:{$G_P$}] (lllp) at (-1,-3.3) {}; \node[point, fill=black, label=right:{$E_h,X$}] (rp) at (1,-1) {}; \node[point, fill=black, label=right:{$F_h,X$}] (rrp) at (1,-2.3) {}; \node[point, fill=black, label=left:{$G_h$}] (rrrp) at (1,-3.3) {}; \draw[->] (cp) to node[pos=0.5,sloped, above] {$r$} (lp); \draw[->] (cp) to node[pos=0.5,sloped, above] {$r$} (rp); \draw[->] (lp) to node[pos=0.5, left] {$r$} (llp); \draw[->] (llp) to node[pos=0.5, left] {$r$} (lllp); \draw[->] (rp) to node[pos=0.5, right] {$r$} (rrp); \draw[->] (rrp) to node[pos=0.5, right] {$r$} (rrrp); \end{tikzpicture} } \end{figure} \begin{figure*}\caption{Basic Query}\label{fig:BasicQ} \centerline{ \begin{tikzpicture}[>=latex,thick,point/.style={circle,draw=black,minimum size=1.4mm,inner sep=0pt}] \node[point, fill=white, label=above:{$x$}] (x) at (0,0) {}; \node[point, fill=white, label=left:{$y_0$}] (y0) at (-1,-1) {}; \node[point, fill=white, label=left:{$y_1$}] (y1) at (-1,-2.3) {}; \node[point, fill=white, label=left:{$y_m$}] (ym) at (-1,-3.5) {}; \node[point, fill=white, label=left:{$y_{m+1}$}, label= right:{$X, A$}] (X) at (-1,-3.5- 1.3) {}; \node[point, fill=white, label=below:{$u$}, label= right:{$G_h$}] (Gh) at (-1,-3.5 - 2.6) {}; \node[point, fill=white, label=right:{$z_0$}] (z0) at (1,-1) {}; \node[point, fill=white, label=right:{$z_1$}] (z1) at (1,-2.3) {}; \node[point, fill=white, label=right:{$z_{m+2}$}] (zm2) at (1,-5) {}; \node[point, fill=white, label=right:{$z_{m+3}$}, label=left:{$X, A$}] (XR) at (1,-5-1.3) {}; \node[point, fill=white, label=below:{$v$}, label=left:{$G_p$}] (Gp) at (1,-5-2.6) {}; \draw[->] (x) to node[pos=0.5,sloped, above] {$r$} (y0); \draw[->] (x) to node[pos=0.5,sloped, above] {$r$} (z0); \draw[->] (y0) to node[pos=0.5, left] {$r$} (y1); \draw[->,dotted](y1) to (ym); \draw[->] (ym) to node[pos=0.5, left] {$r$} (X); \draw[->] (zm2) to node[pos=0.5, right] {$r$} (XR); \draw[->] (X) to node[pos=0.5, left] {$r^+$} (Gh); \draw[->] (XR) to node[pos=0.5, right] {$r^+$} (Gp); \draw[->] (z0) to node[pos=0.5, right] {$r$} (z1); \draw[->,dotted] (z1) to (zm2); \coordinate (A) at (7,0); \coordinate (B) at (5,-3); \coordinate(C) at (9,-3); \draw[color=gray] (A) -- (B) -- (C) -- cycle; \node[point, fill=black, label=above right:$L_0$] at (A) {}; \node[point, fill=black, label=above right:$L_0$] at (12,-1) {}; \draw[color=gray] (12,-1) -- (10,-4) -- (14,-4) -- cycle; \node[point, fill=black] (p) at (9.5, -0.5){}; \draw[->] (A) to node[pos=0.5, above]{$r$} (p); \draw[->] (5,0) to node[pos=0.5, above]{$r$} (A); \draw[->] (3,0) to node[pos=0.5, above]{$r$} (5,0); \draw[->](p) to node[pos=0.5, above]{$r$} (12,-1); \node[shift={(7,-3)}, point, fill=black, label=above:{$L_m$}] (cp) at (0,0) {}; \node[shift={(7,-3)}, point, fill=black, label=left:{$E_P,X$}] (lp) at (-1,-1) {}; \node[shift={(7,-3)}, point, fill=black, label=left:{$F_P,X$}] (llp) at (-1,-2.3) {}; \node[shift={(7,-3)}, point, fill=black, label=left:{$G_P$}] (lllp) at (-1,-3.3) {}; \node[shift={(7,-3)}, point, fill=black, label=right:{$E_h,X$}] (rp) at (1,-1) {}; \node[shift={(7,-3)}, point, fill=black, label=right:{$F_h,X$}] (rrp) at (1,-2.3) {}; \node[shift={(7,-3)}, point, fill=black, label=left:{$G_h$}] (rrrp) at (1,-3.3) {}; \draw[->] (cp) to node[pos=0.5,sloped, above] {$r$} (lp); \draw[->] (cp) to node[pos=0.5,sloped, above] {$r$} (rp); \draw[->] (lp) to node[pos=0.5, left] {$r$} (llp); \draw[->] (llp) to node[pos=0.5, left] {$r$} (lllp); \draw[->] (rp) to node[pos=0.5, right] {$r$} (rrp); \draw[->] (rrp) to node[pos=0.5, right] {$r$} (rrrp); \node[shift={(12,-4)}, point, fill=black, label=above:{$L_m$}] (Lm) at (0,0) {}; \node[shift={(12,-4)}, point, fill=black, label=left:{$E_P,X$}] (EP) at (-1,-1) {}; \node[shift={(12,-4)}, point, fill=black, label=left:{$F_P,X$}] (FP) at (-1,-2.3) {}; \node[shift={(12,-4)}, point, fill=black, label=left:{$G_P$}] (GP) at (-1,-3.3) {}; \node[shift={(12,-4)}, point, fill=black, label=right:{$E_h,X$}] (EH) at (1,-1) {}; \node[shift={(12,-4)}, point, fill=black, label=right:{$F_h,X$}] (FH) at (1,-2.3) {}; \node[shift={(12,-4)}, point, fill=black, label=left:{$G_h$}] (GH) at (1,-3.3) {}; \draw[->] (Lm) to node[pos=0.5,sloped, above] {$r$} (EP); \draw[->] (Lm) to node[pos=0.5,sloped, above] {$r$} (EH); \draw[->] (EP) to node[pos=0.5, left] {$r$} (FP); \draw[->] (FP) to node[pos=0.5, left] {$r$} (GP); \draw[->] (EH) to node[pos=0.5, right] {$r$} (FH); \draw[->] (FH) to node[pos=0.5, right] {$r$} (GH); \draw[dashed,out=-20,in=200,] (Gp) to (GP); \draw[dashed,out=10,in=170] (Gh) to (rrrp); \draw[dashed,out=10,in=170, blue] (X) to (rrp); \draw[dashed,out=20,in=160, orange] (X) to (rp); \draw[dashed,out=20,in=160, blue] (x) to (A); \draw[dashed,out=-20,in=200, orange] (x) to (5,0); \draw[dashed,out=-20,in=200, orange] (z0) to (A); \draw[dashed,out=-20,in=200, blue] (z0) to (p); \draw[dashed,out=-20,in=200, blue] (XR) to (FP); \draw[dashed,out=-20,in=220, orange] (XR) to (EP); \end{tikzpicture}} \end{figure*} \section{Introduction} The use of ontologies to provide background knowledge for enriching answers to queries posed to a database is a major research topic in the fields of knowledge representation and reasoning. In this data-centric setting, various options for the formalisms used to express ontologies and queries exist, but popular choices are description logics (DLs) and either unions of conjunctive queries (UCQs) or navigational queries. The main reasoning problem in this scenario is query entailment, which has been extensively investigated for different combinations of DLs and query languages. An important assumption in data-centric applications is that both database instances and the models they represent are finite. The study of \emph{finite} query entailment, where one is interested in reasoning over finite models only, is thus paramount. Even so, the finite model semantics has received far less attention than the unrestricted one. Prior work on finite query entailment in description logics has concentrated on \emph{local} queries, UCQs in particular~\cite{Rosati08,GarciaLS14,AmarilliB15,GogaczIM18,Kieronski18,GogaczGIJM19}. The single work studying extensions of UCQs \cite{Rudolph16}, brings only undecidability results for navigational queries and various expressive description logics. In contrast, for unrestricted entailment a large body of literature is available, providing multiple positive results for navigational queries and both expressive and lightweight DLs \cite{CalvaneseEO14,StefanoniMKR14,BienvenuOS15,JungLMS17,GuIbJu-AAAI18,GogaczGIJM19,BednarczykR19}. The lack of research on finite entailment of non-local queries (e.g.\ variants of regular path queries) comes as a surprise since, as noted in the above works, they are necessary in data centric applications dealing with graph databases. In this paper, we close the distance to the undecidability frontier for finite entailment delineated by \citeauthor{Rudolph16}~(\citeyear{Rudolph16}) by identifying some decidable classes of non-local ontology-mediated queries. We focus on UCQs with transitive closure over roles; from the viewpoint of DL applications, transitive closure is arguably one of the most useful features of regular expressions over roles. As the ontology component, we consider extensions of the DL \ALC, allowing for transitive closure of roles. The study of finite entailment is relevant for this combination because, unlike for plain CQs, query entailment of CQs with transitive closure is not finitely controllable even for \ALC, and thus finite and unrestricted entailment do not coincide. As a consequence, dedicated algorithmic methods and lower bounds need to be developed. Our main finding is that finite entailment of UCQs with transitive closure over \ensuremath{\ALCOI^\smallplus}\xspace or \ensuremath{\ALCOQ^\smallplus}\xspace knowledge bases is \ensuremath{\textsc{2ExpTime}}\xspace-complete. As unrestricted entailment of positive regular path queries is \ensuremath{\textsc{2ExpTime}}\xspace-complete for both logics~\cite{CalvaneseEO14,BednarczykR19}, and the hardness already holds for CQs and both \ALCI and \ALCO ~\cite{DBLP:conf/cade/Lutz08,DBLP:conf/kr/NgoOS16}, we have that the complexity of our setting is the same over arbitrary and finite models. As finite entailment of two-way regular path queries over $\mathcal{ALCIOF}$ knowledge bases is undecidable~\cite{Rudolph16}, our results are quite close to the undecidability frontier. While there exist positive results on finite entailment in expressive DLs related to \ensuremath{\ALCOI^\smallplus}\xspace or \ensuremath{\ALCOQ^\smallplus}\xspace, they are all about local queries. For example, the \ensuremath{\textsc{2ExpTime}}\xspace algorithms for finite entailment of UCQs over \ensuremath{{\cal{S\hspace{-0.2ex}O\hspace{-0.06ex}I}}}\xspace, \ensuremath{{\cal{S\hspace{-0.06ex}I\hspace{-0.1ex}F}}}\xspace, and \SOQ knowledge bases~\cite{GogaczIM18,GogaczGIJM19} are considerably easier to obtain due to the relatively simple structure of transitive roles. For the more expressive \SHOIF, the problem becomes undecidable~\cite{Rudolph16}. Indeed, to the best of our knowledge, this paper offers the first positive results on finite entailment of non-local queries in description logics. In order to show our main result, we provide a series of intermediate reductions allowing us to work with simpler variants of the input logics and query formalisms. The reductions apply to both logics, requiring sometimes conceptually different proofs for each of them. Our proofs encompass different techniques. We use unravelling operations to establish a tree-like model property, i.e.\ to show that if a query is not entailed by a knowledge base, then there is a tree-like counter-model. This in turn serves as the basis for automata-based approaches to finite entailment. We also use the coloured blocking principle to construct appropriate finite counter-models out of infinite tree-like counter-models. \section*{Acknowledgments} This work was supported by Poland's National Science Centre grant 2018/30/E/ST6/00042. \section{Eliminating Multiple Roles}~\label{sec:mulroles} Moving on with simplifications, we reduce finite entailment of $\ensuremath{\UCQ^\smallplus}\xspace$s over $\ensuremath{\ALCI^\smallplus}\xspace$ or $\ensuremath{\ALCQ^\smallplus}\xspace$ KBs to the single-role case. More precisely, we show how to solve one instance of finite entailment by solving many instances of finite entailment modulo types with single-role KBs. Let ${\cal{K}} = ({\cal{T}},{\cal{A}})$ be an $\ensuremath{\ALCI^\smallplus}\xspace$ or $\ensuremath{\ALCQ^\smallplus}\xspace$ KB, $Q \in \ensuremath{\UCQ^\smallplus}\xspace$ and $ m = \max_{q\in Q} |q|$. One can decide if ${\cal{K}}\models_{\mathsf{fin}} Q$ in time $O\big(\mathrm{poly}\big(\|{\cal{K}}\|, 2^{|\mn{CN}({\cal{K}})|\cdot |Q| \cdot 4^{m}}\big)\big)$ using oracle calls to finite entailment modulo types with single-role KBs of size at most $\mathrm{poly}(\|{\cal{K}}\|,\|Q\|)$, unions of at most $|Q| \cdot 2^{\mathrm{poly}(m)}$ $\ensuremath{\CQ^\smallplus}\xspace$s of size ${\cal{O}}(m)$, and type sets of size at most $2^{|\mn{CN}({\cal{K}})|\cdot |Q| \cdot 4^{m}}$; the KBs inherit their counting threshold and set of relevant concept names from ${\cal{K}}$. The argument again relies on unravelling, which allows focusing on \emph{tree-like} counter-models; that is, ones that can be decomposed into multiple finite $\Sigma_r$-subinterpretations with $\Sigma_r=\{r\}\cup\mn{CN}({\cal{K}})$ and $r \in \mn{rol}({\cal{K}})$, called \emph{bags}, arranged into a (possibly infinite) tree such that: (1) two bags share a single element if they are neighbours, and are disjoint if they are not neighbours; (2) each element $d$ occurs in exactly one $\Sigma_r$-bag for each $r\in \mn{rol}({\cal{K}})$ and \new{some bag containing $d$ is the parent of all other bags containing $d$}; (3)~the root bag satisfies ${\cal{A}}$. A tree-like interpretation is a model of ${\cal{K}}$ iff each $\Sigma_r$-bag is a model of the TBox ${\cal{T}}_r$, collecting all CIs from ${\cal{T}}$ that mention only role name $r$. Evaluating $Q$ over a tree-like interpretation ${\cal{I}}$ can be distributed over bags by means of \emph{$Q$-labellings}, which assign to each element its \emph{(unary) $Q$-type}, summarizing information relevant for $Q$ as a set of pairs $(p,V)$ where $p$ is a fragment of $Q$ and $\new{\emptyset \neq \,} V \subseteq \textit{var}(p)$. We shall think of a $Q$-labelling as an extension ${\cal{I}}'$ of ${\cal{I}}$ to fresh concept names $A_{p, V}$. \new{We are interested in $Q$-labellings ${\cal{I}}'$ such that $A_{q, V}^{{\cal{I}}'} = \emptyset$ for all $q \in Q$ and $\emptyset \neq V \subseteq \textit{var}(q)$; we call them \emph{$Q$-refutations}.} We call ${\cal{I}}'$ \emph{correct} if $e \in A_{p, V}^{{\cal{I}}'}$ iff $\eta(V) = \{e\}$ for some match $\eta$ for $p$ in ${\cal{I}}'$. We call ${\cal{I}}'$ \emph{consistent} if each bag satisfies the following: for each partition of a fragment $p'$ into fragments $p, p_1, p_2, \dots, p_k$ with $\textit{var}(p_i)\cap \textit{var}(p_j) = \emptyset$ for $i\neq j$, $V_i = \textit{var}(p_i) \cap \textit{var}(p)$, and $\new{\emptyset \neq} \;V\subseteq \textit{var}(p)$, there is no match $\eta$ for $p$ in the bag such that $\eta(V_i) = \{e_i\} \subseteq A_{p_i, V_i}^{{\cal{I}}'}$ for all $i$ but $\eta(V) = \{e\} \not\subseteq A_{p', V}^{{\cal{I}}'}$. \begin{lemma} \label{lem:multirolesconsistent} \new{The correct $Q$-labelling of ${\cal{I}}$ is a $Q$-refutation iff ${\cal{I}}$ admits a consistent $Q$-refutation.} \end{lemma} It remains to show how to find consistent \new{$Q$-refutations ${\cal{J}}$ such that ${\cal{J}} \models {\cal{K}}$} and prove that they can be turned into finite counter-models. \new{Consistent $Q$-refutations} can be recognized by a tree automaton but there are two obstacles. First, bags are finite, but arbitrarily large, so tree-like interpretations do not naturally encode as finitely-labelled trees. Second, the information that needs to be passed between bags is the unary type of the shared element, and the unary type of the element shared with the parent bag needs to be related with the \emph{set of unary types} of elements shared with child bags. As the number of such types is $2^{\mn{CN}({\cal{K}}) \cdot |Q|\cdot 4^{m}}$, this suggests a triply exponential construction. Our response is to generalize automata to trees over infinite alphabets and avoid representing the transition relation explicitly. \begin{definition} A \emph{(B\"uchi) automaton} ${\cal{B}}= (\Sigma, \Gamma,S, I, F, \delta)$ consists of a \emph{node alphabet} $\Sigma$, an \emph{edge alphabet} $\Gamma$, a finite set $S$ of \emph{states}, sets $I, F\subseteq S$ of \emph{initial} and \emph{accepting} states, and a \emph{transition function} $\delta: S \times \Sigma \to 2^{(\Gamma \times S)^*}$ mapping state-letter pairs to sets of words over the alphabet $\Gamma\times S$. A \emph{run} $\rho$ of ${\cal{B}}$ on a tree $T$ maps nodes of $T$ to $S$ such that $\rho(\varepsilon) \in I$ and for each node $v$ with children $v_1, v_2, \dots, v_n$, \[ (\gamma_1, \rho(v_1)) (\gamma_2, \rho(v_2)) \dots (\gamma_n, \rho(v_n)) \in \delta (\rho(v), \sigma) \,,\] where $\gamma_i$ is the label of the edge $(v, v_i)$ and $\sigma$ is the label of the node $v$. A tree $T$ is \emph{accepted} by ${\cal{B}}$ if for some run $\rho$, each branch of $T$ contains infinitely many nodes from $\rho^{-1}(F)$. All trees accepted by ${\cal{B}}$ form the set \emph{recognized} by ${\cal{B}}$. \end{definition} Let us build an automaton ${\cal{B}}_{{\cal{K}}, Q}$ recognizing \new{consistent $Q$-refutations}. Because the state space is finite, the automaton cannot compute which elements are shared between bags: it must be given this information. We provide it by marking in each bag the element shared with the parent bag and displaying the shared element on the edge to the parent. With that, the actual elements used in the bags do not matter any more: the element on the edge between bags indicates the element of the parent bag that should be identified with the marked element of the child bag. Let $\Delta$ be a countably infinite set. The node alphabet is the set of finite $\Sigma_r$-interpretations for $r\in\mn{rol}({\cal{K}})$ with domains contained in $\Delta$, and the edge alphabet is $\Delta$. States consist of $r\in\mn{rol}({\cal{K}})$ and a unary type $\tau$ that includes no $A_{q, V}$ with $q \in Q$. A state $(r, \tau)$ is initial if $\tau \supseteq \{A \bigm | A(a) \in {\cal{A}}\}$ where $\{a\} = \mn{ind}({\cal{K}})$. All states are accepting. The transition function ensures that the input tree represents a tree-like interpretation and that each $\Sigma_r$-bag is a model of ${\cal{T}}_r$ and satisfies the consistency condition. Our automata are infinite objects, but in the oracle model their emptiness can be tested in $\ensuremath{\textsc{PTime}}\xspace$ (see Appendix B). \begin{fact} \label{fact:emptiness} There is a polynomial-time algorithm with an oracle that, for each automaton ${\cal{B}} = (\Sigma, \Gamma, S, I, F, \delta)$, accepts input $(S, I, F)$ with oracle $\mathsf{step}_{\cal{B}}$ iff ${\cal{B}}$ accepts some tree, where $\mathsf{step}_{\cal{B}}$ is the set of pairs $(P, q) \in 2^S\times S$ such that $\delta(q, \sigma) \cap (P\times \Gamma)^* \neq \emptyset$ for some $\sigma \in \Sigma$. \end{fact} Deciding if $\big(P, (r, \tau)\big) \in \mathsf{step}_{{\cal{B}}_{{\cal{K}},Q}}$ reduces to a single instance of finite entailment modulo types, for ${\cal{K}}'=({\cal{T}}_r, {\cal{A}}_\tau)$ where ${\cal{A}}_\tau$ encodes $\tau$ as a set of assertions on some distinguished individual, $Q'$ obtained, informally speaking, by taking the union of all matches forbidden in the consistency condition, and $\Theta'=\big \{ \tau \bigm | \forall \, r\in\mn{rol}({\cal{K}})\; (r, \tau) \in P \cup (r, \tau)\big\}$. Hence, applied to ${\cal{B}}_{{\cal{K}}, Q}$, Fact~\ref{fact:emptiness} yields the desired bounds. \smallskip To get finite counter-models we use coloured blocking. For $d \in\Delta^{\cal{I}}$, the \emph{$n$-neighbourhood $N_n^{{\cal{I}}}(d)$ of $d$} is the interpretation obtained by restricting ${\cal{I}}$ to elements $e \in \Delta^{\cal{I}}$ within distance $n$ from $d$ in ${\cal{I}}$, enriched with a fresh concept interpreted as $\{d\}$. A \emph{colouring of ${\cal{I}}$ with $k$ colours} is an extension ${\cal{I}}'$ of ${\cal{I}}$ to $k$ fresh concept names $B_1, \dots, B_k$ such that $B_1^{{\cal{I}}'}, \dots, B_k^{{\cal{I}}'}$ is a partition of $\Delta^{{\cal{I}}'} = \Delta^{{\cal{I}}}$. We say that $d \in B_i^{{\cal{I}}'}$ has colour $B_i$. We call ${\cal{I}}'$ \emph{$n$-proper} if for each $d \in \Delta^{{\cal{I}}'}$ all elements of $N_n^{{\cal{I}}'}(d)$ have different colours. \begin{fact}[\citeauthor{GogaczIM18} \citeyear{GogaczIM18}] \label{fact:coloured-blocking} If ${\cal{I}}$ has bounded degree, then for all $n\geq 0$ there exists an $n$-proper colouring ${\cal{I}}'$ of ${\cal{I}}$ with finitely many colours. Consider interpretation ${\cal{J}}$ obtained from ${\cal{I}}'$ by redirecting some edges such that the old target and the new target have isomorphic $n$-neighbourhoods in ${\cal{I}}'$. Then, for each $q \in \ensuremath{\mathcal{C\hspace{-0.25ex}Q}}\xspace$ with at most $\sqrt{n}$ binary atoms, if ${\cal{I}}\centernot\models q$, then ${\cal{J}}\centernot\models q$. \end{fact} From the proof of Fact~\ref{fact:emptiness} it also follows that if ${\cal{B}}$ accepts some tree, then it also accepts a \emph{regular} tree; that is, a tree that has only finitely many non-isomorphic subtrees. Each regular tree has bounded branching and uses only finitely many different labels. Consequently, the tree-like counter-model ${\cal{I}}$ corresponding to a regular tree accepted by ${\cal{B}}_{{\cal{K}}, Q}$ uses finitely many different bags (up to isomorphism), which means that their size is bounded by some $k$. Therefore, ${\cal{I}}$ has bounded degree and, because $\Sigma_r$-bags are disjoint, the length of simple directed $r$-paths in ${\cal{I}}$ is also bounded by $k$. For $\ell = 2k$, let $Q^{(\ell)}$ be obtained from $Q$ by replacing each transitive atom $r^*(x, y)$ with the disjunction \[ x=y \lor r(x,y) \lor \bigvee_{1<i\leq \ell} r^i(x, y)\, , \] where $r^i(x, y)$ expresses the existence of an $r$-path of length $i$ from $x$ to $y$ as $r(x, z_1) \land r(z_1, z_2) \land \dots \land r(z_{i-1}, y)$ for fresh variables $z_1, \dots, z_{i-1}$. Rewrite $Q^{(\ell)}$ as a $\ensuremath{\mathcal{U\hspace{-0.15ex}C\hspace{-0.25ex}Q}}\xspace$ and let $t$ be the maximal number of binary atoms in one $\ensuremath{\mathcal{C\hspace{-0.25ex}Q}}\xspace$ in $Q^{(\ell)}$. \begin{fact} \label{fact:bounded} If each simple directed $r$-path in an interpretation ${\cal{J}}$ has length at most $\ell$, then $\Jmc \models Q$ iff $\Jmc \models Q^{(\ell)}$. \end{fact} Fix $n = t^2$ and let ${\cal{I}}'$ be an $n$-proper colouring of ${\cal{I}}$. On each infinite branch, select the first $\Sigma_r$-bag ${\cal{M}}$ such that for some $\Sigma_r$-bag ${\cal{M}}'$ higher on this branch, the $n$-neighbourhood of the element $e$, shared by ${\cal{M}}$ and its parent, is isomorphic to the $n$-neighbourhood of the element $e'$, shared by ${\cal{M}}'$ and its parent. The set of selected bags forms a maximal antichain, and by K\"onig's Lemma, it is finite. Let ${\cal{F}}$ be the interpretation obtained by taking the union of all strict ancestors of the selected bags, and for each element $e$ shared by a selected $\Sigma_r$-bag and its parent, redirect each $r$-edge incident with $e$: instead of pointing at an $r$-neighbour of $e$, it should point at the corresponding $r$-neighbour of $e'$. If ${\cal{K}}$ is an $\ensuremath{\ALCQ^\smallplus}\xspace$ KB, redirect only outgoing $r$-edges, and drop the incoming ones. Multiple nodes $e$ may be attached to the same bag ${\cal{M}}'$ in this way, but they are only $r$-reachable from each other via elements of ${\cal{M}}'$, so any simple $r$-path in ${\cal{F}}$ has length bounded by $2k = \ell$. It is routine to check that ${\cal{F}}\models {\cal{K}}$. By Fact~\ref{fact:coloured-blocking}, ${\cal{F}} \not\models Q^{(\ell)}$; by Fact~\ref{fact:bounded}, ${\cal{F}} \not\models Q$. Thus, ${\cal{F}}$ is a finite counter-model. \section{Eliminating Nominals, Trivializing ABoxes} \label{sec:ABoxesNomMain} Finite entailment of a $\ensuremath{\UCQ^\smallplus}\xspace$ over an $\ensuremath{\ALCOI^\smallplus}\xspace$ or $\ensuremath{\ALCOQ^\smallplus}\xspace$ KB can be reduced to multiple instances of finite entailment of $\ensuremath{\UCQ^\smallplus}\xspace$s over $\ensuremath{\ALCI^\smallplus}\xspace$ or $\ensuremath{\ALCQ^\smallplus}\xspace$ KBs, respectively, with \emph{trivial} ABoxes; the latter means that ABoxes mention only one individual (with a fully specified unary type) and contain no binary assertions. Concluding complexity bounds for $\ensuremath{\ALCOI^\smallplus}\xspace$ or $\ensuremath{\ALCOQ^\smallplus}\xspace$ from bounds for $\ensuremath{\ALCI^\smallplus}\xspace$ or $\ensuremath{\ALCQ^\smallplus}\xspace$ requires precise estimations of the number of these instances and their parameters. The key parameters are the size of the KB, the number of $\ensuremath{\CQ^\smallplus}\xspace$s in the query, and their size. Consider an $\ensuremath{\ALCOI^\smallplus}\xspace$ or $\ensuremath{\ALCOQ^\smallplus}\xspace$ KB ${\cal{K}}$ and $Q \in \ensuremath{\UCQ^\smallplus}\xspace$ with $\ensuremath{\CQ^\smallplus}\xspace$s of size at most $m$. Then, the reduction gives an at most doubly exponential number of instances, with KBs of size at most $\mathrm{poly}(\|{\cal{K}}\|, N^{1+|\mn{RCN}({\cal{K}})|})$ and queries with at most $|Q| \cdot \big(\|{\cal{K}}\|\cdot N^{|\mn{RCN}({\cal{K}})|}\big)^{O(m)}$ $\ensuremath{\CQ^\smallplus}\xspace$s of size $O(m)$. Importantly, the reduction preserves the counting threshold $N$ and the set $\mn{RCN}({\cal{K}})$ of relevant concept names. Let us sketch the argument. Using routine one-step unravelling one can show that for $\ensuremath{\ALCOI^\smallplus}\xspace$ it suffices to search for counter-models ${\cal{I}}$ that can be decomposed into domain-disjoint interpretations ${\cal{I}}\upharpoonright \mn{ind}({\cal{K}})$ and ${\cal{I}}_1, \dots, {\cal{I}}_n$ for some $n \leq |{\cal{K}}| \cdot |\mn{ind}({\cal{K}})|$ with two kinds of additional edges: arbitrary edges connecting elements from $\bigcup_i\Delta^{{\cal{I}}_i}$ with elements from $\mn{nom}({\cal{K}})$, and a single edge connecting a distinguished element $d_i\in\Delta^{{\cal{I}}_i}$ with a corresponding element $e_i \in \mn{ind}({\cal{K}})$ for each $i\leq n$. Iterating over possible ${\cal{I}}\upharpoonright \mn{ind}({\cal{K}})$, we check if there exist ${\cal{I}}_i$ that \new{are compatible with} ${\cal{K}}$, provide witnesses for elements from $\mn{ind}({\cal{K}})$, and avoid satisfying the query. The properties required for a single ${\cal{I}}_i$ can be encoded as a finite entailment problem for a modified KB whose ABox describes the unary type of $d_i$, and a union of selected fragments of $Q$ with some variables substituted by elements of $\{d_i\} \cup \mn{nom}({\cal{K}})$. By representing the existence of an $r$-edge to $a\in \mn{nom}({\cal{K}})$ with a fresh concept name $A_{\exists r.\{a\}}$, suitably axiomatized, we can eliminate nominals from the KB and from the query. For $\ensuremath{\ALCOQ^\smallplus}\xspace$, unravelling is made harder by at-most restrictions over closures of roles. We shall treat in a special way all successors of elements from $\mn{ind}({\cal{K}})$ that are affected by such at-most restrictions. Let us call an $r$-successor $e$ of $d \in \Delta^{\cal{I}}$ \emph{directly $r$-relevant} if $e\in A^{\cal{I}}$ for some $A$ relevant for $d$ with respect to $r$, and let $\mn{rel}_r^{\cal{I}}(d)$ be the set of all \emph{$r$-relevant successors} of $d$; that is, the least set containing all directly $r$-relevant successors of $d$ and closed under directly $r$-relevant successors. The key insight is that this set has bounded size. \begin{fact}[\citeauthor{GuIbJu-AAAI18} \citeyear{GuIbJu-AAAI18}] \label{fact:relevant} If $N$ is the counting threshold in ${\cal{K}}$ and ${\cal{I}} \models {\cal{K}}$, then $|\mn{rel}_r^{\cal{I}}(d)|\leq N^{|\mn{RCN}({\cal{K}})|}$ for all $d\in\Delta^{\cal{I}}$ and $r \in \mn{rol}({\cal{K}})$. \end{fact} \noindent In the argument for $\ensuremath{\ALCOI^\smallplus}\xspace$, we replace $\mn{ind}({\cal{K}})$ with \[\mn{ind}({\cal{K}}) \cup \bigcup \big \{ \mn{rel}^{\cal{I}}_r(a) \bigm| {r \in \mn{rol}({\cal{K}})}, {a \in \mn{ind}({\cal{K}})}\big\}\,,\] and similarly for $\mn{nom}({\cal{K}})$. Appendix A has full details. In the following sections we shall focus on the decision procedures for $\ensuremath{\ALCI^\smallplus}\xspace$ and $\ensuremath{\ALCQ^\smallplus}\xspace$, but to ensure that they give $\ensuremath{\textsc{2ExpTime}}\xspace$ upper bounds for $\ensuremath{\ALCOI^\smallplus}\xspace$ and $\ensuremath{\ALCOQ^\smallplus}\xspace$ when combined with the reductions above, we will need more careful complexity analysis. \section{Eliminating nominals and complex ABoxes [draft]}~\label{sec:ABoxesNomMain} Finite entailment of a \ensuremath{\UCQ^\smallplus}\xspace $Q$ by an $\ensuremath{\ALCOI^\smallplus}\xspace$ (resp. $\ensuremath{\ALCOQ^\smallplus}\xspace$) KB ${\cal{K}}$ can be reduced to multiple instances of the problem of finite entailment of a $\ensuremath{\UCQ^\smallplus}\xspace$ by an $\ensuremath{\ALCI^\smallplus}\xspace$ (resp. $\ensuremath{\ALCQ^\smallplus}\xspace$) KB. Moreover, in these instances, the knowledge base can be assumed to have a trivial ABox (i.e. consisting of one individual with fully specified unary type). The reduction does not introduce new role names\nb{right now not true for \ensuremath{\ALCOI^\smallplus}\xspace; should be easy to change, but also: we don't need it for \ensuremath{\ALCOI^\smallplus}\xspace}. As we use this result several times \comment{(twice? thrice?)} and depend on the detailed complexity bounds, we state it as an algorithmic result for several different cases, providing for each of them: \begin{itemize} \item the number of instances to which we reduce; \item three bounds on the sizes of these instances: \begin{itemize} \item size of the KB; \item number of disjuncts in the query (call it \emph{query length}(?)); \item size of the largest disjunct in the query \comment{(number of atoms? variables? binary atoms?)} (call it \emph{query width}(?)). \end{itemize} \end{itemize} Let ${\cal{K}}$ be an \ensuremath{\ALCOI^\smallplus}\xspace or \ensuremath{\ALCOQ^\smallplus}\xspace KB and $Q$ be a \ensuremath{\UCQ^\smallplus}\xspace with $n$ disjuncts, each of size at most $m$. \begin{itemize} \item If ${\cal{K}}$ is an \ensuremath{\ALCOI^\smallplus}\xspace KB, there is an exponential (in $|{\cal{K}}|$) number of instances, with size of the KB polynomial in $|{\cal{K}}|$, query length $O(|{\cal{K}}|^n)$ and query width at most $3m$. \item If ${\cal{K}}$ is an \ensuremath{\ALCOQ^\smallplus}\xspace KB, there is a double exponential (in $|{\cal{K}}|$) number of instances, with size of the KB exponential in $|{\cal{K}}|$, query length $O(2^{n|{\cal{K}}|})$ and query width at most $3m$. \todo{verify} \item If ${\cal{K}}$ is an \ensuremath{\ALCOQ^\smallplus}\xspace KB without long at-most restrictions and all but one nominal having guaranteed no outgoing edges, there is an exponential (in $|{\cal{K}}|$) number of instances, with size of the KB polynomial in $|{\cal{K}}|$, query length $O(|{\cal{K}}|^n)$ and query width at most $3m$. \todo{verify, specify the conditions} \end{itemize} For the full proof, see Appendix. The main ideas of the reduction for \ensuremath{\ALCOI^\smallplus}\xspace: \begin{itemize} \item axiomatization of concepts $C_{\exists r. A} \equiv \exists r. A$ and $C_{\exists r\refltrans. A} \equiv \exists r\refltrans. A$ for all concepts $A$ from the original KB; \item after fixing the unary types of the nominals, the query can be modified to not use nominals; thus, it stays mostly the same in the instances; \item we want to create a set of KBs ${\cal{K}}_i$; each KB corresponds essentially to a guess of the properties of the nominals and their neighbourhoods \comment{(court?)} (unary types, connections between them); \item for each model of ${\cal{K}}$, there is a model of some ${\cal{K}}_i$ being the same, but with the nominals removed (and enriched with some concept names). \end{itemize} For \ensuremath{\ALCOQ^\smallplus}\xspace similarly, but handling the number restrictions along the way; the crucial observation is that there is a bounded number of relevant successors of the nominals; thus, we can treat them all as nominals too; to get good complexity and a trivial ABox, we need one-step unravelling of the nominals. \section{Plan of Attack} Our main technical contribution are the following results. \begin{theorem}\label{thm:LoweBound} Finite entailment of $\ensuremath{\UCQ^\smallplus}\xspace\!$s over \ensuremath{\ALCOI^\smallplus}\xspace or \ensuremath{\ALCOQ^\smallplus}\xspace knowledge bases is \ensuremath{\textsc{2ExpTime}}\xspace-complete. \end{theorem} To prove upper bounds, we will show a series of reductions that will allow us to deal at the end with a base case where the query is a plain UCQ and the knowledge base is `single-role ABox-trivial' either in $\ensuremath{\ALCI^\smallplus}\xspace$ or in $\ensuremath{\ALCQ^\smallplus}\xspace$ without at-most restrictions over closures of roles. These reductions can be seen as different phases in our decision procedure, each of them depending on the previous one. \medskip \noindent {\bf I.} We start by showing in Section~\ref{sec:ABoxesNomMain} that one can eliminate nominals from the input knowledge bases, i.e.\ roughly, that one can reduce finite entailment of $\ensuremath{\UCQ^\smallplus}\xspace\!$s over \ensuremath{\ALCOI^\smallplus}\xspace or \ensuremath{\ALCOQ^\smallplus}\xspace KBs to \ensuremath{\ALCI^\smallplus}\xspace or \ensuremath{\ALCQ^\smallplus}\xspace KBs, respectively. We further show that the input ABox can be assumed to be `trivial' in the sense that it contains no role assertions and that only one individual name occurs in it. \smallskip \noindent {\bf II.} In Section~\ref{sec:mulroles} we show that the variants obtained in Step I above can be further reduced to the case where the knowledge base contains a single role name. This is in line with seeing \ensuremath{\ALCQ^\smallplus}\xspace and \ensuremath{\ALCI^\smallplus}\xspace as a fusion of logics~\cite{BaaderLSW02}, where the interaction between different roles is limited. In a nutshell, we show that there exists a finite counter-model if and only if there exists a tree-like counter-model accepting a decomposition into components interpreting a single role name. \smallskip \noindent {\bf III.} In Section~\ref{sec:elim-trans}, assuming single-role ABox-trivial $\ensuremath{\ALCI^\smallplus}\xspace$ or $\ensuremath{\ALCQ^\smallplus}\xspace$ KBs, we eliminate transitive closure from queries and from at-most restrictions. This step is the one requiring the most technical effort. We will develop the notion of hybrid decompositions, which are tree decompositions that associate with each node arbitrarily large interpretations, but have a certain more subtle parameter bounded. We will observe special characteristics of these interpretations that allow us to establish structural restrictions between neighbouring nodes in the decomposition. Roughly, the key result will be that finite counter-models can be unravelled into counter-models admitting a hybrid decomposition with the above features. This tree-like model property will then be the basis for automata-based approaches to finite entailment in this setting. \smallskip \noindent {\bf IV.} Section~\ref{sec:basecase} provides a decision procedure for the base case described above. We will rely again on tree unravelling and automata-based techniques. \smallskip For the matching lower bound, we show the following. \begin{theorem} Finite entailment of $\ensuremath{\CQ^\smallplus}\xspace\!$s over \ALC knowledge bases is \ensuremath{\textsc{2ExpTime}}\xspace-hard. \end{theorem} % The proof is by reducing the word problem of exponentially space bounded alternating Turing machines, which is known to be \ensuremath{\textsc{2ExpTime}}\xspace-hard~\cite{chandraAlternation1981}. The encoding is a direct adaptation of the one used to show that (arbitrary) entailment of CQs over $\mathcal{SH}$ knowledge bases is \ensuremath{\textsc{2ExpTime}}\xspace-hard~\cite{EiterLOS09}, but use $\ensuremath{\CQ^\smallplus}\xspace\!$s to compensate for the weaker logic. \section{Preliminaries}\label{sec:preli} \subsection{Description Logics} We consider a vocabulary consisting of countably infinite disjoint sets of \emph{concept names} $\concepts$, \emph{role names} $\roles$, and \emph{individual names} $\mn{N_I}$. A \emph{role} is a role name or an \emph{inverse role} $r^-$. The \emph{(transitive-reflexive) closure} of a role $r$ is $r^*$. \emph{$\ensuremath{(\ALCOIQfwd)^\smallplus}\xspace$-concepts $C,D$} are defined by the grammar \[ C,D ::= A \mid \neg C \mid C \sqcap D \mid \{a\} \mid \exists s. C \mid \qnrleq n {s'} C \] where $A \in \mn{N_C}$, $s$ is a role or the closure of a role, $n \geq 0$ is a natural number given in binary, and $s'$ is a role name or the closure of a role name. We will use $\qnrgeq n {s'} C$ as abbreviation for $\neg \qnrleq {n{-}1} {s'} C$, together with standard abbreviations $\bot$, $\top$, $C\sqcup D$, $\forall s.C$. Concepts of the form $\qnrleq n {s'} C $, $\qnrgeq n {s'} C$, and $\{a\}$ are called \emph{at-most restrictions}, \emph{at-least restrictions}, and \emph{nominals}, respectively. Note that in $\ensuremath{(\ALCOIQfwd)^\smallplus}\xspace$-concepts, \emph{inverse roles} are not allowed in at-most and at-least restrictions. An \emph{$\ensuremath{(\ALCOIQfwd)^\smallplus}\xspace$-TBox \Tmc} is a finite set of \emph{concept inclusions (CIs)} $C\sqsubseteq D$, where $C,D$ are $\ensuremath{(\ALCOIQfwd)^\smallplus}\xspace$-concepts. An \emph{ABox} $\Amc$ is a finite non-empty set of \emph{concept} and \emph{role assertions} of the form $A(a)$, $r(a,b)$, $r^*(a,b)$ where $A \in \mn{N_C}$, $r \in \mn{N_R}$ and $\{a,b\} \subseteq \mn{N_I}$. A \emph{knowledge base (KB)} is a pair ${\cal{K}}=({\cal{T}}, {\cal{A}})$. We write $\mn{CN}({\cal{K}})$, $\mn{rol}({\cal{K}})$, $\mn{nom}({\cal{K}})$, and $\mn{ind}({\cal{K}})$ for, respectively, the set of \emph{all concept names, role names, nominals, and individuals occurring in ${\cal{K}}$}. The \emph{counting threshold} of ${\cal{K}}$ is one plus the greatest number used in ${\cal{K}}$. We let $\|{\cal{K}}\|$ be the total size of the representation of ${\cal{K}}$. Sublogics of $\ensuremath{(\ALCOIQfwd)^\smallplus}\xspace$ are defined by forbidding any subset of the following features: nominals (${\cal{O}}$), inverse roles (${\cal{I}}$), counting (${\cal{Q}}$), and closure of roles ($^\smallplus$); this is indicated by dropping corresponding letter or decoration from the name of the logic. The symbol $^\shortminus$ indicates restricted interaction between inverse roles and counting restrictions, so if either is forbidden, $^\shortminus$ is also dropped. The focus of this paper is on the logics $\ensuremath{\ALCOI^\smallplus}\xspace$ and $\ensuremath{\ALCOQ^\smallplus}\xspace$, obtained by forbidding counting and inverse roles, respectively. Other sublogics of $\ensuremath{(\ALCOIQfwd)^\smallplus}\xspace$, in particular $\ensuremath{(\ALCIQfwd)^\smallplus}\xspace$, are used to uniformize and share fragments of arguments. \subsection{Interpretations} The semantics is given as usual via \emph{interpretations} $\Imc = (\Delta^\Imc, \cdot^\Imc)$ consisting of a non-empty \emph{domain} $\Delta^\Imc$ and an \emph{interpretation function $\cdot^\Imc$} mapping concept names to subsets of the domain and role names to binary relations over the domain. Further, we adopt the \emph{standard name assumption}, i.e., $a^\Imc=a$ for all $a \in \mn{N_I}$. The interpretation of complex concepts $C$ is defined in the usual way~\cite{DLBook}. An interpretation $\Imc$ is a \emph{model of a TBox \Tmc}, written $\Imc\models\Tmc$ if $C^\Imc\subseteq D^\Imc$ for all CIs $C\sqsubseteq D\in \Tmc$. It is a \emph{model of an ABox \Amc}, written $\Imc\models \Amc$, if $a\in A^\Imc$ for all $A(a)\in \Amc$, $(a,b)\in r^\Imc$ for all $r(a,b)\in \Amc$, and $(a,b)\in (r^\Imc)^*$ for all $r^*(a,b)\in \Amc$, where $ (r^\Imc)^*$ is the usual transitive-reflexive closure of the binary relation $r^\Imc$. Finally, $\Imc$ is a \emph{model of a KB ${\cal{K}}=({\cal{T}}, {\cal{A}})$}, written $\Imc\models \Kmc$, if ${\cal{I}}\models {\cal{T}}$ and $\Imc\models {\cal{A}}$. An interpretation ${\cal{I}}$ is \emph{finite} if $\Delta^{\cal{I}}$ is finite. An interpretation $\Imc'$ is a \emph{sub-interpretation} of $\Imc$, written as $\Imc'\subseteq \Imc$, if $\Delta^{\Imc'}\subseteq \Delta^\Imc$, $A^{\Imc'}\subseteq A^\Imc$, and $r^{\Imc'}\subseteq r^{\Imc}$ for all $A\in\mn{N_C}$ and $r\in \mn{N_R}$. For $\Sigma \subseteq \concepts \cup \roles$, ${\cal{I}}$ is a \emph{$\Sigma$-interpretation} if $A^{\cal{I}}=\emptyset$ and $r^{\cal{I}}=\emptyset$ for all $A\in \concepts \setminus \Sigma$ and $r\in \roles\setminus\Sigma$. The \emph{restriction of $\Imc$ to signature $\Sigma$} is the maximal $\Sigma$-interpretation $\Imc'$ with $\Imc'\subseteq \Imc$. The \emph{restriction of $\Imc$ to domain $\Delta$}, written ${\cal{I}}\upharpoonright \Delta$, is the maximal sub-interpretation of $\Imc$ with domain $\Delta$. The union ${\cal{I}} \cup {\cal{J}}$ of ${\cal{I}}$ and ${\cal{J}}$ is an interpretation such that $\Delta^{{\cal{I}} \cup {\cal{J}}} = \Delta^{{\cal{I}}} \cup \Delta^{{\cal{J}}}$, $A^{{\cal{I}} \cup {\cal{J}}} = A^{{\cal{I}}} \cup A^{{\cal{J}}}$, and $r^{{\cal{I}} \cup {\cal{J}}} = r^{{\cal{I}}} \cup r^{{\cal{J}}}$ for all $A\in\mn{N_C}$ and $r\in \mn{N_R}$. A \emph{homomorphism} from interpretation ${\cal{I}}$ to interpretation ${\cal{J}}$, written as $h : {\cal{I}} \to {\cal{J}}$ is a function $h : \Delta^{\cal{I}} \to \Delta^{\cal{J}}$ that preserves roles, concepts, and individual names: that is, for all $r \in \roles$, $(h(d), h(e)) \in r^{\cal{J}}$ whenever $(d,e) \in r^{\cal{I}}$, for all $A \in \concepts$, $h(d) \in A^{\cal{J}}$ whenever $d \in A^{\cal{I}}$, and $h(a)= a$ for all $a \in \mn{ind}(\Kmc)$. \subsection{Queries and Finite Entailment} Let $\ensuremath{\mn{N_{\mn{V}}}}$ be a countably infinite set of \emph{variables}. An \emph{atom} is an expression of the form $A(t)$, $t = t'$, $r(t,t')$, or $r^*(t,t')$ with $A \in\concepts$, $r \in \roles$, and $t,t' \in \ensuremath{\mn{N_{\mn{V}}}}\cup\ensuremath{\mn{N_{\mn{I}}}}$, referred to as \emph{concept}, \emph{equality}, \emph{role}, and \emph{transitive atoms}, respectively. A \emph{conjunctive query (with transitive atoms)} is a set of atoms, understood as the conjunction thereof. We write $\ensuremath{\CQ^\smallplus}\xspace$ for conjunctive queries (with transitive atoms), and $\ensuremath{\mathcal{C\hspace{-0.25ex}Q}}\xspace$ for conjunctive queries without transitive atoms. Let $\textit{var}(q)$ be the set of variables occurring in the atoms of $q \in \ensuremath{\CQ^\smallplus}\xspace$. A \emph{match for $q$ in $\Imc$} is a function $\eta:\textit{var}(q)\to \Delta^{\cal{I}}$ such that ${\cal{I}},\eta\models q$ under the standard semantics of first-order logic, assuming that the extension of $r^*$ is the reflexive-transitive closure of the extension of $r$. An interpretation ${\cal{I}}$ \emph{satisfies} $q$, written ${\cal{I}}\models q$, if there exists a match for $q$ in ${\cal{I}}$. Fix $p,q \in \ensuremath{\CQ^\smallplus}\xspace$ and a function $\eta:\textit{var}(p) \to \ensuremath{\mn{N_{\mn{V}}}} \cup \ensuremath{\mn{N_{\mn{I}}}}$. Let $\eta(p)$ be obtained from $p$ by substituting each $x\in\textit{var}(p)$ with $\eta(x)$. We call $\eta$ a \emph{homomorphism} if $\eta(p) \subseteq q^*$, where $q^*$ is obtained by saturating $q$ as follows for all $r$ and all $s,s' \in \{r, r^*\}$: if $\{x\,{=}\,y, y\,{=}\,z\} \subseteq q$, add $x\,{=}\,z$, if $\{s(x,y), y\,{=}\,y'\} \subseteq q$, add $s(x,y')$, if $\{s(x,y), x\,{=}\,x'\} \subseteq q$, add $s(x',y)$, if $\{s(x, y), s'(y,z)\} \subseteq q$, add $r^*(x,z)$. Let ${\cal{I}}\models q$. If there is a homomorphism from $p$ to $q$, then ${\cal{I}}\models p$. If there is a homomorphism from ${\cal{I}}$ to ${\cal{J}}$, then ${\cal{J}}\models q$. A union of conjunctive queries is a finite set of $\ensuremath{\CQ^\smallplus}\xspace$s. We write $\ensuremath{\UCQ^\smallplus}\xspace$ for unions of conjunctive queries, and $\ensuremath{\mathcal{U\hspace{-0.15ex}C\hspace{-0.25ex}Q}}\xspace$ for unions of conjunctive queries without transitive atoms. An interpretation ${\cal{I}}$ satisfies $Q\in\ensuremath{\UCQ^\smallplus}\xspace$, written as ${\cal{I}}\models Q$, if ${\cal{I}} \models q$ for some $q \in Q$. A \emph{fragment} of $Q$ is a $\ensuremath{\CQ^\smallplus}\xspace$ formed by a \new{connected} subset of atoms of some $q \in Q$. We let $\|Q\|$ denote the number of all fragments of $Q$; note that it is exponential in $\max_{q\in Q} |q|$. We say that ${\cal{K}}$ \emph{finitely entails} ${\cal{Q}}$, written ${\cal{K}}\models_{\mathsf{fin}} Q$, if each finite model of ${\cal{K}}$ satisfies $Q$. A model of ${\cal{K}}$ that does not satisfy $Q$ is a \emph{counter-model}. The \emph{finite entailment problem} asks if a given KB ${\cal{K}}$ finitely entails a given query $Q$. We also consider \emph{finite entailment modulo types}, which allows more precise complexity bounds. A \emph{unary ${\cal{K}}$-type} is a subset of $\mn{CN}({\cal{K}})$ including either $A$ or $\bar A$ for each $A \in \mn{CN}({\cal{K}})$. Let $\mn{Tp}({\cal{K}})$ be the set of all unary ${\cal{K}}$-types. For an interpretation ${\cal{I}}$ and an element $d \in \Delta^{\cal{I}}$, the \emph{unary ${\cal{K}}$-type of $d$ in ${\cal{I}}$} is $\mn{tp}^{\cal{I}}(d) = \left \{ A \in \mn{CN}({\cal{K}}) \bigm | d \in A^{\cal{I}}\right\}$. We say that ${\cal{I}}$ \emph{realizes} a unary ${\cal{K}}$-type $\tau$ if $\tau = \mn{tp}^{\cal{I}}(d)$ for some $d \in \Delta^{\cal{I}}$. For a KB ${\cal{K}}$, a query $Q$, and a set of unary types $\Theta \subseteq \mn{Tp}({\cal{K}})$ we write ${\cal{K}} \models_{\mathsf{fin}}^\Theta Q$ if for each finite interpretation ${\cal{I}}$ that only realizes types from $\Theta$, if ${\cal{I}}\models {\cal{K}}$ then ${\cal{I}}\models Q$. In this context, a counter-model is a model of ${\cal{K}}$ that only realizes types from $\Theta$ and does not satisfy $Q$. \subsection{Normal Form and Additional Assumptions} Without loss of generality, we assume throughout the paper that all CIs are in one of the following \emph{normal forms}: \begin{align*} \bigsqcap_i A_i \sqsubseteq \bigsqcup_j B_j, \quad A \sqsubseteq \qnrleq n r B, \quad A \sqsubseteq \qnrgeq n r B, \\ \quad A \sqsubseteq \qnrleq n {r^*} B, \quad A \sqsubseteq \qnrgeq n {r^*} B, \\ \quad A \sqsubseteq \forall r^-. B, \quad A\sqsubseteq \exists r^-.B, \quad A\sqsubseteq \exists (r^-)^*.B, % \end{align*} where $A,A_i,B,B_j$ are concept names or nominals, $r\in \mn{N_R}$, and empty disjunction and conjunction are equivalent to $\bot$ and $\top$, respectively. In logics without counting, the number $n$ in at-most restrictions must be 0, and in at-least restrictions it must be 1. We also assume that for each concept name $A$ used in ${\cal{K}}$ there is a \emph{complementary} concept name $\bar A$ axiomatized with CIs $\top \sqsubseteq A \sqcup \bar A$ and $A \sqcap \bar A \sqsubseteq \bot$. A concept name $B\in\mn{CN}({\cal{K}})$ is \emph{relevant} if ${\cal{K}}$ contains a CI of the form $A \sqsubseteq \qnrleq n {r^*} B$ with $n>0$. We let $\mn{RCN}({\cal{K}})$ denote the set of relevant concept names in ${\cal{K}}$. A concept name $B$ is \emph{relevant in ${\cal{I}}$ for $d\in\Delta^{\cal{I}}$ with respect to $r\in\roles$} if $d \in A^{\cal{I}}$ for some CI $A \sqsubseteq \qnrleq n {r^*} B$ in ${\cal{K}}$ \new{with $n>0$}. We call ${\cal{K}}$ \emph{sticky} if for each model ${\cal{I}}$ of ${\cal{K}}$, each $r \in \roles$, and each $d\in\Delta^{\cal{I}}$, all concept names relevant for $d$ with respect to $r$ are also relevant (with respect to $r$) for each $r$-successor of $d$. Stickiness of ${\cal{K}}$ can be assumed without loss of generality: \new{ for each $B\in\mn{RCN}({\cal{K}})$ and $r \in \mn{rol}({\cal{K}})$ introduce fresh concept names $B_r$ and $\overline B_r$ axiomatized with $\top \sqsubseteq B_r \sqcup \overline B_r $, $B_r \sqcap \overline B_r \sqsubseteq \bot$, $B_r \sqsubseteq \qnrleq 0 r {\overline B_r}$, $B_r \sqsubseteq \qnrleq N {r^*} B$, where $N$ is the counting threshold in ${\cal{K}}$, and add $A \sqsubseteq B_r$ for each CI $A \sqsubseteq \qnrleq n {r^*} B$ in ${\cal{K}}$. } A variable $y$ is \emph{linking} in $q\in\ensuremath{\CQ^\smallplus}\xspace$ if the only atoms in $q$ using $y$ are $r^*(x, y), r^*(y, z)$ for some $x, z \in \textit{var}(q)$. In a match $\eta$ for $q$, $\eta(y)$ can be any node on a path from $\eta(x)$ to $\eta(z)$. We call $q$ \emph{normalized} if in every atom over $r^*$ at least one variable is linking, and for every two atoms $r^*(x, y), r^*(y, z)$ with $y$ linking, exactly one of the variables $x$ and $z$ is linking too. Each query can be normalized by first eliminating all linking variables, and then subdividing each $r^*$ atom into three $r^*$ atoms using two fresh linking variables. Without loss of generality we can assume that the input \new{$\ensuremath{\UCQ^\smallplus}\xspace$s consist of normalized connected $\ensuremath{\CQ^\smallplus}\xspace$s}. \section{Eliminating transtive atoms: \ensuremath{\ALCI^\smallplus}\xspace} Let ${\cal{K}}$ be an \ensuremath{\ALCI^\smallplus}\xspace KB using only one role, let $Q$ be a \ensuremath{\UCQ^\smallplus}\xspace and let $T$ be a set of forbidden unary types. We will remove the transitive atoms from the query. We assume there just one individual. \subsection{Tree-like structure} We will be interested in arbitrary models and their tree partitions with the following properties: \begin{itemize} \item each bag is finite; \item each (directed) edge between bags has exactly one associated edge in the interpretation; \item each edge in the interpretation is either inside one bag or is associated to some edge between bags and connects an element from the parent bag and an element from the child bag (preserving the direction of the edge between the bags); \item the root bag contains the individual. \end{itemize} We will call it an SCC-partition (as each strongly connected component needs to be inside one bag). For each element $x$ of the interpretation define $\mn{Bag}(x)$ as the bag in the SCC-partition containing $x$. \begin{definition} An interpretation is \emph{safe} if it does not contain an infinite simple directed path. \end{definition} We will call a model $\Imc$ along with its SCC-partition a \emph{strong counter-example} if: \begin{itemize} \item $\Imc \models {\cal{K}}$; \item $\Imc$ is safe; \item $\Imc \not\models Q'$, where $Q'$ is $Q$ with each transitive atom $r\trans(x, y)$ replaced with: \[ \bigvee_{x'\in\mn{Bag}(x)} \bigvee_{y'\in\mn{Bag}(y)} r\trans(x', y'). \] \end{itemize} \begin{lemma} There exists a finite counter-model iff there exists a strong counter-example. \end{lemma} For the left-to-right implication we will construct a strong counter-example from any finite counter-model by unravelling it appropriately. For the right-to-left one we will develop a procedure deciding whether there exists a strong counter-example; it will follow that if there is one, there is also one with bounded degree of its SCC-partition and it can be folded back to a finite counter-model. \subsection{Unravelling} Let $\Imc$ be a finite counter-model. We will construct a finite counter-model $\Jmc$ with an SCC-partition (forming a strong counter-example). There will be a homomorphism $h: \Delta^\Jmc \to \Delta^\Imc$, as each element of $\Jmc$ will be constructed as a copy of some element from $\Imc$. The root bag contains the ABox along with strongly connected components of the individuals. Then, for each element $x' \in \Delta^\Jmc$, let $x = h(x')$ (i.e. $x'$ was constructed as a copy of $x$) and consider all edges incident to $x$ in $\Imc$. If any such edge $(x, y)$ or $(y, x)$ was not yet copied to $\Jmc$ (i.e. there is no copy $y'$ of $y$ such that there is an edge between $x'$ and $y'$), create a fresh copy of $y$ and its strongly connected component in $\Jmc$ and add an edge from $x$ to $y'$ (or an inverse one), where $y'$ is the copy of $y$. Repeat the above for each element added to $\Jmc$. Now each bag consists of a single strongly connected component (a copy of an SCC from $\Imc$). No two adjacent bags can be copies of the same SCC from $\Imc$. It is easy to verify that ${\cal{K}}$ is satisfied. $Q$ does not have a match in $\Jmc$, because of the homomorphism $h$. $\Jmc$ with the declared SCC-partition is a strong counter-example; each bag is an SCC, so the query $Q'$ from the definition of a strong counter-example is equivalent to $Q$; and $\Jmc$ is safe, because any two adjacent bags are copies of different SCCs, so the longest directed path in this tree is bounded by the size of $\Imc$. \input{sections/UCQplusprocedure} \input{sections/UCQplusconceptqueries} \input{sections/UCQplusfold} \section{Eliminating Transitive Atoms}~\label{sec:elim-trans} In this section we make the hardest step towards proving our main result: we reduce finite entailment of $\ensuremath{\UCQ^\smallplus}\xspace$s to finite entailment of $\ensuremath{\mathcal{U\hspace{-0.15ex}C\hspace{-0.25ex}Q}}\xspace$s, for single-role ABox-trivial KBs either in $\ensuremath{\ALCI^\smallplus}\xspace$ or in $\ensuremath{\ALCQ^\smallplus}\xspace$. Most of the argument is not only shared for the two DLs, but works for their common extension $\ensuremath{(\ALCIQfwd)^\smallplus}\xspace$. Thus, throughout this section we let ${\cal{K}} = ({\cal{T}},{\cal{A}})$ be a single-role $\ensuremath{(\ALCIQfwd)^\smallplus}\xspace$ KB with a trivial ABox. We also fix some $Q \in \ensuremath{\UCQ^\smallplus}\xspace$ and a set $\Theta$ of unary types. The overall strategy is to show that finite counter-models can be unravelled into safe counter-models admitting tree decompositions with bags of arbitrary size, but with a certain more subtle width measure bounded. The bags of these decompositions will be almost strongly connected, which will allow dropping transitive atoms when evaluating fragments of $Q$ over a single bag. Moreover, each bag will contain only a bounded number of elements relevant for at-most restrictions over closures of roles, meaning that they can be replaced with nominals (for each bag separately). This way, the existence of bags that together form a safe counter-model can be reduced to multiple instances of finite entailment of $\ensuremath{\mathcal{U\hspace{-0.15ex}C\hspace{-0.25ex}Q}}\xspace$s in $\ensuremath{\ALCOI^\smallplus}\xspace$ or $\ensuremath{\ALCOQ^\smallplus}\xspace$ without at-most restrictions over closures of roles; eliminating nominals as explained in Section~\ref{sec:ABoxesNomMain}, one arrives at the base case, solved in the next section. As the last step, from the existence of such safe counter-models one infers the existence of finite counter-models. Given that we are in the single-role case, we shall be using graph terminology without mentioning the role name. In particular, a \emph{source} is an element without incoming edges, a \emph{sink} is an element without outgoing edges, an \emph{internal} element is one that has both incoming and outgoing edges, \new{and an \emph{isolated} element is one that has neither incoming nor outgoing edges.} \subsection{Unravelling Finite Counter-Models} We relax the simplistic notion of decomposition used to eliminate multiple roles by allowing bags to share additional elements with their neighbours, provided that the total number of these additional elements is bounded for each bag. \begin{definition} [hybrid decomposition] \label{def:hybrid} A \emph{hybrid decomposition} of an interpretation ${\cal{I}}$ is a tree $T$ in which each node $v \in T$ is labelled with a finite interpretation ${\cal{I}}_v = (\Delta_v, \cdot^{{\cal{I}}_v})$, called a \emph{bag}, a set $\Gamma_v \subseteq \Delta_v$, and an element $f_v\in \Delta_v$, called the \emph{root} of ${\cal{I}}_v$, such that \begin{enumerate} \item \label{item:hybrid-union} ${\cal{I}} = \bigcup_{v\in T} {\cal{I}}_v $; \item \label{item:hybrid-connected} for each $e\in\Delta^{\cal{I}}$, $\left \{v \in T \bigm| e \in \Delta_v\right\}$ is connected in $T$; \item \label{item:hybrid-disjoint} for each edge $(u,v)$ in $T$, $\Delta_u \cap \Delta_v = \{f_v\} \cup (\Gamma_u \cap \Gamma_v)$. \end{enumerate} We let $\widetilde\Gamma_u = \left \{f_v \bigm | v \text{ is a child of } u\right\}$ and call $\max_{u\in T} |\Gamma_u|$ the \emph{width} of $T$. An element $d\in \Delta_u$ is \emph{fresh} in $u$ if $u$ is the root of $T$ or $d\notin\Delta_{u'}$ for the parent $u'$ of $u$; $d$ is \emph{local} in $u$ if $d=f_u$ or if $d\notin\Delta_v$ for all neighbours $v$ of $u$. \end{definition} \noindent We often blur the distinction between the node $v$ and the interpretation ${\cal{I}}_v$, using the term \emph{bag} for both. Note that each element is fresh in exactly one bag, and the only local element in $u$ that is not fresh in $u$ is $f_u$ (unless $u=\varepsilon$, when $f_\varepsilon$ is fresh too). While Definiton~\ref{def:hybrid} captures the fundamental structural simplicity of our counter-models, the limitations of the target special case impose grittier structural requirements. \begin{definition}[well-formedness] \label{def:well-formed} If ${\cal{K}}$ uses both inverses and counting, a hybrid decomposition $T$ is \emph{well-formed} for ${\cal{K}}$ if ${\cal{I}}_\varepsilon \models {\cal{A}}$ and for each $u\in T$, \begin{enumerate} \item \label{item:types} for each concept name $A$, $A^{{\cal{I}}_u} = A^{{\cal{I}}} \cap \Delta_u$; \item \label{item:roots} for each child $v$ of $u$, $f_v$ is a fresh sink or source in ${\cal{I}}_u$ \new{(or a fresh element of $\Gamma_u$)}; \item \label{item:external} for each fresh sink or source $d$ in ${\cal{I}}_u$ \new{(or fresh $ d\in \Gamma_u$)}, $d=f_v$ for exactly one child $v$ of $u$; \item \label{item:rel-consistent} for each $w\in T$, if $f_u \in \Gamma_w$, then $\Gamma_u \subseteq \Gamma_w$; \item \label{item:rel-contained} for each local element $d$ in ${\cal{I}}_u$ and each concept name $A$ relevant for $d$: if $d \in A^{{\cal{I}}_u}$ then $d\in\Gamma_u$, and $\Gamma_v \cap A^{{\cal{I}}_v} \subseteq \Gamma_u$ for all $v\in T$ such that $f_v$ is a sink in ${\cal{I}}_u$ or $f_u$ is a \emph{non-isolated} source in ${\cal{I}}_v$. \end{enumerate} If ${\cal{K}}$ does not use inverses, ``sink or source'' in items \ref{item:roots} and \ref{item:external} is replaced with ``sink'', and the case ``\new{$f_u$ is a non-isolated source in ${\cal{I}}_v$}'' in item \ref{item:rel-contained} is dropped, \new{but additionally we require that each element of $\Gamma_u\setminus \{f_u\}$ is a sink in ${\cal{I}}_u$.} If ${\cal{K}}$ does not use counting, we additionally require that $\Gamma_u = \emptyset$ for all $u\in T$. \end{definition} \noindent Note that in a well-formed hybrid decomposition, each element is local in exactly one node. We work with infinite counter-examples because they have simpler structure, but ultimately we need to make them finite. The following notion guarantees that this is possible. \begin{definition}[safety] A hybrid decomposition $T$ is \emph{safe} if it admits no infinite sequence of nodes $u_0, u_1, \dots$ such that for all $i$, either $f_{u_{i+1}}$ is a sink in ${\cal{I}}_{u_{i}}$ or $f_{u_i}$ is a \new{non-isolated} source in ${\cal{I}}_{u_{i+1}}$. \end{definition} Finally, replacing $\ensuremath{\UCQ^\smallplus}\xspace$ with $\mathcal{UCQ}$ is possible thanks to strong connectedness guarantees on the bags. \begin{definition}[well-connectedness] An interpretation ${\cal{J}}$ is \emph{well-connected} if for all $d, e \in \Delta^{\cal{J}}$, $(d,e) \in (r^*)^{\cal{J}}$ iff either $d=e$ or $d$ is not a sink and $e$ is not a source in ${\cal{J}}$. A hybrid decomposition $T$ is well-connected if ${\cal{I}}_v$ is well-connected for all $v \in T$. \end{definition} In the remainder, by a \emph{${\cal{K}}$-decomposition} we mean a hybrid decomposition well-formed for ${\cal{K}}$, of width at most $N^{|\mn{RCN}({\cal{K}})|}$ where $N$ is the counting threshold in ${\cal{K}}$. \begin{lemma} \label{lem:unravelling} If ${\cal{K}}\notmodels_{\!\!\mathsf{fin}}^\Theta Q$, then there exists a counter-model admitting a safe and well-connected ${\cal{K}}$-decomposition. \end{lemma} \begin{proof} Let ${\cal{J}}$ be a finite counter-model. We construct the special counter-model ${\cal{I}}$ and a witnessing ${\cal{K}}$-decomposition $T$ of ${\cal{I}}$ by unravelling ${\cal{J}}$ in a special way. We describe the construction for the case when ${\cal{K}}$ uses inverses; if it does not, simply replace ``neighbours'' with ``direct successors''. Because the ABox of ${\cal{K}}$ is trivial, we have $\mn{ind}({\cal{K}}) = \{d\}$. We begin from the interpretation ${\cal{I}}_\varepsilon$, obtained from ${\cal{J}} \upharpoonright \{d\}$ by removing the only possible edge, $f_\varepsilon = d$, and $\Gamma_\varepsilon = \emptyset$. Now, roughly, for each previously added element $e$ missing a neighbour, we will be adding a new bag containing $e$ with all its missing neighbours, along with all other elements from $\mn{cmp}_{\cal{J}}(e)$---the strongly connected component of $e$ in ${\cal{J}} \upharpoonright \big(\Delta^{\cal{J}} \setminus \mn{rel}_{\cal{J}}(e)\big)$, or $\{e\}$ if $e \in \mn{rel}_{\cal{J}}(e)$---with all their neighbours, and $\mn{rel}_{\cal{J}}(e)$. If an element $f'$ in this bag corresponds to $f \in \Delta^{\cal{J}}$, we call $f'$ a \emph{copy of} $f$ and $f$ the \emph{original of} $f'$. For convenience, we extend this nomenclature to the root bag: if $f' \in \Delta_\varepsilon$, then its original $f \in \Delta^{\cal{J}}$ is $f'$ itself; if $f \in \Delta^{\cal{J}}$ belongs to $\Delta_\varepsilon$, then its copy $f'$ in $\Delta_\varepsilon$ is $f$ itself. We proceed as follows, as long as there is something to do. For each previously added node $u$ and each \new{sink or source} $d' \in \Delta_u$ \new{(or $d'\in\Gamma_u$)} fresh in $u$, we add a new child $v$ of $u$. Let $d\in\Delta^{\cal{J}}$ be the original of $d'$ and let $X \subseteq \Delta^{\cal{J}}$ be the set of the originals of neighbours of $d'$ in ${\cal{I}}_u$. The interpretation ${\cal{I}}_v$ is obtained by \begin{itemize} \item taking the restriction of ${\cal{J}}$ to the subdomain comprising $\mn{rel}_{\cal{J}}(d)$, $\mn{cmp}_{\cal{J}}(d)$, neighbours of $\mn{cmp}_{\cal{J}}(d) \setminus \{d\}$, and neighbours of $d$ that do not belong to $X$; \item removing all edges that are not incident with $\mn{cmp}_{\cal{J}}(d)$ and all edges between $d$ and elements from $X$ \new{(if ${\cal{K}}$ does not use inverses, drop edges outgoing from $\mn{rel}_{\cal{J}}(d) \setminus \{d\}$)}; \item replacing each element $e$ with a fresh copy $e'$, except that for elements $e \in \{d\} \cup \mn{rel}_{\cal{J}}(d)$ that already have a copy $e'$ in ${\cal{I}}_u$, $e'$ is reused in ${\cal{I}}_v$. \end{itemize} We let $f_v = d'$ and $\Gamma_v = \left\{e' \bigm| e \in \mn{rel}_{\cal{J}}(d)\right\}$. By construction, $T$ is a hybrid decomposition of width bounded by $\max_{d \in \Delta^{\cal{J}}} |\mn{rel}_{\cal{J}}(d)| \leq N^{|\mn{RCN}({\cal{K}})|}$ (Fact~\ref{fact:relevant}). It is also not difficult to check that $T$ is safe, well connected, and well formed, and that ${\cal{I}} \models {\cal{K}}$ (see Appendix C). Moreover, mapping each element of ${\cal{I}}$ to its original in ${\cal{J}}$ gives a homomorphism from ${\cal{I}}$ to ${\cal{J}}$, which implies that ${\cal{I}} \centernot\models Q$, and that ${\cal{I}}$ only realizes types from $\Theta$. \end{proof} \subsection{Evaluating Queries over Unravellings} We aim at distributing query evaluation over bags, like when eliminating multiple roles. This is now harder because bags share more than one element, but it is possible because the total number of additional shared elements is bounded for each bag. These elements will be \emph{parameters} of $Q$-types. \begin{definition}[nullary $Q$-types] A \emph{(nullary) $Q$-type with parameters $\Gamma$} is a set of pairs $(p,\eta)$ where $p$ is a fragment of $Q$ and $\eta$ is a partial function from $\textit{var}(p)$ to $\Gamma$. The \emph{$Q$-type of ${\cal{J}}$ with parameters $\Gamma$} is the set $\mn{tp}_{Q}^{\cal{J}}(\Gamma)$ of pairs $(p, \eta)$ where $p$ is a fragment of $Q$, and $\eta$ is a partial function from $\textit{var}(p)$ to $\Gamma$ that can be extended to a matching for $p$ in ${\cal{J}}$. \end{definition} The power of $Q$-types with parameters is \emph{compositionality}. Consider interpretations ${\cal{J}}_1,{\cal{J}}_2$ and parameter sets $\Gamma_1, \Gamma_2$. If $\Gamma'\subseteq \Gamma_1$, then \[\mn{tp}^{{\cal{J}}_1}_Q(\Gamma') =\mn{tp}^{{\cal{J}}_1}_Q(\Gamma_1) \upharpoonright \Gamma'\,,\] where $\tau_1 \upharpoonright \Gamma' = \left\{(p, \eta \upharpoonright \Gamma') \bigm | (p, \eta) \in \tau_1 \right\}$ is the \emph{projection of $\tau_1$ on $\Gamma' $}. If $\Delta^{{\cal{J}}_1} \cap \Delta^{{\cal{J}}_2} \subseteq \Gamma_1 \cap \Gamma_2$, then \[\mn{tp}^{{\cal{J}}_1 \cup {\cal{J}}_2}_Q(\Gamma_1\cup\Gamma_2) = \mn{tp}^{{\cal{J}}_1}_Q(\Gamma_1) \oplus \mn{tp}^{{\cal{J}}_2}_Q(\Gamma_2)\,,\] where $\tau_1\oplus\tau_2$ is the \emph{composition} of $\tau_1$ and $\tau_2$ defined as the set of tuples $(p, \eta)$ such that there exist $\tau \subseteq \tau_1 \cup \tau_2$ with $\textit{var}(p') \setminus \dom(\eta')$ pairwise disjoint for $(p',\eta')\in\tau$ and a homomorphism $\widetilde\eta : p \to \bigcup_{(p',\eta') \in \tau} \eta'(p')$ extending $\eta$. Like before, we decorate elements with their $Q$-types. \begin{definition} [$Q$-labellings] A \emph{$Q$-labelling} for a ${\cal{K}}$-decomposition $T$ of ${\cal{I}}$ is a function $\sigma$ that maps each element $d$ local in $u\in T$ to a $Q$-type $\sigma(d)$ with parameters $\{d\} \cup \Gamma_u$. We call $\sigma$ \emph{correct} if for each $d$ local in $u$, $\sigma(d)$ is the $Q$-type of $\widehat{\cal{I}}_u$ with parameters $\{d\} \cup \Gamma_u$, where $\widehat{\cal{I}}_u$ is the interpretation represented by the subtree of $T$ rooted at $u$. \end{definition} If an interpretation ${\cal{I}}$ admits a ${\cal{K}}$-decomposition, then ${\cal{I}} \centernot\models Q$ iff the correct $Q$-labelling for any ${\cal{K}}$-decomposition of ${\cal{I}}$ uses only $Q$-types in which no $q \in Q$ appears. Such $Q$-labellings, called \emph{$Q$-refutations}, are what we need to find. Given a ${\cal{K}}$-decomposition, we can (coinductively) compute the correct $Q$-labelling bottom-up, by composing and projecting $Q$-types of the current bag with the $Q$-types of its direct subtrees, as captured in the following lemma. \begin{lemma} \label{lem:correct} \new{The correct $Q$-labelling for a ${\cal{K}}$-decomposition $T$ of an interpretation ${\cal{I}}$ is the least (pointwise) $Q$-labelling $\sigma$ for $T$ such that} \[\sigma(d) = \bigg( \mn{tp}^{{\cal{I}}_u}_Q\big(\{d\} \cup \Gamma_u \cup \widetilde\Gamma_u\big) \oplus \bigoplus_{e\in \widetilde\Gamma_u} \sigma(e) \bigg) \upharpoonright \{d\}\cup\Gamma_u\] for each node $u \in T$ and each element $d$ local in $u$. \end{lemma} \subsection{From $\ensuremath{\UCQ^\smallplus}\xspace$ to $\ensuremath{\mathcal{U\hspace{-0.15ex}C\hspace{-0.25ex}Q}}\xspace$} The condition in Lemma~\ref{lem:correct} provides the locality required in automata-based decision procedures, but it still relies on evaluating $\ensuremath{\UCQ^\smallplus}\xspace$s over bags. We now show how to avoid it. \begin{definition}[localization] A \emph{localization} of a $\ensuremath{\CQ^\smallplus}\xspace$ $q$ is any $\ensuremath{\mathcal{C\hspace{-0.25ex}Q}}\xspace$ obtainable from $q$ by replacing each atom $r^* (x,y)$ either with $x=y$ or with $r(x,y'), r(x',y)$ for some fresh variables $x'$ and $y'$ used only in these two atoms. \end{definition} Every matching for a $\ensuremath{\UCQ^\smallplus}\xspace$ $q$ in an interpretation ${\cal{J}}$ extends to a matching for some localization of $q$. So, if ${\cal{J}}$ does not satisfy any localization of $q$, then ${\cal{J}}\centernot\models q$. Moreover, if ${\cal{J}}$ is well-connected, then each matching for a localization of $q$ in ${\cal{J}}$ induces a matching for $q$. So, for well-connected ${\cal{J}}$, ${\cal{J}}\centernot\models q$ iff ${\cal{J}}$ does not satisfy any localization of $q$. \begin{definition}[weak $Q$-types] The \emph{weak $Q$-type of ${\cal{J}}$ with parameters $\Gamma$} is the set $\mn{wtp}_Q^{\cal{J}}(\Gamma)$ of pairs $(p, \eta)$ such that $p$ is a fragment of $Q$ and $\eta$ is a partial function from $\textit{var}(p)$ to $\Gamma$ that extends to a matching of some localization of $p$ in ${\cal{J}}$. \end{definition} Weak $Q$-types are over-approximations of $Q$-types, \[\mn{tp}_{Q}^{\cal{J}}(\Gamma) \subseteq \mn{wtp}_{Q}^{\cal{J}}(\Gamma)\,,\] and are exact for well-connected interpretations, \[{\cal{J}} \text { is well-connected} \implies \mn{tp}_{Q}^{\cal{J}}(\Gamma) = \mn{wtp}_{Q}^{\cal{J}}(\Gamma)\,.\] By replacing $Q$-types with weak $Q$-types in the condition of Lemma~\ref{lem:correct}, we avoid evaluating fragments of $\ensuremath{\UCQ^\smallplus}\xspace$ by evaluating their localizations instead. We also relax the condition by replacing equality with inclusion, to facilitate the reduction to finite (non-)entailment. \begin{definition} [consistency] \label{def:consistency} A $Q$-labelling $\sigma$ for a ${\cal{K}}$-decomposition $T$ of an interpretation ${\cal{I}}$ is \emph{consistent} if \[\sigma(d) \supseteq \bigg(\mn{wtp}^{{\cal{I}}_u}_Q\big(\{d\} \cup \Gamma_u \cup \widetilde\Gamma_u\big) \oplus \bigoplus_{e\in \widetilde\Gamma_u} \sigma(e)\bigg) \upharpoonright \{d\}\cup\Gamma_u\] for each node $u \in T$ and each element $d$ local in $u$. \end{definition} For any ${\cal{K}}$-decomposition $T$, the existence of a consistent $Q$-refutation implies the existence of a correct $Q$-refutation. Moreover, if $T$ is well-connected, then the two conditions coincide, which eliminates false negatives in the finite entailment decision procedure. \begin{lemma} \label{lem:consistent} If a ${\cal{K}}$-decomposition $T$ of ${\cal{I}}$ admits a consistent $Q$-refutation, then it admits a correct $Q$-refutation. If $T$ is well-connected, then the correct $Q$-labelling is consistent. \end{lemma} \begin{proof} Let $\sigma$ be the correct $Q$-labelling for $T$. By Lemma~\ref{lem:correct} and the relation between $Q$-types and weak $Q$-types, for each consistent $Q$-labelling $\sigma'$ for $T$, $\sigma(v) \subseteq \sigma'(v)$ for all $v \in T$. Consequently, if some consistent $Q$-refutation $\sigma'$ for $T$ exists, then $\sigma$ is a $Q$-refutation as well. As $\sigma$ is correct, the first claim of the lemma follows. If $T$ is well-connected, $Q$-types and weak $Q$-types coincide. Combined with Lemma~\ref{lem:correct}, this implies that $\sigma$ is consistent. \end{proof} \begin{lemma} \label{lem:there} If ${\cal{K}}\notmodels_{\!\!\mathsf{fin}}^\Theta Q$ then some model of ${\cal{K}}$ realizing only types from $\Theta$ has a safe ${\cal{K}}$-decomposition admitting a consistent $Q$-refutation. \end{lemma} \begin{proof} Assume ${\cal{K}}\notmodels_{\!\!\mathsf{fin}}^\Theta Q$. By Lemma~\ref{lem:unravelling}, there exists a counter-model ${\cal{I}}$ with a safe and well-connected ${\cal{K}}$-decomposition $T$. Let $\sigma$ be the unique correct $Q$-labelling for $T$. Because ${\cal{I}} \centernot\models Q$, $\sigma$ is a $Q$-refutation. By Lemma~\ref{lem:consistent}, $\sigma$ is consistent. \end{proof} \subsection{Recognizing Safe Counter-Examples} We now construct an automaton ${\cal{B}}_{{\cal{K}}, Q}$ recognizing safe ${\cal{K}}$-decompositions of models of ${\cal{K}}$, admitting consistent $Q$-refutations. Like in the case of multiple roles, we must give the automaton information about shared elements. For this purpose, we enrich each node $v$ with a tuple $\tup{g}_v$ enumerating all elements of $\Gamma_v$ that belong to the parent $u$ of $v$, and on the edge between $u$ and $v$ we put $f_v$ and $\tup{g}_v$. Again, the actual elements in $\Delta_v$ and $\Delta_u$ do not matter: $f_v$ and $\tup{g}_v$ coupled with the label on the edge from $u$ to $v$ determine which elements represented in $v$ and in $u$ should be identified. Let $M = N^{|\mn{RCN}({\cal{K}})|}$ where $N$ is the counting threshold in ${\cal{K}}$. We fix a countably infinite set $\Delta$ and assume that the node alphabet of our automaton is the set of 4-tuples of the form $({\cal{J}}, f, \Gamma, \tup{g})$ where ${\cal{J}}$ is a finite interpretation with $\Delta^{\cal{J}} \subseteq \Delta$, $f \in \Delta^{\cal{J}}$, $\Gamma \subseteq \Delta^{\cal{J}}$, $|\Gamma| \leq K$, and $\tup{g}$ is a tuple enumerating a subset of $\Gamma$. The edge alphabet is $\Delta \times \bigcup_{i=0}^M \Delta^{i}$. The following lemma relies on ${\cal{K}}$ being expressed either in $\ensuremath{\ALCI^\smallplus}\xspace$ or in $\ensuremath{\ALCQ^\smallplus}\xspace$. By a base-case KB we understand a single-role KB in $\ensuremath{\ALCI^\smallplus}\xspace$ or $\ensuremath{\ALCQ^\smallplus}\xspace$, respectively, with a trivial ABox and no at-most restrictions over closures of roles. Let $m=\max_{q \in Q}|q|$. \begin{lemma} \label{lem:regularity} There exists an automaton ${\cal{B}}_{{\cal{K}},Q,\new{\Theta}}$ recognizing those safe ${\cal{K}}$-decompositions of models of ${\cal{K}}$ realizing only types from $\Theta$ that admit consistent $Q$-refutations. The states, initial states, and accepting states of ${\cal{B}}_{{\cal{K}}, Q, \new{\Theta}}$ can be computed in time $O\big(2^{\mathrm{poly}( \|Q\|, \|{\cal{K}}\|, M^m)}\big)$. The question if $(P,q) \in \mathsf{step}_{{\cal{B}}_{{\cal{K}},Q, \new{\Theta}}}$ can be reduced to an instance of finite entailment modulo types for a base case KB of size at most $\mathrm{poly}(\|{\cal{K}}\|, \|Q\|, N\cdot M^m)$ and counting threshold $N$, a $\ensuremath{\mathcal{U\hspace{-0.15ex}C\hspace{-0.25ex}Q}}\xspace$ consisting of at most $\|Q\|^2 \cdot M^m \cdot m^m$ $\ensuremath{\mathcal{C\hspace{-0.25ex}Q}}\xspace$s of size $O(m)$, and a type set of size at most $|\Theta| \cdot 2^{\mathrm{poly}(\|K\|, \|Q\| , N\cdot M^m)}$. \end{lemma} \subsection{Making Counter-Examples Finite} To complete the proof we need to derive finite non-entailment from the existence of a safe counter-example. \begin{lemma} \label{lem:back} If ${\cal{K}}$ is in $\ensuremath{\ALCI^\smallplus}\xspace$ or $\ensuremath{\ALCQ^\smallplus}\xspace$ and some model of ${\cal{K}}$ realizing only types from $\Theta$ has a safe ${\cal{K}}$-decomposition admitting a consistent $Q$-refutation, then ${\cal{K}}\notmodels_{\!\!\mathsf{fin}}^\Theta Q$. \end{lemma} For $\ensuremath{\ALCQ^\smallplus}\xspace$, a finite counter-model comes for free. Indeed, each safe hybrid decomposition well-formed for a KB without inverses must be finite, so the interpretation it represents is finite too. For $\ensuremath{\ALCI^\smallplus}\xspace$, we use the coloured blocking principle. By Lemma~\ref{lem:regularity}, the set of those ${\cal{K}}$-decompositions of models of ${\cal{K}}$ that admit a weakly-consistent $Q$-refutation is recognized by an automaton. Consequently, if nonempty, it contains a regular tree $T$; that is, $T$ has only finitely many non-isomorphic subtrees. From the regularity of $T$ it follows that ${\cal{I}}_v$ are chosen from a finite set, which means that their size is bounded. Similarly, the branching of $T$ is bounded. Finally, safety and regularity of $T$ together imply that there is a bound on the length of sequence of nodes $u_0, u_1, \dots, u_k$ such that for all $i<k$, either $f_{u_i}$ is a source in ${\cal{I}}_{u_{i+1}}$ or $f_{u_{i+1}}$ is a sink in ${\cal{I}}_{u_{i}}$. It follows that in the interpretation ${\cal{I}}$ represented by $T$, both the branching and the length of simple directed paths is bounded by some $\ell \in \mathbb{N}$. By Fact~\ref{fact:bounded}, ${\cal{I}}\models Q$ iff ${\cal{I}}\models Q^{(\ell)}$, where $Q^{(\ell)} \in \ensuremath{\mathcal{U\hspace{-0.15ex}C\hspace{-0.25ex}Q}}\xspace$ is the query defined in Section~\ref{sec:mulroles}. Fix $t = \max_{q \in Q^{(\ell)}} |q|$ and $n = \max(\ell^2, t^2)$. Let ${\cal{I}}'$ be an $n$-proper colouring of ${\cal{I}}$. Let $V$ be the set of nodes $v \in T$ such that $f_v$ is a sink in ${\cal{I}}_{v'}$ for the parent $v'$ of $v$ and $f_{v'}$ is a source in ${\cal{I}}_{v''}$ for the parent $v''$ of $v'$. By the boundedness properties of $T$, each infinite branch of $T$ has infinitely many nodes in $V$. On each infinite branch, select the first node $v \in V$ with an ancestor $\hat v \in V$ such that the $n$-neighbourhood of $f_{v}$ is isomorphic with the $n$-neighbourhood of $f_{\hat v}$. The set of selected nodes forms a maximal antichain in $T$ and, by K\"onig's Lemma, it is finite. Let ${\cal{F}}$ be the interpretation obtained by taking the union of ${\cal{I}}_u$ for $u$ ranging over the nodes of $T$ that have a selected descendent, except that for each selected node $v$, $f_{v}$ is removed from the domain and all incoming edges are redirected to $f_{\hat v}$. \begin{lemma} \label{lem:folding-correct} \new{ The length of simple directed paths in ${\cal{F}}$ is bounded by $\ell$} and ${\cal{F}} \models {\cal{K}}$. \end{lemma} By Fact~\ref{fact:coloured-blocking}, ${\cal{F}} \centernot\models Q^{(\ell)}$, and by Fact~\ref{fact:bounded} and Lemma~\new{\ref{lem:folding-correct}}, ${\cal{F}} \centernot\models Q$. Thus, ${\cal{F}}$ is a finite counter-model. \subsection{Wrapping up} Assume ${\cal{K}}$ is in $\ensuremath{\ALCI^\smallplus}\xspace$ or $\ensuremath{\ALCQ^\smallplus}\xspace$. By Lemmas~\ref{lem:there} and \ref{lem:back}, ${\cal{K}}\notmodels_{\!\!\mathsf{fin}}^\Theta Q$ iff some model of ${\cal{K}}$ realizing only types from $\Theta$ has a safe ${\cal{K}}$-decomposition admitting a weakly consistent $Q$-refutation. Combining Lemma~\ref{lem:regularity} and Fact~\ref{fact:emptiness}, we get a decision procedure for ${\cal{K}}\models_{\mathsf{fin}}^\Theta Q$ running in time $O\big(\mathrm{poly}(|\Theta|)\cdot 2^{\mathrm{poly}( \|Q\|, \|{\cal{K}}\|, M^m)}\big)$ and using oracle calls to finite entailment modulo types for instances with parameters bounded as in Lemma~\ref{lem:regularity}. \section{Base Case}~\label{sec:basecase} We now solve finite entailment modulo types under the assumptions justified in previous sections; that is, for $Q$ in $\ensuremath{\mathcal{U\hspace{-0.15ex}C\hspace{-0.25ex}Q}}\xspace$ and a single-role ABox-trivial ${\cal{K}}$ either in $\ensuremath{\ALCI^\smallplus}\xspace$ or in $\ensuremath{\ALCQ^\smallplus}\xspace$ without at-most restrictions over closures of roles. We show that it suffices to consider tree-shaped counter-models (Lemma~\ref{lem:tree-shaped}), and that they consitute an effectively regular set (Lemma~\ref{lem:reg}). The decision procedure then amounts to computing the automaton and testing its emptiness; it runs in time $\mathrm{poly}(|\Theta|, 2^{\|\ensuremath{{\cal{K}}}\xspace\|^2\cdot\|Q\|})$ where $\Theta$ is the set of allowed types. An interpretation ${\cal{J}}$ is \emph{tree-shaped} if its elements can be arranged into a tree such that the unique $f\in\mn{ind}({\cal{K}})$ is the root and $r$-edges in ${\cal{J}}$ are allowed only between parents and children; if ${\cal{K}}$ is an $\ensuremath{\ALCQ^\smallplus}\xspace$ KB, $r$-edges must point down. \begin{lemma} \label{lem:tree-shaped} ${\cal{K}}\notmodels_{\!\!\mathsf{fin}}^\Theta Q$ iff there exists a tree-shaped counter-model of bounded degree realizing only types from $\Theta$. \end{lemma} \begin{proof} Let ${\cal{I}}$ be a finite counter-model realizing only types from $\Theta$. We get a tree-shaped counter-model ${\cal{I}}'$ by unravelling ${\cal{I}}$ from the unique $f \in \mn{ind}({\cal{K}})$. If ${\cal{K}}$ is in $\ensuremath{\ALCQ^\smallplus}\xspace$, we unravel by adding fresh copies of all direct successors of previously copied elements from ${\cal{I}}$. If ${\cal{K}}$ is in $\ensuremath{\ALCI^\smallplus}\xspace$, we add fresh copies of all direct successors and fresh copies of all direct predecessors. It is clear that ${\cal{I}}'$ is a tree-shaped counter-model realizing only types from $\Theta$, of degree bounded by twice the degree of ${\cal{I}}$. Conversely, let ${\cal{I}}$ be a tree-shaped counter-model of bounded degree realizing only types from $\Theta$. If ${\cal{K}}$ is in $\ensuremath{\ALCQ^\smallplus}\xspace$, we enrich ${\cal{I}}$ to ensure that witnesses for at-least restrictions over $r^*$ are never glued with each other. Note that in this case all $r$-edges in ${\cal{I}}$ point down. Let $N$ be the counting threshold in ${\cal{K}}$. For each concept name $A$, introduce fresh concepts names $A_1, A_2, \dots, A_N$, called the {\em shades} of $A$. Extend ${\cal{I}}$ to these concept names in such a way that $A_1^{\cal{I}}, A_2^{\cal{I}}, \dots, A_N^{\cal{I}}$ form a partition of $A^{\cal{I}}$, and for each $n \leq N$, if $d\in\Delta^{\cal{I}}$ has at least $n$ successors in $A$, then it has successors in at least $n$ shades of $A$. This can be done greedily, by processing ${\cal{I}}$ top down, ensuring that subtrees rooted at unprocessed nodes use each shade of $A$ at most once. Take a shallowest unprocessed node $v$. For $n=1, 2, \dots, N$, if $v$ has at least $n$ descendents in $A$ but only $n-1$ are painted with a shade of $A$, pick an unpainted one and paint it with an unused shade of $A$. After the whole tree is processed, paint each remaining element in $A$ with an arbitrary shade of $A$. For each concept name $B$ (including the shades) enrich ${\cal{I}}$ further by introducing a fresh concept name $B'$ with extension $(\exists r^*.B)^{\cal{I}}$ and add $B' \sqsubseteq \exists r^*.B$ to ${\cal{K}}$; if ${\cal{K}}$ is in $\ensuremath{\ALCI^\smallplus}\xspace$, introduce also $B''$ with extension $(\exists (r^-)^*.B)^{\cal{I}}$ and add $B'' \sqsubseteq \exists (r^-)^*.B$. Let $n=\max(2, |Q|^2)$ and let ${\cal{I}}'$ be an $n$-proper colouring of ${\cal{I}}$. Consider a level $l$ in ${\cal{I}}'$ such that all $n$-neighbourhoods realized in ${\cal{I}}'$ are already realized above $l$. For each element above level $l$, choose a witness for each CI of the form $A \sqsubseteq \exists r^* .B$ or $A \sqsubseteq \exists (r^-)^*. B$ in ${\cal{K}}$. Restrict the domain to the nodes above level $l$ and the chosen witnesses, together with the paths that lead to them. Redirect each edge leaving the restricted domain to some element above level $l$, preserving the $n$-neighbourhood. The only nontrivial thing to check is that at-least restrictions are not violated, in the case when ${\cal{K}}$ is in $\ensuremath{\ALCQ^\smallplus}\xspace$. For restrictions over $r$, this is because siblings have different colours in each $n$-proper colouring, so edges leading to different siblings are never redirected to the same element. For restrictions over $r^*$, this is because witnesses for the CI $A_i' \sqsubseteq \exists r^*. A_i$ are preserved for each shade $A_i$ of $A$. \end{proof} \begin{lemma} \label{lem:reg} The set of tree-shaped counter-models realizing only types from $\Theta$ is recognized by an automaton computable in time $2^{O(\|\ensuremath{{\cal{K}}}\xspace\|^2\cdot\|Q\|)}$. \end{lemma} This is a routine construction. For $\ensuremath{\ALCQ^\smallplus}\xspace$, the node alphabet is $\Theta$ and the edge alphabet is trivial. To verify that the input tree is a model of ${\cal{K}}$, the automaton stores the unary type of the parent of the current node, and for each $A\in \mn{CN}(\ensuremath{{\cal{K}}}\xspace)$, it stores in the state the minimum number of elements in $A$ to be found in the current subtree, together with a binary flag indicating if progress has been made recently in finding them. This component of the automaton has $(4\cdot N)^{|\mn{CN}(\ensuremath{{\cal{K}}}\xspace)|}$ states, where $N$ is the counting threshold in ${\cal{K}}$. Verifying that the input tree does not satisfy $Q$ involves storing a set of subqueries of CQs from $Q$, which are not to be satisfied in the current subtree. This component has $2^{\|Q\|}$ states. The whole automaton is the product of the two components. It is easy to see that the step relation can be computed in time polynomial in the number of states. The case of $\ensuremath{\ALCI^\smallplus}\xspace$ is similar, except that the edge alphabet is $\{r, r^-\}$ and the first component has separate information about elements reachable and backwards reachable from current node in the current subtree, and also outside (without progress flags). The first component thus has $2^{7\cdot|\mn{CN}({\cal{K}})|}$ states, because it only needs to count up to 1. Note that if the automaton accepts any tree, it also accepts a regular one, and a regular tree has bounded degree.
\section{Introduction} When the geometry of constant curvature spaces was brought to attention in the 19th century, mechanical problems in such spaces presented an opportunity for an interesting variation on familiar themes. In particular, studying the motion of point masses subject to extensions of Newton's usual (flat) inverse square force law to analogous `curved inverse square laws' was soon undertaken, see e.g. the historical reviews in \cite{BMK2, DCS}. Consequently, we speak of \textit{the} curved Kepler problem or \textit{the} curved $n$-body problem to refer to the mechanics of point masses in a space of constant curvature under such nowadays customary extensions of Newton's inverse square force. While the curved Kepler problem is quite similar to the flat Kepler problem --both being characterized by their conformance to analogues of Kepler's laws, or super-integrability-- there are striking differences between the curved 2-body problem and the usual 2-body problem. Namely, it has long been noticed that the absence of Galilean boosts prohibits straightforward reduction of a curved 2-body problem to a curved Kepler problem, and more recently it has been shown --as an application of Morales-Ramis theory in \cite{Shch}, and by numerically exhibiting complicated dynamics in \cite{BMK}-- that the curved 2-body problem, in contrast to the usual 2-body problem, is non-integrable. In this article we will apply classical averaging techniques to compare some features of certain orbits in these curved and flat 2-body dynamics. When the two bodies are close, their motion is a small perturbation of the flat 2-body problem. Indeed, after reduction, we find their relative motion governed by a Kepler problem and additional perturbing terms which vanish as the distance between the bodies goes to zero. Consequently their motion at each instant is approximately along an \textit{osculating conic}: the conic section the two bodies would follow if these perturbing terms were ignored. The averaged, or \textit{secular}, dynamics take into account how the perturbing terms slowly deform these osculating conics. Our main results, theorems \ref{thm:qper} and \ref{thm:per} below, describe quasi-periodic and periodic motions in the reduced curved 2-body problems (see fig.~\ref{fig:orbs}). \begin{figure}[!htb] \centering \includegraphics[scale = .28]{Orbs1.png} \caption{\footnotesize{(a) For two sufficiently close bodies on a sphere, there are motions (blue) along which the two bodies revolve nearly along conic sections which precess in the direction \textit{opposite} to the bodies (fast) motion around the conic. The angular momentum here is vertical, and the whole system rotates about the angular momentum axis. As the two bodies get closer to the equator, their rate of precession decreases and the eccentricity of their osculating conic increases until at the equator two types of (regularized) periodic collision orbits survive: one for which the two bodies bounce perpendicularly to the equator (red) and another for which they bounce along the equator. Similar results hold for two bodies in a negatively curved space, but now the precession is in the \textit{same} direction as the bodies motion around the conic (b) with vertical angular momentum and (c) for angular momentum 'to the right'. We expect some chaotic dynamics to occur near the collision orbits (remark \ref{rmrk:split}).}}\label{fig:orbs} \end{figure} We will begin in section \ref{sec:Kep} by recalling properties of the curved Kepler problem, with details in appendix \ref{app:DelPoi}. As an aside, in seeking parametrizations of the curved Kepler orbits useful for averaging, we derive a 'curved Kepler equation' eq. (\ref{eq:KepEq}) that, as far as we can tell, is new. The curved 2-body problem admits symmetries by the isometry group of the space of constant curvature. In section \ref{sec:2bdy}, we carry out a Meyer-Marsden-Weinstein (symplectic) reduction to formulate the equations of motion for the reduced curved 2-body problem (prop.~\ref{prop:red}), and define a scaling of the coordinates (prop.~\ref{prop:scal}) allowing us to focus our attention on the dynamics when the two bodies are close relative to the curvature of the space. In section \ref{sec:SecDyn} we prove our two main results, establishing that the behaviour depicted in fig.~\ref{fig:orbs} holds for 'most' orbits when the two bodies in a given curved space are sufficiently close. \begin{rmrk} Our results are related to a remark (in section 4.1 of \cite{BMK}), in that determining the secular dynamics is a preliminary step towards a proof of non-integrability by 'Poincar\'e's methods'. Upon defining curved analogues of the Delaunay and Poincar\'e coordinates, our methods are quite similar to those applied to the usual 3-body problem in \cite{FejQP}, although the setting here is simpler in the sense that we only need to average over one fast angle. \end{rmrk} \section{Curved Kepler problems} \label{sec:Kep} Newton's '$1/r$' potential may be characterized by either of the following properties: \begin{itemize} \item it is a (constant multiple) of the fundamental solution of the 3-dimensional laplacian, $\Delta_{\mathbb{R}^3}$ \item the corresponding central force problem has orbits following Kepler's laws. \end{itemize} Generalizing these properties to spaces of constant positive (resp.~negative) curvature yields '$\cot\varphi$' (resp.~'$\coth\varphi$') potentials. We refer to \cite{Al} for a discussion of these long established potentials and their properties using central projection (fig. \ref{fig:CentProj}), presenting some details here in appendix \ref{app:DelPoi}. In particular, the curved Kepler problems are super integrable and on the open subset of initial conditions leading to bounded non-circular motions we have action-angle coordinates, $(L, \ell, G, g)$ where the energy depends only on $L$ (see prop. \ref{prop:DP}). \begin{figure}[!htb] \centering \includegraphics[scale = .5]{gnomic.png} \caption{\footnotesize{The curved Kepler dynamics --with \textit{fixed} center of attraction or 'sun' at $q_s$-- may be characterized by requiring that its \textit{unparametrized} trajectories centrally project to those of the flat Kepler problem in the tangent plane at $q_s$. Setting $\rho = |cq_s|$, the sphere has curvature $\kappa = 1/\rho^2$ and the hyperboloid (with the restricted Minkowski metric) has curvature $\kappa = - 1/\rho^2$. We call $\varphi := \angle (q_scq)$ (resp.~$\tilde\varphi:= \angle(q_sc\tilde q)$ measured with the Minkowski inner product) the \textit{angular distance} from $q$ to $q_s$ (resp.~$\tilde q$ to $q_s$). The distance from $q$ on the sphere to $q_s$ is given by $\rho\varphi$, while the distance from $\tilde q$ to $q_s$ on the hyperboloid is given by $\rho \tilde\varphi$. We set $r:=|q_oq_s| = \rho \tan\varphi = \rho\tanh\tilde\varphi$.}}\label{fig:CentProj} \end{figure} In what follows, we will consider motions satisfying $\varphi = O({\mathbf e})$ for all time, where ${\mathbf e}$ is a small parameter. Evidently, for these Kepler problems, such orbits are central projections of elliptic orbits in the plane. Also, to avoid repetitive arguments and computations, we will give details for the positive curvature case and remark on the analogous results for negative curvature. \section{Curved two body problems}\label{sec:2bdy} Let $S^2$ be the sphere of curvature $\kappa$, with $\|\cdot\|_\kappa$ the norm given by its constant curvature metric. Consider two point masses, $$(q_1,q_2) =:q\in (S^2\times S^2)\backslash \{|\cot \varphi| = \infty\} =: Q,$$ on this sphere of masses $m_1, m_2>0$ with $\varphi$ the angular distance between $q_1$ and $q_2$. Normalize the masses so that $m_1 + m_2 = 1$. We consider the Hamiltonian flow on $T^*Q$ of: $$F := \frac{\|p_1\|_\kappa^2}{2m_1} + \frac{\|p_2\|_\kappa^2}{2m_2} - \frac{m_1m_2}{\rho}\cot\varphi.$$ The tangential components of the forces are of equal magnitude and directed towards eachother along the arc $\stackrel{\frown}{q_1q_2}$. By letting $\vec q_j$ be the position vector of $q_j$ from the center of the sphere, the components of the \textit{angular momentum vector}: $$\vec C := m_1\vec q_1\times \dot{\vec q}_1 + m_2 \vec q_1\times \dot{\vec q}_2$$ are first integrals. They correspond to the symmetry by the diagonal action, $(q_1,q_2)\mapsto (gq_1, gq_2)$, of $\mathrm{SO}_3$ on $Q$. Since $\varphi\ne 0, \pi$ in $Q$, this $\mathrm{SO}_3$ action on each level set $\{\varphi = cst.\}\subset Q$ is free and transitive. By choosing a representative configuration (see fig.~\ref{fig:com}) in each level set of $\varphi$ we obtain a slice of this group action and have: \[ Q\cong I\times \mathrm{SO}_3,~~I = (0,\pi)\ni \varphi,\] such that the $\mathrm{SO}_3$ action is by left multiplication on the second factor. \begin{figure}[!htb] \centering \includegraphics[scale = .5]{com.png} \caption{\footnotesize{Our choice of representative configuration. Embed the sphere of curvature $\kappa$ in $\mathbb{R}^3$, centered at the origin and take an orthonormal basis $\hat i, \hat j, \hat k$ with $\vec C = C\hat k$. We take $q^o(\varphi):=( -\rho\sin m_2\varphi \hat j + \rho\cos m_2\varphi \hat k, \rho\sin m_1\varphi \hat j + \rho\cos m_1\varphi \hat k)$. Given $q\in Q$ with angular distance $\varphi$ between the two bodies, there is a unique element $g\in \mathrm{SO}_3$ with $q = gq^o(\varphi)$.}}\label{fig:com} \end{figure} \subsection{Reduced equations of motion} An application of symplectic reduction (see e.g. \cite{ACM} App. 5) gives: \begin{prop}\label{prop:red} Fix the angular momentum $\vec C\ne 0$. The reduced 2-body dynamics on a sphere of curvature $\kappa = \frac{1}{\rho^2}$ takes place in $T^*I\times\mathcal{O}_\mu$, where $\mathcal{O}_\mu$ is a co-adjoint orbit in $\mathfrak{so}_3^*$. It is the Hamiltonian flow of: $$F_{red} = Kep_\kappa + \kappa(\frac{\|\vec C\|^2}{2} - p_\theta^2) + O(\varphi),~~~dp_\varphi\wedge d\varphi + dp_\theta\wedge d\theta,$$ for $|p_\theta|<\|\vec C\|$, and with $Kep_\kappa = \frac{p_\varphi^2 + p_\theta^2/\sin^2\varphi}{2\rho^2m_1m_2} - \frac{m_1m_2}{\rho}\cot\varphi$, the Hamiltonian for a curved Kepler problem. \end{prop} \begin{proof} We first find the mass weighted metric, $\langle (\vec v_1, \vec v_2), (\vec u_1, \vec u_2)\rangle = m_1 \vec v_1\cdot \vec u_1 + m_2 \vec v_2\cdot \vec u_2$, in terms of our identification $Q\cong I\times \mathrm{SO}_3$ (fig.~\ref{fig:com}). Since the metric is invariant under left translations, it suffices to determine it at the identity (our representative configurations, $q^o$, in fig.~\ref{fig:com}). Let $X_1, X_2, X_3$ be the infinitesimal symmetry vector fields generated by rotations about the $\hat i, \hat j, \hat k$ axes. Together with $\partial_\varphi$, they frame $Q$. We compute: \begin{align*} \langle \partial_\varphi, \partial_\varphi\rangle_{q^o} &= \rho^2m_1m_2 & \langle X_1, X_1\rangle_{q^o} &= m_1\|\hat i \times \vec q_1^o\|^2 + m_2\|\hat i \times \vec q_2^o\|^2 = \rho^2\\ \langle X_2, X_2\rangle_{q^o} &= \rho^2(m_1\cos^2m_2\varphi + m_2\cos^2m_2\varphi) & \langle X_3, X_3\rangle_{q^o} &= \rho^2(m_1\sin^2m_2\varphi + m_2\sin^2m_2\varphi) \end{align*} \[ \langle X_2, X_3\rangle_{q^o} = \rho^2(m_1\cos m_2\varphi\sin m_2\varphi - m_2\cos m_1\varphi\sin m_1\varphi), \] all other inner products being zero. In terms of $Q$'s co-frame, $\{d\varphi, X^j\}$, dual to the above frame, the metric is given by inverting its $\{\partial_\varphi, X_j\}$ matrix representation: \begin{align*} \langle d\varphi, d\varphi\rangle_{q^o} &= \frac{1}{\rho^2m_1m_2} & \langle X^1, X^1\rangle_{q^o} &= \frac{1}{\rho^2}\\ \langle X^2, X^2\rangle_{q^o} &= \frac{m_1\sin^2m_2\varphi + m_2\sin^2m_2\varphi}{m_1m_2\rho^2\sin^2\varphi} & \langle X^3, X^3\rangle_{q^o} &= \frac{m_1\cos^2m_2\varphi + m_2\cos^2m_2\varphi}{m_1m_2\rho^2\sin^2\varphi} \end{align*} \[ \langle X^2, X^3\rangle_{q^o} = \frac{m_2\cos m_1\varphi\sin m_1\varphi - m_1\cos m_2\varphi\sin m_2\varphi }{m_1m_2\rho^2\sin^2\varphi}. \] We identify $T^*Q\cong T^*I\times (\mathrm{SO}_3\times \mathfrak{so}_3^*)$ by \textit{right} translation: $\alpha_g\in T_g^*SO_3\mapsto (g, R_g^*\alpha_g)$. In these coordinates, the symplectic lift of $\mathrm{SO}_3$'s left action on $Q$ is given by: $g\cdot (\varphi, p_\varphi, h, \mu) = (\varphi, p_\varphi, gh, Ad_{g^{-1}}^*\mu)$ with associated moment map: $J(\varphi, p_\varphi, g, \mu) = \mu$. The reduced dynamics takes place on the quotient $P_\mu := J^{-1}(\mu)/G_\mu\cong T^*I\times\mathcal{O}_\mu$, realized by: $(\varphi, p_\varphi, g, \mu)\mapsto (\varphi, p_\varphi, Ad_g^*\mu)$. The reduced symplectic form on $P_\mu$ is $dp_\varphi\wedge d\varphi + \Omega$, where $\Omega_\nu(ad_\xi^*\nu, ad_\eta^*\nu) = \nu([\xi, \eta])$ is the Kirillov-Kostant form on $\mathcal{O}_\mu$. By left invariance of the two body Hamiltonian, $F$, we have: $F(\varphi, p_\varphi, g, \mu) = F(\varphi, p_\varphi, e, Ad_g^*\mu)$, or letting $\nu = Ad_g^*\mu = \nu_j X^j(q^o)$, and $m = m_1m_2$, we have: \begin{equation}\label{eq:Fred} F_{red} = \frac{p_\varphi^2}{2m\rho^2} - \frac{m}{\rho}\cot\varphi + \frac{\nu_1^2}{2\rho^2} + \nu_2^2\frac{m_1\sin^2m_2\varphi + m_2\sin^2m_1\varphi}{2m\rho^2\sin^2\varphi}\end{equation} \[ + \nu_3^2\frac{m_1\cos^2m_2\varphi + m_2\cos^2m_1\varphi}{2m\rho^2\sin^2\varphi} + \nu_2\nu_3\frac{m_2\cos m_1\varphi\sin m_1\varphi - m_1\cos m_2\varphi\sin m_2\varphi}{m\rho^2\sin^2\varphi}.\] Now, using that $\frac{\sin^2ax}{\sin^2x}$ is an analytic function around $x=0$, with expansion $a^2 + O(x^2)$, and that the $\nu_2\nu_3$ coefficient is analytic around $\varphi = 0$ of $O(\varphi)$, and $\nu_1^2 + \nu_2^2 + \nu_3^2 = \|\vec C\|^2$, we have: \[ F_{red} = \frac{p_\varphi^2}{2m\rho^2} + \frac{\nu_3^2}{2m\rho^2\sin^2\varphi} - \frac{m}{\rho}\cot\varphi + \kappa(\frac{\|\vec C\|^2}{2} - \nu_3^2) + O(\varphi).\] Finally, recall that the Kirillov-Kostant form is given by $\Omega = dp_\theta \wedge d\theta$ when we parametrize $\mathcal{O}_\mu$ -- away from the poles $|p_\theta| = \|\vec C\|$ -- as $(\sqrt{\|\vec C\|^2 - p_\theta^2}\sin\theta, \sqrt{\|\vec C\|^2 - p_\theta^2}\cos\theta, p_\theta) = (\nu_1, \nu_2, \nu_3)$. \end{proof} \begin{rmrk}\label{rmrk:eqMass} For equal masses, the expression for $F_{red}$ may be simplified by taking $\psi = \varphi/2, p_\psi = 2p_\varphi$. One has: $F_{red} = Kep_\kappa + \frac{\tan\psi}{8\rho} + \kappa\frac{\|\vec C\|^2 - p_\theta^2}{2}(1 + (\tan\psi\cos\theta)^2)$, where $Kep_\kappa = \frac{1}{2\rho^2}(p_\psi^2 + \frac{p_\theta^2}{\sin^2\psi}) - \frac{\cot\psi}{8\rho}$. \end{rmrk} \begin{rmrk} In \cite{Shch}, symplectic reduction was also applied to reduce the curved 2-body problems. However, for purposes of comparison, it was not clear to us what representative configuration or slice of the group action was used, which led us to present a reduction here 'from scratch'. Our choice of representative (fig.~\ref{fig:com}) was motivated by the mass metric being more diagonal, namely requiring: $\langle \partial_\varphi, X_j\rangle = 0$. \end{rmrk} Next, we introduce a small parameter, ${\mathbf e}$, to study the dynamics when $\varphi = O({\mathbf e})$: \begin{prop}\label{prop:scal} The dynamics on the open set $\varphi = O({\mathbf e})$ may be reparametrized as that of: $$\hat F_{red} = Kep_{{\mathbf e}^2} + Per,~~\hat\omega = d\hat L\wedge d\hat\ell + d\hat G\wedge d\hat g$$ where $Kep_{{\mathbf e}^2} = - \frac{m^3}{2\hat L^2} + \frac{{\mathbf e}^2 \hat L^2}{2m}$, $m = m_1m_2$, and $Per = {\mathbf e}^2\left(\frac{\hat C^2}{2} - \hat G^2 + (m_2-m_1)O({\mathbf e}) + O({\mathbf e}^2)\right)$. \end{prop} \begin{proof} Take Delaunay coordinates (app. \ref{prop:DP}), $(L,G,\ell, g)$, for the $Kep_\kappa$ term of $F_{red}$. Let $L^2 =: \rho{\mathbf e}\hat L^2, G^2 =: \rho{\mathbf e}\hat G^2, \|\vec C\|^2 =: \rho{\mathbf e} \hat C^2$, so that $\varphi = O({\mathbf e})$. The dynamics of $\hat F_{red} := \rho{\mathbf e} F_{red}$ with symplectic form $\hat\omega := d\hat L\wedge d\ell + d\hat G\wedge dg = \omega/\sqrt{\rho{\mathbf e}}$, corresponds to the time reparametrization: $(\rho{\mathbf e})^{3/2}\hat t = t$, where $\hat t$ is the new time. Note that the mean anomaly, $\hat\ell$, for $Kep_{{\mathbf e}^2}$ is the same as the mean anomaly, $\ell$, for the $Kep_{\kappa}$ term, as can be easily checked by comparing $d\ell = \partial_LKep_\kappa~dt$ and $d\hat\ell = \partial_{\hat L} Kep_{{\mathbf e}^2}~d\hat t$. \end{proof} \begin{rmrk} The scaling above includes the possibility of taking ${\mathbf e} = 1/\rho$, and in place of imagining the bodies as close, view their distance remaining bounded as the curvature of the space goes to zero. \end{rmrk} \begin{rmrk} When the curvature is negative, eq. (\ref{eq:Fred}) has the trigonometric functions replaced by their hyperbolic counterparts, and with $\mathfrak{so}_{2,1}^*$'s coadjoint orbits: $\nu_1^2 + \nu_2^2 - \nu_3^2 = \|\vec C\|_{2,1}^2$ replacing the coadjoint orbits of $\mathfrak{so}_3^*$. One arrives at $\hat F_{red} = Kep_{-{\mathbf e}^2} + {\mathbf e}^2(\frac{\|\hat C\|_{2,1}^2}{2} + \hat G^2 + (m_2-m_1)O({\mathbf e}) + O({\mathbf e}^2))$. \end{rmrk} \section{Secular dynamics} \label{sec:SecDyn} The \textit{secular} or averaged dynamics refers to the dynamics of the Hamiltonian: \[\langle F_{red}\rangle := \frac{1}{2\pi}\int_0^{2\pi} F_{red}(L,\ell, G, g)~d\ell. \] The secular dynamics is integrable, $L$ being a first integral. We will use the brackets to denote a functions averaged over $\ell$, namely $\langle f\rangle = \frac{1}{2\pi}\int_0^{2\pi} f~d\ell$. The dynamical relevance of the secular Hamiltonian is due to its appearance in a series of 'integrable normal forms' for the reduced curved 2-body dynamics: \begin{prop} Consider the scaled Hamiltonian, $(\hat F_{red}, \hat\omega)$, of proposition \ref{prop:scal}. For each $k\in\mathbb N$, there is a symplectic change of coordinates, $(\psi^k)^*\hat\omega = \hat\omega$, with: \[\hat F_{red}\circ\psi^k = Kep_{{\mathbf e}^2} + \langle Per\rangle + \langle F^1\rangle + ... + \langle F^{k-1}\rangle + F^{k}\] and each $F^j = O({\mathbf e}^{2j+3})$. When the masses are equal, $F^j = O({\mathbf e}^{2j + 4})$. \end{prop} \begin{proof} The iterative process to determine the sequence of $\psi^k$ and $F^k$'s is not new (see \cite{FejQP}). For the first step, let $\psi^1$ be the time 1-flow of a 'to be determined' Hamiltonian $\chi$. By Taylor's theorem: \[ \hat F_{red}\circ \psi^1 = Kep_{{\mathbf e}^2} + Per + \{Kep_{{\mathbf e}^2}, \chi\} + \{Per, \chi\} + \int_0^1 (1-t)\frac{d^2}{dt^2}(\hat F_{red}\circ\psi^t)~dt.\] Let $\tilde Per := Per - \langle Per\rangle$. Note that, while $Per = O({\mathbf e}^2)$, we have $\tilde Per = O({\mathbf e}^3)$. Taking $\hat n \chi := \int_0^\ell \tilde Per(\hat L, l, \hat G, g)~dl,$ where $\hat n = \partial_{\hat L}Kep_{{\mathbf e}^2}$, we have: \[ Per + \{Kep_{{\mathbf e}^2}, \chi\} = \langle Per\rangle,~~\chi = O({\mathbf e}^3),\] so that for ${\mathbf e}$ sufficiently small $\psi^1$ is defined. Finally, integrating by parts, one has \[ F^1 := \{Per, \chi\} + \int_0^1 (1-t)\frac{d^2}{dt^2}(\hat F_{red}\circ\psi^t)~dt = \int_0^1 \{\langle Per\rangle + t\tilde Per, \chi\}\circ \psi^t~dt = O({\mathbf e}^5).\] \end{proof} \begin{rmrk}\label{rmrk:kSec} The truncated, or \textit{$k$'th order secular system}: $Sec^k:=Kep_{{\mathbf e}^2} + \langle Per\rangle + \langle F^1\rangle + ... + \langle F^{k-1}\rangle$ is integrable, since it does not depend on $\ell$. If the sequence $\psi^k$ converged, the curved 2-body problem would be integrable, although by \cite{Shch} we know there is no such convergence. For each fixed $k$ however, the $k$'th order secular system approximates the true motion over long time scales in a region of configurations with the 2-bodies sufficiently close. \end{rmrk} In appendix \ref{app:Per}, we compute an expansion of $\langle Per\rangle$ in powers of ${\mathbf e}$, eq. (\ref{eq:PerExp}). Via this expansion, one finds two unstable periodic orbits (red in fig.~\ref{fig:orbs}), whose stable and unstable manifolds coincide for the integrable secular dynamics. The complicated dynamics which would result from the splitting of these manifolds is a likely mechanism responsible for the non-integrability of the curved 2-body problem. By ignoring the $O(\varphi)$ terms in $F_{red}$, the Keplerian orbits experience precession (see fig.~\ref{fig:orbs}): \[ \dot G = 0,~~\dot g = - 2\kappa G.\] When the curvature is positive, the conic precesses in a direction opposite to the particles (fast) motion around the conic, while when the curvature is negative the precession occurs in the same direction as the particles motion. We will check that for $\varphi$ sufficiently small, many such orbits survive the perturbation of including the $O(\varphi)$ terms: they may be continued to orbits of the reduced curved 2-body problem and then lifted to orbits of the curved 2-body problem. \subsection{Continued orbits} Applying a KAM theorem from \cite{Fej}, establishes certain quasi-periodic motions of the reduced problem. Introducing some notation, for $\gamma>0, \tau>1$, let \[ D_{\gamma,\tau}:= \{ v\in\mathbb{R}^2~:~|\mathbf{k}\cdot v|\ge \frac{\gamma}{(|k_1|+|k_2|)^\tau}, \forall \mathbf{k} = (k_1,k_2)\in\mathbb{Z}^2\backslash \mathbf{0}\} \] be the $(\gamma,\tau)$-\textit{Diophantine frequencies}. Take \[\mathbf{\hat B}:= \{ (\hat L, \hat G) ~:~ 0 < \hat G \le \hat L < 1\} \] and let \[(I,\theta) = (I_1,I_2,\theta_1, \theta_2) = (\hat L, \hat G, \ell, g) + O({\mathbf e}^3)\] be action-angle variables for some $k$th order secular system, with $\mathbf{B} = \{ (I_1, I_2) : (\hat L, \hat G)\in \mathbf{\hat B}\}\subset \mathbb{R}^2$ equipped with the Lebesgue measure, $Leb$, restricted to $\mathbf{B}$. The reduced curved 2-body problem has, for $\varphi$ sufficiently small, a positive measure of invariant tori along each of which the motions are quasi-periodic. More precisely: \begin{theorem}\label{thm:qper} Fix $\tau >1, \hat\gamma >0, m>2$ and set $\gamma := {\mathbf e}^m\hat\gamma$. There exists ${\mathbf e}_0>0$ such that for each $0<{\mathbf e}<{\mathbf e}_0$, we have: (i) A positive measure set, $d_{\gamma, \tau}\subset \mathbf{B}$, (ii) for each $I^o\in d_{\gamma,\tau}$, there is a local symplectic change of coordinates, $\psi^o$, for which $\psi^o(I^o, \theta)$ is an invariant torus of $\hat F_{red}$ with frequency in $D_{\gamma,\tau}$. (iii) As ${\mathbf e}\to 0$, $Leb(d_{\gamma,\tau})\to Leb(\mathbf{B})$ and $\psi^o\to id$ (in the Whitney $C^\infty$ topology). \end{theorem} \begin{proof} We verify the hypotheses of \cite{Fej}. Let $(I,\theta)$ be action-angle variables for a $k$'th order secular system (remark \ref{rmrk:kSec}) with $2k>2m-3$. Setting $s := I^o\in \mathbf{B}$, and $r := I - I^o$, we have by Taylor expansion: \[ F_s^o := Sec^k = c_s^o + \alpha_s^o\cdot r + O(r^2) \] where $c_s^o := Sec_k(I^o), \alpha_s^o := dSec^k(I^o) = O(1, {\mathbf e}^2)$. Likewise, we take $F_s:=\hat F_{red}(r,\theta)$ around $s = I^o$. Since we have chosen $2k + 1>2m$, we have \[|F_s - F_s^o| = o(\gamma^2)\] for ${\mathbf e}$ sufficiently small. So (\cite{Fej} Thm.~15 and remark 21) there exists a map $\mathbf{B}\ni s\mapsto \alpha_s\in \mathbb{R}^2$, with $|\alpha_s - \alpha_s^o|<<1$ in the $C^\infty$-Whitney topology such that \textit{provided} $\alpha_s\in D_{\gamma,\tau}$, we have $\hat F_{red}\circ\psi^o = c_s + \alpha_s\cdot r + O(r^2;\theta)$ for some local symplectic map $\psi^o$. It remains to check that $d_{\gamma,\tau}:=\{ s~:~\alpha_s\in D_{\gamma,\tau}\}$ is non-empty. Since $m>2$ and $\alpha_s = O(1, {\mathbf e}^2)$ we have (\cite{Fej} Cor.~29) \[ Leb(\mathbf{B}\backslash d_{\gamma,\tau}) = O({\mathbf e}^{\frac{m-2}{\mu}})\] for some constant $\mu>0$. So indeed, for ${\mathbf e}$ sufficiently small, $d_{\gamma,\tau}$ has positive measure and is non-empty. \end{proof} \begin{rmrk} As the reduced dynamics has two degrees of freedom, there is KAM-stability in the $\varphi<<1$ regime: the invariant tori form barriers in energy level sets. \end{rmrk} One may also apply the implicit function theorem to establish periodic orbits of long periods for the reduced dynamics: \begin{theorem}\label{thm:per} Let $m,n\in\mathbb N$. Then for $m$ sufficiently large, there exist periodic orbits of the reduced curved 2-body problem for which the bodies make $m$ revolutions about their osculating conics, while the osculating conic precesses around the origin $n$ times. \end{theorem} \begin{proof} We will consider non-equal masses, a similar argument applies for equal masses. After iso-energetic reduction, the equations of motion for $\hat G, g$ are eq. (\ref{eq:PerExp}): \[ \frac{d\hat G}{d\ell} = {\mathbf e}^3\mathfrak{m} \sin g + O({\mathbf e}^4),~~~\frac{dg}{d\ell} = -2{\mathbf e}^2\hat G + O({\mathbf e}^3),\] where $\mathfrak{m}(\hat L, \hat G)\ne 0$ for non-circular motions. Consider the 'long time return map': \[ \overline P_{\mathbf e} (G^o, g^o) := \int_0^{2\pi/{\mathbf e}^2} (\frac{1}{{\mathbf e}}\frac{d\hat G}{d\ell}, ~\frac{dg}{d\ell})~d\ell,\] the integral taken over an orbit with initial condition $G^o, g^o$. When $\overline P_{\mathbf e}(G^o, g^o) = (0, -2\pi n)$ and $1/{\mathbf e}^2 = m\in\mathbb N$, we have a periodic orbit as described in the theorem. The map $\overline P_{\mathbf e}$ is analytic in ${\mathbf e}$, with \[\overline P_0(G^o, g^o) = (\mathfrak{m}\sin g^o, ~ - 2G^o).\] By the implicit function theorem, $g^o\equiv 0~\mod \pi, G^o = \pi n$, continues to solutions of $\overline P_{\mathbf e}(G^{\mathbf e}, g^{\mathbf e}) = (0, -2\pi n)$ for $0<{\mathbf e}<{\mathbf e}_o$, yielding periodic orbits of long periods for those ${\mathbf e}$ with $ 1/{\mathbf e}^2 = m\in\mathbb N$. \end{proof} \begin{rmrk} When the curvature is positive the precession is, as with the quasi-periodic motions, in the opposite direction to the particles motion around the conic, while for negative curvature in the same direction. \end{rmrk} \subsection{Lifted orbits} The continued orbits are the image under a near identity symplectic transformation of certain orbits of $F_{red}$ with the $O(\varphi)$ terms neglected: \[ H_{red} := Kep_\kappa + \kappa(\frac{\|\vec C\|^2}{2} - G^2). \] We describe how the precessing Keplerian orbits of $H_{red}$ lift to $T^*Q$. In the reduced space, $T^*I\times\mathcal{O}_\mu$, the orbits of $H_{red}$ are given by: \[ (p_\varphi(t), \varphi(t), Ad_{g(t)}^*\mu)\] where $g(t) = R_{\hat i}(\lambda)R_{\hat k}(\theta(t))$ is a rotation by $\theta(t)$ about the $\hat k$-axis followed by a rotation by $\lambda$ about the $\hat i$-axis. Moreover, $(\varphi(t), \theta(t))$ describe a precessing orbit of the curved Kepler problem having $G = \|\vec C\|\cos \lambda$ for its angular momentum. We take $\vec C = C\hat k$ (fig.~\ref{fig:com}), so that the isotropy is by rotations about the $\hat k$-axis. The ambiguity in the reduced orbit is $Ad_{g(t)}^*Ad_{h(t)}^*\mu$ where $h(t) = R_{\hat k}(\omega(t))$. Hence the lifted orbit, on $T^*Q$, is of the form: \[(*)~~~ (\varphi(t), p_\varphi(t), h(t)g(t), \mu).\] The Hamiltonian $H_{red}$ is the symplectic reduction of $H$ on $T^*Q$ given by $H(\varphi, p_\varphi, g, \mu) = H_{red}(\varphi, p_\varphi, Ad_g^*\mu)$. Requiring the lifted curve $(*) $ to satisfy the equations of motion of $H$, imposes the condition: \[\dot\omega = \kappa \|\vec C\|.\] In summary, a precessing Keplerian orbit with angular momentum $G$ lifts to an orbit with angular momentum $\vec C = C\hat k$ on $Q$ where the two bodies follow precessing Keplerian orbits centered (we use the notion of 'center' from fig.~\ref{fig:com} here) on the colatitude, $\lambda$, satisfying $C\cos\lambda = G$. The whole system is rotated with angular speed $\kappa C$ about the $\hat k$ axis. \begin{rmrk} As $\lambda\to \pi/2$, the center of the system approaches the equator and the bodies move along more eccentric conic sections until at the equator we have collision orbits. The rate of precession decreases as one moves closer to the equator, where the collision orbits cease to precess (see remark \ref{rmrk:split}, for a finer description of the equatorial behaviour). When $C > L$, there is a maximal value of $\lambda$, and such orbits are constrained to bands around the equator. \end{rmrk} The true motions of the curved 2-body problem established in the previous section are qualitatively the same as such lifted orbits of $H_{red}$, performing small oscillations around them.
\section{Introduction} Modern mobile applications demand low latency, mobility support, energy efficiency, and high bandwidth from back-end data stores that are usually hosted in cloud data centers and content delivery networks (CDN). The distance between mobile users and geographically distributed cloud data centers/CDNs substantially impacts latency. Future 5G and 6G networks aim to provide high-speed access to end devices while increasing traffic load of transit networks and workload of cloud data centers~\cite{Monserrat2015,Ren2019a}. CDNs and micro-data centers have been utilized to distribute the content with respect to geographic regions, hence, partially alleviating the issue of latency~\cite{Baccour2019}. It is estimated that mobile data traffic will increase 500-folds in the next decade with 80\% of the traffic contributed by video content~\cite{Index2017}. Consequently, several networking technologies have been proposed and deployed to bring computing and cache capabilities further closer to the end users. These technologies include Mobile Edge Computing (MEC), fog computing, cloudlets, and information-centric networks, etc~\cite{Ren2019a,Li2018,Qazi2019}. In general terms, the technologies providing cache and computing service in user proximity form an edge network~\cite{Liu2018,Bilal2018}. Edge network cache refers to an in-network storage that contains the content request by or relevant to edge users. The edge networks have solved the problems of high content latency in the last decade while reducing the load on backhaul networks with the help of in-network caching. The key research problems regarding caching at the edge networks are: \textbf{(a)} what (popular, multimedia), \textbf{(b)} when (time-series prediction), \textbf{(c)} where (base stations, mobile users), and \textbf{(d)} how (proactive, reactive) to cache~\cite{Sun2019}. 5G networks and Machine learning (ML) techniques play a vital role in optimizing edge cache performance. Mobile communication technologies have experienced exponential growth over the last few years in the number of users, applications, and data traffic with services ranging from multimedia streaming to online gaming~\cite{Bilal2018,Shuja2016}. It has been identified that existing network architectures will struggle to handle the massive delivery of data efficiently with minimum latency requirements~\cite{Shafi2017}. To this end, next-generation networks (NGN), i.e., 5G evolved with the help of emerging communication technologies, such as millimeter-wave (mmWave) communication and massive Multiple Input Multiple Output (MIMO)~\cite{Bogale2016,Sim2017}. Users in 5G networks often have similar interests, and content can be stored locally (in-network cache) to reduce access latency and load on backhaul, core, and transit networks~\cite{Ren2019}. Without caching, a large amount of backhaul traffic is consumed by fetching redundant copies of popular content~\cite{Yao2019}. 5G network architectures envision caching content at various layers of access, core, and aggregate networks with the help of edge network technologies~\cite{Sutton2018}. Edge caching is one of the key elements that help 5G networks meet stringent latency requirements~\cite{Taleb2017,Elazhary2019}. ML techniques have been prominently used to efficiently solve various computer science problems ranging from bio-informatics to signal and image processing~\cite{Camacho2018,AliHumayun2019}. ML is based on the premise that an intelligent machine should be able to learn and adapt from its environment based on its experiences without the need for explicit programming. ML techniques are beneficial for tasks requiring classifications, clustering, decision making, and prediction~\cite{Wang2020a}. ML techniques have been adopted in wireless networks to solve problems related to, but not limited to, resource management, routing, traffic prediction, and congestion control~\cite{Sun2019,Boutaba2018,Wang2020}. Main reasons behind the emergence of ML techniques in wireless edge networks include \textbf{(a)} increase in computing resources of edge devices facilitating in-network intelligence capabilities, \textbf{(b)} generation of large amounts of data from billions of Internet of Things (IoT) devices that can be statistically exploited for the training of data-driven ML techniques, \textbf{(c)} introduction of network function virtualization (NFV) and Software Defined Networks (SDN) for programmability and manageability of network devices, and \textbf{(d)} advent of collaborative and federated learning techniques for workload distribution of compute-intensive ML algorithms~\cite{Chen2019,Jiang2016,Plastiras2018}. One of the applications of machine learning in wireless networks is to estimate future user requests based on mobility, popularity, and preference data sets that have time-series dynamic characteristics. Several factors challenge the process of learning user characteristics in edge networks. Firstly, user privacy policies prohibit the sharing of user data among applications and service providers. Therefore, it is difficult to formulate a generic application-independent caching policy. Secondly, most of the user traffic is https based limiting insights to user requests over the Internet for any application~\cite{Zhang2018a}. Thirdly, edge networks evolve with dynamic user associations, preferences, and content popularity. Therefore, the learning processes must address the requirements of time-variant data~\cite{Ozcan2019}. Fourthly, the learning process should predict trends specific to an edge network while meeting the storage constraints at the edge. ML techniques can be leveraged to solve the challenges of what, where, and when to cache in edge networks. The application of ML techniques is more suitable to these challenges as: \textbf{(a)} ML techniques learn with few or no data~\cite{Sadeghi2017}, \textbf{(b)} ML techniques, such as federated learning can be used for privacy-preserving mechanisms of user data~\cite{Liu2020}, \textbf{(c)} ML techniques can identify dynamic online communities and popular content with time-variance facilitated by data-driven analytics~\cite{Shan2019}, and \textbf{(d)} ML techniques can optimize a cache placement and delivery problem for a set of network states and storage constraints~\cite{Li2018b}. Given the constraints on the availability of user data in edge networks, ML models that learn without prior knowledge are often applied to optimize caching decisions~\cite{Lien2018,Lim2020}. \begin{table*}[htbp] \centering \caption{Comparison with existing surveys} \label{tab:ex} \resizebox{.99\textwidth}{!}{ \begin{tabular}{|m{0.8cm}|m{4.5cm}|m{4.5cm}|m{4.5cm}|} \hline \textbf{Ref.} & \textbf{Contribution} & \textbf{ML Techniques Covered} & \textbf{Concentration} \\ \hline ~\cite{Wang2020} & Convergence of DL and edge computing & Deep Learning & Overall edge computing paradigm \\ \hline ~\cite{Lim2020} & Application of FL in MEC & Federated Learning & Overall edge network management \\ \hline ~\cite{Sun2019} & Application of ML in wireless networks & Machine Learning & Overall wireless network management \\ \hline ~\cite{Chen2019} & ANN based wireless network management & Artificial Neural Networks & Overall wireless network resource management \\ \hline ~\cite{Yao2019} & Survey of mobile edge caching & No & Edge caching (criteria, locations, schemes, and process) \\ \hline ~\cite{Li2018} & Content placement and delivery strategies in cellular networks & A brief discussion on ML techniques & Edge caching (networks, performance, and strategies) \\ \hline This study & Application of ML for in-network edge caching & Comprehensive ML techniques (supervised, un-supervised, RL, NN, and TL) & Edge caching (cache locations, policy, replacement, and networks) \\ \hline \end{tabular}} \end{table*} \subsection{Motivation} Modern mobile devices execute sophisticated applications, such as voice recognition, augmented reality, and high definition multimedia~\cite{Lien2018,Shuja2018,Hemanth2020}. Such applications require Ultra-Reliable Low Latency Communications (URLLC) and high user QoE. Next-generation 5G technologies envision to support the requirements of modern applications with disruptive data communication technologies (for example, mmWave communication~\cite{Bogale2016}), caching at various layers of the network~\cite{Ren2019}, and edge network architecture~\cite{Zahoor2020}. Therefore, to cope with ever-increasing bandwidth demands of emerging applications and constrained transit, backhaul, fronthaul, and radio access networks (RAN), intelligent user-centric in-network edge caching is indispensable~\cite{Taleb2017,Sutton2018}. The research challenges of cached edge networks due to their time-variant characteristics can be extensively solved with the application of ML techniques~\cite{Ozcan2019,Wang2020}. ML techniques can infer what to cache while driven by data from the user's historical content request~\cite{Wang2017a}. ML techniques can learn where to cache by predicting user locations from location histories and current context~\cite{Shan2019}. Similarly, ML techniques can optimize the caching decisions while contemplating network state and constraints of D2D and mmWave communication~\cite{Yin2018a,Chen2017}. Moreover, ML techniques can learn time-series content popularity from user request patterns and content features~\cite{Song2019}. The learning process can execute at any tier of the network including mobile devices, edges, and cloud servers, and can be federated or distributed~\cite{Yu2018,Lim2020}. Therefore, the application of ML techniques in intelligent and optimal edge caching decisions is essential to meet the requirements of multimedia and URLLC content delivery~\cite{Ahmed2017,Azimi2018}. ML techniques employed towards optimal edge caching decisions are driving technologies and use cases with low latency requirements, e.g., autonomous vehicles, online gaming, virtual and augmented reality, dynamic content delivery, video streaming, IoT, and smart cities~\cite{Tapwal2020,Chekired2019,Wang2020,Khan2020,Wang2017}. A survey specifically focusing and detailing the role, opportunities, and challenges of ML applications towards caching in edge networks was missing in the literature. We aim to fill the missing gap by specifically focusing on ML and caching in edge networks. \subsection{Existing surveys} In this article, we extensively survey ML-based edge caching techniques. Significant progress has been made in surveying applications of ML techniques in the edge, wireless, and cellular networks. Earlier surveys either focused on edge caching without focusing on ML techniques~\cite{Yao2019,Li2018,Goian2019,Wang2017}, or focused on the application of ML techniques to overall resource management in wireless networks~\cite{Sun2019,Lim2020,Wang2020,Chen2019}. Zhu et al.~\cite{Zhu2018} survey the application of Deep Reinforcement Learning (DRL) towards mobile edge caching. However, the survey was brief and focused only on the application of a specific ML class (DRL) to edge caching. Wang et al.~\cite{Wang2020} provided a comprehensive survey on deep learning applications and inferences towards resource management of edge computing paradigm. Researchers in~\cite{Lim2020} surveyed federated learning-based edge networks while focusing on resource management and privacy issues. Sun et al.~\cite{Sun2019} provided a comprehensive review of ML applications in wireless networks including resource management, backhaul management, beamforming, and caching. A comprehensive survey of cellular cache optimization techniques (stochastic, game theory, graph-based, and ML) was provided in~\cite{Yao2019}. This survey can be distinguished from earlier surveys on caching at the edge based on the fact that: \textbf{(a)} it focuses on the comprehensive application of ML techniques rather than a specific ML method~\cite{Zhu2018,Wang2020,Lim2020} and \textbf{(b)} it focuses on optimal caching decisions in edge networks rather than overall resource management~\cite{Chen2019,Sun2019}. Table~\ref{tab:ex} further lists existing surveys in the same direction to highlight the differences. \subsection{Contributions and organization} The main contributions of this article are as follows: \begin{itemize} \item We formulate a taxonomy of the research domain while identifying key characteristics of applied ML techniques, edge networks, and caching strategies. \item We detail the fundamentals of the research domain of edge networks while discussing the role of 5G and network virtualization in edge caching. \item We enlist state-of-the-art research on ML-based edge caching while categorizing the works on ML techniques, i.e., supervised learning, unsupervised learning, neural networks (NN), reinforcement learning (RL), and transfer learning (TL). We compare state-of-the-art research based on the parameters identified in the taxonomy to debate the pros and cons. \item We comprehensively debate key research challenges and future directions for the adoption of ML techniques for caching at the edge networks ranging from federated caching, content transcoding, user privacy, and federated learning. \end{itemize} \begin{table*} [htbp] \centering \caption{List of abbreviations} \label{tab:ab}}{ \resizebox{.99\textwidth}{!}{ \begin{tabular}{|m{1cm}|m{4cm}|m{1cm}|m{4cm}|m{1.2cm}|m{4cm}|} \hline \textbf{Abbr.} & \textbf{Full Form} & \textbf{Abbr.} & \textbf{Full Form} & \textbf{Abbr.} & \textbf{Full Form} \\ \hline {5G} & Fifth generation & {AP} & Access Point & {API} & Application Programmer Interface \\\hline {BS} & Base Station & {BBU} & Baseband Unit & {CDN} & Content Delivery Network\\\hline {CHR} & Cache Hit Ratio & {CNN} & Convolutional Neural Network & {CoMP} & Coordinated MultiPoint \\\hline {C-RAN} & Cloud Radio Area Network & {D2D} & Device to Device & D(RL) & (Deep) Reinforcement Learning \\\hline FL & Federated Learning & {F-RAN} & Fog Radio Area Network & HTTP & HyperText Transfer Protocol \\\hline HetNet & Heterogeneous Networks & {IoT} & Internet of Things & {MBS} & Macro Base Station \\\hline {MEC} & Mobile Edge Computing & {MDP} & Markov Decision Process & mmWave & millimeter-wave \\\hline {MIMO} & Multiple Input Multiple Output & {MNO} & Mobile Network Operator & {ML} & Machine Learning \\\hline {NGN} & Next Generation Networks & {NN} & Neural Network & {NFV} & Network Function Virtualization \\\hline {QoE} & Quality of Experience & {QoS} & Quality of Service & RAN & Radio Access Network \\\hline {RNN} & Recurrent Neural Network & {RRH} & Radio Remote Heads & {SBS} & Small Base Station \\\hline SDN & Software Defined Networks & {SVM} & Support Vector Machine & {TL} & Transfer Learning \\\hline {UE} & User Equipment & {URLLC} & Ultra-Reliable Low Latency Communications & {V2I} & Vehicle-to-infrastructure \\\hline \end{tabular}} \end{table*} The rest of the paper is structured as follows. Section~\ref{sec:funda} presents the fundamentals of edge networks, 5G technologies, and network virtualization. The discussion includes the role of caching towards 5G networks. Section~\ref{sec:tax} lists the taxonomy of ML techniques for caching in edge networks. In Section~\ref{sec:state} and~\ref{sec:comparison}, we present state-of-the-art caching techniques based on ML and their comparison. Key challenges and future research directions are comprehensively discussed in Section~\ref{sec:cfd}. Section~\ref{sec:conc}, concludes the article. \section{Fundamentals of Edge Networks and 5G Technologies}\label{sec:funda} Edge caching defines a edge user-centric cache that has limited storage capacity and saves content that are only relevant to the edge users~\cite{Wang2017,Tran2017}. The limited storage capacity of edge and the dynamic characteristics of user (mobility, content access, etc) make the caching decision distinct from CDN caching. The optimal caching decisions in edge networks are based on multiple inputs such as, content popularity prediction, user mobility prediction, user access prediction, and wireless channel condition prediction. As a result, ML techniques are employed to predict the input features to the optimal caching problems~\cite{Sun2019,Chen2019}. We provide an overview of edge networks, 5G, and network virtualization in this section. We also discuss the role of edge caching in 5G networks. Moreover, the role of network virtualization technologies (SDN and NFV) in edge caching is explored. The list of abbreviations adopted in this article are listed in Table~\ref{tab:ab} for better article readability. \begin{figure*} \centering \includegraphics[height=4.5cm]{images/5g2b.png} \caption {5G conceptual architecture~\cite{Sutton2018}} \label{fig:5g} \end{figure*} \subsection{Edge Networks} The principle of edge computing is to relocate compute, storage (cache), and communication services from centralized cloud servers to distributed nodes (users, BSs) located at the edge of the network~\cite{Wang2017,Kibria2018}. The inter-connected edge resources form an edge network. The principle of edge computing is supported by a set of networking technologies that vary in architecture and protocol. Edge computing technologies include cloudlets~\cite{Jararweh2016}, fog computing~\cite{Bilal2018}, and MEC~\cite{Ahmed2017,Othman2017}. While locating resources at the edge of the network in user proximity, edge computing promises reduced service latency, backhaul bandwidth reduction, UE energy efficiency, and context-awareness that can be utilized for intelligent service placement. MEC was envisioned by the European Telecommunications Standards Institute (ETSI) proposing virtualization of resources to enable execution of services at the network edge~\cite{Hu2015}. Hence, network virtualization is a key enabler for MEC. The architecture of fog computing was proposed by Cisco to extend cloud services to the wireless edge network specifically serving IoTs~\cite{Klas2015}. Fog computing deploys an intermediate platform between end devices and cloud infrastructure to distribute services near users and facilitate time-sensitive applications~\cite{Bilal2018}. Cloudlets represent the middle tier of the three-tier architecture consisting of mobile devices, microdata centers (cloudlets), and the cloud~\cite{Satyanarayanan2009}. The key enabler for cloudlets are also virtualization technologies as virtual images representing cloud services are moved towards the edge networks~\cite{Elazhary2019,Shuja2016a}. Edge networks can be defined as a network architecture that deploys flexible computing and storage resources at the network edge, including the RAN, edge routers, gateways, and mobile devices, etc., with the help of SDN and NFV technologies~\cite{Wang2017,Ahmed2017}. Edge caching considered in this article can encompass any of the above-mentioned edge computing technologies. \subsection{Role of caching in 5G technologies} The idea of caching was first applied to Internet services in the form of CDNs. The content from cloud data centers is stored in CDNs which are distributed over a region that may encompass multiple states and countries. Edge network caching brings the content storage further near to the end user with support of enterprise networks and network service providers. Edge caching has been considered recently to improve content delivery in wireless networks~\cite{Bilal2018,Ahmed2017}. The role of caching in NGNs can be emphasized by putting forward a question: Can edge caching tackle the challenges of URLLC, QoE, and cost in 5G networks? The answer is an emphatic yes. The advancements in 5G networks and high-resolution multimedia content means that the network bottleneck will shift to the core and transit links~\cite{Paschos2018}. Therefore, caching in user proximity may be the only viable solution for growing user requirements from multimedia and virtual/augmented reality applications with time-sensitive stipulations~\cite{Yao2019,Schwab2020}. With the rapid advancements in mobile communication technologies, an ever-increasing number of mobile users are experiencing a wide variety of multimedia services, such as video sharing, video conferencing, real-time video streaming, and online gaming using smartphones and tablets. According to Cisco, the global mobile data traffic is 41 Exabytes per month, and it will increase to 77 Exabytes, containing 79\% of video data, by 2022~\cite{Index2017}. This exponential growth had put a huge burden on the capacities of RAN, transit link, and core network due to the centralized nature of mobile network architectures~\cite{Wang2015,Li2015,Li2015a}. Research and academia identified some major requirements for NGNs, i.e., deliver the content with minimum latency, provide higher bandwidth, and support 1000 times more number of users~\cite{Monserrat2015,Shafi2017,Andrews2014}. Specifically, the current mobile network architectures are unable to efficiently handle the huge delivery of contents that are repeatedly requested by multiple users, for example, the request for the same Ultra High Definition (UHD) videos put a huge burden over the transit link and core network. The massive and variable traffic demands make it difficult to achieve good service performance and deliver high QoE for user-centric applications~\cite{Paschos2018,Chen2014}. To address the above-mentioned challenges, novel mobile architectures and advanced data communication technologies, such as mmWave communication~\cite{Taori2015}, MIMO)~\cite{Xiang2014}, ultra-wideband communication~\cite{Zhang2019}, and Heterogeneous Networks (HetNets)~\cite{Bogale2016} are evolving the advancement of next-generation, i.e., fifth-generation (5G) mobile networks. 5G cellular networks system designs in collaboration with new application-aware approaches improve the network resources utilization and reduce traffic demands. A generic conceptual architecture of 5G developed by Sutton et al.\cite{Sutton2018} is illustrated in Figure~\ref{fig:5g}. The figure depicts the proposed architecture for the 5G networks. Edge computing and caching is an integral part of 5G network and holds a key role in attaining the 5G objectives. The edge commuting support and caching can be placed at any layer (core, aggregation, and access) and even be situated at base stations in the proposed 5G architecture. The flexibility for edge placement is offered to ensure the appropriate and optimal use of constrained edge resources as desired. One of the major approaches to reduce the burden from the backhaul and core network is to cache the popular content in the near vicinity of the users to reduce the redundant downloads of similar content~\cite{Wang2014,Woo2013,Rodrigues2020}. For this purpose, the Content Delivery Networks (CDNs) caches are proposed as an integral part of 5G network architecture. According to Andy Sutton, a principal network architect at BT, the conceptual 5G network architecture, as shown in Fig~\ref{fig:5g}, provides the caching facility at different layers of the hierarchical model~\cite{Sutton2018,Khan2019}. According to architecture, the CDNs can be deployed at the Core, Aggregation, Access, and even at Base Station (BS) layer. By leveraging the content placement strategies, popular content can be cached proactively during the off peak-hours to reduce the burden on the transit link during the peak hours~\cite{Mueller2016,Qiao2016}. The requirements of URLLC for NGNs are driving the cache locations further near to the users. The emerging paradigm in edge caching is caching at UE with D2D communication for content diffusion. The URLLC UE caching architecture arises from the elements of \textbf{(a)} high-speed D2D communication protocols, \textbf{(b)} high-storage capability in modern smartphones, and \textbf{(c)} emerging ultra-dense networks~\cite{Shen2017,Li2019a,Association2016}. As a result, caching strategies are migrating from centralized CDNs to highly distributed UEs. The UEs are highly mobile, have individual content preferences, communicate in social-aware patterns, and are part of multiple online social communities. The ML techniques come to the forefront to solve complex problems of popularity and mobility prediction, user and content clustering, and social community detection in edge networks~\cite{Nitti2019,Shan2019}. \subsection{Role of SDN and NFV in Edge Caching} The SDN/NFV technologies are gaining momentum and are enablers of intelligent edge and cloud networks~\cite{Paschos2018}. SDNs are based on the principle of decoupling data plane from the control plane of the network~\cite{Huo2016}. As a result of the decoupling, SDNs provide three key characteristics of flexibility, programmability, and centralized control for ML-based edge networks. The network functions can be abstracted and programmed for evolving application requirements and logically implemented through a centralized control plane throughout an edge network~\cite{He2017a}. The benefits of implementing SDNs for ML-based edge caching are three-fold. First, the programmable control plan can be utilized to implement a distributed in-network intelligence framework among network entities~\cite{Lei2018,Din2019}. Secondly, ML techniques are data-driven. The SDN controller has a centralized view with the ability to collect network data and enable the application of ML techniques~\cite{Xie2019}. Thirdly, SDNs allow flexible routing of user requests to distributed and hierarchical cache locations within the network~\cite{Mehrabi2019}. NFV allows virtualization of the common physical channel into multiple virtual channels/functions that can be shared among users with varying QoS requirements. Moreover, NFV decouples network functions from dedicated network devices so that they can be implemented over general-purpose computing systems~\cite{Yousaf2017,OrdonezLucena2017}. As a result, in-network intelligence and network functions can execute on the same general-purpose computing platform. The network virtualization technologies are creating further opportunities for edge caching while empowering MNOs to manage the compute, storage, and network resources. The virtualization technologies are helping in the migration of caching services from CDNs to the wireless edge. The caching service can be implemented as a Virtual Network Function (VNF) at the network edge with the flexibility of cache initiation and scaling on the fly. Allocating in-network edge resources falls under the category of network slicing~\cite{OrdonezLucena2017,Mehrabi2019}. More importantly, network virtualization technologies enable the implementation of learning capabilities at the edge network, hence, leading to optimal caching decisions. Moreover, available free resources at any network layer may also be allocated elastically as required according to the QoS requirements. Therefore, it can be established that network virtualization technologies are empowering 5G networks with edge caching and intelligence capabilities~\cite{Yousaf2017,Taleb2016}. ML techniques have also been extensively applied to SDN technologies for resource management, security, and routing optimization~\cite{Xie2019}. \begin{figure*} \centering \includegraphics[width=13cm]{images/tax2.png} \caption {Taxonomy of Machine Learning Techniques for Caching in Edge Networks} \label{Fig:tax} \end{figure*} \section{Taxonomy of ML based edge caching}\label{sec:tax} This section presents the taxonomy of ML applications in edge caching. The aim of this section is to provide the reader with background knowledge of the research domain in detail with the help of categorized concepts. Figure~\ref{Fig:tax} illustrates the taxonomy of the article with major classification as: \textbf{(a)} ML (technique, objective, and features) \textbf{(b)} Caching (location, policy, and replacement), and \textbf{(c)} Edge Networks (delivery network and strategy). The necessary elements of the taxonomy are explained in detail as follows. \subsection{ML Technique/Method} The main application of ML in caching is to answer what and when to cache so that the caching objectives (cache hit ratios, latency, throughput, etc) are optimized. The ML techniques used to find this answer can be generally characterized into \textbf{(a)} supervised learning, \textbf{(b)} unsupervised learning, \textbf{(c)} RL, \textbf{(d)} NN, and \textbf{(e)} TL techniques~\cite{Sun2019,Goian2019}. In some scenarios, multiple ML techniques can be applied to a problem of what to cache at the edge/wireless networks with the objective to find solutions to sub-problems, such as, popularity prediction, cache decision optimization, and user clustering. Supervised learning aims to learn a general rule for mapping input to output based on the labeled data set. Example input and corresponding outputs train the learning agent to learn the mapping of the rest of the data set~\cite{Chang2018,Miyazawa2016}. Unsupervised learning aims to learn the mapping function based on un-labeled data~\cite{Cao2019,Sun2019}. A learning agent continuously interacts with its environment to generate a mapping function based on immediate response/reward in RL~\cite{He2017a}. NNs are inspired by the structure and function of biological NNs that can learn from complex data. NN generally consist of input, hidden, and output layers~\cite{Teerapittayanon2017,Lim2020}. The goal of TL is to utilize knowledge of a specific (source) domain/task in the learning process of a target domain/task. TL avoids the cost of learning a task from scratch~\cite{Chen2019a,Hou2018}. Semi-supervised learning aided by both supervised and unsupervised learning models is also a popular ML technique but rarely utilized for caching in wireless networks~\cite{Bommaraveni2019}. 5 \subsection{ML Objective} In most of the research works listed in the next section, ML techniques are applied to multiple sub-problems. For example, the objective of ML can be: \textbf{(a)} prediction (popularity, mobility, user preference), \textbf{(b)} problem optimization, \textbf{(c)} clustering (user, BS, content), \textbf{(d)} cache replacement, and \textbf{(e)} feature extraction~\cite{Sun2019,Wang2017}. Prediction is often the most difficult task in this scenario (edge network) where assumptions are made regarding user preferences and content history. We consider prediction as to the primary objective of ML application while other objectives as secondary. The non-standard and non-public data sets also hinder research evaluations on common grounds. For example, the data for content popularity at YouTube CDNs can be obtained which pertains to a wider geographic region than edge networks. Some studies assume this wider regional data as edge network data and predict future content popularity. Similarly, user preferences are enclosed in application layer data across the network where service providers are compliant to privacy laws. Social media publishers (Twitter, Facebook, etc) provide API based access to user data with increasing restrictions due to recent data breaches~\cite{Cadwalladr2018,Wang2019b}. ML techniques have been applied to find an optimal resource allocation solutions in cached networks, i.e., where, what, how, and when to cache. ML techniques have also been employed to reduce the time complexity of the mathematical formulation of cache optimization problems. Generally, given the input and sample optimal solutions, the algorithms learn optimal solutions for varying inputs~\cite{Sun2019}. Unsupervised clustering techniques are applied to data during pre-processing stages to group data and find similarities. Clustering partitions a data-set into communities with samples that are more similar to each other based on a similarity/distance function. The clustering of users is based on their D2D connectivity and social-awareness. BSs are clustered based on their coverage area while content clustering is based on data similarity~\cite{Liu2020}. Cache replacement strategy can be learned using an ML (RL, Q-learning, etc) such that the reward/Q-values of the problem are inferred from a cache hit ratios~\cite{Tanzil2017}. \subsection{Features and Patterns} ML techniques often take various features and patterns of the environment as input to train the model. In edge caching, the environment variables that require modeling or have historical data and are input to the ML framework are: \textbf{(a)} content popularity distribution, \textbf{(b)} content access/request distribution, \textbf{(c)} user mobility model, and \textbf{(d)} network state model. The content popularity is modeled mostly as zipf distributions~\cite{Liu2019}. Moreover, content popularity can be predicted with the help of ML techniques based on historical information~\cite{Tanzil2017}. User content requests are modeled as poisson point distributions~\cite{Hu2018} or zipf distributions~\cite{Bommaraveni2019}. User content requests can be estimated with the help of ML techniques based on content features~\cite{Tanzil2017}. User mobility is modeled as poisson point process (PPP)~\cite{Jiang2019a}, random walk model~\cite{Malik2020} or Markov process~\cite{Liu2019}. User mobility can also be predicted with the help of ML techniques given user context and historical information regarding user behavior~\cite{Li2019}. The dynamic wireless network state is modeled as finite-state Markov channel~\cite{Xiang2019} or assumed to be invariant. \subsection{Cache Placement} Cache placement answers the query of where to cache. The caching places in a wireless edge network can be \textbf{(a)} User equipment (mobile devices, home routers), \textbf{(b)} BSs (small, macro, femtocells), \textbf{(c)} BBU pool/CRAN, \textbf{(d)} mobile core network, and \textbf{(e)} collaborative as joint placement in multi-tier caching architecture~\cite{Said2018,Yao2019}. Mobile devices are becoming increasingly sophisticated with larger storage capacities and can act as in-network caches. Caching at UE is also known as infrastructure-less caching and leads to lower the burden on access/cellular networks, low network latency, and higher spectrum utilization while offloading wireless traffic. D2D links in unlicensed-band are required for content communication among UEs. BS of all form and sizes (Macro, small, femto, etc) provide relatively higher latency compared to local caching but connect to a larger set of users in the wireless coverage area. Similarly, service providers in the form of C-RAN, F-RAN, and MEC often provide proximate cache and compute services in user hotspots. Virtualized Baseband Unit pools (BBU) can be utilized as cache location for service providers with the help of SDN and NFV technologies. Service provider's independent infrastructure in the form of edge servers can be added and connected to MNO equipment for content caching~\cite{Wang2019}. Service provider caches provide higher caching capacity and area coverage with higher latency~\cite{Yao2019}. Moreover, C-RAN based cache placement enables service providers to gather vital content features (hits, likes, etc) from central or geographically federated data centers and employ them in the learning process to improve cache hit rates. Some researchers have utilized collaborative caching techniques where the cache placement is distributed among multiple elements in the wireless network with the help of coding schemes~\cite{Fadlallah2017}. The content-coding schemes divide each content into smaller segments for distributed placement and cache size optimization~\cite{Li2018}. Cache placement can also be federated and collaborated among MNOs to reduce redundancy~\cite{Taleb2019}. While caching content closer to the user, user mobility is a larger challenge due to its D2D communication link coverage from cache enabled UE and BS association. Caching content at C-RAN reduces the challenge of user mobility~\cite{Ye2019,Goian2019}. \subsection{Caching Policy} The caching policy can be either proactive or reactive and solves the problem of how to cache while partially responding to when to cache. In the reactive policy, the content is cached once it is requested by a user. When a user request a content, it is delivered from local cache if found. If the content is not found, it is progressively requested from nearby devices in a D2D network, MEC server, and CDNs. During the content delivery phase, it may be cached at multiple locations according to the caching policy. Figure~\ref{fig:re} illustrates the concept of reactive caching in Edge networks. \begin{figure} \centering \includegraphics[width=8.5cm]{images/react.png} \caption {Reactive caching in Edge Networks} \label{fig:re} \end{figure} The proactive approach predicts the popularity based on user preferences and pre-fetches content to further lower access time. A ML framework executing on a cloud or MEC server can predict content popularity based on an edge network's user access features and proactively push content to edge caches. Proactive caching policies have their benefits and challenges. Proactive caching considerably reduces the delay, increases the QoE, and relieves the burden form the transit and backhaul links, specifically in peak hours. Proactive caching can also opportunistically cache content such that network non-peak hours are utilized for UE caching leading to higher spectral efficiency~\cite{Yao2019,Chang2018}. However, proactive caching may result in poor cache hit ratio specifically in edge network where a content which may not be popular is cached on the edge. Moreover, proactively caching a content which may not be accessed requires storage space for caching, which can only be gained by removing stored content. Consequently, redundant fetches may occur for the deleted content specifically in case of small caches. Therefore, it is necessary to apply ML techniques aided by content popularity, user access, and mobility data to benefit from proactive caching and address its challenges~\cite{Liu2019,Baccour2020a}. The learning process is difficult as it increases the number of sub-problems, such as popularity prediction and mobility prediction. Figure~\ref{fig:pro} depicts the idea of proactive caching in Edge networks. \begin{figure} \centering \includegraphics[width=8.5cm]{images/pro.png} \caption {Proactive caching in Edge Networks} \label{fig:pro} \end{figure} \subsection{Cache Replacement} In general computing and CDN caching systems, Least Frequently Used (LFU), Least Recently Used (LRU), and First In First Out (FIFO) algorithms are utilized for cache replacement/eviction. However, the standard recency-based and frequency-based caching algorithms can not be applied to wireless edge networks due to its non-deterministic properties~\cite{Xu2018}. Cache replacement techniques are also necessary as the caching capacity of most network devices is very limited as compared to CDN resources. Moreover, approximately 500 hours of videos are uploaded on YouTube alone every minute~\cite{Index2017}. Therefore, considering the rate of data generation, cache population and replacement play a significant role in user QoE~\footnote{https://www.statista.com/statistics/259477/hours-of-video-uploaded-to-youtube-every-minute/}. The approach followed by some of the state-of-the-art works in wireless networks is learning-based cache replacement. Generally, a Q-learning algorithm can be applied by a UE to act as an independent or joint learner to learn the reward/Q-value of caching/replacement decisions~\cite{Jiang2019a,Wang2017a,Lee2020}. On the other hand, some research works have not considered the sub-problem of cache replacement~\cite{Chang2018} while some have considered a caching decision problem for instance \textit{t+1}~\cite{Thar2018}. \begin{figure*} \centering \includegraphics[width=13cm]{images/delivery2.png} \caption {Types of delivery networks in edge caching} \label{fig:delivery} \end{figure*} \subsection{Delivery Network Type} The access layer of the edge network considering caching architectures can be categorized as \textbf{(a)} macro-cellular networks, \textbf{(b)} HetNet, \textbf{(c)} C-RAN/ F-RAN/ MEC, and \textbf{(d)} D2D networks~\cite{Li2018,Wang2017}. Figure~\ref{fig:delivery} depicts the four types of delivery networks for edge caching connected to a core network. In macro-cellular architectures, UEs are connected to a single macro BS at a time~\cite{Woo2013}. HetNets comprise of UEs with multiple access technologies, such as 5G and Wi-Fi~\cite{Mehrabi2019}. Moreover, HetNets can also be defined as networks where UEs lie in the coverage of multiple BSs (caches) of different cell sizes such as macro and pico~\cite{Zhang2015}. Content can be cached on any of the BSs. However, HetNets cache content on multiple BSs so that the UEs can obtain content from the closest BS based on its communication parameters~\cite{Kabir2020}. The caching capacity and coverage area in HetNets is generally low as compared to macro-cellular architecture. C-RAN/F-RAN cellular architectures employe a central pool of BBU resources with the help of virtualization techniques for processing and caching~\cite{Chen2018}. Cache-enabled D2D networks utilize UE caching capacity and communicate content in close range bypassing BSs and MNOs. UEs often coordinate in clusters based on short-range communication~\cite{Nitti2019}. \subsection{Delivery Strategy} Content delivery strategies try to reduce the load on both front-haul and back-haul networks and reduce duplicate packet transmissions. Delivery strategies employed to deliver cached content in wireless networks are \textbf{(a)} D2D, \textbf{(b)} multi-cast, and \textbf{(c)} coordinated multipoint (CoMP) transmissions. D2D communications are possible in dense networks where content cached on one user device can be sent to nearby users using the unlicensed band (Bluetooth and Wi-Fi)~\cite{Li2019}. D2D caching also utilizes relay/helper nodes when the source and destination nodes can not communicate directly with short-range communication~\cite{Yao2019}. The state of a UE battery may determine their participation in D2D communication. Subsequently, D2D caching requires incentives for UE to act as caching helpers over longer periods of time~\cite{Liu2016}. Multi-cast delivery in caching enabled networks results in packet delivery to multiple users within the network cell. Often in popular live streaming videos in online social networks and video-on-demand services, content is simultaneously watched by multiple users and multi-cast delivery results in reducing duplicate packet transmission~\cite{Bilal2019}. MNOs collect user requests for content over a time frame so that multiple requests for the same content can be furnished simultaneously. Multi-cast delivery has not been discussed in detail in edge caching scenarios. However, amalgamation of multi-cast with ML techniques can result in considerable gains in caching, RAN resource management, and user QoE. ML based prediction techniques may be applied to multi-cast same content to multiple UEs for proactive caching saving RAN resources, minimizing delay, and delivering high QoE. CoMP refers to various techniques that aim for dynamic coordination of data transmission/reception at multiple geographically separate sites~\cite{Wang2017}. In particular, a UE lying at cell edge can be connected to multiple BSs with the aim of improving overall QoE. The user can be connected to one of the BSs which does not have cache of requested content. CoMP delivery can be employed to provide the requested content from other BSs within the coverage network. A non-traditional content delivery strategy is to change the user association in a HetNet with overlapped coverage so that the user is associated with a BS which has the cached content~\cite{Liu2016}. Cache delivery strategies also optimize UE power allocation, channel allocation, and other required transmission parameters~\cite{Li2018}. The main objectives of caching in edge networks are \textbf{(a)} low content delay/access time \textbf{(b)} low backhaul load, \textbf{(c)} energy efficiency for both end user and MNO, \textbf{(d)} higher network throughput, \textbf{(e)} higher spectral efficiency, \textbf{(f)} reduce MNO cost, and \textbf{(g)} increase user QoE~\cite{Li2018,Wang2017}. The optimization problem can be formulated such that it reduces one or more than one of these parameters. The application of ML to caching can further optimize these parameters as a result of higher CHR~\cite{Wei2018}. Caching and backhaul data offloading in edge networks often serve the same concept and purpose~\cite{Wang2017a,Zhao2019}. We use the term of edge caching throughout this article. The user request for content can be realized from many sources. The requested content can be accessed from the local cache, nearby UEs with D2D communications, and BSs with wireless communication. The content can be cached in the MEC server, virtualized C-RAN resources, or central data stores in the form of CDN/clouds~\cite{Yao2019}. \section{State-of-the-art: Machine Learning based Caching}\label{sec:state} Figure~\ref{fig:int} depicts a high-level conceptual framework of ML-based edge caching. Social-awareness~\cite{Bui2018}, mobility patterns~\cite{Hu2018}, and user preferences~\cite{Ren2019} are input to an ML framework that can be federated among multiple nodes, hosted at distributed MEC servers, C-RAN, or centralized CDN. The inputs to the ML based caching decision framework are extracted from social networks, D2D communications, and V2I communications. The intelligent and optimal decisions are fed-back to the caches that are managed by network virtualization techniques~\cite{He2017a,Luo2019}. Innovation is brought to caching placement techniques with the help of UAV mounted caches that can be directed towards dense user populations and real-time events~\cite{Cheng2018}. The low-level design considerations of ML based edge caching will be debated and illustrated in forthcoming sections. \begin{figure*} \centering \includegraphics[width=13cm]{images/int.png} \caption {The Concept of Edge based Intelligence for Edge Caching} \label{fig:int} \end{figure*} We divide the state-of-the-art studies regarding caching in edge networks based on ML techniques categorized into supervised, unsupervised, RL, NN, and TL based methods. Two uncategorized works are listed in a separate subsection. The discussions of remaining taxonomy branches (ML objective, cache locations, network type, etc) are incorporated within this section to avoid redundancy of the ideas considering the length of the article. Most of the related works utilize more than one ML technique where one of the ML techniques is used in prediction (popularity, mobility, user preference) while the other is utilized to find optimal solutions for caching (placement, delivery, replacement) with lower time-complexity. We categorize the related work based on the ML technique applied for prediction or clustering as these are the primary objective of ML application in caching enabled networks. The ML techniques within supervised learning, unsupervised learning, RL, NN, and TL are defined when first referenced. Interested readers can find a detailed overview of ML techniques in~\cite{Sun2019,Chen2019}. \subsection{Supervised Learning} Doan et al.~\cite{Doan2018} presented a caching scheme that predicts the popularity growth of published videos and estimates the popularity of new (unpublished) videos based on features extracted from published videos and their similarity with new videos. A backhaul link video traffic data minimization optimization problem that finds the optimal part of the video for caching is formulated and solved with linear programming. The optimization solution requires the popularity of both published and new videos as input. The spatio-temporal features of both published and new videos are extracted with a 3D convolutional neural network (CNN) with multiple stage pooling. CNN is a type of deep learning algorithm where convolution is applied in more than one layer of a multi-layer stacked network of convolutions and pooling. A G-dimensional vector represents features of a video and is mapped to the video categories. The clustering algorithm based on Jaccard and cosine distances are applied to extracted features to limit the curse of dimensionality. The number of features input to the clustering algorithm are restricted to reduce the complexity of the clustering algorithm. Support Vector Machine (SVM) is employed to classify each video into a video category. SVM is a type of unsupervised learning algorithm that finds a hyperplane in n-dimensional space to classify data points. A supervised ML model with published videos as training data is trained to predict the popularity of new videos while comparing similar video features. Expert advice is incorporated to update training data and evaluate the behavior of popularity predictor. The research does not take into account user mobility and the dynamic nature of the wireless network. However, the proposed work has the ability to predict the popularity of unpublished videos without historical information using supervised learning. The authors extend their work in~\cite{Doan2019} for socially-aware caching where social-awareness is measured as the frequency of D2D connections. Thar et al.~\cite{Thar2018} present a popularity based supervised and deep learning framework for proactive BS caching in MEC. The proposed cloud (master node) based framework predicts the video popularity using supervised and deep learning in two steps and pushes the learned cache decisions to the BSs (slave nodes). First, a data collector module collects data regarding request counts for video identifiers to predict future popularity and class of videos using supervised learning. Second, future request counts for video content are predicted using deep learning algorithms. An optimization framework is formulated to reduce the content access delay in future \textit{(t+1)} while making caching decisions at time \textit{t} based on cache capacity constraint. RNN and CNN models are evaluated for the training of popularity prediction and request count learning agents. The overall cache decision optimization problem is solved with deep NN which is composed of multiple levels of nonlinear operations and multiple hidden layers. The Movie Lens database is utilized as the data set. Authors in~\cite{Zhang2018} utilize learn-to-rank algorithm (supervised learning) and BS clustering (k-means) for caching in a small cell network scenario. The learn-to-rank does not directly use content popularity. Instead, the content is sorted based on its popularity rank. The objective of the study is CHR maximization and the optimization problem is formulated as integer programming whose solution is NP-hard if the content popularity is not known. The authors employ a learn-to-rank algorithm based on historical content requests. K-means clustering is applied to group SBSs based on historical request records for each file. K-means clustering algorithm partitions n data points into \textit{K} clusters such that each data point belongs to a cluster with the nearest mean. Afterward, a learn-to-rank algorithm is applied to predict the ranking of content popularity. Top one popularity is used to predict the probability of the number of requests for each file. The authors presented learning-based caching at SBS and UE in~\cite{Bastug2016,Bastug2014} to meet a required user satisfaction ratio. The authors considered proactive caching at SBS with the help of supervised learning. Each SBS learns a popularity matrix for its user with rows representing the users and columns representing content ratings. The missing matrix entries are inferred using collaborative filtering (recommendation systems). The proactive caching approach uses training and placement steps to offload traffic from backhaul links. In the first step, the popularity matrix is estimated while solving a least square minimization problem. The placement step is executed greedily until the caches are filled. In the second case study, the social relationship between users and their physical proximity is utilized for proactive caching at UE with D2D communications. The centrality measure that quantifies how well a user is connected is adopted for measuring the influence of social users. The authors utilize eigenvector centrality which is based on the largest eigenvalue of the adjacency matrix of the social network. Social influencers are grouped in communities with K-means clustering. The critical content of each community is stored in caches of social media influencers based on the premise that they are highly connected with the community for content distribution. The study is evaluated based on the dynamics of parameters such as the number of content requests, size of the cache, and zipf distribution parameter $\alpha$. The process of supervised learning in an edge network described in this study consists of four steps. First, the user content rating and preferences are collected during peak activity hours. The content popularity is estimated with supervised learning algorithms. The most popular content with respect to a group of edge users is cached. User request are served from local cache in case of a cache hit. \subsection{Unsupervised Learning} Chang et al.~\cite{Chang2018} proposed a big data and ML-based framework for caching in edge networks. The authors provide two case studies to investigate smart caching in edge networks. In the first case study, unsupervised learning and deep learning are combined for the energy efficiency of data transmission optimization framework with constraints of user request latency. K-means clustering (unsupervised learning) is applied to group users in each cell based on user history and channel conditions. Selective scheduling is utilized to serve the end-user requests from the clustered groups. A DNN is trained to learn the behavior of optimal solutions based on input parameters (channel conditions and UE file requests) to reduce the time complexity of optimization. In the second case study, similarity learning is applied to investigate social ties between end-users where some users act as data receivers while others act as data transmitters (caches). A Kullback-Leibler-divergence-based metric is used to find similarity (common data interests) among UEs. This similarity (social tie) is then compared with D2D link quality. A one to one match between receiver and transmitter nodes is established based on the quality of social and physical ties. Liu et al.~\cite{Liu2020} proposed a proactive caching framework for next-generation cellular networks (HetNet) based on K-means clustering and content popularity prediction. The K-means clustering requires user location and content preferences as input to train the prediction model which can lead to privacy issues. It is advocated that traditional privacy-preserving algorithms based on symmetric encryption can lead to low user quality of experience due to their computational complexity. Therefore, the authors enhance the K-means algorithm as Privacy-preserving Federated k-means (PFK-means). A setup stage is utilized to share cryptographic keys among BSs and end-users for data authentication and signature. Subsequently, and update process performs the modified k-means algorithm in four phases namely, centroid initialization, mini-batch selection, mask key sharing, and centroid update. This results in cluster formation and cluster centroids are updated with encrypted data sharing when a user leaves or enters the cluster. The authors augment their framework with a light-weight privacy-preserving scheme that is based on secret sharing and federated learning. Federated learning conceptualizes usage of UEs to execute distributed ML model training instead of a centralized server. The UEs send ML model updates rather than data to the server, hence, preserving data privacy. \begin{figure*} \centering \includegraphics[width=13cm]{images/federated.png} \caption {The Concept of Federated Learning for Privacy Preservation in Edge Networks} \label{fig:fed} \end{figure*} The location of ML model can be centralized on a cloud server, collaborative between MEC and cloud server, or federated among multiple UEs and cloud. In the case of cloud computing, user data is sent to cloud servers to aid execution of ML models for training and prediction of caching related parameters. This approach incurs communication cost and may compromise user privacy during transmission. In the case of MEC, the users send their data to edge servers that execute ML models or further offload them to cloud servers. The collaborative MEC-cloud approach also leads to communication cost and privacy risk. Moreover, both MEC and cloud based approaches are unsuitable for applications that require constant training~\cite{Niknam2020}. Federated learning guarantees privacy as the data does not leave UE. Partial ML models are executed on the UE with local parameters such that the device is not computationally exhausted. The UEs collaboratively execute the ML model and send the output parameters of trained model to the FL server that aggregates the results. Figure~\ref{fig:fed} illustrates the difference between different learning approaches in edge networks (federated, MEC, cloud) to highlight the benefits of federated learning towards privacy-preserving mechanisms~\cite{Lim2020,Qian2019}. \subsection{Reinforcement Learning} Most of ML-based caching techniques in wireless networks apply RL to solve a sub-problem in their research method. The dynamic characteristics of wireless networks favor the application of RL techniques that can learn maximal rewards while interacting with the environment on trail and error basis~\cite{Zhu2018,Yu2019,Hu2018}. The learning process of an RL agent can be modeled as optimal control of Markov Decision Process (MDP)~\cite{He2017b} as described in the most of following listed studies. Delayed reward and trail and error are the two main features of RL. The first feature state that the RL agent looks does not consider immediate reward as optimal and looks for cumulative reward over a long time specified by a reward function. The second feature states that the RL agent finds a trade-off between exploration and exploitation. The agent exploits actions that have been proved to yield better rewards in the past while progressively exploring new actions that may yield better rewards~\cite{Yu2019,Zhu2018}. A BS based distributed edge caching and D2D content delivery framework was presented in~\cite{Wang2017a}. The focus of the article in on edge cache replacement technique. An MDP optimization problem is formulated that minimizes cache replacement transmission cost based on variables such as content popularity, cellular serving ratio, and communication cost of cache replacement from one BS to another. A Q-learning algorithm is adopted to solve the optimization problem of transmission cost minimization while identifying cache replacement at each BS. Q-learning is a type of RL algorithm that interacts with its environment to learn Q-values based on which the learning agent takes action. The cellular serving ratio for the static network is calculated from the maximum weighted independent sets of a conflict graph. In the dynamic network scenario, the cellular serving ratio is calculated using probabilistic methods. The cellular serving ratio helps determine the caching capability of users with D2D communication. As the cache replacement process is distributed at each BS, each BS calculates its replacement reward based on the transmission cost of cache replacement. The Q-learning algorithm measures content placement as observed state and cache replacement as action. Researchers~\cite{Xiang2019,Xiang2020} consider a DRL approach for content caching and Fog Radio Access Network (F-RAN) slicing in vehicular network scenarios. F-RAN slicing is considered to identify user hotspots in the network. The variance in wireless network conditions and content popularity due to spatio-temporal nature of the content and wireless networks increases problem complexity. The user content requests are modeled as zipf distribution while the wireless channel is modeled as a finite-state Markov channel. The APs are connected to the cloud server which executes the optimization solutions and pushes content to appropriate access point (AP) for caching. The server executes DRL based optimization solution which is formulated based on constraints of fronthaul capacity and AP capability to determine user device mode and content caching. DRL, also known as deep Q Network (DQN), utilizes NN to approximate the Q-values of the Q-learning algorithm. The research does not consider the mobility of users while formulating the problem in vehicular networks. Authors in~\cite{Liu2019} proposed a two-step approach for content recommendation and caching with an overall objective to minimize MNO cost where each step utilizes a separate RL agent. The first step of their approach is the content recommendation which works without prior knowledge of user preference. If the mobile user does not accept the recommendation, the experience is used to reinforce the recommendation model. A central processor connected to multiple BSs collects information on user requests and channel conditions. The central processor collects this data in a database that is used to train the recommendation model based on actor-critic network. User stickiness ensures that the mobile user is more likely to accept recommendation if preferred content is recommended. The well-learned recommendation agent helps reduce the state space of the second RL agent that learns to cache and avoids the curse of dimensionality. The recommended content is proactively and opportunistically cached to the mobile device if channel conditions are suitable. The user mobility pattern is modeled as a Markov Decision Process. The objective of the caching agent is to reduce transmission delay and improve user QoE. The overall optimization problem is solved by double deep Q-network (DDQN) with dueling architecture. The proposed approach is compared with other policy-based RL approaches in a simulated environment to debate the optimization of MNO's revenue. Researchers~\cite{Jiang2019} proposed a distributed multi-tier (BS, AP, UE) content caching scheme based on deep Q-learning to increase the efficiency of F-RAN. The scheme first predicts the content popularity from historical user preferences. Instead of topic similarity and community detection, a topic modeling approach named probabilistic latent semantic analysis (pLSA) is applied to predict individual user preferences. pLSA algorithm requires historical user requests for cloud content and topic variables that represent the relationship between content and topics. Expectation maximization (EM) algorithm is used to calculate the probability that a user requests a specific cached content. Collective content popularity for all users is predicted based on current caching status and transmission distance between BSs. The DQN algorithm consists of two individual CNN. One of the CNN (MainNet) predicts current Q-values while the other CNN (TargetNet) predicts Q-values for a certain time period for the case of content caching decision. If the content is not found in the cache, an update process is initiated based on new user preferences, subsequently, updated content popularity. A generic DQN consists of a replay memory of finite space to save transitions regarding system state and cost at the end of each epoch. A mini-batch of randomly selected transitions are used to train a DNN to minimize the loss function and update caching policy. The DNN weights are updated to the next epoch and transition. The proposed DQN is depicted in Figure~\ref{fig:dqn}. \begin{figure} \centering \includegraphics[width=8.5cm]{images/dqn1.png} \caption {The Concept of DQN Algorithm in Edge Networks~\cite{Chen2018a}} \label{fig:dqn} \end{figure} Jiang et al.~\cite{Jiang2019a} present a multi-agent-based RL framework for D2D caching networks with the objective of download latency minimization. The D2D cache optimization problem is formulated as a multi-agent multi-armed bandit (RL) where UEs act as both joint and independent learners, content is considered as arms and caching as actions. The joint and independent learners learn from content demand history in the absence of knowledge of content popularity distribution. In the single-agent MAB model, an agent learns the reward of his sequential actions with the aim to maximize overall reward. In multi-agent MAB mode, there exists a trade-off between current best action and gathering information for achieving a higher reward for future actions. In the independent learning scenario (single agent), UEs employ Q-learning to coordinate the caching decisions in a large action space which is reduced by modified combinatorial upper confidence bound algorithm. In the joint learning scenario (multi-agent), UEs learn Q-values of their caching decisions along with the actions of other UEs. The Q-values are also considered for cache replacement decisions in the next optimization interval. Simulations show the superior performance of joint learning with respect to independent learning in terms of CHR and download latency. Interested readers can refer to a short review of DRL techniques for edge caching in~\cite{Zhu2018}. A RL observes network conditions, user requests, and context as a state of the system at time \textit{t}. The system state is input to train the DNN and predict actions that will lead to maximum benefit in caching decisions. Figure~\ref{fig:rl} illustrates a generic RL based edge caching framework. \begin{figure} \centering \includegraphics[height=6cm]{images/rl.png} \caption {Reinforcement Learning for Edge Caching~\cite{Zhu2018}} \label{fig:rl} \end{figure} \subsection{Neural Networks The authors of~\cite{Li2019} propose a cache placement and delivery mechanism for D2D networks with the goal of traffic and delay minimization. The proposed methodology answers what and where to cache while predicting user mobility and content popularity. A recurrent neural network (RNN) based echo state network (ESN) model is utilized to predict the next location of the user based on his long-term historical information in a D2D network. RNN is a type of feed-forward NN with internal memory and applies the same function to each input. ESN is a variant of RNN with a sparsely connected hidden layer. Further, an RNN based long-short term memory (LSTM) model is applied to predict the user content popularity based on multiple features such as age, gender, time, and location of content request. LSTM is a modified version of RNN which remembers past data in memory and resolves the RNN problem of vanishing gradient. Better user mobility and content popularity prediction leads to better content placement, hence, higher cache hit ratios. Afterward, the D2D content delivery decision (establish D2D link with which neighbor for cached content) is based on the DRL algorithm which optimizes the data transmission energy and content access delay while taking into account variables like channel state and distance between UE. A reward function based on RL is proposed to learn the reward of caching actions for future caching updates. The LSTM (RNN) based content popularity prediction model is depicted in Figrue~\ref{fig:nn}. It consists of four modules, i.e., input layer, hidden layer, output layer, and training network. The input layer pre-processes the data set so that it meets the requirements of the standard input. The hidden layer employs a RNN constructed by multiple LSTM cells. The network is trained by the back propagation and the loss function is optimized by the optimizer. The predicted output values can be iteratively updated to the output layer. \begin{figure} \centering \includegraphics[height=7cm]{images/nn.png} \caption {RNN based long-short term memory (LSTM) model for popularity prediction~\cite{Li2019}} \label{fig:nn} \end{figure} Researchers~\cite{Tanzil2017} presented a video content caching scheme for cellular networks to improve user QoE and reduce backhaul traffic. The scheme takes input user preferences and cellular network properties such as bandwidth. The proposed technique formulates an extreme learning machine (ELM) to predict the future popularity of content based on features extracted from a stochastic approximation algorithm. ELM is a type of feed-forward NN with hidden layers whose parameters are not tuned. The ELM algorithm is utilized in a scenario where the YouTube video features are noisy. Video features in the context of human perception are broadly classified into four categories, i.e., title, keyword, channel, and thumbnail. A total of 54 features are selected for each video using human perception models that take sentiment, subjectivity, video brightness, and contrast as input among other parameters. Stochastic Perturbation Simultaneous Approximation (SPSA) is employed to select a sample number of neurons for the ELM such that its computational complexity is reduced for online popularity prediction while the predictive performance is not compromised. A mixed-integer linear programming optimization is utilized to decide the cache placement (BS station) based on predicted popularity and cellular network properties. Cache replacement utilizes an improved version of segmented least recently used (SLRU) algorithm. The study considers global popularity features extracted from YouTube. On the contrary, video preferences for a network edge-specific community and the mobility of users need to be considered for edge networks. the authors extend their work with risk-neutral and risk-averse caching algorithms for forecasting of content distribution function~\cite{Hoiles2018}. Authors in~\cite{Lei2018} proposed a proactive caching strategy based on deep NN and unsupervised learning in 5G networks. Firstly, SDN/NFV technologies are implemented in network core to gather data and utilize ML functions, specifically a Stacked Sparse AutoEncoder (SSAE) at distributed network elements. An autoencoder is a type of NN that learns data coding in an unsupervised manner. A virtual server receives content statistics from SDN based network resources to predicts content popularity using deep learning. The caching strategy is learned by the SDN controller and network nodes are informed of cache placement. An NN based feature extraction method (SSAE) is used to predict the distribution of user content requests. SSAE employs two stacked auto encoding layers for feature extraction with each stage trained by an unsupervised learning algorithm. The content popularity is utilized in learning of caching strategy where optimal solutions are reached by Deep NN to reduce time-complexity. Chen et al.~\cite{Chen2017} study the problem of proactive caching with the help of unmanned aerial vehicles (UAV) in the CRAN scenario while aiming to maximize the user QoE. The UAV and a virtual pool of BBUs cache content to service ground and terrestrial devices with the help of the mmWave frequency spectrum to reduce blocking effects. The content can be delivered by CRAN based virtual BBU pool, UAV, or neighbor devices with D2D communication. Content popularity and user mobility prediction are learned at virtual BBUs with the help of ESN based on human-centric parameters, such as user locations, requested contents, gender, and job. A conceptor-based ESN is proposed for popularity distribution and mobility prediction to solve the cache optimization problem that maximizes user QoE and minimizes UAV transmit power. The prediction of user content requests and mobility derives user-UAV associations. The user-UAV associations lead to optimal positioning of UAV and cached content where nearby users are grouped with k-means clustering such that one cluster is served by one UAV. The mobility model assumes constant speed of the user, with user location monitored after every hour. The UAV remains static while content is transmitted to a user. The ESN (RNN) model employs conceptors to enable prediction of multiple user mobility and content popularity distributions over different time frames i.e., days or weeks \subsection{Transfer Learning Authors in~\cite{Bharath2016} utilize a TL approach to transfer the popularity of content from social networks to a HetNet in order to optimize CHR. The SBS placed caching strategy assumes user distribution as poison point processes. The unknown popularity profile of cached content is estimated using instantaneous user requests in a time interval at an SBS. Predicting random poison distributions for request arrival is time-consuming with variable network parameters. TL helps improve the popularity prediction while transferring knowledge of popular content from sample social network content. Users connected to SBS are analyzed for social community behavior. The social community acts as the source domain whose knowledge is transferred to the target domain (user request pattern). Authors in~\cite{Hou2018} present an unsupervised learning and TL scheme for proactive and distributed caching in MEC without prior knowledge of content popularity. Instead of learning a task from scratch, TL agents transfer knowledge from relative tasks with fewer training data to speed up the learning process. The learning-based caching scheme utilizes MEC and distributed BSs as cache locations to reduce data transmission costs. The caching optimization problem formulated as an integer programming problem is proved as NP-hard. A proximate solution is provided by a greedy algorithm that optimizes a parameter named as maximum transmission cost reduction. Two sub-problems of content classification and popularity prediction are solved by a 2 step learning strategy aided by unsupervised learning and TL. K-means clustering algorithm takes historical access features of the content during a time interval as input in the form of a 2D vector. After classification of content into K classes, TL is employed to predict class popularity. The higher correlation between historical access and cached content, the better is the performance of the TL algorithm. The popular content is input to the cache optimization problem to decide distributed caching places. The process of transferring knowledge from online social networks to edge networks for content caching is illustrated in Figure~\ref{fig:tl}. In general, social networks can be explored for social ties between edge user and the topics that interest users. This knowledge can be transferred to the clustering algorithms that can group users or their data into communities with respect to an edge network. \begin{figure} \centering \includegraphics[height=6.2cm]{images/tl.png} \caption {Transfer Learning for Edge Caching} \label{fig:tl} \end{figure} \subsection{Other Machine Learning Techniques} Bommaraveni et al.~\cite{Bommaraveni2019} present an active query learning (semi-supervised) approach for accurate content request prediction in 5G Edge networks. The basic premise of the active learning algorithm is to present users with recommendations to learn their preferences. SBS with non-overlapping coverage and attached edge servers are considered. User requests are modeled as a demand matrix where a 0 or 1 entry is marked against each available content. The missing entries of the demand matrix are estimated by active learning-based Query-by-committee (QBC) matrix completion algorithm. The basic intuition of QBC algorithm is to form a committee of matrix completion algorithms that aim to minimize the version space with the aim to find most informative missing matrix entry that accelerates the learning rate. The SBS cache is divided into two portions. One caches the content predicted by the demand matrix for CHR exploitation while another caches content based on an uncertainty matrix for further user behavior exploration. The article by Chuan et al.~\cite{Chuan2019} investigates an ML-based content popularity regeneration framework in wireless networks. The BSs cache popular content based on the common interests of mobile users within their service range. The authors prove that the popularity prediction distribution of mobile users' common interest is based on multi-dimensional Dirichlet distribution. The high computational complexity of popularity distribution requires a sampling-based solution which is derived from a learning-based Gibbs sampling model. The learning model for popularity prediction is based on historical content delivery data set. Based on the assumption that content popularity is derived and learned, content caching optimization is converted into a decision-making problem. The system model lacks details of user mobility, a content delivery technique which are necessary for cellular networks. \begin{table*} \centering \caption{Comparison of ML based Edge Caching Techniques}\label{tab:compmcc} \resizebox{0.84\textwidth}{!}{ \begin{tabular}{|p{1.1cm}|p{1.8cm}|p{2.25cm}|p{2.6cm}|p{2.2cm}|p{1.2cm}|p{1.15cm}|p{1.2cm}|p{1.25cm}|}\hline \textbf{Study} & \textbf{ML method} & \textbf{ML Objective} & \textbf{Features and patterns} & \textbf{Caching Objective} & \textbf{Caching Policy} & \textbf{Location} & \textbf{\makecell{Replace-\\ment}} & \textbf{Network scenario} \\ \hline ~\cite{Doan2018} & Supervised, CNN & Popularity prediction, Feature extraction & popularity of published content & Increase offload ratio & Proactive & MBS & NA & Macro-cellular \\[0.1cm] ~\cite{Thar2018} & Supervised, DNN & Popularity prediction, cache optimization & request count based popularity & decrease access latency & Proactive & BS & NA & MEC \\ ~\cite{Zhang2018} & Supervised, Unsupervised & Popularity ranking, BS clustering & user preference based popularity & Increase CHR & Reactive & SBS & NA & Small cell network \\ ~\cite{Bastug2016} & Supervised learning & popularity prediction & request count and rating based popularity & increase offload traffic, user satisfaction & Proactive & UE, BS & NA & Small cell network \\[0.1cm]\hline ~\cite{Chang2018} case study 1 & Unsupervised, DNN & user clustering, cache optimization & request count and channel conditions & Decrease latency, EE data transmission & Proactive & MBS & NA & Macro-cellular, D2D \\[0.1cm] ~\cite{Chang2018} case study 2 & Unsupervised & similarity learning & user preference & Maximize D2D data rate & Proactive & UE & NA & D2D \\[0.1cm] ~\cite{Liu2020} & Unsupervised (K-means) & user clustering & user preference based popularity and location & Minimize communication overhead & Proactive & MBS, SBS & NA & HetNet \\[0.1cm] \hline ~\cite{Wang2017a} & RL (Q-learning) & Cache replacement & request count based popularity, poison point based user distribution & cache replacement transmission cost & Proactive & UE, BS & Q-learning & Macro-cellular, D2D \\[0.1cm] ~\cite{Xiang2019} & RL (Deep) & RAN slicing & request count based popularity, markov variable based channel coefficients & Maximize CHR, transmit rate & Reactive & UE, V2I & NA & F-RAN \\[0.1cm] ~\cite{Liu2019} & RL & Recommendation, caching optimization & user request and channel condition & Reduce MNO cost & Proactive & MBS, UE & NA & Macro-cellular \\[0.1cm] ~\cite{Jiang2019} & RL (DQN), CNN & caching optimization, predict Q-values & user preference based popularity & Maximize CHR & Proactive & UE, BS, AP & User-preference & F-RAN\\[0.1cm] ~\cite{Jiang2019a} & RL (MAB, Q-learning) & caching optimization, predict Q-values & zipf based popularity distribution and access & Download latency optimization & Proactive & UE, BS, AP & Q-learning based & D2D network \\[0.1cm] \hline ~\cite{Li2019} & RNN (ESN, LSTM), RL & mobility and popularity prediction, problem optimization & user context based popularity, history based locality & Improve CHR, reduce transmission delay and energy & Proactive & BS, UE & FIFO & D2D network \\[0.1cm] ~\cite{Tanzil2017} & NN (ELM) & Popularity prediction & content feature based popularity & Increase QoE, decrease network delay & Reactive & MBS & Segmented LRU & Macro-cellular\\[0.1cm] ~\cite{Lei2018} & DNN, AE & feature extraction, problem optimization & historical content request information & Increase CHR & Proactive & Core, distributed BSs & NA & Distributed core \\[0.1cm] ~\cite{Chen2017} & RNN (ESN) & mobility and popularity prediction & user context based access and location distribution & increase QoE, decrease transmit power & Proactive & UAV, UE, BBU & NA & CRAN \\[0.1cm] \hline ~\cite{Bharath2016} & TL & Transfer popularity from social network & Poisson point distribution based content request & increase CHR & Proactive & UE, SBS & NA & HetNet \\[0.1cm] ~\cite{Hou2018} & Unsupervised (K-means), TL & content clustering & user access based popularity & Minimize data transmission cost & Proactive & MEC, BS & NA & MEC \\\hline ~\cite{Bommaraveni2019} & Active query learning & popularity prediction & user access based popularity & increase CHR, decrease backhaul load & Proactive & UE, SBS & NA & Edge network \\[0.1cm] ~\cite{Chuan2019} & Supervised & Feature extraction & user interest based popularity & Increase CHR & Proactive & BS & NA & Macro-cellular \\\hline \end{tabular}} \end{table*} \section{Comparison of ML based edge caching techniques}\label{sec:comparison} This section provides comparison of the listed studies. The comparison is summarized in Table~\ref{tab:compmcc}. In the context of edge network caching, ML techniques enable edge devices to actively and intelligently monitor their environment by learning and predicting various network features, such as, channel dynamics, traffic patterns, and content requests to proactively take actions that maximize a predefined objective such as, QoS and CHR~\cite{Chen2019}. It can be observed that most of the state-of-the-art techniques apply more than one ML techniques to solve research problems related to optimal edge caching. Supervised learning techniques are mostly applied for content popularity prediction where initial data is available for model training. Supervised learning algorithms are suitable when labeled data is available in the form of historical network state information~\cite{Doan2018}. Unsupervised techniques are applied for clustering (K-means) users, content, and BSs based on their location or access features~\cite{Thar2018,Chang2018}. Unsupervised learning techniques explore unlabeled data such as user geo-location to infer some structure or pattern. RL algorithms are applied to solve the overall problem of cache optimization (where and what to cache) given the network states, actions, and cost~\cite{Jiang2019}. In edge cached networks, caching decisions involve multiple dynamic inputs including mobility, popularity, and access distribution that vary with time, As a result, the application of a RL agent is well suited to edge cache optimization as it interacts with the environment on trail and error basis to to optimize an objective. The RL agent learns and trains on the data collected from the implementation of RL. NNs learn from complex and imprecise data and are applied to forecast the mobility of users and the popularity of the content~\cite{Li2019}. NNs can predict user and network characteristics to help solve complex cache optimization problems and design optimal caching strategy. The data in wireless edge networks is continuous and time-dependent. RNNs (LSTM and ESN) are suitable for dealing with time-dependent data~\cite{Chen2019,Li2019}. The ML techniques applied for caching in edge networks mostly employ RL and NN. The main reason behind this is the unavailability of data for the prediction of content popularity and user mobility. RL and NN techniques can learn content popularity with little or no data~\cite{Jiang2019}. Therefore, NN and RL techniques have larger applications in edge caching networks~\cite{Sun2019,Ye2019}. Moreover, RL, NN, and deep learning are more sophisticated learning techniques than supervised and unsupervised learning. Hence, they are more suited for the dynamics of edge networks. Where data is available, supervised and unsupervised learning are utilized~\cite{Zhang2018}. Among supervised learning SVM~\cite{Doan2018}, in unsupervised learning K-means clustering~\cite{Hou2018,Liu2020}, in RL Q-learning~\cite{Wang2017a} and Deep RL~\cite{Xiang2019}, and in NN Deep NN~\cite{Li2019} are widely utilized to address different issues within optimal caching. SDN, NFV, and C-RAN technologies can be applied in network devices to maintain user content request history which can be inspected for future content popularity prediction~\cite{Lei2018}. Monitoring user request history also leads to privacy issues that have been seldom addressed in recent research~\cite{Liu2020}. In order to gain user faith for participation in data set collection activities, light-weight privacy-preserving, authentication, and trust protocols are necessary for MEC~\cite{Khurshid2019,Li2018a}. Supervised learning and NN are mostly applied for popularity and mobility prediction~\cite{Chen2017,Doan2018}. Unsupervised learning techniques are mostly applied for clustering~\cite{Liu2020}. Feature extraction from content is done with the help of NN~\cite{Lei2018} or supervised learning~\cite{Chuan2019}. RL and NN algorithms are used for cache decision optimization~\cite{Liu2019,Li2019}. Q-learning is appropriately employed for cache replacement by learning Q-values/rewards of caching actions~\cite{Wang2017a}. TL is applied to transfer knowledge of content popularity from social networks to mobile networks~\cite{Bharath2016}. The caching objective of the majority of cited work is increasing CHR~\cite{Zhang2018,Lei2018}. All other caching objectives are directly related to CHR fluctuations. Content access latency, user QoE, data offload ratio, and MNO's operational cost is immediately effected when the content is available in-network and not accessed through CDNs and backhaul links. Hence, the single objective of CHR maximization is often sufficient to address caching optimization problems. The research works that employ D2D communications for delivery strategy often have the objective to reduce data transmission costs (energy efficiency) at UE~\cite{Li2019}. As UE cache and share data with other UEs within the network with little or no incentives, the energy efficiency of the sender is desired. The objective of lower data transmission costs is synonymous with minimal communication overhead~\cite{Liu2020}, maximum data transmission rate, and energy-efficient data transmissions~\cite{Chang2018}. Most of the state-of-the-art works in caching are proactive rather than reactive to further offload traffic from backhaul and core networks~\cite{Doan2018}. The main reason behind proactive caching in ML-based techniques is that the learning process can start without the user initiating a content request. On the other hand, statistical techniques for caching, e.g., most frequently accessed, are mostly reactive to user behavior. Cache delivery networks and location options are diversely employed in the listed literature work~\cite{Doan2018,Thar2018}. This comparison shows that the studies do not focus on one network scenario or one cache location. Each of the choices about the cache delivery network and location has its own pros and cons. Placing cache at UE further lowers access latencies and offloads traffic from both backhaul and fronthaul networks. Therefore, caching techniques that utilize UEs offer better user QoE than BS caching based techniques~\cite{Li2019}. However, UE caching puts the burden of energy and storage resources of handheld devices without a standard incentive policy~\cite{Jiang2019}. MEC, F-RAN, and C-RAN infrastructure based studies assume knowledge of content request history from in-network device statistics~\cite{Thar2018,Jiang2019}. Therefore, MEC /F-RAN / C-RAN based studies have the advantage of user content history over macro-cellular, D2D, and HetNet based network architectures. Moreover, SDN/NFV based techniques are necessary to gain user statistics from n network devices~\cite{Lei2018}. Furthermore, MEC/F-RAN/C-RAN based techniques have lesser complexity in user mobility prediction as their coverage is wider than macro-cellular D2D networks~\cite{Liu2019}. An innovative idea for cache location was presented in~\cite{Chen2017} where UAV where utilized to cache content within the network to support low access latencies in user dense areas. However, the proposal will incur a higher operational cost as compared to standard network cache locations. Among the listed works only one considers the joint RAN slicing and caching in edge networks~\cite{Xiang2019} and one considers user privacy as part of the edge caching solution~\cite{Liu2020}. We have not included the comparison of delivery strategy in Table~\ref{tab:compmcc} as all studies utilized implicit unicast or explicit D2D delivery in edge caching. Multicast and CoMP based delivery strategies have not been discussed which leaves room for considerable optimization in existing studies~\cite{Bilal2019,Said2018}. Cache replacement techniques have not been focused on in most of the cited work. This indicates that a cache optimization problem solved for time \textit{t} can be updated for time \textit{t+1} for cache replacement decision. However, the repetition and recursive call of the cache optimization problem can incur significant complexity. Therefore, a simpler cache replacement decision is desired. Wang et al.~\cite{Wang2017} prove that a simple Q-learning model can be utilized to learn cache rewards from the decisions based on time \textit{t} and update cache replacement decision at time \textit{t+1}. Some of the studies apply statistical caching approaches that have limited benefit in a dynamic network environment~\cite{Tanzil2017,Li2019}. Cache replacement is studied independently as an MDP problem with a Q-learning solution in~\cite{Gu2014}. Few references utilize YouTube~\cite{Tanzil2017} and MovieLens~\cite{Adeel2019,Thar2018} data-sets for performance evaluation of proposed popularity prediction techniques. Therefore, most of the studies use statistical models such as zipf and PPP to model input variables to cache optimization problem. Four network dynamics not detailed in~~\ref{tab:compmcc} need to be debated among the listed work. These are \textbf{(a)} content popularity distribution, \textbf{(b)} content request distribution, \textbf{(c)} user mobility model, and \textbf{(d)} network state model. The benchmark data-sets or models for content popularity, user request, mobility, and network state prediction are not available for edge networks resulting in non-baseline performance evaluations. Most of the works consider the content popularity to be static following the zipf distribution model~\cite{Liu2019,Xiang2019,Bharath2016,Wang2017a,Chen2018b,Hou2018}. The zipf model is based on power law distribution and utilized for web content popularity~\cite{Tatar2014}. In general, the content popularity changes in web caches are very slow as compared to dynamic edge networks with user mobility characteristics~\cite{Liu2016}. Therefore, the application of static zipf model to content popularity distribution in edge networks is not suited. Some researchers have adopted dynamic content popularity distribution models based on user preferences and topological relationships as in~\cite{Jiang2019,Jiang2019a}, as Markov process in~\cite{Sadeghi2017}, and ML-based popularity prediction in~\cite{Tanzil2017}. User content requests are predominantly modeled as Poisson point distributions~\cite{Li2019,Wang2017a,Hu2018,Jiang2019a,Hou2018}. Researchers~\cite{Tanzil2017} further utilize ELM for to predict content popularity based on \textbf{(a)} content features built from human perception model and \textbf{(b)} user requests modeled as Poisson distribution. Some researchers model user requests as zipf distribution~\cite{Bommaraveni2019,Bastug2016} or Markov process~\cite{Sadeghi2019}. Some of the researchers ignore user mobility~\cite{Doan2019} while others model it as Poisson point process (PPP)~\cite{Hu2018,Jiang2019a}, random walk model~\cite{Alfano2014,Malik2020,Chen2018b}, or as Markov process~\cite{Liu2019}. Bastug et al.~\cite{Bastug2016} consider the location of Cache enabled BSs distributed as PPP. Several works utilize NNs to predict the mobility of users in edge networks. Li et al.~\cite{Li2019} utilized RNN based ESN model to predict user mobility and LSTM based model to predict content popularity. The ESN provides non-linear system forecasting with temporal inputs. The ESN model takes location history of a user over a period of time as input and initially modeled as PPP to predict user history at \textit{t+1}. The output of ESN model for user location and user context (gender, age, occupation, time, etc) are input to the LSTM for content popularity prediction. Similarly, Chen et al.~\cite{Chen2017} utilize modified ESN to predict the user content request distributions and mobility patterns. User context information (time, week, gender, occupation, age, location, and device type, etc.) is input to the ESN to get output of content request and mobility patters. The initial user mobility is adopted from pedestrian mobility patterns according to which a user visits places of interest at a specific time of the day. Researchers~\cite{Yin2018a} use user location history as input to ESN to predict mobility patterns and user context as input to another ESN to predict content popularity. The dynamic wireless channel state in terms of Channel State Information (CSI) is modeled in few of the studies~\cite{Chuan2019,Li2019,Wang2019a}. Researchers~\cite{Xiang2019,Wang2019a,Hu2018} models the wireless channel as finite-state Markov channel. Chen et al.~\cite{Chen2017} model the mmWave propagation channel between the UAVs and users using the standard log-normal shadowing model. Researchers~\cite{Li2019,Yin2018a} model wireless channel with dynamic path loss, channel attenuation index, and Gaussian noise. Other studies assume channel conditions to be invariant Many studies model some parameters of the optimization problem as MDP. For example, reference~\cite{Sadeghi2017} model user content request as Markov process with unknown transition probabilities. References~\cite{Gu2014,Wang2017a,Wang2019a} model the cache replacement problem as MDP. Reference~\cite{Liu2019} mobility patterns of users are characterized as Markov process. Reference~\cite{Xiang2019} models the wireless channel as finite-state Markov channel while reference~\cite{He2018} models cache state as Markov model. \section{Research Challenges and Future Directions}\label{sec:cfd} The listed state-of-the-art research works have provided the foundations of ML application in edge caching while addressing issues of popularity prediction~\cite{Trzcinski2017,He2017}, mobility prediction~\cite{Chen2017}, social awareness~\cite{Wu2020,Shan2019}, community detection~\cite{ElBarawy2014,Nguyen2019}, cache decision optimization~\cite{Jiang2019a}, content feature extraction~\cite{Lei2018}, content clustering~\cite{Hou2018}, and cache replacement~\cite{Wang2017a}. The application of ML techniques in wireless networks and caching is a relatively new research topic. The research community has so far not vigorously focused on applications of ML for cache coding, federated caching, and encoding strategies. Lesser attention has been paid to research issues of security~\cite{Li2018a}, privacy~\cite{Liu2020}, federated learning~\cite{Yu2018}, joint interference alignment and caching~\cite{He2017b}, and cache economics~\cite{Khan2019}. Therefore, many research challenges need to be addressed towards further enhancement of the research domain. In this section, we highlight the key challenges to edge caching based ML techniques. Future research directions for the same are also debated. \subsection{Encoding strategies:} Multimedia content is available in a variety of specifications such as, 4K, Quad High Definition, 360$^{o}$, etc. The user preferences and available data rates change the encoding specification from time to time increasing demand on caching capacity~\cite{Paschos2018}. Major content provider like Netflix encode popular videos to more than 120 different bitrates and screen resolutions~\cite{Bilal2019}. Based on the network conditions and user equipment, a different version of same video may be requested, resulting in storage of multiple version of same video in cache, wasting considerable space. Moreover, absence of a specific version means a new request to the content provider is generated resulting in high delay, low QoE, and low CHR. Therefore, instead of requesting a variant of the available cached content, online and in-edge transcoding technique may be applied~\cite{Bilal2018,Bilal2019,Baccour2020a}. The online transcoding of cached content results in considerable gains in storage optimization, users' QoE, access delay, and cost~\cite{Bilal2019}. However, intelligently caching a video representation to avoid redundancy and storage wastage is not explored in detail. Therefore, ML techniques need to be studied to optimize online video caching and transcoding. All of the listed works assumed static encoding parameters ignoring the diversity of user requirements and network conditions. Although work has been done on encoding strategies in wireless edge caching~\cite{He2018,Liao2017,Park2017}, the applications of ML for encoding frameworks are very limited~\cite{Luo2019}. Future research can focus on learning user preferences and network conditions to predict appropriate encoding specifications for pre-fetching content accordingly. Moreover, online transcoding services at the edge of the network can be considered to lower load on transit and core network while providing users with low latency content according to user preferences. Figure~\ref{fig:trans} represents a framework for online transcoding in edge networks with elements for ML where users upload contents to central cloud data centers~\cite{Liu2018a,Bilal2019}. Multiple copies of the same content with different transcoding specifications are stored at the cloud, CDNs, and edge caches. As a result, the capacity of edge cache is limited without the utilization of online transcoding. \begin{figure} \centering \includegraphics[width=8.7cm]{images/trans.png} \caption {A Framework for Online Transcoding in Edge Networks} \label{fig:trans} \end{figure} \subsection{Coded Caching:} In coded caching, the content is divided into \textit{wants} (content delivery) and \textit{has} (content placement) parts at each UE. The content placement phase is planned such that future opportunities arise for multi-cast or broadcast delivery of coded content. When the users expose their requests, the server codes the requested content and broadcasts it. Each user decodes its part of content using simple XOR operations and side information~\cite{Xu2019}. A generic framework of coded caching is illustrated in Figure~\ref{fig:code}. Caching coded content at the edge of the network has been demonstrated to substantially increase system throughput and global caching gain~\cite{Chhangte2020,He2019}. Unexplored opportunities exist for the application of ML techniques towards coded caching. The user requests can be predicted with the help of ML techniques to obtain more opportunities of coded content delivery. Moreover, federated feature extraction from the placed content at UEs can help in the distributed prediction of content requests with lower privacy risk. \begin{figure} \centering \includegraphics[width=9cm]{images/code.png} \caption {The Concept of Coded Caching in Edge Networks~\cite{Paschos2018}.} \label{fig:code} \end{figure} \subsection{Federated caching:} Federated/joint caching means that content is cached and shared in the network among multiple MNOs~\cite{Taleb2019}. Federated caching reduces content duplication with a resource sharing mechanism that extends beyond the operational boundary of an MNO~\cite{Fadlullah2020,Qian2020}. However, none of the listed research works has benefited from federated caching which is more optimal than a single MNO caching scenario in terms of cost and resource management. Considerable gains in cost and cache hit ratio may be achieved using federated caching. However, multiple autonomous MNOs have proprietary network equipment and architectures with no sharing and access permissions. Therefore, the central access positions, such as CRANs and virtualized BBU pools offer an optimal place for collaborative and federated caching. However, novel federated caching architectures need to be designed specifically considering privacy and security. Moreover, appropriate cost and monetization models need to be developed considering complex access patterns~\cite{Cui2020,Fadlullah2020}. Currently, there is no consensus on an architecture of federated caching in edge networks that defines cost and payment models for MNOs. Federated caching can help lower the cost of training an ML model by distributing it among multiple MNOs. Moreover, federated caching can lead to better predictions while aggregating data from multiple MNOs. Furthermore, TL techniques can be applied to explore the diffusion of ML outcomes across multiple MNOs. Therefore, a notable future research direction can be federation of MNOs for ML-based caching in edge networks~\cite{Yu2018,Bilal2019}. \subsection{Federated learning:} In a general ML approach, data is gathered from users and sent to a central server for feature extraction and training of the ML model. This approach is susceptible to privacy and security issues due to data communication and storage at a central store~\cite{Lim2020,Rehman}. An alternate approach is federated learning which does not require centralized data aggregation and lowers privacy and security risks. Instead of centralized intelligence, individual nodes or users train ML models on local data to collaboratively learn parameters of a distributed ML model~\cite{Zhang2018a,Wang2020b}. The benefits of privacy preservation from federated learning have been investigated in a few of the listed works~\cite{Liu2020,Yu2018}. However, the debate of privacy-accuracy tradeoff expanding from federated learning is yet to be explored in edge caching. Moreover, the above-mentioned works have utilized federated learning for data clustering. Other ML algorithms for popularity prediction, problem optimization, and feature extraction are yet to be investigated with the approach of federated learning. \subsection{Delivery strategies:} All of the discussed works have applied explicit D2D cache delivery or implicit unicast delivery. CoMP~\cite{Zhou2017} and multi-cast~\cite{Bilal2019} delivery have not been applied independently to cache delivery. Cache delivery techniques have not been tested in conjunction with the application of ML in edge caching. Multi-cast represents a viable and efficient option when amalgamated with caching and ML for not only RAN but also for transit and backhaul links. Predictive caching based on user preferences may considerably enhance RAN utilization and QoE where the predicted content is multi-cast to multiple UEs simultaneously at non-peak hours and highest bit-rates. Such a multi-cast delivery may occur at any level including \textbf{(a)} MNO core while sending contents to multiple RANs \textbf{(b)} BS level while sending content to multiple UEs within RAN, and \textbf{(c)} D2D level where the content may be multi-cast to multiple UEs in range for future access~\cite{Zahoor2020}. However, very little work has been done in this regard. This point presents a venue for future research works to incorporate CoMP and multi-cast delivery with ML-based caching techniques~\cite{Bilal2019,Wang2017}. Some research areas that may incorporate multi-cast delivery, caching, and ML include \textbf{(a)} community detection by ML techniques and caching at influential users using multi-cast delivery, \textbf{(b)} advertisements and pre-cached content dissemination using multi-cast delivery, and \textbf{(c)} delivery of cost modeling and FL parameters with multi-cast. \subsection{User preferences and content popularity:} Some of ML techniques such as TL and RL work with little or no data as input. However, data regarding user preference is required for content clustering and popularity prediction~\cite{Liu2020,Skaperas2020}. The user traffic is https, hence, the application layer content is hidden from the network resources that transport data~\cite{Li2018}. Users can agree to share their preferences, or be monitored for content access at CDNs or destination server~\cite{Lei2018,Din2019}. Therefore, the training data for content request and popularity prediction can only be available from a central server. On the other hand, only 1\% of the Facebook videos account for more than 80\% of the watch time~\cite{Goian2019,Baccour2020a}. Finding this small class of the CDN content popular in an edge community in a certain time interval is a complex but highly beneficial task. The spatial granularity of a BS coverage area and the dynamic number of associated users results in challenging content popularity models~\cite{Liu2016}. Future research works need to explore ML techniques for time-series content popularity with respect to edge communities. \subsection{Privacy Issues:} In some use cases, the users may agree to share data about their preferences in order to facilitate ML techniques. In such cases, methods that should be incorporated to assure data privacy and security have not been debated in detail~\cite{Liu2020,He2018,Wang2019b}. For instance, users can share their content preference data to facilitate content clustering (K-means), topic modeling, and social communities identification for optimal caching decisions. Similarly, user mobility data is essential for accurate mobility prediction and UE-BS association models in edge networks. However, the centralized collection of mobility and user preference data is vulnerable to large-scale surveillance. Utilizing user location and preference data will necessitate the establishment of trust protocols among UE and the MNOs~\cite{He2018,Chang2018,Zhang2018a}. Moreover, trust needs to be established among UEs for D2D content sharing with or without the help of a dedicated trust agent~\cite{Zhang2018b,Jiang2019}. Furthermore, security measures should be exercised while the user's data is stored for ML applications at MEC or CDN servers. In the MEC and edge computing scenario, all such protocols should be light-weight so that they do not burden the energy resources of the UE and edge servers extensively~\cite{Khurshid2019,Hussain2019,Adeel2019}. User privacy~\cite{Liu2020} and security~\cite{He2018} issues related to edge caching have been studies. Specifically, work has been done on RL based security in edge caching~\cite{Xiao2018}. However, these works have not been evaluated on desirable characteristics for edge caching, such as light-weight and reliability. Blockchain-based privacy and security solutions have been proposed for edge networks~\cite{Kang2018,Yang2020}. Two research issues need attention regarding the integration of Blockchain services in edge networks: \textbf{(a)} distribution of compute-intensive blockchain workload among edge devices, and \textbf{(b)} monetization/reward policy for collaborative blockchain execution among edge nodes~\cite{Salah2019}. \subsection{Cost and monetization models:} Caching economics is one of the least addressed issues in edge caching. Caching at UE and D2D communication leads to the storage, power, and data consumption of mobile devices. All UEs do not cache and share the same amount of content leading to an unfair communication scenario. Therefore, incentive models are necessary for UEs that afford more caching and transmission than other UEs~\cite{Khan2019,Ren2019}. An example of a basic incentive mechanism can be higher download data rates and lower delay for the UE with higher sharing/transmission history~\cite{Jiang2019}. However, most D2D caching techniques lack an incentive mechanism and a standard is necessary for practical UE cache deployments. Moreover, the application of ML techniques for edge caching demands that UE, BSs, and other network entities capable of processing power collaboratively share the workload of compute-intensive learning methods. Based on the distributed contributions, each processing entity should be rewarded for participation in the learning process as all entities receive the same benefits of the optimal caching decisions~\cite{Wang2019a,Debe2020}. Relay nodes may be used in D2D communication, where the sender and receiver may not be in range. Specific monetization models for relay nodes also needs to be defined so that an adhoc setup for data delivery may be established where sender and receiver may reside many hops away. To aggregate issues, compute-intensive Blockchain services are being integrated with edge networks. Despite the many-fold applications of blockchain in edge networks, the distribution of workload and monetization of resources among edge devices remains the main research issue~\cite{Yang2019a,Liu2018b}. \subsection{Complexity:} The wireless edge networks have complex dynamics. When considering all dynamic parameters, such as channel variations, user mobility, user preference, content popularity, the optimization of caching cost (data transmission, delivery time, etc), the time complexity of solving optimization problems increases exponentially~\cite{Li2018,Alasmary2019,He2017b}. In particular, the joint optimization of cache placement and physical layer transmission is deemed NP-hard~\cite{Paschos2018}. The caching optimization decisions are also online in nature, where changing dynamics require updates in the solution. Therefore, current research works do not incorporate multiple edge dynamics while assuming some of the parameters as constant to limit the complexity of the mathematical formulation. However, for higher CHR and more applicable solutions, caching decision problems with realistic assumptions are necessary~\cite{Sadeghi2017,Yin2018a}. Suboptimal solutions are seldom considered to reduce the complexity of online solutions for edge caching~\cite{Wang2017b,Shan2019}. \subsection{Standard Data Set:} A standard user preference and edge-based content popularity data set is required to compare research works and formulate baseline results~\cite{Sun2019}. Existing research works either predict content popularity from no data or a data set that is not public. Furthermore, the existing data sets derive data from CDN or cloud sources that do not represent an edge network~\cite{Liu2019}. The MovieLens~\cite{Harper2015} data set containing information about real-world movies, users, and ratings are often applied for the evaluation of the recommendation systems. References~\cite{Adeel2019,Thar2018,Yu2018,Song2019,Garg2019} utilize the MovieLens data-set to predict the popularity of the content with various learning techniques. However, the MovieLens data-set represents features for cloud/CDN based user access and can not be mapped to an edge network. Similarly, standard data sets for user mobility also impede baseline research~\cite{Malik2020}. Recent research published a public dataset of Facebook Live videos that can be filtered by location to formulate an edge network representation~\cite{Baccour2020}. The data set contains ID and geo-location among other metadata of more than 1.5 Million Facebook Live videos collected from the Facebook Live Map. Further investigations are required to extract content popularity from the metadata. Moreover, efforts are needed to differentiate and highlight the differences in edge popularity and cloud popularity of the content. Such difference if not considered can significantly effect the cache population and CHR. \subsection{Joint network slicing and caching designs:} Network virtualization enabled network slicing is considered a key enabler of NGNs~\cite{Ferrus2018}. Network slicing allows MNOs to manage dedicated logical networks with specific functionality to service user requirements. For example, a vehicular RAN network can be composed of two slices where one supports time-critical driving services while the other network slice serves the bandwidth consuming video streaming services~\cite{Zhang2020}. The distribution of network slices among bandwidth hungry and delay in-tolerant services can guide caching strategies to distribute content among BSs and UE in a RAN network. The joint consideration of network slicing with caching can bring great benefits for the MNO~\cite{Xiang2017}. However, the joint network slicing and caching designs have been evaluated by only one of the listed works~\cite{Xiang2020}. Further work is required to understand the interaction of network slicing with edge caching in edge resource management scenarios. \subsection{UAV assisted caching:} Researchers~\cite{Chen2017} proposed a novel UAV assisted caching scheme for edge networks. The scheme utilizes mmWave frequency for UAV-to-user communications while deploying UAV in user density areas and clusters. The UAV-to-user channel can provide high SNR than the BS-to-user channel in some scenarios. ML techniques can be applied to predict the content that must be cached in the UAV considering a user cluster that may request specific contents. Moreover, the population and spatial features of the cluster can be predicted by ML techniques for optimal cache decisions and delivery. However, mmWave frequency is highly sensitive to the physical environment and obstacles. Path loss occurs due to user mobility and line-of-sight changes. Coverage and blockage zones change dynamically which requires content duplication and highly dynamic content placement strategy. Therefore, user mobility and content popularity prediction models need to be accurate while accommodating the dynamic behavior of the mmWave channels~\cite{Li2018,Giatsoglou2017}. Future research works need to consider the constraints of mmWave communication while designing optimal D2D caching policies. \section{Conclusion}\label{sec:conc} We comprehensively surveyed ML-based edge caching techniques in this article. We examined the role of 5G, SDN, and NFV in edge caching. We provided an exhaustive taxonomy of the research domain with details of background topics including ML, edge networks, and caching. The state-of-the-art ML techniques were categorized into supervised learning, unsupervised learning, RL, NN, and TL based on application to problems of prediction and clustering. We critically compared and analyzed the research work on parameters, such as ML method, network scenario, ML objective, caching objective, caching location, replacement techniques, content popularity distribution, content request distribution, and user mobility models. We further complemented our debate on ML-based edge caching by discussing future challenges and research issues. The research issues and challenges are related to the the exploration of encoding strategies, coded caching, federated caching, initiation of federated learning-based edge caching, multi-cast and CoMP delivery strategies, availability of standard data sets, cost and monetization models for D2D caching, and the establishment of light-weight privacy-preserving and security mechanisms. \subsection*{Acknowledgments} This work is supported by the Postdoctoral Initiative Program at the Ministry of Education, Saudi Arabia. \section{Introduction} Modern mobile applications demand low latency, mobility support, energy efficiency, and high bandwidth from back-end data stores that are usually hosted in cloud data centers and content delivery networks (CDN). The distance between mobile users and geographically distributed cloud data centers/CDNs substantially impacts latency. Future 5G and 6G networks aim to provide high-speed access to end devices while increasing traffic load of transit networks and workload of cloud data centers~\cite{Monserrat2015,Ren2019a}. CDNs and micro-data centers have been utilized to distribute the content with respect to geographic regions, hence, partially alleviating the issue of latency~\cite{Baccour2019}. It is estimated that mobile data traffic will increase 500-folds in the next decade with 80\% of the traffic contributed by video content~\cite{Index2017}. Consequently, several networking technologies have been proposed and deployed to bring computing and cache capabilities further closer to the end users. These technologies include Mobile Edge Computing (MEC), fog computing, cloudlets, and information-centric networks, etc~\cite{Ren2019a,Li2018,Qazi2019}. In general terms, the technologies providing cache and computing service in user proximity form an edge network~\cite{Liu2018,Bilal2018}. Edge network cache refers to an in-network storage that contains the content request by or relevant to edge users. The edge networks have solved the problems of high content latency in the last decade while reducing the load on backhaul networks with the help of in-network caching. The key research problems regarding caching at the edge networks are: \textbf{(a)} what (popular, multimedia), \textbf{(b)} when (time-series prediction), \textbf{(c)} where (base stations, mobile users), and \textbf{(d)} how (proactive, reactive) to cache~\cite{Sun2019}. 5G networks and Machine learning (ML) techniques play a vital role in optimizing edge cache performance. Mobile communication technologies have experienced exponential growth over the last few years in the number of users, applications, and data traffic with services ranging from multimedia streaming to online gaming~\cite{Bilal2018,Shuja2016}. It has been identified that existing network architectures will struggle to handle the massive delivery of data efficiently with minimum latency requirements~\cite{Shafi2017}. To this end, next-generation networks (NGN), i.e., 5G evolved with the help of emerging communication technologies, such as millimeter-wave (mmWave) communication and massive Multiple Input Multiple Output (MIMO)~\cite{Bogale2016,Sim2017}. Users in 5G networks often have similar interests, and content can be stored locally (in-network cache) to reduce access latency and load on backhaul, core, and transit networks~\cite{Ren2019}. Without caching, a large amount of backhaul traffic is consumed by fetching redundant copies of popular content~\cite{Yao2019}. 5G network architectures envision caching content at various layers of access, core, and aggregate networks with the help of edge network technologies~\cite{Sutton2018}. Edge caching is one of the key elements that help 5G networks meet stringent latency requirements~\cite{Taleb2017,Elazhary2019}. ML techniques have been prominently used to efficiently solve various computer science problems ranging from bio-informatics to signal and image processing~\cite{Camacho2018,AliHumayun2019}. ML is based on the premise that an intelligent machine should be able to learn and adapt from its environment based on its experiences without the need for explicit programming. ML techniques are beneficial for tasks requiring classifications, clustering, decision making, and prediction~\cite{Wang2020a}. ML techniques have been adopted in wireless networks to solve problems related to, but not limited to, resource management, routing, traffic prediction, and congestion control~\cite{Sun2019,Boutaba2018,Wang2020}. Main reasons behind the emergence of ML techniques in wireless edge networks include \textbf{(a)} increase in computing resources of edge devices facilitating in-network intelligence capabilities, \textbf{(b)} generation of large amounts of data from billions of Internet of Things (IoT) devices that can be statistically exploited for the training of data-driven ML techniques, \textbf{(c)} introduction of network function virtualization (NFV) and Software Defined Networks (SDN) for programmability and manageability of network devices, and \textbf{(d)} advent of collaborative and federated learning techniques for workload distribution of compute-intensive ML algorithms~\cite{Chen2019,Jiang2016,Plastiras2018}. One of the applications of machine learning in wireless networks is to estimate future user requests based on mobility, popularity, and preference data sets that have time-series dynamic characteristics. Several factors challenge the process of learning user characteristics in edge networks. Firstly, user privacy policies prohibit the sharing of user data among applications and service providers. Therefore, it is difficult to formulate a generic application-independent caching policy. Secondly, most of the user traffic is https based limiting insights to user requests over the Internet for any application~\cite{Zhang2018a}. Thirdly, edge networks evolve with dynamic user associations, preferences, and content popularity. Therefore, the learning processes must address the requirements of time-variant data~\cite{Ozcan2019}. Fourthly, the learning process should predict trends specific to an edge network while meeting the storage constraints at the edge. ML techniques can be leveraged to solve the challenges of what, where, and when to cache in edge networks. The application of ML techniques is more suitable to these challenges as: \textbf{(a)} ML techniques learn with few or no data~\cite{Sadeghi2017}, \textbf{(b)} ML techniques, such as federated learning can be used for privacy-preserving mechanisms of user data~\cite{Liu2020}, \textbf{(c)} ML techniques can identify dynamic online communities and popular content with time-variance facilitated by data-driven analytics~\cite{Shan2019}, and \textbf{(d)} ML techniques can optimize a cache placement and delivery problem for a set of network states and storage constraints~\cite{Li2018b}. Given the constraints on the availability of user data in edge networks, ML models that learn without prior knowledge are often applied to optimize caching decisions~\cite{Lien2018,Lim2020}. \begin{table*}[htbp] \centering \caption{Comparison with existing surveys} \label{tab:ex} \resizebox{.99\textwidth}{!}{ \begin{tabular}{|m{0.8cm}|m{4.5cm}|m{4.5cm}|m{4.5cm}|} \hline \textbf{Ref.} & \textbf{Contribution} & \textbf{ML Techniques Covered} & \textbf{Concentration} \\ \hline ~\cite{Wang2020} & Convergence of DL and edge computing & Deep Learning & Overall edge computing paradigm \\ \hline ~\cite{Lim2020} & Application of FL in MEC & Federated Learning & Overall edge network management \\ \hline ~\cite{Sun2019} & Application of ML in wireless networks & Machine Learning & Overall wireless network management \\ \hline ~\cite{Chen2019} & ANN based wireless network management & Artificial Neural Networks & Overall wireless network resource management \\ \hline ~\cite{Yao2019} & Survey of mobile edge caching & No & Edge caching (criteria, locations, schemes, and process) \\ \hline ~\cite{Li2018} & Content placement and delivery strategies in cellular networks & A brief discussion on ML techniques & Edge caching (networks, performance, and strategies) \\ \hline This study & Application of ML for in-network edge caching & Comprehensive ML techniques (supervised, un-supervised, RL, NN, and TL) & Edge caching (cache locations, policy, replacement, and networks) \\ \hline \end{tabular}} \end{table*} \subsection{Motivation} Modern mobile devices execute sophisticated applications, such as voice recognition, augmented reality, and high definition multimedia~\cite{Lien2018,Shuja2018,Hemanth2020}. Such applications require Ultra-Reliable Low Latency Communications (URLLC) and high user QoE. Next-generation 5G technologies envision to support the requirements of modern applications with disruptive data communication technologies (for example, mmWave communication~\cite{Bogale2016}), caching at various layers of the network~\cite{Ren2019}, and edge network architecture~\cite{Zahoor2020}. Therefore, to cope with ever-increasing bandwidth demands of emerging applications and constrained transit, backhaul, fronthaul, and radio access networks (RAN), intelligent user-centric in-network edge caching is indispensable~\cite{Taleb2017,Sutton2018}. The research challenges of cached edge networks due to their time-variant characteristics can be extensively solved with the application of ML techniques~\cite{Ozcan2019,Wang2020}. ML techniques can infer what to cache while driven by data from the user's historical content request~\cite{Wang2017a}. ML techniques can learn where to cache by predicting user locations from location histories and current context~\cite{Shan2019}. Similarly, ML techniques can optimize the caching decisions while contemplating network state and constraints of D2D and mmWave communication~\cite{Yin2018a,Chen2017}. Moreover, ML techniques can learn time-series content popularity from user request patterns and content features~\cite{Song2019}. The learning process can execute at any tier of the network including mobile devices, edges, and cloud servers, and can be federated or distributed~\cite{Yu2018,Lim2020}. Therefore, the application of ML techniques in intelligent and optimal edge caching decisions is essential to meet the requirements of multimedia and URLLC content delivery~\cite{Ahmed2017,Azimi2018}. ML techniques employed towards optimal edge caching decisions are driving technologies and use cases with low latency requirements, e.g., autonomous vehicles, online gaming, virtual and augmented reality, dynamic content delivery, video streaming, IoT, and smart cities~\cite{Tapwal2020,Chekired2019,Wang2020,Khan2020,Wang2017}. A survey specifically focusing and detailing the role, opportunities, and challenges of ML applications towards caching in edge networks was missing in the literature. We aim to fill the missing gap by specifically focusing on ML and caching in edge networks. \subsection{Existing surveys} In this article, we extensively survey ML-based edge caching techniques. Significant progress has been made in surveying applications of ML techniques in the edge, wireless, and cellular networks. Earlier surveys either focused on edge caching without focusing on ML techniques~\cite{Yao2019,Li2018,Goian2019,Wang2017}, or focused on the application of ML techniques to overall resource management in wireless networks~\cite{Sun2019,Lim2020,Wang2020,Chen2019}. Zhu et al.~\cite{Zhu2018} survey the application of Deep Reinforcement Learning (DRL) towards mobile edge caching. However, the survey was brief and focused only on the application of a specific ML class (DRL) to edge caching. Wang et al.~\cite{Wang2020} provided a comprehensive survey on deep learning applications and inferences towards resource management of edge computing paradigm. Researchers in~\cite{Lim2020} surveyed federated learning-based edge networks while focusing on resource management and privacy issues. Sun et al.~\cite{Sun2019} provided a comprehensive review of ML applications in wireless networks including resource management, backhaul management, beamforming, and caching. A comprehensive survey of cellular cache optimization techniques (stochastic, game theory, graph-based, and ML) was provided in~\cite{Yao2019}. This survey can be distinguished from earlier surveys on caching at the edge based on the fact that: \textbf{(a)} it focuses on the comprehensive application of ML techniques rather than a specific ML method~\cite{Zhu2018,Wang2020,Lim2020} and \textbf{(b)} it focuses on optimal caching decisions in edge networks rather than overall resource management~\cite{Chen2019,Sun2019}. Table~\ref{tab:ex} further lists existing surveys in the same direction to highlight the differences. \subsection{Contributions and organization} The main contributions of this article are as follows: \begin{itemize} \item We formulate a taxonomy of the research domain while identifying key characteristics of applied ML techniques, edge networks, and caching strategies. \item We detail the fundamentals of the research domain of edge networks while discussing the role of 5G and network virtualization in edge caching. \item We enlist state-of-the-art research on ML-based edge caching while categorizing the works on ML techniques, i.e., supervised learning, unsupervised learning, neural networks (NN), reinforcement learning (RL), and transfer learning (TL). We compare state-of-the-art research based on the parameters identified in the taxonomy to debate the pros and cons. \item We comprehensively debate key research challenges and future directions for the adoption of ML techniques for caching at the edge networks ranging from federated caching, content transcoding, user privacy, and federated learning. \end{itemize} \begin{table*} [htbp] \centering \caption{List of abbreviations} \label{tab:ab}}{ \resizebox{.99\textwidth}{!}{ \begin{tabular}{|m{1cm}|m{4cm}|m{1cm}|m{4cm}|m{1.2cm}|m{4cm}|} \hline \textbf{Abbr.} & \textbf{Full Form} & \textbf{Abbr.} & \textbf{Full Form} & \textbf{Abbr.} & \textbf{Full Form} \\ \hline {5G} & Fifth generation & {AP} & Access Point & {API} & Application Programmer Interface \\\hline {BS} & Base Station & {BBU} & Baseband Unit & {CDN} & Content Delivery Network\\\hline {CHR} & Cache Hit Ratio & {CNN} & Convolutional Neural Network & {CoMP} & Coordinated MultiPoint \\\hline {C-RAN} & Cloud Radio Area Network & {D2D} & Device to Device & D(RL) & (Deep) Reinforcement Learning \\\hline FL & Federated Learning & {F-RAN} & Fog Radio Area Network & HTTP & HyperText Transfer Protocol \\\hline HetNet & Heterogeneous Networks & {IoT} & Internet of Things & {MBS} & Macro Base Station \\\hline {MEC} & Mobile Edge Computing & {MDP} & Markov Decision Process & mmWave & millimeter-wave \\\hline {MIMO} & Multiple Input Multiple Output & {MNO} & Mobile Network Operator & {ML} & Machine Learning \\\hline {NGN} & Next Generation Networks & {NN} & Neural Network & {NFV} & Network Function Virtualization \\\hline {QoE} & Quality of Experience & {QoS} & Quality of Service & RAN & Radio Access Network \\\hline {RNN} & Recurrent Neural Network & {RRH} & Radio Remote Heads & {SBS} & Small Base Station \\\hline SDN & Software Defined Networks & {SVM} & Support Vector Machine & {TL} & Transfer Learning \\\hline {UE} & User Equipment & {URLLC} & Ultra-Reliable Low Latency Communications & {V2I} & Vehicle-to-infrastructure \\\hline \end{tabular}} \end{table*} The rest of the paper is structured as follows. Section~\ref{sec:funda} presents the fundamentals of edge networks, 5G technologies, and network virtualization. The discussion includes the role of caching towards 5G networks. Section~\ref{sec:tax} lists the taxonomy of ML techniques for caching in edge networks. In Section~\ref{sec:state} and~\ref{sec:comparison}, we present state-of-the-art caching techniques based on ML and their comparison. Key challenges and future research directions are comprehensively discussed in Section~\ref{sec:cfd}. Section~\ref{sec:conc}, concludes the article. \section{Fundamentals of Edge Networks and 5G Technologies}\label{sec:funda} Edge caching defines a edge user-centric cache that has limited storage capacity and saves content that are only relevant to the edge users~\cite{Wang2017,Tran2017}. The limited storage capacity of edge and the dynamic characteristics of user (mobility, content access, etc) make the caching decision distinct from CDN caching. The optimal caching decisions in edge networks are based on multiple inputs such as, content popularity prediction, user mobility prediction, user access prediction, and wireless channel condition prediction. As a result, ML techniques are employed to predict the input features to the optimal caching problems~\cite{Sun2019,Chen2019}. We provide an overview of edge networks, 5G, and network virtualization in this section. We also discuss the role of edge caching in 5G networks. Moreover, the role of network virtualization technologies (SDN and NFV) in edge caching is explored. The list of abbreviations adopted in this article are listed in Table~\ref{tab:ab} for better article readability. \begin{figure*} \centering \includegraphics[height=4.5cm]{images/5g2b.png} \caption {5G conceptual architecture~\cite{Sutton2018}} \label{fig:5g} \end{figure*} \subsection{Edge Networks} The principle of edge computing is to relocate compute, storage (cache), and communication services from centralized cloud servers to distributed nodes (users, BSs) located at the edge of the network~\cite{Wang2017,Kibria2018}. The inter-connected edge resources form an edge network. The principle of edge computing is supported by a set of networking technologies that vary in architecture and protocol. Edge computing technologies include cloudlets~\cite{Jararweh2016}, fog computing~\cite{Bilal2018}, and MEC~\cite{Ahmed2017,Othman2017}. While locating resources at the edge of the network in user proximity, edge computing promises reduced service latency, backhaul bandwidth reduction, UE energy efficiency, and context-awareness that can be utilized for intelligent service placement. MEC was envisioned by the European Telecommunications Standards Institute (ETSI) proposing virtualization of resources to enable execution of services at the network edge~\cite{Hu2015}. Hence, network virtualization is a key enabler for MEC. The architecture of fog computing was proposed by Cisco to extend cloud services to the wireless edge network specifically serving IoTs~\cite{Klas2015}. Fog computing deploys an intermediate platform between end devices and cloud infrastructure to distribute services near users and facilitate time-sensitive applications~\cite{Bilal2018}. Cloudlets represent the middle tier of the three-tier architecture consisting of mobile devices, microdata centers (cloudlets), and the cloud~\cite{Satyanarayanan2009}. The key enabler for cloudlets are also virtualization technologies as virtual images representing cloud services are moved towards the edge networks~\cite{Elazhary2019,Shuja2016a}. Edge networks can be defined as a network architecture that deploys flexible computing and storage resources at the network edge, including the RAN, edge routers, gateways, and mobile devices, etc., with the help of SDN and NFV technologies~\cite{Wang2017,Ahmed2017}. Edge caching considered in this article can encompass any of the above-mentioned edge computing technologies. \subsection{Role of caching in 5G technologies} The idea of caching was first applied to Internet services in the form of CDNs. The content from cloud data centers is stored in CDNs which are distributed over a region that may encompass multiple states and countries. Edge network caching brings the content storage further near to the end user with support of enterprise networks and network service providers. Edge caching has been considered recently to improve content delivery in wireless networks~\cite{Bilal2018,Ahmed2017}. The role of caching in NGNs can be emphasized by putting forward a question: Can edge caching tackle the challenges of URLLC, QoE, and cost in 5G networks? The answer is an emphatic yes. The advancements in 5G networks and high-resolution multimedia content means that the network bottleneck will shift to the core and transit links~\cite{Paschos2018}. Therefore, caching in user proximity may be the only viable solution for growing user requirements from multimedia and virtual/augmented reality applications with time-sensitive stipulations~\cite{Yao2019,Schwab2020}. With the rapid advancements in mobile communication technologies, an ever-increasing number of mobile users are experiencing a wide variety of multimedia services, such as video sharing, video conferencing, real-time video streaming, and online gaming using smartphones and tablets. According to Cisco, the global mobile data traffic is 41 Exabytes per month, and it will increase to 77 Exabytes, containing 79\% of video data, by 2022~\cite{Index2017}. This exponential growth had put a huge burden on the capacities of RAN, transit link, and core network due to the centralized nature of mobile network architectures~\cite{Wang2015,Li2015,Li2015a}. Research and academia identified some major requirements for NGNs, i.e., deliver the content with minimum latency, provide higher bandwidth, and support 1000 times more number of users~\cite{Monserrat2015,Shafi2017,Andrews2014}. Specifically, the current mobile network architectures are unable to efficiently handle the huge delivery of contents that are repeatedly requested by multiple users, for example, the request for the same Ultra High Definition (UHD) videos put a huge burden over the transit link and core network. The massive and variable traffic demands make it difficult to achieve good service performance and deliver high QoE for user-centric applications~\cite{Paschos2018,Chen2014}. To address the above-mentioned challenges, novel mobile architectures and advanced data communication technologies, such as mmWave communication~\cite{Taori2015}, MIMO)~\cite{Xiang2014}, ultra-wideband communication~\cite{Zhang2019}, and Heterogeneous Networks (HetNets)~\cite{Bogale2016} are evolving the advancement of next-generation, i.e., fifth-generation (5G) mobile networks. 5G cellular networks system designs in collaboration with new application-aware approaches improve the network resources utilization and reduce traffic demands. A generic conceptual architecture of 5G developed by Sutton et al.\cite{Sutton2018} is illustrated in Figure~\ref{fig:5g}. The figure depicts the proposed architecture for the 5G networks. Edge computing and caching is an integral part of 5G network and holds a key role in attaining the 5G objectives. The edge commuting support and caching can be placed at any layer (core, aggregation, and access) and even be situated at base stations in the proposed 5G architecture. The flexibility for edge placement is offered to ensure the appropriate and optimal use of constrained edge resources as desired. One of the major approaches to reduce the burden from the backhaul and core network is to cache the popular content in the near vicinity of the users to reduce the redundant downloads of similar content~\cite{Wang2014,Woo2013,Rodrigues2020}. For this purpose, the Content Delivery Networks (CDNs) caches are proposed as an integral part of 5G network architecture. According to Andy Sutton, a principal network architect at BT, the conceptual 5G network architecture, as shown in Fig~\ref{fig:5g}, provides the caching facility at different layers of the hierarchical model~\cite{Sutton2018,Khan2019}. According to architecture, the CDNs can be deployed at the Core, Aggregation, Access, and even at Base Station (BS) layer. By leveraging the content placement strategies, popular content can be cached proactively during the off peak-hours to reduce the burden on the transit link during the peak hours~\cite{Mueller2016,Qiao2016}. The requirements of URLLC for NGNs are driving the cache locations further near to the users. The emerging paradigm in edge caching is caching at UE with D2D communication for content diffusion. The URLLC UE caching architecture arises from the elements of \textbf{(a)} high-speed D2D communication protocols, \textbf{(b)} high-storage capability in modern smartphones, and \textbf{(c)} emerging ultra-dense networks~\cite{Shen2017,Li2019a,Association2016}. As a result, caching strategies are migrating from centralized CDNs to highly distributed UEs. The UEs are highly mobile, have individual content preferences, communicate in social-aware patterns, and are part of multiple online social communities. The ML techniques come to the forefront to solve complex problems of popularity and mobility prediction, user and content clustering, and social community detection in edge networks~\cite{Nitti2019,Shan2019}. \subsection{Role of SDN and NFV in Edge Caching} The SDN/NFV technologies are gaining momentum and are enablers of intelligent edge and cloud networks~\cite{Paschos2018}. SDNs are based on the principle of decoupling data plane from the control plane of the network~\cite{Huo2016}. As a result of the decoupling, SDNs provide three key characteristics of flexibility, programmability, and centralized control for ML-based edge networks. The network functions can be abstracted and programmed for evolving application requirements and logically implemented through a centralized control plane throughout an edge network~\cite{He2017a}. The benefits of implementing SDNs for ML-based edge caching are three-fold. First, the programmable control plan can be utilized to implement a distributed in-network intelligence framework among network entities~\cite{Lei2018,Din2019}. Secondly, ML techniques are data-driven. The SDN controller has a centralized view with the ability to collect network data and enable the application of ML techniques~\cite{Xie2019}. Thirdly, SDNs allow flexible routing of user requests to distributed and hierarchical cache locations within the network~\cite{Mehrabi2019}. NFV allows virtualization of the common physical channel into multiple virtual channels/functions that can be shared among users with varying QoS requirements. Moreover, NFV decouples network functions from dedicated network devices so that they can be implemented over general-purpose computing systems~\cite{Yousaf2017,OrdonezLucena2017}. As a result, in-network intelligence and network functions can execute on the same general-purpose computing platform. The network virtualization technologies are creating further opportunities for edge caching while empowering MNOs to manage the compute, storage, and network resources. The virtualization technologies are helping in the migration of caching services from CDNs to the wireless edge. The caching service can be implemented as a Virtual Network Function (VNF) at the network edge with the flexibility of cache initiation and scaling on the fly. Allocating in-network edge resources falls under the category of network slicing~\cite{OrdonezLucena2017,Mehrabi2019}. More importantly, network virtualization technologies enable the implementation of learning capabilities at the edge network, hence, leading to optimal caching decisions. Moreover, available free resources at any network layer may also be allocated elastically as required according to the QoS requirements. Therefore, it can be established that network virtualization technologies are empowering 5G networks with edge caching and intelligence capabilities~\cite{Yousaf2017,Taleb2016}. ML techniques have also been extensively applied to SDN technologies for resource management, security, and routing optimization~\cite{Xie2019}. \begin{figure*} \centering \includegraphics[width=13cm]{images/tax2.png} \caption {Taxonomy of Machine Learning Techniques for Caching in Edge Networks} \label{Fig:tax} \end{figure*} \section{Taxonomy of ML based edge caching}\label{sec:tax} This section presents the taxonomy of ML applications in edge caching. The aim of this section is to provide the reader with background knowledge of the research domain in detail with the help of categorized concepts. Figure~\ref{Fig:tax} illustrates the taxonomy of the article with major classification as: \textbf{(a)} ML (technique, objective, and features) \textbf{(b)} Caching (location, policy, and replacement), and \textbf{(c)} Edge Networks (delivery network and strategy). The necessary elements of the taxonomy are explained in detail as follows. \subsection{ML Technique/Method} The main application of ML in caching is to answer what and when to cache so that the caching objectives (cache hit ratios, latency, throughput, etc) are optimized. The ML techniques used to find this answer can be generally characterized into \textbf{(a)} supervised learning, \textbf{(b)} unsupervised learning, \textbf{(c)} RL, \textbf{(d)} NN, and \textbf{(e)} TL techniques~\cite{Sun2019,Goian2019}. In some scenarios, multiple ML techniques can be applied to a problem of what to cache at the edge/wireless networks with the objective to find solutions to sub-problems, such as, popularity prediction, cache decision optimization, and user clustering. Supervised learning aims to learn a general rule for mapping input to output based on the labeled data set. Example input and corresponding outputs train the learning agent to learn the mapping of the rest of the data set~\cite{Chang2018,Miyazawa2016}. Unsupervised learning aims to learn the mapping function based on un-labeled data~\cite{Cao2019,Sun2019}. A learning agent continuously interacts with its environment to generate a mapping function based on immediate response/reward in RL~\cite{He2017a}. NNs are inspired by the structure and function of biological NNs that can learn from complex data. NN generally consist of input, hidden, and output layers~\cite{Teerapittayanon2017,Lim2020}. The goal of TL is to utilize knowledge of a specific (source) domain/task in the learning process of a target domain/task. TL avoids the cost of learning a task from scratch~\cite{Chen2019a,Hou2018}. Semi-supervised learning aided by both supervised and unsupervised learning models is also a popular ML technique but rarely utilized for caching in wireless networks~\cite{Bommaraveni2019}. 5 \subsection{ML Objective} In most of the research works listed in the next section, ML techniques are applied to multiple sub-problems. For example, the objective of ML can be: \textbf{(a)} prediction (popularity, mobility, user preference), \textbf{(b)} problem optimization, \textbf{(c)} clustering (user, BS, content), \textbf{(d)} cache replacement, and \textbf{(e)} feature extraction~\cite{Sun2019,Wang2017}. Prediction is often the most difficult task in this scenario (edge network) where assumptions are made regarding user preferences and content history. We consider prediction as to the primary objective of ML application while other objectives as secondary. The non-standard and non-public data sets also hinder research evaluations on common grounds. For example, the data for content popularity at YouTube CDNs can be obtained which pertains to a wider geographic region than edge networks. Some studies assume this wider regional data as edge network data and predict future content popularity. Similarly, user preferences are enclosed in application layer data across the network where service providers are compliant to privacy laws. Social media publishers (Twitter, Facebook, etc) provide API based access to user data with increasing restrictions due to recent data breaches~\cite{Cadwalladr2018,Wang2019b}. ML techniques have been applied to find an optimal resource allocation solutions in cached networks, i.e., where, what, how, and when to cache. ML techniques have also been employed to reduce the time complexity of the mathematical formulation of cache optimization problems. Generally, given the input and sample optimal solutions, the algorithms learn optimal solutions for varying inputs~\cite{Sun2019}. Unsupervised clustering techniques are applied to data during pre-processing stages to group data and find similarities. Clustering partitions a data-set into communities with samples that are more similar to each other based on a similarity/distance function. The clustering of users is based on their D2D connectivity and social-awareness. BSs are clustered based on their coverage area while content clustering is based on data similarity~\cite{Liu2020}. Cache replacement strategy can be learned using an ML (RL, Q-learning, etc) such that the reward/Q-values of the problem are inferred from a cache hit ratios~\cite{Tanzil2017}. \subsection{Features and Patterns} ML techniques often take various features and patterns of the environment as input to train the model. In edge caching, the environment variables that require modeling or have historical data and are input to the ML framework are: \textbf{(a)} content popularity distribution, \textbf{(b)} content access/request distribution, \textbf{(c)} user mobility model, and \textbf{(d)} network state model. The content popularity is modeled mostly as zipf distributions~\cite{Liu2019}. Moreover, content popularity can be predicted with the help of ML techniques based on historical information~\cite{Tanzil2017}. User content requests are modeled as poisson point distributions~\cite{Hu2018} or zipf distributions~\cite{Bommaraveni2019}. User content requests can be estimated with the help of ML techniques based on content features~\cite{Tanzil2017}. User mobility is modeled as poisson point process (PPP)~\cite{Jiang2019a}, random walk model~\cite{Malik2020} or Markov process~\cite{Liu2019}. User mobility can also be predicted with the help of ML techniques given user context and historical information regarding user behavior~\cite{Li2019}. The dynamic wireless network state is modeled as finite-state Markov channel~\cite{Xiang2019} or assumed to be invariant. \subsection{Cache Placement} Cache placement answers the query of where to cache. The caching places in a wireless edge network can be \textbf{(a)} User equipment (mobile devices, home routers), \textbf{(b)} BSs (small, macro, femtocells), \textbf{(c)} BBU pool/CRAN, \textbf{(d)} mobile core network, and \textbf{(e)} collaborative as joint placement in multi-tier caching architecture~\cite{Said2018,Yao2019}. Mobile devices are becoming increasingly sophisticated with larger storage capacities and can act as in-network caches. Caching at UE is also known as infrastructure-less caching and leads to lower the burden on access/cellular networks, low network latency, and higher spectrum utilization while offloading wireless traffic. D2D links in unlicensed-band are required for content communication among UEs. BS of all form and sizes (Macro, small, femto, etc) provide relatively higher latency compared to local caching but connect to a larger set of users in the wireless coverage area. Similarly, service providers in the form of C-RAN, F-RAN, and MEC often provide proximate cache and compute services in user hotspots. Virtualized Baseband Unit pools (BBU) can be utilized as cache location for service providers with the help of SDN and NFV technologies. Service provider's independent infrastructure in the form of edge servers can be added and connected to MNO equipment for content caching~\cite{Wang2019}. Service provider caches provide higher caching capacity and area coverage with higher latency~\cite{Yao2019}. Moreover, C-RAN based cache placement enables service providers to gather vital content features (hits, likes, etc) from central or geographically federated data centers and employ them in the learning process to improve cache hit rates. Some researchers have utilized collaborative caching techniques where the cache placement is distributed among multiple elements in the wireless network with the help of coding schemes~\cite{Fadlallah2017}. The content-coding schemes divide each content into smaller segments for distributed placement and cache size optimization~\cite{Li2018}. Cache placement can also be federated and collaborated among MNOs to reduce redundancy~\cite{Taleb2019}. While caching content closer to the user, user mobility is a larger challenge due to its D2D communication link coverage from cache enabled UE and BS association. Caching content at C-RAN reduces the challenge of user mobility~\cite{Ye2019,Goian2019}. \subsection{Caching Policy} The caching policy can be either proactive or reactive and solves the problem of how to cache while partially responding to when to cache. In the reactive policy, the content is cached once it is requested by a user. When a user request a content, it is delivered from local cache if found. If the content is not found, it is progressively requested from nearby devices in a D2D network, MEC server, and CDNs. During the content delivery phase, it may be cached at multiple locations according to the caching policy. Figure~\ref{fig:re} illustrates the concept of reactive caching in Edge networks. \begin{figure} \centering \includegraphics[width=8.5cm]{images/react.png} \caption {Reactive caching in Edge Networks} \label{fig:re} \end{figure} The proactive approach predicts the popularity based on user preferences and pre-fetches content to further lower access time. A ML framework executing on a cloud or MEC server can predict content popularity based on an edge network's user access features and proactively push content to edge caches. Proactive caching policies have their benefits and challenges. Proactive caching considerably reduces the delay, increases the QoE, and relieves the burden form the transit and backhaul links, specifically in peak hours. Proactive caching can also opportunistically cache content such that network non-peak hours are utilized for UE caching leading to higher spectral efficiency~\cite{Yao2019,Chang2018}. However, proactive caching may result in poor cache hit ratio specifically in edge network where a content which may not be popular is cached on the edge. Moreover, proactively caching a content which may not be accessed requires storage space for caching, which can only be gained by removing stored content. Consequently, redundant fetches may occur for the deleted content specifically in case of small caches. Therefore, it is necessary to apply ML techniques aided by content popularity, user access, and mobility data to benefit from proactive caching and address its challenges~\cite{Liu2019,Baccour2020a}. The learning process is difficult as it increases the number of sub-problems, such as popularity prediction and mobility prediction. Figure~\ref{fig:pro} depicts the idea of proactive caching in Edge networks. \begin{figure} \centering \includegraphics[width=8.5cm]{images/pro.png} \caption {Proactive caching in Edge Networks} \label{fig:pro} \end{figure} \subsection{Cache Replacement} In general computing and CDN caching systems, Least Frequently Used (LFU), Least Recently Used (LRU), and First In First Out (FIFO) algorithms are utilized for cache replacement/eviction. However, the standard recency-based and frequency-based caching algorithms can not be applied to wireless edge networks due to its non-deterministic properties~\cite{Xu2018}. Cache replacement techniques are also necessary as the caching capacity of most network devices is very limited as compared to CDN resources. Moreover, approximately 500 hours of videos are uploaded on YouTube alone every minute~\cite{Index2017}. Therefore, considering the rate of data generation, cache population and replacement play a significant role in user QoE~\footnote{https://www.statista.com/statistics/259477/hours-of-video-uploaded-to-youtube-every-minute/}. The approach followed by some of the state-of-the-art works in wireless networks is learning-based cache replacement. Generally, a Q-learning algorithm can be applied by a UE to act as an independent or joint learner to learn the reward/Q-value of caching/replacement decisions~\cite{Jiang2019a,Wang2017a,Lee2020}. On the other hand, some research works have not considered the sub-problem of cache replacement~\cite{Chang2018} while some have considered a caching decision problem for instance \textit{t+1}~\cite{Thar2018}. \begin{figure*} \centering \includegraphics[width=13cm]{images/delivery2.png} \caption {Types of delivery networks in edge caching} \label{fig:delivery} \end{figure*} \subsection{Delivery Network Type} The access layer of the edge network considering caching architectures can be categorized as \textbf{(a)} macro-cellular networks, \textbf{(b)} HetNet, \textbf{(c)} C-RAN/ F-RAN/ MEC, and \textbf{(d)} D2D networks~\cite{Li2018,Wang2017}. Figure~\ref{fig:delivery} depicts the four types of delivery networks for edge caching connected to a core network. In macro-cellular architectures, UEs are connected to a single macro BS at a time~\cite{Woo2013}. HetNets comprise of UEs with multiple access technologies, such as 5G and Wi-Fi~\cite{Mehrabi2019}. Moreover, HetNets can also be defined as networks where UEs lie in the coverage of multiple BSs (caches) of different cell sizes such as macro and pico~\cite{Zhang2015}. Content can be cached on any of the BSs. However, HetNets cache content on multiple BSs so that the UEs can obtain content from the closest BS based on its communication parameters~\cite{Kabir2020}. The caching capacity and coverage area in HetNets is generally low as compared to macro-cellular architecture. C-RAN/F-RAN cellular architectures employe a central pool of BBU resources with the help of virtualization techniques for processing and caching~\cite{Chen2018}. Cache-enabled D2D networks utilize UE caching capacity and communicate content in close range bypassing BSs and MNOs. UEs often coordinate in clusters based on short-range communication~\cite{Nitti2019}. \subsection{Delivery Strategy} Content delivery strategies try to reduce the load on both front-haul and back-haul networks and reduce duplicate packet transmissions. Delivery strategies employed to deliver cached content in wireless networks are \textbf{(a)} D2D, \textbf{(b)} multi-cast, and \textbf{(c)} coordinated multipoint (CoMP) transmissions. D2D communications are possible in dense networks where content cached on one user device can be sent to nearby users using the unlicensed band (Bluetooth and Wi-Fi)~\cite{Li2019}. D2D caching also utilizes relay/helper nodes when the source and destination nodes can not communicate directly with short-range communication~\cite{Yao2019}. The state of a UE battery may determine their participation in D2D communication. Subsequently, D2D caching requires incentives for UE to act as caching helpers over longer periods of time~\cite{Liu2016}. Multi-cast delivery in caching enabled networks results in packet delivery to multiple users within the network cell. Often in popular live streaming videos in online social networks and video-on-demand services, content is simultaneously watched by multiple users and multi-cast delivery results in reducing duplicate packet transmission~\cite{Bilal2019}. MNOs collect user requests for content over a time frame so that multiple requests for the same content can be furnished simultaneously. Multi-cast delivery has not been discussed in detail in edge caching scenarios. However, amalgamation of multi-cast with ML techniques can result in considerable gains in caching, RAN resource management, and user QoE. ML based prediction techniques may be applied to multi-cast same content to multiple UEs for proactive caching saving RAN resources, minimizing delay, and delivering high QoE. CoMP refers to various techniques that aim for dynamic coordination of data transmission/reception at multiple geographically separate sites~\cite{Wang2017}. In particular, a UE lying at cell edge can be connected to multiple BSs with the aim of improving overall QoE. The user can be connected to one of the BSs which does not have cache of requested content. CoMP delivery can be employed to provide the requested content from other BSs within the coverage network. A non-traditional content delivery strategy is to change the user association in a HetNet with overlapped coverage so that the user is associated with a BS which has the cached content~\cite{Liu2016}. Cache delivery strategies also optimize UE power allocation, channel allocation, and other required transmission parameters~\cite{Li2018}. The main objectives of caching in edge networks are \textbf{(a)} low content delay/access time \textbf{(b)} low backhaul load, \textbf{(c)} energy efficiency for both end user and MNO, \textbf{(d)} higher network throughput, \textbf{(e)} higher spectral efficiency, \textbf{(f)} reduce MNO cost, and \textbf{(g)} increase user QoE~\cite{Li2018,Wang2017}. The optimization problem can be formulated such that it reduces one or more than one of these parameters. The application of ML to caching can further optimize these parameters as a result of higher CHR~\cite{Wei2018}. Caching and backhaul data offloading in edge networks often serve the same concept and purpose~\cite{Wang2017a,Zhao2019}. We use the term of edge caching throughout this article. The user request for content can be realized from many sources. The requested content can be accessed from the local cache, nearby UEs with D2D communications, and BSs with wireless communication. The content can be cached in the MEC server, virtualized C-RAN resources, or central data stores in the form of CDN/clouds~\cite{Yao2019}. \section{State-of-the-art: Machine Learning based Caching}\label{sec:state} Figure~\ref{fig:int} depicts a high-level conceptual framework of ML-based edge caching. Social-awareness~\cite{Bui2018}, mobility patterns~\cite{Hu2018}, and user preferences~\cite{Ren2019} are input to an ML framework that can be federated among multiple nodes, hosted at distributed MEC servers, C-RAN, or centralized CDN. The inputs to the ML based caching decision framework are extracted from social networks, D2D communications, and V2I communications. The intelligent and optimal decisions are fed-back to the caches that are managed by network virtualization techniques~\cite{He2017a,Luo2019}. Innovation is brought to caching placement techniques with the help of UAV mounted caches that can be directed towards dense user populations and real-time events~\cite{Cheng2018}. The low-level design considerations of ML based edge caching will be debated and illustrated in forthcoming sections. \begin{figure*} \centering \includegraphics[width=13cm]{images/int.png} \caption {The Concept of Edge based Intelligence for Edge Caching} \label{fig:int} \end{figure*} We divide the state-of-the-art studies regarding caching in edge networks based on ML techniques categorized into supervised, unsupervised, RL, NN, and TL based methods. Two uncategorized works are listed in a separate subsection. The discussions of remaining taxonomy branches (ML objective, cache locations, network type, etc) are incorporated within this section to avoid redundancy of the ideas considering the length of the article. Most of the related works utilize more than one ML technique where one of the ML techniques is used in prediction (popularity, mobility, user preference) while the other is utilized to find optimal solutions for caching (placement, delivery, replacement) with lower time-complexity. We categorize the related work based on the ML technique applied for prediction or clustering as these are the primary objective of ML application in caching enabled networks. The ML techniques within supervised learning, unsupervised learning, RL, NN, and TL are defined when first referenced. Interested readers can find a detailed overview of ML techniques in~\cite{Sun2019,Chen2019}. \subsection{Supervised Learning} Doan et al.~\cite{Doan2018} presented a caching scheme that predicts the popularity growth of published videos and estimates the popularity of new (unpublished) videos based on features extracted from published videos and their similarity with new videos. A backhaul link video traffic data minimization optimization problem that finds the optimal part of the video for caching is formulated and solved with linear programming. The optimization solution requires the popularity of both published and new videos as input. The spatio-temporal features of both published and new videos are extracted with a 3D convolutional neural network (CNN) with multiple stage pooling. CNN is a type of deep learning algorithm where convolution is applied in more than one layer of a multi-layer stacked network of convolutions and pooling. A G-dimensional vector represents features of a video and is mapped to the video categories. The clustering algorithm based on Jaccard and cosine distances are applied to extracted features to limit the curse of dimensionality. The number of features input to the clustering algorithm are restricted to reduce the complexity of the clustering algorithm. Support Vector Machine (SVM) is employed to classify each video into a video category. SVM is a type of unsupervised learning algorithm that finds a hyperplane in n-dimensional space to classify data points. A supervised ML model with published videos as training data is trained to predict the popularity of new videos while comparing similar video features. Expert advice is incorporated to update training data and evaluate the behavior of popularity predictor. The research does not take into account user mobility and the dynamic nature of the wireless network. However, the proposed work has the ability to predict the popularity of unpublished videos without historical information using supervised learning. The authors extend their work in~\cite{Doan2019} for socially-aware caching where social-awareness is measured as the frequency of D2D connections. Thar et al.~\cite{Thar2018} present a popularity based supervised and deep learning framework for proactive BS caching in MEC. The proposed cloud (master node) based framework predicts the video popularity using supervised and deep learning in two steps and pushes the learned cache decisions to the BSs (slave nodes). First, a data collector module collects data regarding request counts for video identifiers to predict future popularity and class of videos using supervised learning. Second, future request counts for video content are predicted using deep learning algorithms. An optimization framework is formulated to reduce the content access delay in future \textit{(t+1)} while making caching decisions at time \textit{t} based on cache capacity constraint. RNN and CNN models are evaluated for the training of popularity prediction and request count learning agents. The overall cache decision optimization problem is solved with deep NN which is composed of multiple levels of nonlinear operations and multiple hidden layers. The Movie Lens database is utilized as the data set. Authors in~\cite{Zhang2018} utilize learn-to-rank algorithm (supervised learning) and BS clustering (k-means) for caching in a small cell network scenario. The learn-to-rank does not directly use content popularity. Instead, the content is sorted based on its popularity rank. The objective of the study is CHR maximization and the optimization problem is formulated as integer programming whose solution is NP-hard if the content popularity is not known. The authors employ a learn-to-rank algorithm based on historical content requests. K-means clustering is applied to group SBSs based on historical request records for each file. K-means clustering algorithm partitions n data points into \textit{K} clusters such that each data point belongs to a cluster with the nearest mean. Afterward, a learn-to-rank algorithm is applied to predict the ranking of content popularity. Top one popularity is used to predict the probability of the number of requests for each file. The authors presented learning-based caching at SBS and UE in~\cite{Bastug2016,Bastug2014} to meet a required user satisfaction ratio. The authors considered proactive caching at SBS with the help of supervised learning. Each SBS learns a popularity matrix for its user with rows representing the users and columns representing content ratings. The missing matrix entries are inferred using collaborative filtering (recommendation systems). The proactive caching approach uses training and placement steps to offload traffic from backhaul links. In the first step, the popularity matrix is estimated while solving a least square minimization problem. The placement step is executed greedily until the caches are filled. In the second case study, the social relationship between users and their physical proximity is utilized for proactive caching at UE with D2D communications. The centrality measure that quantifies how well a user is connected is adopted for measuring the influence of social users. The authors utilize eigenvector centrality which is based on the largest eigenvalue of the adjacency matrix of the social network. Social influencers are grouped in communities with K-means clustering. The critical content of each community is stored in caches of social media influencers based on the premise that they are highly connected with the community for content distribution. The study is evaluated based on the dynamics of parameters such as the number of content requests, size of the cache, and zipf distribution parameter $\alpha$. The process of supervised learning in an edge network described in this study consists of four steps. First, the user content rating and preferences are collected during peak activity hours. The content popularity is estimated with supervised learning algorithms. The most popular content with respect to a group of edge users is cached. User request are served from local cache in case of a cache hit. \subsection{Unsupervised Learning} Chang et al.~\cite{Chang2018} proposed a big data and ML-based framework for caching in edge networks. The authors provide two case studies to investigate smart caching in edge networks. In the first case study, unsupervised learning and deep learning are combined for the energy efficiency of data transmission optimization framework with constraints of user request latency. K-means clustering (unsupervised learning) is applied to group users in each cell based on user history and channel conditions. Selective scheduling is utilized to serve the end-user requests from the clustered groups. A DNN is trained to learn the behavior of optimal solutions based on input parameters (channel conditions and UE file requests) to reduce the time complexity of optimization. In the second case study, similarity learning is applied to investigate social ties between end-users where some users act as data receivers while others act as data transmitters (caches). A Kullback-Leibler-divergence-based metric is used to find similarity (common data interests) among UEs. This similarity (social tie) is then compared with D2D link quality. A one to one match between receiver and transmitter nodes is established based on the quality of social and physical ties. Liu et al.~\cite{Liu2020} proposed a proactive caching framework for next-generation cellular networks (HetNet) based on K-means clustering and content popularity prediction. The K-means clustering requires user location and content preferences as input to train the prediction model which can lead to privacy issues. It is advocated that traditional privacy-preserving algorithms based on symmetric encryption can lead to low user quality of experience due to their computational complexity. Therefore, the authors enhance the K-means algorithm as Privacy-preserving Federated k-means (PFK-means). A setup stage is utilized to share cryptographic keys among BSs and end-users for data authentication and signature. Subsequently, and update process performs the modified k-means algorithm in four phases namely, centroid initialization, mini-batch selection, mask key sharing, and centroid update. This results in cluster formation and cluster centroids are updated with encrypted data sharing when a user leaves or enters the cluster. The authors augment their framework with a light-weight privacy-preserving scheme that is based on secret sharing and federated learning. Federated learning conceptualizes usage of UEs to execute distributed ML model training instead of a centralized server. The UEs send ML model updates rather than data to the server, hence, preserving data privacy. \begin{figure*} \centering \includegraphics[width=13cm]{images/federated.png} \caption {The Concept of Federated Learning for Privacy Preservation in Edge Networks} \label{fig:fed} \end{figure*} The location of ML model can be centralized on a cloud server, collaborative between MEC and cloud server, or federated among multiple UEs and cloud. In the case of cloud computing, user data is sent to cloud servers to aid execution of ML models for training and prediction of caching related parameters. This approach incurs communication cost and may compromise user privacy during transmission. In the case of MEC, the users send their data to edge servers that execute ML models or further offload them to cloud servers. The collaborative MEC-cloud approach also leads to communication cost and privacy risk. Moreover, both MEC and cloud based approaches are unsuitable for applications that require constant training~\cite{Niknam2020}. Federated learning guarantees privacy as the data does not leave UE. Partial ML models are executed on the UE with local parameters such that the device is not computationally exhausted. The UEs collaboratively execute the ML model and send the output parameters of trained model to the FL server that aggregates the results. Figure~\ref{fig:fed} illustrates the difference between different learning approaches in edge networks (federated, MEC, cloud) to highlight the benefits of federated learning towards privacy-preserving mechanisms~\cite{Lim2020,Qian2019}. \subsection{Reinforcement Learning} Most of ML-based caching techniques in wireless networks apply RL to solve a sub-problem in their research method. The dynamic characteristics of wireless networks favor the application of RL techniques that can learn maximal rewards while interacting with the environment on trail and error basis~\cite{Zhu2018,Yu2019,Hu2018}. The learning process of an RL agent can be modeled as optimal control of Markov Decision Process (MDP)~\cite{He2017b} as described in the most of following listed studies. Delayed reward and trail and error are the two main features of RL. The first feature state that the RL agent looks does not consider immediate reward as optimal and looks for cumulative reward over a long time specified by a reward function. The second feature states that the RL agent finds a trade-off between exploration and exploitation. The agent exploits actions that have been proved to yield better rewards in the past while progressively exploring new actions that may yield better rewards~\cite{Yu2019,Zhu2018}. A BS based distributed edge caching and D2D content delivery framework was presented in~\cite{Wang2017a}. The focus of the article in on edge cache replacement technique. An MDP optimization problem is formulated that minimizes cache replacement transmission cost based on variables such as content popularity, cellular serving ratio, and communication cost of cache replacement from one BS to another. A Q-learning algorithm is adopted to solve the optimization problem of transmission cost minimization while identifying cache replacement at each BS. Q-learning is a type of RL algorithm that interacts with its environment to learn Q-values based on which the learning agent takes action. The cellular serving ratio for the static network is calculated from the maximum weighted independent sets of a conflict graph. In the dynamic network scenario, the cellular serving ratio is calculated using probabilistic methods. The cellular serving ratio helps determine the caching capability of users with D2D communication. As the cache replacement process is distributed at each BS, each BS calculates its replacement reward based on the transmission cost of cache replacement. The Q-learning algorithm measures content placement as observed state and cache replacement as action. Researchers~\cite{Xiang2019,Xiang2020} consider a DRL approach for content caching and Fog Radio Access Network (F-RAN) slicing in vehicular network scenarios. F-RAN slicing is considered to identify user hotspots in the network. The variance in wireless network conditions and content popularity due to spatio-temporal nature of the content and wireless networks increases problem complexity. The user content requests are modeled as zipf distribution while the wireless channel is modeled as a finite-state Markov channel. The APs are connected to the cloud server which executes the optimization solutions and pushes content to appropriate access point (AP) for caching. The server executes DRL based optimization solution which is formulated based on constraints of fronthaul capacity and AP capability to determine user device mode and content caching. DRL, also known as deep Q Network (DQN), utilizes NN to approximate the Q-values of the Q-learning algorithm. The research does not consider the mobility of users while formulating the problem in vehicular networks. Authors in~\cite{Liu2019} proposed a two-step approach for content recommendation and caching with an overall objective to minimize MNO cost where each step utilizes a separate RL agent. The first step of their approach is the content recommendation which works without prior knowledge of user preference. If the mobile user does not accept the recommendation, the experience is used to reinforce the recommendation model. A central processor connected to multiple BSs collects information on user requests and channel conditions. The central processor collects this data in a database that is used to train the recommendation model based on actor-critic network. User stickiness ensures that the mobile user is more likely to accept recommendation if preferred content is recommended. The well-learned recommendation agent helps reduce the state space of the second RL agent that learns to cache and avoids the curse of dimensionality. The recommended content is proactively and opportunistically cached to the mobile device if channel conditions are suitable. The user mobility pattern is modeled as a Markov Decision Process. The objective of the caching agent is to reduce transmission delay and improve user QoE. The overall optimization problem is solved by double deep Q-network (DDQN) with dueling architecture. The proposed approach is compared with other policy-based RL approaches in a simulated environment to debate the optimization of MNO's revenue. Researchers~\cite{Jiang2019} proposed a distributed multi-tier (BS, AP, UE) content caching scheme based on deep Q-learning to increase the efficiency of F-RAN. The scheme first predicts the content popularity from historical user preferences. Instead of topic similarity and community detection, a topic modeling approach named probabilistic latent semantic analysis (pLSA) is applied to predict individual user preferences. pLSA algorithm requires historical user requests for cloud content and topic variables that represent the relationship between content and topics. Expectation maximization (EM) algorithm is used to calculate the probability that a user requests a specific cached content. Collective content popularity for all users is predicted based on current caching status and transmission distance between BSs. The DQN algorithm consists of two individual CNN. One of the CNN (MainNet) predicts current Q-values while the other CNN (TargetNet) predicts Q-values for a certain time period for the case of content caching decision. If the content is not found in the cache, an update process is initiated based on new user preferences, subsequently, updated content popularity. A generic DQN consists of a replay memory of finite space to save transitions regarding system state and cost at the end of each epoch. A mini-batch of randomly selected transitions are used to train a DNN to minimize the loss function and update caching policy. The DNN weights are updated to the next epoch and transition. The proposed DQN is depicted in Figure~\ref{fig:dqn}. \begin{figure} \centering \includegraphics[width=8.5cm]{images/dqn1.png} \caption {The Concept of DQN Algorithm in Edge Networks~\cite{Chen2018a}} \label{fig:dqn} \end{figure} Jiang et al.~\cite{Jiang2019a} present a multi-agent-based RL framework for D2D caching networks with the objective of download latency minimization. The D2D cache optimization problem is formulated as a multi-agent multi-armed bandit (RL) where UEs act as both joint and independent learners, content is considered as arms and caching as actions. The joint and independent learners learn from content demand history in the absence of knowledge of content popularity distribution. In the single-agent MAB model, an agent learns the reward of his sequential actions with the aim to maximize overall reward. In multi-agent MAB mode, there exists a trade-off between current best action and gathering information for achieving a higher reward for future actions. In the independent learning scenario (single agent), UEs employ Q-learning to coordinate the caching decisions in a large action space which is reduced by modified combinatorial upper confidence bound algorithm. In the joint learning scenario (multi-agent), UEs learn Q-values of their caching decisions along with the actions of other UEs. The Q-values are also considered for cache replacement decisions in the next optimization interval. Simulations show the superior performance of joint learning with respect to independent learning in terms of CHR and download latency. Interested readers can refer to a short review of DRL techniques for edge caching in~\cite{Zhu2018}. A RL observes network conditions, user requests, and context as a state of the system at time \textit{t}. The system state is input to train the DNN and predict actions that will lead to maximum benefit in caching decisions. Figure~\ref{fig:rl} illustrates a generic RL based edge caching framework. \begin{figure} \centering \includegraphics[height=6cm]{images/rl.png} \caption {Reinforcement Learning for Edge Caching~\cite{Zhu2018}} \label{fig:rl} \end{figure} \subsection{Neural Networks The authors of~\cite{Li2019} propose a cache placement and delivery mechanism for D2D networks with the goal of traffic and delay minimization. The proposed methodology answers what and where to cache while predicting user mobility and content popularity. A recurrent neural network (RNN) based echo state network (ESN) model is utilized to predict the next location of the user based on his long-term historical information in a D2D network. RNN is a type of feed-forward NN with internal memory and applies the same function to each input. ESN is a variant of RNN with a sparsely connected hidden layer. Further, an RNN based long-short term memory (LSTM) model is applied to predict the user content popularity based on multiple features such as age, gender, time, and location of content request. LSTM is a modified version of RNN which remembers past data in memory and resolves the RNN problem of vanishing gradient. Better user mobility and content popularity prediction leads to better content placement, hence, higher cache hit ratios. Afterward, the D2D content delivery decision (establish D2D link with which neighbor for cached content) is based on the DRL algorithm which optimizes the data transmission energy and content access delay while taking into account variables like channel state and distance between UE. A reward function based on RL is proposed to learn the reward of caching actions for future caching updates. The LSTM (RNN) based content popularity prediction model is depicted in Figrue~\ref{fig:nn}. It consists of four modules, i.e., input layer, hidden layer, output layer, and training network. The input layer pre-processes the data set so that it meets the requirements of the standard input. The hidden layer employs a RNN constructed by multiple LSTM cells. The network is trained by the back propagation and the loss function is optimized by the optimizer. The predicted output values can be iteratively updated to the output layer. \begin{figure} \centering \includegraphics[height=7cm]{images/nn.png} \caption {RNN based long-short term memory (LSTM) model for popularity prediction~\cite{Li2019}} \label{fig:nn} \end{figure} Researchers~\cite{Tanzil2017} presented a video content caching scheme for cellular networks to improve user QoE and reduce backhaul traffic. The scheme takes input user preferences and cellular network properties such as bandwidth. The proposed technique formulates an extreme learning machine (ELM) to predict the future popularity of content based on features extracted from a stochastic approximation algorithm. ELM is a type of feed-forward NN with hidden layers whose parameters are not tuned. The ELM algorithm is utilized in a scenario where the YouTube video features are noisy. Video features in the context of human perception are broadly classified into four categories, i.e., title, keyword, channel, and thumbnail. A total of 54 features are selected for each video using human perception models that take sentiment, subjectivity, video brightness, and contrast as input among other parameters. Stochastic Perturbation Simultaneous Approximation (SPSA) is employed to select a sample number of neurons for the ELM such that its computational complexity is reduced for online popularity prediction while the predictive performance is not compromised. A mixed-integer linear programming optimization is utilized to decide the cache placement (BS station) based on predicted popularity and cellular network properties. Cache replacement utilizes an improved version of segmented least recently used (SLRU) algorithm. The study considers global popularity features extracted from YouTube. On the contrary, video preferences for a network edge-specific community and the mobility of users need to be considered for edge networks. the authors extend their work with risk-neutral and risk-averse caching algorithms for forecasting of content distribution function~\cite{Hoiles2018}. Authors in~\cite{Lei2018} proposed a proactive caching strategy based on deep NN and unsupervised learning in 5G networks. Firstly, SDN/NFV technologies are implemented in network core to gather data and utilize ML functions, specifically a Stacked Sparse AutoEncoder (SSAE) at distributed network elements. An autoencoder is a type of NN that learns data coding in an unsupervised manner. A virtual server receives content statistics from SDN based network resources to predicts content popularity using deep learning. The caching strategy is learned by the SDN controller and network nodes are informed of cache placement. An NN based feature extraction method (SSAE) is used to predict the distribution of user content requests. SSAE employs two stacked auto encoding layers for feature extraction with each stage trained by an unsupervised learning algorithm. The content popularity is utilized in learning of caching strategy where optimal solutions are reached by Deep NN to reduce time-complexity. Chen et al.~\cite{Chen2017} study the problem of proactive caching with the help of unmanned aerial vehicles (UAV) in the CRAN scenario while aiming to maximize the user QoE. The UAV and a virtual pool of BBUs cache content to service ground and terrestrial devices with the help of the mmWave frequency spectrum to reduce blocking effects. The content can be delivered by CRAN based virtual BBU pool, UAV, or neighbor devices with D2D communication. Content popularity and user mobility prediction are learned at virtual BBUs with the help of ESN based on human-centric parameters, such as user locations, requested contents, gender, and job. A conceptor-based ESN is proposed for popularity distribution and mobility prediction to solve the cache optimization problem that maximizes user QoE and minimizes UAV transmit power. The prediction of user content requests and mobility derives user-UAV associations. The user-UAV associations lead to optimal positioning of UAV and cached content where nearby users are grouped with k-means clustering such that one cluster is served by one UAV. The mobility model assumes constant speed of the user, with user location monitored after every hour. The UAV remains static while content is transmitted to a user. The ESN (RNN) model employs conceptors to enable prediction of multiple user mobility and content popularity distributions over different time frames i.e., days or weeks \subsection{Transfer Learning Authors in~\cite{Bharath2016} utilize a TL approach to transfer the popularity of content from social networks to a HetNet in order to optimize CHR. The SBS placed caching strategy assumes user distribution as poison point processes. The unknown popularity profile of cached content is estimated using instantaneous user requests in a time interval at an SBS. Predicting random poison distributions for request arrival is time-consuming with variable network parameters. TL helps improve the popularity prediction while transferring knowledge of popular content from sample social network content. Users connected to SBS are analyzed for social community behavior. The social community acts as the source domain whose knowledge is transferred to the target domain (user request pattern). Authors in~\cite{Hou2018} present an unsupervised learning and TL scheme for proactive and distributed caching in MEC without prior knowledge of content popularity. Instead of learning a task from scratch, TL agents transfer knowledge from relative tasks with fewer training data to speed up the learning process. The learning-based caching scheme utilizes MEC and distributed BSs as cache locations to reduce data transmission costs. The caching optimization problem formulated as an integer programming problem is proved as NP-hard. A proximate solution is provided by a greedy algorithm that optimizes a parameter named as maximum transmission cost reduction. Two sub-problems of content classification and popularity prediction are solved by a 2 step learning strategy aided by unsupervised learning and TL. K-means clustering algorithm takes historical access features of the content during a time interval as input in the form of a 2D vector. After classification of content into K classes, TL is employed to predict class popularity. The higher correlation between historical access and cached content, the better is the performance of the TL algorithm. The popular content is input to the cache optimization problem to decide distributed caching places. The process of transferring knowledge from online social networks to edge networks for content caching is illustrated in Figure~\ref{fig:tl}. In general, social networks can be explored for social ties between edge user and the topics that interest users. This knowledge can be transferred to the clustering algorithms that can group users or their data into communities with respect to an edge network. \begin{figure} \centering \includegraphics[height=6.2cm]{images/tl.png} \caption {Transfer Learning for Edge Caching} \label{fig:tl} \end{figure} \subsection{Other Machine Learning Techniques} Bommaraveni et al.~\cite{Bommaraveni2019} present an active query learning (semi-supervised) approach for accurate content request prediction in 5G Edge networks. The basic premise of the active learning algorithm is to present users with recommendations to learn their preferences. SBS with non-overlapping coverage and attached edge servers are considered. User requests are modeled as a demand matrix where a 0 or 1 entry is marked against each available content. The missing entries of the demand matrix are estimated by active learning-based Query-by-committee (QBC) matrix completion algorithm. The basic intuition of QBC algorithm is to form a committee of matrix completion algorithms that aim to minimize the version space with the aim to find most informative missing matrix entry that accelerates the learning rate. The SBS cache is divided into two portions. One caches the content predicted by the demand matrix for CHR exploitation while another caches content based on an uncertainty matrix for further user behavior exploration. The article by Chuan et al.~\cite{Chuan2019} investigates an ML-based content popularity regeneration framework in wireless networks. The BSs cache popular content based on the common interests of mobile users within their service range. The authors prove that the popularity prediction distribution of mobile users' common interest is based on multi-dimensional Dirichlet distribution. The high computational complexity of popularity distribution requires a sampling-based solution which is derived from a learning-based Gibbs sampling model. The learning model for popularity prediction is based on historical content delivery data set. Based on the assumption that content popularity is derived and learned, content caching optimization is converted into a decision-making problem. The system model lacks details of user mobility, a content delivery technique which are necessary for cellular networks. \begin{table*} \centering \caption{Comparison of ML based Edge Caching Techniques}\label{tab:compmcc} \resizebox{0.84\textwidth}{!}{ \begin{tabular}{|p{1.1cm}|p{1.8cm}|p{2.25cm}|p{2.6cm}|p{2.2cm}|p{1.2cm}|p{1.15cm}|p{1.2cm}|p{1.25cm}|}\hline \textbf{Study} & \textbf{ML method} & \textbf{ML Objective} & \textbf{Features and patterns} & \textbf{Caching Objective} & \textbf{Caching Policy} & \textbf{Location} & \textbf{\makecell{Replace-\\ment}} & \textbf{Network scenario} \\ \hline ~\cite{Doan2018} & Supervised, CNN & Popularity prediction, Feature extraction & popularity of published content & Increase offload ratio & Proactive & MBS & NA & Macro-cellular \\[0.1cm] ~\cite{Thar2018} & Supervised, DNN & Popularity prediction, cache optimization & request count based popularity & decrease access latency & Proactive & BS & NA & MEC \\ ~\cite{Zhang2018} & Supervised, Unsupervised & Popularity ranking, BS clustering & user preference based popularity & Increase CHR & Reactive & SBS & NA & Small cell network \\ ~\cite{Bastug2016} & Supervised learning & popularity prediction & request count and rating based popularity & increase offload traffic, user satisfaction & Proactive & UE, BS & NA & Small cell network \\[0.1cm]\hline ~\cite{Chang2018} case study 1 & Unsupervised, DNN & user clustering, cache optimization & request count and channel conditions & Decrease latency, EE data transmission & Proactive & MBS & NA & Macro-cellular, D2D \\[0.1cm] ~\cite{Chang2018} case study 2 & Unsupervised & similarity learning & user preference & Maximize D2D data rate & Proactive & UE & NA & D2D \\[0.1cm] ~\cite{Liu2020} & Unsupervised (K-means) & user clustering & user preference based popularity and location & Minimize communication overhead & Proactive & MBS, SBS & NA & HetNet \\[0.1cm] \hline ~\cite{Wang2017a} & RL (Q-learning) & Cache replacement & request count based popularity, poison point based user distribution & cache replacement transmission cost & Proactive & UE, BS & Q-learning & Macro-cellular, D2D \\[0.1cm] ~\cite{Xiang2019} & RL (Deep) & RAN slicing & request count based popularity, markov variable based channel coefficients & Maximize CHR, transmit rate & Reactive & UE, V2I & NA & F-RAN \\[0.1cm] ~\cite{Liu2019} & RL & Recommendation, caching optimization & user request and channel condition & Reduce MNO cost & Proactive & MBS, UE & NA & Macro-cellular \\[0.1cm] ~\cite{Jiang2019} & RL (DQN), CNN & caching optimization, predict Q-values & user preference based popularity & Maximize CHR & Proactive & UE, BS, AP & User-preference & F-RAN\\[0.1cm] ~\cite{Jiang2019a} & RL (MAB, Q-learning) & caching optimization, predict Q-values & zipf based popularity distribution and access & Download latency optimization & Proactive & UE, BS, AP & Q-learning based & D2D network \\[0.1cm] \hline ~\cite{Li2019} & RNN (ESN, LSTM), RL & mobility and popularity prediction, problem optimization & user context based popularity, history based locality & Improve CHR, reduce transmission delay and energy & Proactive & BS, UE & FIFO & D2D network \\[0.1cm] ~\cite{Tanzil2017} & NN (ELM) & Popularity prediction & content feature based popularity & Increase QoE, decrease network delay & Reactive & MBS & Segmented LRU & Macro-cellular\\[0.1cm] ~\cite{Lei2018} & DNN, AE & feature extraction, problem optimization & historical content request information & Increase CHR & Proactive & Core, distributed BSs & NA & Distributed core \\[0.1cm] ~\cite{Chen2017} & RNN (ESN) & mobility and popularity prediction & user context based access and location distribution & increase QoE, decrease transmit power & Proactive & UAV, UE, BBU & NA & CRAN \\[0.1cm] \hline ~\cite{Bharath2016} & TL & Transfer popularity from social network & Poisson point distribution based content request & increase CHR & Proactive & UE, SBS & NA & HetNet \\[0.1cm] ~\cite{Hou2018} & Unsupervised (K-means), TL & content clustering & user access based popularity & Minimize data transmission cost & Proactive & MEC, BS & NA & MEC \\\hline ~\cite{Bommaraveni2019} & Active query learning & popularity prediction & user access based popularity & increase CHR, decrease backhaul load & Proactive & UE, SBS & NA & Edge network \\[0.1cm] ~\cite{Chuan2019} & Supervised & Feature extraction & user interest based popularity & Increase CHR & Proactive & BS & NA & Macro-cellular \\\hline \end{tabular}} \end{table*} \section{Comparison of ML based edge caching techniques}\label{sec:comparison} This section provides comparison of the listed studies. The comparison is summarized in Table~\ref{tab:compmcc}. In the context of edge network caching, ML techniques enable edge devices to actively and intelligently monitor their environment by learning and predicting various network features, such as, channel dynamics, traffic patterns, and content requests to proactively take actions that maximize a predefined objective such as, QoS and CHR~\cite{Chen2019}. It can be observed that most of the state-of-the-art techniques apply more than one ML techniques to solve research problems related to optimal edge caching. Supervised learning techniques are mostly applied for content popularity prediction where initial data is available for model training. Supervised learning algorithms are suitable when labeled data is available in the form of historical network state information~\cite{Doan2018}. Unsupervised techniques are applied for clustering (K-means) users, content, and BSs based on their location or access features~\cite{Thar2018,Chang2018}. Unsupervised learning techniques explore unlabeled data such as user geo-location to infer some structure or pattern. RL algorithms are applied to solve the overall problem of cache optimization (where and what to cache) given the network states, actions, and cost~\cite{Jiang2019}. In edge cached networks, caching decisions involve multiple dynamic inputs including mobility, popularity, and access distribution that vary with time, As a result, the application of a RL agent is well suited to edge cache optimization as it interacts with the environment on trail and error basis to to optimize an objective. The RL agent learns and trains on the data collected from the implementation of RL. NNs learn from complex and imprecise data and are applied to forecast the mobility of users and the popularity of the content~\cite{Li2019}. NNs can predict user and network characteristics to help solve complex cache optimization problems and design optimal caching strategy. The data in wireless edge networks is continuous and time-dependent. RNNs (LSTM and ESN) are suitable for dealing with time-dependent data~\cite{Chen2019,Li2019}. The ML techniques applied for caching in edge networks mostly employ RL and NN. The main reason behind this is the unavailability of data for the prediction of content popularity and user mobility. RL and NN techniques can learn content popularity with little or no data~\cite{Jiang2019}. Therefore, NN and RL techniques have larger applications in edge caching networks~\cite{Sun2019,Ye2019}. Moreover, RL, NN, and deep learning are more sophisticated learning techniques than supervised and unsupervised learning. Hence, they are more suited for the dynamics of edge networks. Where data is available, supervised and unsupervised learning are utilized~\cite{Zhang2018}. Among supervised learning SVM~\cite{Doan2018}, in unsupervised learning K-means clustering~\cite{Hou2018,Liu2020}, in RL Q-learning~\cite{Wang2017a} and Deep RL~\cite{Xiang2019}, and in NN Deep NN~\cite{Li2019} are widely utilized to address different issues within optimal caching. SDN, NFV, and C-RAN technologies can be applied in network devices to maintain user content request history which can be inspected for future content popularity prediction~\cite{Lei2018}. Monitoring user request history also leads to privacy issues that have been seldom addressed in recent research~\cite{Liu2020}. In order to gain user faith for participation in data set collection activities, light-weight privacy-preserving, authentication, and trust protocols are necessary for MEC~\cite{Khurshid2019,Li2018a}. Supervised learning and NN are mostly applied for popularity and mobility prediction~\cite{Chen2017,Doan2018}. Unsupervised learning techniques are mostly applied for clustering~\cite{Liu2020}. Feature extraction from content is done with the help of NN~\cite{Lei2018} or supervised learning~\cite{Chuan2019}. RL and NN algorithms are used for cache decision optimization~\cite{Liu2019,Li2019}. Q-learning is appropriately employed for cache replacement by learning Q-values/rewards of caching actions~\cite{Wang2017a}. TL is applied to transfer knowledge of content popularity from social networks to mobile networks~\cite{Bharath2016}. The caching objective of the majority of cited work is increasing CHR~\cite{Zhang2018,Lei2018}. All other caching objectives are directly related to CHR fluctuations. Content access latency, user QoE, data offload ratio, and MNO's operational cost is immediately effected when the content is available in-network and not accessed through CDNs and backhaul links. Hence, the single objective of CHR maximization is often sufficient to address caching optimization problems. The research works that employ D2D communications for delivery strategy often have the objective to reduce data transmission costs (energy efficiency) at UE~\cite{Li2019}. As UE cache and share data with other UEs within the network with little or no incentives, the energy efficiency of the sender is desired. The objective of lower data transmission costs is synonymous with minimal communication overhead~\cite{Liu2020}, maximum data transmission rate, and energy-efficient data transmissions~\cite{Chang2018}. Most of the state-of-the-art works in caching are proactive rather than reactive to further offload traffic from backhaul and core networks~\cite{Doan2018}. The main reason behind proactive caching in ML-based techniques is that the learning process can start without the user initiating a content request. On the other hand, statistical techniques for caching, e.g., most frequently accessed, are mostly reactive to user behavior. Cache delivery networks and location options are diversely employed in the listed literature work~\cite{Doan2018,Thar2018}. This comparison shows that the studies do not focus on one network scenario or one cache location. Each of the choices about the cache delivery network and location has its own pros and cons. Placing cache at UE further lowers access latencies and offloads traffic from both backhaul and fronthaul networks. Therefore, caching techniques that utilize UEs offer better user QoE than BS caching based techniques~\cite{Li2019}. However, UE caching puts the burden of energy and storage resources of handheld devices without a standard incentive policy~\cite{Jiang2019}. MEC, F-RAN, and C-RAN infrastructure based studies assume knowledge of content request history from in-network device statistics~\cite{Thar2018,Jiang2019}. Therefore, MEC /F-RAN / C-RAN based studies have the advantage of user content history over macro-cellular, D2D, and HetNet based network architectures. Moreover, SDN/NFV based techniques are necessary to gain user statistics from n network devices~\cite{Lei2018}. Furthermore, MEC/F-RAN/C-RAN based techniques have lesser complexity in user mobility prediction as their coverage is wider than macro-cellular D2D networks~\cite{Liu2019}. An innovative idea for cache location was presented in~\cite{Chen2017} where UAV where utilized to cache content within the network to support low access latencies in user dense areas. However, the proposal will incur a higher operational cost as compared to standard network cache locations. Among the listed works only one considers the joint RAN slicing and caching in edge networks~\cite{Xiang2019} and one considers user privacy as part of the edge caching solution~\cite{Liu2020}. We have not included the comparison of delivery strategy in Table~\ref{tab:compmcc} as all studies utilized implicit unicast or explicit D2D delivery in edge caching. Multicast and CoMP based delivery strategies have not been discussed which leaves room for considerable optimization in existing studies~\cite{Bilal2019,Said2018}. Cache replacement techniques have not been focused on in most of the cited work. This indicates that a cache optimization problem solved for time \textit{t} can be updated for time \textit{t+1} for cache replacement decision. However, the repetition and recursive call of the cache optimization problem can incur significant complexity. Therefore, a simpler cache replacement decision is desired. Wang et al.~\cite{Wang2017} prove that a simple Q-learning model can be utilized to learn cache rewards from the decisions based on time \textit{t} and update cache replacement decision at time \textit{t+1}. Some of the studies apply statistical caching approaches that have limited benefit in a dynamic network environment~\cite{Tanzil2017,Li2019}. Cache replacement is studied independently as an MDP problem with a Q-learning solution in~\cite{Gu2014}. Few references utilize YouTube~\cite{Tanzil2017} and MovieLens~\cite{Adeel2019,Thar2018} data-sets for performance evaluation of proposed popularity prediction techniques. Therefore, most of the studies use statistical models such as zipf and PPP to model input variables to cache optimization problem. Four network dynamics not detailed in~~\ref{tab:compmcc} need to be debated among the listed work. These are \textbf{(a)} content popularity distribution, \textbf{(b)} content request distribution, \textbf{(c)} user mobility model, and \textbf{(d)} network state model. The benchmark data-sets or models for content popularity, user request, mobility, and network state prediction are not available for edge networks resulting in non-baseline performance evaluations. Most of the works consider the content popularity to be static following the zipf distribution model~\cite{Liu2019,Xiang2019,Bharath2016,Wang2017a,Chen2018b,Hou2018}. The zipf model is based on power law distribution and utilized for web content popularity~\cite{Tatar2014}. In general, the content popularity changes in web caches are very slow as compared to dynamic edge networks with user mobility characteristics~\cite{Liu2016}. Therefore, the application of static zipf model to content popularity distribution in edge networks is not suited. Some researchers have adopted dynamic content popularity distribution models based on user preferences and topological relationships as in~\cite{Jiang2019,Jiang2019a}, as Markov process in~\cite{Sadeghi2017}, and ML-based popularity prediction in~\cite{Tanzil2017}. User content requests are predominantly modeled as Poisson point distributions~\cite{Li2019,Wang2017a,Hu2018,Jiang2019a,Hou2018}. Researchers~\cite{Tanzil2017} further utilize ELM for to predict content popularity based on \textbf{(a)} content features built from human perception model and \textbf{(b)} user requests modeled as Poisson distribution. Some researchers model user requests as zipf distribution~\cite{Bommaraveni2019,Bastug2016} or Markov process~\cite{Sadeghi2019}. Some of the researchers ignore user mobility~\cite{Doan2019} while others model it as Poisson point process (PPP)~\cite{Hu2018,Jiang2019a}, random walk model~\cite{Alfano2014,Malik2020,Chen2018b}, or as Markov process~\cite{Liu2019}. Bastug et al.~\cite{Bastug2016} consider the location of Cache enabled BSs distributed as PPP. Several works utilize NNs to predict the mobility of users in edge networks. Li et al.~\cite{Li2019} utilized RNN based ESN model to predict user mobility and LSTM based model to predict content popularity. The ESN provides non-linear system forecasting with temporal inputs. The ESN model takes location history of a user over a period of time as input and initially modeled as PPP to predict user history at \textit{t+1}. The output of ESN model for user location and user context (gender, age, occupation, time, etc) are input to the LSTM for content popularity prediction. Similarly, Chen et al.~\cite{Chen2017} utilize modified ESN to predict the user content request distributions and mobility patterns. User context information (time, week, gender, occupation, age, location, and device type, etc.) is input to the ESN to get output of content request and mobility patters. The initial user mobility is adopted from pedestrian mobility patterns according to which a user visits places of interest at a specific time of the day. Researchers~\cite{Yin2018a} use user location history as input to ESN to predict mobility patterns and user context as input to another ESN to predict content popularity. The dynamic wireless channel state in terms of Channel State Information (CSI) is modeled in few of the studies~\cite{Chuan2019,Li2019,Wang2019a}. Researchers~\cite{Xiang2019,Wang2019a,Hu2018} models the wireless channel as finite-state Markov channel. Chen et al.~\cite{Chen2017} model the mmWave propagation channel between the UAVs and users using the standard log-normal shadowing model. Researchers~\cite{Li2019,Yin2018a} model wireless channel with dynamic path loss, channel attenuation index, and Gaussian noise. Other studies assume channel conditions to be invariant Many studies model some parameters of the optimization problem as MDP. For example, reference~\cite{Sadeghi2017} model user content request as Markov process with unknown transition probabilities. References~\cite{Gu2014,Wang2017a,Wang2019a} model the cache replacement problem as MDP. Reference~\cite{Liu2019} mobility patterns of users are characterized as Markov process. Reference~\cite{Xiang2019} models the wireless channel as finite-state Markov channel while reference~\cite{He2018} models cache state as Markov model. \section{Research Challenges and Future Directions}\label{sec:cfd} The listed state-of-the-art research works have provided the foundations of ML application in edge caching while addressing issues of popularity prediction~\cite{Trzcinski2017,He2017}, mobility prediction~\cite{Chen2017}, social awareness~\cite{Wu2020,Shan2019}, community detection~\cite{ElBarawy2014,Nguyen2019}, cache decision optimization~\cite{Jiang2019a}, content feature extraction~\cite{Lei2018}, content clustering~\cite{Hou2018}, and cache replacement~\cite{Wang2017a}. The application of ML techniques in wireless networks and caching is a relatively new research topic. The research community has so far not vigorously focused on applications of ML for cache coding, federated caching, and encoding strategies. Lesser attention has been paid to research issues of security~\cite{Li2018a}, privacy~\cite{Liu2020}, federated learning~\cite{Yu2018}, joint interference alignment and caching~\cite{He2017b}, and cache economics~\cite{Khan2019}. Therefore, many research challenges need to be addressed towards further enhancement of the research domain. In this section, we highlight the key challenges to edge caching based ML techniques. Future research directions for the same are also debated. \subsection{Encoding strategies:} Multimedia content is available in a variety of specifications such as, 4K, Quad High Definition, 360$^{o}$, etc. The user preferences and available data rates change the encoding specification from time to time increasing demand on caching capacity~\cite{Paschos2018}. Major content provider like Netflix encode popular videos to more than 120 different bitrates and screen resolutions~\cite{Bilal2019}. Based on the network conditions and user equipment, a different version of same video may be requested, resulting in storage of multiple version of same video in cache, wasting considerable space. Moreover, absence of a specific version means a new request to the content provider is generated resulting in high delay, low QoE, and low CHR. Therefore, instead of requesting a variant of the available cached content, online and in-edge transcoding technique may be applied~\cite{Bilal2018,Bilal2019,Baccour2020a}. The online transcoding of cached content results in considerable gains in storage optimization, users' QoE, access delay, and cost~\cite{Bilal2019}. However, intelligently caching a video representation to avoid redundancy and storage wastage is not explored in detail. Therefore, ML techniques need to be studied to optimize online video caching and transcoding. All of the listed works assumed static encoding parameters ignoring the diversity of user requirements and network conditions. Although work has been done on encoding strategies in wireless edge caching~\cite{He2018,Liao2017,Park2017}, the applications of ML for encoding frameworks are very limited~\cite{Luo2019}. Future research can focus on learning user preferences and network conditions to predict appropriate encoding specifications for pre-fetching content accordingly. Moreover, online transcoding services at the edge of the network can be considered to lower load on transit and core network while providing users with low latency content according to user preferences. Figure~\ref{fig:trans} represents a framework for online transcoding in edge networks with elements for ML where users upload contents to central cloud data centers~\cite{Liu2018a,Bilal2019}. Multiple copies of the same content with different transcoding specifications are stored at the cloud, CDNs, and edge caches. As a result, the capacity of edge cache is limited without the utilization of online transcoding. \begin{figure} \centering \includegraphics[width=8.7cm]{images/trans.png} \caption {A Framework for Online Transcoding in Edge Networks} \label{fig:trans} \end{figure} \subsection{Coded Caching:} In coded caching, the content is divided into \textit{wants} (content delivery) and \textit{has} (content placement) parts at each UE. The content placement phase is planned such that future opportunities arise for multi-cast or broadcast delivery of coded content. When the users expose their requests, the server codes the requested content and broadcasts it. Each user decodes its part of content using simple XOR operations and side information~\cite{Xu2019}. A generic framework of coded caching is illustrated in Figure~\ref{fig:code}. Caching coded content at the edge of the network has been demonstrated to substantially increase system throughput and global caching gain~\cite{Chhangte2020,He2019}. Unexplored opportunities exist for the application of ML techniques towards coded caching. The user requests can be predicted with the help of ML techniques to obtain more opportunities of coded content delivery. Moreover, federated feature extraction from the placed content at UEs can help in the distributed prediction of content requests with lower privacy risk. \begin{figure} \centering \includegraphics[width=9cm]{images/code.png} \caption {The Concept of Coded Caching in Edge Networks~\cite{Paschos2018}.} \label{fig:code} \end{figure} \subsection{Federated caching:} Federated/joint caching means that content is cached and shared in the network among multiple MNOs~\cite{Taleb2019}. Federated caching reduces content duplication with a resource sharing mechanism that extends beyond the operational boundary of an MNO~\cite{Fadlullah2020,Qian2020}. However, none of the listed research works has benefited from federated caching which is more optimal than a single MNO caching scenario in terms of cost and resource management. Considerable gains in cost and cache hit ratio may be achieved using federated caching. However, multiple autonomous MNOs have proprietary network equipment and architectures with no sharing and access permissions. Therefore, the central access positions, such as CRANs and virtualized BBU pools offer an optimal place for collaborative and federated caching. However, novel federated caching architectures need to be designed specifically considering privacy and security. Moreover, appropriate cost and monetization models need to be developed considering complex access patterns~\cite{Cui2020,Fadlullah2020}. Currently, there is no consensus on an architecture of federated caching in edge networks that defines cost and payment models for MNOs. Federated caching can help lower the cost of training an ML model by distributing it among multiple MNOs. Moreover, federated caching can lead to better predictions while aggregating data from multiple MNOs. Furthermore, TL techniques can be applied to explore the diffusion of ML outcomes across multiple MNOs. Therefore, a notable future research direction can be federation of MNOs for ML-based caching in edge networks~\cite{Yu2018,Bilal2019}. \subsection{Federated learning:} In a general ML approach, data is gathered from users and sent to a central server for feature extraction and training of the ML model. This approach is susceptible to privacy and security issues due to data communication and storage at a central store~\cite{Lim2020,Rehman}. An alternate approach is federated learning which does not require centralized data aggregation and lowers privacy and security risks. Instead of centralized intelligence, individual nodes or users train ML models on local data to collaboratively learn parameters of a distributed ML model~\cite{Zhang2018a,Wang2020b}. The benefits of privacy preservation from federated learning have been investigated in a few of the listed works~\cite{Liu2020,Yu2018}. However, the debate of privacy-accuracy tradeoff expanding from federated learning is yet to be explored in edge caching. Moreover, the above-mentioned works have utilized federated learning for data clustering. Other ML algorithms for popularity prediction, problem optimization, and feature extraction are yet to be investigated with the approach of federated learning. \subsection{Delivery strategies:} All of the discussed works have applied explicit D2D cache delivery or implicit unicast delivery. CoMP~\cite{Zhou2017} and multi-cast~\cite{Bilal2019} delivery have not been applied independently to cache delivery. Cache delivery techniques have not been tested in conjunction with the application of ML in edge caching. Multi-cast represents a viable and efficient option when amalgamated with caching and ML for not only RAN but also for transit and backhaul links. Predictive caching based on user preferences may considerably enhance RAN utilization and QoE where the predicted content is multi-cast to multiple UEs simultaneously at non-peak hours and highest bit-rates. Such a multi-cast delivery may occur at any level including \textbf{(a)} MNO core while sending contents to multiple RANs \textbf{(b)} BS level while sending content to multiple UEs within RAN, and \textbf{(c)} D2D level where the content may be multi-cast to multiple UEs in range for future access~\cite{Zahoor2020}. However, very little work has been done in this regard. This point presents a venue for future research works to incorporate CoMP and multi-cast delivery with ML-based caching techniques~\cite{Bilal2019,Wang2017}. Some research areas that may incorporate multi-cast delivery, caching, and ML include \textbf{(a)} community detection by ML techniques and caching at influential users using multi-cast delivery, \textbf{(b)} advertisements and pre-cached content dissemination using multi-cast delivery, and \textbf{(c)} delivery of cost modeling and FL parameters with multi-cast. \subsection{User preferences and content popularity:} Some of ML techniques such as TL and RL work with little or no data as input. However, data regarding user preference is required for content clustering and popularity prediction~\cite{Liu2020,Skaperas2020}. The user traffic is https, hence, the application layer content is hidden from the network resources that transport data~\cite{Li2018}. Users can agree to share their preferences, or be monitored for content access at CDNs or destination server~\cite{Lei2018,Din2019}. Therefore, the training data for content request and popularity prediction can only be available from a central server. On the other hand, only 1\% of the Facebook videos account for more than 80\% of the watch time~\cite{Goian2019,Baccour2020a}. Finding this small class of the CDN content popular in an edge community in a certain time interval is a complex but highly beneficial task. The spatial granularity of a BS coverage area and the dynamic number of associated users results in challenging content popularity models~\cite{Liu2016}. Future research works need to explore ML techniques for time-series content popularity with respect to edge communities. \subsection{Privacy Issues:} In some use cases, the users may agree to share data about their preferences in order to facilitate ML techniques. In such cases, methods that should be incorporated to assure data privacy and security have not been debated in detail~\cite{Liu2020,He2018,Wang2019b}. For instance, users can share their content preference data to facilitate content clustering (K-means), topic modeling, and social communities identification for optimal caching decisions. Similarly, user mobility data is essential for accurate mobility prediction and UE-BS association models in edge networks. However, the centralized collection of mobility and user preference data is vulnerable to large-scale surveillance. Utilizing user location and preference data will necessitate the establishment of trust protocols among UE and the MNOs~\cite{He2018,Chang2018,Zhang2018a}. Moreover, trust needs to be established among UEs for D2D content sharing with or without the help of a dedicated trust agent~\cite{Zhang2018b,Jiang2019}. Furthermore, security measures should be exercised while the user's data is stored for ML applications at MEC or CDN servers. In the MEC and edge computing scenario, all such protocols should be light-weight so that they do not burden the energy resources of the UE and edge servers extensively~\cite{Khurshid2019,Hussain2019,Adeel2019}. User privacy~\cite{Liu2020} and security~\cite{He2018} issues related to edge caching have been studies. Specifically, work has been done on RL based security in edge caching~\cite{Xiao2018}. However, these works have not been evaluated on desirable characteristics for edge caching, such as light-weight and reliability. Blockchain-based privacy and security solutions have been proposed for edge networks~\cite{Kang2018,Yang2020}. Two research issues need attention regarding the integration of Blockchain services in edge networks: \textbf{(a)} distribution of compute-intensive blockchain workload among edge devices, and \textbf{(b)} monetization/reward policy for collaborative blockchain execution among edge nodes~\cite{Salah2019}. \subsection{Cost and monetization models:} Caching economics is one of the least addressed issues in edge caching. Caching at UE and D2D communication leads to the storage, power, and data consumption of mobile devices. All UEs do not cache and share the same amount of content leading to an unfair communication scenario. Therefore, incentive models are necessary for UEs that afford more caching and transmission than other UEs~\cite{Khan2019,Ren2019}. An example of a basic incentive mechanism can be higher download data rates and lower delay for the UE with higher sharing/transmission history~\cite{Jiang2019}. However, most D2D caching techniques lack an incentive mechanism and a standard is necessary for practical UE cache deployments. Moreover, the application of ML techniques for edge caching demands that UE, BSs, and other network entities capable of processing power collaboratively share the workload of compute-intensive learning methods. Based on the distributed contributions, each processing entity should be rewarded for participation in the learning process as all entities receive the same benefits of the optimal caching decisions~\cite{Wang2019a,Debe2020}. Relay nodes may be used in D2D communication, where the sender and receiver may not be in range. Specific monetization models for relay nodes also needs to be defined so that an adhoc setup for data delivery may be established where sender and receiver may reside many hops away. To aggregate issues, compute-intensive Blockchain services are being integrated with edge networks. Despite the many-fold applications of blockchain in edge networks, the distribution of workload and monetization of resources among edge devices remains the main research issue~\cite{Yang2019a,Liu2018b}. \subsection{Complexity:} The wireless edge networks have complex dynamics. When considering all dynamic parameters, such as channel variations, user mobility, user preference, content popularity, the optimization of caching cost (data transmission, delivery time, etc), the time complexity of solving optimization problems increases exponentially~\cite{Li2018,Alasmary2019,He2017b}. In particular, the joint optimization of cache placement and physical layer transmission is deemed NP-hard~\cite{Paschos2018}. The caching optimization decisions are also online in nature, where changing dynamics require updates in the solution. Therefore, current research works do not incorporate multiple edge dynamics while assuming some of the parameters as constant to limit the complexity of the mathematical formulation. However, for higher CHR and more applicable solutions, caching decision problems with realistic assumptions are necessary~\cite{Sadeghi2017,Yin2018a}. Suboptimal solutions are seldom considered to reduce the complexity of online solutions for edge caching~\cite{Wang2017b,Shan2019}. \subsection{Standard Data Set:} A standard user preference and edge-based content popularity data set is required to compare research works and formulate baseline results~\cite{Sun2019}. Existing research works either predict content popularity from no data or a data set that is not public. Furthermore, the existing data sets derive data from CDN or cloud sources that do not represent an edge network~\cite{Liu2019}. The MovieLens~\cite{Harper2015} data set containing information about real-world movies, users, and ratings are often applied for the evaluation of the recommendation systems. References~\cite{Adeel2019,Thar2018,Yu2018,Song2019,Garg2019} utilize the MovieLens data-set to predict the popularity of the content with various learning techniques. However, the MovieLens data-set represents features for cloud/CDN based user access and can not be mapped to an edge network. Similarly, standard data sets for user mobility also impede baseline research~\cite{Malik2020}. Recent research published a public dataset of Facebook Live videos that can be filtered by location to formulate an edge network representation~\cite{Baccour2020}. The data set contains ID and geo-location among other metadata of more than 1.5 Million Facebook Live videos collected from the Facebook Live Map. Further investigations are required to extract content popularity from the metadata. Moreover, efforts are needed to differentiate and highlight the differences in edge popularity and cloud popularity of the content. Such difference if not considered can significantly effect the cache population and CHR. \subsection{Joint network slicing and caching designs:} Network virtualization enabled network slicing is considered a key enabler of NGNs~\cite{Ferrus2018}. Network slicing allows MNOs to manage dedicated logical networks with specific functionality to service user requirements. For example, a vehicular RAN network can be composed of two slices where one supports time-critical driving services while the other network slice serves the bandwidth consuming video streaming services~\cite{Zhang2020}. The distribution of network slices among bandwidth hungry and delay in-tolerant services can guide caching strategies to distribute content among BSs and UE in a RAN network. The joint consideration of network slicing with caching can bring great benefits for the MNO~\cite{Xiang2017}. However, the joint network slicing and caching designs have been evaluated by only one of the listed works~\cite{Xiang2020}. Further work is required to understand the interaction of network slicing with edge caching in edge resource management scenarios. \subsection{UAV assisted caching:} Researchers~\cite{Chen2017} proposed a novel UAV assisted caching scheme for edge networks. The scheme utilizes mmWave frequency for UAV-to-user communications while deploying UAV in user density areas and clusters. The UAV-to-user channel can provide high SNR than the BS-to-user channel in some scenarios. ML techniques can be applied to predict the content that must be cached in the UAV considering a user cluster that may request specific contents. Moreover, the population and spatial features of the cluster can be predicted by ML techniques for optimal cache decisions and delivery. However, mmWave frequency is highly sensitive to the physical environment and obstacles. Path loss occurs due to user mobility and line-of-sight changes. Coverage and blockage zones change dynamically which requires content duplication and highly dynamic content placement strategy. Therefore, user mobility and content popularity prediction models need to be accurate while accommodating the dynamic behavior of the mmWave channels~\cite{Li2018,Giatsoglou2017}. Future research works need to consider the constraints of mmWave communication while designing optimal D2D caching policies. \section{Conclusion}\label{sec:conc} We comprehensively surveyed ML-based edge caching techniques in this article. We examined the role of 5G, SDN, and NFV in edge caching. We provided an exhaustive taxonomy of the research domain with details of background topics including ML, edge networks, and caching. The state-of-the-art ML techniques were categorized into supervised learning, unsupervised learning, RL, NN, and TL based on application to problems of prediction and clustering. We critically compared and analyzed the research work on parameters, such as ML method, network scenario, ML objective, caching objective, caching location, replacement techniques, content popularity distribution, content request distribution, and user mobility models. We further complemented our debate on ML-based edge caching by discussing future challenges and research issues. The research issues and challenges are related to the the exploration of encoding strategies, coded caching, federated caching, initiation of federated learning-based edge caching, multi-cast and CoMP delivery strategies, availability of standard data sets, cost and monetization models for D2D caching, and the establishment of light-weight privacy-preserving and security mechanisms. \subsection*{Acknowledgments} This work is supported by the Postdoctoral Initiative Program at the Ministry of Education, Saudi Arabia.
\section{Introduction} \label{sec:intro} Immersive video technologies have experienced significant development over the past few years. One such technology is Free Viewpoint Video (FVV), which enables users to navigate a scene by placing a virtual camera ideally at any viewpoint of their choosing. This functionality has the potential to improve user experience in many applications such as broadcasting of any kind of events (sports, performances, etc.) or interactive video communications (telepresence). As it is typical of 3D reconstruction systems, FVV systems need to see the 3D scene from many reference viewpoints (i.e., cameras) and integrate the information from them to synthesize a model or virtual view of the scene. However, unlike static 3D reconstruction applications, FVV systems need to simultaneously capture many synchronized video streams, which means that the sheer amount of input data easily exceeds the capabilities of any single computer. Therefore, FVV systems are inherently distributed, they need distinct nodes devoted to capture and synthesis, and some means to efficiently encode and transmit data among them. Thus, the design and development of FVV systems presents a number of challenges regarding video quality, cost and other functional requirements such as real-time operation, which are frequently at odds with one another. Clearly, high video quality benefits from having more and higher resolution cameras, but that increases the cost and the amount of data to be transmitted and processed, making it (even) more difficult to meet real-time constraints, which is already hard with few cameras due to the high computational complexity of typical view synthesis algorithms. In fact, expensive systems in commercial operation such as Intel True View~\cite{trueview} or 4DReplay~\cite{4dreplay} have been designed to maximize visual quality but at the cost of sacrificing real-time operation despite using tens of processing nodes. In this paper, we present FVV Live, a novel end-to-end real-time, low-cost, FVV system that coordinates several nodes covering the various stages of the system, from capture to transmission, synthesis, and finally visualisation and control from a mobile terminal. FVV Live was conceived from the outset with the two key constraints of low-cost, only resorting to consumer-grade electronics, and real-time operation. These two constraints have informed many of the decisions taken during the design and development of the system. While other systems have been proposed in the literature or in the industry, FVV Live remains, to our knowledge, the only system operating in real-time and, furthermore, at a substantially lower cost than other proposals. \begin{figure}[tbh] \begin{centering} \includegraphics[viewport=0bp 150bp 2048bp 1100bp,clip,width=0.85\columnwidth]{figs/cameras_surround} \par\end{centering} \caption{\label{fig:capture-setup}Overview of the capture setup.} \end{figure} \section{\label{sec:Capture-and-transmission}Capture and transmission} The first stage of the FVV system is the capture of video streams from the scene. Stemming from the low-cost requirement, we evaluated several consumer depth cameras, but most of these devices project infrared light patterns. While this is perfectly adequate for a single camera, whenever multiple such cameras operate simultaneously, their infrared light patterns projected at the same time on the scene interfere with one another, which drastically decreases the quality of the depth estimation. Consequently, we chose the Stereolabs ZED cameras, which estimate depth thanks to a purely passive approach, and therefore can be used together with any number of them at the same time. Figure~\ref{fig:capture-setup} shows our capture setup with nine ZED cameras. Professional multi-camera setups typically use hardware dedicated clock sources to synchronize the capture of frames among all cameras, but the ZED camera, which is a consumer-grade device, offers no such facility. Each camera is simply attached to the controlling computer via a USB 3.0 link, so we have developed our own software synchronization scheme using timestamps and a shared clock source, distributed using PTP (IEEE 1588-2002). \begin{figure}[tbh] \includegraphics[width=0.5\columnwidth]{figs/colour_1900}\includegraphics[width=0.5\columnwidth]{figs/depth1900} \caption{\label{fig:sample-frame-colour-and-depth}Sample frame, colour (l) and depth (r) information.} \end{figure} Each camera yields regular pictures plus their corresponding depth estimation (not actually computed by the camera, but by software on the GPU of the controlling node), as shown in figure~\ref{fig:sample-frame-colour-and-depth}. The sequence of regular pictures is compressed with standard (lossy) video codecs, which cannot be blindly applied to depth data. Firstly, more than 8 bits per pixel are required to maintain proper reconstruction quality and, furthermore, lossy coding schemes are unacceptable because the structure of the scene would be altered. Therefore, we have adapted a lossless 4:2:0 video codec to transport 12 bits per pixel of depth information by carefully arranging depth data from each $2\times2$ pixel substructure as shown in figure~\ref{fig:adaptation-of-420-for-depth}. \pagestyle{empty} \begin{figure}[tbh] \begin{centering} \includegraphics[width=0.94\columnwidth]{figs/depth_composed} \par\end{centering} \caption{\label{fig:adaptation-of-420-for-depth}Adaptation of $2\times2$ pixel cells to 4:2:0 sampling structures to transport 12 bpp of depth data.} \end{figure} \section{Synthesis and visualization} A dedicated server receives video and depth streams from the capture nodes and generates the synthetic view according to the viewpoint and camera orientation selected by the user. In principle, if enough computational power and network capacity were available it would be desirable to use as much information about the scene as possible to compute the virtual view. However, even the most powerful computers cannot tackle problems like multi-view stereo~\cite{furukawa2010towards} in real-time, so there is not much value in transmitting all available data. In recognizing this fact, and considering that real-time operation is irrenounceable for us, we dynamically select the three reference cameras closest to the virtual viewpoint, as shown in figure~\ref{fig:dynamic-selection-of-reference-cameras}, warp them to the virtual viewpoint using DIBR techniques, and mix their contributions to produce the synthesized view of the foreground. Although we only use the three closest cameras to synthesize the view, we actually transmit the five closest to ease handovers, having the cameras that will be needed next as reference ``on call''. \begin{figure}[tbh] \begin{centering} \includegraphics[width=0.9\columnwidth]{figs/camera_selection} \par\end{centering} \caption{\label{fig:dynamic-selection-of-reference-cameras}Dynamic selection of reference cameras for the virtual view synthesis.} \end{figure} To reduce the amount of data to transmit and process, we observe that the colour of the background may change over time due to shadows or illumination changes, but not its structure (depth). Consequently, we can afford to generate a detailed model of the depth of the background during system calibration (offline) using techniques that are too costly to be used in real time (e.g., Shape from Motion, Multiview Stereo), so that during online operation we need to send depth information only about the foreground. Finally, we synthesize the virtual view using a combination of layers from both background and foreground information to produce a natural result at reduced computational cost. \begin{figure}[tbh] \begin{centering} \includegraphics[width=1\columnwidth]{figs/frame1900} \par\end{centering} \caption{\label{fig:results-from-a-virtual-viewpoint}Synthetic view of the same instant shown in figure~\ref{fig:sample-frame-colour-and-depth}.} \end{figure} Thanks to its careful design and optimization, FVV Live is capable of delivering good quality results, as shown in figure~\ref{fig:results-from-a-virtual-viewpoint} (see \url{https://www.gti.ssr.upm.es/fvvlive} for video demos), while maintaining real-time operation at Full HD resolution at 30~fps. \bibliographystyle{IEEEbib}
\section{Introduction} \vs{1} \begin{figure*}[] \vspace{0.2cm} \begin{minipage}{1.0\textwidth} \centering \label{fig:model-diagram} \includegraphics[width=1.0\linewidth]{figures/topdownbottomup_v5.png} \caption{Overall layout of the proposed Bidirectional Recurrent Independent Mechanisms (BRIMs) model. Information is passed forward in time using recurrent connections and information passed between layers using attention. Modules attend to both the lower layer on the current time step as well as the higher layer on the previous time step, along with \emph{null}, which refers to a vector of zeros. } \end{minipage} \end{figure*} Deep learning emerged from the goal of learning representational hierarchies, with the higher levels corresponding to abstract features used for decision-making~\citep{Hinton06,Bengio-nips-2006-small,salakhutdinov2009deep}. Hierarchical models are often taken to imply that computation proceeds in a feedforward or \emph{bottom up} fashion, i.e., stage-wise information processing in which low-level (sensory) representations construct or modulate high level (conceptual) representations. However, they could equally well support the flow of information in a feedback or \emph{top down} fashion, i.e., information processing in which high-level representations modulate lower-level representations. Neuroscientists have noted that reciprocity of connectivity among anatomically distinct areas of neocortex is common \citep{FellemanVanEssen1991,Rockland2015}, causing early visual areas to be modulated by later stages of processing~\citep{Bastos:2015eu}. The same is true for other sensory modalities as well~\citep{Manita:2015bp}. Neuroimaging research has found evidence for distinct bidirectional activity flows with functional consequences \citep{Dijkstra2017,Nielsen1999}, and neurophysiological and neuroanatomical studies indicate the important role of top-down information for guiding processing resources to behaviorally relevant events \citep{baluch2011mechanisms,gilbert2013topdown}. The Global Workspace theory~\citep{baars1997theatre,Dehaene-et-al-2017} posits that top-down signals are necessary to broadcast information throughout neocortex, which enables conscious states and verbal behavior. Nonetheless, the neural mechanisms of interaction between bottom-up and top-down pathways are still poorly understood. One goal of our research is to conduct machine-learning experiments to explore the value of top-down mechanisms for learning, achieving robustness to distributional shifts, and guiding the development of novel and improved neural architectures. In the cognitive science community, the relative contributions of bottom-up and top-down signals have been an ongoing subject of debate for over 40 years \citep{Kinchla1979,Rauss2013}. The \citet{Mcclelland1981} model of printed-word reading consisted of a hierarchy of detectors, from letter fragments to letters to words, with bidirectional connectivity. The top-down connectivity imposed orthographic constraints of the vocabulary and helped to explain human proficiency in reading. The model also accounted for puzzling behavioral phenomena, such as the fact that people are better at discriminating the letters \textsc{e} and \textsc{o} when a letter appears embedded in a word---such as \textsc{r\underline{e}ad}---than when the same letter is presented in isolation. In the model, partial activation from the representation of the word \textsc{read} provides top-down support for the activation of the letter \textsc{e} in the context of the word, but not the \textsc{e} in isolation. If top-down pathways provide expectations, they can be considered as priors on subsequent inputs, and uncertainty plays a key role in how information is combined from bottom-up and top-down sources \cite{Weiss2002,Kersten:2004hd}. For instance, if one enters a familiar but dark room, one's expectations will guide perception and behavior, whereas expectations are less relevant in the light of day. Even without prior expectations, top-down pathways can leverage simultaneous contextual information to resolve local uncertainty, e.g., the interpretation of the middle letters of these two words: \includegraphics[]{images/THECAT.pdf}. Thus, top-down processing leverages goals, temporal and concurrent context, and expectations (conscious or otherwise) to steer or focus the interpretation of sensory signals. Top-down processing helps to overcome intrinsically noisy or ambiguous sensory data, whereas bottom-up processing allows an agent to be reactive to unexpected or surprising stimuli. \vspace{-4mm} \paragraph{Information Flow in Deep Neural Networks.} Models having within-layer recurrence are common (e.g., LSTM layers), but such recurrence involves a particular level of representation interacting with itself, as opposed to the strict top-down notion of higher levels acting on lower levels. In contrast, a layered architecture with feedforward and feedback connections makes a structural distinction between higher and lower levels of representations, and it requires a combination of information from two distinct sources. Bidirectional layered models have long existed \cite{dayan1995helmholtz,Larochelle2008,salakhutdinov2009deep}, but these models have not received the same intense scrutiny and development as feedforward models. The goal of this paper is to revisit bidirectional layered models with the aim of raising them to state-of-the-art in performance and more specifically, out of distribution generalization. Simply taking existing models and incorporating bidirectional connectivity introduces challenges \cite{Iuzzolino2019}. Instead, we explore the notion that bidirectional information flow must be coupled with additional mechanisms to effectively select from potential top-down signals, modulate bottom-up signals and prevent a cacophony of intermixed signals. We propose two specific mechanisms from the deep learning toolkit to dynamically route information flow: \emph{modularity} and \emph{attention}. With these two mechanisms, we outperform state-of-the-art feedforward models on challenging vision and language tasks. \vspace{-4mm} \paragraph{Dynamic Information Flow Using Attention.} \citet{goyal2019recurrent} offer evidence that modularity, coupled with a flexible means of communication between modules, can dramatically improve generalization performance. They describe a recurrent independent mechanisms (RIMs) architecture that dynamically controls information flow in a modular RNN. The recurrently connected modules compete for external input and communicate sets of objects \emph{sparingly} via differentiable attention mechanisms driven by the match between keys (from a source module) and queries (from a destination module). Computation is sparse and modular, meaning that only a subset of the neural modules are active at any time. Composition of computations is dynamic rather than static, in the sense that the attention mechanism uses context to select the subset of modules that are activated and what is communicated to which module, with the input of one module dynamically selected, so the values associated with selected objects are not always coming from the same modules or parts of the input. The motivating intuition behind this increased flexibility is that if the relationship between modules changes between training and evaluation, a model which keeps the information in these modules sufficiently separate should still be able to correctly recombine information, even though the overall data distribution differs from what was seen during training. \vspace{-4mm} \paragraph{Combining Top-down and Bottom-up Information with Attention over Modules.} We now present our central proposal, which is that top-down and bottom-up signals should be combined explicitly and selectively by using attention. On a given time step, only a fraction of the high-level concepts being detected are likely to be relevant for a particular stimulus. For example, if a person is trying to classify an object in a dark room (which they are familiar with), the most relevant top-down signal is the person's prior knowledge of what that object looks like, as opposed to other knowledge about the room. This motivates breaking up the hidden state into multiple modules, such that the top-down and bottom-up interactions can be appropriately focused. Thus we consider the use of modules at multiple levels of abstraction to be a key ingredient for our method. We elect to build upon the Recurrent Independent Mechanisms (RIMs) framework for the modular building blocks, as their end-to-end training demonstrated successful specialization between modules \cite{goyal2019recurrent}. However, while network modularity revealed considerable computational advantages, the modules in the RIMs architecture are fully interconnected and thus there is no notion of layered or hierarchical structure. To address this issue, we propose a new architecture, which we call \textit{Bidirectional Recurrent Independent Mechanisms (BRIMs)}. This new approach endows the attention-based, modular structure with a hierarchy of layers composed of competing modules, yielding organized contextual computations during training. The rationale is to provide an architectural backbone such that each layer of the hierarchy can send information in both a bottom-up direction as well as in a top-down direction. We find that this inductive bias, combined with the modularity mechanisms developed in~\citet{goyal2019recurrent}, provides considerable and further advantages for tasks where there is a change of input distribution from training to testing. \section{Preliminaries} \paragraph{Multi-layer Stacked Recurrent Networks.} The most common multi-layer RNN architecture is bottom-up and feed-forward, in the sense that higher layers are supplied with the states of the lower layers as inputs. An $L$-layer deep RNN is then concisely summarized as: \begin{align} \textbf{y}_t &= D(\textbf{h}^L_t) \\ \textbf{h}^l_t &= F^{l}(\textbf{h}^{l-1}_t, \textbf{h}^l_{t-1}) \label{rnn_hier} \\ \textbf{h}^0_t &= E(\textbf{x}_t) \end{align} with $l = 0,1,...,L$. For a given time $t$, $\textbf{y}_t$ denotes the model prediction, $\textbf{x}_t$ the input and $\textbf{h}^l_t$ the hidden state of the model at layer $l$. $D$ and $E$ denote the Decoder and Encoder for the model. $F^l$ represents the recurrent dynamics at the hierarchy level $l$ (e.g., an LSTM or GRU). \paragraph{Key-Value Attention.} Key-value Attention (also sometimes called Scaled Dot Product attention), defines the backbone of updates to the hidden states in the proposed model. This form of attention is widely used in self-attention models and performs well on a wide array of tasks \citep{vaswani2017attention, santoro2018relational}. Given a set of queries $\textbf{Q}$, keys $\textbf{K}$ ($d$-dimensional) and values $\textbf{V}$, an attention score $\textbf{A}_S$ and an attention modulated result $\textbf{A}_R$ are computed as \begin{align} \mathrm{\textbf{A}_S} &= \mathrm{Softmax} \left (\frac{\textbf{QK}^T}{\sqrt{d}} \right) \label{att_score}\\ \mathrm{\textbf{A}_R} &= \mathrm{\textbf{A}_S}\; \textbf{V} \label{att_out} \end{align} \paragraph{Recurrent Independent Mechanisms.} RIMs \citep{goyal2019recurrent} consist of a single layered recurrent structure where the hidden state $\textbf{h}_t$ is decomposed into $n$ modules, $\textbf{h}_{t,k}$ for $k = 1, ... n$. It also has the property that on a given time step, only a subset of modules is activated. In RIMs, the updates for the hidden state follow a three-step process. First, a subset of modules is selectively activated based on their determination of the relevance of their input. Second, the activated modules independently process the information made available to them. Third, the active modules gather contextual information from all the other modules and consolidate this information in their hidden state. \paragraph{Selective Activation.} Each module creates queries \mbox{$\bar{\textbf{Q}}={Q}_{inp}\,(\textbf{h}_{t-1})$} ($n \times d$ matrix) which are then combined with the keys $\bar{\textbf{K}}={K}_{inp}\,(\textbf{\o},\textbf{x}_t)$ and values $\bar{\textbf{V}}={V}_{inp}\,(\textbf{\o}, \textbf{x}_t)$ obtained from the input $\textbf{x}_t$ and zero vectors $\textbf{\o}$ to get both the attention score $\bar{\textbf{A}}_S$ and attention modulated input $\bar{\textbf{A}}_R$ as per equations \eqref{att_score} and \eqref{att_out}. Based on this attention score, a fixed number of modules $m$ are activated for which the input information is most relevant (where the null module, which provides no additional information, has low attention score). We refer to this activated set per time-step as $\mathcal{S}_t$. \paragraph{Independent Dynamics.} Given the attention modulated input obtained above, each activated module then undergoes an update in its hidden state: \begin{align} \bar{\textbf{h}}_{t,k} &= \begin{cases}F_k\, ( \bar{\textbf{A}}_{R_k}\,,\,\textbf{h}_{t-1,k}) \quad & k \in \mathcal{S}_t \\ \textbf{h}_{t-1,k} \quad & k \notin \mathcal{S}_t \end{cases} \end{align} $F_k$ here stands for any update procedure, e.g. GRU or LSTM. \paragraph{Communication.} After an independent update step, each module then consolidates information from all the other modules. RIMs again utilize the attention mechanism to perform this consolidation. Active modules create queries $\hat{\textbf{Q}}=Q_{com}(\bar{\textbf{h}}_{t})$ which act with the keys $\hat{\textbf{K}}={K}_{com}(\bar{\textbf{h}}_{t})$ and values $\hat{\textbf{V}}={V}_{com}(\bar{\textbf{h}}_{t})$ generated by all modules and the result of attention $\hat{\textbf{A}}_R$ is added to the state for that time step:\blfootnote{Code is available at \href{https://github.com/sarthmit/BRIMs}{https://github.com/sarthmit/BRIMs}} \begin{align} \textbf{h}_{t,k} &= \begin{cases}\bar{\textbf{h}}_{t,k} + \hat{\textbf{A}}_{R_k} \quad & k \in \mathcal{S}_t \\ \bar{\textbf{h}}_{t,k} \quad & k \notin \mathcal{S}_t \end{cases} \end{align} \section{Proposed Method} Our contribution is to extend RIMs to a multilayered bidirectional architecture, which we refer to as BRIMs. Each layer is a modified version of the RIMs architecture \citep{goyal2019recurrent}. A concise representation of our architecture is depicted in \hyperref[fig:model-diagram]{Figure~\ref{fig:model-diagram}}. We now describe the dynamic bottom-up and top-down flow of information in BRIMs. \subsection{Composition of Modules} We use the procedure provided in RIMs to decompose the hidden state $\textbf{h}^l_t$ on each layer $l$ and time $t$ into separate modules. Thus, instead of representing the state as just a fixed dimensional vector $\textbf{h}^l_t$, we choose to represent it as $\{((\textbf{h}^l_{t,k})_{k=1}^{n_l}, \mathcal{S}^l_t)\}$ where $n_l$ denotes the number of modules in layer $l$ and $\mathcal{S}^l_t$ is the set of modules that are active at time $t$ in layer $l$. $|\mathcal{S}^l_t| = m_l$, where $m_l$ is a hyperparameter specifying the number of modules active in layer $l$ at any time. Each layer can potentially have different number of modules active. Typically, setting $m_l$ to be roughly half the value of $n_l$ works well. \subsection{Communication Between Layers} \label{within_hier} We dynamically establish communication links between multiple layers using key-value attention, in a way which differs radically from RIMs \citep{goyal2019recurrent}. While many RNNs build a strictly bottom-up multi-layer dependency using \eqref{rnn_hier}, we instead build multi-layer dependency by considering queries $\bar{\textbf{Q}}={Q}_{lay}\,(\textbf{h}^l_{t-1})$ from modules in layer $l$ and keys $\bar{\textbf{K}}={K}_{lay}\,(\textbf{\o},\textbf{h}^{l-1}_{t}, \textbf{h}^{l+1}_{t-1})$ and values $\bar{\textbf{V}}={V}_{lay}\,(\textbf{\o},\textbf{h}^{l-1}_{t},\textbf{h}^{l+1}_{t-1})$ from all the modules in the lower and higher layers (blue and red arrows respectively; \hyperref[fig:model-diagram]{Figure~\ref{fig:model-diagram}}). From this three-way attention mechanism, we obtain the attention score $\bar{\textbf{A}}^l_S$ and output $\bar{\textbf{A}}^l_R$ (Equations \ref{att_score} and \ref{att_out} respectively). Note that in the deepest layer, only the lower layer is used and on the first layer, the input's embedded state serves as the lower layer. Also note that the attention receiving information from the higher layer looks at the previous time step, whereas the attention receiving information from lower layer (or input) looks at the current time step. \begin{align*} \small \text{Softmax} \left(\begin{bmatrix} \mathbf{Q}_{\;module\; 1} \\ \mathbf{Q}_{\;module\; 2} \\ \mathbf{Q}_{\;module\; 3} \\ \end{bmatrix} \begin{bmatrix} \mathbf{\color{myred}K}_{\;\phi} & \mathbf{\color{myblue}K}_{\;l-1} & \mathbf{\color{mygreen}K}_{\;l+1} \end{bmatrix} \right) \begin{bmatrix} \mathbf{\color{myred}V}_{\;\phi} \\ \mathbf{\color{myblue}V}_{\;l-1} \\ \mathbf{\color{mygreen}V}_{\;l+1} \end{bmatrix} \\ \begin{matrix} {\color{myred}\phi}: \text{Null} & {\color{myblue}l-1}: \text{Bottom Up} & {\color{mygreen}l+1}: \text{Top Down} \end{matrix} \end{align*} \subsection{Sparse Activation} Based on the attention score $\bar{\textbf{A}}^l_S$, the set $S_t^l$ is constructed which comprises modules for which null information is least relevant. Every activated module gets its own separate version of input (as it's dependent on its query, which is a function of the hidden state of the module) which is obtained through the attention output $\bar{\textbf{A}}^l_R$. Concretely, for each activated module, this can be represented as: \begin{align} \bar{\textbf{h}}^l_{t,k} &= F_k^l \, ( \bar{\textbf{A}}^l_{R_k}, \textbf{h}^l_{t-1, k}) \quad k \in \mathcal{S}^l_t \end{align} where $F_k^l$ denotes the recurrent update procedure. \subsection{Communication Within Layers} We also perform communication between the different modules within each layer (green arrows; \hyperref[fig:model-diagram]{Figure~\ref{fig:model-diagram}}). In order to enable this communication, we again make use of key-value attention. This communication between modules within a layer allows them to share information, albeit in a limited way through the bottleneck of attention. We create queries $\hat{\textbf{Q}}={Q}_{com}\,(\bar{\textbf{h}}^l_{t})$ from active modules and keys $\hat{\textbf{K}}={K}_{com}\,(\bar{\textbf{h}}^l_t)$ and values $\hat{\textbf{V}}={V}_{com}\,(\bar{\textbf{h}}^l_t)$ from all the modules to get the final update to the module state through residual attention $\hat{\textbf{A}}^l_R$ addition as follows: \begin{align} \textbf{h}^l_{t,k} &= \begin{cases}\bar{\textbf{h}}^l_{t,k} + \bar{\textbf{A}}^l_{R_k} \quad& k \in \mathcal{S}^l_t \\ \textbf{h}^l_{t-1,k} \quad& k \notin \mathcal{S}^l_t \end{cases} \end{align} \begin{figure*}[] \begin{minipage}{1.0\textwidth} \centering \includegraphics[width=1.0\linewidth]{plots/CIFAR_BRIMS.jpg} \includegraphics[scale=0.25]{plots/legend.pdf} \caption{On sequential CIFAR-10, we evaluate on 32x32 test images and change a certain number of the pixels to random values. We show the \textbf{average activation weight (y-axis)} on Input (left), Null (middle) and Higher Layer (right) plotted against the \textbf{number of random pixels (x-axis)} (total number of pixels = 1024). We see that as more pixels are set to random values, the model becomes increasingly reliant on the higher-level information. } \label{fig:noise-cifar} \end{minipage} \vspace{-2mm} \end{figure*} \subsection{Training} The architecture proposed here doesn't rely on any additional losses and thus can be used as a drop-in substitute for LSTMs and GRUs. For training we consider task-specific losses which range from classification and video prediction losses to RL losses depending on the problem. \section{Related Work} \textbf{Deep Boltzmann Machines:} Deep Boltzmann machines \citep{salakhutdinov2009deep} resemble our motivating intuitions, as they are undirected and thus have both top-down and bottom-up feedback through an energy function. Additionally, the model captures a probability distribution over the hidden states, such that the role of top-down feedback becomes most important when the bottom-up signal has the most uncertainty. However, a significant problem in deep Boltzmann machines, and with undirected graphical models in general, is that sampling and inference are both difficult. Sampling generally requires an iterative procedure, which may converge slowly. \textbf{Helmholtz Machine:} Like autoencoders, the Helmholtz machine \citep{dayan1995helmholtz} contains two separate networks: a generative network and a discriminative network, and the wake-sleep learning algorithm is applied to discover a latent representation of the data in an unsupervised way. However, unlike in our proposal, the top-down path only influences the learning of the bottom-up path, and not its actual current computation. \textbf{Transformers:} The Transformer architecture \citep{vaswani2017attention} eschews the use of a recurrent state in favor of using attention to pass information between different positions. It lacks an explicit inductive bias towards a bottom-up followed by top-down flow, since at the lowest-layers of the network, the positions in the distant past can only undergo a small amount of processing before they can influence the lower levels of processing of later inputs. \textbf{Modulating Visual Processing with Language:} \cite{devries2017visual} proposes to modulate a visual image processing pipeline by adding in language representations at multiple layers, including early layers. Since the language is already quite abstract, this can be seen as top-down modulation on the model's bottom-up processing. While this improved results, it assumes that the raw data is associated with text which provides a top-down signal, as opposed to our proposed technique, in which the top-down signal is learned end to end from raw data and dynamically applied using top-down attention. \textbf{Hierarchical Multiscale Recurrent Neural Network:} This paper explored an architecture in which the higher layer at previous steps is given as additional inputs to an RNN's lower layers \citep{chung2016hierarchical}. Additionally the higher level information is flushed, copied, or updated, using a sparse gating operation. However a key difference from our work is that we use attention to determine whether and what to read from the higher or lower levels, as opposed to concatenating into the input. Additionally, our approach uses a modular recurrent state. \textbf{Generative Classifiers:} These classify by selecting a class y to maximize $p(x|y)p(y)$. This is a top-down form of classification, since a key factor is estimating the likelihood of a given sample $x$ under a generative model $p(x|y)$. Notably, this purely top-down approach often struggles as learning a model of $p(x|y)$ is generally much harder and much more complex than a direct model of $p(y|x)$ \citep{genclass2002ng}. \textbf{Link to Global Workspace Theory:} The GWT~\citep{baars1997theatre,Dehaene-et-al-2017} proposes that this high-level conscious content is broadcast across the brain via top-down connections forming an active circuit with the bottom-up connections. What has been missing from RIMs and which we propose to study here is therefore a notion of hierarchy of levels enabling this kind of bidirectional information flow mediated by attention. One major difference between the current work, and GWT is that, the kinds of modules that are usually considered in GWT are pretty high level, e.g., face recognition, gait recognition, object recognition, visual routines etc i.e., GWT considers \textit{macro} modules, while the current work focuses more on micro modules. \section{Experiments} The main goal of our experiments is to explore the effect of BRIMs on generalization. In particular, we primarily focus on tasks where the training and testing distribution differ systematically, as we believe that the improved top-down modulation of BRIMs will help the model to adapt to variations unseen during training. Additionally, we provide ablations and analysis which explore how the different components of the BRIMs architecture affect results. We show that BRIMs improve out-of-distribution generalization over sequence length, on sequential MNIST and CIFAR classification, and moving MNIST generation. We then show that BRIMs better reason about physical movement in a synthetic bouncing balls dataset. In all of these tasks, the test distribution differs dramatically from the training distribution. We also show that BRIMs improve results on both language modeling and reinforcement learning. As the data distribution implicitly changes in reinforcement learning as a result of the policy changing during training, this provides further evidence that BRIMs improve out-of-distribution generalization in complex settings. \begin{table} \vs{2} \begin{center} \renewcommand{\arraystretch}{1.0} \resizebox{\columnwidth}{!}{ \begin{tabular}{ ccccc } \hline \textit{Algorithm} & \textit{Properties} & \textit{16$\times$16} & \textit{19$\times$19} & \textit{24$\times$24}\\ \hline LSTM & --- &86.8 & 42.3 & 25.2 \\ LSTM & \textsc{h} & 87.2 & 43.5 & 22.9 \\ LSTM & \textsc{h+b} & 83.2 & 44.4 & 25.3 \\ LSTM & \textsc{h+a} & 84.3 & 47.5 & 31.0\\ LSTM & \textsc{h+a+b} & 83.2 & 40.1 & 20.8\\ \hline RMC & \textsc{a} & 89.6 & 54.2 & 27.8\\ Transformers & \textsc{h+a+b} & \highlight{91.2} & 51.6 & 22.9\\ RIMs & \textsc{a+m} & 88.9 & 67.1 & 38.1 \\ \hline Hierarchical RIMs & \textsc{h+a+m} & 85.4 & 72.0 & 50.3 \\ MLD-RIMs & \textsc{h+a+m} & 88.8 & 69.1 & 45.3 \\ BRIMs (ours) & \textsc{h+a+b+m} & 88.6 & \highlight{74.2} & \highlight{51.4} \\ \hline \end{tabular} } \end{center} \caption{Performance on the \textbf{Sequential MNIST resolution generalization:} Test Accuracy \% after 100 epochs. All models were trained on 14x14 resolution but evaluated at different resolutions; results averaged over 3 different trials.} \label{table:mnist} \vspace{-6mm} \end{table} \subsection{Baselines} In our experiments, we consider multiple baselines which use some aspects of BRIMs, such as stacked recurrent layers and modularity. We compare our architecture against various state-of-the-art models (Transformers \citep{vaswani2017attention}, Relational RNNs \citep{santoro2018relational}) while also providing ablation studies based on an LSTM backbone \citep{hochreiter1997long}. By outperforming these baselines, we demonstrate the necessity of the contributions introduced in the BRIMs architecture. In particular, we try to disentangle the contributions of attention [\textsc{a}], hierarchy [\textsc{h}], modularity [\textsc{m}], and bidirectional [\textsc{b}] structure. \textit{LSTM variants}: We consider variants of LSTMs based on different subsets of important properties. In particular, we experimented with standard LSTMs as well as hierarchical LSTMs without feedback [\textsc{h}], with feedback [\textsc{h+b}], with attention [\textsc{h+a}], and with both [\textsc{h+a+b}]. \textit{Transformers} [\textsc{h+a}]: Self-attention based multi-layer architecture \citep{vaswani2017attention}. \textit{RMC, a relational RNN} [\textsc{a}]: Memory based recurrent model with attention communicating between saved memory and hidden states \citep{santoro2018relational}. \textit{Recurrent Independent Mechanisms (RIMs)} [\textsc{a+m}]: Modular memory based single layered recurrent model with attention modulated input and communication between modules \citep{goyal2019recurrent}. \textit{Hierarchical RIMs} [\textsc{h+a+m}]: Two layered modular architecture with attention based communication between the modules in the same layer and between different layers. Here the flow of information is unidirectional i.e information only flows from bottom to top, and hence no top-down information is being used. \textit{MLD-RIMs, RIMs with Multilayer Dynamics} [\textsc{h+a+m}]: The same as hierarchical RIMs except that the activation of RIMs on the higher layer is copied from the lower layer instead of being computed at the higher layer. This more tightly couples the behavior of the lower and higher layers. \textit{BRIMs} [\textsc{h+a+m+b}]: Our model incorporates all these ingredients: layered structure, where each layer is composed of modules, sparingly interacting with the bottleneck of attention, and allowing top down information flow. For more detailed description about the baselines, we refer the reader to section \ref{appendix:baseline_desc} in Appendix. \begin{table} \vs{3} \begin{center} \renewcommand{\arraystretch}{1.0} \resizebox{\columnwidth}{!}{ \scalebox{0.95}{\begin{tabular}{ ccccc } \hline \textit{Algorithm} & \textit{Properties} & \textit{19$\times$19} & \textit{24$\times$24} & \textit{32$\times$32} \\ \hline LSTM & --- & 54.4 & 44.0 & 32.2\\ LSTM & \textsc{h} & 57.0 & 46.8 & 33.2\\ LSTM & \textsc{h+b} & 56.5 & 52.2 & 42.1 \\ LSTM & \textsc{h+a} & 56.7 & 51.5 & 40.0 \\ LSTM & \textsc{h+a+b} & 59.9 & 54.6 & 43.0\\ \hline RMC & \textsc{a} & 49.9 & 44.3 & 31.3 \\ RIMs & \textsc{a+m} & 56.9 & 51.4 & 40.1 \\ \hline Hierarchical RIMs & \textsc{h+a+m} & 57.2 & 54.6 & 46.8 \\ MLD-RIMs & \textsc{h+a+m} & 56.8 & 53.1 & 44.5\\ BRIMs (ours) & \textsc{h+a+b+m} & \highlight{60.1} & \highlight{57.7} & \highlight{52.2} \\ \hline \end{tabular}} \vspace{-4mm} } \end{center} \caption{Performance on \textbf{Sequential CIFAR generalization:} Test Accuracy \% after 100 epochs. Both the proposed and the Baseline model (LSTM) were trained on 16x16 resolution but evaluated at different resolutions; results averaged over 3 different trials.} \label{table:cifar} \vspace{-4mm} \end{table} \subsection{Model Setup} We use a 2-layered setup with each layer consisting of a set of modules. The proposed architecture has 2 degrees of freedom: the number of modules in each layer and number of active modules in each layer. For the supervised loss, the final state of the recurrent model is passed through a feed-forward network before making a prediction. For RL experiments, the concatenation of the state of lower level modules as well as higher level modules is used to compute the policy. For video prediction experiments, the state of the lower level module is fed into the decoder, and used for generating the image. Unless otherwise indicated we always (a) learn an embedding for input tokens before feeding it to the RNNs, (b) use adam with a learning rate of 0.001 and momentum of 0.9. We include more experimental results in the supplementary material. \begin{figure} \centering {\includegraphics[width=0.75\linewidth]{images/Multiple_SSIM_89_final.png}} {\includegraphics[width=0.75\linewidth]{images/Multiple_MSE_89_final.png}} \caption{Comparison of BRIMs and SVG-LP \citep{denton2018stochastic} on Stochastic Moving MNIST, evaluated using (a) SSIM (higher is better) and (b) MSE (lower is better). Models are trained on digits 0-7 and tested with digits 8-9. The models are conditioned on 5 time steps, and trained for 10 more time steps. SSIM is calculated by rolling out the models into future time steps.} \label{fig:mnist} \vspace{-5mm} \end{figure} \subsection{Sequential MNIST and CIFAR} \vs{1} \label{sPixel} These tasks involve feeding a recurrent model the pixels of an image in a scan-line order and producing a classification label at the end of the sequence. To study the generalization capacity of different recurrent models, we train on sMNIST at a resolution of (14,14) and test on the resolutions (16,16), (19,19) and (24,24). Similarly, we perform training for sCIFAR at resolution (16,16) and testing on (19,19), (24,24) and (32,32). Because these images contain many distracting and uninformative regions, a model which is better able to ignore these patterns should generalize better to longer sequences. Additionally many details in these images are difficult to understand without having good top-down priors. These will be most salient when the specific character of these details changes as, for example, when we increase the resolution. See Tables~\ref{table:cifar},~\ref{table:mnist} for results and appendix section~\ref{appendix:mnist} for more details. \paragraph{Analysis of Top Down Attention.} We perform analysis on learned BRIMs models to demonstrate the nature of the learned bidirectional flow on sCIFAR task. We show that the model's reliance on top-down information increases when the bottom-up information is less reliable. Further, in general, the models query higher level top-down information only sparingly. We experimentally verified that almost every example attends to the higher level, yet only a small fraction of steps attend to the higher level on typical examples. Quantitatively, 95.1\% of images accessed the higher level at least five times (with a score $\geq$ 50\%), while on average only 2.86\% of the total attention (averaged over all modules) was to the higher level. This shows that the model uses top-down information consistently but sparsely. We also analysed the influence of top-down connections when there is noise in the data. We show that if we train normally but make some of the pixels random (uniformly random noise) at test time, then the model puts more of its attention on the higher level, as opposed to the input (Figure~\ref{fig:noise-cifar}). This is evidence that the model learns to rely more heavily on expectations and prior knowledge when the input sequence is less reliable. \begin{figure} \centering \includegraphics[width=0.9\linewidth,trim={0.5cm 0 0.5cm 2cm},clip]{figures/bouncing_balls_loss.png} \vspace{-4mm} \caption{We study the performance of the proposed model as compared to the LSTM as well as RIMs baseline. We feed the ground truth for the first 15 time steps, and then we ask the model to predict the next 35 time steps. During rollout phase, the proposed model performs better in terms of accurately predicting the dynamics of the balls for the 4Balls scenario, as well as for the more difficult occlusion scenario, as reflected by the lower BCE.} \label{fig:bouncing_balls_loss} \vspace{-4mm} \end{figure} \subsection{Adding Task} \vs{1} In the adding task we consider a stream of numbers as inputs (given as real-values) and then indicate which two numbers should be added together as two additional input streams which vary randomly between examples. The length of the input sequence during testing (2000) is longer than during training (1000). This is a simple test of the model's ability to ignore the distractor numbers. While we train on two number additions, we also test it on cases where more than two numbers are to be added. We provide the results in Table \ref{table:adding}. We also point the readers to appendix section~\ref{appendix:adding} for additional experiments and details regarding this setup. Here, our Random Prediction baseline, unlike the models, assumes knowledge of the number of digits to add. \vs{1} \subsection{Moving MNIST: Video Prediction} \vs{1} \label{movingMNIST} We use the Stochastic Moving MNIST (SM-MNIST) dataset introduced by \citet{denton2018stochastic} which consists of sequences of frames of size 64 x 64, containing one or two MNIST digits moving and bouncing off the edge of the frame (walls). Training sequences were generated on the fly by sampling two different MNIST digits from the training set (60k total digits). We trained the proposed model on SM-MNIST by conditioning on 5 frames and training the model to predict the next 10 frames in the sequence, and compared it to the SVG-LP model \citep{denton2018stochastic}. To test out-of-distribution generalization capability, we trained models on image sequences from the SM-MNIST dataset containing only digits 0-7, and tested them on sequences containing only digits 8 \& 9. We compared the Structural Similarity index (SSIM) and the Mean Squared Error (MSE) of the best generated sequences from the baseline SVG-LP model, and those from ours. We followed the same evaluation protocol as SVG, and the results in \hyperref[fig:mnist]{Figure~\ref{fig:mnist}} demonstrate that our proposed method performs consistently better. For details about the experimental setup, we refer the reader to section \ref{appendix:moving_appendix} in Appendix. \paragraph{Analysis of Top Down Attention.} We hypothesize that higher level encodes top-down beliefs (eg. location of digits) that drive the lower level to draw the digits for the next frame. To support this claim, we train a classifier to predict both the digits’ locations from the learned representation in 1 layered RIMs (82\% accuracy), higher layer of 2 layered LSTM (76\% accuracy), higher layer of BRIMs (88\% accuracy) and lower layer of BRIMs (58\% accuracy). This indicates that the information about the positions of the digits is stored in higher levels that could be useful for better modelling of the dynamics at a lower level especially when the digits overlap. \begin{table}[t!] \centering \renewcommand{\arraystretch}{1.0} \resizebox{\columnwidth}{!}{ \begin{tabular}{c|c|c|c} \toprule \textit{Number of Values} & \textit{Random Prediction} & \textit{LSTM} & \textit{BRIMs (ours)} \\ \midrule 2 & 0.500 & 0.0842 & \highlight{0.0000} \\ 3 & 1.000 & 0.4601 & \highlight{0.0999} \\ 4 & 1.333 & 1.352 & \highlight{0.4564} \\ 5 & 2.500 & 2.738 & \highlight{1.232} \\ 10 & \highlight{9.161} & 17.246 & 11.90 \\ \bottomrule \end{tabular} } \vs{3} \caption{Results on Adding task with training and testing on 1000 and 2000 sequence lengths respectively. Number of values to be added are varied from 2 to 10 during test time.} \label{table:adding} \vspace{-6mm} \end{table} \subsection{Handling Occlusion in Bouncing Balls} \label{bouncingballs} We study the ability of the proposed model to model physical reasoning capabilities, on the bouncing balls task, a standard environment for evaluating physical reasoning capabilities exhibiting complex non-linear physical dynamics. We train BRIMs on sequences of $64 \times 64$ binary images over 51 time-steps that contain four bouncing balls with different masses corresponding to their radii. The balls are initialized with random initial positions, masses and velocities. Balls bounce elastically against each other and the image window. We also test the proposed method in the scenario when an invisible ``curtain'' \citep{van2018relational} is present, which further tests the degree to which the model correctly understands the underlying dynamics of the scene. For vizualizations about the predictions from the proposed model, refer to section \ref{appendix:bouncing_balls} in Appendix. \paragraph{Analysis of Top Down Attention.} Achieving good performance on this task requires the model to track the ball from behind the curtain. We find that whenever the perceptual input is less reliable (i.e a ball is occluded) the perception is relied more by the information coming from higher level layers (higher top-down attention score). \subsection{Language Modelling} We consider word-level language modeling on the WikiText-103 dataset which has been used as a benchmark in previous work \citep{santoro2018relational}. Language has an organic hierarchical and recurrent structure which is both noisy and flexible, making it an interesting and apt task to study for the proposed model. Table~\ref{table:wiki} shows Validation and Test set perplexities for various models. We find that the proposed method improves over the standard LSTM as well as RMCs. \begin{table} \begin{center} \renewcommand{\arraystretch}{1.0} \begin{tabular}{cccc} \hline \textit{Algorithm} & \textit{Properties} & \textit{Valid} & \textit{Test} \\ \hline LSTM & --- & 38.2 & 41.8 \\ RMC* (ours) & \textsc{h} & 36.2 & 38.3 \\ Hierarchical RIMs & \textsc{h+a+m} & 36.1 & 38.1 \\ BRIMs (ours) & \textsc{h+a+b+m} & \highlight{35.5} & \highlight{36.8} \\ \hline \end{tabular} \end{center} \caption{Perplexities on the WikiText-103 dataset. $(*)$ refers to our implementation of the model. The actual results from RMC are even better as compared to the proposed model, but the idea here is not to beat well tuned state of the art methods.} \label{table:wiki} \vspace{-5mm} \end{table} \vspace{-4mm} \subsection{Reinforcement Learning} Top-down and bottom-up signals are clearly differentiated in the case of reinforcement learning (or in active agents, more generally) in that they lead to different optimal behavior. Since top-down signals change more slowly, they often suggest long-term and deliberative planning. On the other hand, bottom-up signals which are surprising can often require an immediate reaction. Thus, in selecting actions, points in which the top-down system dominates may benefit from activating a system with a long-term plan, whereas points where the bottom-up information dominates could benefit from a system which immediately takes action to resolve an unexpected threat. On the whole, we expect that dynamically modulating activation based on bottom-up and top-down signal importance will be especially important in reinforcement learning. Additionally, in reinforcement learning the data distribution implicitly changes as the policy evolves over the course of training, testing the model's ability to correctly handle distribution shift. To investigate this we use an RL agent trained using Proximal Policy Optimization (PPO) \citep{schulman2017proximal} with a recurrent network producing the policy. We employ an LSTM as well as RIMs architecture \citep{goyal2019recurrent} as baselines and compare results to the proposed architecture. This was a simple drop-in replacement and did not require changing any of the hyperparameters for PPO. We experimented on 10 Atari games (chosen alphabetically) and ran three independent trials for each game (reporting mean and standard deviation). We found that simply using BRIMs for the recurrent policy improves performance (\hyperref[table:atari]{Table~\ref{table:atari}}). We also found an improvement on Ms. Pacman, which requires careful planning and is not purely reactive. \begin{table}[t!] \large \renewcommand{\arraystretch}{1.2} \centering \resizebox{\columnwidth}{!}{ \begin{tabular}{c|rm{1em}l|rm{1em}l|rm{1em}l} \toprule \textit{Environment} & \multicolumn{3}{c}{\textit{LSTM}} & \multicolumn{3}{c}{\textit{RIMs}} & \multicolumn{3}{c}{\textit{BRIMs (ours)}}\\ \midrule Alien & 1612 &$\pm$& 44 & 2152 &$\pm$& 81 & \highlight{4102} &$\pm$& 400 \\ Amidar & 1000 &$\pm$& 58 & 1800 &$\pm$& 43 & \highlight{2454} &$\pm$& 100\\ Assault & 4000 &$\pm$& 213 & 5400 &$\pm$& 312 & \highlight{5700} &$\pm$& 320 \\ Asterix & 3090 &$\pm$& 420 & 21040 &$\pm$& 548 & \highlight{30700} &$\pm$& 3200\\ Asteroids & 1611 &$\pm$& 200 & \highlight{3801} &$\pm$& 89 & 2000 &$\pm$& 300\\ Atlantis & 3.28M &$\pm$& 0.20M & 3.5M &$\pm$& 0.12M & \highlight{3.9M} &$\pm$& 0.05M \\ BankHeist & 1153 &$\pm$& 23 & \highlight{1195} &$\pm$& 4 & 1155 &$\pm$& 20 \\ BattleZone & 21000 &$\pm$& 232 & 22000 &$\pm$& 324 & \highlight{25000} &$\pm$& 414 \\ BeamRider & 698 &$\pm$& 100 & \highlight{5320} &$\pm$& 300 & 4000 &$\pm$& 323\\ MsPacMan & 4598 &$\pm$& 100 & 3920 &$\pm$& 500 & \highlight{5900} &$\pm$& 1000 \\ \bottomrule \end{tabular} } \caption{Results on the Atari Reinforcement learning task using PPO with different recurrent policy networks.} \label{table:atari} \vspace{-4mm} \end{table} \section{Ablations and Analysis} We have demonstrated substantially improved results using BRIMs. However, it is essential to understand which aspects of the newly proposed model are important. To this end we conduct ablation studies to demonstrate the necessity of bidirectional structure, attention, modularity, and hierarchy. \vspace{-1mm} \paragraph{Role of Bidirectional Information Flow.} \label{td} We demonstrate that in different architectures, having top down information flow helps in generalization. Tables \ref{table:cifar},~\ref{table:mnist},~\ref{table:wiki} demonstrate the effectiveness of using top down connections in standard LSTMs, attention based LSTMs and hierarchical modules. We maintain that higher layers are able to filter out important information from lower layers and thus conditioning on it provides much more context as to what is relevant at any time in a sequence. However, the results still fall short of BRIMs, indicating that this component alone is not sufficient. \vspace{-1mm} \paragraph{Role of Attention.} Tables~\ref{table:cifar},~\ref{table:mnist},~\ref{table:wiki},~\ref{table:atari} and Figure~\ref{fig:mnist} show the importance of having attention, as Transformers, RMC, attention-modulated LSTMs, RIMs and BRIMs lead to much better performance and generalization in domains ranging from supervised learning to reinforcement learning than their non attention counterparts. This suggests that key-value attention mechanism is better able to extract out important information and dependency as opposed to standard connections. \vspace{-1mm} \paragraph{Role of Modularity.} Tables~\ref{table:cifar},~\ref{table:mnist},~\ref{table:wiki},~\ref{table:atari} indicate that having layers as a composition of smaller modules with their own independent dynamics outperform architectures without modular decomposition. In particular, we note that RIMs, their hierarchical variants and BRIMs perform much better than their LSTM counterparts. This shows that having independent dynamics for modules as well as a communication channel between them are important ingredients for generalization. \vspace{-1mm} \paragraph{Role of Hierarchy.} We consistently found that models with hierarchical structure perform much better than their shallow counterparts (Tables ~\ref{table:cifar},~\ref{table:mnist},~\ref{table:atari}). This relates to the discussion in Section \hyperref[td]{7.1} that higher layers are able to abstract and filter out important information and concepts learned in lower layers. \vspace{-2mm} \paragraph{Capacity of Network.} While BRIMs introduce additional parameters through the attention mechanisms, they are roughly cancelled out by the block diagonal structure in the independent module dynamics. As an example, our LSTM and BRIMs models for sCIFAR both contain $\sim$ 1.5M parameters. Our additional experiments on larger LSTMs showed a drop in performance (2-3\%) on sMNIST and sCIFAR. \section{Conclusion} Top-down and bottom-up information are both critical to robust and accurate perception. Exploring the combination of these signals in network architectures has an important history in deep learning, and has been a central question in cognitive science for several decades. Our work focuses on the idea that attention can be used to give models explicit dynamic and context dependent control over the combination of top-down and bottom-up signals. Our simulation experiments have shown a critical role for network modularity: ensuring that specific top-down signals combine with specific bottom-up signals. Using these insights we have proposed a new algorithm, \emph{Bidirectional Recurrent Independent Mechanisms (BRIMs)}, which achieves substantial improvements on sequence-length generalization tasks, language modeling, video generation, and reinforcement learning on Atari. A detailed ablation study gives evidence that combining top-down and bottom-up signals through attention is a critical component for the improved results. \section*{Acknowledgements} The authors acknowledge the important role played by their colleagues at Mila throughout the duration of this work. The authors would like to thank Sergey Levine and Nasim Rahaman for useful discussions. The authors would also like to thank Mark Pickett for feedback on the earlier version of the paper. The authors are grateful to NSERC, CIFAR, Google, Samsung, Nuance, IBM, Canada Research Chairs, Canada Graduate Scholarship Program, Nvidia for funding, and Compute Canada for computing resources.
\section*{General introduction} A mode of electromagnetic radiation, formally analogous to a harmonic oscillator, can be described in phase space by its quadratures. For most quantum states occurring in nature, such as vacuum, coherent or thermal states, the quadrature probability distributions have Gaussian shapes. Second-order nonlinear processes may ``squeeze'' their width below the vacuum level but they preserve their Gaussian character. Quantum optical states that lie outside the Gaussian domain --- the single-photon state being the simplest example --- are more challenging to handle but irreplaceable in any nontrivial quantum information processing and communication. The scope of non-Gaussian quantum optics --- and of the present review --- is defined not only by the set of states it covers, but also by their description. It treats each optical mode as an independent electromagnetic harmonic oscillator with an associated Hilbert space. The experimental state characterization method consistent with this approach involves homodyne detectors to measure the correlated quantum statistics of the (continuous) electromagnetic field quadratures in all the relevant modes \cite{Leonhardt1997}. This method of state description and characterization is referred to as continuous-variable (CV). In contrast, the discrete-variable (DV) approach is applied to optical states with a well-defined number of individually manipulated photons known \emph{a priori} to occupy a particular set of modes --- for example, a qubit encoded in the polarization of a single photon. In DV, the Hilbert spaces are associated with individual photons, and the states are defined by the modes which these photons occupy (see \textcite{Kok2007} for a review). Measuring such states experimentally involves detecting single photons in various individual modes. While the DV approach also addresses non-Gaussian states, it is touched by this review only insofar it is relevant to its main subject. The difference between the DV and CV approaches is related to that between first and second quantization in quantum physics and can be illustrated by the following example. A photon in the superposition of the horizontal ($H$) and vertical ($V$) polarization states (i.e., a $45^\circ$ polarized photon) would be represented as $(\ket H+\ket V)/\sqrt2$ in the DV language, and $(\ket 1_H\ket 0_V+\ket 0_H\ket 1_V)$ in CV. In other words, while in the DV treatment the photon is a quantum \emph{particle}, in CV it is a quantum \emph{state} of an electromagnetic oscillator \cite{Fabre2019}. Historically, the CV and DV approaches evolved in parallel, with their own sets of theoretical and experimental tools, and reached important milestones such as demonstration of entanglement [\textcite{Ou1992} for CV \emph{vs.} \textcite{Kwiat1995} for DV] and teleportation [\textcite{Bouwmeester1997} and \textcite{Boschi1998} for DV \emph{vs.} \textcite{Furusawa1998} for CV] around the same time. Until about the end of the 20th century, the CV approach was limited to Gaussian states, because such states are available ``on demand'' either directly from lasers (coherent states) and thermal sources (thermal states) or via parametric amplification in nonlinear optical crystals (single- and two-mode squeezed states). Today, despite the progress discussed in section \ref{section:Outlook}, deterministically preparing a given set of modes in a non-Gaussian state remains a challenge. In the present review, we will focus on the most common method for generating non-Gaussian states, which provided many significant results during the last 20 years: it is to start from an on-demand Gaussian state produced by nonlinear optics, and to use conditional measurements to bring it outside of the Gaussian domain, typically by photon counting. Combining non-Gaussianity with CV characterization methods adds a further layer of complexity, because the optical modes of these states must be very well defined and match that of the local oscillator used for homodyne detection. In counterpart, this guarantees that the states prepared by two different sources are pure and indistinguishable, so that they can be used as top-quality resources for quantum engineering. This approach was first implemented in \cite{Lvovsky2001}, where the single photons were produced and characterized using CV methods. Combining DV and CV toolboxes made non-Gaussian quantum optics arise as a research field reaching across the narrow boundaries of these two domains, giving us access to practically the entire optical Hilbert space and enabling capabilities that exceed the boundaries of each of these two domains taken separately. Unveiling these capabilities is one of the main goals of this review. While the field under review has many achievements, it is important to understand its limitations. In particular, conditioning cannot produce non-Gaussian light ``on demand". As a result, virtually all existing experiments on non-Gaussian state engineering resort to the ``crutch" of probabilistic conditional state preparation via non-Gaussian measurements on squeezed states. This limitation can be traced back to the harmonic oscillator nature of light. Its equidistant energy structure implies that any attempt to move the oscillator out of the ground state will necessarily populate not only the first excited level (the single-photon state) but also higher levels, leading to the Gaussian character of the resulting excitation. Possible ways to shun this trap in the optical domain are either operating in a highly nonlinear medium in which the light wave would lose its harmonic characteristic, or coupling the light to a non-harmonic physical system. A few platforms on which this can be achieved are discussed in the last section of this manuscript. This work is not the first review of non-Gaussian quantum optics. The article by \textcite{Zavatta2005} summarized the first results in the field: tomography of the single-photon Fock state and photon added states, as well as technology of the state preparation and homodyne detection. A subsequent development of experiments on ``Schr\"odinger's cats'' (superpositions of opposite-amplitudes coherent states) has triggered a study on this subject by \textcite{Glancy2008}. A detailed review by \textcite{Lvovsky2009} paid significant attention to state reconstruction algorithms and surveyed further experimental developments, in particular single-rail optical qubits and ``cat'' states. A more recent, albeit brief, progress article \cite{Andersen2015} summarized the progress of hybrid CV-DV quantum technology not only in optics, but also in superconducting circuits. In addition, we would like to mention a few review articles that are tangentially related to our field of interest. \textcite{Kurizki2015} survey the rapidly developing research on technology of interfacing among physical systems of different nature, which often requires hybridization of the CV and DV approaches. The paper by \textcite{Pirandola2015} covers recent advances in quantum teleportation, again in both the discrete and continuous bases. The theory, technology and application of squeezed light is surveyed in \cite{Lvovsky2015} and \textcite{Andersen2016}, the latter of which concentrating more on the historic aspect of this phenomenon, and the former being more pedagogical. Additional educational resources that might be useful to newcomers to the field is the book by \textcite{Lvovsky2008}, which covers DV quantum optics, presents detailed analysis of the harmonic oscillator, squeezing and the Heisenberg picture, and the book by \textcite{Leonhardt1997}, detailing the basics of quantum optics with the emphasis on phase-space representation of states, and homodyne tomography. This article is organized into two main parts. The first part is entitled ``Methods \& techniques", and introduces the theoretical and experimental tools which are generic to this domain of research (sections I to V). The second part is entitled ``Results and analysis", and describes more specific experiments, which either have been realized, or are still open challenges (sections VI to VIII). Sections IX and X describe respectively applications to quantum communications and quantum computing, and section XI concludes with some future perspectives. \part{Methods \& techniques} \label{part.methods} \section{Continuous variables and quasi-probabilities functions.} In classical mechanics it is always possible, in principle, to access complete information on a system. In particular, its statistical properties can be described by introducing a joint distribution for the position $x$ and the momentum $p$ in the phase-space picture. In an analogous way, in classical optics the field can be described by the statistics of the complex amplitude $\alpha$; in particular, the expectation value for all the physical quantities can be calculated by knowing the joint probability distribution $P(x,p,t)$ for the real and the imaginary components of $\sqrt{2}\, \alpha = x + i p$, named quadratures, at a given time $t$. The function $P(x,p,t)$ provides the joint probability of finding $x$ and $p$ in a simultaneous measurement. In quantum mechanics, on the contrary, proper probability densities in phase-space cannot be defined since the Heisenberg uncertainty principle forbids the simultaneous knowledge of two canonical variables with infinite precision. However, it is still possible to define particular functions in phase-space, named quasi-probability distributions, useful to calculate averages of physical quantities \citep{Gardiner2000,Leonhardt1997}. In contrast to their classical counterparts, and may become negative or highly singular. In the quantum description the quadratures correspond to the position and momentum operators of the harmonic oscillator which describes the field in a well defined mode. They can be expressed by the following combinations of the bosonic ladder operators $\hat{a}$ and $\hat{a}^{\dag}$ \begin{equation}\label{quad1}\begin{cases}\hat{x}=\frac{1}{\sqrt{2}}(\hat{a}^{\dag}+\hat{a}); \\ \hat{p}=\frac{i}{\sqrt{2}}(\hat{a}^{\dag}-\hat{a}), \end{cases} \end{equation} which obey the commutation rule $[\hat{x},\hat{p}]=i$. More generally the phase-dependent quadrature is defined as \begin{equation}\label{phasequad} \hat{x}_{\theta}=\hat{x}\cos(\theta)+\hat{p}\sin(\theta)=\frac{1}{\sqrt{2}}(\hat{a}^{\dagger} e^{i \theta}+\hat{a}e^{-i \theta}), \end{equation} where $\theta=0$ ($\pi/2$) gives $\hat{x}$ ($\hat{p}$). Any couple of two orthogonal quadratures ($\hat{x}_{\theta}$ and $\hat{x}_{\theta+\pi/2}$ for any $\theta$) can be chosen as the two axes which define the phase-space coordinates. The most famous quasi-probability distributions, the Wigner, the P- and the Q-function, can be classified according to the type of expectation values that are suitable to calculate. The P-function diagonalizes the density operator in terms of coherent states: \begin{equation}\label{pfunc} \hat{\rho}= \int P(\alpha) \; |\alpha \rangle\langle \alpha |\; \dd^{2}\alpha. \end{equation} It corresponds to the normally ordered averaging, which means that the mean values of expressions with powers of $\hat{a}^{\dag}$ operator on left can be calculated in a classical-like manner by: \begin{equation} {\rm \, Tr }\, \{\hat{\rho}\; \hat{a}^{\dag \mu}\hat{a}^{\nu} \}= \int_{-\infty}^{\infty}\int_{-\infty}^{\infty}P(\alpha)\; \alpha^{ \ast \mu} \alpha^{\nu} \; \dd^{2} \alpha. \end{equation} The P-function has a central role in the theory of photodetection \citep{Glauber1963}. The Q-function, defined as $Q(\alpha)= \frac{1}{2\pi}\langle \alpha |\hat{\rho}| \alpha \rangle$, is useful to express anti-normally ordered expectation values \begin{equation} Tr\{\hat{\rho}\; \hat{a}^{\nu}\hat{a}^{\dag \mu} \}= \int_{-\infty}^{\infty}\int_{-\infty}^{\infty}Q(\alpha) \; \alpha^{\nu}\alpha^{ \ast \mu } \; \dd^{2} \alpha. \end{equation} The distribution which will be extensively used in this manuscript is the Wigner function: introduced in 1932 \citep{Wigner1932}, it corresponds to the symmetric order averaging. A symmetric ordered expression is one in which every possible ordering is equally weighted, for example $S\{\hat{a}^{2}\hat{a}^{\dag}\}= 1/3(\hat{a}^{\dag}\hat{a}^{2}+\hat{a}^{2}\hat{a}^{\dag} +\hat{a}\hat{a}^{\dag}\hat{a})$. Note that an expression that is symmetric in $\hat{a}$ and $\hat{a}^{\dag}$ is also symmetric in position $\hat{x}$ and momentum $\hat{p}$. The mean value of this kind of expressions is given by \begin{equation} {\rm \, Tr }\, \{\hat{\rho} \; S\{\hat{a}^{\dag \mu}\hat{a}^{\nu}\}\}= \int_{-\infty}^{\infty}\int_{-\infty}^{\infty}W(\alpha) \; \alpha^{ \ast \mu} \alpha^{\nu} \; \dd^{2} \alpha \end{equation} The Wigner function of a state can be expressed through its density matrix according to \begin{equation}\label{wigner}W(x,p)=\frac{1}{2\pi}\int^{+\infty}_{-\infty}\exp[i p x']\langle x-\dfrac{x'}{2}| \; \hat{\rho} \; |x+\dfrac{x'}{2}\rangle \dd x', \end{equation} where, again, $x=\sqrt 2\,{\rm Re}\alpha$ and $p=\sqrt 2\,{\rm Im}\alpha$. The main property of the Wigner function is that its marginal distributions correspond to the probability distributions of quadratures $ \langle x_{\theta} \vert \hat{\rho} \vert x_{\theta} \rangle = {\rm pr}_{\theta}(x_{\theta})$: \begin{eqnarray} \label{ptheta} && {\rm pr}_{\theta}(x_{\theta}) = \\ &&\int^{+\infty}_{-\infty} W(x_{\theta}\cos(\theta)-p_{\theta} \sin(\theta),x_{\theta} \sin(\theta)+p_{\theta} \cos(\theta)) \; \dd p_{\theta} \nonumber \end{eqnarray} This gives the possibility of reconstructing the Wigner function of the experimental states by tomographic techniques applied to a complete set of quadrature measurements \cite{Leonhardt1997,Lvovsky2009}. As the Wigner function has a univocal correspondence with the density operator of the state, it is therefore possible to get a complete information on the quantum state by measuring the quadrature observables. Since the quasi-probability distributions are used to calculate quantum averages in a classical-like way, any deviation from the behavior of a classical joint probability distribution is considered as a signature of the non-classical properties of the corresponding quantum state. In particular, for a state with a non-negative P-function, the density operator \eqref{pfunc} can be viewed as a statistical mixture of coherent states, which are considered the most closely related to the classical behavior of an electromagnetic wave. In contrast, states with an irregular or negative P-function are considered non-classical. It is the general definition of non-classicality \citep{Glauber1963} widely accepted in the quantum optics community. Unfortunately a direct test of non-classicality by reconstructing the P-function generated state is not always possible because it often exists only in the form of a generalized function and cannot be connected with any measurable quantity, unless a regularized version of the function is used \citep{Kiesel2010}. The Wigner function of a state is a convolution of its P-function with the Gaussian Wigner function of the vacuum state. Hence a negativity in the Wigner function implies that the P-function is also not non-negative definite, and is hence as sufficient witness of a state's non-classicality. Because the Wigner function can always be reconstructed from quadrature measurements, is a more convenient criterion, although there do exist states that are non-classical, yet have non-negative Wigner functions, such as the squeezed states. A pure state has a positive Wigner function if and only if it is Gaussian \citep{Hudson1974}. For mixed states, however, one cannot affirm in general that a non-Gaussian state exhibits a negative Wigner function. There have been several attempts to extend the Hudson theorem or to find equivalent criteria in the more general case of mixed states \citep{Mandilara2009,Genoni2013}. It must be added that, in addition to non-classicality criteria based on phase-space description, there exist other criteria, arising, for example, from quantum information theory \citep{Ferraro2012}. \section{Measurement-induced non-Gaussian state generation } \label{NonGauss} \subsection{Principle} \label{NonGauss:Principle} An important class of transformations in quantum optics, is called \emph{linear unitary Bogoliubov operations (LUBO)}. In the Heisenberg picture, LUBO $M$ applied to a multimode quadrature vector $\vec{R}=[x_1,p_1,...,x_N,p_N]^T$, transforms it into $M\vec R$, or, equivalently, transforms the Wigner function $W(\vec{R})$ of the initial state into $W(M^{-1}\vec{R})$. Any arbitrary LUBO can be implemented by combining the following standard experimental tools. \begin{itemize} \item{Beam splitter (BS)} transformations \begin{equation} \label{EqUnitBS} \hat{B}_{ij}{(\tau)} =\exp\left[\tau\left(\hat{a}_i\hat{a}_j^\dag-\hat{a}_i^\dag\hat{a}_j\right)\right] \end{equation} mix the annihilation operators $\a_i$ and $\a_j$ of two modes $i$ and $j$ according to \begin{equation} \label{EqAAdagBS} \left[\begin{array}{c}\a_i\\\a_j\end{array}\right] \rightarrow \left[\begin{array}{cc}\cos(\tau)&\sin(\tau)\\-\sin(\tau)&\cos(\tau)\end{array}\right] \left[\begin{array}{c}\a_i\\a_j\end{array}\right] \end{equation} where $t=\cos\tau$ and $r=\sin\tau$ are the BS's amplidude transmission and reflection coefficients. In this review, we shall also use $T=t^2$ and $R=r^2$ for the intensity transmission and reflection coefficients of the BS, respectively. \item{Squeezing} transformations \begin{equation} \label{EqUnitOPA} \hat{S}_{ij}{(r)}=\exp\left[ \frac{r}{1+\delta_{ij}}\left(\hat{a}_i^\dag\hat{a}_j^\dag-\hat{a}_i\hat{a}_j\right)\right], \end{equation} usually implemented using optical parametric amplifiers (OPAs), result in the linear combination \begin{equation} \label{EqAAdagOPA} \left[\begin{array}{c}\a_i\\\a_j^\dag\end{array}\right] \rightarrow \left[\begin{array}{cc}\cosh(r)&\sinh(r)\\\sinh(r)&\cosh(r)\end{array}\right] \left[\begin{array}{c}\a_i\\a_j^\dag\end{array}\right] \end{equation} where $G=\cosh^2(r)$ is the amplifier's gain. Here the case $\delta_{i\neq j}=0$ corresponds to two-mode squeezing, and $\delta_{i=j}=1$ to single-mode squeezing. \end{itemize} For instance, using coherent states as a resource, one can prepare any Gaussian state, with a Wigner function \begin{equation} \label{EqWigGauss} W\left(\vec{R}\right)=\frac{\exp\left[-(\vec{R}-\vec{\mu})^T K^{-1} (\vec{R}-\vec{\mu})\right]}{\pi^N|K|} \end{equation} completely determined by the mean value $\vec{\mu}=\expect{\vec{R}}$ and the covariance matrix $K=\expect{(\vec{R}-\vec{\mu})(\vec{R}-\vec{\mu})^T}$ \citep{Olivares2012}. Importantly, the equation above shows that if the initial state is Gaussian, after any LUBO the final state will be Gaussian as well. Making it non-Gaussian requires a non-linear transformation on the quadrature operators, such as one effected by a third-order optical non-linearity. Unfortunately, in standard optical materials, not only such non-linearities are too weak to be used in practice, but they have been shown to be useless in theory \cite{Shapiro2006,Gea-Banacloche2010}. Getting around these no-go theorems requires highly non-linear systems with mode-selectivity and dynamical control. Their realization, while not impossible (see section \ref{section:Outlook}), remains very challenging. This problem can be circumvented by using LUBOs to entangle Gaussian states with each other and performing \textit{measurements} on some of the output modes. Then, conditioned on certain results of these measurements, other output modes may collapse onto non-Gaussian states. Such a ``conditional measurement" technique typically involves photon detectors because of their inherent non-Gaussian nature and is capable to effectively \emph{simulate} a non-linear optical transformation \cite{Lapaire2003}. The price to pay is that the evolution is no longer deterministic: the operation succeeds only when the measurement produces the desired outcome. Non-Gaussian state engineering by means of conditional measurements is impossible if all of the initial states are classical, i.e. are characterized by positive definite P-functions. Indeed, such a state can be expressed as a mixture of coherent states (or their products) as per Eq.~(\ref{pfunc}). The BS operation (\ref{EqAAdagBS}) transforms a product of coherent states into a product of coherent states \cite{Sanders2012} and is hence incapable of producing entanglement from a classical input. The state prepared by any partial measurement on the BS output will therefore remain a classical mixture of coherent states. Hence at least one of the initial states must be nonclassical. The states that are most commonly used in this context are the single- and two-mode squeezed vacua, which we study next. \subsection{Squeezing via parametric fluorescence} \begin{figure}[tb] \includegraphics[width=0.8\columnwidth]{PDC} \caption{Optical parametric amplifier. Degenerate (a) and non-degenerate (b) configurations, leading to single- and two-mode squeezed vacuum states, respectively.\label{PDCFig}} \end{figure} One of the primary methods of producing squeezing is spontaneous parametric down-conversion (SPDC), also known as optical parametric amplification: a nonlinear process where the annihilation of a high frequency pump photon in a nonlinear crystal leads to the simultaneous creation of two lower-frequency photons, known as ``signal'' and ``idler''. The frequencies, wavevectors and polarizations of the generated photons are governed by phase-matching conditions. If the phase-matching configuration is such that the two generated photons are indistinguishable, SPDC is \emph{degenerate} and gives rise to single-mode squeezing [Fig.~\ref{PDCFig}(a)]. \emph{Non-degenerate} SPDC, on the other hand, leads to entanglement in the form of the two-mode squeezed vacuum also known as twin-beam state or the Einstein-Podolsky-Rosen (EPR) state [Fig.~\ref{PDCFig}(b)]. The Heisenberg picture evolution (\ref{EqUnitOPA}) allows us to find the expression for both types of squeezed vacuum in the Fock basis in the Schr\"odinger picture \citep{Walls2008,Lvovsky2015,Lvovsky2008}: \begin{align} \label{EqStateSqz} \ket{\psi_{\rm sqz}[r]}&=\hat S{(r)}\ket0\\ \nonumber&=\frac{1}{\sqrt{\cosh(r)}}\sum_{k=0}^\infty \sqrt{\left(\begin{array}{c}2k\\k\end{array}\right)}\left[-\frac{\tanh(r)}{2}\right]^k\ket{2k} \end{align} for single-mode squeezing and \begin{equation} \label{EqStateEPR} \ket{\psi_{\rm EPR}}=\hat S_{12}{(r)}\ket{0,0}=\frac{1}{\cosh(r)}\sum_{k=0}^\infty \tanh^k(r)\ket{k,k}, \end{equation} for the EPR state. The entanglement $E$ of this pure state, determined by the Von Neumann entropy of the reduced density matrix for each of the modes \begin{equation} \hat{\rho}_1=\hat{\rho}_2=\frac{1}{\cosh^2(r)}\sum_{k=0}^\infty \tanh^{2k}(r)\proj{k}, \end{equation} increases with the parametric gain $G=\cosh^2(r)$ as \begin{equation} \label{EqEntEPR} E=-\mathrm{Tr}\left(\hat{\rho_1}\log({\rho_1})\right)=G\log(G)-(G-1)\log(G-1) \end{equation} In the quadrature picture, the squeezed states are best visualized in terms of their Wigner functions: \begin{equation} \label{EqWigSqz} W_{\rm sqz}=\frac{1}{\pi}\exp\left[-\mathrm{e}^{2r}x^2-\mathrm{e}^{-2r}p^2\right],\\ \end{equation} \begin{align} \label{EqWigEPR} W_{\rm EPR}=\frac{1}{\pi^2}\exp&\left\{-\mathrm{e}^{2r}[(x_1+x_2)^2+(p_1-p_2)^2]\right.\\ &\left.-\mathrm{e}^{-2r}[(x_1-x_2)^2+(p_1+p_2)^2]\right\}.\nonumber \end{align} A single-mode vacuum state is squeezed by a factor $\mathrm{e}^{-2r}$ in variance along the $x$ quadrature and antisqueezed by $\mathrm{e}^{2r}$ along $p$ if $r$ is positive. For the EPR state, quantum fluctuations of the position difference $(x_1-x_2)/\sqrt{2}$ and of the momentum sum $(p_1+p_2)/\sqrt{2}$ become reduced below the vacuum level by a factor $\mathrm{e}^{2r}$ in variance, if $r$ is negative. The EPR state and two orthogonally squeezed single-mode vacuum states produced by degenerate OPAs can be interconverted into one another by mixing on a symmetric BS. This is a common method for producing the EPR state, starting with \cite{Furusawa1998}. In practice, it can be implemented by two degenerate OPAs, which produce squeezing in orthogonal polarizations, placed in sequence; then the EPR state will be generated in the $\pm45^\circ$ polarization modes \cite{Chen2014,Fedorov2017}. Such a configuration ensures phase stability of the two single-mode squeezed states which is essential for high-quality two-mode squeezing. Both for single- and two-mode squeezing, we can distinguish two regimes. In the low-gain regime ($r,G\ll 1$), the probability to generate a pair is small, so each subsequent term in Eqs.~(\ref{EqStateSqz}) and (\ref{EqStateEPR}) is much lower in amplitude than the previous one. This regime is appropriate, for example, for heralded single-photon production: the detection of a photon in the idler mode of the EPR state heralds a single-photon state in the signal mode. Because the probability of multi-pair events is very low, to herald a state with a high fidelity it is unnecessary to use photon-number-discriminating detectors (see section \ref{NonGauss:PhotonCount}). The high-gain regime, on the other hand, is required to achieve significant quadrature squeezing. In the limit $r,G\to \infty$, the squeezing is infinite, so the twin-beam state will approach the state described in the original EPR Gedankenexperiment \cite{Einstein1935}: by choosing to measure either the position or momentum in the idler mode, once can remotely prepare a state with either a certain position or a certain momentum in the signal mode, thereby violating local realism. Since their first experimental observation by \textcite{Slusher1985}, squeezed states found many applications for quantum information processing where, for example, they enabled the first demonstration of quantum teleportation for quadrature observables \citep{Furusawa1998}, or for precision measurements where they are currently used in gravitational-wave detectors to improve their sensitivity beyond the vacuum-noise limit \citep{LIGO2019,VIRGO2019}. A high squeezing is desirable in most cases, as it enhances the non-classical features of these states and hence the performance of the protocols where they are used. Much progress has been made in this direction, by developing materials with stronger non-linearities and by increasing the available peak powers. A detailed review to this effect can be found in \cite{Lvovsky2015,Andersen2016}. The highest squeezing levels have so far been observed using OPAs in the continuous-wave (cw) regime: 15 dB for single-mode squeezing \citep{Vahlbruch2015}; 8.3--8.4 dB for two-mode squeezing\cite{Zhou2015,Feng2018}. Optical powers available in this regime are too low to obtain significant parametric gains in a single pass through a non-linear crystal. Therefore, the crystals are usually placed inside resonant optical cavities, forming optical parametric oscillators (OPOs). The cavity defines a well-controlled spatial mode for the prepared state and reduces its bandwidth to a few MHz. As a result, the temporal profiles of the prepared states are long enough to be resolved by detection electronics which offers an extra degree of freedom for their manipulation. An alternative approach is to use ultrashort pulses with high peak powers \citep{Slusher1987} which nowadays allow one to observe squeezing levels of $\sim 6$ dB with a single pass through a non-linear crystal \citep{Kim1994} or through an optical fiber \citep{Dong2008}. In this case the optical power enhancement is obtained not at the crystal's but at the laser's level: compared to mode-locked lasers used to generate parametric photon pairs, lasers used in squeezing experiments often operate with pulse pickers, cavity dumpers \citep{Wenger2004b} or amplifiers \citep{Dantan2007}. Pulsed lasers provide an intrinsic timing source for the photon detection, but as the ultrashort pump pulses are very sensitive to optical dispersion, the control of spatial and temporal modes is more involved than in cw experiments. In some applications, the amount of squeezing is the only quantity of interest, and the antisqueezing of the orthogonal quadrature plays no role. In the experiments considered here the situation is quite different. While stronger squeezing can indeed help preparing more complex non-Gaussian states or increasing the preparation success rate, the antisqueezing of the orthogonal quadrature must be kept at the minimum allowed by the Heisenberg uncertainty principle $\Delta X\Delta P\geq 1/2$, otherwise the squeezed state becomes impure and, as a consequence, the measurements preparing the non-Gaussian state become unreliable. Unfortunately, excess noise becomes more important as the gain of the amplifier increases. It is a known problem which limits the maximal squeezing level measurable in a given setup \citep{Dong2008}, but even before this level is reached the excess noise makes the squeezed states impossible to use as a resource for non-Gaussian state generation. The purity of the measured state is also degraded if it becomes multimode, or if its mode becomes different from the one defined by the local oscillator used for the homodyne measurement. In practical experimental situations, especially in the pulsed regime, this may occur for many reasons, e.g.: gain-induced diffraction of the parametric photons \citep{Kim1994b,Anderson1995}, group velocity dispersion \citep{Raymer1991}, spatial walk-off or group velocity mismatch between the pump pulse and the downconverted light, thermal or photorefractive effects \citep{Goda2005}. As a result, if the mode of interest is defined by a fixed, independently prepared local oscillator, the squeezing measured in pulsed systems usually do not exceed $3$ dB \citep{Wenger2005,Gerrits2010}. To measure higher squeezing levels the measured mode must be properly modified by shaping the local oscillator \citep{Kim1994,Eto2008}. Unfortunately, to transform these squeezed states into non-Gaussian states, the modes measured by photon counters should be shaped accordingly, which is difficult to do in practice (see Sec.~\ref{condSPDC}). Therefore, a lot of efforts are focused on preparing very pure Gaussian resource states and controlling their spatial, spectral and temporal properties \citep{Banaszek2001,Wasilewski2006,URen2006,Hendrych2007,Garay-Palmett2007,Eckstein2011,Branczyk2011,Edamatsu2011,Cui2012}. \subsection{Photon counting projective measurements} \label{NonGauss:PhotonCount} Photon detection is certainly the simplest non-Gaussian measurement in quantum optics. Formally, an ideal photon counter (able to determine the exact number of photons) destructively projects the measured mode $i$ on a non-Gaussian $n$-photon Fock state $\ket{n}_i$. In order to do this in practice, however, the detector must be photon-number-resolving, highly efficient, and present a low probability of false positive detections (dark count rate). Different practical implementations of such devices are described in a review paper by \textcite{Hadfield2009}. To date, most experiments have been performed with commercial semiconductor avalanche photodiodes (APD) operating in the Geiger mode: the absorption of one or several photons starts a quenched electronic cascade leading to a detectable, macroscopic electronic signal. These devices cannot resolve the number of photons but only detect their presence or absence. The efficiency of commercially-available models can reach $80\%$. In recent years, a new generation of detectors became broadly available. The primary element in such a detector is a metal wire cooled down to a superconducting state. When a photon is absorbed, it heats a region of this wire, lifting superconductivity and giving rise to measurable resistance. Such devices can reach efficiencies up to $98\%$ \citep{Lita2008} and discriminate the number of incident photons up to $\sim 29$ \citep{Lolli2012}. \medskip Photon detection can be used to implement two essential operators in quantum optics: photon subtraction and photon addition. The photon subtraction operator $\a$ can be approximately realized by reflecting a very small fraction of a beam towards a photon detector [Fig.~\ref{FigAlexei:PrincipePhotSubtractAdd}(a)]. Indeed, by applying the BS transformation (\ref{EqUnitBS}) to the input modes in state $\ket\psi$ and $\ket 0$, we find \begin{equation}\label{BSsub} \hat B{(\tau)}\ket\psi\ket0=\ket\psi\ket0+\tau\hat a\ket\psi\ket 1+O(\tau^2). \end{equation} A detection event in the second input mode heralds the subtraction of at least one photon from the beam, and, if the BS's reflectivity is sufficiently low ($\tau\approx \sqrt R \ll1$), the probability to subtract more than one photon becomes negligible. In practice, to keep a sufficient photon detection rate, the reflected fraction must be finite, which mixes the prepared state with the vacuum mode entering through the other input port of the BS, and degrades its non-Gaussian structure. An ideal photon subtraction from the mode $k$ transforms the density matrix $\hat{\rho}$ into \begin{equation} \label{EqRhoPhotSubtract} \hat{\rho}'=\frac{\a_k \; \hat{\rho} \; \a_k^\dag}{\mathrm{Tr}(\a_k\; \hat{\rho} \; \a_k^\dag)}. \end{equation} For a single-mode state, its expression in the Fock basis \begin{equation} \hat{\rho}'=\frac{\sum_{m,n=1}^\infty \rho_{m,n}\sqrt{mn}\ket{m-1}\bra{n-1}}{\sum_{n=1}^\infty \rho_{n,n}n} \end{equation} easily allows one to calculate the average number of photons $\bar{n}'$ remaining after subtraction, related to their average number $\bar{n}$ in the initial state by $\bar{n}'=\bar{n}-1+F$ where the Fano factor $F\equiv\langle(n-\bar{n})^{2}\rangle /\bar{n}$ is equal to, greater or lower than 1 for a state with Poissonian, super-Poissonian or sub-Poissonian statistics respectively. Therefore, although a photon was removed from the initial state, $\bar{n}'$ is not necessarily smaller than $\bar{n}$: for Poissonian states it remains identical, and for super-Poissonian states it is actually larger. An interesting feature of the photon-subtraction operation implemented in this way is that the mode detected by the photon detector (we will denote its annihilation operator as $\hat b$) does not necessarily have to match the signal mode $\hat a$. Indeed, we can decompose $\hat b=\alpha\hat a+\beta\hat a_\perp$, where $\hat a_\perp$ is a mode that is orthogonal to $\hat a$, and is in the vacuum state. We then find $$\hat b\ket\psi_{\hat a}\ket 0_{\hat a_\perp} =\alpha(\hat a\ket\psi_{\hat a})\ket 0_{\hat a_\perp} +\beta \psi_{\hat a}(\hat a_\perp\ket 0_{\hat a_\perp}).$$ The second term in the above equality is zero, so any mismatch between the modes $\hat a$ and $\hat b$ manifests itself only in the probability of the photon detection event. While mathematically simple, this observation may appear intriguing, as the following example shows. Suppose a cloud of weakly absorbing atoms, initially in the ground state, is placed into a pulsed mode $\hat a$ in such way that they are occupying only a part of that mode's geometric cross-section. If these atoms are observed to spontaneously emit a photon after the end of the pulse, this means that the photon has been removed from the optical mode. While one would expect the photon subtraction to have affected only the part of mode $\hat a$'s cross-section where the atoms are located (mode $\hat b$), in fact it affects the entire mode $\hat a$. This effect was named ``quantum vampire" in reference to the folkloric property of vampires to cast no shadow. It was observed in application to Fock \cite{Fedorov2015b} and thermal \cite{Katamadze2018} states. \begin{figure}[tb] \begin{center} \includegraphics[width=6.5cm]{fig1} \end{center} \caption{(Color online) Heralded subtraction and addition of a photon. (a) Heralded subtraction of a photon from the state $\ket{\psi}$, by reflection a small fraction $R\ll1$ of the beam towards a single photon counting module (SPCM). (b) Heralded addition of a single photon, by sending the state $\ket{\psi}$ through a low-gain non-degenerate OPA and detecting a photon in the idler mode.} \label{FigAlexei:PrincipePhotSubtractAdd} \end{figure} \begin{figure}[tb] \begin{center} \includegraphics[width=\columnwidth]{AddSub2mode} \end{center} \caption{(Color online) Non-local photon subtraction (a) and addition (b). The heralding modes of the subtraction and addition operations (Fig.~\ref{FigAlexei:PrincipePhotSubtractAdd}) applied to modes 1 and 2 interfere with a phase $\phi$ on a BS with a reflectivity $R=r^2=1-t^2$. Detecting a photon in one of the output ports corresponds to applying the operator $r\a_1+t\mathrm{e}^{i\phi}\a_2$ (a) or $r\a_1^\dag+t\mathrm{e}^{i\phi}\a_2^\dag$ (b) to the incoming 2-mode state.} \label{fig:AddSub2mode} \end{figure} Recently an alternative method based on up-conversion process for implementing single-photon subtraction \cite{Averchenko2014} has been experimentally demonstrated \cite{Ra2020}. The signal field and a strong coherent gate field interact in a non-linear crystal, and when a photon at the sum-frequency of the two impinging beams is detected, a single photon has been conditionally subtracted from the signal field. Compared to the use of a weakly-reflective beamsplitter, this approach offers, via the shaping of the gate beam, the control over the subtracted photon's mode and also allows for subtraction from a coherent superposition of modes. Photon addition $\a^\dag$ can be approximated in a similar way by replacing the BS with a low-gain non-degenerate OPA [Fig.~\ref{FigAlexei:PrincipePhotSubtractAdd}(b)]. We can see this from Eq.~(\ref{EqUnitOPA}), applied, again, to the input modes in states $\ket\psi$ and $\ket 0$: \begin{equation}\label{BSsub} \hat S_{12}{(r)}\ket\psi\ket0=\ket\psi\ket0+r\hat a^\dag\ket\psi\ket 1+O(\tau^2). \end{equation} The higher-order terms can be neglected for $r^2\approx G-1\ll1$. Detecting a photon in the idler mode heralds the creation of an additional photon in the signal beam, and, if the gain is low enough, the creation of several photons is unlikely. Adding a single photon transforms a density matrix $\hat{\rho}$ into \begin{equation} \label{EqRhoPhotAdd} \hat{\rho}'=\frac{\a_k^\dag \; \hat{\rho} \; \a_k}{\mathrm{Tr}(\a_k^\dag\; \hat{\rho} \; \a_k)}. \end{equation} For a single-mode state, this can be written in the Fock basis as \begin{equation} \label{add} \hat{\rho}'=\frac{\sum_{m,n=1}^\infty \rho_{m-1,n-1}\sqrt{mn}\ket{m}\bra{n}}{\sum_{n=1}^\infty \rho_{n-1,n-1}n}: \end{equation} the mean photon number $\bar{n}'=\bar{n}+1+F$ increases by at least 1, and the vacuum term vanishes. As shown by \cite{Lee1995} such a state is necessarily nonclassical. In reality, however, the finite OPA gain required for a sufficient success rate mixes the state with the amplified vacuum mode entering through the other port of the OPA. Successfully performing addition and subtraction operations in the desired modes requires good understanding of the spatial and temporal modes of the resource states and of the modes selected by the detectors \cite{Aichele2002,Rohde2007,Sasaki2006,Tualle-Brouri2009}. Experimentally, selecting the desired modes is a non-trivial task which usually requires narrow filtering of the light reaching the photon counters and, on the homodyne detection side, an optimization of the local oscillator's mode (see Sec.~\ref{condSPDC}). \begin{figure}[tb] \begin{center} \includegraphics[width=\columnwidth]{AddSubGen} \end{center} \caption{(Color online) Injecting a weak coherent state in the second input port of the BS used for photon subtraction (a) or the OPA used for photon addition (b) implements, respectively, the superpositions of the photon subtraction or addition operators with the identity operator.} \label{fig:AddSubGen} \end{figure} These two elementary ``building blocks'' can be combined to implement more complex operations using the following important idea. Realization of both operators $\hat a $ and $\hat a^\dag$ is heralded by photon detection in an ancillary mode. If one combines these ancillary modes from two sources on a BS, and performs photon detection in one of its outputs [e.g. as shown in Fig.~\ref{fig:AddSub2mode}], the detector ``will not know" which of the two sources the photon came from. As a result, the detection event will herald a \emph{superposition} of the processes associated with the photon detection in each of the individual modes --- the photon subtraction operators in modes 1 and 2 in the case of Fig.~\ref{fig:AddSub2mode}(a) or addition for Fig.~\ref{fig:AddSub2mode}(b). The BS parameters and the relative phases of the ancillary modes determine the coefficients of this superposition. Experimentally, the implementation of this scheme requires high quality matching of the BS inputs in order to ensure that the heralding photons are truly indistinguishable. In principle, combining photon additions \citep{Dakna1999a,Dakna1999b} or subtractions \citep{Fiurasek2005} with linear operations allows one to prepare any quantum state of light. However, the heralding photon-counting operations usually present a low success rate, and using other available tools such as homodyne measurements may offer practical advantage. Of particular interest is the operation of photon subtraction from single-mode squeezed vacuum, which permits one to generate the optical analogue of ``Schr\"odinger's cat''. This is our next subject. \subsection{``Schr\"odinger's cat'' and photon subtraction}\label{ScCatTheoSec} Since Schr\"odinger's seminal paper \citep{Schroedinger1935}, the transition between the ``microscopic'' (quantum) and ``macroscopic'' (classical) worlds became a central question in quantum physics. Quantum information processing, and the quest for larger and more complex quantum devices, made this subject even more important. In general, a ``Schr\"odinger's cat'' is defined as a classical object being in a quantum superposition of classical, distinguishable states, like a cat being dead and alive at the same time. In optics, the closest analogy to a classical light wave with a given amplitude and phase is a coherent state. Therefore, in the following we will call ``Schr\"odinger's cat'' a quantum superposition of coherent states $\ket{\alpha_k}$, written in its general form as $\sum_k a_k\ket{\alpha_k}$. In most cases it is restricted to only two ``dead'' and ``alive'' states with equal probabilities, which reduces its expression to $c(\ket{\alpha_1}+\mathrm{e}^{i\phi}\ket{\alpha_2})$. Quantitatively, the ``size'' of such a superposition can be measured in different ways, but all of them are related to the phase-space distance between the two coherent states $|\alpha_1-\alpha_2|$ which must be large compared to the shot noise for these states to be macroscopically distinguishable: $|\alpha_1-\alpha_2| \gg 1$. Therefore, phase-space displacements and rotations do not change the key features of this state, and without loss of generality we can consider that it can be expressed as \begin{equation}\label{EqStateCatIdeal} \ket{\psi_{{\rm cat}}[\alpha]}=\frac{1}{\sqrt{2c}} \; (\ket{\alpha}+\mathrm{e}^{i\theta} \ket{-\alpha}), \end{equation} with $\alpha\in \mathbb{R}_+$ and $c=1+\cos(\theta)\mathrm{e}^{-2|\alpha|^2}$. The associated Wigner function is \begin{multline} \label{EqWigCatIdeal} W_{{\rm cat}}[\alpha]=\frac{1}{\pi c}\left[\mathrm{e}^{-(x-\sqrt{2}\alpha)^2-p^2}+\mathrm{e}^{-(x+\sqrt{2}\alpha)^2-p^2}\right.\\ \left.+\mathrm{e}^{-x^2-p^2}\cos(2\sqrt{2}\alpha p-\theta)\right], \end{multline} where the first two terms correspond to the two coherent states and the last one produces the phase-space fringe pattern arising from their quantum superposition. The phase $\theta$ determines the phase of the fringes. This ``interference", where the Wigner function takes negative values, is the characteristic signature of the quantum nature of the cat. In the microwave domain, where the photons can be strongly confined and efficiently coupled to superconducting or Rydberg qubits, quantum superpositions of two or more coherent states have been created deterministically over a decade ago \citep{Brune1996,Deleglise2008,Hofheinz2009}. In the optical domain this has proven to be more difficult \cite{Hacker2019}, and several measurement-based non-deterministic protocols have been developed meanwhile \citep{Glancy2008}. The first proposals to prepare cat states using squeezed light and photon counting \citep{Song1990,Yurke1990,Tombesi1996} were based on an experimental design originally developed for quantum non-demolition measurements \citep{LaPorta1989}. However, the first experimental demonstrations \citep{Ourjoumtsev2006a,Neergaard-Nielsen2006,Wakui2007} used a simpler approach proposed by \textcite{Dakna1997}, who pointed out that a small odd ``Schr\"odinger's kitten" state $c(\ket{\alpha}-\ket{-\alpha})$ with $\alpha \lesssim 1$ could be produced with a very high fidelity by subtracting a single photon from a single-mode squeezed vacuum beam (Fig.~\ref{FigAlexei:PulsedKitten}, top). \begin{figure}[tb] \begin{center} \includegraphics[width=7.5cm]{fig11} \end{center} \caption{(Color online) A small fraction of a squeezed vacuum state, created by a degenerate optical parametric amplifier (OPA), is ``tapped": reflected towards a single photon counter which heralds the subtraction of a single photon. The resulting state resembles a ``Schr\"odinger's kitten'', a quantum superposition of coherent states $\ket{\alpha}$ and $\ket{-\alpha}$ with opposite phases and a small amplitude $\alpha\lesssim 1$. Bottom: Wigner function of experimentally generated states in the pulsed regime for $\alpha=0.9$ \citep{Ourjoumtsev2006a}. See Sec.~\ref{Cats} for details.} \label{FigAlexei:PulsedKitten} \end{figure} To see this, we recall the decomposition of the coherent state into the Fock basis: \begin{equation}\label{cohdecom}\ket{\alpha}=e^{-|\alpha|^2/2}\sum_{n=0}^\infty\frac{\alpha^n}{\sqrt{n!}}\ket{n}.\end{equation} The decomposition coefficients for $\ket\alpha$ and $\ket{-\alpha}$ are the same for even Fock states, but opposite for even ones. This means that the Fock decomposition of ``even" cat state (with $\theta=0$) contains only even number terms, whereas that of the ``odd" cat state ($\theta=\pi$) only odd terms. Next, we observe that the single-mode squeezed vacuum $\hat S(r)\ket0$, given by Eq.~\eqref{EqStateSqz} also contains only even number terms. For $r^2=\alpha$, the first two terms of the even cat and $\hat S(r)\ket0$ coincide up to a normalization factor, the difference appearing in higher-order terms. That is, any weakly squeezed vacuum approximates a kitten state of the corresponding amplitude $\alpha=\sqrt{r}$ with a high fidelity. Applying the photon subtraction operator $\hat a$ to the even cat state will produce an odd cat of the same amplitude because the coherent states $\ket{\pm\alpha}$ are eigenstates of that operator with the respective eigenvalues $\pm\alpha$. When we apply that operator to $\hat S(r)\ket0$, we also obtain an approximation of an odd kitten, but the amplitude will increase to $\alpha=\sqrt{3r}$. This difference arises because only the first two terms ($\ket 0$ and $\ket 2$) in the Fock decomposition of $\hat S(r)\ket0$ coincide with those of the even cat, whereas the terms of $\hat S(r)\ket0$ that give rise to the odd kitten after the photon subtraction are $\ket 2$ and $\ket 4$. A detailed calculation to this effect can be found in the supplementary information to \cite{Ulanov2017a}. Subtracting more than one photon increases the cat amplitude even further, by the same token. The photon subtracted squeezed state is equivalent to a squeezed single photon up to a normalization factor. Indeed, from Eq.~\eqref{EqAAdagOPA} we have $\hat S^\dag(r)\hat a\hat S(r)\ket 0=(\hat a\cosh r+\hat a^\dag \sinh r)\ket 0=\sinh r \ket 1$, and hence $\hat a\hat S(r)\ket 0=\sinh r\hat S(r) \ket 1$. This means that, if a deterministic photon source is available, kittens can be prepared in a deterministic fashion (Fig.~\ref{FigAlexei:PulsedKitten}, bottom). It also follows that whatever the squeezing level, the Wigner function of $\hat a \hat S(r)\ket0$ will become negative only around $x=p=0$ (single photon squeezed along one quadrature), whereas the Wigner function of a larger cat state will present several negative ``interference fringes'' between the ``dead'' and the ``alive'' coherent states. Therefore, a single photon subtraction only allows one to prepare small ``kitten'' states, and merely increasing the squeezing of the initial state does not transform them into large ``cats''. \subsection{Homodyne projective measurements} \label{NonGauss:HomodyneProject} An ideal homodyne measurement (discussed in detail in the next section) of the quadrature $\hat{x}_\theta$ in the mode $k$ giving the outcome $y$ corresponds to the projection on the infinitely squeezed state $\ket{x_\theta=y}_k$. These states have non-trivial expressions in the Fock state basis: for example, $\ket{x_\theta=0}$ corresponds to a quantum superposition containing only even photon numbers. A homodyne measurement performed on mode $k$ of a multimode state $\hat\rho$ yields \begin{equation} \hat{\rho}'= \frac{_k\!\bra{x_\theta)=y}\hat{\rho}\ket{x_\theta=y}_k}{ {\rm \, Tr }\, \left(_k\!\bra{x_\theta=y}\hat{\rho}\ket{x_\theta=y}_k\right)}. \end{equation} In terms of Wigner functions (\ref{wigner}), the single-mode infinitely squeezed state along $x(0)=y$ corresponds to $W(x,p)=\delta(x-y)$ for the corresponding Wigner function, which becomes $W({\vec R},{\vec R}^*)=\delta(\textrm{Re}({\vec R}\mathrm{e}^{-i\theta})-y)$ for any measurement phase $\theta$. A homodyne projection onto $\ket{x(\theta)=y}_k$ in mode $k$ transforms the Wigner function of the initial multimode state into \begin{multline} W'({\vec R},{\vec R}^*)\\ =\frac{\int \dd {\vec R}_k\dd {\vec R}_k^* \; \delta\left(\textrm{Re}({\vec R}\mathrm{e}^{-i\theta})-y\right) W({\vec R},{\vec R}^*)} {\int \dd{\vec R}^{2N} \delta\left(\textrm{Re}({\vec R}\mathrm{e}^{-i\theta})-y\right) W({\vec R},{\vec R}^*)} \end{multline} Unlike photon counting, homodyne detection is a Gaussian process: using the equation above, one can easily see that if the initial state is Gaussian, the final state will be Gaussian as well. However, such measurements may be used as a convenient way to transform one non-Gaussian state into another, and to create complex non-Gaussian states from relatively simple ones. Since quadrature eigenstates form a continuous basis, one must allow a finite tolerance $y\pm\epsilon$ around the required value $y$ to prepare the desired state with a finite success rate. In addition, detection losses play a particularly detrimental effect: unlike for photon counting they don't necessarily decrease the heralding event rate, but they modify the structure of the remotely prepared state. \medskip Linear optics, parametric amplifiers, photon counting and homodyne measurements allow one to generate a variety of non-classical light states. These states are generally analyzed by quantum homodyne tomography, presented in the next section. \section{Quantum tomography} Quantum tomography aims at characterizing some quantum objects from experimental data: a quantum state, a quantum process, or a detector \citep{Lundeen2009,Brida2012,Zhang2012,Lvovsky2008}. There is already a wide literature on this subject, and our purpose here is mainly to focus on the problematic raised by the use of continuous variables: measurement space of high dimensionality, use of hybrid non-trace-preserving processes, or encoding of discrete qubits with continuous variables. \subsection{Quantum state tomography} \subsubsection{Homodyne detection}\label{Homodynedet} A primary method for measuring optical states, in addition to photon detection, is balanced homodyne detection \citep{Yuen1978}. This method enables one to measure the phase-dependent electromagnetic field quadrature $\hat{x}_{\theta}=(\hat{a}^{\dag}e^{+i\theta} +\hat{a}e^{-i\theta})/\sqrt{2}$. Acquiring the statistics of such measurements at various phases enables one to reconstruct the density matrix and the Wigner function of the state, thereby enabling quantum state tomography \cite{Leonhardt1997,Lvovsky2009}. In this section, we concentrate on homodyne detection as a measurement technique, deferring the discussion of quantum state tomography to Sec.~\ref{section:MaxLik}. The general scheme of this technique involves a classical reference beam, named local oscillator (LO), impinging on a 50:50 beam splitter, while the signal to be analyzed enters in the second input port. The two outputs are detected by two efficient linear photodetectors, generally PIN photodiodes (Fig.~\ref{Homodynefig}). The quantity of interest is the difference of the corresponding photocurrents. The time integrated photocurrent measured by each detector is proportional to the photon numbers $\hat n_1$ and $\hat n_2$ in the beam splitter output ports, and hence the subtraction photocurrent is proportional to $\hat n_2-\hat n_1$. A simple mathematical description is based on the BS transformation (\ref{EqAAdagBS}) of the $\hat{a}$ and $\hat{a}_{LO}$ annihilation operators describing the signal and LO fields. For $T=1/2$, the two output fields are \begin{equation}\begin{cases}\hat{a}_{1}=\frac{1}{\sqrt{2}}(\hat{a}+\hat{a}_{LO}) \cr \cr \hat{a}_{2}=\frac{1}{\sqrt{2}}(\hat{a}-\hat{a}_{LO})\end{cases} \end{equation} The photon-number operators at the output are then \begin{equation}\label{n1n2}\begin{cases}\hat{n}_{1}=\hat{a}_{1}^{\dag}\hat{a}_{1}=\frac{1}{2}(\hat{a}^{\dag}\hat{a}+\hat{a}_{LO}^{\dag}\hat{a}_{LO}+\hat{a}^{\dag}\hat{a}_{LO}+\hat{a}_{LO}^{\dag}\hat{a}) \cr \cr \hat{n}_{2}=\hat{a}_{2}^{\dag}\hat{a}_{2}=\frac{1}{2}(\hat{a}^{\dag}\hat{a}+\hat{a}_{LO}^{\dag}\hat{a}_{LO}-\hat{a}^{\dag}\hat{a}_{LO}-\hat{a}_{LO}^{\dag}\hat{a})\end{cases} \end{equation} and the difference is \begin{equation}\label{n12}\hat{n}_2-\hat{n}_1=\hat{a}^\dagger \hat{a}_{LO}+ \hat{a}_{LO}^\dagger \hat{a}. \end{equation} Because the above transformation applies to operators, i.e., is performed in the Heisenberg picture, the measurement of the operator $\hat n_{12}$ is performed on the BS input state. That is, the operators $\hat a$ and $\hat a^\dag$ are measured on the signal state, and the operators $\hat a_{LO}$ and $\hat a_{LO}^\dag$ - on the bright coherent state $\ket{\alpha_{LO} e^{i\theta}}$ in the local oscillator mode. Considering the limit $\alpha_{LO}\gg 1$ for the amplitude of the local oscillator allows us to treat it classically and replace the operators $\hat a_{LO}$ and $\hat a_{LO}^\dag$ with their expectation values $\alpha_{LO} e^{i \theta}$ and $\alpha_{LO} e^{-i\theta}$. Eq.~(\ref{n12}) can then be rewritten as follows: \begin{equation}\hat{n}_2-\hat{n}_1=\alpha_{LO} \; (\hat{a}^{\dag}e^{+i\theta} +\hat{a}e^{-i\theta})= \sqrt{2}\; |\alpha| \hat{x}_{\theta}. \end{equation} \begin{figure}[tb] \begin{center} \includegraphics[scale=0.33]{fig3} \end{center} \caption{(Color online) Homodyne detection: The signal and LO field are mixed on the 50:50 BS and the two outputs are detected by two photodiodes, the integral of the difference photocurrent is proportional to the quadrature operator.} \label{Homodynefig} \end{figure} The homodyne signal is hence the measurement of the $\hat{x}_{\theta}$ operator. The angle $\theta$ in the phase space corresponds to the relative phase between the signal and the reference field, generally adjusted by a piezo-controlled mirror in the LO path. If the phase is fixed, the histogram obtained from a large set of repeated measurements, giving different outcomes $x_{\theta}$ on identically prepared states, is a good evaluation of the probability distribution $P_\theta(x_{\theta})$. Importantly, as long as the detection stays balanced, the macroscopic terms $\hat{a}_{LO}^{\dag}\hat{a}_{LO}$ in Eq.~\eqref{n1n2} are canceled, meaning that the effects of any classical excess noise of the reference field are minimized \citep{Bachor2004}. Understanding many important features of homodyne detection requires a more elaborate model than the above simple single-mode description. In particular it is necessary to include a multimode picture to explain that in homodyne detection, which is an inherently interferometric technique, the strong local oscillator selects the spatial and temporal mode in which the measurement is performed. Accordingly, it is necessary to have a good mode-matching between the LO and the signal under analysis in order not to lose information about the quantum field to be measured. Further possible imperfections of homodyne detections include optical losses, finite detection efficiency of the photodiodes, and electronic noise in the measuring chain. They can be modeled by additional beam splitters in the signal path, so that the signal is transmitted with a coefficient corresponding to the global efficiency, and is mixed with either vacuum or thermal states entering in the other input ports \citep{Lvovsky2009,Leonhardt1997}. The first application of homodyne detection in quantum optics was in the frequency domain \citep{Abbas1983,Slusher1985} for the measurement of squeezed light. Measurements of the quadrature noise in different spectral components of the signal is still performed by homodyne setups \citep{Vahlbruch2008,Mehmet2011}. However the application where the homodyne detection has been most extensively used, starting from the pioneering work of \citep{Smithey1993}, is the time domain analysis for the tomographic reconstruction of the Wigner function of quantum states localized in a certain temporal mode. In the pulsed regime the homodyne detector analyzes the quadratures contained in the temporal mode of the pulsed LO which normally comes from the same laser source used in the quantum field generation \citep{Smithey1993,Wenger2004b}. In the conditioned schemes, where the quantum state is announced by a certain event in a correlated heralding field, only the quadratures in the pulses corresponding to the heralded events are processed \citep{Lvovsky2001,Zavatta2004a,Huisman2009,Ourjoumtsev2006b,Zavatta2008}. In the cw regime the time behavior of the quantum states is often determined by the detection of the heralding event which is time-correlated with the analyzed quantum field. The homodyne signal which is acquired with a continuous wave LO needs to be filtered using a temporal function corresponding to the right mode shape \citep{Neergaard-Nielsen2007,MelholtNielsen2009}. These schemes will be described in more details below. Scaling up optical non-Gaussian quantum engineering motivated specific research efforts to move from the single-mode to the multi-mode regime \citep{Pinel2012,Pysher2011,Janousek2009, Roslund2013,Chen2014, Yokoyama2013,Cai2020,Asavanant2019}. The requirement for arbitrary, selective quadrature measurement of such states stimulated the emergence of adaptive methods which realize a mode-selective and a multimode homodyne detection of quantum light states \citep{Ferrini2013,Cai2020}. Spatial and temporal shaping techniques for femtosecond light can be used to iteratively adjust the LO field shape to the quantum signal by maximizing the homodyne efficiency \citep{Polycarpou2012}. The main performance characteristics of homodyne detectors are high subtraction efficiency, high clearance of the shot over the electronic noise, high photodetector quantum efficiency and high bandwidth for increasing the temporal resolution. Achieving high performance in all these benchmarks is challenging. In particular, higher-efficiency photodiodes often feature higher capacitances, which, in turn, leads to narrower bandwidths. A higher bandwidth often compromises the shot-to-electronic-noise clearance, which, in turns, affects the measurement efficiency \citep{Appel2007}. A typical approach to constructing the balanced detector circuitry involves using a low-noise operational amplifier \citep{Zavatta2002,Neergaard-Nielsen2007,Okubo2008,Haderka2009,Kumar2012,Cooper2013a,Qin2016}. Performance characteristics of such circuits are well understood \citep{Masalov2017}. Further improvement in performance can be achieved by using a field-effect transistor instead of an operational amplifier for the first cascade of amplification \citep{Duan2013}, which however requires a good expertise in high-frequency electronics. For some applications, resonant AC-coupled detectors may be advantageous \cite{Serikawa2018}. An important recent achievement is the realization of a homodyne detector integrated on a photonic chip \cite{Raffaelli2018}. \subsubsection{State reconstruction in homodyne tomography} \label{section:MaxLik} As already discussed before, the Wigner function $W(x,p)$ is particularly relevant to picture a quantum state with continuous variables as it is closely connected to the probability distributions $P_\theta(x_\theta)$ of quadratures measured with the homodyne detector. Such distributions indeed simply correspond to the projection of this function onto the axis of the considered quadrature as per Eq.~\eqref{ptheta}. If one introduces the Fourier transforms $\tilde P_\theta(k)$ and $\tilde W(k_x,k_p)$ of $P_\theta(x_\theta)$ and $W(x,p)$, respectively, this relation can be rewritten \citep{Leonhardt1997}: \begin{equation} \label{Rosa:ExpWigner} \tilde W(k\cos\theta,k\sin\theta)=\tilde P_\theta(k_\theta) \end{equation} The reconstruction of $W$ from its projections is quite similar to X-ray computed tomography in medical imaging, and this is the task of the Radon transform, which belongs to the class of state reconstruction methods via inverse linear transformation \citep{Lvovsky2009}: by writing the inverse Fourier transform of Eq.(\ref{Rosa:ExpWigner}) with polar coordinates, it can be expressed as: \begin{equation} \label{Rosa:EQURadonInverse} W(x,p)=\frac{1}{2\pi^{2}}\int_{0}^{\pi}d\theta\int \tilde P_{\theta}(k_\theta)K(x\cos\theta+p\sin\theta-k)\dd k \end{equation} This method however is not very robust to noise due to high oscillations of the integration kernel, which could introduce artifacts in the reconstructed Wigner function. It can even lead to unphysical states: the density matrix $\rho$ deduced from $W$ using pattern functions \citep{Leonhardt1997} is not guaranteed to be positive and of unit trace \citep{Lvovsky2009}. That is the reason why maximum-likelihood reconstruction is usually preferred \citep{Hradil1997,Hradil2004,Lvovsky2004}. The likelihood function can be defined as the probability to observe a set of measurement outcomes in the state with the density matrix $\hat\rho$ \begin{equation} \label{Rosa:EQUVraisemblance} L(\hat\rho)=\prod_{j}p_{j}(\hat\rho) \end{equation} where $p(\hat\rho)=\bra{x_{\theta_j}}\hat\rho\ket{x_{\theta_j}}$ is the probability to observe the quadrature value $x_\theta$ in the $j$th measurement with the local oscillator phase $\theta_j$. An important result \citep{Hradil1997,Lvovsky2004} is that the state $\hat\rho$ for which the likelihood is maximized is obtained by the following iterative procedure: \begin{equation} \label{Rosa:EQUsuiteR} \hat\rho^{(k+1)}=\mathcal{N}[\hat R(\rho^{(k)})\hat\rho^{(k)}\hat R(\rho^{(k)})] \end{equation} \noindent where $\hat R$ is the positive operator: \begin{equation} \label{Rosa:EQUdefR} \hat R(\hat\rho)=\sum_{j}\frac{\ket{x_{\theta_j}}\bra{x_{\theta_j}}}{p_{j}(\hat \rho)} \end{equation} and $\mathcal{N}$ denotes normalization to a unitary trace. The maximum-likelihood approach offers a major advantage of preserving trace and positivity, thereby guaranteeing the reconstruction of a physical state. The iterative sequence usually converges when starting from $\hat\rho^{(0)}=\mathcal{N}[\hat 1]$, even if this algorithm can sometimes fail. Other schemes have been proposed to prevent that risk \citep{Rehacek2007} and guarantee convergence. Stopping rules have also been derived for such iterative processes \citep{Glancy2012}. Importantly, this approach is able to account for a non-ideal detection efficiency which, in the case of homodyne detectors, mainly stems from optical losses. To model them, we can assume that the signal mode (labeled $s$ in the equation below) is transmitted through a beam splitter (BS) whose transmissivity equals the detection efficiency $\eta$ and whose other input (2) is in a vacuum state. The loss transforms the state in the signal path into \begin{equation} \hat{\rho}_{s}'(\eta)={\rm \, Tr }\, _{2}\{\hat{B}_{s2}{(\tau)^\dag}\hat{\rho}_{s} \vert 0 \rangle_{2} \, _{2} \langle 0 \vert \hat{B}_{s2}{(\tau)}\}, \end{equation} where the operator $\hat{B}^\dag(\eta)$ corresponds to the BS operator defined in Eq.~(\ref{EqUnitBS}) with $\cos\tau=\sqrt{\eta}$. If the density operator is expressed in the Fock basis as $\hat{\rho}_{s}= \sum \varrho_{n,m}\vert n \rangle \langle m \vert\ $ the density matrix elements are transformed as \cite{Leonhardt1997} \begin{equation}\label{GenBernoulli} \varrho_{n,m}'(\eta)= \sum_{k=0}^{\infty}[\textbf{B}_{n}^{n+k}(\eta)\textbf{B}_{m}^{m+k}(\eta)] \varrho_{n+k,m+k} \end{equation} where $\textbf{B}^{n+k}_{n}=\sqrt{\binom{n+k}{n} \eta^{n}(1-\eta)^{j}}$. This formula describes a \textit{generalized Bernoulli transformation} and in the case of a pure single photon state gives a mixture of the single photon and the vacuum state: $\hat{\rho}_{s}'(\eta)= \eta \vert 1 \rangle \langle 1 \vert + (1-\eta) \vert 0 \rangle \langle 0 \vert $. The Wigner function of the resulting state can be directly calculated as a convolution of the entering state and the vacuum by \cite{Leonhardt1997} \begin{equation}\label{Weff}\begin{split}W'_{s}(x,y,\eta)=&\int \int W\big(\sqrt{\eta}x - \sqrt{1-\eta}x_{2},\sqrt{\eta}p - \sqrt{1-\eta}p_{2} \big)\\ & \times W_{0}\big(\sqrt{1-\eta}x - \sqrt{\eta}x_{2},\sqrt{1-\eta}p - \sqrt{\eta}p_{2})\\ & dx_{2} dp_{2} \end{split} \end{equation} In other words, losses leas to the ``blurring'' of the Wigner function. It is common to correct for the effect of the losses in the numerical procedure of state reconstruction. In maximum-likelihood reconstruction \citep{Lvovsky2004}, this is done by redefining the POVM or, equivalently, by replacing $\hat\rho$ in Eq.~(\ref{Rosa:EQUdefR}) with its generalized Bernoulli transform (\ref{GenBernoulli}). In this way, the likelihood function (\ref{Rosa:EQUVraisemblance}) is estimated with respect to the density operator that represents the state before the detection losses, so maximizing the likelihood reconstructs the state at that stage. \subsubsection{Parameter estimation} \label{section:ParameterEstimation} A quantum state is characterized by a set of parameters (for example, the elements of the density matrix). Quantum state tomography implies finding the approximate values of these parameters within a certain subspace of the Hilbert space. Even for a moderate size subspace, this parameter set is quite large. Therefore, although the reconstruction methods described above are quite efficient, state tomography requires one to handle a high amount of data, with a substantial computation time. A faster way to evaluate a quantum state in real time (e.g. when aligning a setup) is to exploit the physical \textit{a priori} knowledge of the state in order to build its parametrized model. Then the characterization of a quantum state reduces to a much simpler task of determining only a few parameters. For instance, a degenerate OPA used to produce a squeezed state can be modeled by the succession of an ideal degenerate OPA and of an ideal non-degenerate optical parametric amplifier (NDOPA) \citep{Paris2003,Adam1995} or an attenuator \cite{Lvovsky2015} to account for added noise. In the same way, a NDOPA for the generation of Gaussian EPR states can be modeled by the succession of an ideal NDOPA and of two ideal NDOPAs (Fig.~\ref{Rosa:Model_NDOPA}). \begin{figure}[tb] \begin{center} \includegraphics[scale=0.6]{fig4} \end{center} \caption{(Color online) A non-degenerate optical parametric amplifier (NDOPA) can be modeled by the succession of an ideal NDOPA of gain $g$ and of two ideal NDOPAs of gain $h$ to account for added noise.} \label{Rosa:Model_NDOPA} \end{figure} A $1$-photon Fock state can be conditionally produced through a heralding detection event on one mode of the EPR state of Fig.~\ref{Rosa:Model_NDOPA}. A spatial and spectral filtering system is needed on the heralding mode in order to clearly define the spatio-temporal mode in which the Fock state is emitted, as discussed in detail in Sec.~\ref{condSPDC}. A modal purity parameter $\xi$ can be introduced in order to characterize the quality of this filtering system by quantifying the fraction of detected photon in the desired mode \citep{Lvovsky2001,Wenger2004a,Tualle-Brouri2009}: the signal state will then be a statistical mixture of the ideal heralded state and the state that is present in the signal mode without heralding. Analytical expressions can then be derived for its Wigner function \citep{Ourjoumtsev2006b}: \begin{equation} \label{Rosa:WignerFock1} W_1(x,p)=\frac{e^{-R^2/\sigma^2}}{\pi\sigma^2} \left[1-\delta+\frac{\delta R^2}{\sigma^2}\right], \end{equation} where $R^2=x^2+p^2$ and $\sigma^2$ and $\delta$ are functions of parameters $g$, $h$, $\xi$, of the homodyne efficiency $\eta$ and of the electronic noise $e$. The Wigner function in this case is therefore supposed to depend on only two parameters which can be easily deduced from the first non-zero moments of the measured quadrature distributions: \begin{eqnarray} \label{Rosa:Fock1Moments} \mu_2\equiv\langle x^2\rangle = \sigma^2(1+\delta)/2 \\ \mu_4\equiv\langle x^4\rangle = 3\sigma^4(1+2\delta)/4 \end{eqnarray} This very fast method allows a real-time reconstruction, which is a major help for optimizing an experiment. It also allows one to understand which kind of parameters can be deduced from experimental data: it is clear that all the model parameters $g$, $h$, $\xi$, $\eta$ and $e$ cannot be deduced from the only two parameters $\sigma$ and $\delta$ involved in Eq.~(\ref{Rosa:WignerFock1}). More information can be obtained from a homodyne tomography of the photon subtracted squeezed vacuum discussed in Sec.~\ref{ScCatTheoSec}. In this case, the Wigner function depends on the phase and is of the form \begin{equation} \label{Rosa:WignerKitten} W_{c}(x,p)=\frac{e^{-\frac{x^2}{a}-\frac{p^2}{b^2}}}{\pi\sqrt{ab}} [1-\frac{a'}{a}-\frac{b'}{b}+2x^2\frac{a'}{a^2}+2p^2\frac{b'}{b^2}]. \end{equation} The four parameters $a$, $a'$, $b$, $b'$ can be readily deduced from quadrature moments. On the other hand, they can be expressed \citep{Ourjoumtsev2006a} in terms of the five parameters $s$, $h$, $\xi$, $\eta$ and $e$ of the model in which the squeezed vacuum is produced by an ideal degenerate OPA of squeezing $s$ followed by an ideal NDOPA of gain $h$. In this case, independent knowledge of one model parameter is still needed: the homodyne efficiency $\eta$ cannot be recovered from experimental data and must be evaluated from separate measurements. Physical constrains on the parameters can be enforced using a Bayesian approach \cite{Blandino2012a}. To finish with this short review on parameter estimation, let us mention the research on state non-classicality witnessing \citep{Bednorz2011,Kot2012}. A widely recognized criterion for non-classicality is the negativity of the Wigner function, which is directly connected to state tomography. Many reconstruction methods are however based on quantum laws, as for instance maximum likelihood reconstruction which needs the introduction of the density matrix. The Radon transform does not rely on such knowledge, but presents drawbacks such as parasitic oscillations which can lead to irrelevant negative values. A way around is to note that violating the following inequality implies negativity of the Wigner function \citep{Bednorz2011}: \begin{equation} \label{Rosa:NCWitness} \langle\mathcal{F}\rangle\equiv\int \mathcal{F}(x,p) \; W(x,p) \; \dd x\dd p\ge 0 \end{equation} \noindent where $\mathcal{F}$ is any positive function. One can choose \citep{Kot2012} for such a function the square of a polynomial of $R^2=x^2+p^2$, so that the criterion (\ref{Rosa:NCWitness}) can be evaluated from quadrature moments using \begin{equation} \label{Rosa:Moments} \langle R^{2n}\rangle=\begin{pmatrix}2n\\n\end{pmatrix}^{-1} \frac{2^{2n}}{2n}\sum_{m=1}^{2n}\langle x_{\theta=m\pi/(2n)}^{2n}\rangle \end{equation} Such a criterion allows one to assess the negativity of the Wigner function directly from the moments, without reconstructing the state. Errors on the estimated parameters can be derived from the statistics of the experimental data through linear approximations and error propagation. This can be easily performed using the results of the previous section. Let us consider for instance the value $W_{1,0}\equiv W_1(0,0)$ of the Wigner function (\ref{Rosa:WignerFock1}) of the one-photon Fock state, taken at the origin. As the negativity of this value is a criterion for non-classicity, it is of great importance to have an error estimation on it. Following Eq.(\ref{Rosa:WignerFock1}) and inverting Eq.(\ref{Rosa:Fock1Moments}), this parameter can be expressed as a function of the moments $\mu_2$ and $\mu_4$ of the measured quadrature distributions. The error on the parameter is therefore: \begin{equation} \label{Rosa:ErrorOnW10} \langle\delta W_{1,0}^2\rangle=\sum_{k,l\in\{2,4\}}\frac{\partial W_{1,0}}{\partial\mu_k}\frac{\partial W_{1,0}}{\partial\mu_l}\langle\delta\mu_k\delta\mu_l\rangle \end{equation} Let us note that the error on the moments can be estimated from the moments themselves: using the estimator $N^{-1}\sum_{i=1}^N x_i^k$ for the moment $\mu_k$, and injecting it into the expression $\langle\delta\mu_k\delta\mu_l\rangle\equiv\langle\mu_k\mu_l\rangle-\langle\mu_k\rangle\langle\mu_l\rangle$, one finds \begin{equation} \label{Rosa:ErrorOnMuk} \langle\delta\mu_k\delta\mu_l\rangle=\frac{\mu_{k+l}-\mu_{k}\mu_{l}}{N} \end{equation} A simple alternative to this approach is bootstrapping \citep{Home2009,Lvovsky2009}, where the distribution of the estimated parameters is simulated from random sets of data drawn from the reconstructed parameters. \subsubsection{Intermediate approaches} Quantum tomography that does not rely on any \emph{a priori} information about the state (section \ref{section:MaxLik}) is very general but becomes intractable when the size of the Hilbert space grows. Reconstruction through parameter estimation (section \ref{section:ParameterEstimation}) is very efficient but relies on a detailed model of the physical process used to generate the quantum state. Between these two extremes, several intermediate approaches exist, such as quantum compressed sensing \cite{Gross2010}, permutationally-invariant tomography \cite{Toth2010}, matrix product state tomography \cite{Cramer2010} or machine learning \cite{Carleo2017,Torlai2018,Macarone2019,Rocchetto2019,Yu2019}. Their common point is to describe the state with a model (\emph{Ansatz}) assuming some knowledge about the state's structure and rely on a restricted set of parameters to specify the state within the Ansatz. In particular, such an Ansatz can be provided by neural networks, which is attractive due to their known ability to serve as universal approximators \cite{Hornik1993}, as well as broad availability and understanding of optimization techniques. Most results on applying neural networks for quantum tomography were so far obtained in the DV context, but \textcite{Tiunov2019} have recently used a restricted Boltzmann machine to efficiently reconstruct optical non-Gaussian states, while \textcite{Cimini2020} have used neural networks to directly test Wigner negativity of multimode non-Gaussian states. Rapid progress along these lines is expected. \subsubsection{Unbalanced homodyne detection} Alongside the dramatic development of quantum tomography based on balanced homodyne detection, alternative methods for the local sampling of the phase-space distribution have been proposed \citep{Wallentowitz1996,Banaszek1996c}. They are based on an unbalanced homodyne setup where the signal and the LO fields are mixed on a BS with low reflectivity $|r|^2=1-|t|^2 \ll 1$. This operation, acting on the transmitted signal, corresponds to the application of the displacement operator $\hat{D}(\beta)= \exp(\beta\hat{a}^\dagger- \beta^*\hat{a})$ on the entering signal field $\hat{a}$, which gives $\hat{D}^\dagger(\beta)\hat{a}\hat{D}(\beta)=\hat{a}+\beta$ where $\beta= (r/t)\vert \alpha_{LO}\vert e^{i\theta}$ \cite{Paris1996,Lvovsky2002a}. The probability $P_n(\beta, \eta)$ to detect $n$ photons in the emerging field contains the information on the Wigner function in the phase-space point $\beta$: \begin{equation} W(\beta,\eta)=\frac{2}{\pi}\sum_0^\infty \Big(\frac{2-\eta}{\eta}\Big)^n P_n(\beta, \eta), \end{equation} where $\eta=\vert t\vert^2\eta_{\rm det}$ with $\eta_{\rm det}$ being the quantum efficiency of the photon detector. The main drawback of this technique is that it requires photon-number resolving detectors. So the first implementations of the quantum sampling method have been realized with on/off detectors in the low-mean-photon number regime \citep{Juarez-Amaro2003,Allevi2009,Bondani2010} or using time-multiplexing detectors \citep{Laiho2010}. To overcome the technical problems of poor discrimination in the photon number, cascaded schemes have been proposed: they combine the unbalanced homodyne scheme for the local reconstruction of phase-space distributions and the phase randomized balanced homodyne detection for measuring the photon statistics \citep{Kis1999,Munroe1995}. Then schemes for the reconstruction of photon number distributions by mixing the signal with a thermal state has been proposed and realized \citep{Harder2013}. More recently implementations with number-resolving detectors have become available, along with schemes that are less sensitive to non-ideal detectors \citep{Sridhar2014,Harder2016,Olivares2019,Nehra2019,Sperling2020}. \subsection{Quantum process tomography} In the framework of this review, quantum process tomography is not as crucial as quantum state tomography considered in the previous section. However, it does matter for the evaluation of processors, such as amplifiers or quantum gates, which will be presented in Part II. Therefore we present here some relevant features, with special emphasis on heralded (non-deterministic) processes. \subsubsection{Generalities} A quantum process, which associates an input state $\hat\rho$ to an output state $\mathcal{E}(\hat\rho)$, can be viewed as a completely positive linear map \citep{Kraus1983,Chuang1997}. A positive map preserves the Hermiticity and the positivity, what is clearly a mandatory requirement for the transformation of density matrices. Complete positivity consists in the additional requirement that $\mathbb{I}\otimes\mathcal{E}$ is also a positive map (where $\mathbb{I}$ is the identity on any ancillary space), what accounts for the fact that $\mathcal{E}$ can also be applied to parts of entangled states. This last requirement is closely linked to the Jamio{\l}kowsi isomorphism \citep{Jamiolkowski1972}, which associates to any map $\mathcal{E}$ the quantum state \begin{equation} \label{Rosa:Jamiolkowsi} \hat\rho_\mathcal{E}=(\hat{\mathbb{I}}\otimes\mathcal{E})\ket{\Phi}\bra{\Phi} \end{equation} \noindent where $\ket{\Phi}=\frac{1}{\sqrt{d}}\sum_j\ket{j}\ket{j}$ is a maximally entangled two-mode state described in a $d$-dimensional Hilbert space. The physical meaning of this isomorphism has to be underlined: if (for a trace-preserving map) a state $\ket{\psi}$ is measured on the first mode of $\hat\rho_\mathcal{E}$, the second mode is projected into $\mathcal{E}((\ket{\psi}\bra{\psi})^*)$, where the asterisk denotes the operator whose matrix is complex conjugate to that of $\ket{\psi}\bra{\psi}$. In this way, we describe the the map through a $2$-mode quantum state. A quantum map corresponding to a physical operation only needs to be trace-non-increasing \citep{Nielsen2000}, and may include non-deterministic processes, which are trace-non-preserving. In fact, for any non-deterministic (heralded) process $\mathcal{E}$, a trace-preserving ($\it{i.e.}$ deterministic) quantum map can be constructed by including both success and failure events as parts of the process. The trace ${\rm \, Tr }\, [\mathcal{E}(\hat\rho)]$ then corresponds to the heralding success probability $P_{\rm succ}$, and the final state is \begin{equation} \label{Rosa:FinalState} \hat\rho_{\rm out}=\frac{\mathcal{E}(\hat\rho)}{{\rm \, Tr }\, [\mathcal{E}(\hat\rho)]}=\frac{\mathcal{E}(\hat\rho)}{P_{\rm succ}} \end{equation} A primary property of any quantum map is its linearity with respect to density operators. That is, if the effect of the process $\mathcal{E}(\hat\rho_i)$ is known for a set of density operators $\{\hat\rho_i\}$, its effect on any linear combination $\hat\rho=\sum \beta_i\hat\rho_i$ is \begin{equation}\label{QPTbasis}\mathcal{E}(\hat\rho)=\sum \beta_i \mathcal{E}(\hat\rho_i). \end{equation Thanks to this linearity, there exists a compact representation of any map in the form of a matrix multiplication. By applying Eq.~\eqref{QPTbasis} to the density matrix of an arbitrary input state $\hat\rho=\sum_{m,n}\hat\rho_{mn}\ketbra mn$, we find \begin{equation} \label{Rosa:MapFockBasis} \bra{k}\mathcal{E}(\hat\rho)\ket{l}=\sum_{m,n}\mathcal{E}_{k,l}^{m,n}, \end{equation} where \begin{equation}\label{ProcessTensor} \mathcal{E}_{k,l}^{m,n}=\bra k\mathcal{E}(\ketbra mn)\ket l. \end{equation} is the so-called process tensor and $\ket k,\ket l,\ket m,\ket n$ denote the elements of any basis, for example, the Fock basis \citep{Lvovsky2008}. A quantum map can also be represented using continuous variables: in the same way as the Wigner function $W(x,p)$ can be viewed as a quasi-probability distribution for the quadratures of a quantum state, a Markovian-like process can be associated to a quantum map \citep{Berry1979}, with: \begin{equation} \label{Rosa:Ferreyrol} W_{out}(x,p)=\int \; W(x',p') \; f_\mathcal{E}(x,p,x',p')\dd x'\dd p' \end{equation} The function $f_\mathcal{E}$ can be obtained even for non-deterministic operations, and allows an intuitive picture of quantum maps, with very simple expressions for many elementary processes. The corresponding expression for chained processes is very similar to the Chapman-Kolmogorov equation for Markovian processes \citep{Ferreyrol2012}. \subsubsection{Methods} Quantum process tomography (QPT) is a technique of reconstructing the process tensor \eqref{ProcessTensor} by applying the process to a number of ``probe" states that constitute a spanning set within the space $\mathcal{L}(\mathcal{H})$ of linear operators over a particular Hilbert space $\mathcal{H}$. Then the knowledge of $\{ \mathcal{E}(\hat\rho_i)\}$ may be sufficient to extract complete information about the quantum process as per Eq.~\eqref{QPTbasis}. One possibility \citep{Lobino2008} is to use coherent states as probe, taking advantage of Eq.~\ref{pfunc}: any density operator can be written as a linear combination of density operators of coherent states. Applying Eq.~\eqref{ProcessTensor} to Eq.~\eqref{pfunc}, we find \begin{equation}\label{QPTpfunc} \mathcal{E}_{k,l}^{m,n}= \int d^{2}\alpha \; P_{\ketbra mn}(\alpha, \alpha^{\ast} ) \; \bra k\mathcal{E}(|\alpha \rangle\langle \alpha |)\ket l, \end{equation} where $P_{\ketbra mn}(\alpha, \alpha^{\ast} )$ is the P-function of the operator $\ketbra mn$. The advantage of this technique is that any quantum process, however complex, can, in principle, be reconstructed by means of simple laser pulses \citep{Lobino2008}, without nonclassical probe states. Coherent-state QPT in the form of Eq.~\eqref{QPTpfunc} is difficult to apply in practice because $P_{\ketbra mn}(\alpha, \alpha^{\ast} )$ is a highly singular generalized function. This formula has been simplified in \citep{Rahimi-Keshari2011}: \begin{equation} \label{Rosa:Rahimi} \mathcal{E}_{k,l}^{m,n}=\frac{1}{\sqrt{m!n!}}\partial_\alpha^m\partial_{\alpha^*}^n\left[e^{|\alpha|^2}\bra k\mathcal{E}(|\alpha \rangle\langle \alpha |)\ket l\right]_{\alpha=0} \end{equation} The derivatives at $\alpha=0$ can be deduced from a finite set of probe coherent states through a polynomial interpolation. A further simplification is provided by the QPT maximum-likelihood algorithm \citep{Anis2012} which iteratively calculates the process tensor directly from the quadrature measurements $\mathcal{E}(|\alpha \rangle\langle \alpha |)$. This algorithm utilizes the Jamiolkowski isomorphism to effectively reduce QPT to quantum state tomography. In the case of a heralded process, the final state $\hat\rho_{\rm out}(\alpha)$ is different from $\hat\rho(\alpha)=\mathcal{E}(\ket{\alpha}\bra{\alpha})$ due to the normalization in Eq. (\ref{Rosa:FinalState}). As underlined by \cite{Rahimi-Keshari2011}, this problem can be circumvented with the knowledge of the success probability $P_{\rm succ}$ by setting $\mathcal{E}(|\alpha \rangle\langle \alpha |)=P_{\rm succ} \; \hat\rho_{\rm out}(\alpha)$ in Eq. (\ref{Rosa:Rahimi}). In the maximum-likelihood algorithm \citep{Anis2012}, trace-non-preserving processes are taken into account by treating instances in which the heralding event did not occur as the process output being a special state that is not an element of the original Hilbert space. Since its development, the method of coherent-state QPT has been applied to a large variety of processes, such as quantum-optical memory \citep{Lobino2009}, photon addition and subtraction \citep{Kumar2013,Ra2017} as well as other conditional state-engineering quantum processes \citep{Cooper2015}, and optically-controlled kerr non-linearity \citep{Kupchak2015}. It has also been extended to the multimode case \citep{Fedorov2015a}. On the other hand, it has been observed that ``coherent states are very `classical', and provide exponentially little information about parameters of some quantum processes" \citep{Rosema2014}. This has motivated a search for a more efficient set of probe states. In particular, squeezed states have been investigated for this role \citep{Fiurasek2015}. \subsubsection{Physical models for quantum processes} Generally, QPT is a task far more difficult than quantum state tomography. The total number of parameters contained in the process tensor scales as the fourth power of the Hilbert space dimension, which means that QPT requires one to acquire and manipulate a vast amount of data. Under some circumstances, however, certain features of a process are known \emph{a priori}. Then the general QPT, as described above, is not necessary; the problem effectively reduces to parameter estimation. For example, if the process is known to be of linear optical nature, its characterization is straightforward even in the case of multiple input and output modes. The transformation matrix can be reconstructed by measuring the intensities in the output ports in response to coherent states injected into individual input ports as well as pairs thereof \citep{Rahimi2013}. A similar goal can be achieved by using single-photon states as probes, in which case the photon count rates in individual outputs, as well as pairwise coincidences must be measured \citep{Laing2012,Dhand2016}. Another instance is the non-deterministic phase gate proposed in \citep{Marek2010} and discussed in detail in Sec.~\ref{QCompSec}. For the phase shift of $\pi$, this gate reduces to a photon-subtraction experiment with a sampling BS and a photon detection heralding event. This setup can be characterized by two parameters: the reflectivity $R$ of the sampling BS and the modal purity parameter $\xi$. These parameters can be determined from only one input state like a squeezed vacuum, and can successfully predict the behaviour of the gate for a squeezed single photon at the input, then allowing a quantitative comparison between the experimental gate and the ideal one \citep{Blandino2012b}. A similar approach was also applied to the non-deterministic Hadamard gate \citep{Tipsmark2011}. \section{Conditional photon measurements in parametric down conversion} \label{condSPDC} The parametric down conversion process (PDC) in the pulsed low-gain regime is the most widely used scheme for the conditional implementation of nonclassical states of light with few photons in a localized temporal frame. Fock states and (multi-)entangled states, which are the basic ingredients for photonic quantum information and communication protocols, were obtained in PDC setups \citep{Lvovsky2001,Ourjoumtsev2006b,Bouwmeester1999,Yao2012}. The basic principle of heralded state preparation by means of photon detection has been discussed in Sec.~\ref{NonGauss:PhotonCount}. Here we analyze this procedure in view of an important practical complication: photon pair produced in PDC are typically entangled spectrally. Therefore photon detection in the heralding channel, unless performed judiciously, will result in the heralded state in a highly impure optical mode that is unsuitable for further applications. The optimal approach to heralding strongly depends on how the PDC bandwidth compares to the inverse time resolution of the photon detector. Accordingly, we identify two main regimes of operation: pulsed (broadband) and cw (narrowband). \subsection{Pulsed low-gain regime}\label{PDC-PLG} \begin{figure}[tb] \begin{center} \includegraphics[width=0.9\columnwidth]{fig5.png} \end{center} \caption{(Color online) Parametric down conversion. Left: one pump photon with frequency $\omega_{p}$ and wavevector $\mathbf{k}_{p}$ is converted into two lower energy photons $\omega_{s}, \mathbf{k}_{s}$ and $\omega_{i},\mathbf{k}_{s}$. Right: detection via the the single-photon counting module (SPCM) after spatial and spectral filtering (F) in the idler channel projects the signal channel into the state $\hat{\rho}_{s}$ which approaches a pure single-photon state when the filter bandwidth is much smaller than the pump bandwidth.} \label{SPDCFIG} \end{figure} The two photons, called idler and signal, and the original pump one satisfy energy and momentum conservation, which are expressed in the \textit{phase-matching} conditions $\omega_{p}=\omega_{s}+\omega_{i} $ and $\label{PM2}\mathbf{k}_{p}=\mathbf{k}_{s}+\mathbf{k}_{i}$. The symbols $\omega_{p,s,i}$ denote the pump, signal and idler frequencies and $\mathbf{k}_{p,s,i}$ the corresponding wave vectors. The two expressions ensure that the two down-converted photons are correlated in momentum and energy, but these attributes are not defined for either of them until a measurement is performed on the other one. These features, together with the simultaneous emission within the pump coherence time, cause the two photons to exhibit non-classical behaviour. The process of parametric down-conversion can be studied in the interaction picture \begin{equation} H_{I}(t)=\chi^{(2)}\int_{V}E^{(-)}_{s}(\mathbf{r},t)E^{(-)}_{i}(\mathbf{r},t)E^{(+)}_{p}(\mathbf{r},t)\dd ^{3}\mathbf{r}+h.c. \end{equation} where $\chi^{(2)}$ is the second-order electric susceptibility of the crystal and $E^{(-/+)}_{p,s,i}(\mathbf{r},t)$ are the negative/positive part of the pump, signal, idler fields. Using a plane-wave decomposition, the idler/signal field is quantized in each spatial-spectral component $ (\mathbf{k}_{s,i},\omega_{s,i})$, and the amplitude of the classical pump beam is denoted as $\mathcal{E}^{(+)}_{p}(\mathbf{k}_{p},\omega_{p})$. Assuming weak interaction, the solution for the state in the signal and idler channels can be expressed in terms of Dyson series \citep{Sakurai1994}, which we write up to the first order: \begin{align}\label{dyson} \vert\psi(t)\rangle & =\ket{\mathbf{0,0}}_{si} -\frac{i}{\hbar}\int_{0}^{t}H_{I}(t')\ket{\mathbf{0,0}}_{si}\dd t'+\ldots\\ \nonumber = & \ket{\mathbf{0,0}}_{si}+\int \phi(k_{s},k_{i}) \, \ket{1}_{k_s}\ket1_{k_i}\dd k_s \dd k_i+\ldots \end{align} where we used a single symbol $k=(\mathbf{k},\omega)$ for the spatial and spectral component and $\ket1_{k_{s,i}}$ is the state containing a single photon in the mode $k_s$ of the signal or $k_i$ of the idler channel and vacuum elsewhere. The second term in the above equation describes the simultaneous emission of one photon in the idler and in signal channel is sometimes called biphoton; its spatial and spectral properties are described by the function $\phi(k_{s},k_{i})$ which depends both on the pump spatial and spectral distribution and on the phase-matching term related with the crystal properties. Higher-order terms describes the less probable processes with two and more photons in each channel. Heralded single photon preparation in the signal channel can be described by the projection \cite{Aichele2002} \begin{equation} \label{SP-spdc1} \hat{\rho}_{s}={\rm \, Tr }\, _{i} \lbrace \hat{\rho }_{i}\vert \psi(t)\rangle \langle\psi(t)\vert \rbrace \end{equation} where ${\rm \, Tr }\, _{i}$ is the trace taken over the trigger states (idler) and $\hat{\rho}_{i}$ is the state ensemble selected by the filters $T(k_i)$: \begin{align} \hat{\rho}_{i}&= \int \; T(k_{i} ) \; _{k_i}\hspace{-1mm}\langle 1|\psi(t)\rangle \langle\psi(t)|1\rangle_{k_i}\dd k_i\\ \nonumber &= \iiint T(k_{i} )\phi(k_{s},k_{i})\phi^*(k'_{s},k_{i}) |1\rangle_{k_s\,k_s'}\hspace{-1mm}\langle 1|\dd k_i\dd k_s\dd k_s'. \end{align} The state purity of the generated heralded photon depends on the ratio between the filter bandwidth and the characteristic width of the function $\phi(k_{s},k_{i})$; generally, narrowband filtering is required [Fig.~\ref{fig:filter}(a,b)], in which case the spectrum of the heralded photon largely replicates that of the pump. However, if the SPDC configuration is such that the biphoton spectrum is separable, i.e.~$\phi(k_{s},k_{i})=\phi_s(k_{s})\phi_i(k_{i})$, the state of the signal photon is independent of the filtering conditions [Fig.~\ref{fig:filter}(c)]. This is a highly desired condition because it permits eliminating the filtering in the idler channel altogether, thereby greatly enhancing the heralded photon production rate. For the first time, this condition has been achieved in \cite{Mosley2008}. \begin{figure}[tb] \begin{center} \includegraphics[width=\columnwidth]{filter} \end{center} \caption{(Color online) Filtering of the idler channel for heralded preparation of the signal photon. The contour plots show the biphoton spectra $\phi(k_{s},k_{i})$. a) Broadband filtering results in a non-pure state. b) Narrowband filtering produces the heralded photon in the pure state, with the spectrum resembling that of the pump. c) If the biphoton is separable, the state of the signal photon is independent of the filtering conditions. } \label{fig:filter} \end{figure} The probability of producing one biphoton in one pump pulse is $\label{prob1phot}p_{1}=\langle \psi_{1}|\psi_{1}\rangle= \int |\phi(k_{s},k_{i})|^{2}\dd k_{s}\dd k_{i}$. The larger the parametric gain, the higher the success rate of generating the heralded photon, provided that the number of photons in the trigger mode can be precisely determined. If a detector that cannot discriminate the exact photon number is used, the gain must be sufficiently low in order to reduce the probability of generating several photons in the signal mode, instead of only one. \subsection{Continuous regime} Besides the pulsed regime considered in the previous section, continuous-wave squeezed light generated by an optical parametric oscillator (OPO) offers excellent sources for non-Gaussian operations with high state purity. Compared to pulsed experiments, cw squeezed states produced by OPOs have much narrower spectral bandwidths (of the order of a few MHz rather than a few THz). This requires the use of optical cavities and makes the experimental control more involved but, as a pay-off, all states are prepared in very well-defined spatial and spectral modes. This allows one to reach very high purities for the prepared states, and to detect them with almost unity homodyne efficiency. The use of cw squeezed light for quantum information was triggered by seminal papers on quantum teleportation \citep{Braunstein1998,Furusawa1998}, and subsequently extended to the non-Gaussian realm. In this section we review important non-Gaussian operations in the cw regime. \subsubsection{CW squeezed state} Figure \ref{fig.cw_sq_st_time_domain} depicts a cw squeezed beam generated by a typical scheme (bow-tie cavity) of OPO. It has a Lorentzian spectral shape. The OPO is driven by a cw pump beam at an angular frequency $2\omega_0$. A cw squeezed beam is generated at the frequency $\omega_0$. Continuous-variable squeezed states are typically described in the frequency domain, because they are generated by a narrow-band-limited OPO. On the other hand, a photon detection event occurs at a specific moment in time, and is hence best treated in the time domain. Therefore, in order to develop the theory of preparing non-Gaussian states from cw squeezing, we need to establish the connection between these approaches \cite{Sasaki2008b,Lvovsky2015}. The frequency-dependent field operators obey the continuum commutation relation \begin{equation} \label{continuum commutation relation in frequency} [\hat a(\omega_0+\Omega), \hat a^\dagger(\omega_0+\Omega')] =2\pi\delta(\Omega-\Omega'). \end{equation} These operators are related to the time-dependent field operator as \begin{equation} \hat a(t)=\frac{1}{2\pi}\int_{-\infty}^{\infty} d\Omega \; \hat a(\omega_0+\Omega) \; e^{-i(\omega_0+\Omega)t}. \label{eq.01} \end{equation} The operator $\hat a(t)$ is defined in the interval $(-\infty,\infty)$ and obeys the commutation relation \begin{equation} \label{continuum commutation relation in time} [\hat a(t), \hat a^\dagger(t')]=\delta(t-t'). \end{equation} Squeezed light fields can be conveniently described in the rotating frame about the center frequency $\omega_0$, \begin{equation} \label{operator in rotating frame} \hat A(t)=\hat a(t) e^{i\omega_0t} = \frac{1}{2\pi}\int_{-\infty}^{\infty} \hat A(\Omega) \; e^{-i\Omega t}\dd\Omega \end{equation} where $\hat A(\Omega)=\hat a(\omega_0+\Omega)$. This angular frequency $\Omega$ is the variable for the side-bands around the center frequency $\omega_0$, within the OPO bandwidth. The single-mode squeezing process can be described by a unitary operator, and the pure cw squeezed state is represented as $\hat S \ket{\mathbf{0}}$ with \begin{equation}\label{Squeezing operator S_{A}} \hat S =\mathrm{exp} \Biggl( \int_{-\infty}^{\infty} r(\Omega) \biggl[ \hat A(\Omega)\hat A(-\Omega) - \hat A^\dagger(\Omega)\hat A^\dagger(-\Omega) \biggr]\dd\Omega \Biggr), \end{equation} where $r(\Omega)=r(-\Omega)$ is a real squeezing parameter and $\ket{\mathbf{0}}$ is the tensor product of vacuum states in all temporal modes. That is, continuous single-mode squeezing in the time domain corresponds to two-mode squeezing in the frequency domain applied to the continuum of pairs of modes at frequencies $(\Omega,-\Omega)$. Its spectrum is determined by the cavity characteristics of the OPO, and in the idealized lossless limit, it is given by \citep{Walls2008}: \begin{equation}\label{SqSpectrum} \mathrm{exp}\left[ r(\Omega) \right] \equiv \sqrt{ \frac{(\zeta_0+\epsilon)^2+\Omega^2} {(\zeta_0-\epsilon)^2+\Omega^2} }, \end{equation} where $\zeta_0$ corresponds to the OPO resonant bandwidth and the value of $\epsilon$ is proportional to the non-linear $\chi^{(2)}$ coefficient and the pump field amplitude; the OPO ocillation threshold corresponds to $\epsilon=\zeta_0$. On the other hand, for $\epsilon\ll\zeta_0$, Eq.~(\ref{SqSpectrum}) becomes $r(\Omega)\approx4\zeta_0\epsilon/(\zeta_0^2+\Omega^2)$. Thus, in the limit of low squeezing, the cw squeezed state has a Lorentzian spectrum with the characteriztic band $[-\zeta_0,\zeta_0]$. The Bogoliubov transformation associated with this squeezing is \begin{equation} \label{Bogolubov transformation by S_{A}} \hat S^\dagger \hat A(\Omega) \hat S =\mu(\Omega) \hat A(\Omega) +\nu(\Omega) \hat A^\dagger(-\Omega), \end{equation} where, as per Eq.~\eqref{EqAAdagOPA}, \begin{eqnarray} \label{cosh and sinh} \mu(\Omega) = \cosh r(\Omega), \nonumber \; \; \; \nu(\Omega) = -\sinh r(\Omega). \end{eqnarray} For two-mode squeezing, Eqs.~(\ref{Squeezing operator S_{A}}) and (\ref{Bogolubov transformation by S_{A}}) take the form \begin{align}\label{Squeezing operator S2_{A}} &\hat S_{si}\\ \nonumber &=\mathrm{exp} \Biggl( \int_{-\infty}^{\infty} \frac{r(\Omega)}2 \biggl[ \hat A_s(\Omega)\hat A_i(-\Omega) - \hat A_s^\dagger(\Omega)\hat A_i^\dagger(-\Omega) \biggr]\dd\Omega \Biggr) \end{align} and \begin{equation} \label{Bogolubov transformation by S2_{A}} \hat S_{si}^\dagger \hat A_{s,i}(\Omega) \hat S_{si} =\mu(\Omega) \hat A_{s,i}(\Omega) +\nu(\Omega) \hat A_{i,s}^\dagger(-\Omega), \end{equation} where the signal $s$ and idler $i$ are two modes that are distinguistable either spatially or in polarization. In a practical setting, the above pure-state treatment needs to be modified by including imperfections of losses and noises, which results in the output squeezed state becoming mixed and losing its minimum-uncertainty nature. \begin{figure}[tb] \centering {\includegraphics[width=0.95\linewidth]{fig6} \caption{(Color online) Left: OPO cavity preparing a cw squeezed vacuum state. Right: a photon detection event at time $t_1$ conditionally prepares a (squeezed) single photon in the temporal mode $\psi(t-t_k)$. } \label{fig.cw_sq_st_time_domain}} \end{figure} \subsubsection{Heralded photon preparation} \label{cwHeraldedSec} Next, we consider heralded preparation of the photon in the low-gain regime, i.e.~the same problem as in Sec.~\ref{PDC-PLG}, but for the cw regime. In the case of low gain, we start with the two-mode squeezed vacuum $\hat S_{si}\ket{\mathbf{0,0}}_{si}$ and decompose the exponent in Eq.~\ref{Squeezing operator S2_{A}} to the first order. We find \begin{align}\label{cwSq} \hat S_{si}\ket{\mathbf{0,0}}_{si}&\\ \nonumber &\hspace{-1cm}=\left(\mathbb{I} -\int_{-\infty}^{\infty} \frac{r(\Omega)}2\biggl[\hat A_s^\dagger(\Omega)\hat A_i^\dagger(-\Omega)\biggr]\dd\Omega \right)\ket{\mathbf{0,0}}_{si} \end{align} Now suppose a photon is detected in the idler mode at the moment $t_1$. The state of this photon can be written as $\hat A_i^\dag(t_1)\ket{\mathbf{0}}_i$, so the projection onto that state will prepare the following state of the signal: \begin{align}\label{} _i\hspace{-1mm}\bra{\mathbf{0}}\hat A_i(t_1)\hat S_{si}\ket{\mathbf{0,0}}_{si}&\\ \nonumber &\hspace{-2cm}=\frac1{2\pi}\int_{-\infty}^{\infty} \frac{r(\Omega)}2 \hat A_s^\dagger(\Omega) \; e^{i\Omega t_1}\dd\Omega\ket{\mathbf{0}}_s=A_1^\dagger\ket{\mathbf{0}}_s, \end{align} where \begin{align} \label{A_1a} \hat A_1^\dagger&=\frac{1}{4\pi}\int_{-\infty}^{\infty} e^{i\Omega t_1} \frac{r(\Omega)}2 \hat A_s^\dag(\Omega) d\Omega \\&=\frac12\int_{-\infty}^{\infty} \hat A^\dagger(t) \psi (t-t_1) \dd t,\label{A_1a2} \end{align} with \begin{equation} \label{psi(t)a} \psi (t-t_1)=\frac{1}{2\pi} \int_{-\infty}^{\infty} e^{-i\Omega (t-t_1)} r(\Omega) \dd\Omega . \end{equation} We see that the state of the signal mode is a single photon in the temporal mode given by Eq.~\ref{psi(t)a} \citep{Lund2004,Suzuki2006}. This mode is a two-sided exponential centered at $t_1$: \begin{equation}\label{cwTempMode}\psi (t-t_1)\propto e^{-\zeta_0 \vert t-t_1\vert} \end{equation}because the function $r(\Omega)$ approaches Lorentzian in the limit of low squeezing (Fig.~\ref{fig.cw_sq_st_time_domain}). In deriving the above results, we assumed that the time moment $t_1$ of the heralding event is known precisely. In fact, the heralded wavepacket is incoherently smeared over the time interval $T$ that is equal to the uncertainty of that event. However, as long as this uncertainty is significantly below the width of that wavepacket, i.e.,~$\zeta_0T\ll1$, it can be neglected \citep{Sasaki2006}. This is indeed the case in a typical cw experiment. Unless the heralding photon is deliberately subjected to spectral filtering, typically $\zeta_0\sim30\times 10^6$\,s$^{-1}$ whereas $T\lesssim$1\,ns for photon counting modules based on silicon avalanche photodiodes), thus $\zeta_0T\sim0.03$, resulting in a high-purity heralded mode. In contrast, the short pulse scheme typically has $\zeta_0\sim10^{12}$\,s$^{-1}$, so $\zeta_0T\sim10^3$, therefore narrow filtering in the trigger channel is required as discussed in the previous section. \subsubsection{Photon subtraction from squeezed vacuum} Let us now analyze a more complex case of subtracting a single photon from a cw single-mode squeezed vacuum by means of a low-reflectivity beam splitter and a SPCM, as described in Sec.~\ref{ScCatTheoSec}. Detecting a trigger signal at $t=t_1$ is equivalent to applying the annihilation operator $\hat A(t_1)$ to the state $\hat S_A \ket{\mathbf{0}_{A}}$. Using the unitarity of the squeezing operator, we write \begin{align}\label{} \hat A(t_1)\hat S \ket{\mathbf{0}}&=\frac{1}{2\pi}\int_{-\infty}^{\infty} \; e^{-i\Omega t_1} \hat A(\Omega) \hat S \ket{\mathbf{0}} d\Omega\\ &=\frac{1}{2\pi}\int_{-\infty}^{\infty} \; e^{-i\Omega t_1}\hat S\hat S^\dag \hat A(\Omega) \hat S \ket{\mathbf{0}} d\Omega\nonumber \end{align} Now substituting the Bogoliubov transformation \ref{Bogolubov transformation by S_{A}}, we find \begin{equation}\label{ASA0A} \hat A(\Omega) \hat S \ket{\mathbf{0}} =\hat S\hat S^\dag\hat A(\Omega) \hat S \ket{\mathbf{0}} =\hat S \hat A_1^\dag \ket{\mathbf{0}}, \end{equation} where the mode operator $\hat A_1^\dag$ is given by Eq.~(\ref{A_1a2}) with the mode function \begin{equation} \label{psi(t)} \psi (t-t_1)=\frac{1}{2\pi} \int_{-\infty}^{\infty} e^{i\Omega (t-t_1)} \nu(\Omega) d\Omega . \end{equation} In other words, in the case of finite squeezing, the conditionally prepared state is the squeezed single photon in the temporal mode (\ref{psi(t)}) and squeezed vacuum in other temporal modes. Although we are no longer working in the limit of infinitesimal squeezing, the temporal mode is typically well approximated by Eq.~(\ref{A_1a2}). This interpretation is only approximate because the operator $\hat S_A$, given by Eq.~(\ref{Squeezing operator S_{A}}), is frequency dependent, so different spectral modes of the single photon $\hat A_1^\dag\ket{\mathbf{0}_{A}}$ in Eq.~(\ref{ASA0A}) are squeezed differently \citep{Yoshikawa2007}. This leads to effective detection efficiency losses that are insignificant for small squeezing. This issue can be addressed, for example, by spectrally filtering the heralding photon with a linewidth that is much narrower than that of the squeezing cavity \citep{Asavanant2017}. The typical feature of the cw scheme, $\zeta_0T\ll1$, leads not only to the ideal mode preparation condition, but also to a regime where multiple photons can be subtracted within the coherence time of the squeezed light, because the trigger photon counting has a faster temporal resolution than the OPO time scale. This provides rich physics in the time domain, which we discuss in Sec.~\ref{PhotonSubExpSec}. \vskip 1 cm \part{Results \& analysis} \label{Results} \section{Production and tomography of Fock states} The first tomographic reconstruction of a single-photon Wigner function was realized in the 1.6-picosecond pulsed regime \citep{Lvovsky2001}, by heralding on a biphoton prepared via low gain SPDC (Sec.~\ref{PDC-PLG}). All experimental imperfections in the generation stage (e.g. limited state-purity given by the finite filter bandwidth in the idler channel, and dark counts of the single photon counter) and in the detection process (e.g. optical losses, detector electronic noise and mode-mismatch between the LO and the signal field) led to a global efficiency $\eta=0.55$. In this first experiment the mode-locked pulse repetition rate was lowered from the $\sim$80MHz to $\sim$800kHz by means of a pulse picker because the bandwidth of the homodyne detector was too low to discriminate consecutive pulses. Afterwards high-frequency bandwidth homodyne detectors for fast states analysis were developed (Sec.~\ref{Homodynedet}) allowing the generation and analysis of quantum states at the full laser repetition rate. A 0.3 nm bandwidth interference filter in the trigger channel was used to make the signal photons sufficiently pure (Fig.~\ref{fig:filter}(b)) and to make their mode match that of the maser laser which cold then be used as the LO for homodyne detection \cite{Aichele2002}. Single-photon states can also be conditionally prepared using cw OPAs, where the spontaneous parametric down conversion occurs in a cavity \citep{Nielsen2007c}. The output state of an OPA operating far below threshold is a two-mode squeezed state described by Eq. (\ref{Squeezing operator S2_{A}}) which, in the ideal case, corresponds to a spontaneous parametric down conversion emission in a well-defined spatial and temporal mode. One possible configuration is the non-degenerate Type-I OPA, where the signal and idler photon are emitted in two distinct frequency modes $\omega_+$ and $\omega_-$, separated by one cavity free spectral range \citep{Neergaard-Nielsen2007}. In this case the idler photon is split from the signal by a cavity which is resonant only with the idler field, and then transmitted and strongly filtered by subsequent cavities in order to suppress the contributions from neighbouring uncorrelated cavity modes. Otherwise, in the degenerate Type-II scheme the two channels have the same frequency but different polarizations \citep{Morin2012}, and the signal and idler channel are separated by a polarizing beam splitter before going into the detection stages. The detection of the idler photon on an avalanche photodiode triggers the homodyne acquisition in the signal channel, which is done by integrating the photocurrent acquired with a continuous local oscillator over time with the weight corresponding to the detection mode \cite{Neergaard-Nielsen2006,Lvovsky2009,Wakui2007}: \begin{equation} \label{IntCWmode} \hat x_1(t_1)\equiv \int_{t_1-T'/2}^{t_1+T'/2} \psi(t-t_1) \hat x(t) dt. \end{equation} Here $t_1$ is the idler detection event time, $ \psi(t-t_1)$ is the double-sided exponentially-decaying temporal mode in which the photon is prepared (see Sec.~\ref{cwHeraldedSec}) and $T'$ is the acquisition period of homodyne signals around the trigger, which must be larger than the duration of that mode. In a typical experiment, the quadrature data $x(t)$ is first acquired with a transient digitizer and then the convolution (\ref{IntCWmode}) is calculated off-line. An elegant variant of this calculation has been implemented in \cite{Ogawa2016,Asavanant2017}: it was performed in an analog, rather than digital, fashion, by means of a custom designed electronic circuit with the response function that is equal to $\psi(t)$. Then one can observe the quadrature $x_1(t_1)$ in real time on the oscilloscope screen, so the momentary quadrature statistics at the trigger event moment corresponds to the state of interest. \begin{figure}[!h] \begin{center} \includegraphics[width = 7cm]{fig7a.png} \vskip 2.5mm \includegraphics[width = 7cm]{fig7b.png} \vskip 2.5mm \includegraphics[width = 7cm]{fig7c.png} \end{center} \caption{ (Color online) Experimental quadrature distributions, reconstructed density matrix elements and Wigner function of Fock states. From top to bottom: single-photon \citep{Morin2012}, two-photon \citep{Ourjoumtsev2006b}, and three-photon states \citep{Cooper2013b}} \label{Focktom} \end{figure} The conditional scheme in the parametric process can produce higher number states, even though the success rate decreases exponentially with the photon number. Until now, up to three-photon Fock states have been generated and analyzed by tomographic techniques, as shown on Fig.~\ref{Focktom}. The two-photon state has been generated by conditioning on coincident two-photon detections in the idler channel, both with the pulsed non-degenerate parametric amplifier scheme \citep{Ourjoumtsev2006b} and with the cw approach \citep{Zavatta2008}. Three-photon Fock states have been created similarly by conditioning on triple coincidences \citep{Cooper2013b}. The latter experiment took advantage of the pulsed SPDC configuration with a separable biphoton [Fig.~\ref{fig:filter}(c)], eliminating the need for spectral filtering in the trigger channel and dramatically increasing the heralding rate. Besides the conditional preparation on spontaneous parametric down conversion process, which produces the purest number-states in a well-defined spatio-temporal mode (fidelity larger than $ 90 \% $), techniques based on atomic ensembles have been thoroughly investigated in order to produce single photons which are compatible with atomic memories in both their bandwidths and central frequencies \citep{Laurat2006,Simon2007}. Experimental efforts made these sources efficient enough to analyze them by homodyne tomography and obtain a complete characterization of the state in a well-defined spatio-temporal mode \citep{MacRae2012,Bimbard2014,Brannan2014}. \section{Photon addition and subtraction in experiments}\label{AssSubSec} In Sec.~\ref{NonGauss:PhotonCount}, we discussed the heralded implementation of the photon subtraction ($\hat a$) and addition ($\hat a^\dag$) operators. The experimental realization of these schemes opened many interesting scenarios for non-Gaussian states and photonic operation engineering, as well as for testing fundamental quantum mechanical effects, which we discuss next. While the photon subtraction operator can be realized by means of a linear optical ``tapping" scheme [Fig.~\ref{FigAlexei:PrincipePhotSubtractAdd}(a)], the realization of the photon addition operator is more complicated and involves SPDC [Fig.~\ref{FigAlexei:PrincipePhotSubtractAdd}(b)]. The first experiment on photon addition to a non-vacuum state (specifically, the coherent state) was made by \textcite{Zavatta2004b}. In this experiment, the ability of this operation to convert a classical state into a non-classical one is evidenced by the transformation of the Wigner function, which loses its Gaussian shape and acquires negative values. Later, single-photon added thermal states (SPATs) were generated and tomographically reconstructed. SPATs possess non-classical features such as negative Wigner functions, but these features become harder to detect for input states with higher mean photon numbers. SPATs have been therefore used as a benchmark for testing different nonclassicality criteria which can be applied to experimental data in order to assess the quantum character of the generated states \citep{Thadd2007}. SPATs are also interesting as non-classical states whose P function may be negative but regular, which permits direct experimental reconstruction of that function \citep{Kiesel2008}. Combined in the same experimental setup, sequences of the photon addition and subtraction operators permit implementing complex quantum state engineering \citep{Jeong2014,Morin2014} as well as useful protocols \citep{Zavatta2011,Coelho2014}. By conditioning on coincident photon detections in various heralding channels, it is possible to implement an arbitrary function of the two operators \citep{Fiurasek2009}. This can be useful, in particular, to realize noiseless amplification (Sec.~\ref{section:NLA}) or simulate Kerr nonlinearities (Sec.~\ref{QCompSec}). However, the increasing number of implemented operations has to be paid for by a decreased success rate of the whole process. \begin{figure}[tb] \begin{center} \includegraphics[width=\columnwidth]{fig8} \end{center} \caption{(Color online) a) Scheme for implementing sequences of single photon subtraction and addition operators. By observing a coincidence between the first two stages the $\hat{a}^{\dag}\hat{a}$ operation is realized, while a coincidence of the last two stages implements the $\hat{a}\hat{a}^{\dag}$ operator. b) Superposition of the two sequences can be achieved by indistinguishably observing an event from one of the two photon-subtraction operations.} \label{addsubsc} \end{figure} In \textcite{Parigi2007}, the two sequences $\hat{a}\hat{a}^{\dag}$ and $\hat{a}^{\dag}\hat{a}$ were applied to thermal states in order to test the bosonic commutation rules. To that end, three different stages have been concatenated, by placing two single-photon subtraction setups (each composed of a half-wave plate and a polarizing beam splitter, with an APD in the reflected channel) before and after photon-addition arrangements (composed of the parametric crystal with an APD in the trigger channel), as shown on Fig.~\ref{addsubsc}(a). By conditioning on a coincidence click from the photon addition state and one of the photon subtraction stages, it is possible to implement the two operators in either sequence. The double-click conditioned state is then analyzed by homodyne detection. The evident difference (see Fig.~\ref{comm}) between the reconstructed Wigner functions of the states resulting from the two sequences applied on a thermal state shows that $\hat{a}\hat{a}^{\dag} \neq \hat{a}^{\dag}\hat{a} $ \citep{Parigi2007}. \begin{figure}[tb] \begin{center} \includegraphics[width=0.8\columnwidth]{fig9} \end{center} \caption{(Color online) Left: Wigner function of a thermal state. Right: the two Wigner functions after the $\hat{a}\hat{a}^{\dag}$ and the $\hat{a}^{\dag}\hat{a}$ sequences have been applied to that state, showing that the two operations do not commute \citep{Parigi2007}.} \label{comm} \end{figure} A complete quantitative test of the commutation relation $[\hat{a},\hat{a}^{\dag}]=\hat{\mathbb{I}}$, was performed using the scheme in Fig.~\ref{addsubsc}(b), where the heralding fields of the two photon-subtraction stages interfere on a $50:50$ BS \citep{Zavatta2009}. When the photon detector after the BS clicks, it is not possible to know which photon-subtraction has been performed. The double event from this detector and that in the addition stage heralds the superposition of operators $\hat{a}\hat{a}^{\dag}- \textit{e}^{i \varphi} \hat{a}^{\dag}\hat{a}$, where $\varphi$ is the relative phase of the two interfering subtracted photons that can be controlled with a piezo-actuated mirror. \begin{figure}[tb] \begin{center} \includegraphics[width=\columnwidth]{fig10.png} \end{center} \caption{(Color online) a) Wigner function of an initial thermal state and the resulting states after applying the commutator and the anti-commutator sequences of creation and annihilation operators. b) histogram of the raw quadrature data (solid dots) for the anticommutator operation output state with theoretical curves for different values of the commutator ($K= 0$: dashed orange; $K=2$: dotted green; $K= 3$: dash-dotted blue). The solid red curve is the result of the best fit to the experimental data \citep{Zavatta2009}.} \label{comm-quant} \end{figure} In particular, by setting $\varphi=0$ or $\varphi=\pi$, one can implement the commutator or the anticommutator of the creation and annihilation operators, respectively. The application of the commutator operator to a thermal state yielded a state that is largely identical to the input [Fig.~\ref{comm-quant}(a), top right], from which \textcite{Zavatta2009} concluded that this commutator is proportional to the identity: $[\hat{a},\hat{a}^{\dag}]= K\hat{\mathbb{I}}$. Importantly, because of the probabilistic nature of the implementation of the non-unitary operators $\hat a$ and $\hat a^\dag$, the above measurement does not establish the value of the proportionality constant $K$. This value can be determined by observing that the anticommutator of the creation and annihilation operators must be equal to $2\hat{a}^{\dag}\hat{a}+ K$ --- so that, when applied to the thermal state, the resulting state will depend on $K$. \textcite{Zavatta2009} subjected this state to homodyne tomography and found the measurement statistics to be consistent with $K=1$ [Fig.~\ref{comm-quant}(a, bottom right) and (b)], thus quantitatively demonstrating the bosonic commutation relation. \section{Optical ``Schr\"odinger's cat" experiments} \label{Cats} \subsection{Photon subtraction from squeezed vacuum}\label{PhotonSubExpSec} \label{Cats:1PhotSubtract} In Sec.~\ref{ScCatTheoSec}, we discusssed how the ``Schr\"odinger's cat'' states (coherent superpositions of coherent states) can be produced by means of photon subtraction from squeezed vacuum. The first attempt to implement this protocol was made in the pulsed regime by \textcite{Wenger2004a}. The Wigner function of the prepared state was clearly non-Gaussian but remained positive due to experimental imperfections. Improving the experimental apparatus allowed the same team to create ``Schr\"odinger's kittens" with $|\alpha|^2\approx 0.8$ and to observe negative values on reconstructed Wigner functions without correcting for the homodyne detection losses \citep{Ourjoumtsev2006a}. In the pulsed domain, this protocol has been implemented by several other groups \citep{Gerrits2010,Namekata2010,Tipsmark2011}. In parallel with pulsed experiments, ``kitten'' states have been generated in the cw regime, where squeezing can be generated with high purity, and detected with high efficiency. After the first demonstration by \textcite{Neergaard-Nielsen2006}, significant experimental improvements allowed \textcite{Wakui2007} to produce extremely pure photon subtracted squeezed states with strongly negative Wigner functions. This result was further improved by \citep{Asavanant2017}, where nearly perfect squeezed single photons have been demonstrated. While being relatively simple to generate, ``kitten'' states are very non-classical \citep{Kim2005,Jezek2012}: like single photons they are antibunched and present negative Wigner functions, but at the same time they are phase-dependent and may even feature quadrature squeezing. Therefore, they are an excellent benchmark for testing quantum devices such as quantum memories or quantum teleportation systems, which must operate with high coherence and low loss levels in order to preserve all of these non-classical features. An interesting twist to the technique of cat state preparation in the cw regime was realized by \textcite{Serikawa2018b}. Here the two-mode squeezing was first produced at two sidebands 500 MHz above and below the carrier (LO) frequency. Both these modes were then subjected to electro-optical modulation at the frequency of 500 MHz, resulting in a part of the optical energy from both sidebands transfered to the carrier mode. This mode was then separated from the sidebands by a set of cavities and subjected to photon detection. A click heralded the preparation of the cat state in the mode that is the sum of the two sideband modes. This cat was reconstructed using a homodyne detector that was custom designed to have a gain peak at the 500 MHz sideband frequency. As discussed in Sec.~\ref{ScCatTheoSec}, subtracting photons from the cat state increases its amplitude $|\alpha|$. Hence the task of producing larger-amplitude cat states can be solved by subtracting multiple photons from squeezed vacuum \citep{Dakna1997}. In the pulsed scheme, this was done by \textcite{Gerrits2010}, where two and three photons were simultaneously subtracted from 140-fs pulsed squeezed vacuum pulses at 861.8-nm wavelength. A superconducting transition edge sensor (TES) was used as a photon number resolving counter. Three-photon subtraction could generate a non-Gaussian state which had a fidelity $F\sim0.59$ with an ideal cat state of $|\alpha|\sim1.76$. Similar experiments with TES were done at the telecom wavelength \citep{Namekata2010}. \begin{figure}[tb] \centering {\includegraphics[width=0.8\linewidth]{fig12} \caption{(Color online) Two-photon subtraction from the cw squeezed state. Small fraction of squeezed beam is tapped, and directed to two APDs via a 50:50 BS.} \label{fig.2-ph_subtraction_from_cw_sq}} \end{figure} In the cw scheme, multiple photons can be subtracted at different times within the coherence time of the squeezed light, which provides rich physics in the time domain \citep{Sasaki2008b,Takeoka2008,Takahashi2008}. Suppose that one photon is subtracted at $t=t_1$ and another one at $t=t_2$, as in Fig.\ref{fig.2-ph_subtraction_from_cw_sq}. Depending on the relation between the time-separation $\Delta\equiv|t_2-t_1|$ and the coherence time scale $\zeta_0^{-1}$, three regions can be identified. (i) $\Delta \ll \zeta_0^{-1}$ where the two-photon subtraction takes place in a single mode, producing a small even-number cat state as originally proposed by \cite{Dakna1997}. (ii) $\Delta\sim\zeta_0^{-1}$ where the two packets overlap with each other, and nontrivial interference occurs. (iii) $\Delta\gg\zeta_0^{-1}$ where two small odd-number cat states are generated in separated packets $\psi(t-t_1)$ and $\psi(t-t_2)$. Each cat state is the squeezed single-photon state as described in the previous subsection. In the intermediate region (ii), there is a crossover between (i) and (iii), and both even- and odd-number cat states exist, being entangled over the two modes. To study this entanglement, \cite{Sasaki2008b} introduced the ``biased" orthonormal set consisting of the symmetric and antisymmetric modes, whose temporal shape is given by (Fig.~\ref{fig.PsiP_PsiN_psi1_psi2}) \begin{equation}\label{biased} \Psi_\pm(t)=\frac{\psi(t-t_2)\pm\psi(t-t_1)}{\sqrt{ 2\left( 1\pm I_\Delta \right) } }, \end{equation} where \begin{equation} I_\Delta\equiv\int_{-\infty}^{\infty} \psi(t-t_1)\psi(t-t_2)\dd t\approx ( 1+\zeta_0\Delta )e^{-\zeta_0\Delta}. \end{equation} \begin{figure}[tb] \centering {\includegraphics[width=0.7\linewidth]{fig13} \caption{(Color online) Temporal shape of the biased modes. $\Psi_+(t)$ is symmetric, while $\Psi_-(t)$ is antisymmetric.} \label{fig.PsiP_PsiN_psi1_psi2}} \end{figure} \begin{figure*} \centering {\includegraphics[width=0.8\linewidth]{fig19} \caption{(color online) Amplitude enhancement of a cat state in the symmetric mode $\hat A_+$ by controlling the time separation $\Delta$. The top panels show the temporal shape of $\Psi_+(t)$. The middle panels are the experimental Wigner functions. The bottom panels are their contour plots. From left to right the time separation is increased, and the amplitude of the generated state gradually increases accordingly. For $\Delta\,=\,$32\,ns, the negative dips are observed at the sides of the origin \citep{Takahashi2008}. The OPA linewidth is $\zeta_0=2\pi\times$ 4.5 MHz. } \label{fig.Cat_breeding}} \end{figure*} $\Psi_+(t)$ is the mode that extracts the features emerging due to the overlap of the packets $\psi(t-t_1)$ and $\psi(t-t_2)$, while $\Psi_-(t)$ is the mode that extracts the differential features of these localized packets. The field operators in the biased modes are defined by \begin{equation} \label{signal mode field} \hat A_\pm \equiv \int_{-\infty}^{\infty} \hat a(t) \Psi_\pm(t) \dd t. \end{equation} By replacing the order of the squeezing and the annihilation operators akin to Eq. (\ref{ASA0A}), the two-photon subtracted state can be represented as \citep{Sasaki2008b} \begin{eqnarray} \label{Two photon subtracted state in biased modes} && \hat A(t_2) \hat A(t_1)\hat S\ket{\mathbf{0}} \sim \hat S \Biggl[ \frac{1+ I_\Delta}{\sqrt2}\ket{2_+,0_-,\mathbf{0}_{\tilde A}} \\\nonumber &&\quad- \frac{1- I_\Delta}{\sqrt2}\ket{0_+,2_-,\mathbf{0}_{\tilde A}}+ \frac{\zeta_0}{\epsilon} e^{-\zeta_0 \Delta} \ket{0_+,0_-,\mathbf{0}_{\tilde A}} \Biggr], \end{eqnarray} where $\ket{\mathbf{0}_{\tilde A}}$, hereafter omitted for brevity, is the vacuum state of all modes that are orthogonal to both $\hat A_+$ and $\hat A_-$, and the squeezing operator $\hat S$ applies to all three states inside the ket. Thus the output state is generally a squeezed entangled state of the 2-photon and vacuum states over modes $\Psi_\pm(t)$ \citep{Sasaki2008b}. In the region $\zeta_0\Delta\ll1$, the wavepacket overlap $I_\Delta$ approaches unity, so the second term in Eq.~(\ref{Two photon subtracted state in biased modes}) becomes negligible and the state becomes separable: \begin{equation}\label{Two photon subtracted state in biased modes 3} \hat A(t_2) \hat A(t_1)\hat S \ket{\mathbf{0}_{A}}\rightarrow \hat S\bigg[\biggl( \sqrt{2}\ket{2_+}+ \frac{\zeta_0}{\epsilon}e^{-\zeta_0 \Delta}\ket{0_+} \biggr)\otimes \; \ket{0_-}\bigg] \end{equation} The mode $\hat A_+$ is in a squeezed superposition of the zero and two-photon states, which approximates the even cat state (Sec.~\ref{ScCatTheoSec}) while mode $\hat A_-$ is approximately in the squeezed vacuum state. The amplitude of the cat in the symmetric mode can be controlled by the OPA pumping rate, which determines the parameter $\epsilon$ and the degree of squeezing in the OPA output. However, one can also increase the quantity $\zeta_0\Delta$, which will reduce the vacuum term in the cat state. This effect has been experimentally demonstrated by \citep{Takahashi2008} (Fig.~\ref{fig.Cat_breeding}) and in \cite{Huang2016}. As the separation $\Delta$ increases, the second term in Eq.~(\ref{Two photon subtracted state in biased modes}) becomes significant and the state of the two biased modes is no longer separable. In the regime $\zeta_0\Delta\gg1$, we have $I_\Delta\ll 1$, and state takes the form \begin{equation} \label{Two photon subtracted state in biased modes 4} \hat A(t_2) \hat A(t_1)\hat S\ket{\mathbf{0}}\rightarrow \frac{1}{\sqrt{2}}\hat S\biggl(\ket{2_+,0_-}-\ket{0_+,2_-}\biggr). \end{equation} This means that, when the symmetric mode is analyzed separately, it becomes a mixture of the form $\hat S(\ketbra{2_+}{2_+}+\ketbra{0_+}{0_+})\hat S^\dag$. Equation (\ref{Two photon subtracted state in biased modes 4}) is easy to interpret. When the photon detection events are well separated, two independent squeezed single photons are produced in the wavepackets $\psi(t-t_1)$ and $\psi(t-t_2)$, so we can write \begin{equation}\label{Two photon subtracted state in unbiased modes} \hat A(t_2) \hat A(t_1) \hat S \ket{\mathbf{0}}\sim\hat S\ket{1_1,1_2} \end{equation} The biased modes are related to these wavepackets by the beam-splitter-like transformation (\ref{biased}), resulting in the Hong-Ou-Mandel effect \cite{Hong1987} visible in Eq.~(\ref{Two photon subtracted state in biased modes 4}). \subsection{Cats as even or odd photon superpositions}\label{CatsEOSec} The Hong-Ou-Mandel effect, in combination with homodyne projective measurements (Sec.~\ref{NonGauss:HomodyneProject}), has been used for the preparation of cat states in a direct fashion by \textcite{Etesse2015} as follows. Two heralded photons have been overlapped on a 50:50 beam splitter, generating the state $\ket\Psi=\frac{1}{\sqrt{2}}(\ket{2,0}-\ket{0,2})$. Subsequently a homodyne measurement of the $x$ quadrature has been applied in one of the beam splitter outputs, preparing the superposition \begin{equation}\label{Etesse}\braket x\Psi=\frac{1}{\sqrt{2}}(\braket x2 \ket 0-\braket x0 \ket 2) \end{equation}of the vacuum and two-photon states in the other channel. The inner products $\braket x0$ and $\braket x2$ are simply wavefunctions of Fock states, given by $H_n[x]\exp[-x^2/2]$ where $H_n$ is the $n$-th Hermite polynomial \citep{Walls2008}. Depending on the value $x$ of the quadrature detected in the first channel, these wavefunctions take different values, thereby determining the coefficients of the superposition (\ref{Etesse}). In particular, postselecting on the observation of $x=0$ prepares the superposition $(\ket 0+\sqrt2\ket2)/\sqrt3$ which has a 99\% fidelity with an even cat state of amplitude $\alpha=1.63$ squeezed by $s=1.52$ along the quadrature $x$ \citep{Etesse2015}. This idea was extended by \textcite{Ulanov2016} who prepared the state (\ref{Etesse}) by means of entanglement swapping. They initially used two OPAs to generate two weakly squeezed vacuum states in pairs of modes $(\hat A,\hat B)$ and $(\hat C, \hat D)$. They then overlapped modes $\hat B$ and $\hat C$ on a symmetric BS and selected for further analysis those events in which a single photon has been observed in both outputs of that BS. Because of the reversible character of the beam splitter transformation, these events projected modes $\hat B$ and $\hat C$ onto the state (\ref{Etesse}). This, in turn, prepared modes $\hat A$ and $\hat D$ in the same state thanks to the entangled nature of the two-mode squeezed state and the fact that this state carries the same number of photons in both of its channels as per Eq.~(\ref{EqStateEPR}). This approach is operational --- i.e. the state $\frac{1}{\sqrt{2}}(\ket{2,0}-\ket{0,2})$ is produced in modes $\hat A$ and $\hat D$ with high efficiency --- even if the heralding photons in modes $\hat B$ and $\hat C$ experience attenuation. Moreover, the technique can be extended to prepare a general ``N00N" state $\frac{1}{\sqrt{2}}(\ket{N,0}-\ket{0,N})$ with an arbitrary $N$. These states are useful for quantum-enhanced phase metrology \citep{Dowling2008}, and the technique of \textcite{Ulanov2016} makes it possible to prepare and use them in spite of the modes $\hat A$ and $\hat D$ being separated by a lossy medium. This method has been generalized to non-weak SPDC sources in a theoretical proposal for long-range distribution of multiphoton entanglement \cite{Mycroft2019}. The above procedures approximate even low-amplitude cats as superpositions of $\ket 0$ and $\ket 2$. But, as mentioned previously, ``usual'' cat states consist of either only even or only odd Fock components. When the amplitude of the cat is not too high, one can identify two terms that dominate in the state's Fock decomposition, while other terms are significantly lower. Accordingly, any Fock state superposition of the form $\beta\ket{n}+\gamma\ket{n-2}$, with $n$ not exceeding 3--5, approximates the cat state reasonably well. In \citep{Huang2015}, it was proposed to generate this superposition by mixing two single-mode orthogonally squeezed states on an imbalanced BS and detecting $n$ photons in one of the output modes. The other mode is then projected on a state $\beta\ket{n}+\gamma\ket{n-2}$ where $\beta$ and $\gamma$ depend on the BS's reflectivity and the squeezing. In the experiment by \textcite{Huang2015}, the above protocol was implemented for $n=2$. Two-photon detection with highly efficient superconducting single photon detectors were applied to the two-mode squeezed vacuum in a cw beam at 1064 nm, and the generated superposition states had the fidelity of 67\% to a coherent cat state with a size $|\alpha|^2=3$. \subsection{Homodyne projective measurements on Fock states } \begin{figure}[tb] \begin{center} \includegraphics[width=7cm]{fig15} \end{center} \caption{(Color online) Generation of arbitrarily large ``Schr\"odinger cat'' states. (Top) A Fock state $\ket{n}$ containing $n$ photons is divided on a $50:50$ BS, and a homodyne measurement is performed in the reflected port. When the measurement's outcome $p$ satisfies $|p|<\epsilon\ll 1$ the transmitted beam is projected into a ``cat'' state squeezed by $3$ dB, with the same parity as $n$ and with a coherent state amplitude $\alpha=\sqrt{n}$. (Bottom) Experimentally reconstructed Wigner function for a state generated with $\ket{n=2}$ \citep{Ourjoumtsev2007a}. See text for details.} \label{FigAlexei:SqzCat} \end{figure} Although multiple photon subtractions from squeezed vacuum allow one to produce cat states with increasingly large sizes, the success rate decreases and the role of the imperfections increases exponentially with the number of subtracted photons. An alternative rather simple approach \citep{Ourjoumtsev2007a} consists in preparing Fock states $\ket{n}$, sending them through a 50:50 BS, and making a homodyne measurement of the momentum quadrature $p$ in the reflected mode (Fig.~\ref{FigAlexei:SqzCat}). When the result of the measurement is $0$, the remaining transmitted beam is projected on a superposition of only even or only odd photon numbers ranging from $0$ to $n$. The resulting state closely resembles a ``Schr\"odinger's cat'' $c(\ket{\alpha}+(-1)^n\ket{-\alpha})$ with $\alpha=\sqrt{n}$, squeezed by a factor of 2 along the $x$ quadrature. Since the initial Fock state is phase-invariant, the $x$ and $p$ quadratures are actually determined by the projective homodyne measurement: by definition, the $x$ quadrature of the cat state is the one orthogonal to the quadrature measured by the heralding homodyne detector. \begin{figure}[tb] \centerline{\includegraphics[width=\columnwidth]{Catv2.png} } \caption{The experiment on ``breeeding" Schr\"odinger cats \cite{Sychev2017a}. a) Scheme. Detecting the quadrature $x\approx0$ in mode 2 heralds an enlarged cat in mode 1. b) Experimentally reconstructed density matrices and Wigner functions of the initial (left) and amplified (right) cat states, corrected for the detection quantum efficiency of 62\%. The best-fit state is $\ket{\psi_{{\rm cat},-}[1.15]}$ for the initial cat and $\ket{\psi_{{\rm cat},+}[1.18]}$ for the amplified one, squeezed by 1.74 dB (3.04 dB).} \label{BreedingFig} \end{figure} The intuition behind this technique is best seen in the quadrature basis. The unnormalized wavefunction of the initial Fock state, expressed using the momentum quadrature $p$, is $H_n[p]\exp[-p^2/2]$ where $H_n$ is the $n$-th Hermite polynomial. Mixed with a vacuum mode with the wavefunction $\exp[-p_0^2/2]$, where $p_0$ is the momentum quadrature of that mode on a 50:50 BS, the two-mode wavefunction becomes $H_n[(p-p_0)/\sqrt{2}]\exp[-(p^2+p_0^2)/2]$ according to Eq.~(\ref{EqAAdagBS}). A homodyne measurement's result $p_0=0$ leaves the transmitted beam in the state $H_n[p/\sqrt{2}]\exp[-p^2/2]$. Its expression as a function of the $x$ quadrature, obtained by a Fourier transform, is proportional to $x^n\exp[-x^2/2]$ and has double-peaked structure characteristic of a cat state. By construction, the state prepared in this manner cannot contain more than $n$ photons whereas the squeezed cat state has an infinite expansion in the Fock basis. However, neglecting experimental imperfections, the fidelity between the two states is $\mathcal{F}\approx 1-0.028/n$, already at the $99\%$ level for $n=2$ photons and increasing towards unity for larger $n$ \citep{Ourjoumtsev2007a}. In practice, a finite preparation success rate requires one to accept homodyne measurement outcomes within a narrow but finite window $|p|\leq\epsilon\ll 1$. However, the fidelity decreases only quadratically with $\epsilon$ whereas the success rate increases linearly, and, even when the probabilistic generation of resource Fock states is taken into account, this protocol is very competitive compared to others in terms of success rates and state purities. \subsection{``Breeding" larger cats from smaller ones}\label{BreedingSec} Most of the methods listed above enable the preparation of Schr\"odinger cat states of relatively low amplitudes. While this may suffice for many applications --- for example, coherent-state quantum computing, see Sec.~\ref{QCompSec}, it is also important to develop methods to prepare cat states of unlimited size. This would, in particular, help answering a fundamental question: at what degree of macroscopicity, if any, does the world stop being quantum? A practically viable technique in this context was proposed by \textcite{Lund2004}. The idea is to ``breed" larger size cat states from smaller ones my means of linear optics and conditional measurements. Suppose a pair of identical cat states $\ket{\psi_{{\rm cat},\pm}[\alpha]}=\ket\alpha\pm\ket{-\alpha}$ is made to interfere on a symmetric BS [Fig.~\ref{BreedingFig}(a)]. The BS output state is then \begin{equation} \label{eq2} \ket{\psi_{{\rm cat},+}[\sqrt{2}\alpha]}_1\ket{0}_2 \pm \ket{0}_1\ket{\psi_{{\rm cat},+}[\sqrt{2}\alpha]}_2. \end{equation} This result is readily obtained under the assumption that two identical coherent state incident on the BS experience constructive interference in the first output channel and destructive in the second: $\ket\alpha\ket\alpha\to\ket{\sqrt2\alpha}\ket 0$, whereas two coherent states of opposite amplitudes exhibit opposite behavior: $\ket\alpha\ket{-\alpha}\to\ket 0\ket{\sqrt2\alpha}$. If we now perform a measurement on mode 2 of the state \eqref{eq2} to distinguish the states $\ket 0$ and $\ket{\psi_{{\rm cat},+}[\sqrt{2}\alpha]}$, mode 1 will collapse onto either $\ket{\psi_{{\rm cat},+}[\sqrt{2}\alpha]}$ or $\ket 0$, respectively. The positive cat state of amplitude $\sqrt{2}\alpha$ can thus be conditionally prepared in mode 1. Experimentally, conditioning on the detection of the vacuum in mode 2 is challenging because a photon detector with imperfect efficiency may fail to click even if photons are present at the input. A more practical scheme was proposed by \textcite{Laghaout2013}, in which the required conditioning is realized by homodyne measurement of the position quadrature in mode 2 and looking for the result that is close to zero: $|x|<\epsilon\ll1$. For $\alpha\gg 1$, the probability of observing $x=0$ is much higher in the vacuum state than in the state $\ket{\psi_{{\rm cat},+}[\sqrt{2}\alpha]}$, as one can see by comparing the wavefunctions of these two states. The experiment by \textcite{Etesse2015}, discussed above, can be viewed as a simple realization of this proposal, with the role of input cats played by heralded single photons. In the experiment by \textcite{Sychev2017a}, two squeezed cat states of amplitude $\alpha\approx 1.15$ have been prepared by photon subtraction from squeezed vacuum. After the ``breeding" operation, the amplitude has increased to $\approx 1.85$ (Fig.~\ref{BreedingFig}). Remarkably, this operation did not significantly affect the cat's fidelity. However, the non-ideality of the heralding homodyne detection results in additional squeezing of that state. An interesting feature of the ``breeding" protocol is that its performance \emph{improves} with higher amplitudes. This is because higher amplitude cats contain lower amounts of the vacuum state and hence are more distinguishable from that state. If the homodyne heralding is used, the width of the acceptance window $\epsilon$ can be increased for higher $\alpha$ without sacrificing the state preparation fidelity. In the limit of high amplitudes, the probability of a successful heralding event tends to $\sim\frac12$, which allows the application of this protocol in an iterative fashion with a moderate exponential overhead. \subsection{Cat state qubit}\label{CatQubitSec} The opposite-phase coherent states $\ket\alpha$ and $\ket{-\alpha}$ of sufficiently high amplitude can be used to encode a qubit: \begin{equation}\label{Logical encoding} \ket{0}_L=\ket{\alpha},\quad \ket{1}_L=\ket{-\alpha}. \end{equation} This encoding has many helpful properties for both quantum communication and quantum computation, as discussed below. \textcite{Neergaard-Nielsen2010} demonstrated a technique to generate such a qubit, based on the idea of \cite{Takeoka2007}. Starting with the cw squeezed vacuum state $\hat S(r) \ket{0}$ with the squeezing parameter $r = 0.38$, which approximates the state $\ket{\psi_{{\rm cat},+}[\sqrt r]}$, they applied a superposition of the photon subtraction and identity operators using the scheme shown in Fig.~\ref{fig:AddSubGen}(a). Because the photon subtraction converts a positive cat into a negative one, the superposition of positive and negative cats (more precisely, of the cw squeezed vacuum and squeezed single photon) is generated in the output, which can be represented on a Bloch sphere as: \begin{eqnarray}\label{ket_rho(theta,varphi)} \ket{\rho(\theta,\varphi)} = \cos\frac{\theta}{2} \hat S(r) \ket{0} + e^{i\varphi} \sin\frac{\theta}{2} \hat S(r) \ket{1}. \end{eqnarray} The coefficients of this superposition can be controlled by the amplitude and phase of the auxiliary coherent state. \begin{figure}[tb] \centering {\includegraphics[width=\columnwidth]{CatQubit} \caption{(Color online) Wigner functions of measured cat qubit states \citep{Neergaard-Nielsen2010}. Red colors correspond to positive values, blue to negative. a) The Bloch sphere polar angle $\theta$ that determines the relative weights of the terms in the superposition (\ref{ket_rho(theta,varphi)}) is varied with the asimuthal angle $\phi$ fixed at 0$^{\circ}$ (left) and $-90^{\circ}$ (right). b) The azimuthal angle $\phi$ is varied while $\theta$ is fixed at 60$^{\circ}$ (left) and $135^{\circ}$ (right). } \label{fig:CatQubit}} \end{figure} The Wigner functions of the generated states are presented in Fig.~\ref{fig:CatQubit}. Fig.~\ref{fig:CatQubit}(a) shows the control of the superposition weight $\theta$, while keeping the phase constant. Conversely, Fig.~\ref{fig:CatQubit} (b) shows the control of the complex phase $\varphi$ for fixed weights of the superposition. \section{Generating arbitrary quantum states} \label{ArbStateGenSec} Mastering the quantum technology of any physical system implies an ability to prepare arbitrary quantum states of that system. There has been significant effort to develop this ability in application to light, particularly to single-mode states thereof. Existing approaches to optical quantum state engineering involve linear optics, conditional measurements, coherent states, as well as sources of nonclassical light. The role of the latter can be played by single- or two-mode squeezers, on-demand Fock state sources, or nonclassical operators such as photon addition. An arbitrary linear combination of the first $n$ Fock states can be produced by applying a sequence of $n+1$ operators of the form $x_i\hat a^\dag+y_i$ (where $i$ runs from $0$ to $n$) to the vacuum state. This is the basis of some of the first quantum state engineering proposals \citep{Dakna1999a}. A subsequent proposal \cite{Clausen2001} uses an optical feedback loop based on a ring resonator, in which a parametric amplifier is seeded with a weak coherent state and single photon detection is performed in the idler channel [Fig.~\ref{fig:AddSubGen}(b)]. Later, \textcite{Fiurasek2005} demonstrated that linear combinations $x\hat a+y$ of the photon subtraction and identity operators [Fig.~\ref{fig:AddSubGen}(a)] can be used in a similar fashion, if a high-efficiency squeezer is available as an additional resource. These schemes can be extended, with multiple photon additions and subtractions, to the engineering of quantum \emph{operations} on travelling light beams \citep{Fiurasek2009}, such as noiseless linear amplification of light and the emulation of Kerr nonlinearity. Sequential application of photon addition or squeezing operations involves transmitting the state through multiple OPAs. Such schemes would involve significant losses and are therefore not advisable in experimental practice. Instead, one can use a single non-degenerate OPA to generate a two-mode squeezed vacuum, and subsequently implement a sophisticated measurement on the idler channel to \emph{remotely prepare} the desired state in the other channel. This approach has been used to produce arbitrary coherent superpositions of Fock states up to two- \citep{Bimbard2010} and three-photon states \citep{Yukawa2013}. The measurement on the idler channel is implemented as follows. The idler channel is split into two (in \textcite{Bimbard2010}) or three (in \textcite{Yukawa2013}) modes, each of which is overlapped on a BS with an auxiliary coherent state. A single-photon detector is placed into one of the outputs of each BS, \emph{\`a la} Fig.~\ref{fig:AddSubGen}(a). A click in each detector projects the corresponding mode onto a superposition of the single-photon and vacuum states. Therefore an event in which all the detectors have clicked projects the idler channel onto a superposition of Fock states, where the coefficients of that superposition can be controlled by the amplitudes and phases of the ancillary coherent states. Due to the entanglement of the two-mode squeezed vacuum, such a projection remotely prepares the same state in the signal channel. \begin{figure}[tb] \centerline{\includegraphics[width=\columnwidth]{yukawa.pdf} } \caption{A scheme for generating arbitrary Fock state superpositions up to three photons. The desired state preparation event is heralded by a triple coincidence click of the APDs in the idler channel. NOPO, non-degenerate optical parametric oscillator; SC, split cavity; FC, filter cavity; HD, homodyne detector; APD, avalanche photo diode; HBS, half beamsplitter; HWP, half-wave plate; PBS, polarization beamsplitter; PZT, piezo electric transducer. From \cite{Yukawa2013}. } \label{YukawaFig} \end{figure} Another avenue for quantum-state engineering is to employ conditional measurements of quadratures instead of photon counting. \textcite{Lance2006} proposed and experimentally demonstrated the generation of squeezed single photons and superpositions of coherent states from input single- and two-photon Fock states, respectively, via the interaction with an ancilla squeezed vacuum state on a BS, followed by postselecting on a continuous-observable measurement outcome of the ancilla state. A ``state synthesizer" based on the iterative mixing of simple resource states of the form $x_i\ket 0+y_i\ket 1$ on a BS, followed by homodyne conditional measurements, has been proposed by \textcite{Etesse2014b}. This protocol builds the state in a piece-by-piece fashion, and potentially takes advantage of quantum memories in order to improve the success probabilities. Experimentally, \textcite{Babichev2004a} have shown that superpositions of the single-photon and vacuum states can be prepared by splitting a single photon between two modes and realizing a homodyne measurement in one of them to prepare the desired state in the other. \section{Applications to quantum communications} \subsection{From cat state ebits to quantum repeaters} \label{EntCatSec} Although the states $\ket{\alpha}$ and $\ket{-\alpha}$ are never perfectly orthogonal, their overlap $|\braket{\alpha}{-\alpha}|^2=\mathrm{e}^{-4|\alpha|^2}$ decreases very rapidly, and for $\alpha \gtrsim 1$ they can be used as a basis for encoding qubits and using them for various quantum information processing tasks \citep{Jeong2007}, in particular for long-distance quantum communications. To this end, one must be able to prepare Bell-like ``entangled cat states'' $\ket{\Phi_\pm}=c(\ket{\alpha}\ket{\alpha}\pm\ket{-\alpha}\ket{-\alpha})$ and $\ket{\Psi_\pm}=c(\ket{\alpha}\ket{-\alpha}\pm\ket{-\alpha}\ket{\alpha})$, allowing two distant partners, Alice and Bob, to share one ebit of entanglement as a resource for quantum teleportation. In principle, one can prepare the states $\ket{\Phi_\pm}$ simply by splitting a single-mode cat state $c(\ket{\sqrt{2}\alpha}\pm\ket{-\sqrt{2}\alpha})$ on a 50/50 BS, and phase-shifting one of the output modes by $\pi$ to transform $\ket{\Phi_\pm}$ into $\ket{\Psi_\pm}$. In practice, however, this approach is rather unrealistic because cat states are notoriously fragile, all the more as $\alpha$ is large. Preparing them locally and distributing them to distant sites through lossy channels will very rapidly destroy their entanglement, and though the resulting errors can in principle be corrected \citep{Glancy2008}, doing it in practice is technically challenging. \begin{figure}[tb] \begin{center} \includegraphics[width=7cm]{fig20} \end{center} \caption{(Color online) Sharing entangled ``cat'' states between distant sites. (Top) Small fractions of two independent cat states propagate through lossy optical fibers and interfere on a $50/50$ BS with a phase $\phi$. Detecting a photon in one of the output ports creates an entangled superposition of coherent states in a way relatively immune to fiber losses. Bottom: ``cuts'' of experimentally measured two-mode Wigner functions for $\alpha=0.8$ and $\phi=\pi/2$, where initial even ``kitten'' states were approximated by squeezed vacuum \citep{Ourjoumtsev2009}. } \label{FigAlexei:NonLocalCat} \end{figure} To circumvent this problem, one can transfer the loss from the cat state to the single photon used for its heralding. In the photon subtraction process, losing a photon before it reaches the detector mainly decreases the success rate, without affecting the quality of the prepared state to the lowest order. Based on this idea, a method to share entangled cat states between distant sites has been proposed by \citet{Ourjoumtsev2009}, and demonstrated experimentally using small ``kittens'' (Fig.~\ref{FigAlexei:NonLocalCat}). First, Alice and Bob independently prepare two cat states $\ket{\psi_{{\rm cat},+[\alpha]}}_{A,B}$: since these states are prepared locally, they do not suffer from propagation losses. Then, the two modes are subjected to the scheme in Fig.~\ref{fig:AddSub2mode}(a): a small fraction of each cat state is reflected and sent through the lossy quantum channel to an intermediate node (Charlie), where they interfere on a 50/50 BS. Detecting a photon in one of the output modes of this BS applies the operator $\a_A-\mathrm{e}^{i\phi}\a_B$ to the initial state $\ket{\psi_{{\rm cat}}}_{A}\ket{\psi_{{\rm cat}}}_{B}$, where $\phi$ is the relative phase of the interfering beams. Since $\a\ket{\psi_{{\rm cat},+}[\alpha]}\propto\ket{\psi_{{\rm cat},-}[\alpha]}$, this delocalized photon subtraction entangles the two distant modes and projects them into the state \begin{align*} \ket{\Psi_\phi}&=\ket{\psi_{{\rm cat},-}[\alpha]}_A\ket{\psi_{{\rm cat},+}[\alpha]}_B\\ &-\mathrm{e}^{i\phi}\ket{\psi_{{\rm cat},+}[\alpha]}_A\ket{\psi_{{\rm cat},-}[\alpha]}_B \end{align*} which reduces to $\ket{\Psi_-}$ for $\phi=0$ and to $\ket{\Phi_-}$ for $\phi=\pi$. The other pair of states ($\ket{\Psi_+}$ and $\ket{\Phi_+}$) can be generated by using initial cat states with different parities (one odd, the other even). Moreover, for $\phi\neq 0$, using this state as a resource for quantum teleportation allows one to perform phase-space rotations on the teleported qubit which are difficult to realize by other means. The above scheme has been proposed as a basis for a quantum repeater \citep{Sangouard2010,Brask2010,Brask2012b}, and has the following advantage. A necessary component of the quantum repeater is the Bell measurement, which enables the distribution of entanglement to end user parties via entanglement swapping \citep{Sangouard2011}. A Bell measurement performed on a pair of dual-rail qubits, such as the commonly used photon polarization qubit, cannot have a success probability above 50\% \citep{Vaidman1999,Lutkenhaus1999}. Therefore any quantum repeater based on such qubits will inevitably show exponential decay of the success probability with distance. With coherent-state qubits, on the other hand, one can design a Bell measurement scheme with a unit success probability \citep{Brask2010}. However, taking advantage of this feature will require nearly perfect quantum-optical memory and on-demand cat state sources, which are beyond the current technology. \subsection{Teleportation of cats Quantum teleportation is an important instrument both for quantum communications and quantum computing. The CV teleportation scheme initially proposed by \textcite{Vaidman1994} and realized experimentally in the seminal work by \textcite{Furusawa1998} enables, in principle, the teleportation of any single mode state. However, perfect teleportation requires, in addition to the elimination of all the losses, an infinitely squeezed EPR resource state. For this reason, many variations of the CV teleportation protocol \citep{Yoshikawa2007, Zhang2003,Bowen2003, Li2002, Mizuno2005} that emerged after the original experimental demonstration have been limited to Gaussian states. \begin{figure}[tb] \centering {\includegraphics[width=0.9\linewidth]{fig21} \caption{(Color online) Experimental setup for the teleportation of cats, from \textcite{Lee2011}. OPO, optical parametric oscillator; APD, avalanche photodiode; HD, homodyne detector; LO, local oscillator; EOM, electro-optical modulator; ADC, analog-to-digital converter; FC, filtering cavity. } \label{fig:Cat_teleportation_scheme} } \end{figure} Teleportation of non-Gaussian and non-classical states, i.e. cat states whose Wigner functions had negative distributions, was demonstrated by \textcite{Lee2011} using the scheme shown in Fig.~\ref{fig:Cat_teleportation_scheme}. Three OPOs were used to generate the necessary squeezed vacua. One produced a 2.4 dB single-mode squeezed vacuum state for the cat-state preparation, and the other two were for preparing the two-mode squeezed state with the measured squeezing factor of 6.9 dB. Alice received both the input cat state $\hat\rho_{\rm in}$ and one of the entangled beams, and then performed the continuous-variable Bell measurement consisting of two homodyne detectors denoted as HD1 and HD2. Bob received Alice's measurement results through the classical channels and applied the displacement operation on the other component of the entangled beam. The output state $\hat\rho_{\rm out}$ was finally evaluated by the homodyne tomography using the detector HD3. Although the three OPOs produced cw squeezed vacua, the APD click at a time $t_1$ heralded the preparations of a cat state in a wave packet of the form similar to $\psi(t-t_1)$ in Fig.~\ref{fig.cw_sq_st_time_domain}. To teleport this cat state faithfully, all operations had to be realized with less noise and with a much broader bandwidth (corresponding to the wave packet of the cat state) than in the previous CV Gaussian teleportation experiments. \begin{figure}[tb] \centering {\includegraphics[width=0.9\columnwidth]{fig22} \caption{(color online) Experimental results of teleportation of cat states by \cite{Lee2011}. Experimentally measured input state's Wigner function (a), marginal distribution (b), and photon number distribution (c. Experimentally measured output state's Wigner function (d), marginal distribution (e), and photon number distribution (f). } \label{fig:Cat_teleportation_result}} \end{figure} Experimental results are presented in Fig.~\ref{fig:Cat_teleportation_result}. As seen in the right panels, the Wigner function of the output state show a negative $W_{\rm out}(0,0) = - 0.022 \pm 0.003$. This could demonstrate successful teleportation of a highly non-classical input state ($W_{\rm in}(0,0) = - 0.171 \pm 0.003$), shown in the left panel of Fig.~\ref{fig:Cat_teleportation_result}. The teleportation fidelity was greater than the no cloning limit of 2/3 \citep{Grangier2011}. In the limit of low squeezing, the negative cat state resembles the single-photon state Fig.~\ref{fig:Cat_teleportation_result}(c,f). In this experiment, this state --- the particle of light --- was "assembled" in the output mode by Gaussian displacement operations on the electric field in one of the modes of the Gaussian EPR state. This result constitutes a remarkable illustration of wave-particle duality of quantum physics, as it cannot be explained by either the particle or wave pictures of light individually. This work has been developed further in \cite{Takeda2015}. Here, the input of the teleportation device of Fig.~\ref{fig:Cat_teleportation_result} was fed with one mode of the delocalized single-photon state $\sqrt{1-R}\ket{1,0}+\sqrt R\ket{0,1}$, obtained by splitting a photon on a BS with the reflectivity $R$. The teleported state was then verified to be entangled with the other mode of the delocalized photon. In this way, entanglement swapping between discrete and continuous variables has been implemented for the first time (\emph{cf.}~Sec.~\ref{CVDVIntSec}). \subsection{Non-deterministic amplifiers } \label{section:NLA} The performance of deterministic linear amplifiers is limited by quantum physics: quantum states cannot be amplified without introducing additional noise \citep{Caves1982,Caves2012}. This is strongly connected with the no cloning theorem \citep{Wootters1982}. Nevertheless, non-deterministic cloning \citep{Duan1998} and non-deterministic noiseless linear amplifiers are possible \citep{Ralph2009}. If we consider a single mode field $\hat E=(\hat{a}\emph{e}^{-i \omega t}+\hat{a}^{\dag} \emph{e}^{i \omega t})/\sqrt{2}$, the quantum noise can be described in term of the quadrature variance as $\Delta E^2 = (\langle \Delta x ^2 \rangle+\langle \Delta p ^2 \rangle) /2 $. In the case of a (non existing) ideal phase-independent amplifier, one would have $\hat{a}_{out}= g \, \hat{a}_{in}$ , and the signal to noise ratio would be conserved, because the signal power and the variance would be multiplied by the same factor $G=g^2$. However the requirement to conserve the bosonic commutation rules through a unitary transformation imposes including an extra operator $\hat{a}_{out}= g\hat{a}_{in}+ \hat{L}^{\dag}$ which adds to the signal variance an excess noise factor of at least $(1/2)|g^2-1|$. This bound can be reached by a NDOPA, or by a simple BS in the case $g<1$ \citep{Caves1982}. Nevertheless, it is possible to circumvent this limitation by implementing {\it non-deterministic} linear amplification \citep{Barbieri2011}. T.C. Ralph and A.P. Lund made the first proposal for the realization of such a non-deterministic noiseless linear amplifier (NLA) in 2008 \citep{Ralph2009} which has been followed by two experimental implementations in 2010 \citep{Xiang2010,Ferreyrol2010}. The scheme is displayed in Fig.~\ref{NLA}(a): the optical state to be amplified, which we assume to be a coherent state $\ket\alpha$, is divided, by using an arrangement of beam splitters, into $N$ modes each containing a coherent state $\ket{\alpha'}$ with $\alpha'\ll 1$. Each of these is sent in an amplification stage indicated by ``A''. Each amplification stage [Fig.~\ref{NLA}(b)] constitutes a modified teleportation scheme in which the delocalized single photon state is used as the entangled resource \citep{Pegg1998,Babichev2003}. This resource, given by $\ket{\Psi}=r\ket{1}\ket{0}+t\ket{0}\ket{1}$, is generated when a single photon $\ket{1}$, incident upon a beam splitter of amplitude reflectivity $r$ and transmissivity $t$, entangles itself with the vacuum $\ket{0}$. The input coherent state $\ket{\alpha'}\approx\ket 0+\alpha'\ket1$, along with one of the modes of $\ket\Psi$, is subjected to a Bell measurement in the Fock basis. Specifically, the modes are mixed at a 50:50 BS and its outputs are measured with single-photon counters. A detection event in one of the counters and the absence thereof in the other projects the two modes onto the Bell state $\frac{1}{\sqrt{2}}(\ket{1}\ket{0}+\ket{0}\ket{1})$. The state of the remaining mode of the entangled resource will then contain the teleported state. If the first BS is symmetric ($r=t=\frac1{\sqrt2}$), the teleported state is identical to the input state in terms of the vacuum and single-photon terms in its Fock decomposition; higher Fock terms of the input are ``cut off" from the output because they are absent in the entangled resource (hence this protocol is termed ``quantum scissors"). If the input coherent state is weak ($\alpha'\ll1$), its higher-order Fock terms are negligible and the teleported state is similar to the original input. \textcite{Ralph2009} observed that, if $r\ne t$, the teleported output is given by \begin{equation}\label{truncalpha} \vert 0 \rangle \pm g \alpha ' \vert 1 \rangle \approx \vert g \alpha ' \rangle, \end{equation} where $g=t/r$ and the approximation is valid if $g\alpha'\ll 1$. For $g>1$, the output is a coherent state of higher amplitude than the input, i.e. the NLA takes place. The outputs of individual amplification stages can be recombined interferometrically with the inverse arrangement of beam splitters. In this case, the desired state $\ket{g\alpha}$ will come out from one of the ports given that no photon is detected in the remaining $N-1$ ports. In this way, a coherent state of any arbitrary amplitude $\ket\alpha$ can in theory be amplified. \begin{figure}[tb] \includegraphics[width=\columnwidth]{fig25} \caption{(Color online) Noiseless amplification by means of ``asymmetric quantum scissors" \citep{Ralph2009}. a) overall scheme. b) a single amplification stage [marked ``A" in (a)] operational for low-amplitude inputs. c) Interferometric scheme of \cite{Xiang2010} to prove the noiseless character of the amplification.} \label{NLA} \end{figure} To date, only a single stage of the NLA has been implemented experimentally. The experiment realized by \textcite{Xiang2010} used one attenuated channel of a SPDC source to generate the state $ (1-k) \vert 0 \rangle \langle 0\vert + k \vert 1 \rangle \langle 1\vert $ which is very close to a phase mixed coherent state with the amplitude $|\alpha|^2=k$ and it is used as the input state of the amplifier. The other arm of the same source produces the single photon ancilla. To verify that amplification has occurred, \textcite{Xiang2010} used photon counting to compare the measured average photon number at the input and output of the amplifier stage. Linear gain up to $\vert g\vert^{2}=4$ has been realized for state with $\vert\alpha\vert$ up to $\simeq 0.04$. To verify that the gain process is coherent and does not add noise, they embedded the amplifier stage in an inbalanced Mach-Zehnder interferometer. The splitting ratio of the interferometer's initial beam splitter was set to $g^2$, such that the arms became balanced after the amplification. High-visibility fringes ovserved in this experiment showed that the noise introduced by the NLA was significantly below what would be expected from an linear amplifier with the same gain. \begin{figure}[tb] \includegraphics[width=0.82\linewidth]{fig27} \caption{(Color online) Results of the experiment by \textcite{Ferreyrol2010}. a) Reconstruction of the Wigner quasi-distributions of the amplifier outputs, for two values of $\vert \alpha\vert$. The circular shape of the coherent state is approximatively preserved for low $|\alpha|$ (left), but not for high $|\alpha|$ (right). b) Effective phase-independent gain as a function of the input state amplitude compared with the model (solid line). c) Equivalent input noise (\ref{Neq}) for three different quadratures: the average, maximal and minimal value are potted as a function of the state amplitude. } \label{NLA-exp-F} \end{figure} \textcite{Ferreyrol2010} used homodyne tomography to completely characterize the output state. The effective amplification can then be quantified by $g_{\rm eff}=\langle x_{\rm out} \rangle / \langle x_{\rm in} \rangle$ and the noise behavior of the amplifier is analyzed in terms of its ``equivalent input noise": \begin{equation}\label{Neq} N_{\rm eq}=\dfrac{\langle\delta x_{\rm out}^{2}\rangle}{g_{\rm eff}}- \langle\delta x_{\rm in}^{2}\rangle \end{equation} This figure is the quantum optical analogue to the one adopted in electronics \citep{Roch1993}, it tells how much noise must be added to the input noise level in order to mimic the observed output noise for the given gain. The value of $N_{\rm eq}$ cannot be negative for a classical amplifier, but is observed in the experimental data for $\vert \alpha \vert \lesssim 0.3 $ [Fig.~\ref{NLA-exp-F}(c)] thereby making the quantum character of noiseless amplification manifest. The use of heralded noiseless amplifiers has been proposed \citep{Gisin2010} to overcome the problem of channel losses in discrete-variables device-independent quantum key distribution and to improve the maximum transmission distance of continuous-variable quantum key distribution \citep{Blandino2012c}. Heralded noiseless photon amplification at telecom wavelengths has been tested obtaining a gain $ >100 $ associated with a heralding probability greater than $80\%$ up to a distance (in fiber) of 20 km \citep{Bruno2013}. Noiseless linear amplification of a qubit encoded in the polarization state of a single photon has also been demonstrated \citep{Kocsis2013}. Asymmetric quantum scissors is not the only possible implementation of NLA. An alternative scheme is shown in Fig.~\ref{fig:AddSubGen}(a) for $\ket\psi=\ket 1$. Indeed, the output state in this case is given by \begin{equation}\label{catalysis}(\sqrt R\hat a+\alpha)\ket 1=\sqrt R(\ket 0+\frac\alpha {\sqrt R}\ket 1)\approx\ket{\frac\alpha {\sqrt R}}, \end{equation} (where $R$ is the reflectivity of the BS and the approximation is valid for $\frac\alpha {\sqrt R}\ll 1$). In other words, the input coherent state $\ket\alpha$ is amplified by the factor $g=\frac1{\sqrt R}$. Experimentally, this scheme has been developed and experimentally realized by \textcite{Lvovsky2002}, however this paper did not interpret its result as NLA. Subsequently, this scheme has been utilized in a theoretical proposal to amplify collective states of atomic spins for quantum metrology applications \citep{Brunner2011}. Furthermore, it was used for CV entanglement distillation as discussed in the next section. A further alternative strategy to realize non-deterministic noiseless amplifiers has been proposed by \cite{Fiurasek2009} and realized by \cite{Zavatta2011}. It employs the observation that one can associate the NLA of gain $g$ with the operator \begin{equation}\label{Gg0}\hat G=g^{\hat{a}^\dag\a}. \end{equation}One can see this intuitively by applying this operator to a low-amplitude coherent state: $\hat G\ket\alpha\approx\hat G(\ket 0+\alpha \ket 1)=\ket 0+g\alpha \ket 1\approx\ket{g\alpha}$. To prove the relationship (\ref{Gg0}) rigorously, let us define a fictitious Hamiltonian $\hat H=i\hbar\hat{a}^\dag\a\ln g/\tau$, where $\tau$ is an arbitrary positive value in units of time. Then $\hat G$ is the evolution operator under this Hamiltonian for time $\tau$ because $\exp(-\frac i\hbar \tau)=\exp(\hat{a}^\dag\a\ln g)=g^{\hat{a}^\dag\a}$. On the other hand, the annihilation operator evolves in the Heisenberg picture according to $\dot{\a}=\frac i\hbar[\hat H,\a]=\ln g/\tau \hat a$, so the evolution for the time $\tau$ transforms it as follows: $\a(\tau)=\a(0)e^{\ln g}=g\a(0)$, consistent with the definition of the ideal NLA given in the beginning of this section. Decomposing $\hat G$ into the Taylor series with respect to $\hat{a}^\dag\a$ up to the first order, we find \begin{equation}\label{Gg} \hat{G}\approx(g-1){\hat{a}^\dag\a}+1=(g-2)\hat{a}^{\dag}\hat{a}+\hat{a}\hat{a}^{\dag}. \end{equation} Such combinations of the photon addition and photon subtraction operations can be realized using the methods described above in the context of Fig.~\ref{addsubsc}. The advantage of this scheme is that it is possible to realize higher amplification without reducing the fidelity with the ideal target state $\vert g \alpha \rangle$ because it is able to amplify also the higher-photon terms of the state. The results in Fig.~\ref{NLA-exp-Z} correspond to the case of $g=2$, for which the experimental setup is particularly simplified because Eq.~(\ref{Gg}) then reduces to $\hat{G}=\hat{a}\hat{a}^{\dag}$. In the experiment by \textcite{Zavatta2011}, coherent states of different amplitudes have been subjected to the sequential action of the creation and annihilation operators, and then characterized by homodyne tomography. A fidelity above $90\%$ has been reached for $\vert \alpha \vert \lesssim 0.65$ corresponding to the effective gain $g_{\rm eff}\gtrsim 1.6$. The equivalent input noise is $N_{eq}<-0.48$ for $\vert \alpha \vert \leq 1.4$. The advantage in fidelity with respect to the asymmetric scissors is visible by visually comparing the Wigner functions in Figs.~\ref{NLA-exp-F}(a) vs. \ref{NLA-exp-Z}(right column) and is quantified in Fig.~\ref{NLA-exp-F}(b). In a follow-up theoretical paper, \textcite{Park2016} proved that even better preservation of fidelity for higher-amplitude coherent states can be achieved by constructing the NLA using linear combinations of higher order products of the creation and annihilation operators. \begin{figure}[tb] \includegraphics[width=0.95\linewidth]{fig29} \caption{(Color online) Results of the experiment performed by \textcite{Zavatta2011}. Right column: reconstructed Wigner functions for three amplified coherent states of different amplitudes. Left column: a) Effective gain; b) Final state fidelity vs. the input state amplitude $\vert \alpha\vert$. Red solid curves: model of the addition/subtraction scheme \cite{Zavatta2011}; blue dashed curves: model based on the asymmetric scissors \cite{Ralph2009}. c) Measured variances (corrected for the detection efficiency) of the position and momentum quadratures of the amplified coherent state and the corresponding (blue solid) curve for the best deterministic amplifier. } \label{NLA-exp-Z} \end{figure} Yet another strategy for coherent state amplification \citep{Ralph2003,Neergaard-Nielsen2013} is based on teleportation with an asymmetric entangled resource [akin to Ref.~\cite{Ralph2009}], but this teleportation is implemented in the coherent-state basis rather than the Fock basis. The scheme is presented in Fig.~\ref{teleamp}: Bob prepares an odd-cat state $\emph{N}_{-}(\vert \beta \rangle - \vert -\beta \rangle)$ and splits it using a BS with reflectivity $r_{B}$, denoted in Fig.~\ref{teleamp} by the symbol $\hat V_{BC}$, thereby generating an delocalized cat state $\ket{(1-r_B)\beta}_B\ket{r_B\beta}_C-\ket{-(1-r_B)\beta}_B\ket{-r_B\beta}_C$ in paths $B$ and $C$ (\emph{cf.}~Sec.~\ref{EntCatSec}), which is used as the entangled resource for the teleportation. The input state in channel $A$ has the form $c_+\ket\alpha_A+c_-\ket{-\alpha}_A$, where \begin{equation}\label{alphabeta}\beta\sqrt{r_{A}r_{B}}=\alpha \sqrt{1- r_{A}},\end{equation} and $r_A$ is the reflectivity of the beam splitter $\hat V_{AC}$. To perform the Bell measurement, Alice combines modes $A$ and $C$ at the beam splitter $\hat V_{AC}$ with reflectivity $r_{A}$ and looks for those events in which a single photon at port $A$ and no photon at port $C$ is detected. In this case, Bob obtains the state $c_+\ket{(1-r_B)\beta}-c_-\ket{-(1-r_B)\beta}$, which is the amplified input state with the gain $g=\sqrt{(1- r_{A})(1- r_{B})/ r_{A} r_{B}}$. This Bell measurement is described in detail in the Supplementary to \citep{Neergaard-Nielsen2013}; here we offer a brief intuition behind it. Notice that the relation (\ref{alphabeta}) is such that the amplitudes of the coherent states that are reflected from mode $C$ by $\hat V_{AC}$ into the detector in mode $A$ and the one that is transmitted from mode $A$ into the same detector are of the same absolute values. Suppose now that the phases of modes $A$ and $C$ are set such that equal-amplitude coherent states at the entrance to $\hat V_{AC}$ experience constructive interference at that detector, while opposite-amplitude states interfere destructively. This means that the detector in mode $A$ can click only if the states entering $\hat V_{AC}$ are either $\ket\alpha_A\ket{R_B\beta}_C$ or $\ket{-\alpha}_A\ket{-R_B\beta}_C$. A more precise calculation shows that this click, combined with an absent click in mode $C$, projects the input of $\hat V_{AC}$ onto the coherent Bell-like superposition $\ket\alpha_A\ket{R_B\beta}_C+\ket{-\alpha}_A\ket{-R_B\beta}_C$, therefore enabling the teleportation protocol. \begin{figure}[tb] \includegraphics[width=0.95 \linewidth]{fig30} \caption{(Color online) Quantum tele-amplification of a binary cat-state in an ideal lossless channel. From \cite{Neergaard-Nielsen2013}. } \label{teleamp} \end{figure} In the experiment by \textcite{Neergaard-Nielsen2013} the resource odd-cat state is generated by photon-subtraction from a squeezed vacuum, and $\beta$ is experimentally tuned by the squeezing level. Compared with the previous strategies, this scheme gives a higher fidelity with the target state but requires the knowledge of $\alpha$ in order to choose the right amplitude of the odd-cat state. Furthermore, the protocol is significantly affected by the losses in channel $C$ between Alice and Bob \subsection{CV entanglement distillation } The two-mode squeezed vacuum state, mentioned extensively in this review, is a workhorse of CV quantum information processing and communication \cite{Weedbrook2012,Braunstein2005}. Applications thereof include complete quantum teleportation \cite{Furusawa1998}, key distribution \cite{Madsen2012}, repeaters \cite{Campbell2013}, metrology \cite{Anisimov2010} and many others. An obvious advantage of the CV entangled resource, compared to its discrete-variable counterpart, is that it is readily available on demand from parametric amplifiers. On the other hand, the CV EPR state, when distributed over large distances, is deteriorated by losses, and therefore requires distillation to recover its entanglement. \begin{figure}[tb] \includegraphics[width=0.85\columnwidth]{EPR_distill} \caption{(Color online) CV entanglement distillation by photon subtraction. } \label{fig:Distillation_schematic} \end{figure} \begin{figure}[tb] \includegraphics[width=\linewidth]{fig24.png} \caption{(Color online) Results of the experiment by \citep{Takahashi2010b} on the distillation of the split single-mode squeezed vacuum. (a-c) Experimentally reconstructed Wigner functions and their contour plots of the mode defined by the operator $(\hat a_A-\hat a_B)/\sqrt2$: a) distillation via single-photon subtraction with $R$=5\%; b) distillation via two-photon subtraction with $R$=10\%; c) undistilled initial state (squeezed vacuum with $R$=0\%), all with the initial squeezing of $-3.2$ dB. (d) Experimental logarithmic negativities as functions of the initial input squeezing. The dashed curves are theoretical predictions based on independently measured experimental parameters. } % \label{fig:negwig} \end{figure} It was theoretically proven as a ``no-go theorem'' that Gaussian operations can never distill entanglement from Gaussian state inputs \citep{Eisert2002,Fiurasek2002,Giedke2002}. Under Gaussian operations, we understand operations that preserve the Gaussian shape of a state's Wigner function. These include interference, conditional homodyne detection, as well as single- and two-mode squeezing. For the entanglement distillation from CV Gaussian states, one should rely on non-Gaussian operations, and photon subtraction is actually a straightforward way to circumvent the above no-go restriction. The idea of CV entanglement distillation by photon subtraction was first proposed by \textcite{Opatrny2000} and further theoretically investigated for photon-number resolving \cite{Cochrane2002} and threshold \cite{Olivares2003} detectors. To understand it, let us apply annihilation operators to both modes of the EPR state (Eq. \ref{EqStateEPR}), as shown in Fig.~\ref{fig:Distillation_schematic}. We find \begin{equation}\label{Psiout} \hat{a}_A \hat{a}_B \ket{\psi_{\rm EPR}} =\frac1{\cosh(r)} \sum^{\infty}_{k=1} k\tanh^{k}r |k-1,k-1\rangle, \end{equation} where the subscripts $A$ and $B$ correspond to the modes of the EPR state. In the limit of small squeezing ($r\ll 1$), both states (\ref{EqStateEPR}) and (\ref{Psiout}) can be approximated to their first order: \begin{subequations}\label{eq:psiin} \begin{eqnarray} \ket{\psi_{\rm EPR}}&\propto&|0,0\rangle+r |1,1\rangle; \\ \hat{a}_1 \hat{a}_2 \ket{\psi_{\rm EPR}}&\propto&|0,0\rangle+2r |1,1\rangle. \end{eqnarray} \end{subequations} A higher contribution of the double-photon term enhances both the entanglement and the two-mode squeezing \cite{Bartley2013}. This enhancement comes at the price of losing the state's Gaussian character: this effect is weak for small initial squeezing, but becomes significant otherwise. The above analysis can be readily extended to account for losses in one or both channels of the EPR state. In fact, the entanglement can increase even more dramatically if, instead of subtracting one photon in each mode via the operator $\hat{a}_A \hat{a}_B$, one subtracts a single photon delocalized in the two modes of the EPR state via the operator $\hat{a}_A +\hat{a}_B$ implemented as shown on Fig. \ref{fig:AddSub2mode}a. In this case, for $r\ll 1$, one obtains the state $(\ket{0,1}+\ket{1,0})/\sqrt{2}$ with one ebit of entanglement: the initial two-mode squeezing only affects the success rate, and even if the initial entanglement is infinitely small, the final entanglement is finite. This protocol was successfully implemented by \cite{Ourjoumtsev2007b}. However, even if the transmission of the quantum channel used for the non-local photon subtraction can be small, it is still a non-local operation, so this process does not qualify as entanglement distillation. The first experiment on entanglement distillation of a Gaussian state by local photon subtraction was done by \textcite{Takahashi2010b}. In this experiment, the input state was not the EPR state but a single-mode squeezed vacuum state split into two modes on a symmetric beam splitter, resulting in entanglement of these two modes. Photons were then subtracted from one or both modes at the same time, and the distilled entangled state was measured by two independent homodyne detectors. \textcite{Takahashi2010b} observed that the two-mode state, both before and after the photon subtraction, becomes separable under the beam splitter transformation $\hat a_\pm=(\hat{a}_A\pm\hat{a}_B)/\sqrt2$. Indeed, the entangled state before subtraction is then transformed back into the initial product of vacuum and squeezed vacuum states $\ket{0}_+\ket{s}_-$, and the photon subtraction operators $\hat a_A=(\hat{a}_+ +\hat{a}_-)/\sqrt2$ and $\hat a_B=(\hat{a}_+ -\hat{a}_-)/\sqrt2$ both reduce to $\hat{a}_-$ as there are no photons to subtract from $\ket{0}_+$. For one- and two-photon subtraction, the mode $\hat a_+$ was indeed observed to remain in the vacuum state, while the state of $\hat a_-$ are the odd [Fig.~\ref{fig:negwig}(a)] and even [Fig.~\ref{fig:negwig}(b)] cat states, respectively. The entanglement increase induced by photon subtraction was quantitatively measured via the logarithmic negativity [Fig.~\ref{fig:negwig}(d)], defined as the sum of the negative eigenvalues of the partially transposed density matrix of a 2-mode entangled state, $\hat\rho_{AB}^{T_A}$ and known to be a monotone measure of entanglement \cite{Vidal2002}. \textcite{Kurochkin2014} demonstrated entanglement distillation of the proper two-mode squeezed state, which was generated via non-degenerate parametric down-conversion [Fig.~\ref{fig:Distillation_schematic}]. The experiment was conducted in the pulsed regime and the initial squeezing was relatively low: $0.63$ dB. After the photon subtraction, which utilized two tapping beam splitters with the reflectivities $R=0.11$, the squeezing increased to $0.83$ dB. The entanglement negativity has also increased from $0.24$ to $0.3$. \begin{figure}[tb] \includegraphics[width=\columnwidth]{kurochkin} \caption{(Color online) CV entanglement distillation by photon subtraction from an EPR state. Variances of the sum and difference of the quadratures measured in the two modes: a) unconditionally, b) conditioned on photon subtraction events in both channels $A$ and $B$ in \cite{Kurochkin2014}. The noise level corresponding to the double vacuum state is 1. The minimum variance in (a) is indicated by a dashed line. The curves show theoretical fits. The insets show histograms of the sum and difference of the position quadratures corresponding to each case. The dashed line shows the standard quantum limit. Enhancement of squeezing is present in (b) while the loss of Gaussian character is insignificant.} \label{fig:kurochkin} \end{figure} The results of this experiment are shown in Fig.~\ref{fig:kurochkin}, where the variances of the sum and difference quadratures $x_\pm(\theta_A,\theta_B)= x_A(\theta_A)\pm x_B(\theta_B)$ are plotted as a function of the sum of the phases $\theta_A+\theta_B$ in the two channels. This way of presenting the results takes advantage of the fact that the two-mode squeezed vacuum is insensitive with respect to equal and opposite shifts of phases $\theta_A$ and $\theta_B$. Indeed, shifting the two modes by $(\delta\theta_A,\delta\theta_B)$ will apply the factor of $e^{ik(\delta\theta_A+\delta\theta_B)}$ to each term of the decomposition (\ref{EqStateEPR}), which vanishes for $\delta\theta_A+\delta\theta_B=0$. The setting $\theta_A+\theta_B=0$ corresponds to the measurement of the position quadratures in both modes, so $x_A(\theta_A)$ and $x_B(\theta_B)$ are correlated and $x_-(\theta_A,\theta_B)$ is squeezed. In contrast, for $\theta_A+\theta_B=\pi$, $x_A(\theta_A)$ and $x_B(\theta_B)$ are anticorrelated and $x_+(\theta_A,\theta_B)$ is squeezed. We note also that because the initial squeezing is low, the distillation does not compromise the Gaussian character of these states, as is evident from the insets in Fig.~\ref{fig:kurochkin}. These experiments show the functionality of the photon subtraction approach to CV entanglement distillation. However, this approach has a significant limitation. As is evident from Eqs.~(\ref{eq:psiin}), the enhancement of entanglement what can arise from single-photon subtraction in each mode cannot exceed a factor of 2, which is not sufficient to compensate for a typical loss occurring in a communication line. Subtracting higher photon numbers can improve this factor, but at a cost of exponential loss in the event rate. A useful alternative protocol \cite{Ulanov2015} relies on the noiseless linear amplification discussed in the previous section. To see this, let us consider the EPR state, which we, as previously, truncate at the single-photon term in the Fock decomposition as per Eq.~(\ref{eq:psiin}a), assuming $r\ll 1$. Suppose that mode $B$ of this state propagates through a loss channel of amplitude transmissivity $t$, resulting in the following statistical mixture: \begin{equation}\label{initstateloss} \hat\rho=(\ket{00}-rt\ket{11})(\bra{00}-rt\bra{11})+r^2(1-t^2)\ketbra{10}{10}. \end{equation} Next, the NLA \emph{\`a la} \textcite{Lvovsky2002} is applied to that channel as per Eq.~(\ref{catalysis}). We obtain \begin{align}\nonumber \hat\rho'&=({\sqrt R}\ket{00}-rt\ket{11})({\sqrt R}\bra{00}-rt\bra{11}) \\&+r^2R(1-t^2)\ketbra{10}{10}.\label{finalstaterho} \end{align} We see that the vacuum component in the first term of the mixture, which corresponds to the entangled state, is multiplied by a factor $\sqrt R\ll 1$, corresponding to the effective enhancement of the entanglement by the inverse of that factor. In this way, by choosing the reflectivity $R$ of the beam splitter used in the NLA, one can restore the entanglement in the EPR state after an arbitrarily high loss. Figure \ref{fig:CVdistillNLA} shows the setting and results of the experiment by \textcite{Ulanov2015}. Two non-degenerate parametric down-conversion setups are used, one to generate the EPR state (with $r=0.135$), and one to prepare the heralded single photon \cite{Huisman2009}. Mode $B$ of the EPR state propagates through an attenuator with a 5\% transmissivity that models a lossy channel. Subsequently, it is overlapped on a low-reflectivity beam splitter to realize NLA. The initial squeezing of 0.65 dB is degraded by the attenuator to an almost undetectable level, but then fully recovered [Fig.~\ref{fig:CVdistillNLA}(a)]. \begin{figure}[tb] \includegraphics[width=0.8\columnwidth]{CVdistillNLA} \caption{(Color online) Distillation of CV entanglement by means of noiseless linear amplification \cite{Ulanov2015}. a) Experimental setup, b) Results showing two-mode squeezing, measured by the variances of the sum (anti-squeezing) and difference (squeezing) of the position quadratures in the two modes of the distilled EPR state. The theoretical curves assume the detection efficiencies in the undistilled and distilled channels of $\eta_A=0.45$ and $\eta_B = 0.5$, respectively, and a single-photon preparation efficiency of $\eta = 0.65$. } \label{fig:CVdistillNLA} \end{figure} Both the photon-subtraction and NLA methods of CV entanglement distillation yield a state that approximates the two-mode squeezed vacuum only up to the first order in the photon number decomposition. This means that the amount of squeezing and entanglement attainable through the distillation is limited. However, the fact that the resulting states are non-Gaussian permits further distillation by Gaussian means. In particular, the state (\ref{finalstaterho}) can be further distilled using the Gaussian procedure of \textcite{Eisert2004}, which can be implemented using only four quantum optical memory cells \cite{Datta2012}. By applying this protocol in an iterative manner, an infinitely squeezed EPR state can in principle be obtained. \subsection{Discrete-continuous interfacing}\label{CVDVIntSec} Physical systems that can be used for quantum information processing can be divided roughly into two classes. The first class is the systems with non-equidistant energy levels, from which one can select a pair of levels that can serve as a qubit. Examples of the first class include single atoms, quantum dots, superconducting circuits or color centers. The other class includes atomic ensembles, optical or microwave cavities, and optomechanical membranes --- that is, systems whose energy level structure is intrinsically equidistant, and therefore similar to that of the harmonic oscillator. In systems of the second class, it is sometimes more natural to encode quantum information in continuous degrees of freedom. A technology for coherent and loss-free exchange of quantum information among different quantum systems is essential for constructing functional quantum information processing networks \cite{Kurizki2015}. A natural means for such exchange is the electromagnetic field, as it is capable of carrying quantum information over significant distances. Fortunately, this system, being by nature a harmonic-oscillator-like system, is also capable of coupling efficiently to quantum objects with nonequidistant energy levels. Moreover, it is able to process information in both CV \cite{Braunstein2005} and DV \cite{Kok2007} regimes. However, there is a missing piece: a tool for interconversion of quantum information between these two encodings. \begin{figure}[tb] \includegraphics[width=\columnwidth]{BelliniLaurat.png} \caption{(Color online) Preparation of an entangled state between a CV (cat) qubit and the single-rail DV qubit. a) The scheme of \textcite{Jeong2014}; b) the scheme of \textcite{Morin2014}. See text for details. } \label{fig:BelliniLaurat} \end{figure} The role of such a tool can be played by an entangled state between qubits encoded in the discrete and continuous bases. Indeed, such a state can be used as the entangled resource for protocols such as teleportation, remote state preparation, and entanglement swapping. In the last few years, there has been a significant effort to develop a technique for generating such a state. In 2014, \textcite{Jeong2014} and \textcite{Morin2014} independently demonstrated an entangled state between a CV qubit encoded in two coherent states of opposite phases (\emph{cf.}~Sec.~\ref{CatQubitSec}) and the single-rail DV qubit encoded in the Fock states $\ket 0$ and $\ket 1$ using two different schemes. Figure \ref{fig:BelliniLaurat}(a) shows the scheme of \textcite{Jeong2014}. Modes 1 and 2 are initially prepared in the vacuum and coherent states, respectively, and then subjected to a nonlocal photon addition operator using the setup of Fig.~\ref{fig:AddSub2mode}(b). This produces the state $a_1^\dag\ket 0\ket\alpha+\ket 0a_2^\dag\ket \alpha$. The effect of the photon creation operator on a coherent state strongly depends on its amplitude. For $\alpha=0$, $\hat a^\dag\alpha=\ket 1$, i.e. the photon-added state is orthogonal to the input. But for a large $\alpha$, the photon-added state $\hat a^\dag\alpha$ is approximated by a coherent state of a slightly larger amplitude $\ket{g\alpha}$, with $g\approx1+1/|\alpha|^2$ \cite{Jeong2014}. In other words, the photon creation operator acts on a high-amplitude coherent state like a noiseless amplifier (Sec.~\ref{section:NLA}). The resulting state in modes 1 and 2 will therefore be approximated by $\ket 1\ket\alpha+\ket 0\ket{g \alpha}$. The remaining step is to apply a phase-space displacement to mode 2 by $-\alpha(g+1)/2$ to transform $\ket\alpha\to\ket{-\alpha(g-1)}$ and $\ket{g\alpha}\to\ket{\alpha(g-1)}$, resulting in the desired DV-CV entangled qubit. This step is implemented by mixing mode 2 with a strong coherent state $\ket\beta$ on a low-reflectivity beam splitter [Fig.~\ref{fig:BelliniLaurat}(a)] \begin{figure}[tb] \includegraphics[width=0.93\columnwidth]{HVCat} \caption{Experiments with the entanglement of the polarization and the cat-like qubits [(a)-(c), \cite{Sychev2017b}] and of the polarization and single-rail qubit [(d), \cite{Drahi2019}]. a) Preparation of the postselected state (\ref{HVCat}) (conditioned on a single photon present in mode $A$) in modes $A$ and $C$. Red lines denote vertical polarization, blue horizontal. b) An entanglement swapping procedure with a freely propagating polarization-entangled state in modes $B$ and $D$ prepares the same state in a heralded (postselection-free) fashion. c) The state of the CV mode $C$ when the DV mode $A$ is projected onto various polarization states. Top rows: Experimental and corresponding theoretical Wigner functions. Red color indicates positive values, blue --- negative. The dashed circles correspond to the half-height of the vacuum state Wigner function. d) Preparation of the postselected state single-dual-rail entangled state (conditioned on a single photon present in mode $A$) in modes $A$ and $C$ \cite{Drahi2019}. The polarization and notation of the modes are changed with respect to the original work \cite{Drahi2019} for consistency.} \label{fig:HVCat} \end{figure} The experiment by \textcite{Morin2014} starts with two OPAs, one operating in the nondegenerate and the other in the degenerate regime. The weekly pumped non-degenerate OPA (marked ``Alice") produces pairs of photons so that, when one photon in the pair is detected, the other emission channel [mode 1 in Fig.~\ref{fig:BelliniLaurat}(b)] will also contain a photon; otherwise it is likely to contain the vacuum state. The degenerate OPO (``Bob") emits squeezed vacuum into mode 2 [Fig.~\ref{fig:BelliniLaurat}(b)], which, as discussed in Sec.~\ref{ScCatTheoSec}, approximates an even cat state. A fraction of that state is tapped using a weakly reflective BS; if a photon in the tapped mode is detected, the state of mode 2 transforms into an odd cat. The heralding modes from both parts of the setup are mixed on a beam splitter and directed onto a single-photon detector; the desired state preparation is heralded by an event in this detector. Indeed, such an event can occur due to one of the two situations. If the trigger photon originates from the non-degenerate OPA, the state of modes 1 and 2 becomes $\ket 1\ket{\psi_{{\rm cat},+}}$. If, on the other hand, the photon comes from the degenerate OPA, the state becomes $\ket 0\ket{\psi_{{\rm cat},-}}$. Provided that the two heralding modes are well-matched, the heralded 2-mode state is the superposition of these two states, i.e.~the entangled DV-CV qubit. The coefficients of this superposition are determined by the relative optical phases of the modes, SPDC amplitudes and the BS parameters. The entangled state prepared using the method of Ref.~\cite{Morin2014} has been used to implement remote state preparation \cite{LeJeannic2018}. The discrete mode was subjected to homodyne detection. Observation of a specific quadrature projected that mode onto a superposition of the vacuum and single-photon states, and the CV channel was accordingly prepared in the same superposition thanks to the DV-CV entanglement. In a later publication \cite{Cavailles2018}, the same group demonstrated, by more than five standard deviations, that this experiment constitutes Einstein-Podolsky-Rosen steering. The state of \textcite{Morin2014} has also served as the entangled resource for rudimentary teleportation from a cat qubit onto a qubit spanned by ${\ket0,\ket 1}$ \cite{Ulanov2017a} and for entanglement swapping with a delocalized single photon \cite{Guccione2020}. The Bell measurement in the cat qubit basis was realized in the manner similar to that in \cite{Neergaard-Nielsen2013} (see Sec.~\ref{section:NLA}). For the input state, Ulanov {\it et al.} used a coherent state of a variable phase $\ket{\alpha e^{i\phi}}$, which, as they argued, approximates the cat qubit state $\ket{\psi_{{\rm cat},+}}+e^{i\phi}\ket{\psi_{{\rm cat},-}}$ up to the first term in the Fock decomposition. In fact, this approximation is precise only for $\phi=0$ or $\pi$ (i.e.~the input state being $\ket\alpha$ or $\ket{-\alpha}$); otherwise it fails for large values of $\alpha$. Nevertheless, this method achieves a high non-classical teleportation fidelity averaged over the Bloch sphere of input qubits. A scheme for reverse teleportation --- from the single-rail qubit onto the cat qubit --- has been theoretically analyzed in \cite{Huang2019}. Both of the above methods of preparing the CV-DV entangled state have their advantages and drawbacks. The disadvantage of the approach used in \cite{Jeong2014} is that the relation $a^\dag\alpha\approx\ket{g\alpha}$ holds only for relatively high values of alpha. However, the amplitudes of the components of the resulting qubit, $\pm(g-1)\alpha\approx \pm1/|\alpha|^2$, diminish with $\alpha$. Therefore one must compromise between the fidelity of the cat and its amplitude: for example, setting $\alpha=2$ results in $\pm(g-1)\alpha\approx 0.25$ and the fidelity of 0.98. On the other hand, the scheme of \cite{Morin2014}, while avoiding this issue, suffers from the amplitudes of the odd and even cat being different by a factor of $\sqrt 3$ (see Sec.~\ref{ScCatTheoSec}), which complicates the practical application of the CV part of the resource. Another issue with both these approaches is that the single-rail encoding of the qubit is not commonly used in practical quantum optical information processing. This is because of the vulnerability to optical losses and inefficient detection and the challenges associated with single-qubit operations and measurements \cite{Berry2006,Izumi2020}. Much more common is the dual-rail encoding, where the logical value is assigned to the photon being present in one of two modes --- such as the well-known polarization qubit is a particular case of the dual-rail encoding. Therefore it is desirable to have a technique to produce an entangled qubit of the form \begin{equation}\label{HVCat}\ket R=\ket H\ket{\psi_{{\rm cat},+}}+\ket V\ket{\psi_{{\rm cat},-}}, \end{equation}where $\ket H$ and $\ket V$ denote horizontally and vertically polarized photons. This technique has been demonstrated by \textcite{Sychev2017b}. Figure \ref{fig:HVCat}(a) shows its basic principle. Suppose a weakly squeezed vacuum state, which approximates $\ket{\psi_{{\rm cat},+}}$, is generated in the \emph{vertically} polarized channel of spatial mode $C$ (which we denote as $VC$). This state passes through a low-reflectivity BS, which taps a fraction of the light into spatial mode $A$. As per our previous arguments, the resulting state can be written as \begin{equation} \ket\psi_{VA,VC}\approx\ket{0}_{VA}\ket{\psi_{{\rm cat},+}}_{VC}+\beta\ket{1}_{VA}\ket{\psi_{{\rm cat},-}}_{VC}, \end{equation} where $\beta$ depends on the initial squeezing and the beam splitter reflectivity. Now let us inject a weak \emph{horizontally} polarized coherent state $\ket{\alpha}\approx\ket{0}+\alpha\ket{1}$ into the input mode $A$ of the BS. The state of all the relevant modes becomes \begin{align}\label{OmegaAC} &\ket{\Omega}_{AC}= \ket\alpha_{HA}\ket\psi_{VA,VC}\approx \ket{0}_{HA}\ket{0}_{VA}\ket{\psi_{{\rm cat},+}}_{VC}\\ & +\alpha\ket{1}_{HA}\ket{0}_{VA}\ket{\psi_{{\rm cat},+}}_{VC}+\beta\ket{0}_{HA}\ket{1}_{VA}\ket{\psi_{{\rm cat},-}}_{VC}\nonumber , \end{align} where we approximated to the first order in $\alpha$ and $\beta$. The second line in Eq.~(\ref{OmegaAC}), corresponding to a single photon present in spatial mode $A$, comprises the state \eqref{HVCat} in modes $A$ and $HC$ (because $\ket V_A\equiv \ket{0}_{HA}\ket{1}_{VA}$ and $\ket H_A\equiv\ket{1}_{HA}\ket{0}_{VA}$). Experimentally, \cite{Sychev2017b} demonstrated this by detecting the photon in mode $A$ in various polarization states. This measurement remotely prepares various superpositions of cat states in mode $HC$, which can be reconstructed by homodyne tomography. The CV-DV entanglement of the state (\ref{OmegaAC}) becomes manifest only when the photon in mode A is detected and destroyed. This greatly limits the practical utility of this state. However, the issue can be remedied as shown in Fig.~\ref{fig:HVCat}(b). One needs to prepare a polarization-entangled photon pair, e.g. $(\ket H\ket V+\ket V \ket H)/\sqrt 2)$, in a separate set of spatial modes $B$ and $D$ and then subject modes $A$ and $B$ to a measurement in the polarization Bell basis. This will result in the swapping of the CV-DV entanglement \cite{Pan1998} to modes $VC$ and $D$. Because the Bell measurement will only produce an event when two photons are input, the resulting state will be a good approximation to Eq.~(\ref{HVCat}). In \textcite{Sychev2017b}, this procedure has been implemented; however, the polarization-entangled pair used in that experiment has been of a postselected, rather than freely-propagating, nature. As a result, a freely propagating CV-DV entangled resource could not be produced. However, this goal appears to be within reach of current technology because heralded preparation of freely polarizating entangled photon pairs has been demonstrated \cite{Barz2010,Wagenknecht2010}. \textcite{Drahi2019} used a similar idea to implement entanglement between single- and dual-rail encodings of the qubit. Here, the single-mode squeezed vacuum source is replaced by a weak two-mode squeezed vacuum source operating in the low-gain regime (i.e. a probabilistic photon pair source). One of the modes is mixed on a polarizing beam splitter with a weak coherent state in an orthogonal polarization [Fig.~\ref{fig:HVCat}(d)]. Now, the polarization of the photon in mode A determines whether this photon has originated from the coherent state or from the pair source; accordingly, a twin photon is either absent or present in mode C. The state of modes A and C is therefore given by $(\ket H_A\ket 0_{VC}+\ket V_A\ket 1_{VC})/\sqrt 2$. Again, the postselected nature of this entanglement is addressed using the entanglement swapping scheme of Fig.~\ref{fig:HVCat}(b)]. With the results described above, we now possess tools to interconvert among three primary encodings of the qubit by means of light: single-rail, dual-rail and coherent-state. These tools consolidate the role of light as the medium that enables exchange of quantum information among physical systems of different nature. \subsection{Bell's inequalities and device-independent quantum key distribution} Bell's inequalities (BI) were designed to show incompatibility of remote quantum correlations with local realism \citep{Bell1964}. Their experimental tests are vulnerable to two loopholes: the locality loophole, which arises when the detectors are too close to completely discard the exchange of subluminal signals during the measurements; and the efficiency loophole, which occurs when the detectors are not efficient enough to be described by Bell's model \cite{Pearle1970,Garg1987}. These loopholes were closed separately \cite{Aspect1982,Weihs1998,Rowe2001} then simultaneously \cite{Hensen2015,Shalm2015,Giustina2015}, and the fundamental debate around quantum nonlocality can be considered settled. Nevertheless, BI retain a central role in the applied side of quantum science, particularly quantum cryptography. Indeed, loophole-free BI violation constitutes unforgeable evidence of entanglement between Alice and Bob, and hence precludes any eavesdropping as long as the latter is bound by the laws of known physics \citep{Acin2005,Barrett2005,Acin2006}. Hence it would enable device-independent quantum key distribution \citep{Acin2007}, which remains secure even if an eavesdropper takes control of the detection system \citep{Lydersen2010,Sauge2011}. It is appealing to extend device-independent security to quantum key distribution in the CV domain, which, under some conditions, enables significantly higher communication rates than its DV counterpart \cite{Grosshans2003}. This would require developing a BI analog that would be compatible with homodyne measurements and allow their experimental loophole-free violation. Unless one trusts the detection system \cite{Thearle2018}, this task cannot be solved without non-Gaussian states with negative Wigner functions, otherwise the quadratures $x$ and $p$ can take the role of hidden variables for which the Wigner function becomes a valid probability distribution. Among the different proposed violation schemes, many require quantum measurements \citep{Banaszek1998,Stobinska2007} or quantum states \citep{Munro1999,Auberson2002,Wenger2003,Cavalcanti2007,Etesse2014} which are still difficult to realize. Others are based on simpler setups but provide only a small violation \citep{Nha2004,Garcia2004}, or can be used only when more than two parties are considered \citep{Acin2009}. Some hybrid schemes, mixing homodyne measurements with photon detection, \citep{Cavalcanti2011,Brask2012}, require more accessible detection efficiencies with simpler states. In general, there is a tradeoff between the required detection efficiency and the complexity of the states used in the protocol \citep{Quintino2012}. \section{Applications to quantum computing}\label{QCompSec} \subsection{Linear optical quantum computing} The challenges of implementing a large-scale, fault-tolerant quantum computer capable of surpassing its classical counterpart for practical computational problems are widely known. However, there exist applications where even small scale quantum computing would be useful. Some of these applications are in quantum communications and networking. Because quantum communication is performed by means of light, it would be preferred that the computation is also done by means of optics \citep{OBrien2009}. Used at the nodes of a quantum optical network, such a device would deliver highly secure communications and distributed quantum processing \citep{Kimble2008,Briegel1998,Bennett1993}, associated with ultra-high capacity and minimum power in optical communications \citep{Giovannetti2004,Waseda2010}. Fault-tolerant optical quantum information processing requires non-Gaussian input states and/or gates capable of turning Gaussian states into non-Gaussian ones \cite{Niset2009}. Their deterministic implementation involves non-linear optical processes at least of the third order \citep{Lloyd1999,Bartlett2002a,Bartlett2002b,Bartlett2002c} which, as already mentioned (section \ref{NonGauss:Principle}) are very difficult to put in practice. On the other hand, they can be realized probabilistically by using linear optics and conditional measurements. For example, \textcite{Costanzo2017} demonstrated a method to enact the transformation \begin{equation}\label{Costanzo1} c_0\ket0+c_1\ket 1+c_2\ket 2 \to c_0\ket 0 +c_1\ket 1-c_2\ket 2, \end{equation} which corresponds to self-phase modulation due to the third-order optical nonlinearity, on an arbitrary linear combination of the first three Fock states by using the circuit shown in Fig.~\ref{addsubsc}. As discussed in Sec.~\ref{AssSubSec}, such a circuit implements a linear combination of operators $\hat n=\hat{a}^\dag \a$ and $\hat n+\mathbb{I}=\a\hat{a}^\dag$, or, equivalently, of operators $\hat n$ and $\mathbb{I}$. By adjusting the parameters of this circuit, one can choose arbitrary coefficients of this linear combinations. In \cite{Costanzo2017}, the operator was $\propto-(2+\sqrt 2)\hat n+\mathbb{I}$, acting as follows: \begin{equation}\label{Costanzo2} c_0\ket0+c_1\ket 1+c_2\ket 2 \to c_0\ket 0 +g c_1\ket 1-g^2c_2\ket 2 \end{equation} with $g=-(\sqrt2+1)$. Subsequently, by applying the noiseless linear amplifier operator $\hat G=(-g)^{-\hat n}$ with the gain $-1/g$ (see Sec.~\ref{section:NLA}), one obtains the transformation (\ref{Costanzo1}). Applied directly in a computational protocol, such probabilistic gates lead to loss of data. Instead, they can be used off-line to prepare specific entangled resources states, then teleport the computational states using these resources to implement the desired gates. This paradigm is known as linear optical quantum computing (LOQC). In the DV domain, the mainstream scheme of LOQC is that of \textcite{Knill2001}. In the optical CV domain, two approaches are now actively studied. One of them, using two phase-opposite coherent states for qubit encoding \citep{Jeong2002,Ralph2003} is referred to as coherent state quantum computing (CSQC) and discussed in section \ref{section:CSQC}. The other one, relying on phase-space ``grid'' or ``comb'' states known as Gottesman-Kitaev-Preskill (GKP) states \cite{Gottesman2001}, is briefly presented in section \ref{section:GKPQC}. Results on recently proposed ``binomial'' codes for bosonic systems \cite{Michael2016} are so far limited to the microwave domain and remain beyond the scope of this review. \subsection{Coherent state quantum computing} \label{section:CSQC} \textcite{Cochrane1999} introduced logical qubit encoding using even and odd cat states, and showed how quantum computing can be implemented by using a large enough cross Kerr interaction, combined with the displacement operation. \textcite{Jeong2002} developed this proposal further, using the encoding with binary coherent states as per Eq.~(\ref{Logical encoding}). The coherent amplitude should be large enough, so that the qubit bases can be almost orthogonal. Assuming that the single-mode Kerr nonlinearity is available online, they showed that a universal gate set can be constructed using teleportation-based CNOT gate. Entangled cat states can also be used as an entanglement resource \citep{vanEnk2001}, but low-loss Kerr interactions required for these schemes are unfortunately quite hard to realize. \textcite{Ralph2003} showed a way to construct the universal gate set only using linear online processes, but offline preparation of ancilla states, which are used as resources to be inserted later on into the calculation. In offline state preparation, two-mode entangled cat states are used to implement one-bit and CNOT gates. This scheme can be deterministic in principle, albeit with a rather demanding requirement on the source of cat states, requiring amplitudes $\alpha>2$. \textcite{Lund2008} then showed that by using nondeterministic gates, based on teleportation with unambiguous state discrimination combined with error correction, the requirement for the amplitudes can be reduced to $\alpha>1.2$. They also studied tolerance to certain errors, including those caused by photon loss, as well as those due to failure events in the nondeterministic gate teleportation. It was shown that low enough photon losses (less than $5\times10^{-4}$), the CSQC scheme can be resource efficient and fault tolerant in the sense that approximately $10^4$ cat states are consumed per error-correction round at the first level coding. This number is 4 orders of magnitude lower than the number of Bell pair resource states consumed under equivalent conditions by the most efficient known scheme of DV LOQC. However, when considering practical implementations with currently available resources, the remaining challenges are considerable. \textcite{Marek2010} pointed that if cat states with amplitudes $\alpha\sim1$ are available, one must use the one-qubit gate with an incremental phase shift repeatedly to include a significant angle, at least ten operations to achieve a $\pi$ phase shift. So they proposed an alternative way to achieve large phase shift with currently available resources, by using, again, probabilistic operations that involve single-photon subtractions. They elaborated a universal gate set for CSQC, consisting of the single-mode phase gate, the single-mode Hadamard gate, and the two-mode controlled phase gate. \begin{figure}[tb] \centering {\includegraphics[width=\linewidth]{fig31} \caption{(Color online) Single-mode phase gate in coherent-state linear optical quantum computing \cite{Marek2010}. } \label{fig:MarekFiurasek}} \end{figure} We discuss the principle of the one-qubit gate from that proposal as an example of a CSQC scheme (Fig.~\ref{fig:MarekFiurasek}). To implement the gate, one first displaces the input qubit $x \ket{\alpha} + y \ket{-\alpha}$ in the phase space along the momentum axis by distance $\beta$, so the qubit components transform according to $\alpha\to\alpha+i\beta,\ -\alpha\to-\alpha+i\beta$ (we assume $\alpha$ to be real). Second, one applies the annihilation operator, which results in a phase shift that is different for the two components: $\a\ket{\alpha+i\beta}=(\alpha+i\beta)\ket{\alpha+i\beta}, \ \a\ket{-\alpha+i\beta}=(-\alpha+i\beta)\ket{-\alpha+i\beta}$. Finally, one displaces the qubit back to its original phase space position, obtaining $x(\alpha+i\beta)\ket{\alpha}+y(-\alpha+i\beta)\ket{-\alpha}$. We see that the two components of the qubit have acquired different quantum phase shifts, with the difference that can be controlled by choosing the value of $\beta$. At present, the single-mode phase gate ($\pi$-phase gate) was implemented by \textcite{Blandino2012b}, and the Hadamard gate by \textcite{Tipsmark2011}. Experimental implementation of the two-mode gate remains an open problem. Progress in superconducting quantum circuits, where deterministic non-Gaussian operations are feasible, large-amplitude cat states have been realized \cite{Vlastakis2013}, and corresponding error-correction protocols can be implemented \cite{Ofek2016}, stimulated new theoretical proposals for fault-tolerant CSQC using ``multi-legged'' cat states corresponding to superpositions of $d>2$ coherent states lying on a circle in phase space \cite{Mirrahimi2014}. In the optical domain, \textcite{Thekkadath2020} proposed to generate four-legged cats probabilistically using coherent ancillas and photon-number-resolving measurements, while \textcite{Hastrup2020} found an alternative approach which can be deterministic if standard ``two-legged'' cats are available as resources. \subsection{GKP state quantum computing} \label{section:GKPQC} Ideal GKP states correspond to an infinite comb of infinitely squeezed states equally spaced along the $x$ (and, by Fourier transform, also along the $p$) quadrature \cite{Gottesman2001}. In practice, constrains can be relaxed to make these states more physical, but they remain highly non-Gaussian and more difficult to generate than cat states. GKP codes have been experimentally implemented with superconducting qubits \cite{Campagne-Ibarcq2019} and trapped ions \cite{Fluehmann2019}, but in the optical domain they remain at a theoretical stage. The protocol proposed by \textcite{Vasconcelos2010} (and independently by \textcite{Etesse2014} in a different context) would allow conditional generation of such states via a procedure reminiscent of ``Schr\"odinger cat breeding" discussed in Sec.~\ref{BreedingSec}. It begins with two cats mixed on a symmetric beamsplitter, producing an entangled superposition of the form \eqref{eq2}. One of the output modes is then subjected to a homodyne measurement. In contrast to ``breeding", the quadrature being measured is momentum rather than position. The resulting conditionally prepared state in the other mode is then a superposition of $\ket{\psi_{{\rm cat},+}[\sqrt{2}\alpha]}$ and $\ket 0$, which is a momentum-squeezed three-peaked GKP state. This operation can be iteratively repeated to produce GKP states with more peaks. \textcite{Weigand2018} have later shown that this protocol can be made more efficient by keeping all states and using the measurement's outcomes for classical feedforward. A similar protocol using photon number resolving counters instead of homodyne detectors for heralding \cite{Eaton2019}, as well as more general but less feasible schemes \cite{Su2019}, have been proposed. \section{Final outlook} \label{section:Outlook} Measurement-induced engineering of non-Gaussian optical states has established itself as an active and mature research field. Its main limitation stems from probabilistic heralding: if the probability $p$ of the expected interesting event is small, the probability $p^n$ of getting $n$ times this same event will be exponentially smaller. Though ideas have been proposed to overcome this exponential loss \citep{Knill2001}, their implementation is extremely demanding, in particular as they require a very high number of physical qubits to encode and protect a single logical qubit. Developing on-demand sources of non-Gaussian states, particularly single photons, is hence essential for the further development of the field. In spite of their probabilistic nature, SPDC sources do possess a promise in this context. An example is the multiplexed photon source \cite{Migdall2002,Kaneda2019}, in which a photon detection in one of the idler modes of a multimode SPDC source triggers an electrooptical switch that directs the counterpart signal photon into a single output mode. Alternatively, a photon (or antother state) prepared in a heralded fashion can be stored in a quantum memory for subsequent on-demand retrieval. A good quantum memory should be able to store this state for longer than it takes to generate another one, and the retrieved state should faithfully reproduce the stored one. The latter requirement implies a high combined storage and retrieval efficiency but is not limited to it: in particular, the retrieved state must not exhibit any added quadrature noise with respect to the stored one \cite{Lvovsky2009QM}. While these criteria have been satisfied separately \cite{Heinze2013,Vernaz-Gris2018,Radnaev2010,Bouillard2019}, a device that could meet all these requirements at once is still to be developed. A streamlined variant of the above procedure is the Duan-Lukin-Cirac-Zoller process, in which Raman scattering on an atomic transition creates two-mode squeezing between a long-lived atomic collective state and an optical mode \cite{Duan2001}. Detection of a photon in this mode heralds a single stored atomic excitation, which can be retrieved on demand as another optical photon. In this way, an intermediate step of heralding a photon and storing it in a memory is bypassed, thereby relaxing the efficiency requirements. This approach has been tested experimentally in various DV settings \cite{Lvovsky2009QM}. In the context of non-Gaussian optics, it was shown to be efficient enough to observe negative Wigner functions \citep{MacRae2012,Bimbard2014,Brannan2014}. In parallel, truly deterministic sources of non-Gaussian states made impressive progress. The performance criteria for such sources are (1) brightness (number of photons emitted per second and per unit bandwidth), (2) antibunching (not more than one photon produced at a time), (3) quality of the mode in which the photon is generated and (4) indistinguishability (if multiple sources run simultaneously). Atomic Rydberg \cite{Ornelas-Huerta2020} and cavity-enhanced \cite{Muecke2013} sources, as well as solid-state \cite{Somashi2016,Wang2019} sources are becoming increasingly more efficient according to all these criteria. Atom-based systems largely improved their overall duty cycles and moved beyond the single-photon regime \cite{Hacker2019,Liang2018,Clark2019} while solid-state devices, which were hampered by sample-to-sample variations, became sufficiently tunable to emit indistinguishable photons \cite{Flagg2010}. Many of these systems can not only generate non-Gaussian states but also implement non-Gaussian operations such as entangling photon-photon gates \cite{Gazzano2013,Hacker2016,Tiarks2019}. Instead of engineering non-Gaussian optical states directly, one could also focus on developing linear interfaces between light and matter-based systems, leaving the complexity of non-Gaussian operations to the latter. Among them, trapped ions and superconducting circuits are currently leading the race in terms of processing capabilities. Efficiently coupling ions to light requires optical cavities: despite additional challenges with respect to neutral atoms, ion-cavity systems are making steady progress \cite{Lee2019}. As for microwave-to-optical photon converters, different implementations can be envisioned \cite{Lambert2019} and some become functional at the quantum level \cite{Forsch2020}. Scaling quantum optical information processing circuits up to a practically useful size necessarily requires their implementation on an integrated photonic chip. In addition to the scalablity, this platform addresses many challenges associated with free space optics. Integrated interferometers are intrinsically stable, while waveguides provide a transverse confinement enhancing the efficiency of nonlinear processes. For atom-based systems, moving from ``bulk'' optical cavities to microresonators enhances the atom-light coupling and the input/output coupling efficiency \citep{Thompson2013,Shomroni2014,Luan2020}. At the same time, taking advantage of these opportunities requires a large range of new technologies to be developed. This includes low-loss waveguides, rapidly controllable linear-optical interferometers, efficient indistinguishable photon and squeezed vacuum sources, as well as on-chip photon and homodyne detectors. Integrated quantum photonics is a very active field, and we refer to recent reviews for more details \cite{Silverstone2016,Wang2019b}. We have shown in this review that the tools of non-Gaussian quantum optics achieve results far beyond those that can be obtained using discrete- or continuous-variable methods alone. Hence these tools will undoubtedly be part of any further progress on manipulating and exploiting quantum light. The main challenge now is to make them deterministic and efficient --- not an easy challenge, but certainly one which can be met. \bibliographystyle{apsrmp4-1}
\section{Introduction} Data analysis tools are essential for data science. Robust movement data analysis tools are therefore key to advancing mobility data science. However, the development of movement data analysis tools is hampered by a lack of shared understanding and standardization. There are numerous implementations, including dozens of R libraries, as well as Python libraries and moving object databases. For example, \cite{joo2020navigating} review 57 R libraries related to movement in ecology. The development of Python libraries for movement analysis is picking up as well. For example, \cite{graser_movingpandas_2019} introduces the Python library MovingPandas and compares it to the R trajectories library \cite{moradi2018trajectories} and the movement database Hermes \cite{pelekis2015hermes}. Other Python libraries for movement analysis include scikit-mobility (focusing on human movement) \cite{pappalardo2019scikitmobility} and Traja (for animal movement) \cite{justin_shenk_2019_3237827}. However, even though they are all built for movement data analysis, they still vary considerably in their underlying concepts and provided functionality. The ISO Standard 19141 Geographic information -- Schema for moving features was first published in 2008 \cite{ISO19141}. It defines a data model for representing moving points and moving rigid regions. Based on this standard, the Open Geospatial Consortium (OGC) has worked on various encodings for representing moving features as well as standardized operations for manipulating moving geometries. However, so far, these standards have failed to reach significant adoption. This discussion paper summarizes the current status as well as open issues towards a universal API for mobility data science. We start with a short introduction to OGC Moving Features standard and provide conceptual and technical commentary on these standardization efforts. These findings should serve as a point of departure for a community-wide effort to develop a shared understanding of what would be the right API for mobility data science -– if such a thing exists. Based on these findings, we then propose essential building blocks to advance movement data science. \begin{figure}[tb] \includegraphics[width=\columnwidth]{example} \caption{Data model of the Moving Features standard illustrated with two moving points A and B. Stars mark changes in attribute values.} \label{fig:example} \end{figure} \section{Moving Features} The ISO and OGC Simple Features standard \cite{ISO19125} has gained widespread adoption in Geographic Information Systems (GIS) and related systems dealing with spatial data. Following this example, the new set of OGC Moving Features standards (which are based on the ISO standard \cite{ISO19141}) define how moving features should be encoded and how they should be accessed. A moving feature contains a temporal geometry, whose location changes over time, as well as dynamic non-spatial attributes whose values vary with time. The standards supports 0-dimensional (points), 1-dimensional (lines), 2-dimensional (polygons), and 3-dimensional (polyhedrons) geometries that vary over time. The standard allows the representation of the following phenomena: \begin{enumerate} \item Discrete phenomena, which exist only on a set of instants, such as road accidents, \item Step phenomena, where the changes of locations are abrupt at an instant, such as the location of mobile speed cameras for monitoring traffic, and \item Continuous phenomena, whose locations move continuously for a period in time, such as vehicles, typhoons, or floods. \end{enumerate} \begin{table*}[h] \centering \begin{tabularx}{\textwidth}{lXXX} \hline & \multicolumn{1}{c}{\textbf{CSV}} & \multicolumn{1}{c}{\textbf{XML}} & \multicolumn{1}{c}{\textbf{JSON}} \\ \hline \textbf{Concept} & Segments with start and end time and attributes, no static object properties & Segments with start and end time and attributes, with static properties & Points with timestamps and attributes with (independent) timestamps \\ \hline \textbf{Advantages} & \begin{enumerate} \item Supports temporal gaps in observations \end{enumerate} & \begin{enumerate} \item Supports temporal gaps in observations \item Can handle complex geometries \item Support for static / non-temporal descriptive object properties \end{enumerate} & \begin{enumerate} \item Most compact representation \item Can handle complex geometries \item Time stamps of location and attribute changes are modelled independently -- no synchronization necessary \item Interpolation modes can be specified individually for each attribute \item Support for non-temporal descriptive attributes \end{enumerate} \\ \hline \textbf{Limitations} & \begin{enumerate} \item Verbose: redundant information (start and end time and location for each segment) \item Temporal geometry and temporal attributes have to be synced \item Only linear interpolation \item Only moving points \item Not readily usable in GIS (missed the opportunity to use WKT to represent the geometry) \end{enumerate} & \begin{enumerate} \item Very verbose: XML \& redundant information (start and end time and location for each segment) \item Temporal geometry and temporal attributes have to be synced \item Same interpolation for geometry and all attributes \end{enumerate} & \begin{enumerate} \item Multiple options for encoding the same situation (e.g. unclear bounds of time periods) \item No support for temporal gaps in observations \end{enumerate} \\ \hline \end{tabularx} \caption{Overview of OGC Moving Feature encodings} \label{tab:1} \end{table*} Fig.~\ref{fig:example} illustrates the Moving Features data model. It shows the movement of two vehicles denoted by $A$ and $B$. The goal is to model the vehicles' changing location and gear settings. The vehicle locations are modelled as moving points while the selected gear is modelled as a temporal property. Both vehicles start their movement at time $t=0$. While vehicle $A$ records its location at time $t=1$ and $t=2$, vehicle $B$ records its location only at time $t=2$. Furthermore, timestamps when $A$ changes gears are marked by a star symbol. This example follows the default assumption of linear interpolation between locations. In general, a moving feature can be modelled as positions recorded at discrete timestamps, where the position between two recorded timestamps is computed by interpolation. If the interpolation is discrete, then no assumption is made about the location of the object between two observations. On the other hand, stepwise interpolation assumes that the location of the object is constant between two observations. Finally, linear or polynomial interpolations specify how to compute the location of the object between two observations. Based on this data model, OGC Simple Features defines XML/GML \cite{OGC14-083r2} and JSON \cite{OGC16-140r1} data encodings, as well as simpler CSV \cite{OGC14-084r2} and binary encodings (which are limited to moving points). However, even though these encodings are part of the same standard and are based on the same general data model, there are still considerable differences that significantly affect which kind of information can and can not be modelled (as shown in Table~\ref{tab:1}). To dive deeper and illustrate our point, the following sections show the example introduced in Fig.~\ref{fig:example} encoded using the CSV, XML, and JSON encodings. \subsection{CSV Encoding} The CSV encoding is the simplest option in the Moving Features standard. Fig.~\ref{fig:csv} shows the CSV representation of the example introduced in Fig.~\ref{fig:example}. The CSV structure is divided into two parts: First, the header lines (starting with the ``\verb+@+" character) provide the meta-information. Then the trajectory lines describe the movement. The CSV encoding is segment based \cite{OGC14-084r2}, that is, each line describes a trajectory segment with two or more coordinate pairs (or triplets for 3D trajectories). \begin{figure}[htb] \begin{lstlisting} @stboundedby,urn:x-ogc:def:crs:EPSG:6.6:4326, 2D,10.0 10.0,10.6 12.2,2011-07-14T22:00:00Z, 2011-07-14T22:00:20Z,sec @columns,mfidref,trajectory,gear,xsd:integer A,0,5,10.0 10.0 10.2 10.6,1 A,5,10,10.2 10.6 10.4 11.2,2 A,10,15,10.4 11.2 10.5 11.7,2 A,15,20,10.5 11.7 10.6 12.2,3 B,0,20,2.0 2.0 2.1 2.1,1 \end{lstlisting} \caption{CSV encoding of vehicles $A$ and $B$} \label{fig:csv} \end{figure} \begin{figure*}[htb] \begin{lstlisting}[language=XML] <?xml version="1.0" encoding="UTF-8"?> <mf:MovingFeatures xmlns:mf="http://schemas.opengis.net/mf-core/1.0" ...> <mf:STBoundedBy offset="sec"> <gml:EnvelopeWithTimePeriod srsName="urn:x-ogc:def:crs:EPSG:6.6:4326"> <gml:lowerCorner>10.0 10.0</gml:lowerCorner> <gml:upperCorner>10.6, 12.2</gml:upperCorner> <gml:beginPosition>2011-07-14T22:00:00Z</gml:beginPosition> <gml:endPosition>2011-07-14T22:00:20Z</gml:endPosition> </gml:EnvelopeWithTimePeriod> </mf:STBoundedBy> <mf:Member> <mf:MovingFeature gml:id="A"> <gml:name>NissanA</gml:name> <gml:description>Nissan Sentra ...</gml:description> </mf:MovingFeature> </mf:Member> <mf:Header> <mf:VaryingAttrDefs> <mf:attrDef name="gear" type="xsd:integer"> <mf:AttrAnnotation>The gear number used... </mf:AttrAnnotation> </mf:attrDef> </mf:VaryingAttrDefs> </mf:Header> <mf:Foliation> <mf:LinearTrajectory gml:id="LT0001" mfIdRef="A" start="0" end="5"> <gml:posList>10.0 10.0 10.2 10.6</gml:posList> <mf:Attr>1</mf:Attr> </mf:LinearTrajectory> <mf:LinearTrajectory gml:id="LT0003" mfIdRef="A" start="5" end="10"> <gml:posList>10.2 10.6 10.4 11.2</gml:posList> <mf:Attr>2</mf:Attr> </mf:LinearTrajectory> <mf:LinearTrajectory gml:id="LT0003" mfIdRef="A" start="10" end="15"> <gml:posList>10.4 11.2 10.5 11.7</gml:posList> <mf:Attr>2</mf:Attr> </mf:LinearTrajectory> <mf:LinearTrajectory gml:id="LT0003" mfIdRef="A" start="15" end="20"> <gml:posList>10.5 11.7 10.6 12.2</gml:posList> <mf:Attr>3</mf:Attr> </mf:LinearTrajectory> </mf:Foliation> </mf:MovingFeatures> \end{lstlisting} \caption{XML encoding of vehicle $A$} \label{fig:xml} \end{figure*} The first header line specifies the spatio-temporal boundary of the moving features. It lists the spatial reference system used, the number of dimensions of the geometries, the coordinates of the corners of the spatial boundary, the start and end times, and the time encoding, that is, the units of time used in the trajectory lines for encoding the offset from the start time. The second header line specifies the columns in the trajectory lines. The first column \verb+mfidref+ is used to identify the moving object. The second column \verb+trajectory+ defines the spatio-temporal geometry, followed by the definition of the time-varying attributes (name and its type). The following trajectory lines contain the spatio-temporal geometries for moving features. Each line specifies the \verb+mfidref+, the start and end time, which can be specified as absolute or relative (offset) values, the points of the line string and the attribute values. Since temporal geometry and temporal attributes (in this case the gear) are specified together, it is necessary to encode intermediate locations each time a temporal attribute changes its value. The CSV encoding assumes linear interpolation between locations. There is no way to store timestamps for intermediate positions along trajectory segments. The interpolation assumes constant speed along a segment. A notable design choice is that that the segment geometries are not encoded as well-known text (WKT), which would have made the CSV more easily readable by existing GIS tools. \subsection{XML Encoding} Like the CSV encoding, the XML encoding is also segment based. Fig.~\ref{fig:xml} shows the XML representation of the example introduced in Fig.~\ref{fig:example}. It is obvious that this encoding is considerably more verbose than the CSV encoding. The most essential XML tags are: \begin{itemize} \item \verb+mf:STBoundedBy+ specifies the spatiotemporal bounding box and time units \item \verb+mf:Member+ specifies properties of the moving features \item \verb+mf:Header+ contains meta-information about the moving features, for example, attribute definition \item \verb+mf:Foliation+ specifies the moving geometry and the dynamic attributes \end{itemize} While the XML encoding does support different interpolation types, the same interpolation applies to all attributes (linear by default). Therefore, we cannot specify that the geometry evolves linearly while the gear changes in a stepwise manner. \begin{figure*}[htb] \begin{lstlisting} { "type": "MovingFeature", "temporalGeometry": { "type": "MovingPoint", "coordinates": [ [10.0, 10.0], [10.4, 11.2], [10.6, 12.2] ], "datetimes": ["2011-07-14T22:00:00Z", "2011-07-14T22:00:10Z", "2011-07-14T22:00:20Z"], "interpolations": "Linear" }, "temporalProperties": [ { "name": "gear", "values": [1, 2, 3, 3], "datetimes": ["2011-07-14T22:00:00Z", "2011-07-14T22:00:05Z", "2011-07-14T22:00:15Z", "2011-07-14T22:00:20Z"], "interpolations": "Stepwise" }, ], "stBoundedBy": { "bbox": [10.0, 10.0, 10.6, 12.2], "period": { "begin": "2011-07-14T22:00:00Z", "end" : "2011-07-15T22:00:20Z" } }, "properties": { "name": "NissanA", "description": "Nissan Sentra ..." } } \end{lstlisting} \caption{JSON encoding of vehicle $A$ } \label{fig:json} \end{figure*} \subsection{JSON Encoding} Contrary to the previous two encodings, the JSON encoding is point based rather than segment based. Fig.~\ref{fig:json} shows the JSON representation of the example introduced in Fig.~\ref{fig:example}. The essential elements are: \begin{itemize} \item \verb+temporalGeometry+ represents the coordinates and timestamps in parallel arrays and states that linear interpolation is used \item \verb+temporalProperties+ allows us to represent several such properties, where the values and the timestamps of each of them are represented as parallel arrays, and the interpolation is also stated, which is stepwise in our example for the attribute gear \item \verb+stBoundedBy+ states the spatio-temporal bounding box \item \verb+properties+ represents static / non-temporal descriptive attributes \end{itemize} The JSON encoding is considerably more compact than the CSV and XML encodings since the temporal geometry and the temporal attributes and their respective timestamps are encoded independently. In a real-world vehicle tracking use case, for example, there would considerably fewer gear changes than location changes. Therefore, it saves space to only record gear change events when necessary instead of reporting the gear setting at every location. However, there are still ambiguous situations: for example, for attributes with stepwise interpolation, it is not possible to specify whether the change of value is exactly at the timestamp or just after it. Therefore, when trying to determine the period of time when the first gear is used, we cannot specify whether it was used during [2011-07-14 22:00:00, 2011-07-14 22:00:05] or [2011-07-14 22:00:00, 2011-07-14 22:00:05) (notice the right-open end of the period). This has implications when computing topological predicates for moving geometries, because -- depending on the predicate considered -- the fact that a moving geometry is inside or crosses a boundary needs to take into account whether the bounds of the period are left- and right-inclusive or not. \subsection{Moving Feature Encodings Summary} As the examples in the previous sections show, the three Moving Feature encoding schemes implement different concepts for modeling movement data. This makes it hard to understand and use the standard since each encoding choice has different consequences. To summarize the situation, Table~\ref{tab:1} lists the advantages and limitations of the three Moving Feature encoding options. Overall, the JSON encoding (which is the most recent addition to the standard) is the most compact and has the fewest limitations. However, it is worth mentioning that the segment based CSV and XML encodings (unlike the point based JSON encoding) allow us to represent temporal gaps due to the fact that every segment has both a start and an end timestamps. This is important from a modeling perspective since it makes it possible to represent, for example, that the GPS signal was lost while a moving car was inside a tunnel. \subsection{Moving Features Access} Besides encodings, Moving Features also standardizes functions for working with movement data. The corresponding standard is called OGC Moving Features Access \cite{OGC16-120r3} and it covers a wide range of functions for the retrieval of trajectory feature attributes, as well as operations between trajectories and geometry objects. Functions to retrieve feature attributes include basic functions to access the location, speed, or acceleration at a given time, or the subtrajectory between two timestamps. Conversely, there is also a function to extract the time at a given point. These and similar functions can be found in many existing tools, such as the ones analyzed by \cite{graser_movingpandas_2019}. Beyond these basic functions, however, the standard also defines more obscure functions, such as, for example, timeToDistance which “shall return a graph of the time to distance function as a set of curves in the Euclidean space consisting of coordinate pairs of time and distance”. The standard remains unclear as to how exactly this curved graph should be implemented. \subsection{Discussion} The limited success of OGC Moving Features so far may be due to its failure to involve a wide user base during its development stage. The lack of wide-spread engagement certainly limits public awareness of the standard's existence. Some of the limitations (particularly of the CSV and XML encodings) as well as ambiguities in the standard may be due to limited diversity of perspectives represented during the development of the standard. The decision to define multiple encoding standards that implement different concepts for modelling movement data further complicates the situation and potentially hinders the standard's adoption. Another limiting factor is that, currently, there is no official reference implementation of OGC Moving Features. However, MobilityDB \cite{zimanyi2019mobilitydb, MobilityDB} builds upon the OGC Moving Features specification to add support for spatiotemporal objects to PostGIS databases. This effort may be considered a reality check to gauge the real-world applicability of the standard. \section{Towards an API for Mobility Data Science} Multiple notable recent publications, such as \cite{dodge_analysis_2016, demsar_analysis_2015}, have emphasized the need for a movement data science that bridges the boundaries of established domains, such as ecology, human mobility analytics for health and planning, or transportation research. Why then has there been such limited progress towards a common understanding and implementations of the key elements of an API for movement data analysis or even just a common data exchange format? The following conjectures summarize some of the main challenges that we have identified: \textbf{Conjecture 1: The curse of movement data heterogeneity.} From high-resolution continuous tracking data of cooperative moving objects to sparse checkpoint-based trajectories with large spatiotemporal uncertainties, the flavours of movement datasets vary vastly. Furthermore, there is no consistent terminology \cite{graser_movingpandas_2019}: for example, terms such as trajectory, track, path, move, trip or travel may used to describe the same or different concepts related to movement. Moreover, while some domains still struggle to collect sufficient data, others are amassing huge amounts thanks to recent advances in location and communication technologies. But even if data is plentiful, there is a lack of commonly available data management tools for such volumes of data, and a pressing need for them. However, this heterogeneity means that it is unlikely that there will be one solution that fits all requirements. Therefore, our chances to build a flourishing mobility data science environment would be vastly improved by a shared terminology, as well as a set of standard data formats and well-defined analysis functions. \textbf{Conjecture 2: Lack of pragmatic solutions.} Many recently popularized data formats followed a somewhat opposite approach to established standardization processes. For example, GeoJSON, Vector tiles, or GTFS (General Transit Feed Specification) and the software tools around them quickly gained popularity as useful and pragmatic solutions for common problems. Individual mobility data projects, such as, for example, \cite{TraceJSON} try to follow a similar approach but have yet to reach a critical mass of users. The challenge lies in addressing the common problems faced by movement data analysts in different domains. \textbf{Conjecture 3: Wrong priorities and incentives.} Spatiotemporal data analysis is a hard nut to crack. However, there is no shortage of publications and sophisticated concepts, reaching back to, works such as \cite{sistla1997modeling}. Similarly, there are numerous research software prototypes but most of them are not usable since they were either never made publicly available or not engineered for use by others other than the original author. The current scientific environment provides very limited incentives for the development of well-engineered scientific software. It is risky to spend time on development when academic hiring committees may only look at the conventional publication record. \section{Conclusion} To solve the above mentioned issues and advance the mobility data science domain, we have to take steps to overcome these challenges. Looking back on how static/non-moving spatial data science tools have evolved over the last decades, we advocate for the following essential building blocks: \textbf{A. Common movement data analysis concepts:} Whether through official standards or by adopting a pragmatic de facto standard, a common terminology would vastly improve the exchange of movement data methodology. However, so far, there are no strong contenders for a widely adopted standard. OGC's Moving Feature Standards lacks essential features that would facilitate its wide-spread adoption. A well-accepted standard would provide a common reference framework for development efforts from all sides of the mobility data science community. Furthermore, it has the potential to facilitate the exchange of movement analysis methods by establishing a shared language with a well defined terminology. \textbf{B. An open general-purpose mobility (data) engine:} There are standard libraries for manipulating non-moving geometries (such as the JTS Topology Suite (Java Topology Suite) and its C++ port GEOS \cite{geos}) and numerous spatial data analysis tools (such as GeoTools, GDAL, R, PostGIS, QGIS, Google Earth, and NASA WorldWind) build on these libraries. Similarly, mobility data science would profit from a standard library for manipulating moving geometries. To avoid unnecessary duplication of spatial data handling functionality, such a mobility engine should build upon existing libraries for non-moving geometries. The mobility engine development should focus on the specific spatiotemporal aspects of movement data, while delegating the geometric manipulation to the underlying libraries. Language bindings for higher-level programming languages such as Python and R should be considered essential for a wider industry adoption. This general purpose mobility engine would enable faster development of more specialized movement data analysis tools while still keeping a common base framework. \textbf{C. Focus on open science and reproducibility:} A push towards open scientific practices, including code sharing and replication of results by peers (before and after publication) would be one step towards incentivizing the development of better scientific software. Furthermore, it would speed up research and development by removing the need to re-implement the same things over and over again and instead build on each others work. \bibliographystyle{apalike}
\section{Introduction} \iffalse In the last few years, a lot of works try to learn how people make decisions. However, those models usually simulate the process within latent space which is a black-box for humans. People can only passively accept the result without knowing the reasons. Among those decision-making algorithms, recommender system algorithms are broadly used in normal life. Moreover, researchers gradually realized the benefits brought by explanations in recommender systems. Through explaining why the system recommend such items, users are potentially telling why the algorithm recommends wrong items. The transparent system will increase the confidence or the trust of customers which can gain more profit in the long term. Not only academics are studying this issue, but the explainable recommendation systems have emerged in our daily lives. For example, the online shopping platform Amazon already started to tell consumers why recommended (Fig.\ref{fig:amazon}). \zfcomment{what behavior to humans?} After the term \textit{explainable recommendation} was formally introduced in recent years\cite{zhang2014explicit}, a large number of great works focus on this area. Many popular explainable recommendation approach is model-based method that one designed model can provide both of recommendation and explanation. The model-based explainable recommendation algorithms are closely related to recommendation model with machine learning such as matrix factorization, topic modelling, etc. However, there are many much more complicated models cannot be explained. For example, in an e-commerce system, the recommendation lists are usually generated by a hybrid system containing many different methods. In this case, we rely on model-agnostic methods (also known as post hoc) which separate recommendation and explanation into two independent models. After an item is recommended by any recommendation model, the explanation model can generate a simple explanation based on statistic or data mining, for example, "because of another item you purchased". The main focus for these approaches is to find out the relationships between items. Peake and Wang proposed an association rule mining approach\cite{peake2018explanation} for post hoc explainable recommendation. The authors consider a matrix factorization model as a black-box model and extract the association rules based on the data consisting of the user history and recommended items. The association rules are used to generate the explanation if the recommended item can also be found in an association rule, for example, an item pair $(A, B)$ can be explained as "Because you purchased A, the system recommends B". An association rule is consist of an antecedent and a consequent which could be a kind of explanation. However, it is just co-occurrence instead of causality. Explanation by association rules could be a coincidence which cannot be a reliable explanation. One example is the "beer and diapers" story that young American males who buy diapers also have a predisposition to buy beer. The explanation with association rules may get that "because you purchased diapers, the system recommends beer". Obviously, it is not a trustworthy explanation. Instead, when explaining the recommendation with causality, this kind of mistakes due to high co-occurrence will disappear. In this paper, we apply a method extracting causal relationships for post hoc explainable sequential recommendation. We try different sequential recommendation models as the black-box model and give explanations. We will theoretically prove that the relationship that extracted by our model is high probably a causality. Meanwhile, our model will get better performance against baselines in term of model fidelity which is defined as the percentage of explainable items in recommended items. \fi As widely used in decision-making, recommender systems have been recognized for its ability to provide high-quality services that reduces the gap between products and customers. Nowadays, many state-of-the-art performances are achieved by neural network models. Typically, deep learning models are used as black-box latent factor models accompanied with a high-dimensional latent space. This allows them to achieve good expressiveness power and accuracy in various recommendation tasks. However, it is also true that complex neural models easily go beyond the comprehension of the majority of customers, since thousands or millions of parameters are involved. Nevertheless, it is a natural demand of human-beings to understand why a model makes a specific decision, rather than blindly accepting the results without knowing the underlying reason. As a result, providing supportive information and interpretation along with the recommendation can be helpful for both the customers and the platform, since it improves the transparency, trustworthiness, effectiveness, and user satisfaction of the recommendation systems, while facilitating system designers to refine the algorithms \cite{zhang2018explainable}. For example, a user may be inspired by the recommendation panel explained as ``you may also like'' in an e-commerce system, and thus decides to look around for more items that better satisfy his or her interests. In the meantime, the user preference would be captured more precisely, so that better services can be provided in further interactions. On the other hand, system designers may also easily figure out the reasons of providing unsatisfied recommendation, leveraging the result to take actions. \begin{figure}[t] \centering \includegraphics[scale=0.5]{./fig/post-hoc.pdf} \vspace{-15pt} \caption{The model-intrinsic approaches directly generate the recommendations and explanations, while the model-agnostic approaches generate explanations after the black-box model has generated the recommendations.} \vspace{-20pt} \label{fig:posthoc} \end{figure} To address the explainability problem, researchers turned to explainable recommendation models, which are expected to not only generate effective recommendations but also intuitive explanations to humans. Generally, the explainable models can be either model-intrinsic or model-agnostic (also known as post-hoc), as shown in Fig.\ref{fig:posthoc}. The model-intrinsic approach takes advantage of the interpretable mechanism of the model, with the explanations directly provided as the intermediate stages of recommended decisions. For instance, simple user-based collaborative filtering methods pass an item from one user to another similar user, and thus it can directly output explanations like ``similar users also bought this item''. However, the recommendation explanations are usually not obtained for free, and sometimes we have to trade-off with model accuracy~\cite{theodorou2017designing}. In many cases, outstanding recommendation performances are usually achieved by models that are less interpretable. Thus, it is very challenging for current explainable recommendation methods to redesign a black-box model into an interpretable one whilst maintaining the recommendation performance \cite{zhang2018explainable}. In contrast, post-hoc models make no assumption of the underlying recommendation model, and allow the decision mechanism to be a black-box, since it will provide explanations after a decision is made. Although such explanations may not strictly follow the exact mechanism that generated the recommendations, they offer the flexibility to be applied to many different models. Though it is still not fully understood what information is useful for generating explanations for a certain recommendation result, Peake ~\cite{peake2018explanation} argued that one can provide post-hoc item-level explanations. In other words, interacted items (the causes) in a user's history can be used as explanations for the future item recommendations (the effect), since it answers ``what items you bought causes the recommendation of this item''. However, existing work mostly use global association rule mining to discover the relationship between items, which relies on the item co-occurrence among all user transactions. Therefore, the explanations are not personalized, i.e., different users would receive the same explanation as long as they are recommended with the same item and have overlapped histories. This makes it incompatible with modern recommender systems, which aims to provide personalized services to users. Moreover, the item-level explanation problem naturally involves causal analysis between a user's previous and future behaviors, which makes the problem even more challenging since it has to answer counterfactual questions such as ``what would happen if a different set of items were purchased''. In this paper, we explore a causal analysis framework to provide post-hoc causal explanations for any sequential recommendation algorithm. The goal is to design a model that generates post-hoc explanations for black-box recommendation models in order to reduce the accuracy-interpretability trade-off. Since the explanation model and recommendation model work separately, we obtain the benefit of explainability without hurting the prediction performance. Technically, we propose a Variational Auto-Encoder (VAE) based perturbation framework to create counterfactual examples for causal analysis, which extracts causal rules between a user's previous and future behaviors as explanations. The key contributions of this paper are as follows: \begin{itemize} \item We design and study a causal rule mining framework for sequential recommendation. \item We show that this framework can generate personalized post-hoc explanations based on item-level causal rules to explain the behaviors of a sequential recommendation model. \item We conduct experiments on real-world data to show that our explanation model outperforms state-of-the-art baselines. \end{itemize} In the following, we review related work in in Section 2, and introduce our model in Section 3. Experimental settings and results are provided in Section 4. We conclude this work in Section 5. \iffalse To date, researchers mainly focus on achieving the highest possible model performance and have been making great efforts to solve optimization problems in machine learning area. Most machine learning algorithms use black-box latent factor models to abstract their learning processes to a high-dimensional latent space, which goes beyond the direct comprehension of humans. Thus they can not provide an explanation of how a prediction has been made. With the broad use of machine learning algorithms in decision-making tasks, especially in some risk sensitive areas, such as health care, legal and fintech fields, the problems caused by the intransparency have emphasized the necessity of ensuring the explicability of models to develop people's trust in their decisions. In many cases, humans need to understand why a model make a specific decision rather than just can only decide whether to accept the results without knowing the reason. For example, in "human-in-the-loop" pattern where requires human interaction, the decisions given by models must be understandable by humans for achieving cooperation with machines. Therefore, it is very important yet challenging to establish approaches which can provide explanation for the behavior of the black-box models of decision-making algorithms without sacrificing their performance. As a widely used decision-making system, state-of-the-art recommender systems, though having the ability to provide high-quality recommendations, usually can't explain their working process and results to humans. This lack of explainability for recommendation algorithms leads to critical problems in practice. For example, without letting users know the reason of providing specific results, the system may be less effective in persuading users to adopt the recommendations and further decrease the system's trustworthiness. What's more, providing supportive information and interpretation along with the recommendation is also potentially helpful for complicated decision making. For example, doctors may need comprehensive healthcare recommendations with interpretations to make best diagnoses. Explainable recommendation algorithms focus on developing models which can generate not only effective recommendations but also intuitive explanations to help humans, including the users and system designers, to understand why a particular result is provided, and how to leverage the result to take actions, thus help to improve the transparency, trustworthiness, effectiveness and user satisfaction of the recommendation systems, as well as facilitates system designers to debug and refine the algorithms. Typically, the explainable models can be either model-intrinsic or model-agnostic (also known as post-hoc) as shown in Fig.\ref{fig:posthoc}. The decision mechanism for model-intrinsic approach is transparent since they develop interpretable models, so as to provide explanations for the model decisions directly. Differently, the post-hoc models allow the decision mechanism to be a black-box and provide explanations for a decision after it has been made. Although such explanations may not follow the exact mechanism strictly, they have advantages that can be applied in many different models more flexibly. In this paper, we design a model to generate post-hoc explanation for black-box recommendation models in order to reduce the accuracy-interpretability trade-off. In other words, since the explanation model and black-box model are working separately and the black-box model is fixed after trained, we can obtain the benefit of explainability without hurting the predictive performance. The paper \cite{peake2018explanation} provides an approach to give the post-hoc interpretation for recommendation systems by mining the association rules among the purchased items. However, such explanation can't be satisfactory and even can be incomprehensible sometimes, since the association rules can only tell the co-occurrence of items, but do not represent the causation. What's more, too many spurious association rules among the data, such as the fake association brought by the sample selection bias, may usually cause the unreliable results of the systems. One classical example of association rule for the human purchase behavior is $\{$diapers$\rightarrow$ beer$\}$, which indicates that if a customer purchases diapers, it's likely that he also purchases beer. The explanation given by association rule is that "Because you purchased diapers, the system recommends you beer", which is obvious a confusing explanation. Thus it's naturally to think about using a kind of more stable and explainable relationship among the data to remove the fake associations and unreliable explanations caused by high co-occurrence rat , which is the causation. To the best of our knowledge, it is the first work to provide causal explanations for sequential recommendation systems. The causal relationships can be extracted from itemsets of user purchase history through our proposed two-step model. Firstly, for doing causal analysis, a perturbation model is introduced to generate data for achieving random experiments on black-box models. After that, causal relationships can be captured within a causal rule mining module. Our model is tested on real dataset to provide causal explanations for a state-of-the-art sequential recommendation system. The extracted causal rules are evaluated by showing their reliability, model fidelity and superior explanation performance comparing with association rules, which exhibits that causal rules can provide more reliable and intuitive explanations for black-box sequential recommender systems. In the following, we review some related work in Section 2, introduce our model in Section 3, and conduct experiments and make discussions in Section 4. Finally, we conclude this work in Section 5. \fi \section{Related Work} \subsection{Sequential Recommendation} Sequential recommendation takes into account the historical order of items interacted by a user, and aims to capture useful sequential patterns for making consecutive predictions of the user's future behaviors. Rendle et al. \cite{rendle2010factorizing} proposed Factorized Personalized Markov Chains (FPMC) to combine Markov chain and matrix factorization for next basket recommendation. The Hierarchical Representation Model (HRM) \cite{wang2015learning} further extended this idea by leveraging representation learning as latent factors in a hierarchical model. However, these methods can only model the local sequential patterns of very limited number of adjacent records. To model multi-step sequential behaviors, He et al. \cite{he2016fusing} adopted Markov chain to provide recommendations with sparse sequences. Later on, the rapid development of representation learning and neural networks introduced many new techniques that further push the research of sequential recommendation to a new level. For example, Hidasi et. al. \cite{hidasi2015session} used an RNN-based model to learn the user history representation, Yu et. al. \cite{yu2016dynamic} provided a dynamic recurrent model, Li et. al. \cite{li2017neural} proposed an attention-based GRU model, Chen et. al. \cite{chen2018sequential} developed user- and item-level memory networks, and Huang et. al. \cite{huang2018improving} further integrated knowledge graphs into memory networks. However, most of the models exhibit complicated neural network architectures, and it is usually difficult to interpret their prediction results. As a result, we would like to generate explanations for these black box sequential recommendation models. \subsection{Explainable Recommendation} Explainable recommendation focuses on developing models that can generate not only high-quality recommendations but also intuitive explanations, which help to improve the transparency of the recommendation systems \cite{zhang2018explainable}. Generally, the explainable models can either be model-intrinsic or model-agnostic as introduced in introduction. As for model-intrinsic approaches, lots of popular explainable recommendation methods, such as factorization models \cite{zhang2014explicit,chen2018attention,wang2018explainable}, deep learning models \cite{seo2017interpretable,chen2018sequential,li2019capsule,costa2018automatic}, and knowledge graph models \cite{ai2018learning,xian2019reinforcement,huang2018improving,fu2020fairness,ma2019jointly,wang2019explainable} have been proposed. A more complete review of the related models can be seen in \cite{zhang2018explainable}. However, they mix the recommendation mechanism with interpretable components, which often results in a system too complex to make successful explanations. Moreover, the increased model complexity may reduce the interpretability. A natural way to avoid this dilemma is to rely on model-agnostic post-hoc approaches so that the recommendation system is free from the noises of the down-stream explanation generator. Examples include \cite{mcinerney2018explore} that proposed a bandit approach, \cite{wang2018reinforcement} that proposed a reinforcement learning framework to generate sentence explanations, and \cite{peake2018explanation} that developed an association rule mining approach. In their work, the transactions of all users, which consider user history as input and recommendation item as output, are used to extract association rules as the explanation for black-box models. However, correlation is not reliable for its direction agnostic feature. As will mention in the next part, our goal here is to find causal relationships in the user behaviour, which we can provide more stable explanations. \subsection{Causal Inference in Recommendation} Originated as statistical problems, causal inference \cite{pearl2000causality,imbens2015causal} aims at understanding and explaining the causal effect of one variable on another. While the observational data is considered as the factual world, causal effect inferences should be aware of the counterfactual world, thus often regarded as the question of "what-if". The challenge is that it is often expensive or even impossible to obtain counterfactual data. For example, it is immoral to re-do the experiment on a patient to find out what will happen if we have not given the medicine. Though the majority of causal inference study resides in the direction of statistics and philosophy, it recently attract attention from AI community for its great power of explainablity and bias elimination ability. Efforts have managed to bring causal inference to several machine learning areas, including recommendation \cite{bonner2018causal}, learning to rank \cite{joachims2017unbiased}, natural language processing \cite{wood2018challenges}, and reinforcement learning \cite{buesing2018woulda}, etc. With respect to recommendation tasks, large amount of work is about how to achieve de-bias matrix factorization with causal inference. The probabilistic approach ExpoMF proposed in \cite{liang2016modeling} directly incorporated user exposure to items into collaborative filtering, where the exposure is modeled as a latent variable. Liang et. al.\cite{liang2016causal} followed to develop a causal inference approach to recommender systems which believed that the exposure and click data came from different models, thus using the click data alone to infer the user preferences would be biased by the exposure data. They used causal inference to correct for this bias for improving generalization of recommendation systems to new data. Bonner et. al.\cite{bonner2018causal} proposed a new domain adaptation algorithm which was learned from logged data including outcomes from a biased recommendation policy, and predicted recommendation results according to random exposure. Differently, this paper focuses on learning causal rules to provide more intuitive explanation for the black-box recommendation models. Additionally, we consider \cite{alvarez2017causal} as a highly related work though it is originally proposed for natural language processing tasks. As we will discuss in the later sections, we utilize some of the key ideas of its model construction, and show why it works in sequential recommendation scenarios. \vspace{-3pt} \section{Proposed Approach} In this section, we first define the explanation problem and then introduce our model as a combination of two parts: a VAE-based perturbation model that generates the counterfactual samples for causal analysis, and a causal rule mining model that can extract causal dependencies between the cause-effect items. \subsection{Problem Setting} We denote the set of users as $\mathcal{U}=\{u_1,u_2,\cdots, u_{|\mathcal{U}|} \}$ and set of items as $\mathcal{I}=\{i_1,i_2.\cdots,i_{|\mathcal{I}|}\}$. Each user $u$ is associated with a purchase history represented as a sequence of items $\mathcal{H}^u$. The $j$-th interacted item in the history is denoted as $H_j^u \in \mathcal{I}$. A black-box sequential recommendation model $\mathcal{F}:\mathcal{H}\rightarrow\mathcal{I}$ is a function that takes a sequence of items (as will discuss later, it can be the permuted user history) as input and outputs the recommended item. In practice, the underlying mechanism usually consists of two steps: a ranking function that scores all candidate items based on the user history, and then selects the item with best score as the final output. Note that it only uses user-item interaction without any content or context information, and the scores predicted by the ranking function may differ according to the tasks (e.g. $\{1,\dots,5\}$ for rating prediction, while $[0,1]$ for CTR prediction). Our goal is to find an item-level post-hoc model that captures the causal relation between the history items and the recommended item for each user. \begin{mydef} (Causal Relation) For two variables $X$ and $Y$, if $X$ triggers $Y$, then we say that there is a causal relation $X \Rightarrow Y$, where $X$ is the \textbf{cause} and $Y$ is the \textbf{effect}. \end{mydef} When a given recommendation model $\mathcal{F}$ maps a user history $\mathcal{H}^u$ to a recommended item $Y^u\in\mathcal{I}$, all items in $\mathcal{H}^u$ are considered as potential causes of $Y^u$. Thus we can formulate the set of causal relation candidates as $\mathcal{S}^u = \{(H,Y^u)|H\in\mathcal{H}^u\}$. \begin{mydef} (Causal Explanation for Sequential Recommendation Model) Given a causal relation candidate set $\mathcal{S}^u$ for user $u$, if there exists a true causal relation $(H,Y^u) \in\mathcal{S}^u$, then the causal explanation for recommending $Y^u$ is described as ``Because you purchased $H$, the model recommends you $Y^u$'', denoted as $H\Rightarrow Y^u$. \end{mydef} Then the remaining problem is how to determine whether a candidate pair is a true causal relation. We can mitigate the problem by allowing a likelihood estimation for a candidate pair to be causal relation. In other words, we would like to find a ranking function that predicts the likelihood for each candidate pair. In this way, causal explanations can be generated by selecting the most promising ones from these candidates. One advantage of this formulation is that it allows the possibility that there is no causal relation between a user's history and the recommended item, e.g. when algorithm recommends the most popular items regardless of the user history. In the following sections, we will illustrate in detail how our model solves these problems. \begin{figure*}[htbp] \vspace{-10pt} \centering \includegraphics[width=\linewidth]{./fig/Model.pdf} \vspace{-20pt} \caption{Model framework. $x$ is the concatenation of the item embeddings of the user history. $\tilde{x}$ is the perturbed embedding. } \vspace{-10pt} \label{fig:model} \end{figure*} \begin{algorithm}[t] \caption{Causal Post-hoc Explanation Model} \begin{flushleft} \textbf{Input:} users $\mathcal{U}$, items $\mathcal{I}$, user history $\mathcal{H}^{u}$, perturbation times $m$, black-box model $\mathcal{F}$, embedding model $\mathcal{E}$, causal mining model $\mathcal{M}$\\ \textbf{Output:} causal explanations $H\Rightarrow Y^{u}$ where $H\in\mathcal{H}^{u}$\\ \end{flushleft} \begin{algorithmic}[1] \STATE Use embedding model $\mathcal{E}$ to get item embeddings $\mathcal{E}(\mathcal{I})$ \STATE Use $\mathcal{E}(\mathcal{I})$ and true user history to train perturbation model $\mathcal{P}$ \FOR{each user $u$} \FOR{$i$ from $1$ to $m$} \STATE $\tilde{\mathcal{H}}^u_i \leftarrow \mathcal{P}(\mathcal{H}^{u})$; $\tilde{Y}^u_i\leftarrow\mathcal{F}(\tilde{\mathcal{H}}^u_i)$ \ENDFOR \STATE Construct perturbed input-output pairs $\{(\tilde{\mathcal{H}}^u_i,\tilde{Y}^u_i)\}_{i=1}^m$ \STATE $\theta_{\tilde{H}^u_{ij},\tilde{Y}^u_{i}} \leftarrow \mathcal{M}\Big(\{(\tilde{\mathcal{H}}^u_i,\tilde{Y}^u_i)\}_{i=1}^m \cup (\mathcal{H}^u,Y^u)\Big)$ \STATE Rank $\theta_{\tilde{H}^u_{ij},Y^u}$ and select top-$k$ pairs $\{(H_j,Y^u)\}_{j=1}^k$ \IF{$\exists H_{\min\{j\}}\in \mathcal{H}^{u}$} \STATE Generate causal explanation $H_{\min\{j\}}\Rightarrow Y^u$ \ELSE \STATE No explanation for the recommended item $Y^u$ \ENDIF \ENDFOR \RETURN all causal explanations $H\Rightarrow Y^{u}$ \end{algorithmic} \label{alg:model} \end{algorithm} \subsection{Causal Model for Post-Hoc Explanation} We thus introduce our causal explanation framework for recommendation. Inspired by \cite{alvarez2017causal}, we divide our framework into two models: a perturbation model and a causal rule mining model. The overview of the model framework is shown in Fig.\ref{fig:model}. Before introducing our framework in detail, we define an important concept: \begin{mydef} (Causal Dependency): For a given pair of causal relation candidate $(H,Y^u)$, the causal dependency of the pair is the likelihood of the pair being a true causal relation. \end{mydef} \subsubsection{\textbf{Perturbation Model}} \label{sec:perturbation-model} To capture the causal dependency between items in history and the recommended items, we want to know what would happen if the user history had been different. To avoid unknown influences caused by the length of input sequence (i.e., user history), we keep the input length unchanged, and only replace items in the sequence to create different sequences. Ideally, for each item $H_j^u$ in a user's history $\mathcal{H}^u$, it will be replaced by all possible items in $\mathcal{I}$ to fully explore the influence that $H_j^u$ makes in the history. However, the number of possible combinations will become impractical for the learning system, since recommender systems usually deal with hundreds of thousands or even millions of items. Therefore, we pursue a perturbation-based method that samples the sequences, which randomly replaces items in the original user history $\mathcal{H}^u$. There are various ways to obtain the perturbed version of user history, as long as they are similar to the original history. The simplest solution is randomly selecting an item in $\mathcal{H}^u$ and replacing it with a randomly selected item from $\mathcal{I}$. However, user histories are far from random selections. Instead, a natural assumption is that the user behavior follows a certain distribution. Here, we adopt VAE to learn such a distribution. As shown in Figure \ref{fig:model}, we design a VAE-based perturbation method, which creates item sequences that are similar to but slightly different from a user's true behavior sequence, by sampling from a distribution in latent embedding space centered around the user's true sequence. In detail, the VAE component consists of a probabilistic encoder $(\mu,\sigma) = \mathrm{ENC}(\mathcal{X})$ and a decoder $\tilde{\mathcal{X}} = \mathrm{DEC}(z)$. The encoder encodes a sequence of item embeddings $\mathcal{X}$ into latent embedding space, and extracts the variational information for the sequence, i.e., mean and variance of the latent embeddings under independent Gaussian distribution. The decoder generates a sequence of item embeddings $\tilde{\mathcal{X}}$ given a latent embedding $z$ sampled from the Gaussian distribution. Here, both $\mathcal{X}$ and $\tilde{\mathcal{X}}$ are ordered concatenations of pre-trained item embeddings based on pair-wise matrix factorization (BPRMF) \cite{rendle2012bpr}. We follow the standard training regime of VAE by maximizing the variational lower bound of the data likelihood \cite{kingma2013auto}. Specifically, the reconstruction error involved in this lower bound is calculated by a softmax across all items for each position of the input sequence. We observe that VAE can reconstruct the original data set accurately, while offering the power of perturbation. After pretraining $\mathrm{ENC}(\cdot)$ and $\mathrm{DEC}(\cdot)$, the variational nature of this model allow us to obtain perturbation $\tilde{\mathcal{H}}$ for any history $\mathcal{H}$. More specifically, it first extracts the mean and variance of the encoded item sequences in the latent space, and the perturbation model samples $m$ latent embeddings $z$ based on the above variational information. These sampled embeddings $z$ are then passed to the decoder $\mathrm{DEC}(\cdot)$ to obtain the perturbed versions $\tilde{\mathcal{X}}$. For now, each item embedding in $\tilde{\mathcal{X}}$ may not represent an actual item since it is a sampled vector from the latent space, as a result, we find its nearest neighbor in the candidate item set $\mathcal{I}$ through dot product similarity as the actual item. In this way, $\tilde{\mathcal{X}}$ is transformed into the final perturbed history $\tilde{\mathcal{H}}$. One should keep in mind that the variance should be kept small during sampling, so that the resulting sequences are similar to the original sequence. Finally, the generated perturbed data $\tilde{\mathcal{H}}$ together with the original $\mathcal{H}$ will be injected into the black-box recommendation model $\mathcal{F}$ to obtain the recommendation results $\tilde{Y}$ and $Y$, correspondingly. After completing this process, we will have $m$ perturbed input-output pairs: $\{(\tilde{\mathcal{H}}^u_i,\tilde{Y}^u_i)\}_{i=1}^m$, as well as the original pair $(\mathcal{H}^u,Y^u)$. \subsubsection{\textbf{Causal Rule Learning Model}} \label{sec:causal_rule_learning} Denote $\mathcal{D}^u$ as the combined records of perturbed input-output pairs $\{(\tilde{\mathcal{H}}^u_i,\tilde{Y}^u_i)\}_{i=1}^m$ and the original pair $(\mathcal{H}^u,Y^u)$ for user $u$. We aim to develop a causal model that first extracts causal dependencies between input and output items appeared in $\mathcal{D}^u$, and then selects the causal rule based on these inferred causal dependencies. Let $\tilde{\mathcal{H}}^u_i=[\tilde{H}^u_{i1}, \tilde{H}^u_{i2}, \cdots, \tilde{H}^u_{in}]$ be the input sequence of the $i$-th record of $\mathcal{D}^u$. Let $\tilde{Y}^u_i$ represent the corresponding output. Note that this includes the original pair $(\mathcal{H}^u,Y^u)$. The model should be able to infer the causal dependency $\theta_{\tilde{H}^u_{ij},\tilde{Y}^u_{i}}$ between input item $\tilde{H}^u_{ij}$ and output item $\tilde{Y}^u_{i}$. We consider that the occurrence of a single output can be modeled as a logistic regression model on causal dependencies from all the input items in the sequence: \begin{equation} P(\tilde{Y}^u_{i}|\tilde{\mathcal{H}}^u_{i}) = \sigma\Big(\sum_{j=1}^n \theta_{\tilde{H}^u_{ij},\tilde{Y}^u_{i}}\cdot\gamma^{n-j}\Big)\label{con:eq1} \vspace{-5pt} \end{equation} where $\sigma$ is the sigmoid function defined as $\sigma(x) = (1+\exp(-x))^{-1}$ in order to scale the score to $[0,1]$. Additionally, in recommendation task, the order of a user's previously interacted items may affect their causal dependency with the user's next interaction. A closer behavior tends to have a stronger effect on user's future behaviors, and behaviors are discounted if they happened earlier~\cite{hidasi2015session}. Therefore, we involve a weight decay parameter $\gamma$ to represent the time effect. Here $\gamma$ is a positive value less than one. For an input-output pair in $\mathcal{D}^u$, the probability of its occurrence generated by Eq.\eqref{con:eq1} should be close to one. As a result, we learn the causal dependencies $\theta$ by maximizing the probability over $\mathcal{D}^u$. When optimizing $\theta$, they are always initialized as zero to allow for no causation between two items. By learning this regression model, we are able to gradually increase $\theta$ until they converge to the point where the data likelihood of $\mathcal{D}$ is maximized. After gathering all the causal dependencies, we select the items that have high $\theta$ scores to build causal explanations. This involves a three-step procedure. \begin{itemize}[leftmargin=*] \item[1.] We select those causal dependencies $\theta_{\tilde{H}^u_{ij},\tilde{Y}^u_{i}}$ whose output is the original output $Y^u$ (i.e., $\tilde{Y}^u_{i}=Y^u$). Note that these $(\tilde{H}^u_{ij},Y^u)$ pairs may come from either the original sequence or perturbed sequences, because when a perturbed sequence is fed into the black-box recommendation model, the output may happen to be the same as the original sequence $Y^u$. \item[2.] We sort the above selected causal dependencies in descending order and take the top-$k$ $(\tilde{H}^u_{ij},Y^u)$ pairs. \item[3.] If there exist one or more pairs in these top-$k$ pairs, whose cause item $\tilde{H}^u_{ij}$ appears in the user's original input sequence $\mathcal{H}^u$, then we pick such pair of the highest rank, and construct $\tilde{H}^u_{ij}\Rightarrow Y^u$ as the causal explanation for the given user. Otherwise, i.e., no cause item appears in the user history, then we output no causal explanation for the user. \end{itemize} Note that the extracted causal explanation is personalized since the algorithm is applied on $\mathcal{D}^u$, which only contains records centered around the user's original record $(\mathcal{H}^u,Y^u)$, while collaborative learning among users is indirectly modeled by the VAE-based perturbation model. The overall algorithm is provided in Alg.\ref{alg:model}. \section{Experiments} In this part, we conduct experiments to show what causal relationships our model can capture and how they can serve as an intuitive explanation for the black-box recommendation model. \subsection{Dataset Description} We evaluate our proposed causal explanation framework against baselines on two datasets. The first dataset is MovieLens100k\footnote{https://grouplens.org/datasets/movielens/}. This dataset consists of information about users, movies and ratings. In this dataset, each user has rated at least 20 movies, and each movie can belong to several genres. The second dataset is the office product dataset from Amazon\footnote{https://nijianmo.github.io/amazon/}, which contains the user-item interactions from May 1996 to July 2014. The original dataset is 5-core. To achieve sequential recommendation with input length of 5, we select the users with at least 15 purchases and the items with at least 10 interactions. Since our framework is used to explain sequential recommendation models, we split the dataset chronologically. To learn the pre-trained item embeddings based on BPRMF \cite{rendle2012bpr} (section \ref{sec:perturbation-model}), we take the last 6 interactions from each user to construct the testing set, and use all previous interactions from each user as the training set. To avoid data leakage, when testing the black-box recommendation models and our VAE-based perturbation model, we only use the last 6 interactions from each user (i.e., the testing set of the pre-training stage). Following common practice, we adopt the leave-one-out protocol, i.e., among the 6 interactions, we use the last one for testing, and the previous 5 as input to recommendation models. A brief summary of the data is shown in Table \ref{tab:data}. \begin{table}[t] \centering \setlength{\tabcolsep}{1pt} \begin{tabular}{ccccccc} \toprule Dataset & \# users & \# items & \# interactions & \# train & \# test & sparsity \\\midrule Movielens & 943 & 1682 & 100,000 & 95,285 & 14,715 & 6.3\%\\ Amazon & 573 & 478 & 13,062 & 9,624 & 3,438 & 4.7\%\\\bottomrule \end{tabular} \caption{Summary of the Datasets} \vspace{-10pt} \label{tab:data} \vspace{-10pt} \end{table} \begin{table*}[t] \centering \setlength{\tabcolsep}{4pt} \begin{tabular}{ccccccccccccc} \toprule Dataset & \multicolumn{6}{c}{Movielens 100k} & \multicolumn{6}{c}{Amazon}\\\cmidrule(lr){1-1}\cmidrule(lr){2-7}\cmidrule(lr){8-13} Method & \multicolumn{3}{c}{Causal} & \multicolumn{3}{c}{Association} & \multicolumn{3}{c}{Causal} & \multicolumn{3}{c}{Association}\\\cmidrule(lr){2-4}\cmidrule(lr){5-7}\cmidrule(lr){8-10}\cmidrule(lr){11-13} Parameter & $k=1$ & $k=2$ & $k=3$ & Support & Confidence & Lift & $k=1$ & $k=2$ & $k=3$ & Support & Confidence & Lift\\\midrule FPMC & 96.50\% & 99.25\% & 99.57\% & 14.32\% & 13.47\% & 13.47\%& 95.11\% & 98.95\% & 99.82\% & 12.57\% & 12.04\% & 12.04\%\\ GRU4Rec & 98.51\% & 99.36\% & 99.68\% & 7.423\% & 7.635\% & 7.635\% & 95.94\% & 99.48\% & 99.65\% & 8.202\% & 8.551\% & 8.551\%\\ Caser & 97.03\% & 99.15\% & 99.57\% & 8.801\% & 8.165\% & 8.165\% & 95.99\% & 99.30\% & 99.65\% & 9.250\% & 8.901\% & 8.901\%\\ \bottomrule \end{tabular} \caption{Results of Model Fidelity. Our causal explanation framework is tested under the number of candidate causal explanations $k=1,2,3$. The association explanation framework is tested under support, confidence, and lift thresholds, respectively.} \vspace{-15pt} \label{tab:fidelity} \end{table*} \subsection{Experimental Settings} \label{sec:experimental_setting} We adopt the following methods to train black-box sequential recommendation models and to extract traditional association rules as comparative explanations. We include both shallow and deep models for experiment. \textbf{FPMC}~\cite{rendle2010factorizing}: The Factorized Personalized Markov Chain model, which combines matrix factorization and Markov chains to capture user's personalized sequential behavior patterns for prediction\footnote{https://github.com/khesui/FPMC}. \textbf{GRU4Rec}~\cite{hidasi2015session}: A session-based recommendation model, which uses recurrent neural networks -- in particular, Gated Recurrent Units (GRU) -- to capture sequential patterns for prediction\footnote{https://github.com/hungthanhpham94/GRU4REC-pytorch}. \textbf{Caser}~\cite{tang2018personalized}: The ConvolutionAl Sequence Embedding Recommendation (Caser) model, which adopts convolutional filters over recent items to learn the sequential patterns for prediction\footnote{https://github.com/graytowne/caser\_pytorch}. \textbf{Association Rule}~\cite{peake2018explanation}: A post-hoc explanation model, which learns the item-item association rules as item-level explanations\footnote{https://pypi.org/project/apyori/}. For black-box recommendation models FPMC, GRU4Rec and Caser, we adopt their best parameter selection in their corresponding public implementation. For the association rule-based explanation model, we follow the recommendations in \cite{peake2018explanation} to set the optimal parameters: support = 0.1, confidence = 0.1, lift = 0.1, length = 2 for \textit{MovieLens100k}, and support = 0.01, confidence = 0.01, lift = 0.01, length = 2 for \textit{Amazon} dataset due to its smaller scale. For our causal rule learning framework, we set the item embedding size as 16, both the VAE encoder and decoder are Multi-Layer Perceptrons (MLP) with two hidden layers, and each layer consists of 1024 neurons. The default number of perturbed input-output pairs is $m=500$ on both datasets. The default time decay factor is $\gamma=0.7$. We will discuss the influence of perturbation times $m$ and time decay factor $\gamma$ in the experiments. In the following, we will apply both association rule learning and causal rule learning frameworks on the black-box recommendation models to evaluate and compare the association explanations and causal explanations. In particular, we evaluate our framework from two perspectives. First, we verify that the causal rules learned by our framework represent highly probable causal relationships (explanation quality). Second, we show that our model has the ability to offer explanations for most recommendations (explanation fidelity). Additionally, we shed light on how our model differs from other models on statistical metrics. \iffals \subsection{Implementation Details} In this subsection, we introduce the implementation details to enhance reproducibility, including both our model and the baselines. FPMC \cite{rendle2010factorizing} is implemented by public code\footnote{https://github.com/khesui/FPMC}. During the training process, all transactions in the training set are organized as sequences, where each sequence is the purchased items ordered by time for one user. The original code put some users into training set while the rest users in the testing set. However, in our case, to keep consistent to all baselines, we divided the latest six interactions as testing set where the latest one is the target of prediction. For testing, the input is one user and a sequence with length five which represents the first five interacted items of the corresponding user. Since here we did not focus on the performance of recommendation, we use the same parameter setting for two datasets which is the same as the original setting in public code. GRU4Rec\cite{hidasi2015session} is another sequential recommendation model. It is implemented by a pytorch version of public code from GitHub \footnote{https://github.com/hungthanhpham94/GRU4REC-pytorch}. This code is based on paper\cite{hidasi2015session} and is extended on \cite{hidasi2018recurrent}. Here we group session by users. We consider the purchase history of one user is a session. The user id in the dataset is considered as the session id for GRU4Rec. Similar to FPMC, the dataset used in public code is split by session, however, considering that some sequential recommendation models may learn the representation of users, we split each user history into training and testing set to keep consistent to all baselines. Caser\cite{tang2018personalized} is one of the state-of-the-art sequential recommendation models. This model is implemented by the code\footnote{https://github.com/graytowne/caser\_pytorch} published by authors. Caser also tests on \textit{Movielens 100k} dataset, therefore, we basically use the same parameter setting except the number of target. Compared with original one, we only predict the next one behavior instead of three. The parameter settings are same for two datasets. To distinguish between association rule and causal rule, we firstly introduce association rule mining briefly. Association rules are extracted from items according to their strength in the collection. There are typically three scores to measure association rules: the support, confidence and lift. For two items $m$ and $n$, the support is a frequency measure to show how often we can expect to observe the pattern $\{ m \rightarrow n\}$; the confidence is an estimate of the conditional probability $P(m|n)$ to represent the predictive ability of the rule; and the lift measures the dependency between two items $m$ and $n$ . Specifically, a rule $\{ m \rightarrow n\}$ holds with support $supp$ if $supp\%$ of the records contain both $m$ and $n$; with confidence $conf$ if $conf\%$ of records that contain $m$ also contain $n$, which is defined as $supp(m \cup n) / supp(m)$. And the rule's lift is defined as $supp(m \cup n)$ divided by $supp(m) \times supp(n)$ if the items were independent. The association rules are generally mined by setting specific thresholds for those three scores. Here we followed the pipeline offered by \cite{peake2018explanation} and the association rules are extracted by apyori\footnote{https://pypi.org/project/apyori/} python package. For the association rules, we only involve global association rules and select top 30 for each interestingness as explanation. Peake's work\cite{peake2018explanation} also uses local association rule as explanation which requires to extract association rule based on neighborhood users with high cosine similarity. However, some sequential recommendation models may not have user representation which means that we cannot get the cosine similarity to get the neighborhood users. Based on that consideration, we only apply the global association rule as explanation. Meanwhile, we set the threshold same as \cite{peake2018explanation}: min\_supp = 0.1, min\_conf = 0.1, min\_lift = 0.1, max\_len = 2 for \textit{Movielens 100k}, and min\_supp = 0.01, min\_conf = 0.01, min\_lift = 0.01, max\_len = 2 for \textit{Amazon} due to its smaller scale. For our framework, first we need to pretrain those black-box models and fix them after training. Before training the perturbation model, we also need to get the latent representation of each items. Here we simply use pair-wised \textit{Matrix Factorization} to learn the embedding of items. After fixing the embedding of items, we use the sequence with length five in testing set to train a perturbation model and fix it. The latent size for perturbation model is 16, and the encoder and decoder are two Multi-Layer Perceptron (MLP) with two hidden layer and each layer is consisted of 1024 neurons. For each user, we need several sequences which are similar to the true history sequence for achieving our random experiment. In \textit{Movielens 100k} dataset, we generate 500 unique perturbed sequence for each user. Meanwhile, we keep the original sequence to make sure all items in true history will appear at least once. We plug unique sequence (501 in total) into black box models to get corresponding recommendation as perturbed output which has the exactly same number (501 in total). In \textit{Amazon} dataset, the number of items is less than \textit{Movielens 100k}. Based on that observation, we only sample 250 times for each user which means that there are 251 unique sequences including the original one for each user. We will discuss about the influence of time of perturbation in later section. Same as \textit{Movielens 100k}, we plug the sequences into recommendation model to get corresponding predictions. After getting input-output perturbation pairs, we use our causal rule mining model to extract the causal relations set and select the causal explanation from the set. The time effect is set as 0.7 and we will discuss about the influence of it in later section. In following part, we evaluate our framework from two perspectives. First, we verify that the causal rules which are mined by our framework are highly probably causal relationships. Second, we show that our model has the ability to give explanations for most recommendations. Additionally, we shed light on the characteristics of our model differs from other model on statistical metrics. \f \subsection{Causality Verification} We first verify the quality of the extracted causal rules. Here, we adopt the following widely used definition of causation, which is introduced by Pearl \cite{pearl2000causality}: \begin{equation}\label{eq:verification} \Pr(\text{effect}|do(\text{cause})) \textgreater \Pr(\text{effect}|do(\neg\text{cause})) \end{equation} where $do(c)$ represents an external intervention, which compels the truth of $c$, and $do(\neg c)$ compels the truth of not $c$. Actually, the conditional probability $\Pr(e|c)$ represents a probability resulting from a passive observation of $c$, which rarely coincides with $\Pr(e|do(c))$. We evaluate how many percentage of our extracted causal explanations really satisfy Eq.\eqref{eq:verification}. Suppose the perturbation model (section \ref{sec:perturbation-model}) creates $m$ perturbed input-output pairs for each user $u$: $\{(\tilde{\mathcal{H}}^u_i,\tilde{Y}^u_i)\}_{i=1}^m$, plus the original pair $(\mathcal{H}^u,Y^u)$. Here $\tilde{\mathcal{H}}^u$ is created by our perturbation model (i.e. not observed in the original data), and thus observing $\tilde{\mathcal{H}}^u$ implies we have $do(\tilde{\mathcal{H}}^u)$ in advance. Let $H\Rightarrow Y^u$ be the causal explanation extracted by the casual rule learning model (section \ref{sec:causal_rule_learning}). Then we estimate the probability based on these $m+1$ total pairs as, \begin{equation} \small \begin{aligned} &\Pr(\text{effect}|do(\text{cause}))=\Pr(Y^u|H)=\frac{\#\text{Pairs}(H\in\tilde{\mathcal{H}}^u\land Y=Y^u)}{\#\text{Pairs}(H\in\tilde{\mathcal{H}}^u)}\\ &\Pr(\text{effect}|do(\neg\text{cause}))=\Pr(Y^u|\neg H)=\frac{\#\text{Pairs}(H\notin\tilde{\mathcal{H}}^u\land Y=Y^u)}{\#\text{Pairs}(H\notin\tilde{\mathcal{H}}^u)} \end{aligned} \end{equation} and $H\Rightarrow Y^u$ is considered as a reliable causal rule if Eq.\eqref{eq:verification} is satisfied. The intuition here is that a causal rule should guarantee that the probability of seeing $Y^u$ when $H$ is purchased should be higher than the probability of seeing $Y^u$ when $H$ is not purchased. We calculate the percentage of our extracted causal explanations that satisfy Eq.\eqref{eq:verification}. We tune the parameter $k$ from 1 to 3, where $k$ is the number of candidate causal explanations we consider for each user in the causal rule learning model (section \ref{sec:causal_rule_learning} step 2 and 3). The results of causality verification on two datasets and three recommendation models are shown in Table \ref{tab:verification}. Based on the results we can see that in most cases 90\% or more of the extracted causal explanations are reliable. We also see that with the increasing of $k$, the percentage tends to decease for all three recommendation models on both datasets. Intuitively, this means that unreliable causal relation candidates may be introduced if too many candidate pairs are considered in the causal rule learning model, which is reasonable. However, if too few candidates are considered (i.e., $k$ is too small), many users may not receive explanations at all (i.e., model fidelity will decrease). This will be further analyzed in the next subsection. \begin{table}[t] \centering \setlength{\tabcolsep}{3pt} \begin{tabular}{ccccccc} \toprule Dataset & \multicolumn{3}{c}{Movielens} & \multicolumn{3}{c}{Amazon}\\\cmidrule(lr){2-4}\cmidrule(lr){5-7} $k$ & 1 & 2 & 3 & 1 & 2 & 3\\\midrule FPMC & 94.83\% & 94.23\% & 93.92\% & 91.56\% & 90.48\% & 90.03\%\\ GRU4Rec & 97.84\% & 97.76\% & 97.75\% & 94.91\% & 94.20\% & 93.87\%\\ Caser & 97.15\% & 96.89\% & 96.69\% & 98.91\% & 98.25\% & 98.14\%\\\bottomrule \end{tabular} \caption{The percentage of reliable causal explanations that satisfy the inequality in Eq.\eqref{eq:verification}.} \vspace{-27pt} \label{tab:verification} \end{table} \subsection{Model Fidelity} An important evaluation measure for explanation models is model fidelity, i.e., how many percentage of the recommendation results can be explained by the model \cite{zhang2018explainable}. The results of model fidelity are shown in Table \ref{tab:fidelity}. In this experiment, we still tune the number of candidate causal explanations $k$ from 1 to 3. For the association rule explanation model (section \ref{sec:experimental_setting}), we test three versions of the association rule learning algorithm as introduced in \cite{peake2018explanation}, i.e., the association rules are filtered by support, confidence, and lift thresholds, respectively. We can see that on both datasets, our causal explanation framework can generate explanations for almost all of the recommended items, while the association explanation approach can only provide explanations for significantly fewer recommendations. The underlying reason is that association explanations have to be extracted based on the original input-output pairs, which limits the number of pairs that we can use for rule extraction. However, based on the perturbation model, our causal explanation framework is able to create many counterfactual examples to assist causal rule learning, which makes it possible to go beyond the limited original data to extract causal explanations. Another interesting observation is that GRU4Rec and Caser have significantly ($p<0.01$) lower fidelity than FPMC when explained by the association model. This is reasonable because FPMC is a Markov-based model that directly learns the correlation of adjacent items in a sequence, as a result, it is easier to extract association rules between inputs and outputs for the model. However, it also means that the fidelity performance of the association approach highly depends on the recommendation model being explained. Meanwhile, we see that our causal approach achieves comparably good fidelity on all three recommendation models, because the perturbation model is able to create sufficiently many counterfactual examples to break the correlation of frequently co-occurring items in the input sequence. This indicates the robustness of our causal explanation framework in terms of model fidelity. \iffalse \begin{table}[htbp] \centering \footnotesize \begin{tabular}{ccccccc} \toprule \multicolumn{7}{c}{Movielens 100k}\\\midrule method & \multicolumn{3}{c}{Causal} & \multicolumn{3}{c}{Global Association}\\\cmidrule(lr){2-4}\cmidrule(lr){5-7} k & 1 & 2 & 3 & Support & Confidence & lift\\\midrule Caser & 85.365\% & 92.895\% & 95.546\% & 8.801\% & 8.165\% & 8.165\%\\ GRU4Rec & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%}\\ FPMC & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%}\\\bottomrule \multicolumn{7}{c}{Amazon}\\\midrule method & \multicolumn{3}{c}{Causal} & \multicolumn{3}{c}{Global Association}\\\cmidrule(lr){2-4}\cmidrule(lr){5-7} k & 1 & 2 & 3 & Support & Confidence & lift\\\midrule Caser & \fillblank{87.72\%}\% & \fillblank{87.72\%}\% & \fillblank{87.72\%}\% & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%}\\ GRU4Rec & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%}\\ FPMC & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%} & \fillblank{87.72\%}\\\bottomrule \end{tabular} \caption{Results of Model Fidelity} \label{tab:fidelity} \end{table} \fi \iffals \begin{table}[t] \centering \small \begin{tabular}{ccccccc} \toprule \multirow{2}{*}{Rules} & \multicolumn{3}{c}{Causal Rules} & \multicolumn{3}{c}{Global Association}\\\cmidrule(lr){2-4}\cmidrule(lr){5-7} & 1 & 2 & 3 & support & confidence & lift\\\midrule FPMC & 37.47\% & 37.39\% & 37.38\% & 49.62\% & 50.39\% & 50.39\%\\ GRU4Rec & 40.90\% & 40.98\% & 40.97\% & 55.71\% & 61.11\% & 61.11\%\\ Caser & 37.92\% & 37.75\% & 37.91\% & 51.80\% & 51.94\% & 51.94\%\\\bottomrule \end{tabular} \caption{The percentage of explanations that have same feature as recommendations in \textit{Movielens 100k}} \vspace{-25pt} \label{tab:feature} \end{table} \f \iffals \subsection{Explanation Observation} How to evaluate explainability is an ill-defined problem. Our model tries to explain the behavior of the black-box models. In this case, the explanation may not be accepted by all of humans. However, we would like to show some characteristics of our model by some statistical observation comparing with baselines. Here we use \textit{Movielens 100k} as an example to show our observation. We count the percentage of common features for explanation and recommendation. Here, for \textit{Movielens} dataset, we use the genres of movies as the feature of movies. The results of percentage of explanations that have the same feature as the recommendation are shown in Table.\ref{tab:feature}. According to the table, such percentage is higher for the explanations extracted from global association rule. However, combining with the model fidelity shown in Table.\ref{tab:fidelity}, we can see that global association rule can only explain a few portions of the recommendation, therefore, even it has a more percentage of common feature explanations, our causal model can give more explanations sharing common features with recommendations in terms of the total number. Though sharing common features seems to make an explanation more reasonable and intelligible, it can not be guaranteed that such explanations are better or more accurate. Our causal model is capable of offering more diverse and inspiring explanations to users compared with the global association rule model, which will be shown through examples in subsection~\ref{sec:explanation}. \f \subsection{Influence of Parameters} In this section, we discuss the influence of two important parameters. The first one is time decay parameter $\gamma$ -- in our framework, when explaining the sequential recommendation models, earlier interactions in the sequence will have discounted effects to the recommended item. A proper time decay parameter helps the framework to reduce noise signals when learning patterns from the sequence. The second parameter is the number of perturbed input-output pairs $m$ -- in our framework, we use perturbations to create counterfactual examples for causal learning, but there may exist trade-off between efficiency and performance. We will analyze the influence of these two parameters. \begin{figure}[t] \captionsetup[sub]{font=small,labelfont=normalfont,textfont=normalfont} \centering \hspace{-15pt} \begin{subfigure}{0.24\textwidth} \label{fig:GRU4Rec_ml100k_time_decay} \includegraphics[scale=0.3]{fig/GRU4Rec_fidelity_time_decay_ml100k.png} \vspace{-20pt} \caption{GRU4Rec on Movielens} \end{subfigure} \begin{subfigure}{0.24\textwidth} \label{fig:GRU4Rec_amazon_time_decay} \includegraphics[scale=0.3]{fig/GRU4Rec_fidelity_time_decay_amazon.png} \vspace{-20pt} \caption{GRU4Rec on Amazon} \end{subfigure} \medskip \hspace{-15pt} \begin{subfigure}{0.24\textwidth} \label{fig:k3_ml100k_time_decay} \includegraphics[scale=0.3]{fig/k3_fidelity_time_decay_ml100k.png} \vspace{-20pt} \caption{$k=3$ on Movielens} \end{subfigure} \begin{subfigure}{0.24\textwidth} \label{fig:k3_amazon_time_decay} \includegraphics[scale=0.3]{fig/k3_fidelity_time_decay_amazon.png} \vspace{-20pt} \caption{$k=3$ on Amazon} \end{subfigure} \vspace{-10pt} \caption{Model fidelity on different time decay parameters $\gamma$. $x$-axis is the time decay parameter $\gamma\in\{0.1, 0.3, 0.7, 1\}$ and $y$-axis is the model fidelity. The upper two sub-figures plot the model fidelity for GRU4Rec on different number of candidate causal explanations $k=1,2,3$, and the lower two sub-figures plot the model fidelity for different recommendation models when fixing $k=3$.} \label{fig:time} \vspace{-10pt} \end{figure} \textbf{Time Decay Effect}: Figure \ref{fig:time} shows the influence of $\gamma$ on different recommendation models and datasets. From the result we can see that the time decay effect $\gamma$ indeed affects the model performance on fidelity. In particular, when $\gamma$ is small, the previous interactions in a sequence are more likely to be ignored, which thus reduces the performance on model fidelity. When $\gamma$ is large (e.g., $\gamma=1$), old interactions will have equal importance with latest interactions, which also hurts the performance. We can see from the results that the best performance is achieved at about $\gamma=0.7$ on both datasets. \begin{figure}[t] \captionsetup[sub]{font=small,labelfont=normalfont,textfont=normalfont} \centering \hspace{-15pt} \begin{subfigure}{0.24\textwidth} \label{fig:GRU4Rec_ml100k_time_decay} \includegraphics[scale=0.3]{fig/k1_fidelity_time_pert_ml100k.png} \vspace{-20pt} \caption{Model Fidelity on Movielens} \end{subfigure} \begin{subfigure}{0.24\textwidth} \label{fig:GRU4Rec_amazon_time_decay} \includegraphics[scale=0.3]{fig/k1_fidelity_time_pert_amazon.png} \vspace{-20pt} \caption{Model Fidelity on Amazon} \end{subfigure} \medskip \hspace{-15pt} \begin{subfigure}{0.24\textwidth} \label{fig:k3_ml100k_time_decay} \includegraphics[scale=0.3]{fig/k1_verification_time_pert_ml100k.png} \vspace{-20pt} \caption{Percentage on Movielens} \end{subfigure} \begin{subfigure}{0.24\textwidth} \label{fig:k3_amazon_time_decay} \includegraphics[scale=0.3]{fig/k1_verification_time_pert_amazon.png} \vspace{-20pt} \caption{Percentage on Amazon} \end{subfigure} \vspace{-10pt} \caption{Model fidelity and the percentage of verified causal explanations (Eq.\eqref{eq:verification}) on different number of perturbed pairs $m$. $x$-axis is the number of perturbed pairs $m$. $y$-axis is model fidelity. The upper two sub-figures plot the model fidelity for different recommendation model on $k=1$, and the lower two sub-figures plot the percentage of verified causal explanations for different recommendation model on $k=1$.} \label{fig:pert_time} \vspace{-10pt} \end{figure} \textbf{Number of Perturbations}: Figure \ref{fig:pert_time} shows the influence for the number of perturbed input-output pairs $m$. A basic observation from Figure \ref{fig:pert_time} is that when $m$ increases, both model fidelity and the percentage of verified rules will decrease first and then increase. The underlying reason is as follows. When $m$ is small, the variance of the perturbed input-output pairs will be small, and thus almost any change in the input sequence will be determined as a cause. For example, suppose the original input-output pair is $A, B, C \rightarrow Y$. In the extreme case where $m=1$, we will have only one perturbed pair, e.g., $A, \tilde{B}, C \rightarrow \tilde{Y}$. According to the causal rule learning model (section \ref{sec:causal_rule_learning}), if $\tilde{Y}\neq Y$, then $B\Rightarrow Y$ will be the causal explanation since the change of $B$ results in a different output, while if $\tilde{Y}=Y$, then either $A\Rightarrow Y$ or $C\Rightarrow Y$ will be the causal explanation since their $\theta$ scores will be higher than $B$ or $\tilde{B}$. In either case, the model fidelity and percentage of verified causal rules will be $100\%$. However, in this case, the results do not present statistical meanings since they are estimated on a very small amount of examples. When $m$ increases but not large enough, then random noise examples created by the perturbation model will reduce the model fidelity. Still consider the above example, if many pairs with the same output $Y$ are created, then the model may find other items beyond $A,B,C$ as the cause, which will result in no explanation for the original sequence. However, if we continue to increase $m$ to sufficiently large numbers, such noise will be statistically offset, and thus the model fidelity and percentages will increase again. In the most ideal case, we would create all of the $|\mathcal{H}|^{|\mathcal{I}|}$ sequences for causal rule learning, where $|\mathcal{H}|$ is the number of item slots in the input sequence, and $|\mathcal{I}|$ is the total number of items in the dataset. However, $|\mathcal{H}|^{|\mathcal{I}|}$ would be a huge number that makes it computational infeasible for causal rule learning. In practice, we only need to specify $m$ sufficiently large. Based on Chebyshev's Inequality, we find that $m=500$ already gives >95\% confidence that the estimated probability error is <0.1. \subsection{Case Study} \label{sec:explanation} In this section, we provide a simple qualitative case study to compare causal explanations and association explanations. Compared with the association explanation model, our model is capable of generating personalized explanations, which means that even if the recommendation model recommends the same item for two different users and the users have overlapped histories, our model still has the potential to generate different explanations for different users. However, the association model will provide the same explanation since the association rules are extracted based on global records. An example by the Caser recommendation model on \textit{MovieLens100k} dataset is shown in Figure \ref{fig:case_study}, where two users with one commonly watched movie (\textit{The Sound of Music}) get exactly same recommendation (\textit{Pulp Fiction}). The association model provides the overlapped movie as an explanation for the two different users, while our model can generate personalized explanation for different users even when they got the same recommendation. \iffalse \begin{table}[h] \centering \begin{tabular}{l} \hline \textbf{Reliable Causal Rule Examples}\\\hline Dracula: Dead and Loving It $\Rightarrow$ Jeffrey\\ Free Willy 3: The Rescue $\Rightarrow$ Mad City\\ Crumb $\Rightarrow$ Evita\\\hline \textbf{Fake Causal Rule Examples}\\\hline Men in Black $\Rightarrow$ Twilight \\ Beyond Bedlam $\Rightarrow$ Donnie Brasco\\ Blood for Dracula $\Rightarrow$ Face/Off\\\hline \end{tabular} \caption{causal Rules Examples} \vspace{-10pt} \label{tab:results} \end{table} \fi \vspace{-5pt} \section{Conclusions} Recommender systems are widely used in our daily life. Effective recommendation mechanisms usually work through black-box models, resulting in the lack of transparency. In this paper, we extract causal rules from user history to provide personalized, item-level, post-hoc explanations for the black-box sequential recommendation models. The causal explanations are extracted through a perturbation model and a causal rule learning model. We conduct experiments on real-world datasets, and apply our explanation framework to several state-of-the-art sequential recommendation models. Experimental results verified the quality and fidelity of the causal explanations extracted by our framework. In this work, we only considered item-level causal relationships, while in the future, it would be interesting to explore causal relations on feature-level external data such as textual user reviews, which can help to generate finer-grained causal explanations. \section*{Acknowledgement} This work was supported in part by NSF IIS-1910154. Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect those of the sponsors. \begin{figure}[t!] \centering \includegraphics[width=\linewidth]{./fig/CaseStudy.pdf} \vspace{-25pt} \caption{ A case study on MovieLens by the Caser model. The first movie for $u_1$ is unknown in the dataset. } \vspace{-10pt} \label{fig:case_study} \end{figure} \vspace{-5pt} \balance \bibliographystyle{ACM-Reference-Format}
\section*{Availability} This article may be downloaded for personal use only. Any other use requires prior permission of the author and AIP Publishing. This article appeared in \cite{Stehli2020} and may be found at \href{https://aip.scitation.org/doi/10.1063/5.0023533}{https://aip.scitation.org/doi/10.1063/5.0023533}. The data that support the findings of this study are available from the corresponding author upon reasonable request. \section*{References}
\section{\label{sec:introduction}Functional surface area measures} This paper has two main parts, so it also has two introductory sections. In this section we give the necessary background concerning surface area measures and their functional extensions. We conclude it by stating our first main theorem, which is proved in Sections \ref{sec:first-variation} and \ref{sec:variation-formula}. In Section \ref{sec:Lp-intro} we introduce the Minkowski problem and its known functional analogues, and state our second main theorem. This second theorem is proved in Section \ref{sec:Lp-existence}. We begin this section by recalling the classical definition of the surface area measure of a convex body. For us, a \emph{convex body} is a convex and compact set $K\subseteq\RR^{n}$ with non-empty interior. The \emph{support function} $h_{K}:\RR^{n}\to\RR$ of $K$ is defined by \[ h_{K}(y)=\max_{x\in K}\left\langle x,y\right\rangle , \] where $\left\langle \cdot,\cdot\right\rangle $ denotes the standard inner product on $\RR^{n}$. For points $x\in\RR^{n}$ we will write $\left|x\right|=\sqrt{\left\langle x,x\right\rangle }$ for the Euclidean norm, while for convex bodies we will write $\left|K\right|$ for their (Lebesgue) volume. The use of the same notation for both should not cause any confusion. If $K,L\subseteq\RR^{n}$ are convex bodies and $t\ge0$ we write \[ K+tL=\left\{ x+ty:\ x\in K,\ y\in L\right\} \] for the Minkowski addition. A fundamental fact in convex geometry is that for every convex body $K$ there exists a Borel measure $S_{K}$ on the unit sphere $\SS^{n-1}=\left\{ x\in\RR^{n}:\ \left|x\right|=1\right\} $ such that \begin{equation} \lim_{t\to0^{+}}\frac{\left|K+tL\right|-\left|K\right|}{t}=\int_{\SS^{n-1}}h_{L}\dd S_{K}\label{eq:body-area-measure} \end{equation} for every convex body $L$. The measure $S_{K}$ is called the surface area measure of the body $K$. For a proof of this fact, as well as alternative equivalent definitions of $S_{K}$ and general background in convex geometry, we refer the reader to \cite{Schneider2013}. Over the last two decades it became more and more apparent that important problems in convexity and asymptotic analysis can be attacked by embedding the class of convex bodies into appropriate classes of functions or measures on $\RR^{n}$. The idea is to think of such analytic objects as ``generalized convex bodies'', and study geometric constructions such as volume, addition and support functions on these larger classes. The motivation behind this idea is twofold. First, even if one is ultimately only interested in convex geometry and convex bodies, working in such a larger class can be extremely useful as it allows the use of various analytic and probabilistic tools. Second, since we are now working with functions and measures, the geometrically inspired theorems we obtain can be of interest in analysis. In fact, the main theorem we prove in Section \ref{sec:Lp-existence} can be viewed as a theorem about the existence of generalized solutions to a certain PDE, as we will see. Since this fundamental idea of ``functional convexity'' is so widespread nowadays, it is impossible to pick a manageable list of representative papers to cite. Instead we settle for referring the reader to Section 9.5 of \cite{Schneider2013}, to the survey \cite{Milman2008} and to the references therein. Unfortunately these only cover slightly older results and not the massive explosion of the field over the last decade. In this paper we will study functional surface area measures. We will work with the standard class of log-concave functions: \begin{defn} A function $f:\RR^{n}\to[0,\infty)$ is called log-concave if for every $x,y\in\RR^{n}$ and every $0\le\lambda\le1$, \[ f\left((1-\lambda)x+\lambda y\right)\ge f(x)^{1-\lambda}f(y)^{\lambda}. \] For every convex body $K$, the indicator function $\oo_{K}$ is log-concave. This gives a natural embedding of the class of convex bodies into the class of log-concave functions. We will always assume that our log-concave functions are upper semi-continuous, which is analogous to assuming the body $K$ is closed. We denote the class of all upper semi-continuous log-concave functions $f:\RR^{n}\to[0,\infty)$ by $\lc_{n}$. Every $f\in\lc_{n}$ is of the form $f=e^{-\phi}$ for a lower semi-continuous convex function $\phi:\RR^{n}\to(-\infty,\infty]$. We denote the class of such convex functions by $\cvx_{n}$. In order to have a functional analogue of \eqref{eq:body-area-measure} we first need to understand a few things: what is the ``volume'' of log-concave functions, how to add such functions, what is the support function $h_{f}$ of a log-concave function $f$, and most importantly what is the surface area measure $S_{f}$ of $f$. The easiest of the four is the volume. Since $\left|K\right|=\int\oo_{K}$, it makes sense to define the ``volume'' of $f$ to be its Lebesgue integral $\int f$ (unless explicitly stated otherwise, our integrals will always be on $\RR^{n}$ with respect to the Lebesgue measure). As for addition and support functions, recall that for convex bodies the two operations are intimately connected by the relation $h_{K+tL}=h_{K}+th_{L}$. If one wants to keep this relation for log-concave functions, and have other natural properties such as monotonicity, it turns out that there is essentially only one possible definition: \end{defn} \begin{thm}[\cite{Rotem2013}] Assume we are given a map $\mathcal{T}:\lc_{n}\to\cvx_{n}$ and a map $\oplus:\cvx_{n}\times\cvx_{n}\to\cvx_{n}$ such that \begin{enumerate} \item $f\le g$ if and only if $\mathcal{T}f\le\mathcal{\mathcal{T}}g$. \item $\mathcal{T}\oo_{K}=h_{K}$. \item $\mathcal{T}(f\oplus g)=\mathcal{T}f+\mathcal{T}g$. \end{enumerate} Then: \begin{enumerate} \item There exists $C>0$ such that \[ \left(\mathcal{T}f\right)(x)=\frac{1}{C}\cdot(-\log f)^{\ast}\left(Cx\right). \] \item We have \[ \left(f\oplus g\right)(x)=\sup_{y\in\RR^{n}}f(y)g(x-y). \] \end{enumerate} \end{thm} The $^{\ast}$ that appears in the theorem is the \emph{Legendre transform} map $^{\ast}:\cvx_{n}\to\cvx_{n}$, defined by \begin{equation} \phi^{\ast}(y)=\sup_{x\in\RR^{n}}\left(\left\langle x,y\right\rangle -\phi(x)\right).\label{eq:legendre-def} \end{equation} Therefore, for a log-concave function $f=e^{-\phi}$ we define its support function $h_{f}:\RR^{n}\to(-\infty,\infty]$ by $h_{f}=\phi^{\ast}$. We also define the addition of log-concave functions to be \[ \left(f\star g\right)(x)=\sup_{y\in\RR^{n}}f(y)g(x-y). \] This addition is also known as the sup-convolution, or Asplund sum, and as an addition on log-concave functions was it first considered in \cite{Klartag2005}. Like the support function $h_{f}$, it is by now a standard definition in convex geometry. For $t>0$ and $f\in\lc_{n}$ we also define $\left(t\cdot f\right)(x)=f\left(\frac{x}{t}\right)^{t}$. This dilation operation is consistent with the sup-convolution is the sense that $2\cdot f=f\star f$. With these standard definitions in our disposal, we may now define: \begin{defn} For $f,g\in\lc_{n}$ we define \[ \delta(f,g)=\lim_{t\to0^{+}}\frac{\int\left(f\star\left(t\cdot g\right)\right)-\int f}{t}. \] \end{defn} In other words, $\delta(f,g)$ is the directional derivative of the integral at the point $f$ and in the direction $g.$ The first to seriously study this quantity were Colesanti and Fragalà, who proved in \cite{Colesanti2013} that $\delta(f,g)$ is well defined whenever $\int f>0$. More importantly, they were able to prove a functional version of \eqref{eq:body-area-measure}: \begin{defn} \label{def:func-surface-area}For $f=e^{-\phi}\in\lc_{n}$, we define its surface area measure $S_{f}$ as the push-forward of the measure $f\dd x$ under the map $\nabla\phi$. More explicitly, for every Borel subset $A\subseteq\RR^{n}$ we define \[ S_{f}(A)=\int_{\left\{ x:\ \nabla\phi(x)\in A\right\} }f\dd x. \] \end{defn} Equivalently, if $f=e^{-\phi}$ then $S_{f}$ is the unique Borel measure on $\RR^{n}$ such that \begin{equation} \int_{\RR^{n}}\rho(y)\dd S_{f}(y)=\int_{\RR^{n}}\rho\left(\nabla\phi(x)\right)f(x)\dd x\label{eq:push-forward} \end{equation} for all functions $\rho$ for which the left hand side is well defined (it could be $\pm\infty$). Note that this definition does not require any regularity assumptions from $f$. Indeed, since $\phi$ is a convex function it is differentiable almost everywhere on the set $\dom\phi=\left\{ x\in\RR^{n}:\ \phi(x)<\infty\right\} $ \textendash{} see e.g. \cite{Rockafellar1970} for this fact as well as other basic analytic properties of convex functions. Therefore $\nabla\phi$ exists $f\dd x$-a.e. , which means the push-forward is well defined. Definition \ref{def:func-surface-area} can seem a bit strange at first. For example, we note that $S_{f}\left(\RR^{n}\right)=\int f$, which is the ``volume'' of $f$ and not its ``surface area''. This is unlike the classical case of convex bodies, where we have $S_{K}\left(\SS^{n-1}\right)=\left|\partial K\right|$, the surface area of $K$. However, at least for sufficiently regular functions $f$ it turns out that $S_{f}$ is indeed the correct definition for a surface area measure, because of the following theorem of Colesanti and Fragalà: \begin{thm}[\cite{Colesanti2013}] \label{thm:colesanti-fragala}Fix $f,g\in\lc_{n}$. Assume that $\phi=-\log f$ and $\psi=-\log g$ belong to the class \[ \left\{ \rho\in\cvx_{n}:\ \begin{array}{l} \rho\text{ is finite and }C^{2}\text{-smooth, }\text{\ensuremath{\nabla^{2}\rho(x)\succ0}}\\ \text{for all }x\in\RR^{n},\text{ and }\text{\ensuremath{\lim_{\left|x\right|\to\infty}\frac{\rho(x)}{\left|x\right|}=\infty}} \end{array}\right\} . \] Assume further that $h_{f}-ch_{g}$ is a convex function for sufficiently small $c>0$. Then \begin{equation} \delta(f,g)=\int_{\RR^{n}}h_{g}\dd S_{f}.\label{eq:func-first-var} \end{equation} \end{thm} Theorem \ref{thm:colesanti-fragala} was one of the main motivations behind this paper. Comparing it with \eqref{eq:body-area-measure} explains why $S_{f}$ should indeed be considered as the surface area measure of the function $f$. At the same time, the assumptions of the theorem are definitely not optimal. For example, it was already proved in \cite{Rotem2012} that when $f(x)=e^{-\left|x\right|^{2}/2}$, the first variation formula \eqref{eq:func-first-var} holds for all $g\in\lc_{n}$ with no technical assumptions. However, there is no doubt that some assumptions are needed, as \eqref{eq:func-first-var} cannot hold for all functions $f,g\in\lc_{n}$. For example, if $f=\oo_{K}$ for some convex body $K$ then $S_{f}=\left|K\right|\cdot\delta_{0}$, so \eqref{eq:func-first-var} cannot hold even if $g$ is also the indicator of a convex body. We therefore see that the theory developed in this paper is a functional analogue of the classical theory for convex bodies, but does not formally extend it. We remark that in \cite{Colesanti2013} the authors did define a generalization of the measure $S_{f}$ to the case where $f$ is supported on some smooth convex body $K$ and satisfies some technical assumptions, and proved a generalization of Theorem \ref{thm:colesanti-fragala} for such functions $f$. Unfortunately the indicator function $\oo_{K}$ does not satisfy these technical assumptions, so even this more general theorem does not recover the case of convex bodies. It's an interesting open problem to find extensions of Definition \ref{def:func-surface-area} and Theorem \ref{thm:colesanti-fragala} that will hold for all $f\in\lc_{n}$, including both smooth functions and indicators of convex bodies. In this paper, however, we will keep Definition \ref{def:func-surface-area} as our definition of $S_{f}$, and prove a necessary and sufficient condition on $f$ for \eqref{eq:func-first-var} to hold. The correct condition to impose on $f$ appeared in the work of Cordero-Erausquin and Klartag (\cite{Cordero-Erausquin2015}). In this work the authors study the moment measure of a convex function $\phi$. While this term comes from the very different field of toric Kähler manifolds, the moment measure of $\phi$ is precisely the same measure as the surface area measure $S_{e^{-\phi}}$. We refer the reader to \cite{Cordero-Erausquin2015} and the previous works cited therein (especially \cite{Berman2013}) for more information about the connection between this measure and complex geometry. The results of \cite{Cordero-Erausquin2015} and of Section \ref{sec:Lp-existence} below can also be considered as establishing the existence of generalized solutions to certain Monge\textendash Ampère differential equations. This shows again how functional results that are motivated by convex geometry can have applications to very different areas of mathematics. In any case, the crucial definition from \cite{Cordero-Erausquin2015} is the following: \begin{defn} Fix $f\in\lc_{n}$ with $0<\int f<\infty$. We say that $f$ is essentially continuous if \[ \HH^{n-1}\left(\left\{ x\in\RR^{n}:\ f\text{ is not continuous at }x\right\} \right)=0, \] where $\HH^{n-1}$ denotes the $(n-1$)-dimensional Hausdorff measure (see, e.g. Chapter 2 of \cite{Evans1992} for definition of the Hausdorff measure). \end{defn} To explain this definition, let us write $K=\overline{\left\{ x:\ f(x)\ne0\right\} }$ for the support of $f$. Since $f=e^{-\phi}$ for a convex function $\phi$ and convex functions are continuous on the interior of their domain, $f$ is continuous everywhere outside of $\partial K$. Moreover, since $f$ is upper semi-continuous, it is easy to see that $f$ is continuous at a boundary point $x_{0}\in K$ if and only if $f(x_{0})=0$. Therefore $f$ is essentially continuous if and only if $f\equiv0$ $\HH^{n-1}$-a.e. on $\partial K$. The following theorem is an adaptation of Theorem 8 from \cite{Cordero-Erausquin2015} to our notation: \begin{thm}[\cite{Cordero-Erausquin2015}] \label{thm:subdifferential}Fix $f,g\in\lc_{n}$ with $0<\int f,\int g<\infty$. Assume that $f$ is essentially continuous. Then \[ \log\int f-\log\int g\ge\frac{1}{\int f}\cdot\int\left(h_{f}-h_{g}\right)\dd S_{f}. \] \end{thm} The relationship between Theorems \ref{thm:colesanti-fragala} and \ref{thm:subdifferential} may not be immediately clear, and as far as we know did not previously appear in the literature. To understand it, let us define $F:\cvx_{n}\to[-\infty,\infty]$ by \[ F(\psi)=-\log\int e^{-\psi^{\ast}}. \] In other words for every $f\in\lc_{n}$ we have $F(h_{f})=-\log\int f$, where we are using the fact that $\psi^{\ast\ast}=\psi$ for all $\psi\in\cvx_{n}$. Theorem \ref{thm:colesanti-fragala} is a theorem about the differential of $F$ at some point $h_{f}$. Indeed, under its technical assumptions we have by the chain rule \begin{align*} \left.\frac{\dd}{\dd t}\right|_{t=0^{+}}F\left(h_{f}+th_{g}\right) & =\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}F\left(h_{f\star\left(t\cdot g\right)}\right)=-\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\left[\log\int\left(f\star\left(t\cdot g\right)\right)\right]\\ & =-\frac{1}{\int f}\cdot\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\int\left(f\star\left(t\cdot g\right)\right)=-\frac{1}{\int f}\cdot\int h_{g}\dd S_{f}. \end{align*} In other words, the linear map $L_{f}(h_{g})=-\frac{1}{\int f}\int h_{g}\dd S_{f}$ is the differential of $F$ at the point $h_{f}$. On the other hand, Theorem \ref{thm:subdifferential} is a theorem about the \emph{subdifferential} of $F$. Indeed, the Prékopa\textendash Leindler inequality (\cite{Prekopa1971}, \cite{Leindler1972}) states that for every $f,g\in\lc_{n}$ with $0<\int f,\int g<\infty$ and $0<t<1$ one has \[ \int\left(\left(1-t\right)\cdot f\right)\star\left(t\cdot g\right)\ge\left(\int f\right)^{1-t}\left(\int g\right)^{t}, \] or \[ F\left((1-t)h_{f}+th_{g}\right)\le(1-t)F(h_{f})+tF(h_{g}). \] Therefore $F$ is convex on the appropriate domain. The conclusion of Theorem \ref{thm:subdifferential} may be written as \[ F(h_{g})-F(h_{f})\ge L_{f}\left(h_{g}-h_{f}\right), \] which means that $L_{f}$ belongs to the \emph{subdifferential} $\partial F(h_{f})$. This conclusion is weaker than the conclusion of Theorem \ref{thm:colesanti-fragala}, but the assumptions are much weaker as well. In fact, Cordero-Erausquin and Klartag show that essential continuity of $f$ is necessary for Theorem \ref{thm:subdifferential} to hold. The first major goal of this paper is to prove a common generalization of both Theorems \textendash{} We will obtain the stronger conclusion of Theorem \ref{thm:colesanti-fragala} under the optimal assumptions of Theorem \ref{thm:subdifferential}. More concretely, we will prove the following result: \begin{thm} \label{thm:first-variation}Fix $f,g\in\lc_{n}$ with $0<\int f,\int g<\infty$. If $f$ is essentially continuous, then \begin{equation} \delta(f,g)=\int h_{g}\dd S_{f}.\label{eq:moment-first-variation-1} \end{equation} Moreover, \eqref{eq:moment-first-variation-1} holding for $g=\oo_{B_{2}^{n}}$ is \textbf{equivalent} to $f$ being essentially continuous. \end{thm} We immediately remark that it is not necessarily true that both sides of \eqref{eq:moment-first-variation-1} are finite, and this equality can take the form $+\infty=+\infty$. As an example it is enough to take $f(x)=e^{-\left|x\right|^{2}/2}$, so $S_{f}=f\dd x$, and the function $g\in\lc_{n}$ which satisfies $h_{g}(x)=e^{\left|x\right|^{2}}$. Theorem \ref{thm:first-variation} is proved in Section \ref{sec:variation-formula}, after some preliminary technicalities are proved in Section \ref{sec:first-variation}. Other than a general desire to state theorems under the minimal and most elegant conditions, we believe that our proof also explains in a very transparent way exactly \emph{why} essential continuity is the natural condition here. The proof also hints about possible extensions of the theorem to the non essentially continuous case. \section{\label{sec:first-variation}First variation of the Legendre transform} This section is fairly short and technical, and is dedicated to a proof of the following result: \begin{prop} \label{prop:pointwise-der}Let $\psi,\alpha:\RR^{n}\to(-\infty,\infty]$ be lower semi-continuous functions. Assume that $\alpha$ is bounded from below and that $\alpha(0),\psi(0)<\infty$. Write $\phi=\psi^{\ast}$ . Then at every point $x_{0}\in\RR^{n}$ where $\phi$ is differentiable we have \begin{equation} \left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\left(\psi+t\alpha\right)^{\ast}(x_{0})=-\alpha\left(\nabla\phi(x_{0})\right).\label{eq:legendre-first-variation} \end{equation} \end{prop} Conceptually, Proposition \ref{prop:pointwise-der} is well-known. For example, it is similar to Lemma 4.11 of \cite{Colesanti2013}. In fact, if $\left\{ \psi_{t}\right\} $ is any family of convex functions, then it is well-known that under sufficient regularity assumptions we have \begin{equation} \left.\frac{\dd}{\dd t}\right|_{t=0}\psi_{t}^{\ast}(x_{0})=-\left.\frac{\dd}{\dd t}\right|_{t=0}\psi_{t}\left(\nabla\psi_{0}^{\ast}(x_{0})\right)\label{eq:legendre-variation-general} \end{equation} (This result is folklore, but see e.g. Proposition 5.1 of \cite{Artstein-Avidan2017} for one rigorous formulation). The thorny issue here is the words ``sufficient regularity assumptions'': for the proof of Theorem \ref{thm:first-variation} we will need Proposition \ref{prop:pointwise-der} as stated, with no extra smoothness or boundness assumptions. In fact, we do not even assume that $\psi$ and $\alpha$ are convex \textendash{} The Legendre transform of any function $\phi:\RR^{n}\to(-\infty,\infty]$, convex or not, can be defined using formula \eqref{eq:legendre-def}. This will not be important for the proof of Theorem \ref{thm:first-variation}, but will be useful in the second half of this paper. As we were unable to find Proposition \ref{prop:pointwise-der} in the literature with our minimal assumptions, we give a full proof in this section. We do mention that Lemma 2.7 of \cite{Berman2013} is fairly close to our proposition, and the proofs will have some similarities as well. We begin with a lemma: \begin{lem} \label{lem:unique-maximizer}Let $\psi:\RR^{n}\to(-\infty,\infty]$ be a lower semi-continuous function and let $\phi=\psi^{\ast}$ . Assume that for some fixed $x_{0}\in\RR^{n}$ the function $\phi$ is differentiable at $x_{0}$. Then: \begin{enumerate} \item $\lim_{\left|y\right|\to\infty}\left(\left\langle y,x_{0}\right\rangle -\psi(y)\right)=-\infty$. \item The supremum in the definition of $\psi^{\ast}(x_{0})=\phi(x_{0})$ is attained at the unique point $y_{0}=\nabla\phi(x_{0})$. \end{enumerate} \end{lem} \begin{proof} For $(1)$ we do not need that $\phi$ is differentiable at $x_{0}$, but only that it is finite in a neighborhood of $x_{0}$. Since $\phi$ is convex, it follows that there exists $\epsilon>0$ and $M>0$ such that $\phi\le M$ on $\overline{B}(x_{0},\epsilon)$. For any $0\ne y\in\RR^{n}$ we have \[ M\ge\phi\left(x_{0}+\epsilon\frac{y}{\left|y\right|}\right)\ge\left\langle y,x_{0}+\epsilon\frac{y}{\left|y\right|}\right\rangle -\psi(y)=\left(\left\langle y,x_{0}\right\rangle -\psi(y)\right)+\epsilon\left|y\right|. \] Hence \[ \left\langle y,x_{0}\right\rangle -\psi(y)\le M-\epsilon\left|y\right|\xrightarrow{\left|y\right|\to\infty}-\infty, \] so $(1)$ is proved. Now we prove $(2)$. Since the function \[ y\mapsto\left\langle y,x_{0}\right\rangle -\psi(y) \] is upper semi-continuous and tends to $-\infty$ as $\left|y\right|\to\infty$, it must attain a maximum at some point $y_{0}$. We will show that necessarily $y_{0}=\nabla\phi(x_{0})$, which will also imply that the maximizer $y_{0}$ is unique. Indeed, for every $v\in\RR^{n}$ and every small $t>0$ we have \begin{align*} \phi(x_{0}+tv) & \ge\left\langle y_{0},x_{0}+tv\right\rangle -\psi(y_{0})=\left\langle y_{0},x_{0}+tv\right\rangle -\left(\left\langle y_{0},x_{0}\right\rangle -\phi(x_{0})\right)\\ & =\phi(x_{0})+t\left\langle y_{0},v\right\rangle . \end{align*} Hence \[ \left\langle y_{0},v\right\rangle \le\frac{\phi(x_{0}+tv)-\phi(x_{0})}{t}\xrightarrow{t\to0^{+}}\left\langle \nabla\phi(x_{0}),v\right\rangle . \] By replacing $v$ with $-v$ we have $\left\langle y_{0},v\right\rangle =\left\langle \nabla\phi(x_{0}),v\right\rangle $ for all $v\in\RR^{n}$, so indeed $y_{0}=\nabla\phi(x_{0})$ and $(2)$ is proved. \end{proof} We can now prove Proposition \ref{prop:pointwise-der}: \begin{proof}[Proof of Proposition \ref{prop:pointwise-der}] Choose $M>0$ such that $\alpha\ge-M$. By definition we have \[ \phi_{t}(x_{0})=\sup_{y\in\RR^{n}}\left(\left\langle x_{0},y\right\rangle -\psi_{t}(y)\right)=\sup_{y\in\RR^{n}}\underbrace{\left(\left\langle x_{0},y\right\rangle -\psi(y)-t\alpha(y)\right)}_{=:G_{t}(y)}. \] According to Lemma \ref{lem:unique-maximizer}$(1)$ we know that $\lim_{\left|y\right|\to\infty}G_{0}(y)=-\infty.$ Since $G_{t}\le G_{0}+tM$ we also have $\lim_{\left|y\right|\to\infty}G_{t}(y)=-\infty$. Since $\psi$ and $\alpha$ are lower semi-continuous it follows that the $\sup_{y}G_{t}(y)$ is attained at some point $y_{t}$. We claim that the set $\left\{ y_{t}\right\} _{0\le t\le1}$ is bounded. Indeed, for $0\le t\le1$ we have \begin{align*} G_{0}(y_{t}) & \ge G_{t}(y_{t})-tM=\sup_{y\in\RR^{n}}G_{t}(y)-tM\\ & \ge\sup_{y\in\RR^{n}}\left(\left\langle x_{0},y\right\rangle -\psi(y)-\alpha(y)-M\right)\ge-\psi(0)-\alpha(0)-M>-\infty, \end{align*} Since $\lim_{\left|y\right|\to\infty}G_{0}(y)=-\infty,$ $\left\{ y_{t}\right\} _{0\le t\le1}$ is indeed bounded. For $t=0$ we know from Lemma \ref{lem:unique-maximizer}$(2)$ that $G_{0}(y)$ is maximized at the \emph{unique }point $y_{0}=\nabla\phi_{0}(x_{0})$. On the one hand, we have \[ \phi_{t}(x_{0})\ge G_{t}(y_{0})=G_{0}(y_{0})-t\alpha(y_{0})=\phi_{0}(x_{0})-t\alpha(y_{0}), \] so we have the bound \[ \liminf_{t\to0^{+}}\frac{\phi_{t}(x_{0})-\phi_{0}(x_{0})}{t}\ge-\alpha(y_{0}). \] On the other hand, we have \[ \phi_{0}(x_{0})\ge G_{0}(y_{t})=G_{t}(y_{t})+t\alpha(y_{t})=\phi_{t}(x_{0})+t\alpha(y_{t}) \] so \[ \limsup_{t\to0^{+}}\frac{\phi_{t}(x_{0})-\phi_{0}(x_{0})}{t}\le-\liminf_{t\to0^{+}}\alpha(y_{t}). \] Therefore, to finish the proof it is enough to show that $\liminf_{t\to0^{+}}\alpha(y_{t})\ge\alpha(y_{0})$. Since $\alpha$ is lower semi-continuous, it is enough to show that $y_{t}\xrightarrow{t\to0^{+}}y_{0}$. Assume by contradiction this is not the case. Since $\left\{ y_{t}\right\} _{0\le t\le1}$ is bounded we can find a converging sequence $t_{i}\to0$ such that $y_{t_{i}}\to y^{\ast}\ne y$. Since $G_{0}$ is upper semi-continuous it follows that $G_{0}(y^{\ast})\ge\limsup_{i\to\infty}G_{0}(y_{t_{i}})$. But since $y_{t_{i}}$ maximizes $G_{t_{i}}$ we have \[ G_{0}(y_{t_{i}})+t_{i}M\ge G_{t_{i}}(y_{t_{i}})\ge G_{t_{i}}(y_{0})=G_{0}(y_{0})-t_{i}\alpha(y_{0}). \] Since $t_{i}\to0$ as $i\to\infty$ it follows that \[ G_{0}\left(y^{\ast}\right)\ge\limsup_{i\to\infty}G_{0}(y_{t_{i}})\ge G_{0}(y_{0}), \] contradicting the fact that $y_{0}$ is the \emph{unique} maximizer of $G_{0}$. Hence $y_{t}\to y_{0}$ and \eqref{eq:legendre-first-variation} is proved. \end{proof} \section{\label{sec:variation-formula}Essentially continuity and the variation Formula} We now begin our proof of Theorem \ref{thm:first-variation}. The following fact about essentially continuous log-concave functions was proved in \cite{Cordero-Erausquin2015}: \begin{prop} \label{prop:int-grad}For every $f\in\lc_{n}$ with $0<\int f<\infty$ we have $\int\left|\nabla f\right|<\infty$. If $f$ is essentially continuous then $\int\nabla f=0$. \end{prop} The following result is the main place essential continuity is used in our proof. It may be of independent interest: \begin{thm} \label{thm:coarea}Fix $f\in\lc_{n}$ with $0<\int f<\infty$ and let $K=\overline{\left\{ x:\ f(x)\ne0\right\} }$ denote its support. Then \[ \int_{0}^{\infty}\mathcal{H}^{n-1}\left(\left\{ x:\ f(x)=t\right\} \right)\dd t=\int_{\RR^{n}}\left|\nabla f\right|\dd x+\int_{\partial K}f\dd\HH^{n-1}. \] In particular, $f$ is essentially continuous if and only if we have the classic co-area formula \begin{equation} \int_{0}^{\infty}\mathcal{H}^{n-1}\left(\left\{ x:\ f(x)=t\right\} \right)\dd t=\int_{\RR^{n}}\left|\nabla f\right|\dd x.\label{eq:lc-coarea} \end{equation} \end{thm} \begin{proof} We will use the co-area formula for BV functions \textendash{} see e.g. \cite{Evans1992} for the statement and the necessary definitions. By translating $f$ we may assume without loss of generality that $0$ is in the interior of $K$. Let $\Phi:\RR^{n}\to\RR^{n}$ be a $C^{1}$ vector field with compact support. Choose a ball $B$ such that $\textrm{support}(\Phi)\subseteq B$. For every $\lambda<1$ the set $\lambda K\cap B$ is convex, hence a Lipschitz domain. Since convex functions are locally Lipschitz on the interior of their support, it follows that $f$ is Lipschitz on $\lambda K\cap B$. Hence $f\Phi$ is also Lipschitz and we may apply the divergence theorem: \begin{align*} \int_{\partial(\lambda K\cap B)}\left\langle f\Phi,n_{\lambda K\cap B}\right\rangle \dd\HH^{n-1} & =\int_{\lambda K\cap B}\div\left(f\Phi\right)=\int_{\lambda K}\div\left(f\Phi\right)\\ & =\int_{\lambda K}\left\langle \nabla f,\Phi\right\rangle +\int_{\lambda K}f\div\Phi. \end{align*} Here of course $n_{\lambda K\cap B}$ denotes the outer unit normal to the set $\lambda K\cap B$, which exists $\HH^{n-1}$-almost everywhere. Since $\Phi\equiv0$ on $\partial B$ we also have \begin{align*} \int_{\partial(\lambda K\cap B)}\left\langle f\Phi,n_{\lambda K\cap B}\right\rangle \dd\HH^{n-1} & =\int_{\partial\left(\lambda K\right)}f(y)\left\langle \Phi(y),n_{\lambda K}(y)\right\rangle \dd\HH^{n-1}(y)\\ & =\lambda^{n-1}\int_{\partial K}f(\lambda x)\left\langle \Phi(\lambda x),n_{\lambda K}(\lambda x)\right\rangle \dd\HH^{n-1}(x)\\ & =\lambda^{n-1}\int_{\partial K}f(\lambda x)\left\langle \Phi(\lambda x),n_{K}(x)\right\rangle \dd\HH^{n-1}(x). \end{align*} Letting $\lambda\to1^{-}$ and using the dominated convergence theorem we obtain \[ \int_{\partial K}f\left\langle \Phi,n_{K}\right\rangle \dd\HH^{n-1}=\int_{K}\left\langle \nabla f,\Phi\right\rangle +\int_{K}f\div\Phi, \] and since $f$ is supported on $K$ we may also write \[ \int_{\RR^{n}}f\div\Phi=-\int_{\RR^{n}}\left\langle \nabla f,\Phi\right\rangle +\int_{\partial K}f\left\langle \Phi,n_{K}\right\rangle \dd\HH^{n-1}. \] By definition, this means that $f$ is a function of locally bounded variation, and its variation measure $\left\Vert Df\right\Vert $ satisfies \begin{equation} \dd\left\Vert Df\right\Vert =\left|\nabla f\right|\dd x+f\cdot\left.\dd\HH^{n-1}\right|_{\partial K}\label{eq:variation-measure} \end{equation} (see Section 5.1 of \cite{Evans1992}). In particular, we may apply the co-area formula (Section 5.5 of \cite{Evans1992}) and conclude that \[ \int_{0}^{\infty}\mathcal{H}^{n-1}\left(\left\{ x:\ f(x)=t\right\} \right)\dd t=\left\Vert Df\right\Vert \left(\RR^{n}\right)=\int\left|\nabla f\right|\dd x+\int_{\partial K}f\dd\HH^{n-1}, \] which is what we wanted to prove. Finally, for the ``in particular'' part of the theorem, we see from the last equation that \eqref{eq:lc-coarea} holds if and only if $\int_{\partial K}f\dd\HH^{n-1}=0$. This holds if and only if $f\equiv0$ $\HH^{n-1}$-a.e. on $\partial K$, which exactly means that $f$ is essentially continuous. \end{proof} \begin{rem} Equation \eqref{eq:variation-measure} actually shows that $f$ is essentially continuous if and only if its variation measure $\left\Vert Df\right\Vert $ is absolutely continuous with respect to the Lebesgue measure. This is equivalent to $f$ belonging to the Sobolev space $W_{loc}^{1,1}\left(\RR^{n}\right)$ \textendash{} see again Section 5.1 of \cite{Evans1992}. By \eqref{eq:variation-measure} and Proposition \ref{prop:int-grad} we know that in this case \[ \left\Vert Df\right\Vert \left(\RR^{n}\right)=\int\left|\nabla f\right|<\infty, \] so we actually obtain the following characterization: a function $f\in\lc_{n}$ with $0<\int f<\infty$ is essentially continuous if and only if $f\in W^{1,1}\left(\RR^{n}\right)$. We will not need this characterization in this paper. \end{rem} We can already prove the ``moreover'' part of Theorem \ref{thm:first-variation}. In fact we will show something slightly more general: \begin{prop} \label{prop:first-variation-ball}Fix $f\in\lc_{n}$ with $0<\int f<\infty$. Write $g=\lambda\cdot\oo_{mB_{2}^{n}}$ for some $\lambda,m>0$. Then \begin{equation} \delta(f,g)=\int h_{g}\dd S_{f}\label{eq:variation-ball} \end{equation} if and only if $f$ is essentially continuous. \end{prop} \begin{proof} We first observe that multiplying $g$ by a constant cannot change the validity of \eqref{eq:variation-ball}. Indeed, define $\widetilde{g}=e^{c}\cdot g$ for some $c\in\RR$. Then on the left hand side we obtain \begin{align*} \delta(f,\widetilde{g}) & =\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\int\left(f\star\left(t\cdot\widetilde{g}\right)\right)=\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\left[e^{tc}\cdot\int\left(f\star\left(t\cdot g\right)\right)\right]\\ & =c\cdot\int f+\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\int\left(f\star\left(t\cdot g\right)\right)=c\int f+\delta(f,g), \end{align*} While on the right hand side we obtain \[ \int h_{\widetilde{g}}\dd S_{f}=\int\left(h_{g}+c\right)\dd S_{f}=c\int\dd S_{f}+\int h_{g}\dd S_{f}=c\int f+\int h_{g}\dd S_{f}. \] Since both sides changed by the same additive term, the validity of \eqref{eq:variation-ball} did not change. Hence we may assume without loss of generality that $\lambda=1$, i.e. $g=\oo_{mB_{2}^{n}}$. Let us compute both sides of \eqref{eq:variation-ball}. Write $f_{t}=f\star\left(t\cdot g\right)$, so by definition \[ f_{t}(x)=\sup_{y\in\RR^{n}}f(x-y)\oo_{mB_{2}^{n}}\left(\frac{y}{t}\right)^{t}=\sup_{y\in tmB_{2}^{n}}f(x-y). \] It follows that if we set $K_{s}=\left\{ x:\ f(x)\ge s\right\} $ then \[ \left\{ x:\ f_{t}(x)\ge s\right\} =K_{s}+tmB_{2}^{n}, \] so by the layer cake representation we have \[ \frac{\int f_{t}-\int f}{t}=\frac{\int_{0}^{\infty}\left|K_{s}+tB_{2}^{n}\right|\dd s-\int_{0}^{\infty}\left|K_{s}\right|\dd s}{t}=\int_{0}^{\infty}\frac{\left|K_{s}+tmB_{2}^{n}\right|-\left|K_{s}\right|}{t}\dd s. \] For every $s>0$ we have \[ \frac{\left|K_{s}+tmB_{2}^{n}\right|-\left|K_{s}\right|}{t}=m\frac{\left|K_{s}+tmB_{2}^{n}\right|-\left|K_{s}\right|}{tm}\xrightarrow{t\to0^{+}}m\cdot\left|\partial K_{s}\right|. \] Moreover, Minkowski's polynomiality theorem (see e.g. Theorem 5.1.7 of \cite{Schneider2013}) implies that for every fixed $s>0$ the left hand side is a polynomial in $t$ with non-negative coefficients, and hence monotone in $t$. Therefore we may apply the monotone convergence theorem and deduce that \[ \lim_{t\to0^{+}}\frac{\int f_{t}-\int f}{t}=m\int_{0}^{\infty}\left|\partial K_{s}\right|\dd s. \] On the other hand, we have $h_{g}(y)=m\left|y\right|$, so \[ \int h_{g}\dd S_{f}=m\int\left|\nabla\left(-\log f\right)\right|f=m\int\left|\nabla f\right|. \] Therefore in the case $g=\oo_{mB_{2}^{n}}$, formula \eqref{eq:variation-ball} reduces to the co-area formula \eqref{eq:lc-coarea}. By Theorem \ref{thm:coarea}, it holds if and only if $f$ is essentially continuous. \end{proof} Proposition \ref{prop:first-variation-ball} explains the role of essential continuity in the subject, but the full proof of Theorem \ref{thm:first-variation} is more technically involved. We will need Proposition \ref{prop:pointwise-der} from Section \ref{sec:first-variation}, as well as two more results. The first is contained e.g. in Lemma 3.2 of \cite{Artstein-Avidan2004}: \begin{prop} \label{prop:lc-int-conv}Let $f,f_{1},f_{2},\ldots:\RR^{n}\to[0,\infty)$ be log-concave functions such that $f_{i}\xrightarrow{i\to\infty}f$ pointwise. Then $\int f_{i}\to\int f$. \end{prop} The second is a very simple measure theoretic lemma: \begin{lem} \label{lem:fatou-comparison}Let $\left\{ u_{t}\right\} _{t>0},\left\{ v_{t}\right\} _{t>0},\left\{ w_{t}\right\} _{t>0}$ be families of integrable functions $u_{t},v_{t},w_{t}:\RR^{n}\to\RR$ such that $u_{t}\xrightarrow{t\to0^{+}}u$ , $v_{t}\xrightarrow{t\to0^{+}}v$ and $w_{t}\xrightarrow{t\to0^{+}}w$ almost everywhere. Assume that: \begin{enumerate} \item $u_{t}\le v_{t}\le w_{t}$ for all $t>0$. \item $\int w_{t}\xrightarrow{t\to0^{+}}\int w<\infty$. \item $\int u_{t}\xrightarrow{t\to0^{+}}\int u>-\infty$. \end{enumerate} Then we also have $\int v_{t}\xrightarrow{t\to0^{+}}\int v$. \end{lem} \begin{proof} Applying Fatou's lemma to $w_{t}-v_{t}$ we have \[ \int w-\limsup_{t\to0^{+}}\int v_{t}=\liminf_{t\to0^{+}}\int\left(w_{t}-v_{t}\right)\ge\int\left(w-v\right)=\int w-\int v, \] so $\limsup_{t\to0^{+}}\int v_{t}\le\int v$. Similarly we may apply Fatou's lemma to $v_{t}-u_{t}$ and obtain \[ \liminf_{t\to0^{+}}\int v_{t}-\int u=\liminf_{t\to0^{+}}\int\left(v_{t}-u_{t}\right)\ge\int(v-u)=\int v-\int u, \] so $\liminf_{t\to0^{+}}\int v_{t}\ge\int v$. The claim follows. \end{proof} We are now ready to prove Theorem \ref{thm:first-variation}. We will need a bit of notation for the proof. First, we write $f=e^{-\phi}$ and $g=e^{-\beta}$. We also set $\psi=h_{f}=\phi^{\ast}$ and $\alpha=h_{g}=\beta^{\ast}$. Finally we define $\psi_{t}=\psi+t\alpha$, $\phi_{t}=\psi_{t}^{\ast}$ and $f_{t}=e^{-\phi_{t}}=f\star\left(t\cdot g\right)$. We first prove the theorem under the extra assumption $\alpha$ grows very slowly: \begin{lem} \label{lem:var-linear-growth}Under the assumptions of Theorem \ref{thm:first-variation} assume further that \[ -m\le h_{g}(y)\le m\left|y\right|+c \] for some $m,c>0$. Then \[ \delta(f,g)=\int h_{g}\dd S_{f}. \] \end{lem} \begin{rem} \label{rem:finiteness-linear}Unlike the more general Theorem \ref{thm:first-variation}, the equality in the lemma is always an equality of finite quantities. Indeed, \[ \int h_{g}\dd S_{f}=\int h_{g}\left(\nabla\phi\right)e^{-\phi}\le\int\left(m\left|\nabla\phi\right|+c\right)e^{-\phi}=m\int\left|\nabla\left(e^{-\phi}\right)\right|+c\int e^{-\phi}, \] which is finite by Proposition \ref{prop:int-grad}. \end{rem} \begin{proof} Write $\widetilde{g}=e^{c}\cdot\oo_{mB_{2}^{n}}$, and observe that $h_{\widetilde{g}}(y)=m\left|y\right|+c$. Define \[ \widetilde{f}_{t}(x)=\left(f\star\left(t\cdot\widetilde{g}\right)\right)(x)=e^{tc}\cdot\max_{z:\ \left|z-x\right|\le mt}f(z). \] Since $h_{g}\le h_{\widetilde{g}}$ we also have $g\le\widetilde{g}$, so for all $t>0$ we have $f_{t}\le\widetilde{f}_{t}$. On the other hand, we also have \[ f_{t}=e^{-\left(\psi+t\alpha\right)^{\ast}}\ge e^{-\left(\psi-tm\right)^{\ast}}=e^{-\left(\phi+tm\right)}=e^{-tm}f. \] Therefore if we define $u_{t}=\frac{e^{-tm}f-f}{t}$, $v_{t}=\frac{f_{t}-f}{t}$ and $w_{t}=\frac{\widetilde{f}_{t}-f}{t}$ then $u_{t}\le v_{t}\le w_{t}$ for all $t>0$. We claim that \begin{equation} v_{t}\to\alpha\left(\nabla\phi\right)f\label{eq:pointwise-diff} \end{equation} almost everywhere, where we interpret the right hand side to be $0$ whenever $f=0$. Indeed, this will follow from Proposition \ref{prop:pointwise-der}. More precisely, let $K=\overline{\left\{ x:\ f(x)\ne0\right\} }$ denote the support of $f$. As a convex function $\phi$ is differentiable almost everywhere on $K$, so at almost every $x\in K$ we may apply Proposition \ref{prop:pointwise-der} and deduce that \[ \left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\phi_{t}(x)=-\alpha\left(\nabla\phi(x)\right). \] By the chain rule we then have \[ \left.\frac{\dd}{\dd t}\right|_{t=0^{+}}f_{t}(x)=\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}e^{-\phi_{t}}(x)=\alpha\left(\nabla\phi(x)\right)\cdot f(x) \] like we wanted. On the other hand, for every $x\notin K$ we have $d(x,K)=\delta>0$, and then for every $t<\frac{\delta}{m}$ we have $\widetilde{f}_{t}(x)=0$. Hence $f_{t}(x)=0$ as well for all small enough $t>0$, so we obviously have $\lim_{t\to0^{+}}v_{t}(x)=0$. This concludes the proof of \eqref{eq:pointwise-diff}. The same proof with $g$ replaced by $\widetilde{g}$ shows that $w_{t}\to\left(m\left|\nabla\phi\right|+c\right)f$ almost everywhere, and basic calculus implies that $u_{t}\to-mf$. Let us call these three pointwise limits $v$, $w$ and $u$. It is trivial that \[ \int u_{t}\xrightarrow{t\to0^{+}}-m\int f=\int u>-\infty. \] Since $f$ is essentially continuous we may apply Proposition \ref{prop:first-variation-ball} and deduce that \[ \lim_{t\to0^{+}}\int w_{t}=\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\int\widetilde{f}_{t}=\int h_{\widetilde{g}}\dd S_{f}=\int w. \] Moreover, remark \ref{rem:finiteness-linear} explains why $\int w<\infty$. Hence we may apply Lemma \ref{lem:fatou-comparison} and deduce that \[ \lim_{t\to0^{+}}\int v_{t}=\int\lim_{t\to0^{+}}v_{t}=\int\alpha\left(\nabla\phi\right)f=\int h_{g}\dd S_{f}, \] completing the proof. \end{proof} Now we can finally prove Theorem \ref{thm:first-variation} in its full generality: \begin{proof}[Proof of Theorem \ref{thm:first-variation}.] First we claim that translating $g$ does not change the validity of the theorem. Indeed, the left hand side clearly doesn't change when we replace $g$ by $\widetilde{g}(x)=g(x-v)$. For the right hand side we have $h_{\widetilde{g}}(x)=h_{g}(x)+\left\langle x,v\right\rangle $, so by Proposition \pageref{prop:int-grad} we have \begin{align*} \int h_{\widetilde{g}}\dd S_{f} & =\int h_{g}\dd S_{f}+\int\left\langle x,v\right\rangle \dd S_{f}=\int h_{g}\dd S_{f}+\int\left\langle \nabla\phi,v\right\rangle f\\ & =\int h_{g}\dd S_{f}-\left\langle \int\nabla f,v\right\rangle =\int h_{g}\dd S_{f}. \end{align*} Hence we may translate and assume that $\max g=g(0)>0$, which means that $\min\beta=\beta(0)<\infty$. This implies that $\alpha\ge-\beta(0)>-\infty$ is bounded from below. For every integer $i>0$ we define \[ g_{i}(x)=\begin{cases} g(x) & \left|x\right|\le i\\ 0 & \text{otherwise.} \end{cases} \] Define $f_{t,i}=f\star t\cdot g_{i}$ and $\alpha_{i}=h_{g_{i}}$. We claim that $\alpha_{i}(x)\nearrow\alpha(x)$ and $f_{t,i}(x)\nearrow f_{t}(x)$ as $i\to\infty$, where $x\in\RR^{n}$ and $t>0$ are fixed. Let us show that $f_{t,i}(x)\nearrow f_{t}(x)$. Since $g_{i}$ is increasing in $i$ and $g_{i}\le g$ it follows that $f_{t,i}$ is also increasing in $i$ and $f_{t,i}\le f$. Therefore we only have to prove that \[ \sup_{i\ge1}f_{t,i}(x)\ge f_{t}(x). \] Indeed, for every $\epsilon>0$ there exists $y_{0}\in\RR^{n}$ such that \[ f_{t}(x)=\sup_{y\in\RR^{n}}f(x-y)g\left(\frac{y}{t}\right)^{t}\le f(x-y_{0})g\left(\frac{y_{0}}{t}\right)^{t}+\epsilon. \] Therefore for every $i_{0}>\left|y_{0}/t\right|$ we have \begin{align*} \sup_{i\ge1}f_{t,i}(x) & \ge f_{t,i_{0}}(x)=\sup_{y\in\RR^{n}}f(x-y)g_{i_{0}}\left(\frac{y}{t}\right)^{t}\ge f(x-y_{0})g_{i_{0}}\left(\frac{y_{0}}{t}\right)^{t}\\ & =f(x-y_{0})g\left(\frac{y_{0}}{t}\right)^{t}\ge f_{t}(x)-\epsilon. \end{align*} Since $\epsilon>0$ was arbitrary the claim is proved. The proof that $\alpha_{i}(x)\to\alpha(x)$ is similar. Note that \[ \alpha_{i}(y)=\sup_{x\in\RR^{n}}\left(\left\langle x,y\right\rangle -\beta_{i}(x)\right)=\sup_{\left|x\right|\le i}\left(\left\langle x,y\right\rangle -\beta(x)\right)\le i\left|y\right|-\beta(0), \] and that $\alpha_{i}(y)\ge-\beta_{i}(0)=-\beta(0)$. Hence we may apply Lemma \ref{lem:var-linear-growth} and conclude that \[ \delta(f,g_{i})=\lim_{t\to0^{+}}\frac{\int f_{t,i}-\int f}{t}=\int h_{g_{i}}\dd S_{f}. \] In particular, as was explained in Remark \ref{rem:finiteness-linear} these expressions are finite. Since $\alpha_{i}\nearrow\alpha$ we have by monotone convergence $\int h_{g_{i}}\dd S_{f}\nearrow\int h_{g}\dd S_{f}$. For the left hand side, define $\rho_{i}(t)=\int f_{t,i}$ and $\rho(t)=\int f_{t}$, and set $\rho_{i}(0)=\rho(0)=\int f$. By Proposition \ref{prop:lc-int-conv} we have $\rho_{i}(t)\xrightarrow{i\to\infty}\rho(t)$ for all $t>0$. For every $i$ the function \[ \phi_{i,t}(x)=\left(\psi+t\alpha_{i}\right)^{\ast}(x)=\sup_{y\in\RR^{n}}\left[\left\langle x,y\right\rangle -\psi(y)-t\alpha_{i}(y)\right] \] is jointly convex in $(t,x)\in\RR^{n+1}$ as the supremum of linear functions. The Prékopa-Leindler inequality then implies that $\rho_{i}(t)=\int e^{-\phi_{i,t}(x)}\dd x$ is log-concave as well. Similarly $\rho$ is log-concave. Hence \begin{align*} \left(\log\rho\right)_{+}^{\prime}(0) & =\lim_{t\to0^{+}}\frac{\log\rho(t)-\log\rho(0)}{t}=\sup_{t>0}\frac{\log\rho(t)-\log\rho(0)}{t}\\ & =\sup_{t>0}\sup_{i}\frac{\log\rho_{i}(t)-\log\rho_{i}(0)}{t}=\sup_{i}\sup_{t>0}\frac{\log\rho_{i}(t)-\log\rho_{i}(0)}{t}\\ & =\sup_{i}\left(\log\rho_{i}\right)_{+}^{\prime}(0)=\sup_{i}\frac{\left(\rho_{i}\right)_{+}^{\prime}(0)}{\int f}=\sup_{i}\frac{\int\alpha_{i}\dd S_{f}}{\int f}=\frac{\int\alpha\dd S_{f}}{\int f}. \end{align*} On the other hand, we also have $\left(\log\rho\right)_{+}^{\prime}(0)=\frac{\rho_{+}^{\prime}(0)}{\int f}$. One has to be careful here, since we do not know if $\rho$ is even continuous at $t=0$, let alone differentiable. Therefore we interpret this equality to mean that if $\left(\log\rho\right)_{+}^{\prime}(0)=+\infty$ then $\rho_{+}^{\prime}(0)=+\infty$ as well. Under this convention we see that indeed \[ \lim_{t\to0^{+}}\frac{\int f_{t}-\int f}{t}=\rho_{+}^{\prime}(0)=\int\alpha\dd S_{f}, \] and the proof is complete. \end{proof} \section{\label{sec:Lp-intro}Minkowski's theorem and $L^{p}$-surface area measures} It is now time to discuss a classic problem we avoided so far: What measures are surface area measures? In the classic case of convex bodies, the answer is known as Minkowski's existence theorem: \begin{thm} \label{thm:minkowski-classic}Let $\mu$ be a finite Borel measure on $\SS^{n-1}$. Then $\mu=S_{K}$ for some convex body $K$ if and only if it satisfies the following two conditions: \begin{enumerate} \item $\mu$ is centered, i.e. $\int_{\SS^{n-1}}x\dd\mu(x)=0$. \item $\mu$ is not supported on any great sub-sphere of $\SS^{n-1}$. \end{enumerate} \end{thm} In this classical setting, the uniqueness is also well known \textendash{} if $S_{K}=S_{L}$ for some convex bodies $K$ and $L$ then necessarily $K=L+v$ for some $v\in\RR^{n}$. For a proof of these facts see e.g. Sections 8.1 and 8.2 of \cite{Schneider2013}. In \cite{Cordero-Erausquin2015} Cordero-Erausquin and Klartag proved a functional version of Theorem \ref{thm:minkowski-classic}. In our notation their result reads as follows: \begin{thm}[\cite{Cordero-Erausquin2015}] \label{thm:1-lc-minkowski}Let $\mu$ be a finite Borel measure on $\RR^{n}$. Then $\mu=S_{f}$ for an essentially continuous $f\in\lc_{n}$ with $0<\int f<\infty$ if and only $\mu$ satisfies the following two conditions: \begin{enumerate} \item $\mu$ is centered (so in particular $\int_{\RR^{n}}\left|x\right|\dd\mu(x)<\infty$). \item $\mu$ is not supported on any lower dimensional linear subspace of $\RR^{n}$. \end{enumerate} Moreover, $f$ is uniquely determined up to translations. \end{thm} Besides its geometric content this theorem can also be viewed analytically, as an existence and uniqueness theorem for generalized solutions of a Monge-Ampère type differential equation. Indeed, assume that $\frac{\dd\mu}{\dd x}=g$ for a smooth function $g$, and that the solution $f=e^{-\phi}$ to the equation $S_{f}=\mu$ is smooth as well. Then using \eqref{eq:push-forward} and the classic change of variables formula we see that \[ g\left(\nabla\phi(x)\right)\cdot\det\left(\nabla^{2}\phi(x)\right)=e^{-\phi(x)} \] for all $x\in\RR^{n}$. This point of view is further explained in \cite{Cordero-Erausquin2015}. We also remark that the ``uniqueness'' part of the theorem was also proved in \cite{Colesanti2013} under some technical conditions. For the rest of this paper we will be mostly interested in an extension of the surface area measure, known as the $L^{p}$-surface area measure. Given two convex bodies $K,L$ containing the origin and a number $p\ge1$, the $L^{p}$-combination $K+_{p}\left(t\cdot L\right)$ of $K$ and $L$ is defined via its support function by \begin{equation} h_{K+_{p}t\cdot L}=\left(h_{K}^{p}+t\cdot h_{L}^{p}\right)^{1/p}.\label{eq:p-mean-direct} \end{equation} Note that since $0\in K,L$ we know that $h_{K},h_{L}\ge0$, so the right hand side is well-defined. Moreover, using the fact that the $L^{p}$ norm is indeed a norm it is not hard to check that the right hand side defines a convex, $1$-homogeneous function, and hence the body $K+_{p}t\cdot L$ exists. For $p=1$ the $L^{p}$-addition $+_{1}$ coincides with the usual Minkowski addition. $L^{p}$ additions of convex bodies were first defined by Firey (\cite{Firey1962}), and the Brunn-Minkowski theory of such bodies was developed by Lutwak (\cite{Lutwak1993}, \cite{Lutwak1996}). In particular, in \cite{Lutwak1993} Lutwak proved an extension of \eqref{eq:body-area-measure} for this case: For every pair convex bodies $K,L$ containing the origin we have \begin{equation} \lim_{t\to0^{+}}\frac{\left|K+_{p}t\cdot L\right|-\left|K\right|}{t}=\frac{1}{p}\int_{\SS^{n-1}}h_{L}^{p}h_{K}^{1-p}\dd S_{K}.\label{eq:p-variation} \end{equation} We refer to the measure $h_{K}^{1-p}\dd S_{K}$ as the $L^{p}$-surface areas measure of $K$, and denote it by $S_{K,p}$. In the same paper Lutwak proved an extension of Minkowski's existence theorem for $p\ge1$: \begin{thm}[\cite{Lutwak1993}] \label{thm:p-Minkowski-classic}Fix $p\ge1$, and let $\mu$ be an \textbf{even} finite Borel measure on $\SS^{n-1}$ which is not supported on any great sub-sphere. Then: \begin{enumerate} \item If $p\ne n$ there exists an origin-symmetric convex body $K$ (i.e. $K=-K$) such that $S_{K,p}=\mu$. \item For $p=n$ there exists an origin-symmetric convex body $K$ such that $S_{K,n}=c\cdot\mu$ for some $c>0$. \end{enumerate} Moreover, the body $K$ is unique. \end{thm} In order to explain some peculiarities about the statement of Theorem \ref{thm:p-Minkowski-classic}, it is useful to say a few words about its proof. In the proof one finds the body $K$ by minimizing the functional \[ \Phi(L)=\left|L\right|^{-\frac{p}{n}}\int_{\SS^{n-1}}h_{L}^{p}\dd\mu \] over the class of origin symmetric convex bodies. If the minimum is attained at some body $K$, then it turns out that the first order optimality condition ``$\nabla\Phi(K)=0$'' implies that $S_{K}=c\cdot\mu$ for some $c>0$. If $p\ne n$ we can dilate $K$ to have exactly $S_{K}=\mu$, by noticing that $S_{\lambda K,p}=\lambda^{n-p}S_{K,p}$. Obviously this scaling idea cannot work when $p=n$, as in this case $S_{\lambda K,n}=S_{K,n}$. This explains why the case $p=n$ is special. This very rough sketch of the proof can also explain why $\mu$ is assumed to be even, an assumption that was unnecessary in the case $p=1$. Indeed, the use of the first order optimality condition ``$\nabla\Phi(K)=0$'' requires the minimizer $K$ to be an interior point of the domain of $\Phi$. When $p>1$, $\Phi$ can only be defined on convex bodies containing the origin, to make $h_{L}^{p}$ well defined. Without the assumption that $L$ is origin symmetric the minimum of $\Phi$ may be obtained at some body $K$ containing $0$ at its boundary, which will make the argument impossible. Variants of Theorem \ref{thm:p-Minkowski-classic} are known for non-even measures (see \cite{Chou2006} and \cite{Hug2005}), but we will not require them here. In recent years there has been a lot of interest in the $L^{p}$ theory, and in particular in $L^{p}$-surface area measures, for $0<p<1$. When $p<1$ one cannot define $K+_{p}t\cdot L$ using \eqref{eq:p-mean-direct}, as the right hand side is not necessarily a convex function. Instead, for any function $\rho:\SS^{n-1}\to(0,\infty)$, convex or not, one defines the Alexandrov body (or Wulff shape) of $\rho$ as \[ A\left[\rho\right]=\left\{ x\in\RR^{n}:\ \left\langle x,\theta\right\rangle \le\rho(\theta)\text{ for all }\theta\in\SS^{n-1}\right\} . \] In other words, $A[\rho]$ is the largest convex body with $h_{A[\rho]}\le\rho$. In particular for every convex body $K$ we have $A[h_{K}]=K$. Then one can define \[ K+_{p}t\cdot L=A\left[\left(h_{K}^{p}+th_{L}^{p}\right)^{1/p}\right] \] for any $p>0$. Using the saw called Alexandrov Lemma, one can verify that \eqref{eq:p-variation} remains true for $0<p<1$. Furthermore, as Schneider observes in \cite{Schneider2013} (see Theorem 9.2.1), the existence part of Theorem \ref{thm:p-Minkowski-classic} continues to hold in this case, with the same proof. However, for $p<1$, the uniqueness problem is highly non-trivial. In fact it was proved by Böröczky, Lutwak, Yang and Zhang (\cite{Boroczky2012}) that this uniqueness problem is equivalent to the so called $L^{p}$-Brunn-Minkowski conjecture, a major open problem in convex geometry. While this relation was one of our original motivation to study $L^{p}$-surface area measures it will not play any role in the sequel, so we will not give any further details. We will be interested in functional $L^{p}$-addition and functional $L^{p}$-surface area measures. The definitions are fairly straightforward: \begin{defn} Let $\psi:\RR^{n}\to(-\infty,\infty]$ be a lower semi-continuous function (which may or may not be convex). The Alexandrov Function of $\psi$ is $f=A\left[\psi\right]=e^{-\psi^{\ast}}.$ \end{defn} Note that $h_{f}=\psi^{\ast\ast}$ , so $f$ is the largest log-concave function with $h_{f}\le\psi$ in analogy to the classical theory. We then define: \begin{defn} Fix $p>0$ and fix functions $f,g\in\lc_{n}$ with $h_{f},h_{g}\ge0$. The $L^{p}$-combination $f\star_{p}t\cdot g$ is defined by \[ f\star_{p}t\cdot g=A\left[\left(h_{f}^{p}+th_{g}^{p}\right)^{1/p}\right]. \] \end{defn} Let us compute the first variation of $\int\left(f\star_{p}t\cdot g\right)$. Unlike the case $p=1$ we will not do it rigorously under minimal assumptions, but use \eqref{eq:legendre-variation-general} to derive the answer formally assuming sufficient regularity: \begin{align*} \left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\int\left(f\star_{p}t\cdot g\right) & =\int\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\left(f\star_{p}t\cdot g\right)\\ & =\int\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\exp\left(-\left[\left(h_{f}^{p}+th_{g}^{p}\right)^{1/p}\right]^{\ast}\right)\\ & =-\int\left(e^{-\phi}\cdot\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\left[\left(h_{f}^{p}+th_{g}^{p}\right)^{1/p}\right]^{\ast}\right)\\ & =\int\left(e^{-\phi}\cdot\left(\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\left[\left(h_{f}^{p}+th_{g}^{p}\right)^{1/p}\right]\circ\nabla\phi\right)\right)\\ & =\frac{1}{p}\int e^{-\phi}\cdot h_{f}^{1-p}\left(\nabla\phi\right)\cdot h_{g}^{p}\left(\nabla\phi\right)=\frac{1}{p}\int h_{g}^{p}h_{f}^{1-p}\dd S_{f}. \end{align*} As expected, the result is completely analogous to the case of convex bodies, so we make the following definition: \begin{defn} For $f\in\lc_{n}$ with $0<\int f<\infty$ and $0<p<1$ we define the $L^{p}$-surface area measure of $f$ to be $S_{f,p}=h_{f}^{1-p}\dd S_{f}$. \end{defn} \begin{rem} \label{rem:surface-support}For $S_{f,p}$ to be well defined and not identically equal to $+\infty$ we should verify that $h_{f}(x)<\infty$ for $S_{f}$-almost every $x$. This is true since at every point $x\in\RR^{n}$ where $f(x)>0$ and $\phi(x)=-\log f(x)$ is differentiable we have by Lemma \ref{lem:unique-maximizer} \[ \phi(x)=\left\langle x,\nabla\phi(x)\right\rangle -h_{f}\left(\nabla\phi(x)\right), \] so in particular $h_{f}\left(\nabla\phi(x)\right)<\infty$. Hence \[ S_{f}\left(\left\{ y:\ h_{f}(y)=\infty\right\} \right)=\int\oo_{\left\{ h_{f}\left(\nabla\phi(x)\right)=\infty\right\} }f(x)\dd x=0, \] so $S_{f}$-almost everywhere we have $h_{f}<\infty$. \end{rem} The second major goal of this paper is to prove a Minkowski existence theorem for functional $L^{p}$-surface area measures. More concretely we will prove the following: \begin{thm} \label{thm:lp-minkowski}Fix $0<p<1$. Let $\mu$ be an \textbf{even} finite Borel measure on $\RR^{n}$. Assume that: \begin{enumerate} \item $\int\left|x\right|\dd\mu<\infty$ (and then of course $\mu$ is centered, as it is even) \item $\mu$ is not supported on any hyperplane \end{enumerate} Then there exists $c>0$ and an even function $f\in\lc_{n}$ with $h_{f}\ge0$ such that $S_{f,p}=c\cdot\mu$. \end{thm} If again we assume that $\frac{\dd\mu}{\dd x}=g$ for some smooth function $g$ and that the solution $f=e^{-\phi}$ to $S_{f,p}=c\cdot\mu$ is also smooth, then $\phi$ solves the Monge-Ampère type differential equation \[ c\cdot g\left(\nabla\phi(x)\right)\cdot\det\left(\nabla^{2}\phi(x)\right)=\left(\phi^{\ast}(x)\right)^{1-p}e^{-\phi(x)}. \] Note that we claim nothing about the uniqueness of $f$. As was explained above this is a much more delicate issue that we will not address here. Also note that we only prove the result for even measures $\mu$, and we can only deduce that $S_{f,p}$ coincides with the measure $\mu$ up to a constant $c>0$. This is very similar to the case $p=n$ of Theorem \ref{thm:p-Minkowski-classic}, and happens for essentially the same reasons. We will prove Theorem \ref{thm:lp-minkowski} in the next section. \section{\label{sec:Lp-existence}A functional $L^{p}$ Minkowski's existence theorem} In this section we prove Theorem \ref{thm:lp-minkowski}. Not surprisingly, we will find the function $f$ we are looking for by solving a certain optimization problem. Unlike the proofs of Theorems \ref{thm:1-lc-minkowski} and \ref{thm:p-Minkowski-classic} however, it will be much more convenient to work with a \emph{constrained} optimization problem. First we will need a result guaranteeing the existence of a minimizer: \begin{prop} \label{prop:lp-minimizer}Assume $\mu$ satisfies the assumptions of Theorem \ref{thm:lp-minkowski}. Fix $0<p<1$, and consider the minimization problem \[ \min\left\{ \int\psi^{p}\dd\mu:\ \begin{array}{l} \psi:\RR^{n}\to[0,\infty]\text{ is even,}\\ \text{measurable and }\int e^{-\psi^{\ast}}\ge a \end{array}\right\} . \] If $a>0$ is large enough then the minimum is attained for a lower semi-continuous convex function $\psi_{0}$. Moreover, $\psi_{0}(0)>0$ and $\int e^{-\psi_{0}^{\ast}}=a$. \end{prop} In order to prove this proposition we will need two lemmas, which are both variants of lemmas from \cite{Cordero-Erausquin2015}. First let us state our version of Lemma 15 from this paper: \begin{lem} \label{lem:zero-value}Assume $\mu$ satisfies the assumptions of Theorem \ref{thm:lp-minkowski}. Let $\psi:\RR^{n}\to[0,\infty]$ be an even lower semi-continuous convex function with $\psi(0)=0$. Write $\phi=\psi^{\ast}$ and fix $0<p<1$. Then \[ \int\psi^{p}\dd\mu\ge c_{\mu}\left(\int e^{-\phi}\right)^{\frac{p}{n}}-C_{\mu} \] for $c_{\mu},C_{\mu}>0$ that depend on $\mu$ and $p$ but not on $\psi$. \end{lem} For completeness we provide a proof of the lemma. The fact that we only deal with even functions and measures makes the proof shorter than the corresponding proof in \cite{Cordero-Erausquin2015}: \begin{proof} If $\int\psi^{p}\dd\mu=\infty$ there is nothing to prove, so we may assume that $\int\psi^{p}\dd\mu<\infty$. Therefore $\psi$ is finite on the support of $\mu$, and since $\psi$ is convex it is also finite on its convex hull $K=\text{conv}(\text{supp}(\mu))$. By our assumptions on $\mu$ the body $K$ is an origin symmetric convex body with non-empty interior, so it must contain $0$ in its interior. In particular $\psi$ is bounded in a neighborhood of $0$. If $\left|\psi(y)\right|\le M$ for $\left|y\right|\le\delta$ then \[ \phi(x)=\sup_{y\in\RR^{n}}\left[\left\langle x,y\right\rangle -\psi(y)\right]\ge\left\langle x,\frac{\delta x}{\left|x\right|}\right\rangle -\psi\left(\frac{\delta x}{\left|x\right|}\right)\ge\delta\left|x\right|-M, \] So in particular $\int e^{-\phi}<\infty$. If $\int e^{-\phi}=0$ again there is nothing to prove, so we may assume $0<\int e^{-\phi}<\infty$. By the Blaschke-Santaló inequality (see \cite{Artstein-Avidan2004}) it follows that \[ \int e^{-\psi}\cdot\int e^{-\phi}\le\left(2\pi\right)^{\frac{n}{2}}. \] Next we define \[ K=\left\{ y\in\RR^{n}:\ \psi(y)\le1\right\} . \] We also define $r=\min_{\theta\in\SS^{n-1}}h_{K}(\theta)$, and let $\theta_{0}\in\SS^{n-1}$ be the direction in which this minimum is attained. It follows that \[ \frac{\left(2\pi\right)^{n/2}}{\int e^{-\phi}}\ge\int_{\RR^{n}}e^{-\psi}\ge\int_{K}e^{-\psi}\ge\frac{1}{e}\left|K\right|\ge\frac{1}{e}\left|rB^{n}\right|=c_{n}\cdot r^{n}, \] so $r\le C_{n}\cdot\left(\int e^{-\phi}\right)^{-1/n}$. Here and everywhere else $c_{n},C_{n}>0$ are some constants that depend only on the dimension $n$. For every $y\in K$ we have $r=h_{K}(\theta_{0})\ge\left|\left\langle y,\theta_{0}\right\rangle \right|$. Equivalently, if $\left|\left\langle y,\theta_{0}\right\rangle \right|>r$ then $x\notin K$, so $\psi(y)>1$. It follows that if $2r\le\left|\left\langle y,\theta_{0}\right\rangle \right|$ then \[ 1<\psi\left(\frac{2r}{\left|\left\langle y,\theta_{0}\right\rangle \right|}y\right)=\psi\left(\left(1-\frac{2r}{\left|\left\langle y,\theta_{0}\right\rangle \right|}\right)\cdot0+\frac{2r}{\left|\left\langle y,\theta_{0}\right\rangle \right|}\cdot y\right)\le\frac{2r}{\left|\left\langle y,\theta_{0}\right\rangle \right|}\psi(y), \] so $\psi(y)+1\ge\psi(y)\ge\frac{\left|\left\langle y,\theta_{0}\right\rangle \right|}{2r}$. Obviously if $\left|\left\langle y,\theta_{0}\right\rangle \right|<2r$ this inequality still holds trivially, so it holds for every $y\in\RR^{n}$. Hence \[ \int(\psi^{p}+1)\dd\mu\ge\int(\psi+1)^{p}\dd\mu\ge\frac{1}{\left(2r\right)^{p}}\int\left|\left\langle y,\theta_{0}\right\rangle \right|^{p}\dd\mu. \] The function $\theta\mapsto\int\left|\left\langle y,\theta\right\rangle \right|^{p}\dd\mu(y)$ is continuous on $\SS^{n-1}$ by the dominated convergence theorem, and is strictly positive since $\mu$ is not supported on any hyperplane. Hence it has a positive minimum which we may denote by $\widetilde{c}_{\mu}$. It follows that \[ \int(\psi^{p}+1)\dd\mu\ge\frac{\widetilde{c}_{\mu}}{(2r)^{p}}\ge c_{\mu}\left(\int e^{-\phi}\right)^{\frac{p}{n}}, \] completing the proof. \end{proof} The second lemma we will need is a variant of Lemma 17 from \cite{Cordero-Erausquin2015}: \begin{lem} \label{lem:p-compactness}Assume $\mu$ satisfies the assumptions of Theorem \ref{thm:lp-minkowski}. Let $\left\{ \psi_{i}\right\} _{i=1}^{\infty}$ be non-negative, even, lower semi-continuous convex functions such that \[ \sup_{i}\int\psi_{i}^{p}\dd\mu<\infty. \] There there exists a subsequence $\left\{ \psi_{i_{j}}\right\} _{j=1}^{\infty}$ and an even lower semi-continuous convex function $\psi:\RR^{n}\to[0,\infty]$ such that \[ \int\psi^{p}\dd\mu\le\liminf_{j\to\infty}\int\psi_{i_{j}}^{p}\dd\mu\quad\text{and}\quad\int e^{-\psi^{\ast}}\ge\limsup_{j\to\infty}\int e^{-\psi_{i_{j}}^{\ast}}. \] \end{lem} In fact, Lemma 17 of \cite{Cordero-Erausquin2015} is exactly the same statement in the case $p=1$, and with the assumption of evenness replaced with the assumption $\psi_{i}(0)=0$. The proofs are identical, as writing the extra power $p$ everywhere doesn't affect the argument in any way. The assumption $\psi_{i}(0)=0$ is only used in \cite{Cordero-Erausquin2015} to know that $\psi_{i}(\lambda x)$ is increasing in $\lambda$. This is trivial when $\psi_{i}$ is even, so this assumption may be omitted. Since the proofs are otherwise identical we omit a proof of Lemma \ref{lem:p-compactness}. Using these two lemma we can prove Proposition \ref{prop:lp-minimizer}: \begin{proof}[Proof of Proposition \ref{prop:lp-minimizer}.] Without loss of generality assume that $\mu$ is a probability measure. Consider the function $\widetilde{\psi}(y)=\log a+c_{n}\left|y\right|$, where the constant $c_{n}$ is chosen such that $\left|c_{n}B_{2}^{n}\right|=1$. Then $\widetilde{\psi}^{\ast}(x)=-\log a+\oo_{c_{n}B_{2}^{n}}^{\infty}$, so $\int e^{-\widetilde{\psi}^{\ast}}=a$. For $a\ge e$ we have $\widetilde{\psi}\ge1$, so \[ \int\widetilde{\psi}^{p}\dd\mu\le\int\widetilde{\psi}\dd\mu=\log a+c_{n}\int\left|y\right|\dd\mu(y)=\log a+C_{\mu}. \] In particular we see that \[ m=\inf\left\{ \int\psi^{p}\dd\mu:\ \begin{array}{l} \psi:\RR^{n}\to[0,\infty]\text{ is even,}\\ \text{measurable and }\int e^{-\psi^{\ast}}\ge a \end{array}\right\} <\infty. \] Next we choose a sequence $\left\{ \psi_{i}\right\} _{i=1}^{\infty}$ of even, measurable functions with $\int e^{-\psi_{i}^{\ast}}\ge a$ and such that $\int\psi_{i}^{p}\dd\mu\to m$. By replacing each $\psi_{i}$ with its second Legendre conjugate $\psi_{i}^{\ast\ast}$ we may assume the functions $\left\{ \psi_{i}\right\} $ are all lower semi-continuous and convex. Obviously $\int\psi_{i}^{p}\dd\mu<m+1$ for all but finitely many values of $i$. Hence we can apply Lemma \ref{lem:p-compactness} and find a subsequence $\left\{ \psi_{i_{j}}\right\} $ and an even lower semi-continuous convex function $\psi:\RR^{n}\to[0,\infty]$ such that \[ \int\psi^{p}\dd\mu\le\liminf_{j\to\infty}\int\psi_{i_{j}}^{p}\dd\mu=m \] and \[ \int e^{-\psi^{\ast}}\ge\limsup_{j\to\infty}\int e^{-\psi_{i_{j}}^{\ast}}\ge a. \] It follows that $\int\psi^{p}\dd\mu=m$ and therefore $\psi$ is the minimizer we were looking for. Assume by contradiction that $\psi(0)=0$. Then by Lemma \ref{lem:zero-value} we have \[ \int\psi^{p}\dd\mu\ge c_{\mu}\left(\int e^{-\psi^{\ast}}\right)^{\frac{p}{n}}-C_{\mu}\ge c_{\mu}a^{\frac{p}{n}}-C_{\mu}. \] Therefore for large enough $a>0$ we have $\int\psi^{p}\dd\mu>\int\widetilde{\psi}^{p}\dd\mu$, which is a contradiction to the minimality of $\psi$. Hence $\psi(0)>0$ for $a>0$ large enough. Finally, assume by contradiction that $\int e^{-\psi^{\ast}}>a$. Since $\psi(0)>0$ the function $\psi_{\epsilon}=\psi-\epsilon$ is non-negative for small enough $\epsilon>0$. Since $\int e^{-\psi_{\epsilon}^{\ast}}=e^{-\epsilon}\int e^{-\psi^{\ast}}$ we see that $\psi_{\epsilon}$ is in our domain for small enough $\epsilon>0$. But this is impossible since $\psi$ is a minimizer and $\int\psi_{\epsilon}^{p}\dd\mu<\int\psi^{p}\dd\mu$. This complete the proof. \end{proof} Now that we have our minimizer, Theorem \ref{thm:lp-minkowski} will follow by writing the first order optimality condition. In order to do this, we will need the following result, which is a much simpler variant of Theorem \ref{thm:first-variation}: \begin{prop} \label{prop:bounded-variation}Fix $f\in\lc_{n}$ with $0<\int f<\infty$ and set $\psi=h_{f}$. Let $v:\RR^{n}\to\RR$ be bounded and continuous. Then \[ \left.\frac{\dd}{\dd t}\right|_{t=0}\int e^{-\left(\psi+tv\right)^{\ast}}=\int v\dd S_{f}. \] \end{prop} \begin{proof} Fix a point $x_{0}$ where $\phi=-\log f$ is differentiable. By Proposition \ref{prop:pointwise-der} we know that \[ \left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\left(\psi+tv\right)^{\ast}(x_{0})=-v\left(\nabla\phi(x_{0})\right). \] (Recall that we very explicitly did not assume in Proposition \ref{prop:pointwise-der} that the function $v$ is convex). Applying the same proposition to $-v$ instead of $v$ we see that \[ \left.\frac{\dd}{\dd t}\right|_{t=0^{-}}\left(\psi+tv\right)^{\ast}(x_{0})=-\left(\left.\frac{\dd}{\dd t}\right|_{t=0^{+}}\left(\psi-tv\right)^{\ast}(x_{0})\right)=-v\left(\nabla\phi(x_{0})\right), \] so the two sided derivative exists. Therefore if we write $f_{t}=e^{-\left(\psi+tv\right)^{\ast}}$ then by the chain rule we have $\left.\frac{\dd}{\dd t}\right|_{t=0}f_{t}(x_{0})=v\left(\nabla\phi(x_{0})\right)f$. Choose $M>0$ such that $\left|v\right|\le M$. Then the functions $f_{t}=e^{-\left(\psi+tv\right)^{\ast}}$ satisfy $e^{-tM}f\le f_{t}\le e^{tM}f$. In particular all functions $f_{t}$ have the same support which we denote by $K$. Moreover for $\left|t\right|\le1$ we have \begin{align*} \left|\frac{f_{t}-f}{t}\right| & \le\max\left\{ \left|\frac{e^{tM}f-f}{t}\right|,\left|\frac{e^{-tM}f-f}{t}\right|\right\} \\ & =f\cdot\max\left\{ \left|\frac{e^{tM}-1}{t}\right|,\left|\frac{e^{-tM}-1}{t}\right|\right\} \le\left(e^{M}-1\right)\cdot f \end{align*} which is an integrable function. Hence by dominated convergence we have \begin{align*} \left.\frac{\dd}{\dd t}\right|_{t=0}\int e^{-\left(\psi+tv\right)^{\ast}} & =\left.\frac{\dd}{\dd t}\right|_{t=0}\int_{K}f_{t}=\int_{K}\left(\left.\frac{\dd}{\dd t}\right|_{t=0}f_{t}\right)=\int_{K}v\left(\nabla\phi\right)f\\ & =\int v\left(\nabla\phi\right)f=\int v\dd S_{f}. \end{align*} \end{proof} We can now complete the proof of Theorem \ref{thm:lp-minkowski}. In theory, since we are working with a constrained optimization problem, the first order optimality condition should involve Lagrange multipliers. Luckily our functions are simple enough that we may compute this optimality condition directly and we do not have to worry about the theory of Lagrange multipliers on an infinite dimensional space: \begin{proof}[Proof of Theorem \ref{thm:lp-minkowski}] Fix $a>0$ large enough and Let $\psi$ be the minimizer from Proposition \ref{prop:lp-minimizer}. Write $f=e^{-\phi}=e^{-\psi^{\ast}}$ and define $K=\overline{\left\{ x:\ \psi(x)<\infty\right\} }.$ Since $\int\psi^{p}\dd\mu<\infty$ the measure $\mu$ is supported on $K$. From Remark \ref{rem:surface-support} the measure $S_{f}$ is also supported on $K$. Fix an even, bounded and continuous function $v:\RR^{n}\to\RR$ whose support is contained in the \emph{interior} of $K$. Define \[ \psi_{t}=\psi+tv\psi^{1-p}+\log a-\log\int e^{-\left(\psi+tv\psi^{1-p}\right)^{\ast}}. \] Note that \[ \psi_{t}^{\ast}=\left(\psi+tv\psi^{1-p}\right)^{\ast}-\log a+\log\int e^{-\left(\psi+tv\psi^{1-p}\right)^{\ast}} \] so that $\int e^{-\psi_{t}^{\ast}}=a$. Moreover $v\psi^{1-p}$ is a bounded function, since $v$ is bounded on $\RR^{n}$ and $\psi$ is bounded on the support of $v$. Let us write $\left|v\psi^{1-p}\right|\le M$. We then also have \[ \log\int e^{-\left(\psi+tv\psi^{1-p}\right)^{\ast}}\le\log\int e^{-\left(\psi+\left|t\right|M\right)^{\ast}}=\log\left(e^{\left|t\right|M}\int e^{-\psi^{\ast}}\right)=\log a+\left|t\right|M \] and similarly $\log\int e^{-\left(\psi+tv\psi^{1-p}\right)^{\ast}}\ge\log a-\left|t\right|M$. Hence $\left|\psi_{t}-\psi\right|\le2\left|t\right|M$. In particular, since $\min\psi=\psi(0)>0$, there exists $\delta>0$ such that $\psi_{t}\ge\delta$ if $\left|t\right|$ is small enough. By Proposition \ref{prop:bounded-variation} we have \[ \left.\frac{\dd}{\dd t}\right|_{t=0}\psi_{t}=v\psi^{1-p}-\frac{1}{a}\cdot\int v\psi^{1-p}\dd S_{f}. \] The function $x\mapsto x^{p}$ is $\frac{p}{\delta^{1-p}}$-Lipschitz on the interval $[\delta,\infty)$. Since for small enough $\left|t\right|$ we have $\psi,\psi_{t}\ge\delta$ we obtain \begin{equation} \left|\frac{\psi_{t}^{p}-\psi^{p}}{t}\right|\le\frac{p}{\delta^{1-p}}\left|\frac{\psi_{t}-\psi}{t}\right|\le\frac{2Mp}{\delta^{1-p}}.\label{eq:p-dom-bound} \end{equation} From the fact that $\psi$ is a minimizer it follows that $\int\psi_{t}^{p}\dd\mu\ge\int\psi^{p}\dd\mu$ for all $\left|t\right|$ small enough. Because of \eqref{eq:p-dom-bound} we may apply dominated convergence and conclude that \begin{align*} 0 & =\left.\frac{\dd}{\dd t}\right|_{t=0}\int\psi_{t}^{p}\dd\mu=\int\left(\left.\frac{\dd}{\dd t}\right|_{t=0}\psi_{t}^{p}\right)\dd\mu\\ & =\int\left(p\psi^{p-1}\cdot\left(v\psi^{1-p}-\frac{1}{a}\int v\psi^{1-p}\dd S_{f}\right)\right)\dd\mu\\ & =p\int v\dd\mu-\frac{1}{a}\int v\psi^{1-p}\dd S_{f}\cdot\int p\psi^{p-1}\dd\mu. \end{align*} We see that \[ \int v\dd\mu=c\cdot\int v\psi^{1-p}\dd S_{f}=c\cdot\int v\dd S_{f,p} \] for some constant $c>0$ that depends on $\mu$ and $\psi$ but not on $v$. Since $\mu$ and $S_{f,p}$ are even and supported on $K$, and since this equality holds for \emph{every }even, bounded and continuous function $v$ whose support is contained in the interior of $K$, it follows that $\mu=c\cdot S_{f,p}$ . This completes the proof. \end{proof} \bibliographystyle{plain}
\section{Introduction} Task allocation in multi-agent systems is a fundamental problem in distributed computing. Given a collection of tasks, a collection of task-performing agents, and a \emph{demand vector} which specifies the number of agents required to perform each task, the agents must collectively allocate themselves to the tasks to satisfy the demand vector. This problem has been studied in a wide variety of settings. For example, agents may be identical or have differing abilities, agents may or may not be permitted to communicate with each other, agents may have limited memory or computational power, agents may be faulty, and agents may or may not have full information about the demand vector. See Georgiou and Shvartsman's book~\cite{georgiou2011cooperative} for a survey of the distributed task allocation literature. See also the more recent line of work by Dornhaus, Lynch and others on algorithms for task allocation in ant colonies~\cite{cornejo2014task, su2017ant, dornhaus2018self, radeva2017costs}. We consider the setting where the demand vector \emph{changes dynamically} over time and agents must redistribute themselves among the tasks accordingly. We aim to minimize the \emph{switching cost}, which is the number of agents that change tasks in response to a change in the demand vector. The switching cost is an important metric since changing tasks may incur significant overhead. Dynamic task allocation has been extensively studied in practical, heuristic, and experimental domains. For example, in swarm robotics, there is much experimental work on heuristics for dynamic task allocation (see e.g. \cite{krieger2000ant, csahin2004swarm, mclurkin2005dynamic, mclurkin2004stupid, lerman2006analysis, macarthur2011distributed}). Additionally, in insect biology it has been empirically observed that demands for tasks in ant colonies change over time based on environmental factors such as climate, season, food availability, and predation pressure~\cite{oster1979caste}. Accordingly, there is a large body of biological work on developing hypotheses about how insects collectively perform task allocation in response to a changing environment (see surveys \cite{beshers2001models, robinson1992regulation}). Despite the rich experimental literature, to the best of our knowledge there are only two works on dynamic distributed task allocation from a theoretical algorithmic perspective. Su, Su, Dornhaus, and Lynch~\cite{su2017ant} present and analyze gossip-based algorithms for dynamic task allocation in ant colonies. Radeva, Dornhaus, Lynch, Nagpal, and Su~\cite{radeva2017costs} analyze dynamic task allocation in ant colonies when the ants behave randomly and have limited information about the demand vector. \subsection{Problem Statement}\label{sec:state} We study the formalization of dynamic distributed task allocation introduced by Su, Su, Dornhaus, and Lynch~\cite{su2017ant}. \subparagraph{Objective:} Our goal is to minimize the \emph{switching cost}, which is the number of agents that change tasks in response to a change in the demand vector. \subparagraph{Properties of agents:} \begin{enumerate \item the agents have complete information about the changing demand vector \item the agents are heterogeneous \item the agents cannot communicate \item the agents are memoryless \end{enumerate} The first two properties specify \emph{capabilities} of the agents while the third and fourth properties specify \emph{restrictions} on the agents. Although the exclusion of communication and memory may appear overly restrictive, our setting captures well-studied models of both collective insect behavior and swarm robotics, as outlined in Section~\ref{sec:app}. From a mathematical perspective, our model captures the \emph{combinatorial} aspects of dynamic distributed task allocation. In particular, as we show in Section~\ref{sec:reform}, the problem can be reformulated as finding a \emph{low distortion embedding} from symmetric difference to Hamming distance. \subsubsection{Formal statement} Formally, the problem is defined as follows. There are three positive integer parameters: $n$ is the number of agents, $k$ is the number of tasks, and $D$ is the target \emph{maximum switching cost}, which we define later. The goal is to define a set of $n$ deterministic functions $f_1^{n,k},f_2^{n,k},\dots, f_n^{n,k}$, one for each agent, with the following properties. \begin{itemize} \item {\bf Input:} For each agent $a$, the function $f_a^{n,k}$ takes as input a \emph{demand vector} $\vec{v}=\{v_1,v_2,\dots,v_k\}$ where each $v_i$ is a non-negative integer and $\sum_i v_i=n$. Each $v_i$ is the number of agents required for task $i$, and the total number of agents required for tasks is exactly the total number of agents. \item {\bf Output:} For each agent $a$, the function $f_a^{n,k}$ outputs some $i\in [k]$. The output of $f_a^{n,k}(\vec{v})$ is the task that agent $a$ is assigned when the demand vector is $\vec{v}$. \item {\bf Demand satisfied:} For all demand vectors $\vec{v}$ and all tasks $i$, we require that the number of agents $a$ for which $f_a^{n,k}(\vec{v})=i$ is exactly $v_i$. That is, the allocation of agents to tasks defined by the set of functions $f_1^{n,k},f_2^{n,k},\dots, f_n^{n,k}$ exactly satisfies the demand vector. \item {\bf Switching cost satisfied:} The \emph{switching cost} of a pair $(\vec{v},\vec{v'})$ of demand vectors is defined as the number of agents $a$ for which $f_a^{n,k}(\vec{v})\not=f_a^{n,k}(\vec{v'})$; that is, the number of agents that switch tasks if the demand vector changes from $\vec{v}$ to $\vec{v'}$ (or from $\vec{v'}$ to $\vec{v}$). We say that a pair of demand vectors $\vec{v}$, $\vec{v'}$ are \emph{adjacent} if $|\vec{v}-\vec{v'}|_1=2$; that is, if we can get from $\vec{v}$ to $\vec{v'}$ by moving exactly one unit of demand from one task to another. The \emph{maximum switching cost} of a set of functions $f_1^{n,k},f_2^{n,k},\dots, f_n^{n,k}$ is defined as the maximum switching cost over all pairs of adjacent demand vectors; that is, the maximum number of agents that switch tasks in response to the movement of a single unit of demand from one task to another. We require that the maximum switching cost of $f_1^{n,k},f_2^{n,k},\dots, f_n^{n,k}$ is at most $D$. \end{itemize} \begin{mdframed} \begin{question*}Given $n$ and $k$, what is the minimum possible maximum switching cost $D$ over all sets of functions $f_1^{n,k},\dots, f_n^{n,k}$? \end{question*} \end{mdframed} \subsubsection{Remarks} \begin{remark} The problem statement only considers the switching cost of pairs of \emph{adjacent} demand vectors. We observe that this also implies a bound on the switching cost of non-adjacent vectors: if every pair of adjacent demand vectors has switching cost at most $D$, then every pair of demand vectors with $\ell_1$ distance $d$ has switching cost at most $D( d/2)$. \end{remark} \begin{remark}The problem statement is consistent with the properties of the agents listed above. In particular, the agents have complete information about the changing demand vector because for each agent, the function $f_a^{n,k}$ takes as input the current demand vector. The agents are heterogeneous because each agent $a$ has a separate function $f_a^{n,k}$. The agents have no communication or memory because the \emph{only} input to each function $f_a^{n,k}$ is the current demand vector. \end{remark} \begin{remark} Forbidding communication among agents is crucial in the formulation of the problem, as otherwise the problem would be trivial. In particular, it would always be possible to achieve maximum switching cost 1: when the current demand vector changes to an adjacent demand vector, the agents simply reach consensus about which single agent will move. \end{remark} \subsubsection{Applications}\label{sec:app} \paragraph{Collective insect behavior} There are a number of hypotheses that attempt to explain the mechanism behind task allocation in ant colonies (see the survey~\cite{beshers2001models}). One such hypothesis is the \emph{response threshold model}, in which ants decide which task to perform based on individual preferences and environmental factors. Specifically, the model postulates that there is an environmental stimulus associated with each task, and each individual ant has an internal threshold for each task, whereby if the stimulus exceeds the threshold, then the ant performs that task. The response threshold model was introduced in the 70s and has been studied extensively since (for comprehensive background on this model see the survey~\cite{beshers2001models} and the introduction of~\cite {duarte2012evolution}). Our setting captures the essence of the response threshold model since agents are permitted to behave based on individual preferences (property 2: agents are heterogeneous) and environmental factors (property 1: agents have complete information about the demand vector). We study whether models like the response threshold model can achieve low switching costs. Inspired by collective insect behavior, researchers have also studied the response threshold model in the context of swarm robotics~\cite{castello2013task, kim2014response, yang2009swarm}. Our setting also relates more generally to swarm robotics: \paragraph{Swarm robotics} There is a body of work in swarm robotics specifically concerned with property 3 of our setting: eliminating the need for communication (e.g. \cite{wang2015multi, chen2015cooperation, kernbach2013adaptive, penders2011robot}). In practice, communication among agents may be unfeasible or costly. In particular, it may be unfeasible to build a fast and reliable network infrastructure capable of dealing with delays and failures, especially in a remote location. Regarding property 4 of our setting (the agents are memoryless), it may be desirable for robots in a swarm to not rely on memory. For example, if a robot fails and its memory is lost, we may wish to be able to introduce a new robot into the system to replace it. Concretely, dynamic task allocation in swarm robotics may be applicable to disaster containment~\cite{penders2011robot, zahugi2013oil}, agricultural foraging, mining, drone package delivery, and environmental monitoring~\cite{csahin2004swarm}. \subsection{Past Work}\label{sec:past} Our problem was previously studied only by Su, Su, Dornhaus, and Lynch~\cite{su2017ant}, who presented two upper bounds and a lower bound. The first upper bound is a very simple set of functions $f_1^{n,k},\dots, f_n^{n,k}$ with maximum switching cost $k-1$. Each agent has a unique ID in $[n]$ and the tasks are numbered from 1 to $k$. The functions $f_1^{n,k},\dots, f_n^{n,k}$ are defined so that for all demand vectors, the agents populate the tasks in order from 1 to $k$ in order of increasing agent ID. That is, for each agent $a$, $f_a^{n,k}$ is defined as the task $j$ such that $\sum_{i=0}^{j-1} d_i<\text{ID}(a)$ and $\sum_{i=0}^{j} d_i\geq \text{ID}(a)$. Starting with any demand vector, if one unit of demand is moved from task $i$ to task $j$, the switching cost is at most $|i-j|$ because at most one agent from each task numbered between $i$ and $j$ (including $i$ but not including $j$) shifts to a new task. Thus, the maximum switching cost is $k-1$. The lower bound of Su et al.~is also very simple. It shows that there does not exist a set of functions $f_1^{n,k},\dots, f_{n}^{n,k}$ with maximum switching cost 1 for $n\geq 2$ and $k\geq 3$. Suppose for contradiction that there exists a set of functions $f_1^{n,k},\dots, f_{n}^{n,k}$ with maximum switching cost 1 for $n=2$ and $k=3$ (the argument can be easily generalized to higher $n$ and $k$). Suppose the current demand vector is $[1,1,0]$, that is, one agent is required for each of tasks 1 and 2 while no agent is required for task 3. Suppose agents $a$ and $b$ are assigned to tasks 1 and 2, respectively, which we denote $[a,b,\emptyset]$. Now suppose the demand vector changes from $[1,1,0]$ to the adjacent demand vector $[1,0,1]$. Since the maximum switching cost is 1, only one agent moves, so agent $b$ moves to task 3, so we have $[a,\emptyset, b]$. Now suppose the demand vector changes from $[1,0,1]$ to the adjacent demand vector $[0,1,1]$. Again, since the maximum switching cost is 1, agent $a$ moves from task 1 to task 2 resulting in $[\emptyset,a,b]$. Now suppose the demand vector changes from $[0,1,1]$ to the adjacent demand vector $[1,1,0]$, which was the initial demand vector. Since the maximum switching cost is 1, agent $b$ moves from task 3 to task 1 resulting in $[b,a,\emptyset]$. The problem statement requires that the allocation of agents depends \emph{only} on the current demand vector, so the allocation of agents for any given demand vector must be the same regardless of the history of changes to the demand vector. However, we have shown that the allocation of agents for $[1,1,0]$ was initially $[a,b,\emptyset]$ and is now $[b,a,\emptyset]$, a contradiction. Thus, the maximum switching cost is at least 2. The second upper bound of Su et al.~states that there exists a set of functions $f_1^{n,k},\dots, f_{n}^{n,k}$ with maximum switching cost 2 if $n\leq 6$ and $k=4$. They prove this result by exhaustively listing all 84 demand vectors along with the allocation of agents for each vector. \subsection{Our results} We initiate the study of non-trivial lower bounds for the switching cost. In particular, with the current results it is completely plausible that the maximum switching cost can always be upper bounded by 2, regardless of the number of tasks and agents. Our results show that this is not true and provide further evidence that the maximum switching cost grows with the number of tasks. One might expect that the limitations on $n$ and $k$ in the second upper bound of Su et al.~is due to the fact the space of demand vectors grows exponentially with $n$ and $k$ so their method of proof by exhaustive listing becomes unfeasible. However, our first result is that the second upper bound of Su et al.~is actually \emph{tight} with respect to $k$. In particular, we show that achieving maximum switching cost 2 is impossible even for $k=5$ (for \emph{any} $n>2$). \begin{theorem}\label{thm:3} For $n\geq 3$, $k\geq 5$, every set of functions $f_1^{n,k},\dots, f_n^{n,k}$ has maximum switching cost at least 3. \end{theorem} We then consider the next natural question: \emph{For what values of $n$ and $k$ is it possible to achieve maximum switching cost 3?} Our second result is that maximum switching cost 3 is not always possible: \begin{theorem}\label{thm:4} There exist $n$ and $k$ such that every set of functions $f_1^{n,k},\dots, f_n^{n,k}$ has maximum switching cost at least 4. \end{theorem} The value of $k$ for Theorem~\ref{thm:4} is an extremely large constant derived from hypergraph Ramsey numbers. Specifically, there exists a constant $c$ so that Theorem~\ref{thm:4} holds for $n\geq 5$ and $k\geq t_{n-1}(cn)$ where the tower function $t_j(x)$ is defined by $t_1(x) = x$ and $t_{i+1}(x) = 2^{t_i(x)}$. We remark that while our focus on small constant values of the switching cost may appear restrictive, functions with maximum switching cost 3 already have a highly non-trivial combinatorial structure. \subsection{Our techniques}\label{sec:tech} We introduce two novel techniques, each tailored to a different parameter regime. One parameter regime is when $n\ll k$ and the demand for each task is either 0 or 1. This regime seems to be the most natural for the goal of proving the highest possible lower bounds on the switching cost. \subsubsection{The $n\ll k$ regime} We develop a proof framework for the $n\ll k$ regime and use it to prove Theorem~\ref{thm:3} for $n=3$, $k=5$, and more importantly, to prove Theorem~\ref{thm:4}. We begin by supposing for contradiction that there exists a set of functions $f_1^{n,k},\dots, f_{n}^{n,k}$ with switching cost 2 and 3, respectively, and then reason about the structure of these functions. The main challenge in proving Theorem~\ref{thm:4} as compared to Theorem~\ref{thm:3} is that functions with switching cost 3 can have a much more involved combinatorial structure than functions with switching cost 2. In principle, our proof framework could also apply to higher switching costs, but at present it is unclear how exactly to implement it for this setting. The first step in our proofs is to reformulate the problem as that of finding a low distortion embedding from symmetric difference to Hamming distance, which we describe in Section~\ref{sec:reform}. This provides a cleaner way to reason about the problem in the $n\ll k$ parameter regime. Our proofs are written in the language of the problem reformulation, but here we will briefly describe our proof framework in the language of the original problem statement. The simple upper bound of $k-1$ described in Section~\ref{sec:past} can be viewed as each agent having a ``preference" for certain tasks. The main idea of our lower bound is to show that for \emph{any} set of functions $f_1^{n,k},\dots, f_{n}^{n,k}$ with low switching cost, many agents must have a ``preference" for certain tasks. More formally, we introduce the idea of a task being \emph{frozen} to an agent. A task $t$ is frozen to agent $a$ if for every demand vector in a particular large set of demand vectors, agent $a$ is assigned to task $t$. Our framework has three steps: \begin{itemize} \item In step 1, we show roughly that in total, many tasks are frozen to some agent. \item In step 2, we show roughly that for many agents $a$, only few tasks are frozen to $a$. \item In step 3, we use a counting argument to derive a contradiction: we count a particular subset of frozen task/agent pairs in two different ways using steps 1 and 2, respectively. \end{itemize} The proof of Theorem~\ref{thm:3} for $n=3$ and $k=5$ serves as a simple illustrative example of our proof framework, while the proof of Theorem~\ref{thm:4} is more involved. In particular, in step 1 of the proof of Theorem~\ref{thm:4}, we derive \emph{multiple} possible structures of frozen task/agent pairs. Then, we use Ramsey theory to show that there exists a collection of tasks that all obey only \emph{one} of the possible structures. This allows us to reason about each of the possible structures independently in steps 2 and 3. \subsubsection{The remaining parameter regime}\label{sec:remain} In the remaining parameter regime, we complete the proof of Theorem~\ref{thm:3}. In the previous parameter regime, we only addressed the $n=3$, $k=5$ case, and now we need to consider all larger values of $n$ and $k$. Extending to larger $k$ is trivial (we prove this formally in Section~\ref{sec:3}). However, it is not at all clear how to extend a lower bound to larger values of $n$. In particular, our proof framework from the $n\ll k$ regime immediately breaks down as $n$ grows. The main challenge of handling large $n$ is that having an abundance of agents can actually allow \emph{more} pairs of adjacent demand vectors to have switching cost 2, so it becomes more difficult to find a pair with switching cost greater than 2. To see this, consider the following example. Consider the subset $S_i$ of demand vectors in which a particular task $i$ has an unconstrained amount of demand and each remaining task has demand at most $n/(k-1)$. We claim that there exists a set of functions $f_1^{n,k},\dots, f_{n}^{n,k}$ so that every pair of adjacent demand vectors from $S_i$ has switching cost 2. Divide the agents into $k-1$ groups of $n/(k-1)$ agents each, and associate each task except $i$ to such a group of agents. We define the functions $f_1^{n,k},\dots, f_{n}^{n,k}$ so that given any demand vector in $S_i$, the set of agents assigned to each task except $i$ is simply a subset of the group of agents associated with that task (say, the subset of such agents with smallest ID). This is a valid assignment since the demand of each task except $i$ is at most the size of the group of agents associated with that task. The remaining agents are assigned to task $i$. Then, given a pair $(\vec{v},\vec{v'})$ of adjacent demand vectors in $S_i$, whose demands differ only for tasks $s$ and $t$, their switching cost is 2 because the only agents assigned to different tasks between $\vec{v}$ and $\vec{v'}$ are: one agent from each of the groups associated with tasks $s$ and $t$, respectively. Because it is possible for many pairs of adjacent demand vectors to have switching cost 2, finding a pair of adjacent demand vectors with larger switching cost requires reasoning about a very precise set of demand vectors. To do this, we use roughly the following strategy. We identifying a task that serves the role of $i$ in the above example and then successively move demand out of task $i$ until task $i$ is empty and can thus no longer fill this role. At this point, we argue that we have reached a pair of adjacent demand vectors with switching cost more than 2. \section{Problem reformulation}\label{sec:reform} \subsection{Notation} Let $A$ and $B$ be multisets. The intersection of $A$ and $B$ denoted $A\cap B$ is the maximal multiset of elements that appear in both $A$ and $B$. For example, $\{a,a,b,b\}\cap\{a,b,b,c\}=\{a,b,b\}$. The symmetric difference between $A$ and $B$, denoted $A\oplus B$, is the multiset of elements in either $A$ or $B$ but not in their intersection. For example, $\{a,a,b,b\}\oplus\{a,b,b,c\}=\{a,c\}$ since we are left with $a$ after removing $\{a,b,b\}$ from $\{a,a,b,b\}$ and we are left with $c$ after removing $\{a,b,b\}$ from ${a,b,b,c}$. A permutation of a multiset $A$ is simply a permutation of the elements of the multiset. For example, one permutation of $\{a,a,b\}$ is $aba$. We treat permutation as strings and perform string operations on them. For strings $X$ and $Y$ (which may be permutations), let $d(X,Y)$ denote the \emph{Hamming distance} between $X$ and $Y$. For example, $d(aba,bca)=2$. \subsection{Problem statement}\label{sec:combs} Given positive integers $n$, $k$, and $D$, the goal is to find a function $\pi_{n,k}$ with the following properties. \begin{itemize} \item Let $\mathcal{S}_{n,k}$ be the set of all size $n$ multisets of $[k]$. The function $\pi_{n,k}$ takes as input a set $S\in \mathcal{S}_{n,k}$ and outputs a permutation of $S$. \item We say that a pair $S,S'\in \mathcal{S}_{n,k}$ has \emph{distortion} $D'$ with respect to $\pi_{n,k}$ if $|S\oplus S'|=2$ and\\$d(\pi_{n,k}(S),\pi_{n,k}(S'))=D'$. In other words, a pair of multisets has distortion $D'$ if they have the \emph{smallest} possible symmetric distance but \emph{large} Hamming distance (at least $D'$). We say that $\pi_{n,k}$ has \emph{maximum distortion} $D'$ if the maximum distortion over all pairs $S,S'\in \mathcal{S}_{n,k}$ with $|S\oplus S'|=2$ is $D'$. We require that the function $\pi_{n,k}$ has maximum distortion at most $D$. \end{itemize} We are interested in the question of for which values of the parameters $n$, $k$, and $D$, there exists $\pi_{n,k}$ that satisfies the above properties. In particular, we aim to minimize the maximum distortion: \begin{mdframed} \begin{question*}Given $n$ and $k$, what is the minimum possible maximum distortion over all functions $\pi_{n,k}$? \end{question*} \end{mdframed} In other words, the question is whether there exists a function $\pi_{n,k}$ such that \emph{every} pair $S,S'\in \mathcal{S}_{n,k}$ has distortion at least $D$. Our theorems are lower bounds, so we show that for every function $\pi_{n,k}$ there \emph{exists} a pair $S,S'\in \mathcal{S}_{n,k}$ with distortion at least $D$. \subsection{Equivalence to original problem statement} We claim that the new problem statement from Section~\ref{sec:combs} is equivalent to the original problem statement from Section~\ref{sec:state}. \begin{claim} Given parameters $n$ and $k$ (the same for both problem statements) there exists a function $\pi_{n,k}$ with maximum distortion $D$ if and only if there exists a set of functions $f_1^{n,k},\dots,f_n^{n,k}$ with maximum switching cost $D$. \end{claim} We describe the correspondence between the two problem statements: \begin{itemize \item {\bf Demand vector.} $\mathcal{S}_{n,k}$ is the set of all possible demand vectors since a demand vector is simply a size $n$ multiset of the $k$ tasks. For example, the multiset $S=\{1,1,3\}$ is equivalent to the demand vector $\vec{v}=[2,0,1]$; both notations indicate that task 1 requires two units of demand, task 2 requires no demand, and task 3 requires one unit of demand. \item {\bf Allocation of agents to tasks.} If $\vec{v}$ is the demand vector representing the multiset $S\in \mathcal{S}_{n,k}$, a permutation $\pi_{n,k}(S)$ is an allocation $f_1^{n,k}(\vec{v}),\dots, f_n^{n,k}(\vec{v})$ of agents to tasks so that $\pi_{n,k}(S)[i]=f_i^{n,k}(\vec{v})$; that is, agent $i$ performs the task that is the $i^{th}$ element in the permutation $\pi_{n,k}(S)$. For example, $\pi_{3,3}(\{1,1,3\})=131$ is equivalent to the following: $f_1^{3,3}([2,0,1])=1$, $f_2^{3,3}([2,0,1])=3$, and $f_3^{3,3}([2,0,1])=1$; both notations indicate that agents 1 and 3 both performs task 1, while agent 2 performs task 2. \item {\bf Switching cost.} If $\vec{v},\vec{v'}$ are the demand vectors representing the multisets $S,S'\in\mathcal{S}_{n,k}$ respectively, the value $d(\pi_{n,k}(S),\pi_{n,k}(S'))$ is the switching cost because from the previous bullet point, $\pi_{n,k}(S)[i]\not=\pi_{n,k}(S')[i]$ if and only if $f_a^{n,k}(\vec{v})\not=f_a^{n,k}(\vec{v'})$. \item {\bf Adjacent demand vectors.} The set of all pairs $S,S'\in \mathcal{S}_{n,k}$ such that $|S\oplus S'|=2$ is the set of all pairs of adjacent demand vectors. This is because $|S\oplus S'|=2$ means that starting from $S$, one can reach $S'$ by changing exactly one element in $S$ from some $i\in [k]$ to some $j\in [k]$. Equivalently, starting from the demand vector represented by $S$ and moving one unit of demand from task $i$ to task $j$ results in the demand vector represented by $S'$. \item {\bf Maximum switching cost.} If $f_1^{n,k},\dots, f_n^{n,k}$ is the set of functions representing $\pi_{n,k}$, then $\pi_{n,k}$ has maximum distortion $D$ if and only if $f_1^{n,k},\dots, f_n^{n,k}$ has maximum switching cost $D$. This is because $S,S'\in \mathcal{S}_{n,k}$ has distortion $D$ if and only if $|S\oplus S'|=2$ and $d(\pi_{n,k}(S),\pi_{n,k}(S'))=D$ which is equivalent to saying that the demand vectors $\vec{v}$ and $\vec{v'}$ that represent $S$ and $S'$ are adjacent and have switching cost $D$. \end{itemize} \subsection{Restatement of results} We restate Theorems~\ref{thm:3} and \ref{thm:4} in the language of the problem restatement. \begin{theorem}[Restatement of Theorem~\ref{thm:3}]\label{thm:3r} Let $n\geq 3$ and $k\geq 5$. Every function $\pi_{n,k}$ has maximum distortion at least 3. \end{theorem} \begin{theorem}[Restatement of Theorem~\ref{thm:4}]\label{thm:4r} There exist $n$ and $k$ so that every function $\pi_{n,k}$ has maximum distortion at least 4. \end{theorem} \subsection{Example instance} To build intuition about the problem restatement, we provide a concrete example of a small instance of the problem. Suppose $n=3$ and $k=2$. For notational clarity, instead of denoting $[k]=\{0,1\}$ we denote $[k]=\{a,b\}$. Then $\mathcal{S}_{3,2}$ is the set of all size 3 multisets of $\{a,b\}$; that is, $\mathcal{S}_{3,2}=\{\{a,a,a\},\{a,a,b\},\{a,b,b\},\{b,b,b\}\}$. $\pi_{3,2}$ is a function that maps each element of $\mathcal{S}_{3,2}$ to a permutation of itself. For example, $\pi_{3,2}$ could be defined as follows: \[ \begin{matrix*}[l]% \pi_{3,2}(\{a,a,a\})=aaa,& \pi_{3,2}(\{a,a,b\})=aba& \pi_{3,2}(\{a,b,b\})=bab,& \pi_{3,2}(\{b,b,b\})=bbb.\end{matrix*}\] We are concerned with all pairs $S,S'\in \mathcal{S}_{3,2}$ such that $|S\oplus S'|=2$ (since the maximum distortion of $\pi_{3,2}$ is defined in terms of only these pairs). In this example, the only such pairs are as follows: \[\begin{matrix*}\{a,a,a\}\oplus\{a,a,b\}=2,& \{a,a,b\}\oplus\{a,b,b\}=2,& \{a,b,b\}\oplus\{b,b,b\}=2.\end{matrix*}\] For each such pair, we consider $d(\pi_{3,2}(S),\pi_{3,2}(S'))$: \[\begin{matrix*}d(aaa,aba)=1,&d(aba,bab)=3,&d(bab,bbb)=1.\end{matrix*}\] This particular choice of $\pi_{3,2}$ has maximum distortion 3 (since the largest value in the above row is 3), however we could have chosen $\pi_{3,2}$ with maximum distortion 1 (for example if $\pi_{3,2}(\{a,b,b\})=bba$ instead of $bab$). \section{The $n\ll k$ regime}\label{sec:n<k} In this section we will prove Theorem~\ref{thm:3r} for $n=3$, $k=5$, and Theorem~\ref{thm:4r}. The proofs are written in the language of the problem reformulation from Section~\ref{sec:reform}. For these proofs it will suffice to consider only the elements of $\mathcal{S}_{n,k}$ that are \emph{subsets} of $[k]$, rather than multisets. This corresponds to the set of demand vectors where each task has demand either 0 or 1. \emph{For the rest of this section we consider only subsets of $[k]$, rather than multisets.} We call each element of $[k]$ a \emph{character} (e.g. in the above example instance, $a$ and $b$ are characters). \subsection{Proof framework}\label{sec:frame} As described in Section~\ref{sec:tech}, we develop a three-step proof framework for the $n\ll k$ regime. Suppose we are trying to prove that every function $\pi_{n,k}$ has maximum distortion at least $D$ for a particular $n$ and $k$. We begin by supposing for contradiction that there exists $\pi_{n,k}$ with maximum distortion less than $D$. That is, we suppose that every pair $S,S'\in \mathcal{S}_{n,k}$ with $|S\oplus S'|=2$ has $d(\pi_{n,k}(S),\pi_{n,k}(S'))<D$. Under the assumption that such a $\pi_{n,k}$ exists, steps 1 and 2 of the framework show that $\pi_{n,k}$ must obey a particular structure. For the remainder of this section, we drop the subscript of $\pi$ since $n$ and $k$ are fixed. \begin{notation*} For any set $R\subseteq [k]$, let $\mathcal{U}_R$ be the set of all sets $S\subseteq [k]$ such that $R\subset S$ and $|S|=|R|+1$. \end{notation*} \paragraph{Step 1: Structure of size $n-1$ sets.} We begin by fixing a size $n-1$ set $R\subseteq [k]$. Now, consider $\mathcal{U}_R$ (defined above). We note that all pairs $S,S'\in \mathcal{U}_R$ are by definition such that $|S\oplus S'|=2$. Because we initially supposed that $\pi$ has maximum distortion less than $D$, we know that for all pairs $S,S'\in\mathcal{U}_R$, we have $d(\pi(S),\pi(S'))<D$. Then we prove a structural lemma which roughly says that many characters $r\in R$ have a ``preference" to be in a particular position in the permutations $\pi(S)$ for $S\in \mathcal{U}_R$. We say that $R$ \emph{$i$-freezes} the character $r$ if $\pi(S)[i]=r$ for many $S\in \mathcal{U}_R$. Our structural lemma roughly says that for many characters $r\in R$, there exists an index $i\in [n]$ such that $R$ $i$-freezes $r$. In other words, for many $S\in \mathcal{U}_R$, the $\pi(S)$s agree on the position of many characters in the permutation. \paragraph{Step 2: Structure of size $n-2$ sets.} We begin by fixing a size $n-2$ set $Q\subseteq [k]$. Now, consider $\mathcal{U}_Q$. We note that each $R\in\mathcal{U}_Q$ obeys the structural lemma from step 1; that is, for many characters $r\in R$, there exists an index $i\in [n]$ such that $R$ $i$-freezes $r$. We prove a structural lemma which roughly says that the sets $P\in \mathcal{U}_Q$ are for the most part \emph{consistent} about which characters they freeze to which index of the permutation. More specifically, for many characters $q\in Q$, for all pairs $P,P'\in \mathcal{U}_Q$, if $R$ $i$-freezes $r$ and $R'$ $j$-freezes $r$, then $i=j$. \paragraph{Step 3: Counting argument.} In step 3, we use a counting argument to derive a contradiction. For the proof of Theorem~\ref{thm:3r}, a simple argument suffices. The idea is that step 1 shows that many characters are frozen overall while step 2 shows that each character can only be frozen to a single index. Then, the pigeonhole principle implies that more than one character is frozen to a single index, which helps to derive a contradiction. For the proof of Theorem~\ref{thm:4r}, it no longer suffices to just show that more than one character is frozen to a single index. Instead, we require a more sophisticated counting argument and a careful choice of what quantity to count. We end up counting the number of pairs $(Q,a)$ such that $R\in \mathcal{U}_Q$, where $Q\subset [k]$ is a size $n-2$ set and $a\in [n]\setminus Q$. To reach a contradiction, we count this quantity in two different ways, using steps 1 and 2 respectively. Having reached a contradiction, we conclude that $\pi$ has maximum distortion at least $D$. \subsection{Proof of Theorem~\ref{thm:3r} for $n=3$, $k=5$} In this section, we prove Theorem~\ref{thm:3r} for $n=3$, $k=5$, which serves as a simple illustrative example of our proof framework from Section~\ref{sec:frame}. \begin{theorem}[Special case of Theorem~\ref{thm:3r}]\label{thm:warm} Every function $\pi_{3,5}$ has maximum distortion at least 3. \end{theorem} \begin{proof} Suppose by way of contradiction that there is a function $\pi_{3,5}$ with maximum distortion at most 2. For the remainder of this section we omit the subscript of $\pi$ since $n=3$, $k=5$ are fixed. For clarity of notation, we let $\{a,b,c,d,e\}$ be the characters in $[k]$ for $k=5$. Thus, we are considering the set of all ${5\choose 3}=10$ size 3 subsets of $\{a,b,c,d,e\}$. (Recall that we are only concerned with subsets, not multisets.) \subsubsection*{Step 1: Structure of size $n-1$ sets} We begin by fixing a set $\{x,y\}\subseteq \{a,b,c,d,e\}$ of size $n-1=2$. Recall that $\mathcal{U}_{\{x,y\}}$ is the set of all size 3 sets $S$ such that $\{x,y\}\subseteq S\subseteq \{a,b,c,d,e\}$. For example, $\mathcal{U}_{\{a,b\}}=\{\{a,b,c\},\{a,b,d\},\{a,b,e\}\} $. We note that by definition all pairs $S,S'\in \mathcal{U}_{\{x,y\}}$ have $|S\oplus S'|=2$. Thus, to find a pair with distortion 3 and thereby obtain a contradiction, it suffices to find a pair $S,S'\in \mathcal{U}_{\{x,y\}}$ with Hamming distance $d(\pi(S),\pi(S'))=3$. Since $n=3$, this means we are looking for permutations $\pi(S),\pi(S')$ that disagree about the position of \emph{all} elements. The following lemma says that $\pi$ places one of $x$ or $y$ at the \emph{same} position for \emph{all} $\pi(S)$ with $S\in \mathcal{U}_{\{x,y\}}$. For ease of notation, we give this phenomenon a name: \begin{definition}[freeze]\label{defn:freeze} We say that a pair $\{x,y\}\subseteq \{a,b,c,d,e\}$ \emph{$i$-freezes} a character $p\in \{x,y\}$ if for all $S\in\mathcal{U}_{\{x,y\}}$, we have $\pi(S)[i]=p$. We simply say that $\{x,y\}$ \emph{freezes} $p$ if $i$ is unspecified. Equivalently, we say that a character $p$ is \emph{$i$-frozen} (or just \emph{frozen}) by a pair. \end{definition} \begin{lemma}\label{lem:fix} For every $\{x,y\}\subseteq \{a,b,c,d,e\}$, there exists $i$ so that $\{x,y\}$ $i$-freezes either $x$ or $y$. \end{lemma} For example, one way that the pair $\{a,b\}$ could satisfy Lemma~\ref{lem:fix} is if the permutations $\pi(\{a,b,c\})$, $\pi(\{a,b,d\})$, and $\pi(\{a,b,e\})$ \emph{all} place the character $a$ in the $0^{th}$ position. In this case, we would say that the pair $\{a,b\}$ 0-freezes $a$. \begin{proof}[Proof of Lemma~\ref{lem:fix}] Without loss of generality, consider $\{x,y\}=\{a,b\}$. In this case, $\mathcal{U}_{\{x,y\}}=\mathcal{U}_{\{a,b\}}=\{\{a,b,c\},\{a,b,d\},\{a,b,e\}\} $. Thus, we are trying to show that $\{a,b,c\}$, $\{a,b,d\}$, and $\{a,b,e\}$ \emph{all} agree on the position of either $a$ or $b$. Suppose without loss of generality that $\pi(\{a,b,c\})=abc$. We first note that $\pi(\{a,b,c\})$ and $\pi(\{a,b,d\})$ must agree on the position of either $a$ or $b$ because otherwise we would have $d(\pi(\{a,b,c\}), \pi(\{a,b,d\}))=3$ which would mean that $\pi(\{a,b,c\})$ and $\pi(\{a,b,d\})$ would have distortion 3, and we would have proved Theorem~\ref{thm:warm}. Without loss of generality, suppose $\pi(\{a,b,c\})$ and $\pi(\{a,b,d\})$ agree on the position of $a$; that is, $\pi(\{a,b,d\})$ is either $abd$ or $adb$. By the same reasoning, $\pi(\{a,b,c\})$ and $\pi(\{a,b,e\})$ agree on the position of either $a$ or $b$, and $\pi(\{a,b,d\})$ and $\pi(\{a,b,e\})$ agree on the position of either $a$ or $b$. If $\pi(\{a,b,e\})$ agrees with \emph{either} $\pi(\{a,b,c\})$ or $\pi(\{a,b,d\})$ on the position of $a$, then it agrees with \emph{both} (in which case we are done) since $\pi(\{a,b,c\})$ and $\pi(\{a,b,d\})$ agree on the position of $a$, by the previous paragraph. Thus, the only option is that $\pi(\{a,b,e\})$ agrees with \emph{both} $\pi(\{a,b,c\})$ and $\pi(\{a,b,d\})$ on the position of $b$. This completes the proof. \end{proof} \subsubsection*{Step 2: Structure of size $n-2$ sets} Since $n-2=1$, we begin by fixing a single element $x\in\{a,b,c,d,e\}$. In the following lemma we prove that $x$ cannot be frozen to two different indices. \begin{lemma}\label{lem:same} If a pair $\{x,y\}\subseteq\{a,b,c,d,e\}$ $i$-freezes $x$ and a pair $\{x,z\}\subseteq\{a,b,c,d,e\}$ $j$-freezes $x$ then $i=j$. \end{lemma} \begin{proof} Since $\{x,y\}$ $i$-freezes $x$, then in particular, $\pi(\{x,y,z\})[i]=x$. Since $\{x,z\}$ $j$-freezes $x$, then in particular, $\pi(\{x,y,z\})[j]=x$. A single character cannot be in multiple positions of the permutation $\pi(\{x,y,z\})$ so $i=j$. \end{proof} \subsubsection*{Step 3: Counting argument} Lemma~\ref{lem:fix} implies that for each character $x\in \{a,b,c,d,e\}$ except for at most one, \emph{some} pair $\{x,y\}$ freezes $x$. That is, at least 4 characters are frozen by some pair. However $n=3$ so by the pigeonhole principle, two characters $x,y\in \{a,b,c,d,e\}$ are frozen to the same index $i$. Fix $x$, $y$, and $i$, and suppose $x$ and $y$ are each $i$-frozen. By Lemma~\ref{lem:fix}, the pair $\{x,y\}$ freezes either $x$ or $y$. Without loss of generality, say $\{x,y\}$ freezes $x$. By Lemma~\ref{lem:same}, since $x$ is $i$-frozen by some pair, \emph{all} pairs that freeze $x$ must $i$-freeze $x$. Thus, the pair $\{x,y\}$ $i$-freezes $x$. Let $\{y,z\}\subseteq \{a,b,c,d,e\}$ be a pair that $i$-freezes $y$. Thus we have $\pi(\{x,y,z\})[i]=y$. However, since $\{x,y\}$ $i$-freezes $x$, we also have $\pi(\{x,y,z\})[i]=x$. This is a contradiction since $\pi(\{x,y,z\})[i]$ cannot take on two different values. \end{proof} \subsection{Proof of Theorem~\ref{thm:4r}}\label{app:n<k} \begin{theorem}[Restatement of Theorem~\ref{thm:4r}] There exist $n$ and $k$ so that every function $\pi_{n,k}$ has maximum distortion at least 4. \end{theorem} More specifically, we will show that there exists a constant $c$ so that Theorem~\ref{thm:4} holds for $n\geq 5$ and $k\geq t_{n-1}(cn)$ where the tower function $t_j(x)$ is defined by $t_1(x) = x$ and $t_{i+1}(x) = 2^{t_i(x)}$. \begin{proof} Suppose by way of contradiction that there is a function $\pi_{n,k}$ with maximum distortion at most 3, for $n$ and $k$ to be set later. For the remainder of this section we omit the subscript of $\pi$ since $n$ and $k$ are fixed. As a convention, we will generally use the variables $P$, $Q$, $R$, and $S$ to refer to subsets of $[k]$ of size $n-3$, $n-2$, $n-1$, and $n$, respectively. \subsubsection{Step 1: Structure of size $n-1$ sets.} Let $R\subset [k]$ be a size $n-1$ set. Recall from Section~\ref{sec:frame} that $\mathcal{U}_R$ is the set of all size $n$ sets $S$ such that $R\subset S \subset [k]$. We note that all pairs $S,S'\in \mathcal{U}_R$ are by definition such that $|S\oplus S'|=2$. Because we initially supposed that $\pi$ has maximum distortion at most 3, we know that all pairs $S,S'\in\mathcal{U}_R$ have Hamming distance $d(\pi(S),\pi(S'))\leq 3$. We begin by generalizing the notion of \emph{freezing} a character from Definition~\ref{defn:freeze}. Instead of freezing a single character, our new definition will concern freezing a \emph{set} of characters. Freezing a set of characters essentially means that every character in the set is frozen to a different index. \begin{definition}[freeze] Let $R\subseteq [k]$ be a size $n-1$ set and let $A_R\subseteq R$. We say that $R$ \emph{freezes} $A_R$ with \emph{freezing function} $g_R$ if $g_R$ is a one-to-one mapping from $A_R$ to $[n]$ such that for all $a\in A_R$ and all $S\in\mathcal{U}_R$, we have $\pi(S)[g_R(a)]=a$. \end{definition} Unlike in the proof of Theorem~\ref{thm:warm}, it is not true that for any size $n-1$ set $R\subset [k]$, some subset of $R$ must be frozen. Instead, to capture the full structure of permutations with Hamming distance 3, we will need another notion of freezing, which we call \emph{semi-freezing}. In this definition, each character is restricted to \emph{two} indices instead of just one. \begin{definition}[semi-freeze] Let $R\subset [k] $ be a size $n-1$ set. We say that $R$ is \emph{semi-frozen} with \emph{semi-freezing function} $h_R$ and \emph{wildcard index} $w_R$ if $h_R$ is a one-to-one mapping from $R$ to $[n]$ such that for all $r\in R$, we have that for all $S\in\mathcal{U}_R$ either $\pi(S)[h_R(r)]=r$ or $\pi(S)[w_R]=r$. \end{definition} We note that since $g_R$ is a one-to-one mapping and $R$ is of size $n-1$, the \emph{only} index in $[n]$ not mapped to by $g_R$ is the wildcard index $w_R$. We call $w_R$ the wildcard index because $\pi(S)$ could place \emph{any} character from $R$ at index $w_R$. In contrast, for every other index $i$, $\pi(S)$ can only place a single character from $R$ at index $i$, namely the character mapped to $i$ by the function $g_R$. Our structural lemma for step 1 says that either $R$ freezes a large subset $A\subset R$, or $R$ is semi-frozen. \begin{lemma}\label{lem:fix2} Every set $R\subset [k]$ of size $n-1$, obeys one of the following two configurations: \begin{enumerate} \item there exists a set $A_R\subset R$ of size $n-3$ such that $R$ freezes $A_R$, or \item $R$ is semi-frozen. \end{enumerate} \end{lemma} Figure~\ref{fig:fix2} shows the structure of permutations that obey each of the two configurations in Lemma~\ref{lem:fix2}. In configuration 1, each character in a \emph{large subset} of $R$ is always mapped to a \emph{single} index. In configuration 2, each character in $R$ is always mapped to one of \emph{two} possible choices. In other words, both configurations enforce a rigid structure but each of them are flexible in a different way. Configuration 1 is flexible in that it does not impose structure on characters not in $A_R$, and rigid in that the characters in $A_R$ are \emph{always} mapped to the same position. On the other hand, configuration 2 is flexible in that it allows each character to map to a choice of two positions, but rigid in that the structure is imposed on \emph{every} character in $R$. \begin{figure}[h] \begin{subfigure}[b]{.57\linewidth \includegraphics[width=60mm]{struct1bb.pdf} \end{subfigure} \begin{subfigure}[b]{.15\linewidth \includegraphics[width=60mm]{struct2b.pdf} \end{subfigure} \caption{\small Examples of the configurations from Lemma~\ref{lem:fix2}. Each of the two subfigures shows the the set of permutations $\pi(S)$ for each $S\in\mathcal{U}_R$ where $R=\{a,b,c,d\}$, $n=5$, and $k=10$. The left subfigure shows configuration 1 of Lemma~\ref{lem:fix2}: the frozen set is $A=\{a,b\}$ since $a$ and $b$ each only appear at a fixed index, as marked by the gray box. The right subfigure shows configuration 2 of Lemma~\ref{lem:fix2}: $R$ is semi-frozen with wildcard index indicated by the gray box since each element of $R$ only appears at the wildcard index and one other index.} \label{fig:fix2} \end{figure} To prove Lemma~\ref{lem:fix2}, we would like to initially fix a pair $S,S'\in\mathcal{U}_R$ with $d(\pi(S),\pi(S'))= 3$. The following lemma proves that we can assume that such a pair exists, because if not, then configuration 1 of Lemma~\ref{lem:fix2} already holds. The proof of the following lemma is nearly identical to the proof of Lemma~\ref{lem:fix}. \begin{lemma}\label{lem:exists3} If all pairs $S,S'\in\mathcal{U}_R$ have $d(\pi(S),\pi(S'))\leq 2$, then for every size $n-1$ set $R\subset [k]$, there exists a subset $A_R$ of size $n-2$ such that $R$ freezes $A_R$. \end{lemma} \begin{proof} Any pair $S,S'\in\mathcal{U}_R$ must agree on the position of at least $n-2$ characters in $R$ because otherwise we would have $d(\pi(S), \pi(S'))>2$. Also, there must exist a pair $S,S'\in\mathcal{U}_R$ with $d(\pi(S), \pi(S'))=2$ because if all pairs had $d(\pi(S), \pi(S'))=1$ then all $S\in \mathcal{U}_R$ would agree on the position of all $n-1$ characters in $R$ and we would be done. Thus, let $S,S'\in\mathcal{U}_R$ be such that $d(\pi(S), \pi(S'))=2$. Let $R=\{a_1,a_2,\dots,a_{n-1}\}$ and without loss of generality suppose $\pi(S)$ and $\pi(S')$ agree on the position of the characters $a_1,a_2,\dots,a_{n-2}$ and disagree on the position of $a_{n-1}$. We wish to show that for all $S''\in\mathcal{U}_R$, $\pi(S'')$ also agrees with $\pi(S)$ and $\pi(S')$ on the position of the characters $a_1,a_2,\dots,a_{n-2}$. Suppose for contradiction that there exists $S''\in\mathcal{U}_R$ such that $\pi(S'')$ disagrees with $\pi(S)$ and $\pi(S')$ on the position of some character in $\{a_1,a_2,\dots,a_{n-2}\}$. Then since $\pi(S'')$ must agree with both $\pi(S)$ and $\pi(S')$ on the position of at least $n-2$ characters in $R$, $\pi(S'')$ must agree with \emph{both} $\pi(S)$ and $\pi(S')$ on the position of $a_{n-1}$. But, this is a contradiction because $\pi(S)$ and $\pi(S')$ disagree on the position of $a_{n-1}$. \end{proof} \begin{proof}[Proof of Lemma~\ref{lem:fix2}] Let $S,S'\in\mathcal{U}_R$ be such that $d(\pi(S),\pi(S'))=3$. Such $S,S'$ exist by Lemma~\ref{lem:exists3}. Fix $S,S'\in\mathcal{U}_R$. Let $R=\{a_1,a_2,\dots,a_{n-1}\}$ and without loss of generality suppose $\pi(S)$ and $\pi(S')$ agree on the position of the $n-3$ characters $a_3,a_4,\dots,a_{n-1}$. If every $S''\in\mathcal{U}_R$ is such that $\pi(S'')$ also agrees with $\pi(S)$ and $\pi(S')$ on the positions of the characters $a_3,a_4,\dots,a_{n-1}$, then we are done because in this case $R$ freezes the set $\{a_3,a_4,\dots,a_{n-1}\}$. So suppose otherwise; that is, let $S''\in\mathcal{U}_R$ be such that $\pi(S'')$ disagrees with $\pi(S)$ and $\pi(S')$ on the position of $a_3$ (without loss of generality). Since $S,S',S''\in \mathcal{U}_R$, each of $S$, $S'$, and $S''$ have one additional character besides those in $R$. Let $s$, $s'$, and $s''$ be these characters respectively. In the following we will analyze $\pi(S)$, $\pi(S')$ and $\pi(S'')$. Since $a_4,a_5,\dots a_{n-1}$ are all in the same position with respect to all three permutations, we will ignore these characters. That is, letting $Z=\{a_4,a_5,\dots a_{n-1}\}$, we consider $S\setminus Z=\{a_1,a_2,a_3,s\}$, $S'\setminus Z=\{a_1,a_2,a_3,s'\}$, and $S''\setminus Z=\{a_1,a_2,a_3,s''\}$. We will abuse notation and let $\pi(S\setminus Z)$ be the subpermutation of $\pi(S)$ containing only the elements of $S\setminus Z$, and similarly for $S'\setminus Z$ and $S''\setminus Z$. Suppose without loss of generality that $\pi(S\setminus Z)=a_1a_2sa_3$. Then since $\pi(S)$ and $\pi(S')$ agree on the position of $a_3$ but disagree on the positions of $a_1$ and $a_2$, we have that either \begin{enumerate} \item $\pi(S')$ places $s'$ in the position that $\pi(S)$ places $s$, so $\pi(S'\setminus Z)=a_2a_1s'a_3$, or \item $\pi(S')$ places $s'$ in the position that $\pi(S)$ places $a_1$ or $a_2$, so without loss of generality $\pi(S'\setminus Z)=s'a_1a_2a_3$. \end{enumerate} Recall that $\pi(S'')$ disagrees with $\pi(S)$ on the position of $a_3$. Since $d(\pi(S''),\pi(S))\leq 3$ and the positions of $a_3$ and $s''$ each account for one unit of difference between $\pi(S'')$ and $\pi(S)$, we know that $\pi(S'')$ agrees with $\pi(S)$ on the position of at least one of $a_1$ or $a_2$. Similarly, since $\pi(S'')$ disagrees with $\pi(S')$ on the position of $a_3$, we have that $\pi(S'')$ agrees with $\pi(S')$ on the position of at least one of $a_1$ or $a_2$. If $\pi(S'\setminus Z)=a_2a_1s'a_3$ (case 1 above), then $\pi(S'')$ cannot possibly agree with both $\pi(S)$ and $\pi(S')$ on the position of at least one of $a_1$ or $a_2$ because the positions of $a_1$ and $a_2$ are swapped in $\pi(S)$ as compared to $\pi(S')$. Thus, it must be the case that $\pi(S'\setminus Z)=s'a_1a_2a_3$ (case 2 above). Now, given that $\pi(S\setminus Z)=a_1a_2sa_3$ and $\pi(S'\setminus Z)=s'a_1a_2a_3$, there is only one possibility for $\pi(S''\setminus Z)$ that satisfies the criteria that $\pi(S'')$ disagrees with $\pi(S)$ and $\pi(S')$ on the position of $a_3$ and agrees with each of $\pi(S)$ and $\pi(S')$ on the position of at least one of $a_1$ or $a_2$. The only possibility is that $\pi(S''\setminus Z)=a_1a_3a_2s''$. The above argument applies for any $S''\in\mathcal{U}_R$ such that $\pi(S'')$ disagrees with $\pi(S)$ and $\pi(S')$ on the position of some $a_i$ with $3\leq i\leq n-1$. That is, letting $Z'=\{a_3,a_4,\dots a_{n-1}\}\setminus\{a_i\}$ and letting $s''=S''\setminus R$, we have that without loss of generality, $\pi(S\setminus Z')=a_1a_2sa_i$, $\pi(S'\setminus Z')=s'a_1a_2a_i$, and $\pi(S''\setminus Z)=a_1a_ia_2s''$. We claim that the structure we have derived implies that $R$ is semi-frozen. To see this, consider the following semi-freezing function $h_R$: \begin{align*}&h_R(a_1)=\pi(S)[a_1],\\ &h_R(a_2)=\pi(S')[a_2],\\ \text{for each element $a_i$ for $3\leq i\leq n-1$, } &h_R(a_i)=\pi(S)[a_i]=\pi(S')[a_i],\\ \text{and the wildcard index } &w_R=\pi(S)[a_2]=\pi(S')[a_1]. \end{align*} \end{proof} \subsubsection{Treating configurations 1 and 2 independently}\label{sec:ramsey} Before moving to step 2 of the proof framework, we will show using Ramsey theory that it suffices to consider each of the two configurations from Lemma~\ref{lem:fix2} \emph{independently}. Lemma~\ref{lem:fix2} shows that every size $n-1$ subset of $[k]$ obeys one of two configurations. Using Ramsey theory, we will show that there must exist a subset $K'\subseteq [k]$ such that either \emph{all} size $n-1$ subsets of $K'$ obey configuration 1 or \emph{all} size $n-1$ subsets of $K'$ obey configuration 2. This will allow us to avoid reasoning about the complicated interactions between the two configurations. The required size $k'=|K'|$ can be expressed as a \emph{hypergraph Ramsey number}. The hypergraph Ramsey number $r_j(t,t)$ is the minimum value $m$ such that every red-blue coloring of the $j$-tuples of an $m$-element set contains either a red set or a blue set of size $t$, where a set is called red (blue) if all $j$-tuples from this set are red (blue). Thus, it suffices to let $k'$ satisfy $r_{n-1}(k',k')=k$. Erd\H{o}s and Rado~\cite{erdos1952combinatorial} give the following bound on $r_j(t,t)$, as stated in~\cite{conlon2010hypergraph}. There exists a constant $c$ such that: \[r_{n-1}(k',k')\leq t_{n-1}(ck')\] where the tower function $t_j(x)$ is defined by $t_1(x) = x$ and $t_{i+1}(x) = 2^{t_i(x)}$. In the following we will show that it suffices to let $n\geq 5$ and $k'\geq n+7$, so it suffices to set $n\geq 5$ and $k\geq t_{n-1}(cn)$. \subsubsection{Step 2a: Structure of size $n-2$ sets for configuration 1} From the previous section, there exists a size $k'$ set $K'$ of tasks such that either all size $n-1$ subsets of $K'$ obey configuration 1 or all size $n-1$ subsets of $K'$ obey configuration 2. In this section we will assume that all size $n-1$ subsets of $K'$ obey configuration 1, and later we will independently consider configuration 2. Recall that configuration 1 says that for every set $R\subset[k']$ of size $n-1$, there exists a set $A_R\subset R$ of size $n-3$ such that $R$ freezes $A_R$. Recall that $g_R$ is the freezing function. Let $Q\subset [k']$ be a size $n-2$ set. Recall that $\mathcal{U}_Q$ is the set of all size $n-1$ sets $R$ such that $Q\subset R\subset [k']$. We will prove the following simple structural lemma, analogous to Lemma~\ref{lem:same}, which says that the freezing functions for any two sets in $\mathcal{U}_Q$ are \emph{consistent}. \begin{lemma}\label{lem:config1} For every size $n-2$ set $Q\subset [k']$, for any pair $R,R'\in \mathcal{U}_Q$, for any $a\in A_R\cap A_{R'}$, $g_R(a)=g_{R'}(a)$. \end{lemma} \begin{proof} Fix $R,R'\in \mathcal{U}_Q$. Since $R$ and $R'$ are each composed by adding a single character to $Q$, we have that $|R\cup R'|=n$ and $R\cup R'\in \mathcal{U}_R\cap \mathcal{U}_{R'}$. Since $R\cup R'\in \mathcal{U}_R$, we know that $a$ is at position $g_R(a)$ in $\pi(R\cup R')$ and since $R\cup R'\in \mathcal{U}_{R'}$, we know that $a$ is at position $g_{R'}(a)$ in $\pi(R\cup R')$. Then, since $a$ can only occupy a single position in the permutation $\pi(R\cup R')$, we have that $g_R(a)=g_{R'}(a)$. \end{proof} \subsubsection{Step 3a: Counting argument for configuration 1} Like the previous section, in this section we will assume that all size $n-1$ subsets of $K'$ obey configuration 1. Unlike step 3 of Theorem~\ref{thm:warm}, it does not suffice to simply show that two characters are frozen to the same index. Instead, we apply a more sophisticated counting argument. By Lemma~\ref{lem:config1}, for every size $n-2$ set $Q\subset [k']$, we have that all $R\in\mathcal{U}_Q$ agree on the value of $g_R(a)$ if it exists. Thus, we can define $G_Q$ as the union of $g_R$s over all $R\in\mathcal{U}_Q$. Formally, for any $a\in [k']$, $G_Q(a)=i$ if for every $R\in \mathcal{U}_Q$ with $a\in A_R$, we have $g_R(a)=i$. We note that $G_Q(a)$ \emph{exists} if for \emph{some} $R\in \mathcal{U}_Q$, $a\in A_R$. Since $|Q|=n-2$ and there are $n$ indices total, $G_Q(a)$ can exist for at most $n-2$ characters $a\in Q$ and at most 2 characters $a\not\in Q$. We say that the pair $(Q,a)$ is \emph{irregular} if $G_Q(a)$ exists and $a\not\in Q$. The quantity that we will count is the total number of irregular pairs $(Q,a)$ over all size $n-2$ sets $Q\subset [k']$ and all $a\in [k']$. On one hand, as previously mentioned, each set $Q$ can only be in at most 2 irregular pairs. Then since there are ${k'\choose n-2}$ sets $Q\subset [k']$ of size $n-2$, the total number of irregular pairs is at most $2{k'\choose n-2}$. On the other hand, the definition of configuration 1 implies a lower bound on the number of irregular pairs. Recall that configuration 1 says that for every size $n-1$ set $R\subset [k']$, there exists a set $A_R\subset R$ of size $n-3$ such that $R$ freezes $A_R$. Fix sets $R$ and $A_R$. We claim that for each $a\in A_R$, the pair $(R\setminus\{a\},a)$ is an irregular pair. Firstly, is clear that $a\not\in R\setminus\{a\}$. Secondly, $G_{R\setminus\{a\}}(a)$ exists because $R\in \mathcal{U}_{R\setminus\{a\}}$ and $a\in A_R$. Thus, for each $a\in A_R$, the pair $(R\setminus\{a\},a)$ is an irregular pair. Thus, every size $n-1$ set $R\subset [k']$ \emph{produces} $n-3$ irregular pairs $(R\setminus\{a\},a)$. Furthermore, given an irregular pair $(Q,a)$, there is only one set that could produce it, namely $Q\cup\{a\}$. Then since there are ${k'\choose n-1}$ sets $R\subset [k']$ of size $n-1$, we have that the total number of irregular pairs is at least $(n-3){k'\choose n-1}$. Thus, we have shown that the total number of irregular pairs is at most $2{k'\choose n-2}$ and at least $(n-3){k'\choose n-1}$. Therefore, we have reached a contradiction if $2{k'\choose n-2}<(n-3){k'\choose n-1}$ which is true if $n\geq 4$ and $k'>\frac{n^2-3n+4}{n-3}$. In particular, $n\geq 5$, $k'\geq n+7$ satisfy these bounds. \subsubsection{Step 2b: Structure of size $n-2$ sets for configuration 2} From Section~\ref{sec:ramsey}, there exists a size $k'$ set $K'$ of tasks such that either all size $n-1$ subsets of $K'$ obey configuration 1 or all size $n-1$ subsets of $K'$ obey configuration 2. We have already considered the configuration 1 case and now we will assume that all size $n-1$ subsets of $K'$ obey configuration 2. Recall that configuration 2 says that $R$ is semi-frozen. Recall that $h_R$ is the semi-freezing function and $w_R$ is the wildcard index. Let $Q\subset [k']$ be a size $n-2$ set. Recall that $\mathcal{U}_Q$ is the set of all size $n-1$ sets $R$ such that $Q\subset R\subset [k']$. We will prove the following structural lemma, which says that the semi-freezing functions for two sets in $\mathcal{U}_Q$ are in some sense \emph{consistent}. \begin{lemma}\label{lem:config2} For every size $n-2$ set $Q\subset [k']$, there exists a size $n-4$ set $_QT\subset Q$ such that for all $R,R'\in \mathcal{U}_Q$ and all $t\in T_Q$, $h_R(t)=h_{R'}(t)$. \end{lemma} We will prove Lemma~\ref{lem:config2} through a series of lemmas. In the following lemma, we consider the characters that are \emph{not} in the set $T_Q$, that is, the characters $q\in Q$ for which $h_R(q)\not=h_{R'}(q)$. \begin{lemma}\label{lem:wild} For all size $n-2$ sets $Q\subset [k']$ and all $R,R'\in \mathcal{U}_Q$, if $q\in Q$ is such that $h_R(q)\not=h_{R'}(q)$, then either $\pi(R\cup R')[w_R]=q$ or $\pi(R\cup R')[w_{R'}]=q$. \end{lemma} \begin{proof} Since $R$ and $R'$ are each composed by adding a single character to $Q$, we have $R\cup R'\in \mathcal{U}_R\cap\mathcal{U}_{R'}$. Since $R\cup R'\in\mathcal{U}_R$, we know that the position of $q$ in $\pi(R\cup R')$ is either $h_R(q)$ or $w_R$. Since $R\cup R'\in\mathcal{U}_{R'}$, we know that the position of $q$ in $\pi(R\cup R')$ is either $h_{R'}(q)$ or $w_{R'}$. Thus, the position of $q$ in $\pi(R\cup R')$ must be either $w_R$ or $w_{R'}$, because otherwise its position would have to be both $h_R(q)$ and $h_{R'}(q)$, which cannot happen since $h_R(q)\not=h_{R'}(q)$. \end{proof} Before proving Lemma~\ref{lem:config2}, we prove the pairwise version of Lemma~\ref{lem:config2}. \begin{lemma}[pairwise version of Lemma~\ref{lem:config2}]\label{lem:pair} For every size $n-2$ set $Q\subset [k']$ of characters, for every pair $R,R'\in \mathcal{U}_Q$, there exists a size $n-4$ subset $T\subset Q$ such that every character $t\in T$, $h_R(t)=h_{R'}(t)$. \end{lemma} \begin{proof} Suppose by way of contradiction that there exist $R,R'\in \mathcal{U}_Q$ such that there is a set of 3 characters $Q'\subset Q$ so that for each $q\in Q'$, $h_R(q)\not=h_{R'}(q)$. By Lemma~\ref{lem:wild}, for each $q\in Q'$ the position of $q$ in $\pi(R\cup R')$ is either $w_R$ or $w_{R'}$. That is, all 3 characters in $Q'$ must occupy a total of 2 positions in $\pi(R\cup R')$, which is impossible. \end{proof} We have just shown in Lemma~\ref{lem:pair} that given a size $n-2$ set $Q\subset [k']$, for every pair $R,R'\in\mathcal{U}_Q$ there are at most two characters $q$ in $Q$ for which $h_R(q)\not=h_{R'}(q)$. Thus, we have two cases: 1) the uninteresting case where every pair $R,R'$ has only one such character $q$, and 2) the interesting case where there exist $R,R'$ so that there are two such characters $q$. The following lemma handles the uninteresting case by showing that in this case Lemma~\ref{lem:config2} already holds. \begin{lemma}\label{lem:one} Suppose $Q\subset [k']$ is a size $n-2$ set of characters and for every pair $R,R'\in \mathcal{U}_Q$ there is at most one character $q\in Q$, with $h_R(q)\not=h_{R'}(q)$. Then there exists a size $n-3$ subset $T\subset Q$ such that for every pair $R,R'\in \mathcal{U}_Q$ and every character $t\in T$, $h_R(t)=h_{R'}(t)$. \end{lemma} \begin{proof} Let $R,R'\in \mathcal{U}_Q$ and $q\in Q$ be such that $h_R(q)\not=h_{R'}(q)$. Then by assumption, for all $q'\in Q$ with $q'\not=q$, $h_R(q')=h_{R'}(q')$. Consider $R''\in \mathcal{U}_Q$. It suffices to show that for all $q'\in Q$ with $q'\not=q$, we have $h_{R''}(q')=h_{R}(q')$. Suppose for contradiction that there exists $q'\in Q$ with $q'\not=q$ such that $h_{R''}(q')\not=h_{R}(q')$. Then, since $h_{R}(q')=h_{R'}(q')$, we have $h_{R''}(q')\not=h_{R'}(q')$. From the precondition of the lemma statement, $q'$ is the only character with $h_{R''}(q')\not=h_{R}(q')$ and $q'$ is the only character with $h_{R''}(q')\not=h_{R'}(q')$. Thus, $h_{R''}(q)=h_{R}(q)$ and $h_{R''}(q)=h_{R'}(q)$. So, $h_{R}(q)=h_{R'}(q)$, a contradiction. \end{proof} We have handled the uninteresting case from above and now we handle the interesting case in which there exist $R,R'\in \mathcal{U}_Q$ so that there are two characters $q$ in $Q$ for which $h_R(q)\not=h_{R'}(q)$. The following lemma shows that in this case we can completely characterize the structure of $h_R$ and $h_{R'}$. Table~\ref{tabh} depicts the structure. \begin{lemma}\label{lem:spec} For every size $n-2$ set $Q\subset [k']$ of characters, if $R,R'\in \mathcal{U}_Q$ are such that there exist $q,q'\in Q$ with $h_R(q)\not=h_{R'}(q)$ and $h_R(q')\not=h_{R'}(q')$, then (modulo switching $q$ and $q'$): \begin{enumerate} \item Let $r$ be the single character in $R\setminus Q$ and let $r'$ be the single character in $R'\setminus Q$. Then $h_R(q)=h_{R'}(r')$ and $h_R(r)=h_{R'}(q')$. \item $h_R(q')=w_{R'}$ and $h_{R'}(q)=w_R$. \item for all $q''\in Q$ not equal to $q$ or $q'$, $h_R(q'')=h_{R'}(q'')$. \end{enumerate} \end{lemma} \begin{table}[h] \centering \begin{tabular}{c|c|c|c|c|c} & & &$\bm{w_R}$ &$\bm{w_{R'}}$ & \\ \hline $\bm{\pi(R\cup R')}$& $r'$ & $r$ & $q$ & $q'$ &$\{q''\in Q\}$\\ \hline $\bm{h_R}$ & $q$ & $r$ & N/A & $q'$ &$\{q''\in Q\}$\\ \hline $\bm{h_{R'}}$ & $r'$ & $q'$ & $q$ & N/A &$\{q''\in Q\}$ \end{tabular} \caption{The structure imposed by Lemma~\ref{lem:spec}. Each column indicates an index in $[n]$. For example, the first column indicates that $\pi(R\cup R')[r']=h_R(q)=h_{R'}(r')$. Some entries are not applicable (N/A) because by definition $h_R$ does not map anything to the index $w_R$.}\label{tabh} \end{table} \begin{proof} We begin with item 3. By Lemma~\ref{lem:wild}, without loss of generality $\pi(R\cup R')[w_R]=q$ and $\pi(R\cup R')[w_{R'}]=q'$. Since the position in $\pi(R\cup R')$ of each remaining character $q''\in Q$ is either $h_R(q'')$ or $w_R$ but the position $w_R$ is taken by $q$, it must be that $\pi(R\cup R')[h_R(q'')]=q''$. Similarly, we have $\pi(R\cup R')[h_{R'}(q'')]=q''$. Thus, $h_R(q'')=h_{R'}(q'')$ for all $q''\in Q$ with $q''\not=q,q'$. We now move to item 2. Since the position of $q$ in $\pi(R\cup R')$ is either $w_{R'}$ or $h_{R'}(q)$ but $w_{R'}$ is taken by $q'$, we have that $\pi(R\cup R')[h_{R'}(q)]=q$. We already know that $\pi(R\cup R')[w_R]=q$, so $h_{R'}(q)=w_R$. By a symmetric argument, $h_R(q')=w_{R'}$. We now move to item 1. Since the position in $\pi(R\cup R')$ of $r$ is either $h_R(r)$ or $w_R$, but the position $w_R$ is taken by $q$, it must be that $\pi(R\cup R')[h_R(r)]=r$. By a symmetric argument, $\pi(R\cup R')[h_{R'}(r')]=r'$. Combining these two facts, since $r$ and $r'$ cannot occupy the same index in $\pi(R\cup R')$, we have $h_R(r)\not=h_{R'}(r')$. We proceed by process of elimination. The set of indices which are mapped to by $h_R$ is $[n]\setminus \{w_R\}$ and the indices which have so far been mapped to by items 2 and 3 are $w_{R'}$ and $h_R(q'')=h_{R'}(q'')$ for all $q''\in Q$ not equal to $q$ or $q'$. The set of indices which are mapped to by $h_{R'}$ is $[n]\setminus \{w_{R'}\}$ and the indices which have so far been mapped to by items 2 and 3 are $w_{R}$ and $h_{R'}(q'')=h_{R}(q'')$ for all $q''\in Q$ with $q''\not=q,q'$. Thus, the set of indices which have not yet been mapped to is the same for $h_R$ and $h_{R'}$: $[n]\setminus\{w_R,w_{R'},h_R(q'')=h_{R'}(q'')\}$. The characters for which $h_R$ has not yet been determined are $q$ and $r$ and the characters for which $h_{R'}$ has not yet been determined are $q'$ and $r'$. From the previous paragraph, we know that $h_R(r)\not=h_{R'}(r')$. Thus, we have $h_R(q)=h_{R'}(r')$ and $h_R(r)=h_{R'}(q')$. \end{proof} We are now ready to prove Lemma~\ref{lem:config2}. We have just shown in Lemma~\ref{lem:spec} that individual pairs $R,R'\in \mathcal{U}_Q$ obey a particular structure, and in Lemma~\ref{lem:config2} we will derive structure among \emph{all} $R\in\mathcal{U}_Q$. \begin{lemma}[Restatement of Lemma~\ref{lem:config2}]\label{lem:config22} For every size $n-2$ set $Q\subset [k']$, there exists a size $n-4$ set $T_Q\subset Q$ such that for all $R,R'\in \mathcal{U}_Q$ and all $t\in T_Q$, $h_R(t)=h_{R'}(t)$. \end{lemma} \begin{proof} By Lemma~\ref{lem:one} we can assume that there exists a pair $R,R'\in \mathcal{U}_Q$ so that there exist $q,q'\in Q$ with $h_R(q)\not=h_{R'}(q)$ and $h_R(q')\not=h_{R'}(q')$. Fix $R$, $R'$, $q$, and $q'$. $R$ and $R'$ obey the structure specified by Lemma~\ref{lem:spec}. Consider $R''\in \mathcal{U}_Q$ with $R''\not=R,R'$. Suppose by way of contradiction that there exists $q''\in Q$ with $q''\not=q,q'$ such that $h_{R''}(q'')\not=h_{R}(q'')$ (and thus also $h_{R''}(q'')\not=h_{R'}(q'')$ since $h_{R}(q'')=h_{R'}(q'')$ by Lemma~\ref{lem:spec}). We first note that it cannot be the case that both $h_{R''}(q)=h_{R}(q)$ and $h_{R''}(q')=h_{R}(q')$ because then we would have $h_{R''}(q)\not=h_{R'}(q)$ and $h_{R''}(q')\not=h_{R'}(q')$, in which case $h_{R''}$ and $h_{R'}$ would differ on inputs $q$, $q'$, and $q''$ which contradicts Lemma~\ref{lem:pair}. Thus, $h_{R''}$ must differ from each of $h_R$ and $h_{R'}$ and on exactly one of $q$ or $q'$. Without loss of generality, suppose $h_{R''}(q)\not=h_R(q)$ and $h_{R''}(q')\not=h_{R'}(q')$. Since $h_{R''}$ also differs from each of $h_R$ and $h_{R'}$ on input $q''$, $h_{R''}$ differs from each of $h_R$ and $h_{R'}$ on exactly two inputs. Thus, the pair $R'',R$ and the pair $R'',R'$ both obey the structure specified by Lemma~\ref{lem:spec}. We claim that it is impossible to reconcile these pairwise structural constraints. $R$, $R'$, and $R''$ are each composed by adding a single character to $Q$. Let $r$, $r'$, and $r''$ be these characters respectively. Applying item 1 of Lemma~\ref{lem:spec} to the pair $R,R'$ we have the following two cases: \subparagraph{Case 1: $h_R(q)=h_{R'}(r')$ and $h_R(r)=h_{R'}(q')$.} Item 1 of Lemma~\ref{lem:spec} presents two options for the pair $R,R''$: either $h_{R''}(r'')=h_R(q)$ or $h_{R''}(r'')=h_R(q'')$. If $h_{R''}(r'')=h_R(q)$, then from the definition of case 1, $h_{R'}(r')=h_{R''}(r'')$, but this is not true by item 1 of Lemma~\ref{lem:spec}. Thus, $h_{R''}(r'')=h_R(q'')$ and $h_R(r)=h_{R''}(q)$. Since $h_{R''}$ and $h_{R'}$ differ only on inputs $q'$ and $q''$, we have $h_{R''}(q)=h_{R'}(q)$. Thus, we have shown that $h_R(r)=h_{R'}(q)$. However, by item 2 of Lemma~\ref{lem:spec}, we have $h_{R'}(q)=w_R$, which is a contradiction since $h_R(r)\not=w_R$. \subparagraph{Case 2: $h_R(q')=h_{R'}(r')$ and $h_R(r)=h_{R'}(q)$.} Since $h_{R''}$ and $h_{R}$ differ only on inputs $q$ and $q''$, we have $h_{R''}(q')=h_{R}(q')$. Thus, $h_{R''}(q')=h_{R'}(r')$. Then by item 2 of Lemma~\ref{lem:spec}, we have $h_{R''}(q'')=w_{R'}$. Since $h_{R''}$ and $h_{R'}$ differ only on inputs $q'$ and $q''$, we have $h_{R''}(q)=h_{R'}(q)$. Then since we are in case 2, we have $h_R(r)=h_{R''}(q)$. Then by item 2 of Lemma~\ref{lem:spec}, we have $h_{R''}(q'')=w_{R}$. Thus, we have shown that $h_{R''}(q'')$ is equal to both $w_{R'}$ and $w_R$, which is not true by Lemma~\ref{lem:spec}. \end{proof} By Lemma~\ref{lem:config22}, we can define a function $h'_Q$ that takes as input any element $t\in T_Q$ and outputs the value $h_R(t)$, which is the same for all $R\in \mathcal{U}_Q$. Let $P\subset [k']$ be a size $n-3$ set. Recall that $\mathcal{U}_P$ is the set of all size $n-2$ sets $Q$ such that $P\subset Q \subset [k']$. We conclude this section by proving a lemma similar to Lemma~\ref{lem:config1}, which says that the functions $h'$ for any two sets in $\mathcal{U}_P$ are \emph{consistent}. \begin{lemma}\label{lem:config2con} For every size $n-3$ set $P\subset [k']$, for any pair $Q,Q'\in \mathcal{U}_P$, for any character $t\in T_Q\cap T_{Q'}$, $h'_Q(t)=h'_{Q'}(t)$. \end{lemma} \begin{proof} Since $Q$ and $Q'$ are each composed by adding a single character to $P$, we have $Q\cup Q'\in\mathcal{U}_Q\cap \mathcal{U}_{Q'}$. Since $Q\cup Q'\in \mathcal{U}_Q$, we know that $h'_Q(t)=h_{Q\cup Q'}(t)$ and since $Q\cup Q'\in \mathcal{U}_{Q'}$, we know that $h'_{Q'}(t)=h_{Q\cup Q'}(t)$. Thus, $h'_Q(t)=h'_{Q'}(t)$. \end{proof} \subsubsection{Step 3b: Counting argument for configuration 2} Like the previous section, in this section we will assume that all size $n-1$ subsets of $K'$ obey configuration 2. The counting argument similar to that from step 3a. By Lemma~\ref{lem:config2con}, for every size $n-3$ set $P\subset [k']$, we have that all $Q\in\mathcal{U}_P$ agree on the value of $h'_Q(t)$ if it exists. Thus, we can define $H_P$ as the union of $h'_Q$s over all $Q\in\mathcal{U}_P$. Formally, $H_P(t)=i$ if for every $Q\in \mathcal{U}_P$ with $t\in T_Q$, we have $h'_Q(t)=i$. We note that $H_P(t)$ \emph{exists} if for \emph{some} $Q\in \mathcal{U}_P$, $t$ is in the set $T_Q$. Since $|P|=n-3$ and there are $n$ indices total, $H_P(t)$ can exist for at most $n-3$ characters $t\in P$ and at most 3 characters $t\not\in P$. We say that the pair $(P,t)$ is \emph{irregular} if $H_P(t)$ exists and $t\not\in P$. The quantity that we will count is the total number of irregular pairs $(P,t)$ over all size $n-3$ sets $P\subset [k']$ and all $t\in [k']$. On one hand, as previously mentioned, each set $P$ can only be in at most 3 irregular pairs. Then since there are ${k'\choose n-3}$ sets $P\subset [k']$ of size $n-3$, the total number of irregular pairs is at most $3{k'\choose n-3}$. On the other hand, Lemma~\ref{lem:config2} implies a lower bound on the number of irregular pairs. By Lemma~\ref{lem:config2}, for \emph{every} size $n-2$ set $Q\subset [k']$, the set $T_Q\subset Q$ is of size $n-4$. Fix sets $Q$ and $T_Q$. We claim that for each $t\in T_Q$, the pair $(Q\setminus\{t\},t)$ is an irregular pair. Firstly, it is clear that $t\not\in Q\setminus\{t\}$. Secondly, $H_{Q\setminus\{t\}}(t)$ exists because $Q\in \mathcal{U}_{Q\setminus\{q\}}$ and $t\in T_Q$. Thus, for each $t\in T_Q$, the pair $(Q\setminus\{t\},t)$ is an irregular pair. Thus, every size $n-2$ set $Q\subset [k']$ \emph{produces} $n-4$ irregular pairs $(Q\setminus\{t\},t)$. Furthermore, given an irregular pair $(P,t)$, there is only one set that could produce it, namely $P\cup\{t\}$. Then since there are ${k'\choose n-2}$ sets $Q\subset [k']$ of size $n-2$, we have that the total number of irregular pairs is at least $(n-4){k'\choose n-2}$. Thus, we have shown that the total number of irregular pairs is at most $3{k'\choose n-3}$ and at least $(n-4){k'\choose n-2}$. Therefore, we have reached a contradiction if $3{k'\choose n-3}<(n-4){k'\choose n-2}$ which is true if $n\geq 5$ and $k'>\frac{n^2-4n+6}{n-4}$. In particular, $n\geq 5$, $k'\geq n+7$ satisfy these bounds. \end{proof} \section{The remaining parameter regime}\label{sec:3} \begin{theorem}[restatement of Theorem~\ref{thm:3}]\label{thm:3rr} For $n\geq 3$, $k\geq 5$, every set of functions $f_1^{n,k},\dots, f_n^{n,k}$ has maximum switching cost at least 3. \end{theorem} \begin{remark*} We note that the proof framework from Section~\ref{sec:n<k} immediately breaks down if we try to apply it to Theorem~\ref{thm:3rr} for all $n,k$. For example, when $n>k$, there are no size $n$ subsets of $[k]$ so we must instead consider size $n$ \emph{multisets} of $[k]$. Even if we have the same setting of parameters as Theorem~\ref{thm:3r} but we are considering multisets, in step 1 of the proof framework Lemma~\ref{lem:fix} is no longer true. That is, it is not true that for all size 2 multisets $\{x,y\}$ of $[k]$, we have that $\{x,y\}$ $i$-freezes either $x$ or $y$ for some $i$. In particular, suppose $\{x,y\}=\{a,a\}$. Then if is possible that $\pi(\{a,a,b\})=aab$, $\pi(\{a,a,c\})=aca$, and $\pi(\{a,a,d\})=daa$, in which case $a$ is not frozen to any index. Since the proof framework from Section~\ref{sec:n<k} no longer applies, we develop entirely new techniques in this section. \end{remark*} For the rest of this section we will use the language of the original problem statement rather than that of the problem reformulation. \subsection{Preliminaries} To prove the Theorem~\ref{thm:3rr}, we need to show that Theorem~\ref{thm:warm} extends to larger $k$ and $n$. As noted in Section~\ref{sec:remain}, extending to larger $n$ is challenging, while extending to larger $k$ is trivial, as shown in the following lemma. \begin{lemma}\label{lem:k} Fix $n$ and $k$. If there exists a set of functions $f_1^{n,k},\dots, f_n^{n,k}$ with maximum switching cost $D$, then for all $k'<k$, there exists a set of functions $g_1^{n,k'},\dots, g_n^{n,k'}$ with maximum switching cost $D$. \end{lemma} \begin{proof} For each demand vector $\vec{v}$ with $n$ agents and $k$ tasks such that only the first $k'$ entries of $\vec{v}$ are non-zero, let $\vec{v'}$ be the length $k'$ vector consisting of only the first $k'$ entries of $\vec{v}$. We note that the set of all such vectors $\vec{v'}$ is the set of all demand vectors for $n$ agents and $k'$ tasks. Set each $g_i^{n,k'}(\vec{v'})=f_i^{n,k}(\vec{v})$. Then the switching cost for any adjacent pair $(\vec{v'_1},\vec{v'_2})$ with respect to $g_1^{n,k'},\dots, g_n^{n,k'}$ is equal to the switching cost of the corresponding adjacent pair $(\vec{v_1},\vec{v_2})$ with respect to $f_1^{n,k},\dots, f_n^{n,k}$. Thus, the maximum switching cost of $g_1^{n,k'},\dots, g_n^{n,k'}$ is equal to the maximum switching cost of $f_1^{n,k},\dots, f_n^{n,k}$. \end{proof} \begin{notation*} We say that an ordered pair of adjacent demand vectors $(\vec{v_1},\vec{v_2})$ is $(s,t)$-adjacent if starting with $\vec{v_1}$ and moving exactly one unit of demand from task $s$ to task $t$ results in $\vec{v_2}$. We say that an agent $a$ is \emph{$(i,j)$-mobile} with respect to an ordered pair of adjacent demand vectors $(\vec{v_1},\vec{v_2})$ if $f_a^{n,k}(\vec{v_1})=i$, $f_a^{n,k}(\vec{v_2})=j$, and $i\not=j$. We note that if $(\vec{v_1},\vec{v_2})$ is $(s,t)$-adjacent and has switching cost 2, then for some task $i$, some agent $a$ must be $(s,i)$-mobile and another agent $b$ must be $(i,t)$-mobile. We say that $i$ is the \emph{intermediate} task with respect to $(\vec{v_1},\vec{v_2})$. \end{notation*} \subsection{Proof overview} We begin by supposing for contradiction that there exists a set of functions $f_1^{n,k},\dots, f_n^{n,k}$ with maximum switching cost 2, and then we prove a series of structural lemmas about such functions. As previously mentioned, the main challenge of proving Lemma~\ref{thm:3rr} is handling large $n$. To illustrate this challenge, we repeat the example from Section~\ref{sec:remain}. This example shows that having large $n$ can allow more pairs of adjacent demand vectors to have switching cost 2, making it more difficult to find a pair with switching cost greater than 2. Consider the subset $S_i$ of demand vectors in which a particular task $i$ has an unconstrained amount of demand and each remaining task has demand at most $n/(k-1)$. We claim that there exists a set of functions $f_1^{n,k},\dots, f_{n}^{n,k}$ so that every pair of adjacent demand vectors from $S_i$ has switching cost 2. Divide the agents into $k-1$ groups of $n/(k-1)$ agents each, and associate each task except $i$ to such a group of agents. We define the functions $f_1^{n,k},\dots, f_{n}^{n,k}$ so that given any demand vector in $S_i$, the set of agents assigned to each task except $i$ is simply a subset of the group of agents associated with that task (say, the subset of such agents with smallest ID). This is a valid assignment since the demand of each task except $i$ is at most the size of the group of agents associated with that task. The remaining agents are assigned to task $i$. Then, given a pair $(\vec{v},\vec{v'})$ of adjacent demand vectors in $S_i$, whose demands differ only for tasks $s$ and $t$, their switching cost is 2 because the only agents assigned to different tasks between $\vec{v}$ and $\vec{v'}$ are: one agent from each of the groups associated with tasks $s$ and $t$, respectively. To overcome the challenge illustrated by the above example, our general method is to identify a task that serves the role of task $i$ and then successively move demand out of task $i$ until task $i$ is empty, and thus can no longer serve its original role. We note that in the above example, the task $i$ serves as the intermediate task for all pairs of adjacent demand vectors from $S_i$. Thus, we will choose $i$ to be an intermediate task. In particular, we show that there is a demand vector $\vec{v}$ so that we can identify tasks $i$ and $t$ with the following important property: if we start with $\vec{v}$ and move a unit of demand to task $t$ from \emph{any} other task except $i$, the switching cost is 2 and the intermediate task is $i$. Furthermore, we prove that if we start with demand vector $\vec{v}$ and move a unit of demand from task $i$ to task $t$ resulting in demand vector $\vec{v_1}$, then $t$ and $i$ have the important property from the previous paragraph with respect to $\vec{v_1}$. Applying this argument inductively, we show that no matter how many units of demand we successively move from $i$ to $t$, $i$ and $t$ still satisfy the important property with respect to the current demand vector. We move demand from $i$ to $t$ until task $i$ is empty. Then, the final contradiction comes from the fact that if we now move a unit of demand from any non-$i$ task to $t$, then the important property implies that the switching cost is 2 and the intermediate task is $i$; however, $i$ is empty and an empty task cannot serve as an intermediate task.\\ \subsection{Proof of Theorem~\ref{thm:3rr}}\label{app:3} Theorem~\ref{thm:warm} proves Theorem~\ref{thm:3rr} for the case of $n=3$ and $k=5$. Lemma~\ref{lem:k} implies that Theorem~\ref{thm:3rr} also holds for $n=3$ and any $k\geq 5$. Thus, it remains to prove Theorem~\ref{thm:3rr} for $n\geq 4$ and $k\geq 5$. Suppose by way of contradiction that $n\geq 4$, $k\geq 5$, and $f^{n,k}_1,f^{n,k}_2,\dots,f^{n,k}_n$ is a set of functions with switching cost 2. As motivated in the algorithm overview, our first structural lemma concerns tasks $i$ and $t$ such that if we move a unit of demand to task $t$ from any other task except $i$, the switching cost is 2 and the intermediate task is $i$. \begin{lemma}\label{lem:dest2} Let $(\vec{v},\vec{v_1})$ be a pair of $(s_1,t)$-adjacent demand vectors with switching cost 2 and intermediate task $i$. Then, for all $\vec{v_2}$ such that $(\vec{v},\vec{v_2})$ are $(s_2,t)$-adjacent for $s_2\not=i$, the pair $(\vec{v},\vec{v_2})$ has switching cost 2, intermediate task $i$, and the same $(i,t)$-mobile agent as $(\vec{v},\vec{v_1})$. \end{lemma} \begin{proof} Table~\ref{tab1} depicts the proof. \begin{table}[h] \centering \begin{tabular}{c|c|c|c|c} &$\bm{s_1}$&$\bm{i}$&$\bm{t}$&$\bm{s_2}$\\ \hline $\vec{\bm{v}}$&$a$&$b$&&$c$\\ \hline $\vec{\bm{v_1}}$&&$a$&$b$&$c$\\ \hline \hline $\vec{\bm{v_2}}$ \bf(case 1) &$a$&$b$&$c$&\\ \hline $\vec{\bm{v_2}}$ \bf(case 2) &&$b$&$d$&not $c$ \end{tabular} \caption{Demand vectors and the corresponding assignment of agents. For example, the row labeled $\vec{v}$ indicates that for the demand vector $\vec{v}$, agent $a$ is assigned to task $s_2$, agent $b$ is assigned to task $i$, and agent $c$ is assigned to task $s_2$. There could also be other agents in the system that are not shown in the table.} \label{tab1} \end{table} With respect to $(\vec{v},\vec{v_1})$, let $a$ be the $(s_1,i)$-mobile agent and let $b$ be the $(i,t)$-mobile agent. Then $a$ and $b$ behave according to rows $\vec{v}$ and $\vec{v_1}$ of Table~\ref{tab1}. Suppose by way of contradiction that $(\vec{v},\vec{v_2})$ is \emph{not} as in the lemma statement. That is, either $(\vec{v},\vec{v_2})$ has switching cost 1 or $(\vec{v},\vec{v_2})$ has switching cost 2 and either a different intermediate task from $(\vec{v},\vec{v_1})$ or a different $(i,t)$-mobile agent. \subparagraph{Case 1. $(\vec{v},\vec{v_2})$ has switching cost 1.} Let $c$ be the mobile agent with respect to $(\vec{v},\vec{v_2})$. Then, $\vec{v_2}$ is as in row $\vec{v_2}$ (case 1) of Table~\ref{tab1}. Also, since $c$ is not mobile with respect to $(\vec{v},\vec{v_1})$, $c$ is assigned to $s_2$ for both $\vec{v}$ and $\vec{v_1}$ as shown in Table~\ref{tab1}. Comparing rows $\vec{v_1}$ and $\vec{v_2}$ (case 1) of Table~\ref{tab1}, it is clear that $(\vec{v_1},\vec{v_2})$ are adjacent and have switching cost 3, since $a$, $b$, and $c$ each switch tasks. This is a contradiction. \subparagraph{Case 2. $(\vec{v},\vec{v_2})$ has switching cost 2.} Let $i_2$ be the intermediate task of $(\vec{v},\vec{v_2})$ and let $c$ be the $(s_2,i_2)$-mobile agent for $(\vec{v},\vec{v_2})$. Then, for $\vec{v_2}$, $c$ is not assigned to $s_2$, as shown in Table~\ref{tab1}. Let $d$ be the $(i_2,t)$-mobile agent for $(\vec{v},\vec{v_2})$. We note that it is possible that $d=a$, however $d\not=b$ since $d$ is assigned to $i_2$ for $\vec{v}$ while $b$ is assigned to $i$, and $i\not=i_2$. Table~\ref{tab1} shows the positions of $b$ and $d$ (but not $a$) in $\vec{v_2}$. Comparing rows $\vec{v_1}$ and $\vec{v_2}$ (case 2) of Table~\ref{tab1}, it is clear that $(\vec{v_1},\vec{v_2})$ has switching cost 3, since $b$, $d$, and $c$ each switch tasks. Since $(\vec{v_1},\vec{v_2})$ are adjacent, this is a contradiction. \end{proof} We have just shown in Lemma~\ref{lem:dest2} that with respect to any demand vector $\vec{v}$, the set of tasks can be split into two distinct types such that every task is of exactly one type. \begin{definition}[type 1 task] A task $t$ is of \emph{type 1} with respect to a demand vector $\vec{v}$ if when we start with $\vec{v}$ and move a unit of demand from any task to task $t$, the switching cost is 1. \end{definition} \begin{definition}[type 2 task] A task $t$ is of \emph{type 2} with respect to a demand vector $\vec{v}$ if there exists a task $i$ and an agent $a$ such that when we start with $\vec{v}$ and move a unit of demand from any task except $i$ to task $t$, the switching cost is 2, the intermediate task is $i$, and the $(i,t)$-mobile agent is $a$. We say that $a$ is the \emph{intermediate agent} of $t$ with respect to $\vec{v}$. \end{definition} \begin{remark*}We note that if $\vec{v}$ only has two non-empty tasks besides $t$, then it is possible that the identity of task $i$ is ambiguous. However, every time we reference a type 2 task we always have the condition that there are at least three non-empty tasks besides $t$ so there will be no ambiguity. \end{remark*} As mentioned in the proof overview we wish to successively move demand out of an intermediate task until it is empty. The bulk of the remainder of the proof is to prove the following lemma (Lemma~\ref{lem:ind}), which roughly says that if $t$ is a type 2 task and $i$ is $t$'s intermediate task, then after we move a unit of demand from task $i$ to task $t$, task $t$ remains a type 2 task with intermediate task $i$. Then, by iterating Lemma~\ref{lem:ind}, we show that after moving any amount of demand from task $i$ to task $t$, task $t$ still remains a type 2 task with intermediate task $i$. \begin{lemma}\label{lem:ind} Let $\vec{v}$ be a demand vector with at least four non-zero entries. Then there exists a task $t$ such that $t$ is of type 2 with respect to $\vec{v}$ and $\vec{v}$ has at least four non-empty tasks distinct from $t$. Let $i$ be the intermediate task of $t$ with respect to $\vec{v}$. Let $\vec{v'}$ be such that $(\vec{v},\vec{v'})$ are $(i,t)$-adjacent. Then, $t$ is a type 2 task with intermediate task $i$ with respect to $\vec{v'}$. \end{lemma} \paragraph*{Lemma~\ref{lem:ind} implies Theorem~\ref{thm:3rr}.} Let $\vec{v}$, $t$, and $i$ be as in Lemma~\ref{lem:ind}. We claim that if task $i$ is non-empty in $\vec{v'}$ then the triple ($\vec{v'}$, $t$, $i$) also satisfies the precondition of Lemma~\ref{lem:ind}. This is because if task $i$ is non-empty in $\vec{v'}$ then the set of non-empty tasks in $\vec{v'}$ is a superset of the set of non-empty tasks in $\vec{v'}$. Then since $\vec{v}$ has at least four non-empty tasks distinct from $t$, $\vec{v'}$ also has at least four non-empty tasks distinct from $t$. Also, by Lemma~\ref{lem:ind}, $t$ is a type 2 task with intermediate task $i$ with respect to $\vec{v'}$. Thus, we have shown that if task $i$ is non-empty for $\vec{v'}$ then ($\vec{v'}$, $t$, $i$) satisfy the precondition of Lemma~\ref{lem:ind}. Thus, we can iterate Lemma~\ref{lem:ind}: if we start with $\vec{v}$ and successively move demand from task $i$ to task $t$ until task $i$ is empty, the resulting demand vector $\vec{v''}$ is such that $t$ is a type 2 task with intermediate task $i$. However, it is impossible for $i$ to be an intermediate task with respect to $\vec{v''}$ since $i$ is empty. It remains to prove Lemma~\ref{lem:ind}. \subsubsection{Proof of Lemma~\ref{lem:ind}} The following lemma shows that the pair $(\vec{v},\vec{v'})$ from the statement of Lemma~\ref{lem:ind} has switching cost 1. \begin{lemma}\label{lem:sw1} Let $t$ be a type 2 task with intermediate task $i$ with respect to a demand vector $\vec{v}$. Suppose $\vec{v}$ has at least one unit of demand in each of two tasks $s_1$ and $s_2$, both distinct from $t$ and $i$. Let $\vec{v'}$ be the demand vector such that $(\vec{v},\vec{v'})$ is $(i,t)$-adjacent. Then $(\vec{v},\vec{v'})$ has switching cost 1. \end{lemma} \begin{proof} Table~\ref{tab2} depicts the proof. \begin{table}[h] \centering \begin{tabular}{c|c|c|c|c} &$\bm{s_1}$&$\bm{i}$&$\bm{t}$&$\bm{s_2}$\\ \hline $\vec{\bm{v}}$&$a$&$b$&not $d$&$c$\\ \hline $\vec{\bm{v_1}}$&&$a$&$b$&$c$\\ \hline $\vec{\bm{v_2}}$&$a$&$c$&$b$, not $d$&\\ \hline \hline $\vec{\bm{v'}}$ \bf(case 1) &&&$a$, not $b$&$c$\\ \hline $\vec{\bm{v'}}$ \bf(case 2) &$a$&&$d$, not $b$&$c$ \end{tabular} \caption{Demand vectors and the corresponding assignment of agents.} \label{tab2} \end{table} Let $\vec{v_1}$ be such that $(\vec{v},\vec{v_1})$ is $(s_1,t)$-adjacent and let $\vec{v_2}$ be such that $(\vec{v},\vec{v_2})$ is $(s_2,t)$-adjacent. With respect to $(\vec{v},\vec{v_1})$, let $a$ be the $(s_1,i)$-mobile agent and let $b$ be the $(i,t)$-mobile agent. Then $a$ and $b$ behave according to rows $\vec{v}$ and $\vec{v_1}$ of Table~\ref{tab1}. With respect to $(\vec{v},\vec{v_2})$, let $c$ be the $(s_2,i)$-mobile agent. From Lemma~\ref{lem:dest2} we know that $b$ is the $(i,t)$-mobile agent for $(\vec{v},\vec{v_2})$. Thus $b$ and $c$ behave according to rows $\vec{v}$ and $\vec{v_2}$ of Table~\ref{tab1}. Suppose by way of contradiction that $(\vec{v},\vec{v'})$ has switching cost 2. Let $i'\not=i,t$ be the intermediate task. We condition on the $(i',t)$-mobile agent. We already know that it is not $b$ since $b$ is assigned to $i$ for $\vec{v}$. \subparagraph{Case 1. the $(i',t)$-mobile agent for $(\vec{v},\vec{v'})$ is $a$ or $c$.} Suppose the $(i',t)$-mobile agent for $(\vec{v},\vec{v'})$ is $a$, as shown in row $\vec{v'}$ (case 1) of Table~\ref{tab2}. If the $(i',t)$-mobile agent is $c$, the argument is identical. Since we are assuming $c$ is not a mobile-agent, $c$ is assigned to $s_2$ in $\vec{v'}$ as shown in Table~\ref{tab2}. Also, since $a$ is the only $(i',t)$-mobile agent, we know that $b$ is not assigned to $t$ in $\vec{v'}$ as shown in Table~\ref{tab2}. Comparing rows $\vec{v_2}$ and $\vec{v'}$ (case 1) of Table~\ref{tab2}, it is clear that $(\vec{v_2},\vec{v'})$ have switching cost 3, since $a$, $b$, and $c$ all switch tasks. Also, $\vec{v_2}$ and $\vec{v'}$ are adjacent since both are the result of starting with $\vec{v}$ and moving one unit of demand from some task to task $t$. This is a contradiction. \subparagraph{Case 2. the $(i',t)$-mobile agent for $(\vec{v},\vec{v'})$ is neither $a$ nor $c$.} Let $d$ be the $(i',t)$-mobile agent for $(\vec{v},\vec{v_3})$. Then $d$, $a$, and $c$ are assigned as in row $\vec{v'}$ (case 2) of Table~\ref{tab2}. Also, since $d$ is the only $(i',t)$-mobile agent and $d\not=b$, we know that $b$ is not assigned to $t$ in $\vec{v'}$, as shown in Table~\ref{tab2}. Also, since $d$ is the $(i',t)$-mobile agent for $(\vec{v},\vec{v'})$, we know that $d$ is not assigned to $t$ in $\vec{v}$, as shown in Table~\ref{tab2}. Then, since $b$ is the only $(i,t)$-mobile agent for $(\vec{v},\vec{v_2})$, we know that $d$ is also not assigned to $t$ for $\vec{v_2}$, as shown in Table~\ref{tab2}. Comparing rows $\vec{v_2}$ and $\vec{v'}$ (case 2) of Table~\ref{tab2}, it is clear that $(\vec{v_2},\vec{v_3})$ have switching cost 3, since $d$, $b$, and $c$ all switch tasks. This is a contradiction since $\vec{v_2}$ and $\vec{v'}$ are adjacent. \end{proof} Next, we prove another structural lemma concerning the intermediate task $i$, which says that task $i$ is of type 1. \begin{lemma}\label{lem:tech} Let $\vec{v}$ be a demand vector with at least four non-zero entries and let $t$ be a type 2 task with intermediate task $i$. Then, task $i$ is of type 1 with respect to $\vec{v}$. \end{lemma} \begin{proof} Table~\ref{tabb} depicts the proof. \begin{table}[h] \centering \begin{tabular}{c|c|c|c} &$\bm{s}$&$\bm{i}$&$\bm{t}$\\ \hline $\vec{\bm{v}}$&$a$&$b$, not $c$&\\ \hline $\vec{\bm{v_1}}$&&$a$, not $c$&$b$\\ \hline $\vec{\bm{v_2}}$&&$b$, $c$, not $a$&\\ \end{tabular} \caption{Demand vectors and the corresponding assignment of agents.} \label{tabb} \end{table} Suppose for contradiction that task $i$ is of type 2 with respect to $\vec{v}$, and let $i'$ be the intermediate task. Since $\vec{v}$ has at least four non-zero entries, there exists a task $s\not=i'$ that is non-empty for $\vec{v}$. Let $\vec{v_1}$ be such that $(\vec{v},\vec{v_1})$ are $(s,t)$-adjacent. For $(\vec{v},\vec{v_1})$, let $a$ be the $(s,i)$-mobile agent and let $b$ be the $(i,t)$-mobile agent, as shown in Table~\ref{tabb}. Letting $\vec{v_2}$ be such that $(\vec{v},\vec{v_2})$ are $(s,i)$-adjacent, $(\vec{v},\vec{v_2})$ has switching cost 2 since $s\not=i'$. Thus, $a$ does \emph{not} switch to task $i$ for $(\vec{v},\vec{v_2})$, as shown in Table~\ref{tabb}. Also, $b$ remains in task $i$ for $(\vec{v},\vec{v_2})$, as shown in Table~\ref{tabb}. Let $c$ be the mobile agent for $(\vec{v},\vec{v_2})$ that switches to task $i$. Then agent $c$ is not assigned to task $i$ with respect to $\vec{v}$ or $\vec{v_1}$ and is assigned to task $i$ with respect to $\vec{v_2}$, as shown in Table~\ref{tabb}. We note that $(\vec{v_1},\vec{v_2})$ are $(t,i)$-adjacent while they differ on the assignment of agents $a$, $b$, and $c$, a contradiction. \end{proof} Later, we will prove the following lemma (Lemma~\ref{lem:all2int}), which says that (under certain conditions) there is \emph{at most one} task of type 1. Combining this with Lemma~\ref{lem:tech} allows us to say that every task except for intermediate task $i$ is of type 2, which will be a useful structural property. \begin{lemma}\label{lem:all2int} For any demand vector $\vec{v}$ with at least four non-zero entries, there is at most one task of type 1. \end{lemma} In order to prove Lemma~\ref{lem:all2int}, we will prove two structural lemmas. The following simple lemma is useful (but may at first appear unrelated). \begin{lemma}\label{lem:ss} Let $(\vec{v},\vec{v_1})$ be a pair of $(s,t_1)$-adjacent demand vectors with switching cost 2 and intermediate task $i_1$. Let $(\vec{v},\vec{v_2})$ be a pair of $(s,t_2)$-adjacent demand vectors with switching cost 2 and intermediate task $i_2$. Then it is \emph{not} the case that $s$, $i_1$, $t_1$, $i_2$, and $t_2$ are all distinct. \end{lemma} \begin{proof} Suppose by way of contradiction that $s$, $i_1$, $t_1$, $i_2$, and $t_2$ are all distinct. Table~\ref{tab3} depicts the proof. \begin{table}[h] \centering \begin{tabular}{c|c|c|c|c|c} &$\bm{s}$&$\bm{i_1}$&$\bm{t_1}$&$\bm{i_2}$&$\bm{t_2}$\\ \hline $\vec{\bm{v}}$&$a$&$b$&&$c$&\\ \hline $\vec{\bm{v_1}}$&&$a$&$b$&$c$&\\ \hline $\vec{\bm{v_2}}$&&$b$, not $a$&&&$c$\\ \end{tabular} \caption{Demand vectors and the corresponding assignment of agents.} \label{tab3} \end{table} With respect to $(\vec{v},\vec{v_1})$, let $a$ be the $(s,i_1)$-mobile agent and let $b$ be the $(i_1,t_1)$-mobile agent. Then $a$ and $b$ behave according to rows $\vec{v}$ and $\vec{v_1}$ of Table~\ref{tab3}. With respect to $(\vec{v},\vec{v_2})$, let $c$ be the $(i_2,t_2)$-mobile agent. Then $c$ behaves according to Table~\ref{tab3}. Since $i_1\not=s, i_2,t_2$, we know that $b$ is in the same position in $\vec{v}$ and $\vec{v_2}$. For the same reason, $a$ does not move to $i_1$ with respect to $(\vec{v},\vec{v_2})$, as shown in Table~\ref{tab3}. Comparing rows $\vec{v_1}$ and $\vec{v_2}$ in Table~\ref{tab3}, it is clear that $(\vec{v_1},\vec{v_2})$ have switching cost 3. Since $\vec{v_1}$ and $\vec{v_2}$ are adjacent, this is a contradiction. \end{proof} The following lemma is a weaker version of Lemma~\ref{lem:all2int}, which says that there is at least one task of type 2. \begin{lemma}\label{lem:one2} For any demand vector $\vec{v}$ with at least two non-zero entries, there is at least one task of type 2. \end{lemma} \begin{proof} Table~\ref{tab4} depicts the proof. \begin{table}[h] \centering \begin{tabular}{c|c|c|c|c} &$\bm{s_1}$&$\bm{s_2}$&$\bm{s_4}$&$\bm{s_5}$\\ \hline $\vec{\bm{v}}$&$a$&$b$&&\\ \hline $\vec{\bm{v_1}}$&&$b$&$a$&\\ \hline $\vec{\bm{v_2}}$&$a$&&&$b$\\ \hline $\vec{\bm{v_3}}$&$a$&&$b$&\\ \hline $\vec{\bm{v_4}}$&&$b$&&$a$\\ \hline \hline $\vec{\bm{v_5}}$ (case 1)&&&$a$&$b$\\ \hline $\vec{\bm{v_5}}$ (case 2)&&&$b$&$a$\\ \end{tabular} \caption{Demand vectors and the corresponding assignment of agents.} \label{tab4} \end{table} Suppose by way of contradiction that every task is of type 1 with respect to $\vec{v}$. That is, for all $\vec{v'}$ adjacent to $\vec{v}$, the pair $(\vec{v},\vec{v'})$ has switching cost 1. Let $s_1$, $s_2$, and $s_3$ be non-empty tasks with respect to $\vec{v}$ ($s_3$ is not shown in Table~\ref{tab4}). Let $s_4$ and $s_5$ be additional tasks. Let $\vec{v_1}$ be such that $(\vec{v},\vec{v_1})$ are $(s_1,s_4)$-adjacent with mobile agent $a$. Let $\vec{v_2}$ be such that $(\vec{v},\vec{v_2})$ are $(s_2,s_5)$-adjacent with mobile agent $b$. The assignments of agents $a$, $b$, and $c$ for vectors $\vec{v}$, $\vec{v_1}$, and $\vec{v_2}$ are shown in Table~\ref{tab4}. Let $\vec{v_3}$ be such that $(\vec{v},\vec{v_3})$ are $(s_2,s_4)$-adjacent. We know that $(\vec{v},\vec{v_3})$ has switching cost 1 but we do not know whether the mobile agent is $b$ or some other agent. Similarly, let $\vec{v_4}$ be such that $(\vec{v},\vec{v_4})$ are $(s_1,s_5)$-adjacent. We know that $(\vec{v},\vec{v_4})$ has switching cost 1 but we do not know whether the mobile agent is $a$ or some other agent. We claim that the mobile agent for $(\vec{v},\vec{v_4})$ is $a$, and symmetrically the mobile agent for $(\vec{v},\vec{v_3})$ is $b$, as shown in Table~\ref{tab4}. Suppose for contradiction that the mobile agent for $(\vec{v},\vec{v_4})$ is some agent $d\not=a$. Let $\vec{v_5}$ be such that $(\vec{v_1},\vec{v_5})$ are $(s_2,s_5)$-adjacent. Note that $\vec{v_5}$ is adjacent to both $\vec{v_4}$ and $\vec{v_2}$. $\vec{v_2}$ places agent $b$ (and not $d$) in task $s_5$, and $\vec{v_4}$ places agent $d$ (and not $b$) in task $s_5$. Then, since $\vec{v_5}$ can only place at most one of $b$ or $d$ in task $s_5$, $\vec{v_5}$ must disagree with either $\vec{v_2}$ or $\vec{v_4}$ on the assignment of \emph{both} $b$ and $d$. Also, $\vec{v_1}$ places agent $a$ in task $s_4$ while both $\vec{v_2}$ and $\vec{v_4}$ place agent $a$ in task $s_1$. Since $(\vec{v_1},\vec{v_5})$ are $(s_2,s_5)$-adjacent and have switching cost at most 2, agent $a$ cannot switch from task $s_4$ to task $s_1$ when the demand vector changes from $\vec{v_1}$ to $\vec{v_5}$. Thus, $\vec{v_5}$ disagrees with both $\vec{v_2}$ and $\vec{v_4}$ on the assignment of agent $a$. Thus, we have shown that $\vec{v_5}$ disagrees with either $\vec{v_2}$ or $\vec{v_4}$ on the assignment of $a$, $b$, and $d$, a contradiction. Therefore, the mobile agent for $(\vec{v},\vec{v_4})$ is $a$, as shown in Table~\ref{tab4}. By the same argument, the mobile agent for $(\vec{v},\vec{v_3})$ is $b$, as shown in Table~\ref{tab4}. Now, consider $(\vec{v_1},\vec{v_5})$, which are $(s_2,s_5)$-adjacent. We first claim that no agents besides $a$ and $b$ are mobile for $(\vec{v_1},\vec{v_5})$. Like the previous paragraph, Note that $\vec{v_5}$ is adjacent to both $\vec{v_4}$ and $\vec{v_2}$. Again, $\vec{v_2}$ places agent $b$ (and not $a$) in task $s_5$ and $\vec{v_4}$ places agent $a$ (and not $b$) in task $s_5$. Then, since $\vec{v_5}$ can only place at most one of $a$ or $b$ in task $s_5$, $\vec{v_5}$ must disagree with either $\vec{v_2}$ or $\vec{v_4}$ on the assignment of \emph{both} $a$ and $b$. Then since $\vec{v_1}$, $\vec{v_2}$, and $\vec{v_4}$ all agree on the assignment of every agent except $a$ and $b$, no other agent $c$ can be mobile for $(\vec{v_1},\vec{v_5})$, because then $\vec{v_5}$ would disagree with either $\vec{v_2}$ or $\vec{v_4}$ on the placement of agents $a$, $b$, and $c$. Thus, no agents besides $a$ and $b$ are mobile for $(\vec{v_1},\vec{v_5})$. Therefore, we have two cases: \subparagraph{Case 1: $(\vec{v_1},\vec{v_5})$ has switching cost 1.} In this case the only mobile agent for $(\vec{v_1},\vec{v_5})$ is $b$ as indicated in row $\vec{v_5}$ (case 1) of Table~\ref{tab4}. Table~\ref{tab4} shows that $(\vec{v_5},\vec{v_4})$ has switching cost 2 where $a$ is $(s_4,s_5)$-mobile and $b$ is $(s_5,s_2)$-mobile. Thus, with respect to $\vec{v_5}$, task $s_2$ is of type 2 with intermediate task $s_5$. Similarly, Table~\ref{tab4} shows that $(\vec{v_5},\vec{v_3})$ has switching cost 2 where $b$ is $(s_5,s_4)$-mobile and $a$ is $(s_4,s_1)$-mobile. Thus, with respect to $\vec{v_5}$, task $s_1$ is of type 2 with intermediate task $s_4$. We observe that the combination of the previous two paragraphs violates Lemma~\ref{lem:ss}. Recall that $s_3$ is a task that is non-empty for $\vec{v}$, and thus also $\vec{v_5}$. We apply Lemma~\ref{lem:ss} with parameters $(\vec{v}, s, t_1, t_2)=(\vec{v_5},s_3,s_2,s_1)$. Then, from the previous two paragraphs, the intermediate task for task $s_2$ is task $s_5$ and the intermediate task for task $s_1$ is task $s_4$, so $i_1$ and $i_2$ are tasks $s_5$ and $s_4$, respectively. Then $s$, $t_1$, $t_2$, $i_1$, and $i_2$ are all distinct, which violates Lemma~\ref{lem:ss}. \subparagraph{Case 2: $(\vec{v_1},\vec{v_5})$ has switching cost 2.} In this case for $(\vec{v_1},\vec{v_5})$, $b$ is $(s_2,s_4)$-mobile and $a$ is $(s_4,s_5)$-mobile, as indicated in row $\vec{v_5}$ (case 2) of Table~\ref{tab4}. Taking the reverse, $(\vec{v_5},\vec{v_1})$ has switching cost 2 where $a$ is $(s_5,s_4)$-mobile and $b$ is $(s_4,s_2)$-mobile. Thus, with respect to $\vec{v_5}$, task $s_2$ is of type 2 with intermediate task $s_4$. Similarly, Table~\ref{tab4} shows that $(\vec{v_5},\vec{v_2})$ has switching cost 2 where $b$ is $(s_4,s_5)$-mobile and $a$ is $(s_5,s_1)$-mobile. Thus, with respect to $\vec{v_5}$, task $s_1$ is of type 2 with intermediate task $s_5$. We observe that the combination of the previous two paragraphs violates Lemma~\ref{lem:ss}. We apply Lemma~\ref{lem:ss} with parameters $(\vec{v}, s, t_1, t_2)=(\vec{v_5},s_3,s_2,s_1)$. Then, from the previous two paragraphs, the intermediate task for task $s_2$ is task $s_4$ and the intermediate task for task $s_1$ is task $s_5$, so $i_1$ and $i_2$ are tasks $s_4$ and $s_5$ respectively. Then $s$, $t_1$, $t_2$, $i_1$, and $i_2$ are all distinct, which violates Lemma~\ref{lem:ss}. \end{proof} We are now ready to prove Lemma~\ref{lem:all2int}. \begin{lemma}[Restatement of Lemma~\ref{lem:all2int}]\label{lem:all2} For any demand vector $\vec{v}$ with at least four non-zero entries, there is at most one task of type 1. \end{lemma} \begin{proof} Suppose by way of contradiction that there are two type 1 tasks $t_1$, $t_1'$ with respect to $\vec{v}$. By Lemma~\ref{lem:one2}, there must be at least one type 2 task with respect to $\vec{v}$. Let $t_2$ be a type 2 task with respect to $\vec{v}$, choosing an empty task if possible. Let $i$ be the intermediate task for $t_2$ with respect to $\vec{v}$. Either $i\not=t_1$ or $i\not=t_1'$. Without loss of generality, suppose $i\not=t_1$. Let $s_1$ be a non-empty task with $s_1\not=i,t,t_2$. For the construction, we require an additional non-empty task $s_2$ with $s_2\not=s_1,i,t,t_2$. However, such a task might not exist since we are only assuming that $\vec{v}$ has at least four non-zero entries. We note that we cannot assume that $\vec{v}$ has at least five non-zero entries because Theorem~\ref{thm:3rr} only assumes that the total number of agents is at least four. Thus, the existence of $s_2$ is a technicality that is only important when the number of agents is exactly four. We will first assume that such a task $s_2$ exists and later we will show that $s_2$ must indeed exist. Table~\ref{tab5} depicts the proof. \begin{table}[h] \centering \begin{tabular}{c|c|c|c|c|c} &$\bm{s_1}$&$\bm{i}$&$\bm{t_1}$&$\bm{t_2}$&$\bm{s_2}$\\ \hline $\vec{\bm{v}}$&$a$&$b$&&&$c$\\ \hline $\vec{\bm{v_1}}$&&$a$&&$b$&$c$\\ \hline $\vec{\bm{v_2}}$&&$b$&$a$&&$c$\\ \hline $\vec{\bm{v_3}}$&&$c$&$a$&$b$&\\ \hline $\vec{\bm{v_4}}$&$a$&$b$, not $c$&&&\\ \end{tabular} \caption{Demand vectors and the corresponding assignment of agents.} \label{tab5} \end{table} Let $\vec{v_1}$ be such that $(\vec{v},\vec{v_1})$ are $(s_1,t_2)$-adjacent. Since $t_2$ is of type 2 with intermediate task $i$ with respect to $\vec{v}$, $(\vec{v},\vec{v_1})$ has switching cost 2 and intermediate task $i$. Let $a$ be the $(s,i)$-mobile agent and let $b$ be the $(i,t_2)$-mobile agent, as shown in Table~\ref{tab5}. Let $\vec{v_2}$ be such that $(\vec{v},\vec{v_2})$ are $(s_1,t_1)$-adjacent. Since $t_1$ is of type 1 with respect to $\vec{v}$, $(\vec{v},\vec{v_2})$ has switching cost 1. Thus, agents $b$ and $c$ are not mobile for $(\vec{v},\vec{v_3})$ as shown in Table~\ref{tab5}. If $a$ is the mobile agent for $(\vec{v},\vec{v_2})$ then $a$ is assigned to task $t_1$ for $\vec{v_2}$ and otherwise $a$ is assigned to task $s$. In either case, the assignment of both $a$ and $b$ differs between $\vec{v_2}$ and $\vec{v_1}$. Since $(\vec{v_1},\vec{v_2})$ are adjacent, they cannot differ on the assignment of any other agents besides $a$ and $b$. Thus, $(\vec{v_1},\vec{v_2})$ has $b$ as its $(t_2,i)$-mobile agent and $a$ as its $(i,t_1)$ mobile agent, as shown in Table~\ref{tab5}. Thus, with respect to $\vec{v_1}$, task $t_1$ is of type 2 with intermediate task $i$ and intermediate agent $a$. We have also shown that the mobile agent for $(\vec{v},\vec{v_2})$ is $a$. Let $\vec{v_3}$ be such that $(\vec{v_1},\vec{v_3})$ are $(s_2,t_1)$-adjacent. Since $t_1$ is of type 2 with intermediate task $i$ and intermediate agent $a$, $(\vec{v_1},\vec{v_3})$ has switching cost 2 and $a$ is the $(i,t_1)$-mobile agent. Let $c$ be the $(s_2,i)$-mobile agent for $(\vec{v_1},\vec{v_3})$. Then, $\vec{v_3}$ is as is in Table~\ref{tab5}. Let $\vec{v_4}$ be such that $(\vec{v},\vec{v_4})$ are $(s_2,t_1)$-adjacent. Since $t_1$ is of type 1 with respect to $\vec{v}$, $(\vec{v},\vec{v_4})$ has switching cost 1. Thus, neither $a$ nor $b$ are mobile agents for $(\vec{v},\vec{v_4})$, as shown in Table~\ref{tab5}. If $c$ is the mobile agent for $(\vec{v},\vec{v_4})$ then $\vec{v_4}$ assigns $c$ to task $t_1$ and otherwise $\vec{v_4}$ assigns $c$ to $s_2$. In either case, $\vec{v_4}$ does not assign $c$ to task $i$, as shown in Table~\ref{tab5}. We note that $(\vec{v_3},\vec{v_4})$ are $(t_2,s_1)$-adjacent, however according to Table~\ref{tab5}, $\vec{v_3}$ and $\vec{v_4}$ disagree on the assignment of $a$, $b$, and $c$, a contradiction. In the above construction, we assumed the existence of task $s_2$. It remains to show that there indeed exists a non-empty task $s_2$ with $s_2\not=s,i,t,t_2$. As mentioned previously, the existence of $s_2$ is a technicality that is only important when the number of agents is exactly four. Thus, the remainder of the proof merely addresses a technicality. Table~\ref{tab6} depicts the remainder of the proof. Suppose by way of contradiction that $s_1$, $i$, $t$, and $t_2$ are the only non-empty tasks in $\vec{v}$. Let $s'$ be an empty task. The task $t_2$ was initially chosen to be an \emph{empty} type 2 task if one exists. Since $t_2$ is non-empty, we know that $s'$ is of type 1. Let $\vec{v_1}$ be such that $(\vec{v},\vec{v_1})$ are $(s_1,t_2)$-adjacent. Since $t_2$ is of type 2 with intermediate task $i$ with respect to $\vec{v}$, $(\vec{v},\vec{v_1})$ has switching cost 2 and intermediate task $i$. For $(\vec{v},\vec{v_1})$, let $a$ be the $(s_1,i)$-mobile agent and let $b$ be the $(i,t_2)$-mobile agent, as shown in Table~\ref{tab6}. \begin{table}[h] \centering \begin{tabular}{c|c|c|c|c|c} &$\bm{s_1}$&$\bm{i}$&$\bm{t_1}$&$\bm{t_2}$&$\bm{s'}$\\ \hline $\vec{\bm{v}}$&$a$&$b$&$c$&&\\ \hline $\vec{\bm{v_1}}$&&$a$&$c$&$b$&\\ \hline $\vec{\bm{v_2}}$&$a$&$b$&&&$c$\\ \hline $\vec{\bm{v_3}}$&&$b$&$c$&&$a$\\ \hline $\vec{\bm{v_4}}$&&&&$b$&$a$, not $c$\\ \end{tabular} \caption{Demand vectors and the corresponding assignment of agents.} \label{tab6} \end{table} Let $\vec{v_2}$ be such that $(\vec{v},\vec{v_2})$ are $(t,s')$-adjacent. Since $s'$ is of type 1 with respect to $\vec{v}$, $(\vec{v},\vec{v_2})$ has switching cost 1. Let $c$ be the mobile agent for $(\vec{v},\vec{v_2})$ as shown in Table~\ref{tab6}. Let $\vec{v_3}$ be such that $(\vec{v},\vec{v_3})$ are $(s_1,s')$-adjacent. Since $s'$ is of type 1 with respect to $\vec{v}$, $(\vec{v},\vec{v_3})$ has switching cost 1. Thus, agents $b$ and $c$ are not mobile for $(\vec{v},\vec{v_3})$ as shown in Table~\ref{tab6}. If $a$ is the mobile agent for $(\vec{v},\vec{v_3})$ then $a$ is assigned to task $s'$ for $\vec{v_3}$ and otherwise $a$ is assigned to task $s$. In either case, the assignment of both $a$ and $b$ differs between $\vec{v_3}$ and $\vec{v_1}$. Since $(\vec{v_1},\vec{v_3})$ are adjacent, they cannot differ on the assignment of any other agents besides $a$ and $b$. Thus, $(\vec{v_1},\vec{v_3})$ has $b$ as its $(t_2,i)$-mobile agent and $a$ as its $(i,s')$ mobile agent, as shown in Table~\ref{tab6}. Thus, with respect to $\vec{v_1}$, task $s'$ is of type 2 with intermediate task $i$ and intermediate agent $a$. We have also shown that the mobile agent for $(\vec{v},\vec{v_3})$ is $a$. Let $\vec{v_4}$ be such that $(\vec{v_1},\vec{v_4})$ are $(t_1,s')$-adjacent. Since task $s'$ is of type 2 with intermediate task $i$ and intermediate agent $a$ with respect to $\vec{v_1}$, $(\vec{v_1},\vec{v_4})$ have switching cost 2 and intermediate task $i$ and $(i,s')$-mobile agent $a$. Regardless of the $(t_1,i)$-mobile agent for $(\vec{v_1},\vec{v_4})$, agent $c$ is not assigned to task $s'$ for $\vec{v_4}$, as shown in Table~\ref{tab6}. We note that $(\vec{v_2},\vec{v_4})$ are $(s_1,t_2)$-adjacent, however according to Table~\ref{tab6} they disagree on the assignment of $a$, $b$, and $c$, a contradiction. \end{proof} We are now ready to prove Lemma~\ref{lem:ind}. \begin{lemma}[restatement of Lemma~\ref{lem:ind}]\label{lem:indre} Let $\vec{v}$ be a demand vector with at least four non-zero entries. Then there exists a task $t$ such that $t$ is of type 2 with respect to $\vec{v}$ and $\vec{v}$ has at least four non-empty tasks distinct from $t$. Let $i$ be the intermediate task of $t$ with respect to $\vec{v}$. Let $\vec{v'}$ be such that $(\vec{v},\vec{v'})$ are $(i,t)$-adjacent. Then, $t$ is a type 2 task with intermediate task $i$ with respect to $\vec{v'}$. \end{lemma} \begin{proof} First we will show that there exists a task $t$ such that $t$ is of type 2 with respect to $\vec{v}$ and $\vec{v}$ has at least four non-empty tasks distinct from $t$. By Lemma~\ref{lem:one2}, there exists a task of type 2 with respect to $\vec{v}$. Suppose for contradiction that every such task $t'$ is such that $\vec{v}$ has less than four non-empty tasks distinct from $t'$. Then, every empty task is of type 1, because if there were an empty task $t''$ of type 2 then $\vec{v}$ would have at least four non-empty tasks distinct from $t''$ since $\vec{v}$ has at least four non-zero entries. By Lemma~\ref{lem:tech}, task $i$ is of type 1 with respect to $\vec{v}$. Since $i$ is an intermediate task with respect to $\vec{v}$, $i$ is non-empty. Then, by Lemma~\ref{lem:all2int} $i$ is the only type 1 task with respect to $\vec{v}$. Thus, we have shown that every empty task is of type 1 and there are no empty type 1 tasks, so \emph{every} task is non-empty with respect to $\vec{v}$. Then since there are at least 5 tasks total, there are at least four non-empty tasks distinct from $t'$, a contradiction. Now, we will show that $t$ is a type 2 task with intermediate task $i$, with respect to $\vec{v'}$. Since $\vec{v}$ has at least four non-empty tasks excluding task $t$, $\vec{v'}$ has at least four non-zero entries. Thus, we can apply Lemma~\ref{lem:all2} to $\vec{v'}$. We claim that task $i$ is of type 1 with respect to $\vec{v'}$. The proof of this claim is simple and is depicted in Table~\ref{tab7}. \begin{table}[h] \centering \begin{tabular}{c|c|c|c} &$\bm{s}$&$\bm{i}$&$\bm{t}$\\ \hline $\vec{\bm{v}}$&$a$&$b$\\ \hline $\vec{\bm{v'}}$&$a$&&$b$\\ \hline $\vec{\bm{v_1}}$&&$a$&$b$\\ \end{tabular} \caption{Demand vectors and the corresponding assignment of agents.} \label{tab7} \end{table} By Lemma~\ref{lem:sw1}, $(\vec{v},\vec{v'})$ have switching cost 1. Let $b$ be the mobile agent for $(\vec{v},\vec{v'})$, as shown in Table~\ref{tab7}. Let $s$ be a task with $s\not=i,t$. Let $\vec{v_1}$ be such that $(\vec{v},\vec{v_1})$ are $(s,t)$-adjacent. Since task $t$ is of type 2 with respect to $\vec{v}$, $(\vec{v},\vec{v_1})$ has switching cost 2 and intermediate task $i$. Let $a$ be the $(s,i)$-mobile agent, as shown in Table~\ref{tab7}. If the $(i,t)$-mobile agent for $(\vec{v},\vec{v_1})$ is some agent $c\not=b$, then $\vec{v'}$ and $\vec{v_1}$ disagree on the position of $a$, $b$, and $c$, which is impossible since $(\vec{v'},\vec{v_1})$ are adjacent. Thus, $b$ is the $(i,t)$-mobile agent for $(\vec{v},\vec{v_1})$ as shown in Table~\ref{tab7}. From Table~\ref{tab7}, it is clear that $(\vec{v'},\vec{v_1})$ are $(s,i)$-adjacent and have switching cost 1, and $(\vec{v'},\vec{v})$ are $(t,i)$-adjacent and have switching cost 1. Thus, $i$ is of type 1 with respect to $\vec{v'}$. By Lemma~\ref{lem:all2}, task $i$ is the only task of type 1 with respect to $\vec{v'}$, so task $t$ is of type 2. It remains to show that task $t$ has intermediate task $i$ with respect to $\vec{v'}$. If task $t$ has a different intermediate task $i'$ with respect to $\vec{v'}$, then by Lemma~\ref{lem:tech}, task $i'$ is of type 1 with respect to $\vec{v'}$, but we already know that task $i$ is the only task of type 1 with respect to $\vec{v'}$. Thus, task $t$ has intermediate task $i$ with respect to $\vec{v'}$. \end{proof} \section{Acknowledgments} We would like to thank Yufei Zhao for a discussion.
\section{Introduction} The word ``triangle'' can have two different meanings: a curve (Ptolemy, Gauss, M\"obius, Study) or a surface (Schwarz, Klein). In this paper we use it in the sense of Schwarz and Klein. The references for the space of Gauss-Study triangles are \cite{Chisholm,Study}. Spherical triangles with arbitrarily large interior angles and sides occur in the study of spherical metrics with conic singularities which recently attracted substantial attention, \cite{E,EGT1,EGT2,EMP,MP1,FKKRUY}. Here we describe topology of the space of all such triangles. A spherical triangle $\Delta$ is a closed oriented disk with three distinct marked boundary points ({\em corners}) $a_1,a_2,a_3$ equipped with a Riemannian metric of constant curvature $1$ with conic singularities with interior angles $\pi\alpha_i$ at $a_i$ and such that the {\em sides} $(a_i,a_{i+1})$ are geodesic. Two such triangles $\Delta$ and $\Delta'$ are considered equal if there is an orientation-preserving isometry $\Delta\to \Delta'$ mapping corners to corners and preserving the labels. We always assume that the cyclic order $(a_1,a_2,a_3)$ is consistent with the positive orientation of $\partial\Delta$. A {\em developing map} $f:\Delta\to\bC$ is associated with each triangle $\Delta$. Here $\bC$ is the Riemann sphere with the standard Riemannian metric of curvature $1$. The {\em side lengths} of $\Delta$ are the lengths of the images of the sides $f([a_i,a_{i+1}])$, counting multiplicity. So the angles and side lengths of $\Delta$ are positive numbers. A spherical triangle is completely determined by these six positive numbers, the angles and side lengths. This defines the topology, induced from $\R^6$, on the set of all spherical triangles. We measure the angles in half-turns instead of radians, thus ``an integer angle'' means an integer multiple of $\pi$ radians. Similarly, the side lengths are measured so that the length of a great circle is 2. We use notation $(A,B,C)$ for the interior angles of a triangle at its corners $(\A,\B,\C)=(a_1,a_2,a_3)$, and $(a,b,c)$ for the lengths of its sides opposite the corners with angles $(A,B,C)$. The following characterization of angles of spherical triangles was proved in~\cite{E}. \vspace{.1in} \noindent{\bf Theorem A.} {\rm\bf(i)} \emph{If three positive numbers $(A,B,C)$ are not integers, then they are the angles of a spherical triangle if and only if} \begin{equation}\label{cond1} \cos^2\pi A+\cos^2\pi B+\cos^2\pi C+2\cos\pi A\cos\pi B\cos\pi C-1<0. \end{equation} \emph{A triangle with such angles is unique.} \vspace{.1in} \noindent {\rm\bf(ii)} \emph{If exactly one of the angles $(A,B,C)$, say $A$, is an integer then a triangle with these angles exists if and only if either $B+C$ or $|B-C|$ is an integer $m$ of the opposite parity to $A$, and} \begin{equation}\label{b1} m\leq A-1. \end{equation} \emph{For any such angles, a one-parametric family of triangles with these angles exists. The length of the side opposite the integer corner is an integer, while the length of the side opposite to one of the non-integer corners is not an integer, and its fractional part can be chosen as a parameter.}\footnote{In \cite{E} it was erroneously stated that in this case the triangle with given angles is unique. The mistake was corrected in \cite{FKKRUY}.} \vskip .1in \noindent {\rm\bf(iii)} \emph{If two angles are integers then all three are integers, and in this case a triangle with the angles $(A,B,C)$ exists if and only if $A+B+C$ is odd, and} \begin{equation}\label{b2} \max(A,B,C)\leq (A+B+C-1)/2. \end{equation} \emph{There is a two-parametric family of triangles with such angles: any two side lengths can be chosen as parameters. The ranges for the side lengths depend on the angles and will be specified in Section \ref{neighbor} below.} \vskip.1in \begin{remark}\label{rmk:A} \emph{Inequality (\ref{cond1}) is equivalent to} \begin{equation}\label{cond2} \cos\pi\,\frac{A\!+\!B\!+\!C}{2}\,\cos\pi\,\frac{A\!+\!B\!-\!C}{2}\,\cos\pi\,\frac{A\!+\!C\!-\!B}{2} \,\cos\pi\,\frac{\!B\!+\!C\!-\!A}{2}<0. \end{equation} \emph{Yet another illuminating form of this inequality was discovered in \cite{MP1}:} \begin{equation}\label{cond3} d_1\left((A,B,C),\Z_e^3\right)>1, \end{equation} \emph{where $\Z_e^3$ is the sublattice of $\Z^3$ consisting of points with even sum of coordinates, and $d_1\big((A,B,C),(M,N,K)\big)=|A-M|+|B-N|+|C-K|$.} \end{remark} We use Theorem A to describe the space $\X\subset\R^6$ of all spherical triangles: \begin{theorem}\label{main} The space $\X$ of all spherical triangles is a smooth, connected, orientable real analytic $3$-manifold, homotopy equivalent to the 1-skeleton of a cubic partition of the closed first octant of $\R^3$. The angles and side lengths of triangles, which define the embedding of $\X$ to $\R^6$, are smooth (real analytic) functions on $\X$. \end{theorem} The plan of the paper is as follows. In Section \ref{angles} we describe the set $X\in\R^3$ of all possible triples $(A,B,C)$ of angles of spherical triangles in $\X$. The set $X$ is the union of open tetrahedra $T_{m,n,k}$, where $(m,n,k)\in\N^3$, some of their open edges, and some of their vertices. In Section \ref{edgesandvertices} we describe the edges and vertices of the tetrahedra $T_{m,n,k}$ belonging to $X$. An important difference appears between {\em balanced} (satisfying the triangle inequality (\ref{balanced})) and {\em unbalanced} triangles. This terminology was proposed in \cite{EMP}, see also \cite{EGMP}. In particular, only balanced vertices of the tetrahedra $T_{m,n,k}$ belong to $X$. In Section \ref{neighbor} we define the neighborhoods $\U_{m,n,k}\in\X$, homeomorphic to open balls in $\R^3$, of the sets of triangles in $\X$ corresponding to the balanced vertices $(m,n,k)\in X$. The union $\U$ of these neighborhoods is the set of all {\em short-sided} triangles (with all three sides shorter than the full circle, see Definition \ref{short}). All balanced triangles are short-sided. The covering of $\U$ by the charts $\U_{m,n,k}$ defines the structure of an oriented three-dimensional manifold on $\U$. In Section \ref{semibalanced} we define the charts $\S_{m,n,k}\subset\X$, where either $m-1=n+k$ or $n-1=m+k$ or $k-1=m+n$, corresponding to {\em semi-balanced} edges in $X$ (see Definition \ref{balancededges}). Together with the charts $\U_{m,n,k}$, this defines a covering of the whole set $\X$, defining the structure of an oriented three-dimensional manifold on $\X$. In Section \ref{homotopy} we show that the set $\X$ is homotopy equivalent to the 1-skeleton of a cubic partition of the closed first octant of $\R^3$. The same is true for the set $\U\subset\X$ of short-sided triangles, and for the set $\mathcal B\subset\U$ of balanced triangles. \vspace{.1in} We thank Dmitri Panov for discussions of spherical triangles; he explained to us their relevance for description of spherical metrics on tori, and stressed the importance of the balanced condition (\ref{balanced}). \section{Angles of spherical triangles}\label{angles} According to Theorem A, the set $X$ of possible triples $(A,B,C)$ of the angles of spherical triangles consists of three parts: the open set $X_3$ described in (i), the one-dimensional set $X_1$ described in (ii) and the set of isolated points $X_0$ described in (iii). We have $X_3=Y_3\cap\R_{>0}^3$ where $Y_3$ is invariant under the group $G$ (see \cite{E}) consisting of transformations $$(A,B,C)\mapsto (\pm A+M,\pm B+N,\pm C+K),\;\mbox{where}\;(M,N,K)\in\Z^3_e.$$ The interior of a fundamental region of $G$ can be described by the inequalities \begin{equation}\label{in1} A>0,\; B>0,\; C>0,\; A+B<1,\; A+C<1,\; B+C<1. \end{equation} The intersection of $X_3$ with the region (\ref{in1}) is described by the additional inequality \begin{equation}\label{in2} A+B+C>1. \end{equation} Conditions (\ref{in1}) and (\ref{in2}) define an open tetrahedron $\nabla$ with vertices $(1,0,0)$, $(0,1,0)$, $(0,0,1)$, $(\frac12,\frac12,\frac12)$. Three transformations of the group $G$, \begin{equation}\label{g1} \begin{split} (A,B,C)\mapsto(A,1-B,1-C),\\(A,B,C)\mapsto(1-A,B,1-C),\\(A,B,C)\mapsto(1-A,1-B,C), \end{split} \end{equation} map the tetrahedron $\nabla$ onto three disjoint tetrahedra, each having a common facet with $\nabla$. The union of these four tetrahedra, with their common facets, the vertex $(\frac12,\frac12,\frac12)$, and four edges adjacent to that vertex, is an open tetrahedron $T_0$ with the vertices $(1,0,0)$, $(0,1,0)$, $(0,0,1)$, $(1,1,1)$, which is called a truncated cube in \cite{MP1}. The subgroup $G_0$ of $G$ preserving $T_0$ consists of the identity and transformations (\ref{g1}). It is the Klein Viergroup isomorphic to $\Z_2\times \Z_2$. The group $G_1$ consisting of transformations $(A,B,C)\mapsto \pm(A,B,C)+(M,N,K)$, where $(M,N,K)\in\Z^3_e$, is a normal subgroup of $G$ such that $G/G_1=G_0$. The interior of a fundamental region of $G_1$ is the open unit cube $0<A<1,\;0<B<1,\;0<C<1$. Thus $G_1$ maps $T_0$ to one tetrahedron $T_{m,n,k}$ in each unit cube $$Q_{m,n,k}=\{ m< A< m+1,\; n< B< n+1,\; k< C< k+1,\quad (m,n,k)\in\Z^3\}.$$ The group $G_2$ of translations $(A,B,C)\mapsto(A+M,B+N,C+K)$ with $(M,N,K)\in\Z^3_e$ is a normal subgroup of $G_1$, and $G_1/G_2$ is generated by any involution $(A,B,C)\mapsto(M-A,N-B,K-C)$, where $(M,N,K)\in\Z^3_e$, mapping $T_{0,0,0}$ to $T_{M-1,N-1,K-1}$. Vertices of the tetrahedra $T_{m,n,k}$ belong to the set $\Z^3_o\subset\Z^3$ of integer points with odd sum of coordinates. The set $X_3$ is the union of the tetrahedra $T_{m,n,k}$ with $(m,n,k)\in\N^3$. Two tetrahedra in adjacent unit cubes have a common edge (which may belong or not belong to $X_1$). Since three of the four vertices of $T_0$ have the same sum of angles $A+B+C=1$, three vertices of each tetrahedron $T_{m,n,k}$ have the same sum, either $m+n+k+1$ or $m+n+k+2$ when $m+n+k$ is even or odd. It follows from (\ref{cond3}) that the points $(A,B,C)$ of open facets of any tetrahedron $T_{m,n,k}$ never correspond to spherical triangles, since the angles $A,B,C$ are non-integer and $d_1\big((A,B,C),\Z_e^3\big)=1$ at these points. \begin{notation}\label{denote}\emph{ We denote by $\V_{m,n,k}\subset\X$ the set of triangles with the angles $(m,n,k)\in\Z^3_o$ corresponding to a vertex $(m,n,k)\in X_0$. If $L\subset X_1$ is an open edge of a tetrahedron $T_{m,n,k}$, we denote by $\L_{u,v,w}\subset\X$ the set of triangles corresponding to $L$, where $(u,v,w)$ is the midpoint of $L$. For example, $\L_{1,\frac12,\frac12}$ is the set of triangles with the angles $A=1,\;0<B<1,\;0<C<1$ corresponding to the edge $L=\big((1,0,0),(1,1,1)\big)$ of $T_0$.} \end{notation} \section{Edges and vertices of the tetrahedra $T_{m,n,k}$}\label{edgesandvertices} To see which edges and vertices of the tetrahedra $T_{m,n,k}$ correspond to spherical triangles, we use inequalities (\ref{b1}) and (\ref{b2}). If all three angles $A,B,C$ are integer then $A+B+C$ is odd, and inequality (\ref{b2}) implies the triangle inequality \begin{equation}\label{balanced} A\le B+C,\quad B\le A+C,\quad C\le A+B. \end{equation} Inequalities (\ref{balanced}) define a closed cone $\K$ in the first octant bounded by the planes $A=B+C,\; B=A+C,\; C=A+B$. The edges of $\K$ are three rays $\{A=B,\;C=0\}$, $\{A=C,\;B=0\}$, $\{B=C,\;A=0\}$. Klein calls spherical triangles with the angles satisfying (\ref{balanced}) ``triangles of the first kind.'' We prefer to call them {\em balanced} following Mondello and Panov. \begin{definition}\label{balancededges}{\rm A point $(A,B,C)$ in the first octant satisfying the inequality (\ref{balanced}) is called \emph{balanced}, otherwise it is \emph{unbalanced}. A tetrahedron $T_{m,n,k}$ is \emph{balanced} if all its vertices are balanced, \emph{unbalanced} if all its vertices are unbalanced, and \emph{semi-balanced} otherwise. An open edge $L\in X_1$ of a tetrahedron $T_{m,n,k}$ is \emph{balanced} if both its ends are balanced vertices, \emph{unbalanced} if both its ends are unbalanced vertices, and \emph{semi-balanced} otherwise. An unbalanced end $(m,n,k)\in\Z_o$ of a semi-balanced edge is called a \emph{marginally unbalanced} vertex. Its angles satisfy either $m-1=n+k$ or $n-1=m+k$ or $k-1=m+n$.} \end{definition} \begin{remark}\label{rmk:balanced}{\rm Theorem A (iii) says that $X_0=\K\cap\Z^3_o$, thus $X_0$ is the set of all balanced vertices. Note that balanced vertices do not belong to coordinate planes, since (\ref{balanced}) implies $B=C$ when $A=0$, thus $(A,B,C)\notin\Z_o$. All triangles corresponding to a balanced edge are balanced, all triangles corresponding to an unbalanced edge are unbalanced. Triangles corresponding to the points of a semi-balanced edge $L$ between its balanced vertex and midpoint (including the midpoint) are balanced, triangles corresponding to the points of $L$ beyond its midpoint are unbalanced. It is shown below that a semi-balanced tetrahedron in $X_3$ may be either {\em pointed}, with three edges in $X_1$ meeting at a vertex $V\in X_0$, or {\em not pointed}, with two opposite edges in $X_1$. All balanced tetrahedra are pointed, and all unbalanced tetrahedra are not pointed. The set of balanced triangles in a semi-balanced tetrahedron is described in Proposition \ref{balanced-mnk} below.} \end{remark} To determine which edges of the tetrahedra $T_{m,n,k}$ belong to $X_1$, we consider the edges of eight tetrahedra with a common vertex $(m,n,k)\in\Z_o^3\cap\R^3_{>0}$. The edges meeting at $(m,n,k)$ are of two types: those on which the sum $A+B+C$ is constant ({\em first type}) and those on which it is not ({\em second type}). An edge $L$ of the second type is {\em upward} with respect to the vertex $(m,n,k)$ if $A+B+C>m+n+k$ on $L$ and {\em downward} otherwise. It follows from Theorem A (ii) that all edges of the first type belonging to $X_1$ are unbalanced. \vspace{.1in} {\bf Edges adjacent to a balanced vertex.} Let $V=(m,n,k)\in X_0$ be a balanced vertex. Then edges of the first type adjacent to $V$ do not belong to $X_1$, while six edges of the second type belong to $X_1$: three upward edges from $V$ to $(m,n+1,k+1)$, $(m+1,n,k+1)$ and $(m+1,n+1,k)$, and three downward edges from $V$ to $(m,n-1,k-1)$, $(m-1,n,k-1)$ and $(m-1,n-1,k)$. There are four upward (with $A+B+C>m+n+k$) and four downward (with $A+B+C<m+n+k$) tetrahedra adjacent to $V$. This is summarized in the following statement. \begin{prop}\label{sixedges} Six edges of the second type adjacent to a balanced vertex $V=(m,n,k)$ (three upward and three downward) belong to $X_1$. All upward edges adjacent to $V$ are balanced. Tetrahedra $T_{m,n,k}$ and $T_{m-1,n-1,k-1}$ adjacent to $V$ are pointed. Each of them has three edges in $X_1$ adjacent to $V$. Each of the remaining six tetrahedra adjacent to $V$ has exactly one edge $(V,V')$ in $X_1$ adjacent to $V$, common either with $T_{m,n,k}$ or with $T_{m-1,n-1,k-1}$. If the edge $(V,V')$ is balanced, the tetrahedron is pointed, having two more edges in $X_1$ adjacent to $V'$. Otherwise, the tetrahedron is not pointed and has two opposite edges in $X_1$. \end{prop} {\bf Edges adjacent to an unbalanced vertex.} Let $V=(m,n,k)\in\Z^3_o\cap\R^3_{>0}$ be an unbalanced vertex such that $m+n\leq k-1$. Then $V\notin X_0$, and the edges meeting at $V$ belong to $X_1$ if and only if $C=k$ on those edges: the edges of the first type from $V$ to $(m-1,n+1,k)$ and to $(m+1,n-1,k)$, and the edges of the second type from $V$ to $(m+1,n+1,k)$ and to $(m-1,n-1,k)$. Therefore exactly four of the twelve edges meeting at $V$ belong to $X_1$. Each of these four edges is common to two tetrahedra adjacent to $V$, so there are four pairs of these tetrahedra. Two of these pairs, $(T_{m-1,n,k-1},T_{m-1,n,k})$ and $(T_{m,n-1,k-1},T_{m,n-1,k})$, have common edges of the first type (see Fig.~\ref{edges-type1} for $m+n<k-1$ and Fig.~\ref{semibalanced-type1} for $m+n=k-1$). Two other pairs, $(T_{m-1,n-1,k-1},T_{m-1,n-1,k})$ and $(T_{m,n,k-1},T_{m,n,k})$, have common edges of the second type (see Fig.~\ref{edges-type2} and Fig.~\ref{semibalanced-type2}). If $m+n<k-1$ then all eight tetrahedra are unbalanced, and each of them has two opposite edges in $X_1$. If $m+n=k-1$ then vertices $(m+1,n+1,k)$, $(m,n+1,k-1)$ and $(m+1,n,k-1)$, shown as black dots in Fig.~\ref{semibalanced-type1} and Fig.~\ref{semibalanced-type2}, are balanced. All other vertices of the tetrahedra adjacent to $V$ are unbalanced. The tetrahedron $T_{m,n,k-1}$ in Fig.~\ref{semibalanced-type2} is pointed, with three edges in $X_1$ meeting at its vertex $(m+1,n+1,k)$. Each of the other seven tetrahedra in Fig.~\ref{semibalanced-type1} and Fig.~\ref{semibalanced-type2} has two opposite edges in $X_1$. This is summarized in the following statement. \begin{prop}\label{fouredges} If $V=(m,n,k)\in\Z^3_o\cap\R^3_{>0}$ is an unbalanced vertex then four edges adjacent to $V$, the angle $\max(m,n,k)$ being constant on those edges, belong to $X_1$. Two of these edges are of the second type (one upward and one downward) and the other two are of the first type. If $V$ is marginally unbalanced then there are four semi-balanced and four unbalanced tetrahedra adjacent to $V$. Two of the semi-balanced tetrahedra, one of them pointed and another one not pointed, have a common semi-balanced upward edge in $X_1$ adjacent to $V$. The other two semi-balanced tetrahedra are not pointed, have no common edges, and their edges adjacent to $V$ are unbalanced, of the first type. If $V$ is not marginally unbalanced, all eight tetrahedra adjacent to $V$ are unbalanced. \end{prop} \begin{remark}\label{edges-unbalanced}{\em Note that every unbalanced edge in $X_1$ is an edge of at least one unbalanced tetrahedron. Each of the unbalanced edges in Fig.~\ref{edges-type1} - Fig.~\ref{semibalanced-type2} belongs to an unbalanced tetrahedron shown in those figures, except the edge $\big((m,n+1,k+1),(m+1,n,k+1)\big)$ in Fig.~\ref{semibalanced-type2} which is common to a semi-balanced tetrahedron $T_{m,n,k}$ and an unbalanced tetrahedron $T_{m,n,k+1}$ with the vertices $(m,n,k+2)$ and $(m+1,n+1,k+2)$ not shown in Fig.~\ref{semibalanced-type2}.} \end{remark} \section{Neighborhoods of balanced vertices}\label{neighbor} \begin{figure} \centering \includegraphics[width=4.5in]{edges-type1.eps} \caption{Tetrahedra adjacent to edges in $X_1$ of the first type meeting at a vertex $(m,n,k)$ with $m+n<k-1$. Edges in $X_1$ are shown in bold line.}\label{edges-type1} \bigskip \includegraphics[width=4.5in]{edges-type2.eps} \caption{Tetrahedra adjacent to edges in $X_1$ of the second type meeting at a vertex $(m,n,k)$ with $m+n<k-1$. Edges in $X_1$ are shown in bold line.}\label{edges-type2} \end{figure} \begin{figure} \centering \includegraphics[width=4.4in]{semibalanced-type1.eps} \caption{Tetrahedra adjacent to edges in $X_1$ of the first type meeting at a marginally unbalanced vertex $(m,n,k)$ with $m+n=k-1$. Balanced vertices are shown as black dots.}\label{semibalanced-type1} \bigskip \includegraphics[width=4.4in]{semibalanced-type2.eps} \caption{Tetrahedra adjacent to edges in $X_1$ of the second type meeting at a marginally unbalanced vertex $(m,n,k)$ with $m+n=k-1$. Balanced vertices are shown as black dots.}\label{semibalanced-type2} \end{figure} \begin{figure} \centering \includegraphics[width=5.4in]{triangles-111up.eps} \caption{Triangles with $A+B+C>3$ in a neighborhood $U$ of the vertex $(1,1,1)$. When two sides of a triangle are mapped to the same circle, that circle is shown in dual color/style.}\label{up} \end{figure} \begin{figure} \centering \includegraphics[width=5.4in]{triangles-111down.eps} \caption{Triangles with $A+B+C<3$ in a neighborhood $U$ of the vertex $(1,1,1)$. When two sides of a triangle are mapped to the same circle, that circle is shown in dual color/style.}\label{down} \end{figure} \begin{figure} \centering \includegraphics[width=4.3in]{111ab.eps} \caption{The upward (a) and downward (b) tetrahedra adjacent to the vertex $(1,1,1)$ in Lemma \ref{111}. Edges in $X_1$ are shown in bold line.}\label{000} \vskip.1in \includegraphics[width=4.5in]{pqr.eps} \caption{The sets $\Lambda_0$ and $\Lambda_1$ of balanced vertices and edges in $\R^3_{p,q,r}$.}\label{cubic} \end{figure} In this section we define a covering of the set $\U$ of short-sided triangles (see Definition \ref{short} below) by the open neighborhoods $\U_{m,n,k}$ (see Notation \ref{umnk}) of the sets $\V_{m,n,k}$ of triangles corresponding to balanced vertices $(m,n,k)$. Each set $\U_{m,n,k}$ is homeomorphic to an open ball in $\R^3$. \begin{lemma}\label{111} Let $U\subset\X$ be the union of the sets of triangles corresponding to the vertex $V=(1,1,1)$, edges in $X_1$ meeting at $V$, and tetrahedra in $X_3$ adjacent to $V$. Then $U$ is an open neighborhood of the set $\V_{1,1,1}$ in $\X$ consisting of all triangles with the angles $A,B,C$ satisfying the inequalities \begin{equation}\label{abc} 0<A<2,\quad 0<B<2,\quad 0<C<2. \end{equation} In addition, the angles and side lengths of triangles in $U$ satisfy \begin{equation}\label{in4} 1<A+B+C<5,\quad a<2,\quad b<2,\quad c<2, \end{equation} with at most one side length being $\ge 1$. \end{lemma} \begin{proof} It follows from Section \ref{angles} that the union of the vertex $V$, edges in $X_1$ meeting at $V$ and tetrahedra in $X_3$ adjacent to $V$ coincides with the intersection of the set $X$ with the open cube $(0,2)^3$ defined by the inequalities (\ref{abc}). Thus $U$ is the preimage of $X\cap (0,2)^3$ in $\X$, which is an open neighborhood in $\X$ of the preimage $\V_{1,1,1}$ of $V$. Each triangle corresponding to $V$ is a hemisphere with three distinct marked points $(\A,\B,\C)$ at the boundary. The set $\V_{1,1,1}$ of these triangles can be parametrized by any two of the side lengths $(a,b,c)$, since $a+b+c=2$. There are six edges in $X_1$ meeting at $V$ (see Proposition \ref{sixedges}). Three upward edges connect $V$ with the balanced vertices $(1,2,2)$, $(2,1,2)$ and $(2,2,1)$, and three downward edges connect it with the unbalanced vertices $(1,0,0)$, $(0,1,0)$ and $(0,0,1)$. Triangles in $\L_{\frac32,1,\frac32}$ (see Fig.~\ref{up}b) corresponding to the upward edge from $V$ to $(2,1,2)$ have the angles $1<A=C<2,\;B=1$ and side lengths $a+c=1,\;b=1$. The set $\L_{\frac32,1,\frac32}$ can be parametrized by the angle $A$ and either $a$ or $c$. The limits of these triangles in $\V_{1,1,1}$ have the side lengths $a+c=1,\;b=1$. This edge is common to the tetrahedra $T_{1,0,1}$ and $T_{1,1,1}$. Triangles corresponding to these two tetrahedra are shown in Fig.~\ref{up}a and Fig.~\ref{up}d. The angles of triangles in $T_{1,0,1}$ satisfy the inequalities $1<A<2$, $1<C<2$, $B<1$, $3<A+B+C<5$, and the side lengths are $1<b<2$, $a<1$, $c<1$, $a+b+c>2$. The limits of these triangles in $\V_{1,1,1}$ have side lengths $1\le b<2$, $a+c=2-b\le 1$. The angles of triangles in $T_{1,1,1}$ satisfy the inequalities $1<A<2$, $1<B<2$, $1<C<2$, $A+B+C<5$, and the side lengths are $a<1$, $b<1$, $c<1$, $a+b+c<2$. The limits of these triangles in $\V_{1,1,1}$ have all side lengths $\le 1$. Both tetrahedra are pointed: $T_{1,1,1}$ has three edges in $X_1$ meeting at $V$, and $T_{1,0,1}$ has three edges in $X_1$ meeting at $(2,1,2)$ (see Fig.~\ref{000}a). Triangles corresponding to the edges from $V$ to $(2,2,1)$ and $(1,2,2)$ are shown in Fig.~\ref{up}c and Fig.~\ref{up}e. They have the angles $1<A=B<2,\;C=1$ and $1<B=C<2,\;A=1$, respectively, and side lengths satisfying $a+b=1,\;c=1$ (resp., $b+c=1,\;a=1$). The limits of these triangles in $\V_{1,1,1}$ have the side lengths $a+b=1,\;c=1$ (resp., $b+c=1,\;a=1$). These two edges are common for $T_{1,1,1}$ and the tetrahedra $T_{1,1,0}$ and $T_{0,1,1}$, respectively. Triangles corresponding to these two tetrahedra are shown in Fig.~\ref{up}f and Fig.~\ref{up}g. Triangles in $\L_{\frac12,1,\frac12}$ (see Fig.~\ref{down}b) corresponding to the downward edge from $V$ to $(0,1,0)$ have the angles $0<A=C<1,\;B=1$ and side lengths $a+c=1,\;b=1$. The set $\L_{\frac12,1,\frac12}$ can be parametrized by the angle $A$ and either $a$ or $c$. The limits of these triangles in $\V_{1,1,1}$ have the side lengths $a+c=1,\;b=1$. This edge is common to the tetrahedra $T_{0,1,0}$ and $T_{0,0,0}$. Triangles corresponding to these tetrahedra are shown in Fig.~\ref{down}a and Fig.~\ref{down}d. The angles of triangles in $T_{0,1,0}$ satisfy the inequalities $A<1$, $C<1$, $1<B<2$, $A+B+C<3$, and the side lengths are $1<b<2$, $a<1$, $c<1$, $a+b+c>2$. The limits of these triangles in $\V_{1,1,1}$ have the side lengths $1\le b<2$, $a+c=2-b\le 1$. All angles and side lengths of triangles in $T_{0,0,0}$ are less than 1, $A+B+C>1$, $a+b+c<2$. The limits of these triangles in $\V_{1,1,1}$ have all side lengths $\le 1$. The tetrahedron $T_{0,0,0}$ is pointed (with three edges in $X_1$ meeting at $V$), while the tetrahedron $T_{0,1,0}$ is not pointed (see Fig.~\ref{000}b). Triangles corresponding to the edges from $V$ to $(0,0,1)$ and $(1,0,0)$ are shown in Fig.~\ref{down}c and Fig.~\ref{down}e. They have the angles $A=B<1,\;C=1$ and $B=C<1,\;A=1$, respectively, and side lengths $a+b=1,\;c=1$ (resp., $b+c=1,\;a=1$). The limits of these triangles in $\V_{1,1,1}$ have the side lengths $a+b=1,\;c=1$ (resp., $b+c=1,\;a=1$). These two edges are common for $T_{0,0,0}$ and the tetrahedra $T_{0,0,1}$ and $T_{1,0,0}$, respectively. Triangles corresponding to these tetrahedra are shown in Fig.~\ref{down}f and Fig.~\ref{down}g. \end{proof} \begin{remark}\label{tau}{\em The involution $\tau:(A,B,C)\mapsto(2-A,2-B,2-C)$ maps the tetrahedron $T_0=T_{0,0,0}$ to the tetrahedron $T_1=T_{1,1,1}$, and the tetrahedra $T_{1,0,0},\;T_{0,1,0}$ and $T_{0,0,1}$ to the tetrahedra $T_{0,1,1},\;T_{1,0,1}$ and $T_{1,1,0}$, respectively. For each triangle $\Delta\subset\bC$ in one of these tetrahedra, the triangle $\tau(\Delta)=\overline{\bC\setminus\Delta}$ is reflection symmetric to the complementary to $\Delta$ triangle. In particular, $\tau$ preserves the side lengths of triangles, and can be extended to the neighborhood $U$ of $\V_{1,1,1}$.} \end{remark} \begin{prop}\label{U} The neighborhood $U$ of $\V_{1,1,1}$ in Lemma \ref{111} is a three-dimensional real analytic manifold homeomorphic to an open ball in $\R^3$. The angles $A,B,C$ and side lengths $a,b,c$ of triangles in $U$ are real analytic functions on $U$. They define an embedding of $U$ to $\R^6$ as a real analytic submanifold. \end{prop} \begin{proof} Let $D\subset\bC$ be a hemisphere bounded by a great circle $G$, with a marked point $\B\in G$. For a point $\C\in G\setminus\B$, let $\B\C$ be the arc of $G$ of length $a<2$ from $\B$ to $\C$ oriented consistently with the orientation of $G=\partial D$. Let $\B'$ and $\C'$ be the points of $G$ opposite to $\B$ and $\C$, and let $\C'\B'$ be the arc of $G$ such that either $\B\C\subseteq \C'\B'$ or $\C'\B'\subseteq \B\C$. Let $\Gamma_\C=\B\C\cup \C'\B'$. Then $G\setminus\Gamma_\C$ is a non-empty open arc of $G$ of length $\min(a,2-a)$. For a point $\A\in\bC\setminus\Gamma_\C$, let $\Delta_{\A\C}\subset\bC$ be a spherical triangle with the sides $\A\B$ and $\A\C$ of lengths $c<1$ and $b<1$, respectively, and the side $\B\C\subset G$. The set $U_A$ of triangles $\Delta_{\A\C}$ is an open subset of $U$, parametrized by the length $a\in(0,2)$ of the arc $\B\C$ and the point $\A\in\bC\setminus\Gamma_\C$. Let us show that there is one-to-one correspondence between triangles $\Delta_{\A\C}\in U_\A$ and spherical triangles with the angles satisfying (\ref{abc}) and the side lengths $a<2,\;b<1,\;c<1$. Since the sides $\A\B$ and $\A\C$ of $\Delta_{\A\C}$ have lengths less than $1$, they do not intersect $G$ at any points other than $\B$ and $\C$, respectively. Since $\B\C$ is oriented from $\B$ to $\C$ in $\partial D$, this implies that $D$ is a proper subset of $\Delta_{\A\C}$ when $\A\notin D$, $\Delta_{\A\C}=D$ when $\A\in G\setminus\Gamma_\C$, and $\Delta_{\A\C}$ is a proper subset of $D$ when $\A\in D\setminus G$. Accordingly, each triangle $\Delta_{\A\C}$ may be of the following types: \noindent(i) Triangle in $\V_{1,1,1}$ with the sides $b<1$ and $c<1$, when $\A\in G\setminus\Gamma_\C$; \noindent(ii) Triangle in $\L_{1,\frac12,\frac12}$ corresponding to the edge $\big((1,1,1),(1,0,0)\big)$ when $\A\in D\setminus G$ and $a=1$ (see Fig.~\ref{down}e); \noindent(iii) Triangle in $\L_{1,\frac32,\frac32}$ corresponding to the edge $\big((1,1,1),(1,2,2)\big)$, when $\A\notin D$ and $a=1$ (see Fig.~\ref{up}e). \noindent(iv) Triangle in $T_{0,0,0}$, when $\A\in D\setminus G$ and $a<1$ (see Fig.~\ref{down}d); \noindent(v) Triangle in $T_{1,0,0}$, when $\A\in D\setminus G$ and $a>1$ (see Fig.~\ref{down}g); \noindent(vi) Triangle in $T_{1,1,1}$, when $\A\notin D$ and $a<1$ (see Fig.~\ref{up}d); \noindent(vii) Triangle in $T_{0,1,1}$, when $\A\notin D$ and $a>1$ (see Fig.~\ref{up}g); Conversely, each triangle in (i) - (vii) can be realized as a unique triangle $\Delta_{\A\C}\in U_A$, for a fixed point $\B\in G$, and for some points $\C\in G\setminus \B$ and $\A\in\bC\setminus\Gamma_\C$. Finally, $U_A$ is projected to an open interval $(0,2)$ of the values of $a$, with the fiber $\bC\setminus\Gamma_\C$ homeomorphic to an open disk and continuously depending on $a$. Thus $U_A$ is homeomorphic to an open ball in $\R^3$. By a cyclic permutation of the labels $(A,B,C)$, we define the sets $U_B$ and $U_C$ of triangles with the angles satisfying (\ref{abc}) and sides satisfying $b<2,\;a<1,\;c<1$ and $c<2,\;a<1,\;b<1$, respectively. The same arguments as above show that each of these two sets is homeomorphic to an open ball in $\R^3$. The intersection $U_A\cap U_B = U_A\cap U_C = U_B\cap U_C$ consists of triangles in $U$ with all three side lengths less than 1, corresponding to triangles in $\V_{1,1,1}$ with $\max(a,b,c)<1$, $T_{0,0,0}$ and $T_{1,1,1}$. The set of such triangles, also homeomorphic to an open ball in $\R^3$, can be parametrized, as a subset of $U_A$, by the length $a\in(0,1)$ of the side $\B\C$ and the point $\A\in\bC\setminus\Gamma_\C$. Since triangles in $U$ have at most one side length $\ge 1$, we have $U=U_A\cup U_B\cup U_C$. Thus $U$ is homeomorphic to an open ball in $\R^3$. To prove that $U$ is embedded in $\R^6$ as a real analytic manifold, we show this first for embedding of the chart $U_A$ of $U$, parametrized by the length $a\in(0,2)$ of the side $\B\C$ and the point $\A\in\bC\setminus\Gamma_\C$. We realize $\bC$ as the unit sphere in $\R^3_{x,y,z}$ and $G$ as the unit circle in the $xy$-plane, and set $\B=(1,0,0)$, $\C=(s,t,0)$ where $s^2+t^2=1$, $\A=(u,v,w)$ where $u^2+v^2+w^2=1$. The opposite points of $\B$ and $\C$ in $G$ are $\B'=(-1,0,0)$ and $\C'=(-s,-t,0)$. Then \begin{equation}\label{gammac} \Gamma_\C=(x,y,0)\in G: y>0\;\text{or}\;sy<tx. \end{equation} The sides $\A\B$, $\B\C$ and $\C\A$ belong to the circles in the planes through the origin of $\R^3$ with the normals $(0,-w,v)$, $(0,0,1)$ and $(tw,-sw,sv-tu)$, respectively. All three normals are non-zero vectors for any point in $U_A$, as $\A\notin\Gamma_\C$ implies that $v\ne 0,\;sv\ne tu$ when $w=0$, and $(s,t)$ is a unit vector. Thus all three planes depend analytically on parameters in $U_A$, and the angles $A,B,C$ between any two of these planes are real analytic functions on $U_A$. The side lengths $b<1$ and $c<1$ are also real analytic functions of parameters in $U_A$, as $\cos(\pi c)=u,\;\cos(\pi b)=su+tv$. The mapping from $U_A$ to $\R^3_{a,b,c}$ is nondegenerate when $$ds\wedge du\wedge d(su+tv)\wedge d(s^2+t^2)\wedge d(u^2+v^2+w^2)=4t^2 w\,ds\wedge dt\wedge du\wedge dv\wedge dw\ne 0.$$ When $w=0$, all corners $\A,\B,\C$ are on the unit circle in the $xy$-plane, all angles $A,B,C$ are equal to $1$, and the sides $a,b,c$ satisfy $a+b+c=2$. For fixed $a$ and $b$ we have $\partial C/\partial w=-1/(\pi^2 b)\ne 0$ when $w=0$, thus the mapping of $U_A$ to $\R^3_{a,b,C}$ is nondegenerate in this case. When $t=0$, we have $\C=(-1,0,0)$, $a=1$, $b+c=1$, $A=1$, and $0<B=C<2$ is the angle between the vectors $(0,v,w)=\A-(u,0,0)$ and $(0,-1,0)$ counterclockwise in the $yz$-plane. Note that $u\ne\pm 1$ since $\A\ne\B$ and $\A\ne\C$. Thus the mapping from $U_A$ to $\R^3_{a,b,C}$ is nondegenerate in this case. This proves that $U_A$ is embedded in $\R^6$ as a real analytic manifold. Embedding of the charts $U_B$ and $U_C$ of $U$ is obtained by cyclic permutations of the corners $\A,\B,\C$, angles $A,B,C$ and side lengths $a,b,c$. Also, the common intersection of any two of the charts $U_A$, $U_B$ and $U_C$ of $U$ is mapped to itself by these cyclic permutations, which act as linear transformations of $\R^6$. Thus transition maps between the three charts of $U$ are real analytic. \end{proof} \begin{definition}\label{short} \emph{A spherical triangle $\Delta$ is called \emph{short-sided} if all its sides are shorter than the full circle (have length less than $2$). Otherwise, $\Delta$ is \emph{long-sided}. At most one side of a triangle $\Delta$ may be long. If the side $\B\C$ of a triangle $\Delta$ is short, a hemisphere can be attached to $\B\C$, increasing the angles $B$ and $C$ of $\Delta$ by $1$, and replacing the side length $a$ of $\B\C$ by $2-a$. This operation can be repeated, attaching several hemispheres to $\B\C$. Similarly, hemispheres can be attached to short sides $\A\C$ and $\B\C$ of $\Delta$. The triangle $\Delta(p,q,r)$ obtained by attaching $p$ hemispheres to the side $\B\C$ of a triangle $\Delta$ with angles $(A,B,C)$ and side lengths $(a,b,c)$, $q$ hemispheres to its side $\A\C$ and $r$ hemispheres to its side $\A\B$ has the angles $(A+q+r,B+p+r,C+p+q)$ and side lengths $\big((-1)^p(a-1)+1,(-1)^q(b-1)+1,(-1)^r(c-1)+1\big)$. The value $0$ for $p$, $q$ or $r$ means that no hemispheres are attached to the corresponding side of $\Delta$. If a side of $\Delta$ is long then hemispheres cannot be attached to that side, thus the corresponding value of $p$, $q$ or $r$ must be $0$.} \end{definition} \begin{prop}\label{x0} \emph{(See \cite{EGT1}, Section 10.)} For a balanced vertex $(m,n,k)\in X_0$ there exists a unique solution $(p,q,r)\in\N^3$ of the system \begin{equation}\label{pqr} q+r=m-1,\quad p+r=n-1,\quad p+q=k-1. \end{equation} This identifies $X_0$ with the set $\Lambda_0$ of integer points in the first octant of $\R^3_{p,q,r}$, where the origin $(p,q,r)=(0,0,0)$ corresponds to the vertex $(m,n,k)=(1,1,1)$ (see Fig.~\ref{cubic}). A triangle $\Delta(p,q,r)$ with integer angles $(m,n,k)$ can be obtained from a hemisphere $\Delta$ with distinct boundary points $(\A,\B,\C)$ by attaching $p$ hemispheres to the side $\B\C$, $q$ hemispheres to the side $\A\C$, and $r$ hemispheres to the side $\A\B$. The developing map of $\Delta(p,q,r)$ is a rational function with three critical points at $\A$, $\B$ and $\C$ of multiplicities $m-1$, $n-1$ and $k-1$. \end{prop} Let $S$ be the commutative semigroup of $G_1$ generated by translations $(A,B,C)\mapsto (A,B+1,C+1)$, $(A,B,C)\mapsto (A+1,B,C+1)$, $(A,B,C)\mapsto (A+1,B+1,C)$. For each balanced vertex $W=(m,n,k)$, translation by $(m-1,n-1,k-1)$ in $S$ maps the vertex $V=(1,1,1)$ to $W$, and the edges in $X_1$ and tetrahedra in $X_0$ adjacent to $V$ to the edges and tetrahedra adjacent to $W$. \begin{notation}\label{umnk} Let $\U_{m,n,k}$ be the neighbprhood of the set $\V_{m,n,k}$ consisting of triangles with the angles $(A,B,C)$ such that $m-1<A<m+1$, $n-1<B<n+1$, $k-1<C<k+1$. \end{notation} Since all triangles in the neighborhood $U$ of the set $\V_{1,1,1}$ are short-sided, Proposition \ref{x0} implies that this action can be extended to the mapping from $U=\U_{1,1,1}$ to $\U_{m,n,k}$ by attaching $p$ hemispheres to the side $\B\C$, $q$ hemispheres to the side $\A\C$, and $r$ hemispheres to the side $\A\B$ of each triangle $\Delta\in U$, where $(p,q,r)$ satisfies (\ref{pqr}). The sides of the resulting triangle are either of the same length $a$, $b$, $c$ as the corresponding sides of $\Delta$ or of the complementary length $2-a$, $2-b$, $2-c$, depending on the parity of the numbers $p$, $q$, $r$. For example, the sides of triangles in $\U_{1,2,2}$ are $(2-a,\;b,\;c)$, since $(p,q,r)=(1,0,0)$ in that case. In particular, all triangles in each set $\U_{m,n,k}$ are short-sided. \begin{theorem}\label{shortsided} The set of all short-sided spherical triangles is an orientable three-dimensional manifold in $\R^6$ consisting of triangles corresponding to all balanced vertices in $X_0$, balanced and semi-balanced edges in $X_1$, and balanced and semi-balanced tetrahedra in $X_3$. It is the union $\U$ of the sets $\U_{m,n,k}$ corresponding to all balanced vertices $(m,n,k)$. \end{theorem} \begin{proof} It will be shown in the next section that all triangles in $\X\setminus\U$ are long-sided (have one side of length $\ge 2$). Since $\U$ is a three-dimensional manifold covered by charts $\U_{m,n,k}$, it is enough to show that $\U$ is orientable. The set $U=U_{1,1,1}$ is the union $U=U_A\cup U_B\cup U_C$ of three open subsets sets, each of them naturally oriented as a subset of $(0,2)\times\bC$ (see proof of Proposition \ref{U}). It is easy to check (selecting the point $\A$ either at the center of $D$ or at the center of $\bC\setminus D$ in the proof of Proposition \ref{U}) that these orientations are compatible on the intersections $U_A\cap U_B = U_A\cap U_C=U_B\cap U_C$ (opposite to the orientation of $\R^3_{A,B,C}$ on the tetrahedra $T_{0,0,0}$ and $T_{1,1,1}$). Thus the set $U$ is oriented. Note that this orientation of $U$ is compatible with the orientation of $\R^3_{A,B,C}$ on all tetrahedra adjacent to $(1,1,1)$ except $T_{0,0,0}$ and $T_{1,1,1}$. A generator $(A,B,C)\mapsto (A,B+1,C+1)$ of $S$ maps the set $U_{1,1,1}$ to the set $U_{1,2,2}$ which intersects with $U_{1,1,1}$ over $T_{0,1,1}\cup T_{1,1,1}\cup\L_{1,\frac32,\frac32}$. This mapping defines orientation of $U_{1,2,2}$ such that orientations of $U_{1,1,1}\cap U_{1,2,2}$ induced from $U_{1,1,1}$ and $U_{1,2,2}$ are opposite. Orientation of the set $\U$ can be defined by reversing orientations of all sets $U_{m,n,k}$ induced from the orientation of $U_{1,1,1}$ when $m+n+k\equiv 1\mod 4$, corresponding to the odd values of $p+q+r$. \end{proof} \section{Sequences of unbalanced tetrahedra in $X_3$ and edges in $X_1$}\label{semibalanced} \begin{prop}\label{unbalanced} Let $L_0$ be a semi-balanced edge in $X_1$. Then there is a unique not pointed tetrahedron $\nabla_0$ in $X_3$ with the edge $L_0$, and a unique infinite sequence \begin{equation}\label{sequence} \nabla_0,L_1,\nabla_1,L_2,\nabla_2,\ldots \end{equation} of tetrahedra $\nabla_j$ in $X_3$ and edges $L_j$ in $X_1$, where $\nabla_{j-1}$ and $\nabla_j$ have a common edge $L_j$, for each $j>0$. The tetrahedra $\nabla_j$ and edges $L_j$ are unbalanced for $j>0$. Each unbalanced tetrahedron in $X_3$, and each unbalanced edge in $X_1$, belongs to exactly one such sequence. \end{prop} \begin{proof} First we construct the sequence (\ref{sequence}). Let $W=(m,n,k)$ be a marginally unbalanced vertex such that $m-1=n+k$, and let $L_0=\big((m,n+1,k+1),(m,n,k)\big)$ be a semi-balanced edge in $X_1$ of the second type, with one end at $W$. Then $L_0$ is a common edge of a pointed semi-balanced tetrahedron $T_{m-1,n,k}$ (with two more edges in $X_1$, from $(m,n+1,k+1)$ to $(m-1,n,k+1)$ and $(m-1,n+1,k)$) and a non-pointed semi-balanced tetrahedron $\nabla_0=T_{m,n,k}$ with one unbalanced edge $L_1=\big((m+1,n,k+1),(m+1,n+1,k)\big)$ in $X_1$, of the first type. The edge $L_1$ is common for the tetrahedron $\nabla_0$ and an unbalanced tetrahedron $\nabla_1=T_{m+1,n,k}$ which has an unbalanced edge $L_2=\big((m+2,n+1,k+1),(m+2,n,k)\big)$ in $X_1$, of the second type. Extending this construction, we obtain the sequence (\ref{sequence}) consisting of unbalanced edges $L_j=\big((m+j,n,k+1),(m+j,n+1,k)\big)$ of the first type for odd $j$, unbalanced edges $L_j=\big((m+j,n+1,k+1),(m+j,n,k)\big)$ of the second type for even $j$, and the tetrahedra $\nabla_j=T_{m+j,n,k}$, unbalanced for $j>0$. The cases $n-1=m+k$ and $k-1=m+n$ are similar. Now we show that each unbalanced tetrahedron in $X_3$ and each unbalanced edge in $X_1$ belong to exactly one sequence (\ref{sequence}). According to Remark \ref{edges-unbalanced} each unbalanced edge in $X_1$ is an edge of an unbalanced tetrahedron, and each unbalanced tetrahedron $\nabla=T_{m,n,k}$ in $X_3$ with $m>n+k+1$ has two opposite unbalanced edges in $X_1$, either $L=\big((m,n,k+1),(m,n+1,k)\big)$ and $L'=\big((m+1,n+1,k+1),(m+1,n,k)\big)$ or $L=\big((m+1,n,k+1),(m+1,n+1,k)\big)$ and $L'=\big((m,n+1,k+1),(m,n,k)\big)$, depending on the parity of $m+n+k$. Then $\nabla$, $L$ and $L'$ belong to a sequence (\ref{sequence}) associated with a semi-balanced edge $L_0=\big((n+k+1,n+1,k+1),(n+k+1,n,k)\big)$. The cases $n>m+k+1$ and $k>m+n+1$ are similar. \end{proof} \begin{prop}\label{sausage} The set $\S\subset\X$ of triangles corresponding to the tetrahedra $\nabla_j$ for $j\ge 0$ and edges $L_j$ for $j>0$ in a sequence (\ref{sequence}) is homeomorphic to an open ball in $\R^3$. All triangles in $\S$ except those in $\nabla_0$ are long-sided. \end{prop} \begin{proof} We start with the case $W=(1,1,1)$ and $L_0=\big((1,1,1),(1,0,0)\big)$. Triangles corresponding to the edges $L_j$ and tetrahedra $\nabla_j$ of the sequence (\ref{sequence}) can be constructed as follows. Let $D\subset\bC$ be a hemisphere bounded by a great circle $G$. For a fixed point $\B\in G$, let $\C\in G$ be an opposite point, and let $\B\C$ be an arc of $G$ oriented from $\B$ to $\C$ consistently with the orientation of $G=\partial D$. Let us choose an arbitrary point $\A\in D\setminus G$, and let $G_1$ be the great circle passing through $\A$ and $\B$ (and also through $\C$, since $\C$ is opposite to $\B$). Connecting $\A$ with $\B$ and $\C$ by the arcs of $G_1$ inside $D$, we get a triangle $\delta_{\A,1}\subset D$ with the vertices $(\A,\B,\C)$, angles $A=1$, $B=C<1$ and sides $a=1$, $b+c=1$ (as in Fig.~\ref{down}e) corresponding to the edge $L_0$. Since the point $\A$ is uniquely determined by the angle $B<1$ between $G$ and $G_1$ and the length $c<1$ of the arc $\A\B$, each triangle corresponding to the edge $L_0$ is equal to exactly one triangle $\delta_{\A,1}$. Next we fix a point $\A\in D\setminus G$, and allow the point $\C$ to move along the circle $G$, increasing the angle $A$ between the arc $\A\B$ and the arc $\A\C\subset D$ of a great circle $G_2$ passing through $\A$ and $\C$, so that $1<A<2$. Then we get triangles $\delta_{\A,A}$ with the vertices $(\A,\B,\C)$, angles $1<A<2$, $B<1$, $C<1$, and sides $1<a<2$, $b<1$, $c<1$ (as in Fig.~\ref{down}g). Each of these triangles belongs to the tetrahedron $\nabla_0=T_{1,0,0}$. Conversely, for a fixed point $\B\in G$, the point $\A\in D\setminus G$ is uniquely determined by the angles $(A,B,C)\in T_{1,0,0}$. Thus each triangle in $T_{1,0,0}$ is equal to exactly one triangle $\delta_{\A,A}$ with $1<A<2$, for some $\A\in D\setminus G$. If we continue moving the point $\C$ along $G$ increasing the angle $A$, we get $\C=\B$ when $A=2$, and a triangle $\delta_{\A,2}$ with the angles $A=2$, $B+C=1$ and sides $a=2$, $b=c<1$ corresponding to an unbalanced edge $L_1=\big((2,0,1),(2,1,0)\big)$ of the first type. It is easy to check that each triangle corresponding to $L_1$ is equal to exactly one triangle $\delta_{\A,2}$ for some $\A\in D\setminus G$. In particular, all triangles corresponding to $L_1$ are long-sided. Moving the point $\C$ further along $G$ and increasing the angle $A$ accordingly, we obtain a family of triangles $\delta_{\A,A}$ with vertices $(\A,\B,\C)$, angles $A\ge 1$, $B<1$, $C<1$ and sides $a\ge 1$, $b<1$, $c<1$ corresponding to all edges $L_j$ and tetrahedra $\nabla_j$ of the sequence (\ref{sequence}) associated with the semi-balanced edge $L_0$. For $j>0$ these triangles are long-sided, with $a=j+1$ for triangles corresponding to $L_j$ and $j+1<a<j+2$ for triangles in $\nabla_j$. For a balanced vertex $(m,n,k)$ with $m+1=n+k$ and a semi-balanced edge $L_0=\big((m,n,k),(m,n-1,k-1)\big)$, we fix a point $\B\in G=\partial D$ and define a triangle $\delta_{\A,A,n,k}$, for some point $\A\in D\setminus G$ and angle $A\ge 1$, as a triangle $\delta_{\A,A}$ with $n-1$ hemispheres attached to its side $\A\B$ and $k-1$ hemispheres attached to its side $\A\C$. Then $\delta_{\A,A,n,k}$ has the angles $(A+m-1,B,C)$ where $A+m-1\ge m$, $n-1<B<n$, $k-1<C<k$, and sides $a\ge 1$, $b<1$ if $k$ is odd, $1<b<2$ if $k$ is even, $c<1$ if $n$ is odd, $1<c<2$ if $n$ is even. It is easy to check that these triangles $\delta_{\A,A,n,k}$ are in one-to-one correspondence with triangles corresponding to the edges $L_j$ and tetrahedra $\nabla_j$ of the sequence (\ref{sequence}) in Proposition \ref{unbalanced} associated with the semi-balanced edge $L_0=\big((m,n,k),(m,n-1,k-1)\big)$. For $j>0$ all these triangles are long-sided. This construction identifies the set $\S$ with the product $(D\setminus G)\times(1,\infty)$ homeomorphic to an open ball in $\R^3$. The cases of balanced vertices $(m,n,k)$ with $n+1=m+k$ and $k+1=m+n$, and semi-balanced edges $L_0=\big((m,n,k),(m-1,n,k-1)\big)$ and $L_0=\big((m,n,k),(m-1,n-1,k)\big)$, are similar. \end{proof} \section{Homotopy type of the set $\X$ of spherical triangles}\label{type} According to Proposition \ref{x0}, the set $X_0$ of balanced vertices $(m,n,k)$ can be identified with the set $\Lambda_0$ of the integer points $(p,q,r)\in\N^3$ in the first octant of $\R^3_{p,q,r}$ so that $(m,n,k)=(q+r+1,p+r+1,p+q+1)$. It follows from Proposition \ref{sixedges} that an edge in $X_1$ with one end at a balanced vertex $(m,n,k)$ has its other end either at an unbalanced vertex or at a balanced vertex identified with $(p',q',r')=(p\pm 1,q\pm 1,r\pm 1)\in\N^3$. Thus the union of $X_0$ and the set $B_1$ of balanced edges in $X_1$ can be identified with the 1-skeleton $\Lambda_1$ of the cubic partition of the first octant of $\R^3_{p,q,r}$ (see Fig.~\ref{cubic}). \begin{theorem}\label{homotopy} The set $\X$ of all spherical triangles is homotopy equivalent to $\Lambda_1$. \end{theorem} \begin{proof} According to the proof of Proposition \ref{sausage}, the set $\S$ of triangles in the sequence (\ref{sequence}) associated with a semi-balanced edge $L_0=\big((m,n,k),(m,n-1,k-1)\big)$ can be parametrized by $(\A,A)\in(D\setminus\partial D)\times(1,\infty)$ where $\A$ is a point in the interior of a hemisphere $D$ and $A$ is the angle at $\A$. The union of $\S$ and the set $\L_0$ of triangles corresponding to $L_0$ can be parametrized by $(\A,A)\in(D\setminus\partial D)\times[1,\infty)$, and the union of $\L_0$ and the set of triangles in the semi-balanced tetrahedron $\nabla_0$ can be parameterized by $(\A,A)\in(D\setminus\partial D)\times[1,2)$. A homeomorphism $[1,\infty)\to[1,2)$ defines a homeomorphism $\L_0\cup\S\to\L_0\cup\nabla_0$. Applying this homeomorphism to the sequences (\ref{sequence}) corresponding to all semi-balanced edges in $X_1$, we obtain a homeomorphism $\X\to\U$ where $\U$ is the set of all short-sided triangles (see Definition \ref{short} and Theorem \ref{shortsided}) corresponding to all balanced vertices in $X_0$, balanced and semi-balanced edges in $X_1$, and balanced and semi-balanced tetrahedra in $X_3$. This homeomorphism is identity on the triangles corresponding to all vertices in $X_0$ and all balanced and semi-balanced edges in $X_1$. Next, the union of the set of triangles in each tetrahedron $\nabla\subset\U$, the sets of triangles corresponding to the edges of $\nabla$ in $X_1$ adjacent to its balanced vertices, and the sets of triangles corresponding to the balanced vertices of $\nabla$, is retractable to the union of the sets of triangles corresponding to the balanced vertices and balanced edges of $\nabla$. Moreover, this retraction can be made compatible on the common edges of the tetrahedra in $\U$, thus the set $\U$ is retractable to the union $\X_B$ of the sets of triangles corresponding to all balanced edges and vertices. Since projection of the set $\X_B$ to $X_0\cup B_1$ is a compact-covering map with contractible fibers, Vietoris-Begle mapping theorem (see \cite{Spanier}) implies that $\X_B$ is homotopy equivalent to $X_0\cup B_1$, which can be identified with $\Lambda_1$. Combining the homeomorphism $\X\to\U$, retraction of $\U$ to $\X_B$ and projection of $\X_B$ to $X_0\cup B_1$, we complete the proof of Theorem \ref{homotopy}. \end{proof} \begin{prop}\label{balanced-mnk} If a semi-balanced tetrahedron $T$ is pointed then its subset of balanced triangles is the intersection of $T$ with the convex hull of its balanced vertices and midpoints of all its edges (midpoints of edges of $T$ with both ends at balanced vertices may be excluded, as they are not vertices of the convex hull). If $T$ is not pointed then its subset of balanced triangles is the intersection of $T$ with the convex hull of its single balanced vertex $V$ and midpoints of all its edges adjacent to $V$. \end{prop} \begin{proof} The set of balanced triangles in $T$ is $T_B=T\cap\K$, where $\K$ is the closed cone in the first octant of $\R^3$ defined by the inequalities (\ref{balanced}). If $T$ is pointed then it has three edges in $X_1$ with a common end at a balanced vertex $V=(m,n,k)$ and other ends at $P=(m,n-1,k-1)$, $Q=(m-1,n,k-1)$ and $R=(m-1,n-1,k)$. We may assume that $m+1=n+k$. Then the vertex $P$ is unbalanced, thus the edge $VP$ is semi-balanced. Its midpoint is $vp=(m,n-\frac12,k-\frac12)$. Consider first the case when both vertices $Q$ and $R$ are balanced. Then $T$ has two balanced edges $VQ$ and $VR$, an edge $QR$ not in $X_1$ with both ends at balanced vertices, and two edges $PQ$ and $PR$ not in $X_1$, with midpoints $pq=(m-\frac12,n-\frac12,k-1)$ and $pr=(m-\frac12,n-1,k-\frac12)$. All three midpoints $vp,pq,pr$ belong to the face $A=B+C$ of $\K$, thus $T_B$ is the intersection of $T$ with the the convex hull of $V,Q,R,vp,pq,pr$. Next, consider the case when two vertices of $T$, say $P$ and $Q$, are unbalanced, and $R$ is balanced. This happens when $m=n>k=1$. Then $T$ has two semi-balanced edges $VP$ and $VQ$, with midpoints $vp=(m,n-\frac12,\frac12)$ and $vq=(m-\frac12,n,\frac12)$, and three edges $PQ$, $PR$ and $QR$ not in $X_1$, with midpoints $pq=(m-\frac12,n-\frac12,0)$, $pr=(m-\frac12,n-1,\frac12)$ and $qr=(m-1,n-\frac12,\frac12)$. Since $m=n$, the points $vp$, $pq$ and $pr$ belong to the facet $A=B+C$ of $\K$, and the points $vq$, $pq$ and $qr$ belong to the facet $B=A+C$ of $\K$. Thus $T_B$ is the intersection of $T$ with the convex hull of $V,R,vp,vq,pq,pr,qr$. The remaining case $T=T_{0,0,0},\;(m,n,k)=(1,1,1)$ is left as an exercise. The set of balanced triangles in that case is the intersection of $T$ with the convex hull of $(1,1,1)$, $(1,\frac12,\frac12)$, $(\frac12,1,\frac12)$, $(\frac12,\frac12,1)$, $(0,\frac12,\frac12)$, $(\frac12,0,\frac12)$, $(\frac12,\frac12,0)$. If $T$ is not pointed then there is a single balanced vertex $V=(m,n,k)$ of $T$. We may assume that $m+1=n+k$ and that a single semi-balanced edge of $T$ connects $V$ with an unbalanced vertex $P=(m,n-1,k-1)$. Then $T$ has two more unbalanced vertices $Q=(m+1,n,k-1)$ and $R=(m+1,n-1,k)$. The midpoints of the edges $VP$, $VQ$ and $VR$ are $vp=(m,n-\frac12,k-\frac12)$, $vq=(m+\frac12,n,k-\frac12)$ and $vr=(m+\frac12,n-\frac12,k)$. All of them belong to the facet $A=B+C$ of $\K$. Thus $T_B$ is the intersection of $T$ with the convex hull of $V,vp,vq,vr$. \end{proof} \begin{cor}\label{homotopy-balanced} The set of balanced triangles is homotopy equivalent to $\Lambda_1$. \end{cor} \begin{proof} Description of the sets of balanced triangles in semi-balanced tetrahedra in Proposition \ref{balanced-mnk} allows one to define retraction of the set $\U$ of short-sided triangles to the set $\X_B$ of triangles corresponding to balanced edges and vertices in the proof of Theorem \ref{homotopy} as a composition of retraction of $\U$ to the set of balanced triangles and retraction of the set of balanced triangles to $\X_B$. \end{proof} \vspace{.1in}
\subsection{Equivalence, Invariance, and Equivariance} \label{sec:equivalence} \textbf{Equivalence} If a function $f: \mathcal{X} \to \mathcal{Y}$ maps two inputs $x, x' \in \mathcal{X}$ to the same value, that is $f(x) = f(x')$, then we say that $x$ and $x'$ are $f$-equivalent. For instance, two states $s, s'$ leading to the same optimal value $V^*(s) = V^*(s')$ would be $V^*$-equivalent or \emph{optimal value equivalent}~\cite{ravindran2001symmetries}. An example of two optimal value equivalent states would be states $s$ and $L[s]$ in the CartPole example of Figure \ref{fig:symmetry_example}. The set of all points $f$-equivalent to $x$ is called the \emph{equivalence class} of $x$. \textbf{Invariance and Symmetries} Typically there exist very intuitive relationships between the points in an equivalence class. In the CartPole example of Figure \ref{fig:symmetry_example} this relationship is a horizontal flip about the vertical axis. This is formalized with the transformation operator $L_g: \mathcal{X} \to \mathcal{X}$, where $g \in G$ and $G$ is a mathematical group. If $L_g$ satisfies \begin{align} f(x) = f(L_g[x]), \qquad \text{for all } g \in G, x \in \mathcal{X}, \end{align} then we say that $f$ is \emph{invariant} or \emph{symmetric} to $L_g$ and that \updated{$\{L_g\}_{g \in G}$} is a set of \emph{symmetries} of $f$ . We can see that for the invariance equation to be satisfied, it must be that $L_g$ can only map $x$ to points in its equivalence class. Note that in abstract algebra for $L_g$ to be a true transformation operator, $G$ must contain an identity operation; that is $L_g[x] = x$ for some $g$ and all $x$. An interesting property of transformation operators which leave $f$ invariant, is that they can be composed and still leave $f$ invariant, so $L_g \circ L_h$ is also a symmetry of $f$ for all $g, h \in G$. In abstract algebra, this property is known as a \emph{semigroup property}. If $L_g$ is always invertible, this is called a \emph{group property}. In this work, we experiment with group-structured transformation operators. For more information, see~\cite{dummit2004abstract}. One extra helpful concept is that of \emph{orbits}. If $f$ is invariant to $L_g$, then it is invariant along the orbits of $G$. The orbit ${\mathcal{O}}_x$ of point $x$ is the set of points reachable from $x$ via transformation operator $L_g$: \begin{align} {\mathcal{O}}_x \triangleq \{ L_g[x] \in \mathcal{X} | g \in G \}. \end{align} \textbf{Equivariance} A related notion to invariance is \emph{equivariance}. Given a transformation operator $L_g: \mathcal{X} \to \mathcal{X}$ and a mapping $f: \mathcal{X} \to \mathcal{Y}$, we say that $f$ is equivariant \cite{cohen2016group, worrall2017harmonic} to the transformation if there exists a second transformation operator $K_g: \mathcal{Y} \to \mathcal{Y}$ in the output space of $f$ such that \begin{align} K_g [f(x)] = f(L_g[x]), \qquad \text{for all } g \in G, x \in \mathcal{X}. \end{align} The operators $L_g$ and $K_g$ can be seen to describe the same transformation, but in different spaces. In fact, an equivariant map can be seen to map orbits to orbits. We also see that invariance is a special case of equivariance, if we set $K_g$ to the identity operator for all $g$. Given $L_g$ and $K_g$, we can solve for the collection of equivariant functions $f$ satisfying the equivariance constraint. Moreover, for linear transformation operators and linear $f$ a rich theory already exists in which $f$ is referred to as an \emph{intertwiner} \citep{cohen2016steerable}. In the equivariant deep learning literature, neural networks are built from interleaving intertwiners and equivariant nonlinearities. As far as we are aware, most of these methods are hand-designed per pair of transformation operators, with the exception of \cite{diaconu2019learning}. In this paper, we introduce a computational method to solve for intertwiners given a pair of transformation operators. \subsection{Markov Decision Processes} A Markov decision process (MDP) is a tuple $({\mathcal{S}}, {\mathcal{A}}, {R}, {T}, \gamma)$, with \emph{state space} ${\mathcal{S}}$, \emph{action space} ${\mathcal{A}}$, \emph{immediate reward function} ${R}: {\mathcal{S}} \times {\mathcal{A}} \rightarrow \mathbb{R}$, \emph{transition function} ${T}: {\mathcal{S}} \times {\mathcal{A}} \times {\mathcal{S}} \rightarrow \mathbb{R}_{\geq 0}$, and \emph{discount factor} $\gamma \in [0, 1]$. The goal of solving an MDP is to find a policy $\pi \in \Pi$, $\pi: {\mathcal{S}} \times {\mathcal{A}} \rightarrow \mathbb{R}_{\geq 0}$ (written $\pi(a | s)$), where $\pi$ normalizes to unity over the action space, that maximizes the expected return $R_t = \mathbb{E}_\pi[\sum^T_{k=0} \gamma^k r_{t+k+1}]$. The expected return from a state ${s}$ under a policy $\pi$ is given by the \textit{value function} $V^\pi$. A related object is the $Q$-value $Q^\pi$, the expected return from a state ${s}$ after taking action ${a}$ under $\pi$. $V^\pi$ and $Q^\pi$ are governed by the well-known Bellman equations~\cite{bellman1957dynamic} (see Supplementary). In an MDP, optimal policies $\pi^*$ attain an optimal value $V^*$ and corresponding $Q$-value given by $V^*({s}) = \underset{\pi \in \Pi}{\text{ max }} V^\pi (s)$ and $Q^*({s}) = \underset{\pi \in \Pi}{\text{ max }} Q^\pi (s)$. \begin{figure} \begin{center} \includegraphics[width=0.65\textwidth]{figures/mdp_hom.pdf} \end{center} \caption{Example of a reduction in an MDP's state-action space under an MDP homomorphism $h$. Here `equivalence' is represented by a reflection of the dynamics in the vertical axis. This equivalence class is encoded by $h$ by mapping all equivalent state-action pairs to the same abstract state-actions.} \label{fig:mdphom} \end{figure} \paragraph{MDP with Symmetries} \updated{Symmetries can appear in MDPs. For instance, in Figure \ref{fig:mdphom} CartPole has a reflection symmetry about the vertical axis. Here we define an \emph{MDP with symmetries}. In an MDP with symmetries there is a set of transformations on the state-action space, which leaves the reward function and transition operator invariant. We define a state transformation and a state-dependent action transformation as ${L_g}: {\mathcal{S}} \to {\mathcal{S}}$ and ${K_g^s}: {\mathcal{A}} \to {\mathcal{A}}$ respectively. Invariance of the reward function and transition function is then characterized as \begin{align} R(s, a) &= R({L_g}[s], {K_g^s}[a]) && \text{for all } g \in G, s \in {\mathcal{S}}, a \in {\mathcal{A}} \\ T(s' | s, a) &= T({L_g}[s'] | {L_g}[s], {K_g^s}[a]) && \text{for all } g \in G, s \in {\mathcal{S}}, a \in {\mathcal{A}}. \end{align} Written like this, we see that in an MDP with symmetries the reward function and transition operator are invariant along orbits defined by the transformations $({L_g}, {K_g^s})$. } \paragraph{MDP Homomorphisms} \updated{MDPs with symmetries are closely related to MDP homomorphisms, as we explain below. First we define the latter. An \emph{MDP homomorphism} $h$~\cite{ravindran2004approximate, ravindran2001symmetries} is a mapping from one MDP ${M} = ({\mathcal{S}}, {\mathcal{A}}, {R}, {T}, \gamma)$ to another ${\bar{M}} = ({\mathcal{\bar{S}}}, {\mathcal{\bar{A}}}, {\bar{R}}, {\bar{T}}, \gamma)$ defined by a surjective map from the state-action space ${\mathcal{S}} \times {\mathcal{A}}$ to an \emph{abstract state-action space} ${\mathcal{\bar{S}}} \times {\mathcal{\bar{A}}}$. In particular, $h$ consists of a tuple of surjective maps ${(\smap, \amapset)}$, where we have the state map ${\sigma}: {\mathcal{S}} \to {\mathcal{\bar{S}}}$ and the state-dependent action map ${\alpha_s}: {\mathcal{A}} \to {\mathcal{\bar{A}}}$. These maps are built to satisfy the following conditions} \begin{align} {\bar{R}}({\sigma}(s), {\alpha_s}(a)) &\triangleq {R}({s}, {a}) \hspace{1em} &&\text{for all } {s} \in {\mathcal{S}}, {a} \in {\mathcal{A}}, \label{eq:reward-map} \\ {\bar{T}}({\sigma}({s}') | {\sigma}({s}), {\alpha_s}(a)) &\triangleq \sum_{{s}'' \in {\sigma}^{-1}(s')} {T}({s}'' | {s}, {a}) \hspace{1em} &&\text{for all } {s}, {s}' \in {\mathcal{S}}, {a} \in {\mathcal{A}}. \label{eq:transition-map} \end{align} \updated{ An exact MDP homomorphism provides a model equivalent abstraction~\cite{li2006towards}. Given an MDP homomorphism $h$, two state-action pairs $(s, a)$ and $(s', a')$ are called \emph{$h$-equivalent} if ${\sigma}(s) = {\sigma}(s')$ and ${\alpha_s}(a) = \alpha_{s'}(a')$. Symmetries and MDP homomorphisms are connected in a natural way: } \updated{If an MDP has symmetries $L_g$ and $K_g$, the above equations (4) and (5) hold. This means that we can define a corresponding MDP homomorphism, which we define next.} \paragraph{Group-structured MDP Homomorphisms} \updated{Specifically, for an MDP with symmetries, we can define an abstract state-action space, by mapping $(s,a)$ pairs to (a representative point of) their equivalence class $(\sigma(s), \alpha_s(a))$. That is, state-action pairs and their transformed version are mapped to the same abstract state in the reduced MDP: \begin{align} \left (\sigma(s), \alpha_s(a) \right ) &= \left (\sigma(L_g[s]), \alpha_{L_g[s]}(K_g^s[a]) \right ) \hspace{1em} \forall g \in G, s \in \mathcal{S}, a \in \mathcal{A} \end{align} In this case, we call the resulting MDP homomorphism \emph{group structured}. In other words, all the state-action pairs in an orbit defined by a group transformation are mapped to the same abstract state by a group-structured MDP homomorphism. } \textbf{Optimal Value Equivalence and Lifted Policies} \updated{ $h$-equivalent state-action pairs share the same optimal $Q$-value and optimal value function~\cite{ravindran2001symmetries}. } Furthermore, there exists an abstract optimal $Q$-value $\bar{Q}^*$ and abstract optimal value function $\bar{V}^*$, such that $Q^*({s}, {a}) = \bar{Q}^*({\sigma}({s}), {\alpha_s}({a}))$ and $V^*({s}) = \bar{V}^*({\sigma}({s}))$. This is known as \emph{optimal value equivalence}~\cite{ravindran2001symmetries}. Policies can thus be optimized in the simpler abstract MDP. The optimal abstract policy $\bar{\pi}(\bar{a} | \sigma(s))$ can then be pulled back to the original MDP using a procedure called \emph{lifting}~\footnote{Note that we use the terminology \emph{lifting} to stay consistent with~\cite{ravindran2001symmetries}.}. The lifted policy is given in \updated{Equation~\ref{eq:lifted-policy_1}}. A lifted optimal abstract policy is also an optimal policy in the original MDP~\cite{ravindran2001symmetries}. Note that while other lifted policies exist, we follow~\cite{ravindran2001symmetries, ravindran2004approximate} and choose the lifting that divides probability mass uniformly over the preimage: \begin{align} {\pi^\uparrow}(a | s) \triangleq \frac{\bar{\pi}(\bar{a} | \sigma(s))}{|\{a \in {\alpha_s^{-1}}(\bar{a})\}|}, \qquad \text{for any } s \in {\mathcal{S}} \text{ and } a \in {\alpha_s^{-1}}(\bar{a}). \label{eq:lifted-policy_1} \end{align} \subsection{Environments} For each environment we show ${\mathcal{S}}$ and ${\mathcal{A}}$ with respective representations of the group transformations. \textbf{CartPole} In the classic pole balancing task~\cite{barto1983neuronlike}, we used a two-element group of reflections about the $y$-axis. We used OpenAI's Cartpole-v1~\cite{brockman2016openai} implementation, which has a 4-dimensional observation vector: (cart position $x$, pole angle $\theta$, cart velocity $\dot{x}$, pole velocity $\dot{\theta}$). The (discrete) action space consists of applying a force left and right $(\leftarrow, \rightarrow)$. We chose this example for its simple symmetries. \textbf{Grid world} We evaluated on a toroidal 7-by-7 predator-prey grid world with agent-centered coordinates. The prey and predator are randomly placed at the start of each episode, lasting a maximum of 100 time steps. The agent's goal is to catch the prey, which takes a step in a random compass direction with probability $0.15$ and stands still otherwise. Upon catching the prey, the agent receives a reward of +1, and -0.1 otherwise. The observation is a $21\times21$ binary image identifying the position of the agent in the center and the prey in relative coordinates. See Figure~\ref{fig:gridworld}. This environment was chosen due to its four-fold rotational symmetry. \begin{table}[t] \centering \caption{\textsc{Environments and Symmetries}: We showcase a visual guide of the state and action spaces for each environment along with the effect of the transformations. Note, the symbols should not be taken to be hard mathematical statements, they are merely a visual guide for communication.} \label{tab:my_label} \resizebox{\columnwidth}{!}{% \begin{tabular}{rlll} \toprule Environment && Space & Transformations \\ \midrule CartPole & ${\mathcal{S}}$ &$(x,\theta,\dot{x},\dot{\theta})$ & $(x,\theta,\dot{x},\dot{\theta}),(-x,-\theta,-\dot{x},-\dot{\theta})$ \\ & ${\mathcal{A}}$ &($\leftarrow$, $\rightarrow$) &($\leftarrow$, $\rightarrow$), ($\rightarrow$, $\leftarrow$) \\ Grid World & ${\mathcal{S}}$ & $\{0,1\}^{21 \times 21}$ & Identity, \qquad\;\;\; $\curvearrowright 90^\circ$, \qquad\qquad$\curvearrowright 180^\circ$, \qquad\quad $\curvearrowright 270^\circ$ \\ & ${\mathcal{A}}$ & $(\varnothing, \uparrow, \rightarrow, \downarrow, \leftarrow)$ &$(\varnothing, \uparrow, \rightarrow, \downarrow, \leftarrow), (\varnothing, \rightarrow, \downarrow, \leftarrow, \uparrow),(\varnothing, \downarrow, \leftarrow, \uparrow, \rightarrow),(\varnothing, \leftarrow, \uparrow, \rightarrow, \downarrow)$ \\ Pong & ${\mathcal{S}}$ & $\{0,..., 255\}^{4\times 80\times 80}$ & Identity, \qquad\qquad reflect \\ & ${\mathcal{A}}$ &($\varnothing$, $\varnothing$, $\uparrow$, $\downarrow$, $\uparrow$, $\downarrow$) &($\varnothing$, $\varnothing$, $\uparrow$, $\downarrow$, $\uparrow$, $\downarrow$), ($\varnothing$, $\varnothing$, $\downarrow$, $\uparrow$, $\downarrow$, $\uparrow$) \\ \bottomrule \end{tabular} } \end{table} \textbf{Pong} We evaluated on the RLPYT~\cite{stooke2019rlpyt} implementation of Pong. In our experiments, the observation consisted of the 4 last observed frames, with upper and lower margins cut off and downscaled to an $80\times80$ grayscale image. In this setting, there is a flip symmetry over the horizontal axis: if we flip the observations, the up and down actions also flip. A curious artifact of Pong is that it has duplicate (up, down) actions, which means that to simplify matters, we mask out the policy values for the second pair of (up, down) actions. We chose Pong because of its higher dimensional state space. \updated{Finally, for Pong we additionally compare to two data augmentation baselines: stochastic data augmentation, where for each state, action pair we randomly transform them or not before feeding them to the network, and the second an equivariant version of~\cite{kostrikov2020image} and similar to~\cite{silver2016mastering}, where both state and transformed state are input to the network. The output of the transformed state is appropriately transformed, and both policies are averaged.} \subsection{Models} We implemented MDP homomorphic networks on top of two base architectures: MLP and CNN (exact architectures in Supplementary). We further experimented with an equivariant feature extractor, appended by a non-equivariant network, to isolate where equivariance made the greatest impact. \textbf{Basis Networks} We call networks whose weights are linear combinations of basis weights \emph{basis networks}. As an ablation study on all equivariant networks, we sought to measure the effects of the basis training dynamics. We compared an \emph{equivariant} basis against a pure \emph{nullspace} basis\updated{, i.e. an explicitly non-symmetric basis} using the right-null vectors from the equivariant layer construction, and a \emph{random} basis, where we skip the symmetrization step in the layer construction and use the full rank basis. Unless stated otherwise, we reduce the number of `channels' in the basis networks compared to the regular networks by dividing by the square root of the group size, ending up with a comparable number of trainable parameters. \newlength{\heightofhw} \begin{figure}[t] \centering \begin{subfigure}[b]{0.325\textwidth} \includegraphics[width=\textwidth]{figures/cartpole_versus_bases.pdf} \caption{Cartpole-v1: Bases} \label{fig:cartpole_bases} \end{subfigure} \hspace{-5pt} \begin{subfigure}[b]{0.325\textwidth} \includegraphics[width=0.92\textwidth, trim=3em 0 0 0, clip]{figures/cartpole_versus_mlp.pdf} \caption{Cartpole-v1: MLPs} \label{fig:cartpole_mlp} \end{subfigure} \begin{subfigure}[b]{0.325\textwidth} \includegraphics[width=\textwidth]{figures/pong_versus_all.pdf} \caption{Pong} \label{fig:pong_conv} \end{subfigure} \caption{\textsc{Cartpole}: Trained with PPO, all networks fine-tuned over 7 learning rates. 25\%, 50\% and 75\% quantiles over 25 random seeds shown. a) Equivariant, random, and nullspace bases. b) Equivariant basis, and two MLPs with different degrees of freedom. \textsc{Pong}: Trained with A2C, all networks tuned over 3 learning rates. 25\%, 50\% and 75\% quantiles over 15 random seeds shown c) Equivariant, nullspace, and random bases, and regular CNN for Pong.} \label{exp:cartpole} \end{figure} \subsection{Results and Discussion} We show training curves for CartPole in~\ref{fig:cartpole_bases}-\ref{fig:cartpole_mlp}, Pong in Figure~\ref{fig:pong_conv} and for the grid world in Figure~\ref{fig:grid}. Across all experiments we observed that the MDP homomorphic network outperforms both the non-equivariant basis networks and the standard architectures, in terms of convergence speed. \begin{wrapfigure}{r}{0.3\textwidth} \vspace{-0.3cm} \includegraphics[width=0.3\textwidth]{figures/crop_pongdataaug.pdf} \caption{Data augmentation comparison on Pong.} \label{fig:dataaug} \vspace{-0.5cm} \end{wrapfigure} This confirms our motivations that building symmetry-preserving policy networks leads to faster convergence. \updated{Additionally, when compared to the data augmentation baselines in Figure~\ref{fig:dataaug}, using equivariant networks is more beneficial. This is consistent with other results in the equivariance literature~\cite{bekkers2018roto,weiler_2018,winkels20183d,worrall2017harmonic}. While data augmentation can be used to create a larger dataset by exploiting symmetries, it does not directly lead to effective parameter sharing (as our approach does).} Note, in Pong we only train the first 15 million frames to highlight the difference in the beginning; in constrast, a typical training duration is 50-200 million frames~\cite{mnih2016asynchronous, stooke2019rlpyt}. For our ablation experiment, we wanted to control for the introduction of bases. It is not clear \emph{a priori} that a network with a basis has the same gradient descent dynamics as an equivalent `basisless' network. We compared equivariant, non-equivariant, and random bases, as mentioned above. We found the equivariant basis led to the fastest convergence. Figures~\ref{fig:cartpole_bases} and~\ref{fig:pong_conv} show that for CartPole and Pong the nullspace basis converged faster than the random basis. In the grid world there was no clear winner between the two. This is a curious result, requiring deeper investigation in a follow-up. For a third experiment, we investigated what happens if we sacrifice complete equivariance of the policy. This is attractive because it removes the need to find a transformation operator for a flattened output feature map. Instead, we only maintained an equivariant feature extractor, compared against a basic CNN feature extractor. The networks built on top of these extractors were MLPs. The results, in Figure~\ref{fig:pong_conv}, are two-fold: 1) Basis feature extractors converge faster than standard CNNs, and 2) the equivariant feature extractor has fastest convergence. We hypothesize the equivariant feature extractor is fastest as it is easiest to learn an equivariant policy from equivariant features. \\ \updated{We have additionally compared an equivariant feature extractor to a regular convolutional network on the Atari game Breakout, where the difference between the equivariant network and the regular network is much less pronounced. For details, see Appendix C.} \begin{figure}[t] \centering \begin{subfigure}[b]{0.21\textwidth} \includegraphics[width=\textwidth]{figures/gridworld.pdf} \vspace{0pt} \caption{Symmetries} \label{fig:gridworld} \end{subfigure} ~ \begin{subfigure}[b]{0.35\textwidth} \includegraphics[width=\textwidth]{figures/grid_versus_bases_crop.pdf} \caption{Grid World: Bases} \label{fig:pong_bases} \end{subfigure} \hspace{-3pt} \begin{subfigure}[b]{0.35\textwidth} \includegraphics[width=0.92\textwidth, trim=3em 0 0 0, clip]{figures/grid_versus_conv_crop.pdf} \caption{Grid World: CNNs} \label{fig:grid_world} \end{subfigure} \caption{\textsc{Grid World}: Trained with A2C, all networks fine-tuned over 6 learning rates. 25\%, 50\% and 75\% quantiles over 20 random seeds shown. a) showcase of symmetries, b) Equivariant, nullspace, and random bases c) plain CNN and equivariant CNN.} \label{fig:grid} \end{figure} \section{Introduction} \input{introduction} \section{Background} \input{background} \section{Method} \input{method} \section{Experiments} \input{experiments} \section{Related Work} \input{related} \section{Conclusion} \input{conclusion} \section{Acknowledgments and Funding Disclosure } \input{acknowledgments} \section{Broader Impact} \input{impact_statement} \medskip \small \subsection{Lifted Policies Are Invariant} Lifted policies in symmetric MDPs with group-structured symmetries are invariant under the group of symmetries. \updated{Consider the following: Take an MDP with symmetries defined by transformation operators $({L_g}, {K_g^s})$ for $g\in G$. Now, if we take $s' = L_g[s]$ and $a' = K_g^{s}[a]$ for any $g\in G$, $(s', a')$ and $(s, a)$ are h-equivalent under the corresponding MDP homomorphism $h = {(\smap, \amapset)}$.} So \begin{align} {\pi^\uparrow}(a | s) = \frac{\bar{\pi}({\alpha_s}(a) | {\sigma}({s}))}{|\{a \in {\alpha_s^{-1}}(\bar{a})\}|} = \frac{\bar{\pi}(\alpha_{s'}(a') | {\sigma}(s'))}{|\{a' \in \alpha_{s'}^{-1}(\bar{a})\}|} = {\pi^\uparrow}(a' | s'), \label{eq:lifted-policy2} \end{align} for all $s \in {\mathcal{S}}, a \in {\mathcal{A}}$ and $g \in G$. In the first equality we have used the definition of the lifted policy. In the second equality, we have used the definition of $h$-equivalent state-action pairs, where ${\sigma}(s) = {\sigma}({L_g}(s))$ and ${\alpha_s}(a) = \alpha_{s'}(a')$. In the third equality, we have reused the definition of the lifted policy. Thus we see that, written in this way, the lifted policy is invariant under state-action transformations $({L_g}, {K_g^s})$. This equation is very general and applies for all group-structured state-action transformations. For a finite action space, this statement of invariance can be re-expressed as a statement of equivariance, by considering the vectorized policy. \textbf{Invariant Policies On Finite Action Spaces Are Equivariant Vectorized Policies} For convenience we introduce a vector of probabilities for each of the discrete actions under the policy \begin{align} \bm{\pi}(s) \triangleq \begin{bmatrix} \pi(a_1 | s), & \pi(a_2 | s), & ..., & \pi(a_N | s) \end{bmatrix}^\top, \end{align} where $a_1, ..., a_N$ are the $N$ possible discrete actions in action space ${\mathcal{A}}$. The action transformation ${K_g^s}$ maps actions to actions invertibly. Thus applying an action transformation to the vectorized policy permutes the elements. We write the corresponding permutation matrix as ${\textbf{K}}_g$. Note that \begin{align} {\textbf{K}}_g^{-1} \bm{\pi} (s) \triangleq \begin{bmatrix} \pi({K_g^s}[a_1] | s), & \pi({K_g^s}[a_2] | s), & ..., & \pi({K_g^s}[a_N] | s) \end{bmatrix}^\top, \end{align} where writing the inverse ${\textbf{K}}_g^{-1}$ instead of ${\textbf{K}}_g$ is required to maintain the property ${\textbf{K}}_g {\textbf{K}}_h = {\textbf{K}}_{gh}$. The invariance of the lifted policy can then be written as $\bm{\pi}^\uparrow(s) = {\textbf{K}}_g^{-1}\bm{\pi}^\uparrow({L_g}[s])$, which can be rearranged to the equivariance equation \begin{align} {\textbf{K}}_g\bm{\pi}^\uparrow(s) = \bm{\pi}^\uparrow({L_g}[s]) \qquad \text{for all } g \in G, s \in {\mathcal{S}}, a \in {\mathcal{A}}. \label{eq:constraint} \end{align} This equation shows that the lifted policy must satisfy an equivariance constraint. In deep learning, this has already been well-explored in the context of supervised learning~\cite{cohen2016group, cohen2016steerable, worrall2017harmonic, worrall2019deep, weiler2018learning}. Next, we present a novel way to construct such networks. \subsection{Building MDP Homomorphic Networks} Our goal is to build neural networks that follow Eq.~\ref{eq:constraint}; that is, we wish to find neural networks that are \emph{equivariant} under a set of state and policy transformations. Equivariant networks are common in supervised learning~\cite{cohen2016group, cohen2016steerable, worrall2017harmonic, worrall2019deep, weiler2018learning, weiler2019general}. For instance, in semantic segmentation shifts and rotations of the input image result in shifts and rotations in the segmentation. A neural network consisting of only equivariant layers and non-linearities is equivariant as a whole, too\footnote{\updated{See Appendix B for more details.}}~\cite{cohen2016group}. Thus, once we know how to build a single equivariant layer, we can simply stack such layers together. \updated{Note that this is true regardless of the representation of the group, i.e. this works for spatial transformations of the input, feature map permutations in intermediate layers, and policy transformations in the output layer. For the experiments presented in this paper, we use the same group representations for the intermediate layers as for the output, i.e. permutations.} For finite groups, such as cyclic groups or permutations, pointwise nonlinearities preserve equivariance \cite{cohen2016group}. In the past, learnable equivariant layers were designed by hand for each transformation group individually~\cite{cohen2016group,cohen2016steerable,worrall2017harmonic,worrall2019deep,winkels20183d,weiler2018learning,weiler2019general}. This is time-consuming and laborious. Here we present a novel way to build learnable linear layers that satisfy equivariance automatically. \textbf{Equivariant Layers} \begin{algorithm}[b] \caption{Equivariant layer construction} \label{alg:symmetrization} \begin{algorithmic}[1] \State Sample $N$ weight matrices ${\textbf{W}}_1, {\textbf{W}}_2, ..., {\textbf{W}}_N \sim \mathcal{N}({\textbf{W}}; \textbf{0}, \textbf{I})$ for $N \geq \text{dim}({\mathcal{W}_\text{total}})$ \State Symmetrize samples: $\bar{{\textbf{W}}}_i = S({\textbf{W}}_i)$ for $i=1,...,N$ \State Vectorize samples and stack as $\bar{{\textbf{W}}} = [{\text{vec}}(\bar{{\textbf{W}}}_1), {\text{vec}}(\bar{{\textbf{W}}}_2), ...]$ \State Apply SVD: $\bar{{\textbf{W}}} = {\textbf{U}} {\bm{\Sigma}} {\textbf{V}}^{\top}$ \State Keep first $r = \text{rank}(\bar{{\textbf{W}}})$ right-singular vectors (columns of ${\textbf{V}}$) and unvectorize to shape of ${\textbf{W}}_i$ \end{algorithmic} \end{algorithm} We begin with a single linear layer ${\textbf{z}}' = {\textbf{W}}{\textbf{z}} + {\textbf{b}}$, where ${\textbf{W}} \in \mathbb{R}^{D_\text{out} \times D_\text{in}}$ and ${\textbf{b}} \in \mathbb{R}^{D_\text{in}}$ is a bias. To simplify the math, we merge the bias into the weights so ${\textbf{W}} \mapsto [{\textbf{W}}, {\textbf{b}}]$ and ${\textbf{z}} \mapsto [{\textbf{z}}, 1]^\top$. We denote the space of the augmented weights as ${\mathcal{W}_\text{total}}$. For a given pair of linear group transformation operators in matrix form $({\textbf{L}_g}, {\textbf{K}_g})$, where ${\textbf{L}_g}$ is the input transformation and ${\textbf{K}_g}$ is the output transformation, we then have to solve the equation \begin{align} {\textbf{K}_g} {\textbf{W}} {\textbf{z}} = {\textbf{W}} {\textbf{L}_g} {\textbf{z}}, \qquad \text{for all } g \in G, {\textbf{z}} \in \mathbb{R}^{D_\text{in} + 1}. \label{eq:equivariant-layer} \end{align} Since this equation is true for all ${\textbf{z}}$ we can in fact drop ${\textbf{z}}$ entirely. Our task now is to find all weights ${\textbf{W}}$ which satisfy Equation \ref{eq:equivariant-layer}. We label this space of equivariant weights as ${\mathcal{W}}$, defined as \begin{align} {\mathcal{W}} \triangleq \{{\textbf{W}} \in {\mathcal{W}_\text{total}} \mid {\textbf{K}_g} {\textbf{W}} = {\textbf{W}} {\textbf{L}_g}, \text{ for all } g\in G \}, \label{eq:equivariant-subspace} \end{align} again noting that we have dropped ${\textbf{z}}$. To find the space ${\mathcal{W}}$ notice that for each $g \in G$ the constraint ${\textbf{K}_g} {\textbf{W}} = {\textbf{W}} {\textbf{L}_g}$ is in fact linear in ${\textbf{W}}$. Thus, to find ${\mathcal{W}}$ we need to solve a set of linear equations in ${\textbf{W}}$. For this we introduce a construction, which we call a \emph{symmetrizer} $S({\textbf{W}})$. The symmetrizer is \begin{align} S({\textbf{W}}) \triangleq \frac{1}{|G|}\sum_{g \in G} {\textbf{K}_g^{-1}} {\textbf{W}} {\textbf{L}_g}. \label{eq:symmetrizer} \end{align} $S$ has three important properties, of which proofs are provided in Appendix A. First, $S({\textbf{W}})$ is \emph{symmetric} ($S({\textbf{W}})\in {\mathcal{W}}$). Second, $S$ \emph{fixes} any symmetric ${\textbf{W}}$: (${\textbf{W}} \in {\mathcal{W}} \implies S({\textbf{W}}) = {\textbf{W}}$). These properties show that $S$ projects arbitrary ${\textbf{W}} \in {\mathcal{W}_\text{total}}$ to the equivariant subspace ${\mathcal{W}}$. Since ${\mathcal{W}}$ is the solution set for a set of simultaneous linear equations, ${\mathcal{W}}$ is a linear subspace of the space of all possible weights ${\mathcal{W}_\text{total}}$. Thus each ${\textbf{W}} \in {\mathcal{W}}$ can be parametrized as a linear combination of basis weights $\{{\textbf{V}}_i\}_{i=1}^r$, where $r$ is the rank of the subspace and $\text{span}(\{{\textbf{V}}_i\}_{i=1}^r) = {\mathcal{W}}$. To find as basis for ${\textbf{W}}$, we take a Gram-Schmidt orthogonalization approach. We first sample weights in the total space ${\mathcal{W}_\text{total}}$ and then project them into the equivariant \begin{wrapfigure}{r}{0.3\textwidth} \includegraphics[width=0.3\textwidth]{figures/filters_in.pdf} \caption{Example of 4-way rotationally symmetric filters.} \label{fig:grid_filters} \end{wrapfigure}subspace with the symmetrizer. We do this for multiple weight matrices, which we then stack and feed through a singular value decomposition to find a basis for the equivariant space. This procedure is outlined in Algorithm \ref{alg:symmetrization}. Any equivariant layer can then be written as a linear combination of bases \begin{align} {\textbf{W}} = \sum_{i=1}^r c_i {\textbf{V}}_i, \end{align} where the $c_i$'s are learnable scalar coefficients, $r$ is the rank of the equivariant space, and the matrices ${\textbf{V}}_i$ are the basis vectors, formed from the reshaped right-singular vectors in the SVD. An example is shown in Figure~\ref{fig:grid_filters}. To run this procedure, all that is needed are the transformation operators ${\textbf{L}_g}$ and ${\textbf{K}_g}$. Note we do not need to know the explicit transformation matrices, but just to be able to perform the mappings ${\textbf{W}} \mapsto {\textbf{W}}{\textbf{L}_g}$ and ${\textbf{W}} \mapsto {\textbf{K}_g^{-1}}{\textbf{W}}$. For instance, some matrix ${\textbf{L}_g}$ rotates an image patch, but we could equally implement ${\textbf{W}}{\textbf{L}_g}$ using a built-in rotation function. Code is available~\footnote{\url{https://github.com/ElisevanderPol/symmetrizer/}}.
\section{Projection, boundary conditions and physical states} Any physical property only gets contributions from {\em physical states}, {\em i.e.} states that are not annihilated by the projection into the subspace with $D_{\vec{r} }= i$ for each $\vec{r}$. If one uses semi-open boundary conditions for Kitaev's honeycomb model, {\em i.e.} open in one direction and periodic in the other direction, with the honeycomb lattice terminating in a pair of arm-chair edges in the open direction, the projection into the physical subspace only affects the occupation number of boundary orbitals constructed from the ``dangling'' $b$ fermions~\cite{Zschocke_Vojta,Pedrocchi_Chesi_Loss}. Here, ``dangling'' refers to the fact that these $b$ fermions do not appear in any term of the fermionized Hamiltonian. As a result, canonical fermion orbitals constructed entirely from these dangling $b$ fermions can have any occupation number in the ground state(s). Indeed, this freedom reflects a ground state degeneracy of the fermionic Hamiltonian of Kitaev's honeycomb model. The projection operator constrains the parity of (the total occupation number of canonical orbitals constructed from) $c$-fermions relative to the parity of (the total occupation number of canonical orbitals constructed from) $b$-fermions. Since these dangling $b$ orbitals have no role in the Hamiltonian, every $c$-fermion state has a physical version with fixed degeneracy equal to $2^{N_{\mathrm{dangling}} -1}$, where $N_{\mathrm{dangling}}$ denotes the number of canonical fermion orbitals constructed from dangling $b$ fermions. Note that {\em internal edges} generated by the presence of vacancies also contribute to $N_{\mathrm{dangling}}$ in systems diluted with nonmagnetic vacancies. We have repeated this analysis for the SU(2) symmetric model studied here, and find that it remains valid in our case as well. Here, we exploit this by choosing such semi-open boundary conditions which guarantee that the projection operation does not change the value of $\chi(T)$ we obtain from the free-fermion spectrum. \section{Numerical results} We obtain the density of eigenvalues of ${\mathbf K}$ using multiprecision methods used in earlier work~\cite{Sanyal_Damle_Motrunich_PRL}, focusing on samples with semi-open boundary conditions carefully chosen to eliminate extraneous zero modes arising from the arm-chair edges. To achieve this, we use antiperiodic boundary conditions on the fermionic problem whenever the length of the arm-chair edge is a multiple of $4$, and periodic boundary conditions whenever it is a multiple of $2$ but not a multiple of $4$. We use a compensated vacancy ensemble that ensures that each realization has the same number of vacancies on the two sublattices, and forbids vacancies from being on the arm-chair edges (this eliminates some finite-size corrections). Additionally, we forbid vacancies from being adjacent to each other or to share a neighbour---this ensures that our results are dominated by samples without multiple disconnected components, unlike other work~\cite{Weik_etal_PRB} that has specifically focused on zero modes of the largest percolating component of a diluted graphene lattice. In Fig.~\ref{Fig2Appendix,Fig3Appendix,Fig4Appendix,Fig5Appendix}, we display results for the integrated density of nonzero energy states $N$ for four representative values of $n_v$. In each case, $N(\Gamma)$ fits extremely well to the crossover form advertised earlier. By comparing results on two different vacancy ensembles with different correlations between vacancies, we find that the crossover exponent $y$ and crossover scale $\epsilon_c$ are quasiuniversal, depending on $n_v$ mainly through the dependence of $\rho_0$ on $n_v$. These results closely mirror earlier results~\cite{Sanyal_Damle_Motrunich_PRL} on the tight-binding model for graphene diluted with vacancies. The reason is clear: As argued in Ref~\cite{Sanyal_Motrunich_Damle_PRL}, the physics of these zero modes is expected to be largely insensitive to bond-disorder. Moreover, the crossover in the density of states is controlled by the density of these zero modes. Our results reflect this insensitivity, since the presence of $\pi$ flux on certain plaquettes is merely a specific kind of bond-disorder. {\em And so on... So this appendix will serve as a wrapper for all of Sambuddha's numerical results in the tarball I have attached to an earlier email. The hope is that this is eventually a supplemental material to a PRL. If that doesn't work out, this Appendix becomes a Computational Details section.} \section{Infinite-disorder fixed point} This form of the susceptibility is a consequence of an underlying infinite-disorder fixed point. Here we present an argument for this within the framework of the strong-disorder renormalization group approach developed in Ref.~\cite{Motrunich_Damle_Huse_spinchainPRB,Motrunich_Damle_Huse_GadeWegnerPRB,Motrunich_Damle_Huse_dirtySCPRB}. Within this approach to the spectrum of the $f$ fermions, a pair of low-energy wavefunctions is obtained at energies $\pm \Omega = 10^{-\Gamma} K_{\mathrm{av}}$ by decimating the strongest hopping matrix element in a renormalized hopping Hamiltonian with cutoff $\Omega = 10^{-\Gamma} K_{\mathrm{av}}$. At this value of cutoff, the renormalized random hopping problem has $N(\Gamma)$ surviving sites per unit area. $N(\Gamma)$ thus gives the integrated density of states in the interval $0 < |\epsilon| < 10^{-\Gamma}K_{\mathrm{av}}$, thereby justifying the notation used. In this problem, let $N(\Gamma)d\Gamma/\Delta(\Gamma)$ be the number of sites per unit area which are coupled by effective hopping amplitudes of strength $\tilde{K}$ such that that $\log(K_{\mathrm{av}}/\tilde{K}) \in (\Gamma - d\Gamma, \Gamma)$. Then, this RG approach gives $|dN/d\Gamma| \sim N(\Gamma)/\Delta(\Gamma)$. For this RG picture to be reliable and self-consistent, $\Delta(\Gamma)$, which represents the width of the distribution of hopping amplitudes in the renormalized problem with cutoff $\Omega = 10^{-\Gamma}K_{\mathrm{av}}$, must grow indefinitely in the low energy limit as $\Gamma \rightarrow \infty$. Conversely, if an exact computation yields $N(\Gamma) \times |dN/d\Gamma|^{-1}$ that grows indefinitely with $\Gamma$ in a bipartite random hopping problem, we are led to conclude that the low energy spectrum is controlled by an underlying strong disorder fixed point. Using this diagnostic, we see that the modified Gade-Wegner form of the density of states corresponds to distributions of renormalized hoppings widening with RG flow as $\Delta(\Gamma) \sim \Gamma^{1-1/x}$ with $x=3/2$, {\em implying that the form of the low temperature susceptibility obtained above is controlled by an infinite-disorder fixed point}. \end{document}
\section{Representations for weight states}\label{sec:repweight} This section discusses border rank and MPS representations for the weight states. For the convenience of the reader, we recall the definition of the (unnormalized) weight states from the main text: \begin{defi}[Weight states] Given $a,L,\mathfrak{d}\in\mathds{N}_0$ the \emph{weight state} of weight $a$ on $L$ sites of local dimension $\mathfrak{d}+1$ is: \begin{align*} \ket{\chi_{a,\mathfrak{d},L}}=\sum\limits_{\substack{i_1+i_2+\ldots+i_L=a \\0\leq i_1,\ldots,i_L\leq \mathfrak{d}}} \ket{i_1,i_2,\ldots,i_L} \in \left( \mathds{C}^{\mathfrak{d}+1}\right)^{\otimes L} . \end{align*} Write $\ket{\chi_{a,L}}=\ket{\chi_{a,a,L}}$. \end{defi} A state $\ket{\psi}\in\left( \mathds{C}^{d}\right)^{\otimes L}$ admits a representation of tensor rank $r$~\cite{Lan:TensorBook} if there exist product vectors $\ket{u_1},\ldots,\ket{u_r}\in \left( \mathds{C}^{d}\right)^{\otimes L}$ such that \begin{align}\label{equ:rankdecomposition} \ket{\psi}=\ket{u_1} + \cdots + \ket{u_r}. \end{align} A state $\ket{\psi}\in\left( \mathds{C}^{d}\right)^{\otimes L}$ admits a representation of border rank $r$~\cite{Bini_1980,christandl2018tensor} if there exist product vectors $\ket{u_1(\epsilon)},\ldots,\ket{u_r(\epsilon)}\in \left( \mathds{C}^{d}\right)^{\otimes L}$, depending polynomially on $\epsilon$, and a nonnegative integer $a$ such that \begin{align}\label{equ:borderrankdecomposition} \ket{\psi}= \lim _{\epsilon\to0}\frac{1}{\epsilon^a} \left( \ket{u_1(\epsilon)} + \cdots + \ket{u_r(\epsilon)}\right). \end{align} The minimal integer $r$ such that $\ket{\psi}$ has a representation of tensor rank (resp. border rank) is called tensor rank (resp. border rank) of $\ket{\psi}$, denoted $\mathrm{R}( \ket{\psi})$ (resp. $\underline{\mathrm{R}}(\ket{\psi})$). Note that $\ket{\chi_{a,\mathfrak{d},L}}$ can be obtained from $\ket{\chi_{a,L}}$ applying local projection maps $P_{\mathfrak{d}}:\mathds{C}^{a+1}\to \mathds{C}^{\mathfrak{d}+1}$ defined by \begin{align*} P_{\mathfrak{d}}={\textstyle \sum}_{k=0}^{\mathfrak{d}}\ketbra{k}{k}. \end{align*} In particular, a border rank $r$ representation of $\ket{\chi_{a,L}}$ immediately provides a border rank $r$ representation of $\ket{\chi_{a,\mathfrak{d},L}}$. Thus, we focus on efficient representations of $\ket{\chi_{a,L}}$. \begin{prop}[Border rank of weight states]\label{thm:degwweight} Let $\ket{\chi_{a,L}}\in\left( \mathds{C}^{a+1}\right)^{\otimes L}$ be a weight state. For $\epsilon \in \mathds{C}$, let $\ket{\phi(\epsilon)}\in\mathds{C}^{a+1}$ be the state \begin{align*} \ket{\phi_a(\epsilon)}=\sum\limits_{i=0}^a\epsilon^i\ket{i}. \end{align*} Then \begin{equation}\label{eqn: border rank decomp weight} \ket{\chi_{a,L}}= \frac{1}{a!} \lim _{\epsilon \to 0}\frac{1}{\epsilon^a} \left[ \sum_{j=0}^a (-1)^{a-j}{\binom{a}{j}}\ket{\phi(j\epsilon)}^{\otimes L}\right]. \end{equation} In particular, $\underline{\mathrm{R}}(\ket{\chi_{a,L}}) = a+1$. \end{prop} \begin{proof} The lower bound is immediate via a standard flattening argument, see e.g.~\cite[Section 7.2]{BalBerChrGes:PartiallySymRkW} or~\cite{efremenko94barriers}. We verify \eqref{eqn: border rank decomp weight} via a direct calculation: \begin{align*} \sum_{j=0}^a (-1)^{a-j}{\binom{a}{j}}\ket{\phi(j\epsilon)}^{\otimes L} &= \sum_{j=0}^a (-1)^{a-j} \binom{a}{j} \left[ {\textstyle \sum}_{i=0}^a (j \epsilon)^i \ket{i} \right]^{\otimes L} \\ &=\sum_{j=0}^a (-1)^{a-j} \binom{a}{j} \left[ {\textstyle \sum}_{i_1 , \dots , i_L } j^{i_1 + \cdots +i_L} \epsilon^{i_1 + \cdots +i_L} \ket{i_1 , \dots , i_L} \right] \\ &=\sum_{j=0}^a (-1)^{a-j} \binom{a}{j} \sum_{\alpha \geq 0} j^\alpha \epsilon^\alpha \left[ {\textstyle \sum}_{i_1 + \cdots + i_L =\alpha} \ket{i_1 , \dots , i_L} \right] \\ &= \sum_{\alpha \geq 0} \epsilon^\alpha \ket{ \chi_{\alpha,a,L}} \left[ {\textstyle \sum}_{j=0}^a (-1)^{a-j} \binom{a}{j} j^\alpha \right]. \end{align*} To conclude the proof we show that the coefficients $c_{\alpha,a} = {\textstyle \sum}_{j=0}^a (-1)^{a-j} \binom{a}{j} j^\alpha$ satisfy $c_{\alpha,a} = 0$ if $\alpha < a$ and $c_{a,a} = a!$. To see this, we use a double induction on $a$ and $\alpha$. If $(\alpha,a) = (0,0)$ then clearly $c_{\alpha,a}=1$, and if $\alpha = 0$ and $a > 0$, then $c_{\alpha,a} = {\textstyle \sum}_{j=0}^a (-1)^{a-j} \binom{a}{j} = (1-1)^a = 0$ by Newton's binomial formula. Suppose $\alpha >0$; then the $0$-th term of the summation is $0$. We obtain \begin{align*} c_{\alpha,a} & = \sum_{j=1}^a (-1)^{a-j} \binom{a}{j} j^\alpha \\ &=\sum_{j=1}^a (-1)^{a-j} \frac{a!}{j!(a-j)!} j^\alpha \\ &=a \sum_{j=1}^a (-1)^{(a-1)-(j-1)} \frac{(a-1)!}{(j-1)!(a-j)!} j^{\alpha-1} \\ &=a \sum_{j=0}^{a-1} (-1)^{(a-1)-j} \frac{(a-1)!}{j!((a-1)-j)!} (j+1)^{\alpha-1} \\ &=a \sum_{j=0}^{a-1} (-1)^{(a-1)-j} \frac{(a-1)!}{j!((a-1)-j)!} \left[ \sum_{\beta=0}^{\alpha-1} \binom{\alpha-1}{\beta} j^\beta \right] =\\ &=a \sum_{\beta=0}^{\alpha-1} \binom{\alpha-1}{\beta} \sum_{j=0}^{a-1} (-1)^{(a-1)-j} \binom{a-1}{j} j^\beta = a \sum_{\beta=0}^{\alpha-1} \binom{\alpha-1}{\beta} c_{\beta, a-1}. \end{align*} By the inductive hypothesis, $c_{\beta,a-1} =0$ when $\beta < \alpha-1$ and $c_{a-1,a-1} = (a-1)!$. Since $\beta \leq \alpha-1$, we deduce that the summation above vanishes whenever $\alpha < a$. When $\alpha = a$, the summation reduces to $c_{\alpha, a} = a c_{\alpha-1,a-1} = a(a-1)! = a!$. This concludes the proof. \end{proof} A consequence of Proposition \ref{thm:degwweight} is that $\underline{\mathrm{R}}(\ket{\chi_{a,\mathfrak{d},L}}) \leq a+1$, and in particular it is bounded from above independently of $L$. Moreover, all product states in the border rank expression of Proposition \ref{thm:degwweight} are symmetric. Regarding tensor rank, it is a classical fact \cite{Sylv:PrinciplesCalculusForms} that $\mathrm{R}( \ket{\chi_{1,L}}) = L+1$, which implies that $\mathrm{R}(\ket{\chi_{a,L}}) \geq L+1$ grows (at least) linearly in the system size $L$; on the other hand, since the border rank expression for $\ket{\chi_{a,L}}$ has degree $L-a$ in $\epsilon$, a standard interpolation argument (see, e.g., \cite[Thm. 8]{Christandl2017_TR} and \cite[Prop. 6.2]{ChrGesJen:BorderRankNonMult}) shows that $\mathrm{R}(\ket{\chi_{a,L}}) \leq (L-a+1) (a+1)$. The following result provides a matrix product state representation with open boundary conditions for the weight states. As before, we only deal with the case where $\mathfrak{d}=a$. This representation gives rise to the MPS contraction strategy described in the section \emph{Performing computations in the ansatz class} of the main text. \begin{lemma}\label{lemma: MPS for chi} Fix $a,L\in\mathds{N}$ and let $P_L$ be the graph consisting of an open chain with $L$ nodes indexed by $\{1 , \dots , L\}$. For $k = 1 , \dots , L$, define a local map $\mathcal{A}^{k}:\mathds{C}^{a+1}\otimes \mathds{C}^{a+1}\to \mathds{C}^{a+1}$ with $\mathcal{A}^{k}=\sum\limits_{j=0}^{a}\ket{j}\otimes A^{(k)}_{j}$ where \begin{align*} A^{(1)}_j &= \ket{j}\otimes \bra{j}, \\ A^{(k)}_{j}&=\sum \limits_{i=0}^{a-j}\ket{i}\otimes \bra{i+j} \text{ for } 2\leq k\leq L-1 ,\\ A^{(L)} _j &=\sum_{i=0}^{a} \ket{a-j}\otimes \bra{i}. \end{align*} Let $\ket{\phi} = ({\textstyle \bigotimes}_{k =1}^L \mathcal{A}_k ) \ket{\Omega^{(P_L)}_{a+1}}$ be the resulting tensor network state. Then $\ket{\phi} = \ket{\chi_{a,L}}$. \end{lemma} \begin{proof} Write $A_j$ for $A_j^{(k)}$ when $k = 2 , \dots , L-1$ and define $A_j = 0$ for $j > a$. It is easy to see that $A_jA_{j'}=A_{j+j'}$ for all $j,j'$. Therefore, if $i_2+i_3+\ldots+i_{L-1}>a$, we obtain \begin{align*} \langle i_1\ldots i_L| \phi\rangle=0. \end{align*} Therefore, suppose $i_2+i_3+\ldots+i_{L-1} = b \leq a$, so that $A_{i_2}A_{i_3}\ldots A_{i_{L-1}}=A_b$. Then \begin{align*} \langle i_1\ldots i_L| \phi\rangle=1 \end{align*} if $i_1+i_{L}= a-b$ and $0$ otherwise. This concludes the proof. \end{proof} Regarding matrix product states on the ring $C_L$, Lemma \ref{lemma: MPS for chi} implies that $\bTNS^{C_L}_{D,a,\mathfrak{d},d} \subseteq \TNS^{C_L}_{(a+1)D,d}$, relying simply on the fact that $\ket{\Omega^{(C_L)}_{D(a+1)}} =\ket{ \Omega^{(C_L)}_D} \otimes \ket{\Omega^{(P_L)}_{a+1}} \otimes \ket{\Omega^{(e)}_{a+1}}$, where $e$ is the edge which makes the chain $P_L$ into the ring $C_L$. \section{Separations in efficiency of representations}\label{sec:efficiencyseparations} As mentioned in the main text, for matrix product states representations on the cycle $C_L$, the maximal separation between the border bond dimension and bond dimension is at most quadratic. For the sake of completeness, we now provide a proof of this folklore result. \begin{prop}[Separation between border bond and bond dimension]\label{prop: bond quadratic in border bond} Let $\ket{\psi}\in\left( \mathds{C}^d\right)^{\otimes L}$ be a state with $\bbond^{C_L} (\ket{\psi}) = D$. Then $\bond^{C_L}(\ket{\psi}) \leq D^2$. In particular \[ \cTNS^{C_L}_{D} \subseteq \TNS^{C_L}_{D^2}. \] \end{prop} \begin{proof} Let $P_L$ be the chain obtained from $C_L$ by removing a single edge $e_L$. Then $\TNS^{P_L}_{D^2}$ is a closed set \cite{Landsberg_geometry} and clearly $\TNS^{P_L}_{D^2} \subseteq \TNS_{D^2}^{C_L}$. We show that $\cTNS^{C_L}_D \subseteq \TNS^{P_L}_{D^2}$ and this will conclude the proof. Note that $\TNS^{P_L}_{D^2}$ can be interpreted as having two copies of maximally entangled stated of bond dimension $D$ on the chain $P_L$. By performing an entanglement swapping protocol, we can then generate a maximally entangled state between sites $1$ and $L$ with one of the maximally entangled states, which shows that we can generate any TNS on the cycle by starting with two copies on the chain. More formally, let $ T : \mathbb{C}^D\otimes \mathbb{C}^D \to \mathbb{C}$ be the map defined by $T= \sum_1^D \bra{i} \otimes \bra{i}$. Define a family of linear maps $(\mathcal{A}_k : k =1 , \dots , L)$ by $\mathcal{A}^1 = \mathcal{A}^k = \text{id}_{\mathbb{C}^D}$ and $\mathcal{A}^k = T$ for $k =2 , \dots , L-1$. Then $(\bigotimes_k \mathcal{A}^k) \ket{\Omega^{(P_L)} _D }= \ket{\Omega^{(e_L)}_D}$. Since $\ket{\Omega^{(C_L)}_{D}} = \ket{\Omega^{(P_L)}_{D}} \otimes \ket{\Omega^{(e_L)}_D}$, one immediately has $\ket{\Omega^{(C_L)}_{D} }\in \TNS_{D^2}^{P_L}$ by applying the family $(\mathcal{A}_k : k =1 , \dots , L)$ on one factor of $\ket{\Omega^{(P_L)}_{D^2}} = \ket{{\Omega^{(P_L)}_{D}}}^{\otimes 2}$. Therefore, \[ \TNS_D^{C_L} \subseteq \TNS_{D^2}^{P_L}. \] Passing to the closures, we obtain $ \cTNS_D^{C_L} \subseteq \cTNS_{D^2}^{P_L}$, and since $\cTNS_{D^2}^{P_L} = \TNS_{D^2}^{P_L}$ is closed we conclude. \end{proof} The proof above is purely topological and not constructive: it only ensures the existence of a matrix product states representation of bond dimension $D^2$ under the hypothesis of the existence of a border bond dimension $D$ representation. The same argument can be generalized to arbitrary graphs as follows. Given a graph $G$, let $T$ be a spanning tree of $G$, i.e., a tree on all vertices of $G$. In particular, if $e$ is an edge of $G$ which is not an edge of $T$, then $T \cup \{e \}$ contains a cycle; the entanglement swapping argument of Proposition \ref{prop: bond quadratic in border bond} shows that $\Omega^{(e)}_D \in \TNS_D^{T}$. In this way, one can obtain the maximally entangled states $\Omega_D^{(e)}$ corresponding to all edges of $G$ which are not edges of $T$. However, without any assumptions on $G$, one might need a full $\Omega_D^{(T)}$ to generate each edge. Since $T$ does not contain any cycle, the set $\TNS_D^T$ is a closed set and we conclude \[ \cTNS^{G}_D \subseteq \TNS^T_{D^\eta} \subseteq \TNS^G_{D^\eta} \] where $\eta$ is the number of edges of $G$ which are not edges of $T$. As any tree with $|V|$ vertices has $|E|=|V|-1$ edges, we conclude that for a graph $G=(V,E)$ \begin{align*} \cTNS^{G}_D \subseteq \TNS^G_{D^{|E|-|V|+2}}. \end{align*} \subsection{Examples of system-size dependent separations in efficiency of representation}\label{sec:analyticalexamples} In this section, we discuss an example of a state $\ket{\psi_L} \in (\mathbb{C}^3)^{\otimes L}$ for odd $L$ which admits a border bond dimension $2$ translation invariant matrix product state representation with approximation degree $a=1$, yet having translation invariant bond dimension growing with $L$. More precisely, \begin{align*} \bbond^{\text{TI-}C_L}(\ket{\psi_L}) &= 2 \text{ (with $a = \mathfrak{d} = 1$)} \\ \bond^{\text{TI-}C_L}(\ket{\psi_L}) & = \Omega \left( \textfrac{L^{1/3}}{\log(L)} \right) . \end{align*} Moreover, the state $\ket{\psi_L}$ arises as ground state of a translation invariant local (nearest neighbor) Hamiltonian on the cycle. In particular, we obtain $\ket{\psi_L} \in \bTNS^{\text{TI-}C_L}_{2,1,1,3}$ and $\ket{\psi_L} \notin \TNS^{\text{TI-}C_L}_{D,3}$ if $D$ grows slower than $\Omega( \frac{L^{1/3}}{\log(L)})$. In the non-translation invariant case, there are no known examples of separations that are larger than a constant factor. The separation in the translation invariant setting, and in particular the lower bound on $\bond^{\text{TI-}C_L}(\ket{\psi})$ relies on the analogous result for the $W$-state, proved with the same argument as \cite[Corollary 1]{mapsgarcia} via the results of \cite{sanz2010quantum,Rahaman_2020,Michalek_2019_Wielandt}. \begin{lemma}\label{lem:repwstate} Let $C_L$ the cycle on $L$ nodes. Then \begin{align*} (a+1)L\geq\bond^{\text{TI-}C_L}(\ket{\chi_{a,L}}) &= \Omega \left(\frac{L^{1/3}}{\log(L)}\right) ,\\ \bbond^{\text{TI-}C_L} (\ket{\chi_{a,L}}) &\leq a+1. \end{align*} \end{lemma} \begin{proof} The upper bound $\bbond^{\text{TI-}C_L} (\ket{\chi_{a,L}})\leq a+1$ is obtained directly from the border rank expression of Proposition \ref{thm:degwweight}. This is because the superposition of $a+1$ symmetric product states can be written as a TI-MPS of bond dimension $a+1$. The upper bound $\bond^{\text{TI-}C_L}(\ket{\chi_{a,L}}) \leq (a+1)L$ is obtained symmetrizing the non-translation invariant representation obtained in Lemma \ref{lemma: MPS for chi}. As for the lower bound $\bond^{\text{TI-}C_L}(\ket{\chi_{a,L}}) = \Omega \left(\frac{L^{1/3}}{\log(L)}\right)$, first note that the (local and translation invariant) projection map $P^{\otimes L}$ where $P = \ketbra{0}{0} + \ketbra{1}{a}$ sends $\ket{\chi_{a,L}}$ to the $W$-state $\ket{\chi_{1,L}}$. In particular, lower bounds on $\bond^{\text{TI-}C_L}(\ket{\chi_{1,L}})$ are lower bounds for $\ket{\chi_{a,L}}$ as well. In~\cite[Corollary 1]{mapsgarcia}, the authors related $\bond^{\text{TI-}C_L}(\ket{\chi_{1,L}})$ to quantum Wielandt inequalities~\cite{sanz2010quantum,Rahaman_2020,Michalek_2019_Wielandt}. Although the version of the inequality stated in~\cite[Conjecture 2]{mapsgarcia}, on which \cite[Corollary 1]{mapsgarcia} relies on, is only conjectured, in~\cite{Michalek_2019_Wielandt} the authors show that~\cite[Conjecture 2]{mapsgarcia} holds with $f(D)=\mathcal{O}(D^2\log(D))$. Reproducing the proof of~\cite[Corollary 1]{mapsgarcia} provides \begin{align*} (D)^3\log(D)^3=\Omega(L), \end{align*} whenever $D \geq \bond^{\text{TI-}C_L}(\ket{\chi_{1,L}})$. This implies $ \bond^{\text{TI-}C_L}(\ket{\chi_{1,L}}) =\Omega(e^{\mathcal{W}(L^{1/3})})$, where $\mathcal{W}$ is the Lambert $\mathcal{W}$ (see, e.g., \cite{hoorfar2008inequalities}). Indeed, one can show \cite[(1.1)]{hoorfar2008inequalities} that \begin{align*} \mathcal{W}(x)\geq \log(x)-\log \log(x) \end{align*} for all $x\geq e$, which implies that $e^{\mathcal{W}(L^{1/3})}=\Omega\left(\frac{L^{1/3}}{\log(L)}\right) $. \end{proof} From Lemma \ref{lem:repwstate}, already $\ket{\chi_{a,L}}$ provides an example of a state for which we have a separation. However, in the main text we presented a local translationally invariant Hamiltonian whose unique translationally invariant ground state presents this behaviour as well. Let us recall its definition and discuss some of its properties. The weight states themselves give separations in the required bond dimension and will be used as stepping stones to prove separations for these examples. But the next examples require a bond dimension $D>1$ to be represented in the ansatz class introduced class, unlike the weight states. Let $P :\mathbb{C}^3 \otimes \mathbb{C}^3 \to \mathbb{C}^3 \otimes \mathbb{C}^3$ be the projection defined by \begin{align}\label{equ:definitonprojection} P=\ketbra{01}{01}+\ketbra{10}{10}+\ketbra{02}{02}+\ketbra{21}{21}; \end{align} denote by $P_{i,i+1}$ the linear map $P$ acting on the two factors of $(\mathbb{C}^3)^{\otimes L}$ corresponding to sites $i$ and $i+1$ of the ring $C_L$. Define $H_{i,i+1} = \text{id} - P_{i,i+1} + \ketbra{2}{2}_i$, where the third summand acts on the $i$-th site. Let $H = \sum_i H_i$: this is a diagonal, translationally invariant Hamiltonian. We determine its translationally invariant ground state in the case where $L$ is odd. \begin{prop} Let $L$ be odd. Then $H$ has a unique translationally invariant ground state given by \begin{align}\label{equ:TIgroundstate} \ket{\psi_L}=\frac{1}{\sqrt{L}}\sum\limits_{i=0}^{L-1}S^i\ket{2101010\ldots 10}, \end{align} where $S$ is the cyclic permutation of the tensor factors, i.e., the shift operator. \end{prop} \begin{proof} Since $H$ is diagonal, every product state in the standard basis is and eigenstate for $H$. Moreover, using the fact that the $P_{i,i+1}$ commute, one obtains that the spectrum of $H$ is contained in the set \begin{align*} \left\{\ell+\frac{m}{2L}|\ell,m \in\mathds{N}_{0}\right\}. \end{align*} Given a product state in the standard basis, we compute its energy,i.e. the corresponding eigenvalue of $H$. Note that every state involving two adjacent $\ket{0}$'s or two adjacent $\ket{1}$'s has energy at least $1$, since $1$ is the eigenvalue of the corresponding $H_i$. Moreover, since $L$ is odd, if the state does not involve any $\ket{2}$, there are necessarily adjacent $\ket{0}$'s or $\ket{1}$'s. Every state involving at least two $\ket{2}$'s has energy at least $2 \cdot 1/(2L)$, arising from the $\ketbra{2}{2}$ summands in $H$. There are only two basis state, up to cyclic permutation, involving exactly one $\ket{2}$ and having no adjacent $\ket{0}$'s nor $\ket{1}$'s: they are $\ket{20101 \ldots 01}$ and $\ket {21010 \ldots 10}$. The first has energy at least $1$ arising from $H_{12}$. The state $\ket {21010 \ldots 10}$ has energy $1/(2L)$. We conclude that $\{ S^k\ket{2101010\ldots 10} : k = 0 , \dots , L-1\}$ span the ground state space of $H$. The only translation invariant state in this span is $\ket{\psi_L}$. \end{proof} The following result gives upper and lower bounds for the translation invariant bond and border bond dimension of $\ket{\psi_L}$: \begin{prop} Let $\ket{\psi_L} \in (\mathbb{C}^3)^{\otimes L}$ be the state of \eqref{equ:TIgroundstate}. Then \begin{align*} \bbond^{\text{TI-}C_L}(\ket{\psi_L}) &= 2;\\ \bond^{\text{TI-}C_L}(\ket{\psi_L}) &= \Omega\left( \frac{L^{\frac{1}{3}}}{\log(L)}\right). \end{align*} In fact, $\ket{\psi_L} \in \bTNS^{\text{TI-}C_L}_{2,1,1,3}$ and, for $L$ large enough, $\ket{\psi_L} \notin \TNS^{\text{TI-}C_L}_{D,3}$ if $D$ does not depend on $L$. \end{prop} \begin{proof} Let $\mathcal{Q}: \mathbb{C}^3 \to \mathbb{C}^2$ be the local map defined by \begin{align*} \mathcal{Q}=\ketbra{0}{1}+\ketbra{0}{0}+\ketbra{1}{2}. \end{align*} Then $\mathcal{Q}^{\otimes L} \ket{\psi_L}=\ket{\chi_{1,L}}$ is the $W$-state. In particular, the lower bound for $\ket{\chi_{1,L}}$ obtained in Lemma~\ref{lem:repwstate} holds for $\bond^{\text{TI-}C_L}(\ket{\psi_L})$ as well. Now, define $\mathcal{A}(\epsilon): \mathds{C}^{2}\otimes \mathds{C}^{ 2} \to\mathds{C}^3$ by \begin{align*} \mathcal{A}(\epsilon)=\ketbra{0}{01}+\ketbra{1}{10}+\epsilon \ketbra{2}{00}. \end{align*} One can readily check that \begin{align*} \lim_{\epsilon \to 0} \epsilon^{-1} \left( \mathcal{A}(\epsilon)^{\otimes L}\right) \ket{\Omega_2^{(C_L)}}=\ket{\psi_L}, \end{align*} giving a representation of $\ket{\psi_L}$ of border bond dimension $2$ and approximation degree $1$. In particular, $\ket{\psi_L} \in \bTNS^{C_L}_{2,1,1,3}$ and concludes the proof. \end{proof} One can define explicitly a local map $\mathcal{B} : (\mathds{C}^{2}\otimes \mathds{C}^{ 2} ) \otimes \mathbb{C}^2 \to \mathbb{C}^3$ by \[ (\ketbra{0}{01}+\ketbra{1}{10}) \otimes \bra{0}+\ketbra{2}{00} \otimes \bra{1} \] and observe $\ket{\psi_L} = \mathcal{B}^{\otimes L}\ket{ \Omega^{(C_L)}_2} \otimes \ket{\chi_{1,L}}$. This shows that there are unbounded separations in the bond dimension required to represent states that arise as ground states of local Hamiltonians in the new ansatz class for translationally invariant matrix product state when compared with standard matrix product states. \subsection{An explicit example of separation between bond and border bond dimension} For small system size and small local dimension, several explicit examples of separation between bond and border bond dimension are known. In \cite{Str:RelativeBilComplMatMult}, Strassen proved that the GHZ state of level three on three parties, $\ket{\mathrm{ghz}_3} =3^{-\frac{1}{2}}\left( \ket{000} + \ket{111} + \ket{222}\right)$, satisfies $\bbond^{C_3} (\ket{\mathrm{ghz}}) = 2$, realized by a degeneration with approximation degree $a=2$; in fact, one can achieve the same result with a degeneration of approximation degree $a=1$ and in addition in \cite{christandl2018tensor} it was proved that $\bond^{C_3} (\ket{\mathrm{ghz}}) = 3$, providing a separation. In \cite{christandl2018tensor}, a separation was shown for the state $\ket{\lambda} = \sum_{\sigma \in \mathfrak{S}_3} (-1)^\sigma \ket{\sigma(0)\sigma(1)\sigma(2) } + |222\rangle$ as well; here $\mathfrak{S}_3$ denotes the symmetric group on three elements and $(-1)^\sigma$ is the sign of a permutation $\sigma$; in particular $\sum_{\sigma \in \mathfrak{S}_3} (-1)^\sigma \ket{\sigma(0)\sigma(1)\sigma(2) }$ is the unique (up to scaling) alternating tensor in $\mathbb{C}^3 \otimes \mathbb{C}^3 \otimes \mathbb{C}^3 $. It was proved that $\bbond^{C_3} (\ket{\lambda}) =2$ and $\bond^{C_3} = 3$. For these examples, comparing the numerical results in the standard tensor network ansatz class with the ones in the new ansatz class, we observe improvements both in the distance and in the convergence. However, in this case, the class $\bTNS^{C_3} _{2,1,1,3}$ is dense in $\mathbb{C}^3 \otimes \mathbb{C}^3 \otimes \mathbb{C}^3$, so the improvements occur for a trivial reason, as the optimization procedure can just ``walk straight'' to the global minimum. In order to see an example where the optimization procedure is not trivial, we consider the state \begin{equation}\label{eqn: tensor degen 3x3 mamu} \begin{aligned} \ket{T} &=\sqrt{17}^{-1}( \ket{005}+\ket{016}+\ket{040}+\ket{126}+\ket{160}+\ket{227}+\ket{251}+\ket{262}+\ket{338}\\ &+\ket{373}+\ket{384}+\ket{430}+\ket{501}+\ket{632}+\ket{703}+\ket{714}+\ket{824}) \in \mathbb{C}^9 \otimes \mathbb{C}^9 \otimes \mathbb{C}^9, \end{aligned} \end{equation} introduced in the \emph{Numerical examples} section of the main text. Lemma \ref{lemma: bond and border bond of T} below shows $\ket{T} \notin \TNS^{C_3}_{3,9}$ and $\ket{T} \in \bTNS^{C_3}_{3,1,9}$. Moreover, the set $\bar{\bTNS}^{C_3}_{3,1,9}$ is a proper subvariety of $\mathbb{C}^9 \otimes \mathbb{C}^9 \otimes \mathbb{C}^9$, therefore the new ansatz class is non-trivial. \begin{lemma}\label{lemma: bond and border bond of T} Let $\ket{T}$ be the state defined in \eqref{eqn: tensor degen 3x3 mamu}. Then \begin{align*} \bond^{C_3}{(\ket{T})} &\geq 4 , \\ \bbond^{C_3}{(\ket{T})}& = 3 \text{ and the degeneration has approximation degree $a = 1$}. \end{align*} In particular, $\ket{T} \notin \TNS^{C_3}_{3,9}$ and $\ket{T} \in \bTNS^{C_3}_{3,1,9}$. \end{lemma} \begin{proof} Assume by contradiction $\bond^{C_3}(\ket{T}) \leq 3$ and observe that $\ket{\Omega^{(C_3)}_3} \in \mathbb{C}^9 \otimes \mathbb{C}^9 \otimes \mathbb{C}^9$, where each $\mathbb{C}^9$ has a local structure $\mathbb{C}^3 \otimes \mathbb{C}^3$. For $i=1,2,3$, let $\mathcal{A}_i : (\mathbb{C}^3 \otimes \mathbb{C}^3) \to \mathbb{C}^9$ be the linear maps such that $(\bigotimes \mathcal{A}^i) (\ket{\Omega^{(C_3)}_3}) = \ket{T}$. A direct calculation shows that there is no proper subspace $U \subsetneq \mathbb{C}^9$ such that $\ket{T} \in U \otimes \mathbb{C}^9 \otimes \mathbb{C}^9$ or $\ket{T} \in \mathbb{C}^9 \otimes U \otimes \mathbb{C}^9$ or $\ket{T} \in \mathbb{C}^9 \otimes \mathbb{C}^9 \otimes U$. Thus, the maps $\mathcal{A}^i$ are invertible, and $\ket{T}$ is a point of the orbit of $\ket{\Omega^{(C_3)}_3}$ under the action of $GL_9 \times GL_9 \times GL_9$. As a consequence, the stabilizer of $\ket{T}$ and the one of $\ket{\Omega^{(C_3)}_3}$ are conjugate and in particular they have the same dimension. But this is not the case: a direct calculation shows the stabilizer of $\ket{\Omega^{(C_3)}_3}$ is $26$-dimensional whether the stabilizer of $\ket{T}$ is $28$-dimensional. This shows the lower bound $\bond^{C_3} (\ket{T}) \geq 4$. We provide a degeneration of $\ket{\Omega^{(C_3)}_3}$ with approximation degree $a=1$ which realizes $\ket{T}$. In other words, we determine three linear maps $\mathcal{A}^{i}(\epsilon) : \mathbb{C}^3 \otimes \mathbb{C}^3 \to \mathbb{C}^9$ such that $\lim _{\epsilon \to 0} ( \frac{1}{\epsilon} \bigotimes _i \mathcal{A}^i(\epsilon)) \ket{\Omega^{(C_3)}_3} = \ket{T}$. Write $\mathcal{A}^i(\epsilon) = \mathcal{A}_0^{i} + \epsilon \mathcal{A}_1^i$ and express $\mathcal{A}_0^i$ and $\mathcal{A}_1^i$ as matrices with entries in $\mathbb{C}^9$: \begin{align*} \mathcal{A}_0^1 = \mathcal{A}_0^2 = \left(\begin{array}{ccc} \ket{0} & \ket{1} & \\ & \ket{2} & \\ & & \ket{3} \end{array} \right) & \quad \mathcal{A}_0^3 = \left(\begin{array}{ccc} & \ket{1} & \ket{3} \\ & & \ket{4} \\ \ket{0} & \ket{2} & \end{array} \right) \\ \mathcal{A}_1^1 = \mathcal{A}_1^2 = \left(\begin{array}{ccc} & & \ket{4} \\ \ket{5} & & \ket{6} \\ \ket{7} & \ket{8} & \end{array} \right) & \quad \mathcal{A}_1^3 = \left(\begin{array}{ccc} \ket{5} & & \\ \ket{6} & \ket{7} & \\ & & \ket{8} \end{array} \right) & \quad \end{align*} A direct calculation shows that $\lim _{\epsilon \to 0} ( \frac{1}{\epsilon} \bigotimes _i \mathcal{A}^i(\epsilon)) \ket{\Omega^{(C_3)}_3} = \ket{T}$. \end{proof} \section{Approximate representations}\label{sec:approximaterep} As we already showed, there exist states that arise as ground states of local Hamiltonians and admit a more efficient \emph{exact} representation in $\textrm{bTNS}$. However, by definition, if a state lies on the boundary of the TNS variety, it can be approximated arbitrarily well by ``usual" TNS, albeit with local maps whose entries diverge as we increase the precision. Most rigorous results available in the literature only ascertain that tensor network states of a polynomial bond dimension \emph{approximate} ground states well~\cite{Verstraete_2006}. Thus, it is of high importance to investigate the interplay between the speed at which the local maps diverge and how well we can approximate the target state by the restrictions arising from degenerations. This issue that was also raised in~\cite{Hackbusch_2019} recently. In other words, it is important to understand how small one should pick $\epsilon$ so that $\ket{\phi(\epsilon)}\simeq \ket{\phi(0)}$ for the task at hand. First, recall that to estimate most quantities of physical interest up to an additive error $\delta>0$, such as the energy or two-point correlation functions of the ground state, it usually suffices to estimate states to a precision of $\mathcal{O}(\delta L^{-\alpha})$ in the Euclidean norm, where again $L$ is the system size and $\alpha\in\mathds{N}_0$. This is because these quantities are expectation values of observables with operator norm $\mathcal{O}(L^{\alpha})$. With that in mind, we are ready to discuss how to pick $\epsilon$ for a degeneration to ensure the desired precision. To gain some intuition about how the local maps behave in the regime of interest, we consider the case of the $W$-state, before considering the general setting. Consider the family $\ket{\psi(\epsilon)}$ of TI-MPS on a cycle of size $L$ with bond dimension $2$ and matrices given by: \begin{align}\label{equ:MPSdefining} A_0(\epsilon)= \left(\begin{matrix}1&0\\0& e^{\frac{\pi i}{L}}\end{matrix}\right), \quad A_1(\epsilon)=\left(\begin{matrix}\epsilon&0\\0&0\end{matrix}\right). \end{align} One can readily check that \begin{align*} \lim\limits_{\epsilon\to 0}\epsilon^{-1}\ket{\psi(\epsilon)}=\ket{W}, \end{align*} where $\ket{W}$ is the unnormalized $W$-state: \begin{align*} \ket{W}=\ket{100\ldots 0}+\ket{010\ldots 0}+\ldots+\ket{000\ldots 1}. \end{align*} Moreover, the transfer matrix $\mathcal{E}(\epsilon)$ of this family of MPS is given by: \begin{align*} \mathcal{E}(\epsilon)= \left(\begin{matrix}1+\epsilon^2&0&0&0\\0& e^{\frac{\pi i}{L}}&0&0\\0&0& e^{\frac{\pi i}{L}}&0\\0&0&0&1\end{matrix}\right). \end{align*} Thus, we have that: \begin{align*} \|\psi(\epsilon)\|^2=\text{tr}{\mathcal{E}(\epsilon)^L}=(1+\epsilon^2)^L-1. \end{align*} It is also straightforward to compute the overlap of $\ket{\psi(\epsilon)}$ with the $W$-state, as: \begin{align*} \scalar{W}{\psi(\epsilon)}=L\text{tr}{A_0^{L-1}A_1}=L\epsilon. \end{align*} Combining these expressions and normalizing all involved states we have: \begin{align}\label{equ:overlapWdeg} \left\|\frac{\ket{\psi(\epsilon)}}{\|\ket{\psi(\epsilon)}\|}-\frac{\ket{W}}{\sqrt{L}}\right\|^2=2\lb1-\frac{L\epsilon}{\left( L\left( \left( 1+\epsilon^2\right)^L-1\right)\rb^{\frac{1}{2}}}\right)=2\frac{\left( \left( 1+\epsilon^2\right)^L-1\right)^{\frac{1}{2}}-\sqrt{L}\epsilon}{\left( \left( 1+\epsilon^2\right)^L-1\right)^{\frac{1}{2}}} \end{align} Performing a Taylor expansion, we see that \begin{align*} 2\frac{\left( \left( 1+\epsilon^2\right)^L-1\right)^{\frac{1}{2}}-\sqrt{L}\epsilon}{\left( \left( 1+\epsilon^2\right)^L-1\right)^{\frac{1}{2}}}=\mathcal{O}(L\epsilon^2). \end{align*} Thus, in order to ensure that \begin{align*} \left\|\frac{\ket{\psi(\epsilon)}}{\|\ket{\psi(\epsilon)}\|}-\frac{\ket{W}}{\sqrt{L}}\right\|^2\leq \frac{\delta^2}{L^{2\alpha}} \end{align*} for some $\alpha\in \mathds{N}_0$, we need to pick $\epsilon=\mathcal{O}(\delta L^{-\frac{2\alpha+1}{2}})$. Inserting this bound in the definitions of the matrices in Eq. \eqref{equ:MPSdefining} and normalizing the underlying MPS, we see that in order to obtain an approximation up to an error $\delta L^{-\alpha}$ to the W-state in Euclidean norm we need to pick the matrices with entries scaling like: \begin{align*} A_0= \left(\frac{e^{\log(L)\frac{2\alpha+1}{2}}}{\delta}\right)^{\frac{1}{L}}\left(\begin{matrix}1&0\\0& e^{\frac{\pi i}{L}}\end{matrix}\right), \quad A_1=\left(\frac{e^{-\log(L)\frac{2\alpha+1}{2}}}{\delta}\right)\left(\begin{matrix}1&0\\0&0\end{matrix}\right). \end{align*} Note that $A_0$ has entries of constant order, while $A_1$ has entries of inverse polynomial order for $\alpha$ fixed. Moreover, the norm of the underlying MPS will be of order $\delta L^{-\alpha}$, which implies that trying to approximate the $W$-state with this family of MPS leads to ill-conditioned MPS. Setting the vanishing entries to $0$ leads to a state that is \emph{orthogonal} to the state of interest. We expect that this behavior is universal, i.e., that \emph{any} approximation of states on the boundary of the set of TNS of a given bond dimension up to inverse polynomial in system size precision leads to tensors with entries that are polynomially small and ill-conditioned. Unfortunately, we still lack the tools to prove such statements for any approximation of a degeneration and can only prove it for some given degeneration, as we did for the $W$ state: \begin{lemma}[Approximate representation from degeneration]\label{lem:approximate_rep} Let $\mathcal{A}^k(\epsilon):\left( \mathds{C}^{D}\right)^{\otimes k_v}\to \mathds{C}^d$ be a family of local maps whose entries depend polynomially on $\epsilon$ defining a degeneration to $\ket{\phi_0}$ with $\|\phi_0\|=1$. Denote the expansion of \begin{align*} \ket{\psi(\epsilon)}=\left(\bigotimes_{v\in V}\mathcal{A}^v(\epsilon)\right)\left(\bigotimes\limits_{y\in E} \ket{\Omega^y} \right) \end{align*} as a polynomial in terms of $\epsilon$ by: \begin{align}\label{equ:expansionhigherorder} \ket{\psi(\epsilon)}=\epsilon^{a}\ket{\phi_0}+\sum\limits_{l=1}^{e}\epsilon^{a+l}\ket{\phi_l} \end{align} for some $a\in\mathds{N}_0$ and set \begin{align*} \tau(\epsilon)=\sum\limits_{l=1}^{e}\epsilon^{l}\|\ket{\phi_l}\|, \end{align*} Then, for $\tau(\epsilon)\leq\frac{1}{2}$ we have: \begin{align}\label{equ:firstapprox} \left\|\frac{\ket{\psi(\epsilon)}}{\|\ket{\psi(\epsilon)}\|}-\ket{\phi_0}\right\|\leq 4\tau(\epsilon) \end{align} \end{lemma} \begin{proof} By the triangle inequality we have: \begin{align}\label{equ:unnormalized2} \left\|\frac{\ket{\psi(\epsilon)}}{\|\psi(\epsilon)\|}-\ket{\phi_0}\right\|\leq\left\|\frac{\ket{\psi(\epsilon)}}{\epsilon^a}-\ket{\phi_0}\right\|+\left\|\frac{\ket{\psi(\epsilon)}}{\|\ket{\psi(\epsilon)}\|}-\frac{\ket{\psi(\epsilon)}}{\epsilon^a}\right\| \end{align} Let us analyze the first term in the expression above. Expanding the polynomials we see that: \begin{align}\label{equ:firsttriangle} \left\|\frac{\ket{\psi(\epsilon)}}{\epsilon^a}-\ket{\phi_0}\right\|=\left\|\sum\limits_{l=1}^{e}\epsilon^{l}\ket{\phi_l}\right\|\leq \tau(\epsilon) \end{align} by a triangle inequality. Let us now analyze the second term. We have: \begin{align}\label{equ:normalized} &\left\|\frac{\ket{\psi(\epsilon)}}{\|\ket{\psi(\epsilon)}\|}-\frac{\ket{\psi(\epsilon)}}{\epsilon^a}\right\|=\left|\frac{1}{\|\ket{\psi(\epsilon)}\|}-\frac{1}{\epsilon^a}\right|\|\ket{\psi(\epsilon)}\|=\left|\frac{1}{\epsilon^{-a}\|\ket{\psi(\epsilon)}\|}-1\right|\epsilon^{-a}\|\ket{\psi(\epsilon)}\| \end{align} Again by a triangle inequality and the assumption that $\|\phi_0\|=1$, it follows from eq.~\eqref{equ:expansionhigherorder} that: \begin{align*} \|\epsilon^{-a}\psi(\epsilon)\|\leq 1+\tau(\epsilon). \end{align*} Moreover, by a reverse triangle inequality \begin{align*} \left|\epsilon^{-a}\|\ket{\psi(\epsilon)}\|-\|\ket{\phi_0}\|\right|=\left|\epsilon^{-a}\|\ket{\psi(\epsilon)}\|-1\right|\leq\|\epsilon^{-a}\ket{\psi(\epsilon)}-\ket{\phi_0}\|\leq \tau(\epsilon) \end{align*} and we assumed that $\|\phi_0\|=1$. This yields \begin{align*} \epsilon^{-a}\|\psi(\epsilon)\|\geq 1-\tau(\epsilon) \end{align*} and we obtain \begin{align*} \left|\frac{1}{\epsilon^{-a}\|\ket{\psi(\epsilon)}\|}-1\right|\leq\frac{\tau(\epsilon)}{1-\tau(\epsilon)}. \end{align*} Together with Eq.~\eqref{equ:normalized} we conclude that \begin{align}\label{equ:boundonnormalized} \left\|\frac{\ket{\psi(\epsilon)}}{\|\ket{\psi(\epsilon)}\|}-\frac{\ket{\psi(\epsilon)}}{\epsilon^a}\right\|\leq \frac{\tau(\epsilon)(1+\tau(\epsilon))}{1-\tau(\epsilon)}\leq 3\tau(\epsilon), \end{align} as we assumed that $\tau(\epsilon)\leq 1/2$. Inserting the bounds of Equation~\eqref{equ:boundonnormalized} and~\eqref{equ:firsttriangle} into~\eqref{equ:unnormalized2} we obtain the claim in~\eqref{equ:firstapprox}. \end{proof} Thus, we see that in order to obtain an approximation up to an error $\mathcal{O}(\delta L^{-\alpha})$, it suffices to pick $\epsilon_0=\frac{\delta}{L^{\alpha}M}$, where $M=\max \|\phi_l\|$. Indeed, for this choice of parameters, we have $\tau(\epsilon_0)=\mathcal{O}(\delta L^{-\alpha})$. Moreover, we have: \begin{align*} \|\ket{\psi(\epsilon_0)}\|=\mathcal{O}\left(\frac{\delta^a}{L^{a\alpha}M^a}\right). \end{align*} and we expect that the condition number of the underlying maps scales in a similar way. This implies, for instance, that in order to obtain an estimate of the energy of the normalized state $\ket{\psi(\epsilon_0)}/\|\psi(\epsilon_0)\|$, it will be necessary to perform the multiplication $\scalar{\psi(\epsilon_0)}{H\psi(\epsilon_0)}\times\|\psi(\epsilon_0)\|^{-2}$, which entails multiplying two numbers of order $L^{-2a}\delta^{2a}$ and $L^{2a}\delta^{-2a}$, respectively. For $a$ constant this requires a polynomial precision in the computation of expectation values and in case $a$ is at least linear in system size, this requires exponential precision. We conclude that approximating states arising from degenerations by restrictions requires a great amount of precision when computing expectation values and will lead to numerical instabilities as the system size or degree of the degenerations increases. On the other hand, our methods remain stable. This is even more pronounced in the case of tensor networks that are hard to contract exactly. In those cases, it is not feasible to contract the restrictions to the precision we just established are necessary. However, as highlighted in Section~\ref{sec:stableinterpolation}, approximate contractions yield good approximations in bTNS. However, note that in principle some of the low order terms of $\tau(\epsilon)$ may vanish as well, which would lead to better convergence estimates than the ones discussed above. Let us illustrate this phenomenon in the case of the weight states: \subsection{Approximate representations for the weight states} Let us analyze more closely the trade-off between the rank of border rank representations of weight states and the speed at which they converge to the state. As noted in~\cite{Hackbusch_2019}, the representation given in~\eqref{equ:MPSdefining} for the W-state is suboptimal w.r.t. to the convergence speed. Indeed, one can check that: \begin{align}\label{equ:betterrepW} \frac{1}{2\epsilon}\left(\lb \ket{0}+\epsilon \ket{1}\right)^{\otimes L}-\left( \ket{0}-\epsilon \ket{1}\right)^{\otimes L}\right)=\ket{W}+\mathcal{O}(\epsilon^2), \end{align} while the degeneration given in~\eqref{equ:MPSdefining} only converges up to $\mathcal{O}(\epsilon)$. This improved representation is closely connected with the fact that we can also obtain the weight states as: \begin{align}\label{equ:representationderivative} \ket{\chi_{a,L}}=a!\frac{d^a}{d \epsilon^a}\ket{\Gamma_a(\epsilon)}\big |_{\epsilon=0}, \end{align} where \begin{align*} \ket{\Gamma_a(\epsilon)}=(\ket{0}+\epsilon \ket{1}+\ldots+\epsilon^{a}\ket{a})^{\otimes L}. \end{align*} For instance, the degeneration given in Eq.~\eqref{equ:betterrepW} arises from the symmetric difference formula for the derivative of a function: \begin{align*} \frac{f(x+\epsilon)-f(x-\epsilon)}{2\epsilon}=f'(x)+\mathcal{O}(\epsilon^2). \end{align*} Evaluating this formula for $\ket{\Gamma_a(\epsilon)}$ we obtain this improved degeneration. More generally, so-called central finite difference formulas~\cite[Section 10.10]{Quarteroni_2006} allow us to estimate the $a$-th derivative of a function up to an error of order $\mathcal{O}(\epsilon^{2(k+1)})$ by evaluating the function at $2\lfloor \frac{a+1}{2}\rfloor+2k$ points. This immediately yields: \begin{lemma}\label{lem:betterdeg} For $a,L\in \mathds{N}$ and $k\in\mathds{N}_0$ the weight states $\ket{\chi_{a,L}}$ admit a representation of symmetric border rank $2\lfloor \frac{a+1}{2}\rfloor+2k$, $\ket{\chi_{a,L,k}(\epsilon)} $, s.t. \begin{align*} \|\epsilon^{-a}\ket{\chi_{a,L,k}(\epsilon)} -\ket{\chi_{a,L}}\|=\mathcal{O}(\epsilon^{2(1+k)}). \end{align*} \end{lemma} \begin{proof} This immediately follows from the central finite difference formulas together with the representation of the weight states given in~\eqref{equ:representationderivative}. \end{proof} Moreover, it is possible to explicitly compute central difference formulas for a desired order of the derivative and accuracy by solving a system of linear equations~\cite{Quarteroni_2006}. One corollary of Lemma~\ref{lem:betterdeg} is that, even though the weight states do not admit exact system-size independent TI representations as matrix product states, the accuracy with which we can approximate them increases exponentially with the bond dimension. In principle these representations can be used to obtain more efficient approximate contractions schemes for states in bTNS. Indeed, by tensoring with a state with $\epsilon^{-a}\ket{\chi_{a,L,k}(\epsilon)}$ for $k$ large enough instead of $\ket{\chi_{a,L}}$ for small enough $\epsilon$ will lead to approximate contraction schemes that do not depend on $L$ and do not blow up the bond dimension of the underlying states. But it remains unclear at this stage how numerically stable these methods are. \section{Stable Interpolation}\label{sec:stableinterpolation} In this section, we discuss the stability result related to the border rank contraction strategy presented in the main text to compute the expectation values of an observable for a state in the new ansatz class. Given a state $\ket{\phi} \in \bTNS^{G}_{D,a,\mathfrak{d},d}$, the border rank contraction strategy considers the state $\ket{\phi(\epsilon)} = \ket{\Omega^{(G)}_D} \otimes \ket{\chi_{a,\mathfrak{d},L}(\epsilon)}$ where $\ket{\chi_{a,\mathfrak{d},L}(\epsilon)}$ is a border rank expression for $\ket{\chi_{a,\mathfrak{d},L}}$ (e.g., the one arising from Proposition \ref{thm:degwweight}. Given an observable $O : (\mathbb{C}^d)^{\otimes L} \to (\mathbb{C}^d)^{\otimes L}$, define \begin{align}\label{equ:expectationvalueeps} p(\epsilon) = \epsilon^{-2a}\scalar{\phi(\bar{\epsilon})}{O\phi(\epsilon)}; \end{align} then $p(0) = \scalar{\phi}{O\phi}$ is the desired expectation value. Rather than evaluating $p(0)$, in the border rank strategy we recover the value of $p(0)$ via Lagrange interpolation, by evaluating $p(\epsilon)$ at $2(L\mathfrak{d}-a) +1$ points. Expanding the polynomial, we observed that the evaluation of $p(\epsilon)$ can be performed in terms of $(a+1)^2$ overlaps of states in $\TNS^{G}_{D,d}$. In the main text, we only considered exact contraction schemes to compute such overlaps. However, beyond the case of 1D systems, exact contraction of tensor network states is known to be hard~\cite{PhysRevLett.98.140506,Haferkamp_2020} and, in practice, approximate contraction schemes are used~\cite{Orus_practical}. Thus, it is of paramount importance for the applicability of the border rank contraction scheme that the interpolation step is robust: in other words, even if the values of $p(\epsilon)$ at the $2(L\mathfrak{d} -a)$ interpolation points are only exact up to an error $\delta$, one should still be able to recover the value at $0$ up to an error $\mathcal{O}(\delta)$. Choosing the interpolation points to be roots of unity achieves this result. \begin{lemma}[Stable polynomial interpolation] Let $p:\mathds{C}\to\mathds{C}$ be a polynomial of degree $k$ and $z_j=e^{\frac{2\pi ij}{k}}$ for $0\leq j \leq k-1$ be $k$-th roots of unity. Let $c_0 , \dots , c_{k-1} \in\mathds{C}$ be $k$ points such that there exists $\delta > 0$ with \begin{align}\label{equ:localapprox} \left|p(z_j)-c_j\right|\leq \delta. \end{align} Then: \begin{align*} \left|p(0) -\frac{1}{k}{\textstyle \sum}_0^{k-1} c_j\right|\leq\delta. \end{align*} \end{lemma} \begin{proof} Via Lagrange interpolation \begin{align*} p(0)=\frac{1}{k}{\textstyle \sum}_0^{k-1} p(z_j). \end{align*} Therefore \begin{align*} \left|p(0) - \frac{1}{k}{\textstyle \sum}_0^{k-1} c_j\right| = \frac{1}{k}\left|{\textstyle \sum}_0^{k-1} ( p(z_j) - c_j ) \right| \leq \frac{1}{k}{\textstyle \sum}_0^{k-1}\bigl|p(z_j) - c_j\bigr| \leq \delta \end{align*} by a triangle inequality. \end{proof} This result shows that, choosing the interpolation points to be the $2aL$-th roots of unity, if the approximate contraction scheme only provides the values of $z_j^{-2a}p(z_j)$ up to an error $\delta$. Note that $z_j^{-2a}$ is a complex number of modulus $1$, so $c_j$ satisfying $|p(z_j)-c_j|\leq\delta$ also satisfies $|z_j^{-2a}p(z_j)-c_jz_j^{-2a}|$. The resulting approximate value of $p(0)$ is up to an error $\delta$ as well. \bibliographystyle{plain}
\section{Introduction} Convolutional Neural Networks (ConvNets) have achieved phenomenal success in computer vision~\cite{krizhevsky2012imagenet,simonyan2014very,szegedy2015going,he2015delving,ioffe2015batch,he2016deep,xie2017aggregated,huang2017densely}. While shallow ConvNets with a few layers have existed for decades~\cite{lecun1989backpropagation, denker1989neural, lecun1990handwritten, lecun1998gradient}, it is only until recently that networks with hundreds or even thousands of layers can be effectively trained. Such \emph{deep} ConvNets are able to learn sophisticated decision rules for complex practical data, therefore are usually indispensable for obtaining state-of-the-art performance. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figs/teaser.pdf} \label{fig:net} \vspace{-1.2em} \caption{A basic block of an Isometric Network (ISONet). Each block contains only convolution and nonlinear activation layers, with an identity skip connections (for R-ISONet only). The convolution is initialized as the (Kronecker) delta kernel and regulated to be (near) orthogonal during training. The activation is Shifted ReLU (SReLU) $\phi(\cdot)$ with a learnable parameter $b$ for obtaining a balance between nonlinearity and isometry. The figure shows three examples of the SReLU with $b = 1, -1$ and $-3$. } \end{figure} Training \emph{deep} ConvNets is inherently difficult~\cite{pascanu2013difficulty,glorot2010understanding}. Despite widespread interests in this problem, it has not been made possible until the development of proper weight initialization~\cite{glorot2010understanding,he2015delving}, feature map normalization~\cite{ioffe2015batch}, and residual learning techniques~\cite{he2016deep,srivastava2015highway}. Following these initial works, a wide variety of network architectural components including novel nonlinear activation, weight initialization, weight regularization, and residual learning techniques have been purposed in the literature (see Section~\ref{sec:previouswork} for an overview). Such techniques are motivated and justified from diverse perspectives, such as prevention of dead neurons \cite{maas2013rectifier}, promotion of self-normalization \cite{klambauer2017self}, reduction of filter redundancy \cite{wang2019orthogonal}, improvement of generalization~\cite{jia2019orthogonal}, to name a few. The abundance of existing architectural components and the diversity of their design principles posit ConvNets architectural design a difficult task. After all, which combination of components should one use for their networks? Such a challenge motivates us to pose the following question: \emph{Is there a central guiding principle for training very deep ConvNets?} \textbf{Isometric learning.} We show that the \emph{isometric} property, where each layer of the network preserves the inner product for both forward and backward propagation, plays a central role in training deep ConvNets. To illustrate this, we take a minimalist approach and show that a vanilla deep network (i.e., composed of interleaved convolution and nonlinear layers only) can be trained as long as both the convolution and nonlinear activation are close to an isometry. Specifically, we design the Isometric Networks (ISONets) where the convolution layer is simply initialized as {\em the identity} and is regularized to be {\em near orthogonal} during training, and the nonlinear layer is the {\em Shifted ReLU} (SReLU) obtained by shifting regular ReLU towards being an identity around the origin with a learnable parameter (see Figure~\ref{fig:net}). We perform extensive experiments with so designed simple networks on image classification using the ImageNet dataset~\cite{deng2009imagenet,russakovsky2015imagenet}. Our results show that an ISONet with more than $100$ layers is trainable and can achieve surprisingly competitive performance. To the best of our knowledge, this is the best performing \emph{vanilla} ConvNet for such tasks. From a practical perspective, isometric learning provides an important guiding principle for addressing challenges in network architectural design. One such challenge is that the commonly used normalization layers in modern networks \cite{ioffe2015batch,ba2016layer,wu2018group} require certain statistical independence assumptions to hold and large enough batch size or channel number for precise estimation of such statistics. This drawback significantly limits their applications to robust learning \cite{sun2019test}, contrastive learning \cite{chen2020simple}, implicit models \cite{bai2020multiscale}, object detection and so on. To address such a challenge, we develop a Residual ISONet (R-ISONet) that does not contain any normalization layer. In particular, we introduce skip connection to ISONet as it helps to better promote isometry of the network~\cite{tarnowski2019dynamical}. We evaluate the performance of R-ISONet for object detection and instance segmentation on the COCO dataset~\cite{lin2014microsoft}. In these applications, the batch size is very small due to the high resolution of the images, so that batch normalization becomes ineffective. Our experiment shows that R-ISONet obtains better performance than standard ResNet. Comparing with existing techniques for addressing the small-batch challenge~\cite{luo2018differentiable,wu2018group,singh2019filter}, R-ISONet has the benefit that it does not suffer from a slowdown during inference. Isometry and many closely related notions have been implicitly and explicitly studied and utilized in many previous works for improving deep networks. In particular, techniques to promote isometric property have been widely practiced in the literature. However, they are often used together with many other design techniques and none of the previous work has clearly demonstrated that the isometry property {\em alone} ensures surprisingly strong performance for deep networks. At the end (Section \ref{sec:previouswork}), we discuss how isometric learning offers a simple but unified framework for understanding numerous seemingly different and diverse ideas in the literature, supporting the hypothesis that isometric learning offers a central guiding principle for designing and learning deep networks. \section{Isometric Networks} \label{sec:isonet} In this section, we introduce the isometric principle and present the isometric network (ISONet). In Section~\ref{sec:prelim}, we formally introduce the isometric principle in a vanilla net as enforcing both the convolution and nonlinear activation layers to be close to an \emph{isometry}. Subsequently, Section~\ref{sec:convolution} derives the notion of isometry for convolution, and explains how it can be enforced at initialization and in the training process. In Section~\ref{sec:activation}, we discuss principles for designing nonlinear activation functions in isometric learning and argue that one needs to strike a balance between isometry and nonlinearity, which cannot be achieved at the same time. Finally, in Section~\ref{sec:residual}, skip connections (or residual structure) can be naturally introduced to ISONet to further improve isometry, which leads to the R-ISONet. \subsection{Isometric Learning} \label{sec:prelim} We first develop a vanilla network that is composed of interleaved convolution\footnote{We consider convolution for 2D signals (e.g., images), though our analysis trivially generalizes to arbitrary dimensional signals.} and nonlinear activation layers, i.e., \begin{equation} \boldsymbol{x}^\ell = \phi(\boldsymbol{y}^\ell), ~~\boldsymbol{y}^\ell = \mathcal{A}^\ell \boldsymbol{x}^{\ell-1}, ~~~\ell=1, \ldots, L,\label{eq:forward} \end{equation} where $\mathcal{A}^\ell: \Re^{C^{\ell-1} \times H\times W} \to \Re^{C^{\ell} \times H\times W}$ denotes a convolution operator, $\phi(\cdot)$ denotes a point-wise nonlinear activation function, and $\boldsymbol{x}^0 \in \Re^{C^0 \times H \times W}$ is the input signal. Assuming a squared loss given by Loss$=\frac{1}{2}\|\boldsymbol{z} - \boldsymbol{x}^L\|_2^2$, the backward propagation dynamic at $\boldsymbol{x}^0$ is given by \begin{equation}\label{eq:backward} \frac{\partial \text{Loss}}{\partial \boldsymbol{x}^0} = (\mathcal{A}^1)^* \mathcal{D}^1 \cdots (\mathcal{A}^L)^* \mathcal{D}^L (\boldsymbol{z} - \boldsymbol{x}^L), \end{equation} where $(\mathcal{A}^\ell)^*: \Re^{ C^{\ell} \times H\times W} \to \Re^{C^{\ell-1} \times H \times W}$ is the adjoint operator of $\mathcal{A}^\ell$, and $\mathcal{D}^\ell: \Re^{C^{\ell} \times H \times W} \to \Re^{C^{\ell} \times H \times W}$ operates point-wise by multiplying the $(c, h, w)$-th entry of the input by $\phi'(\boldsymbol{y}_{c,h,w}^\ell)$. For the operator $\mathcal{A}^\ell$ and $\phi(\cdot)$ in the forward dynamic and $(\mathcal{A}^\ell)^*$ and $\mathcal{D}^\ell$ in the backward dynamic, we may define the notion of \emph{isometry} as follows: \begin{definition}[Isometry] \label{def:isometry} A map $\mathcal{A}: \Re^C \to \Re^M$ is called an isometry if \begin{equation} \langle \mathcal{A} \boldsymbol{x}, \mathcal{A} \boldsymbol{x}' \rangle = \langle \boldsymbol{x}, \boldsymbol{x}' \rangle, ~~\forall \{\boldsymbol{x}, \boldsymbol{x}'\} \subseteq \Re^C. \end{equation} \end{definition} Our ISONet is designed to maintain that all transformations ($\mathcal{A}, \mathcal{A}^*, \phi$, and $\mathcal{D}$) in the forward and the backward dynamics are close to an \emph{isometry}. In the following, we develop techniques for enforcing isometry in convolution and nonlinear activation layers. As we show in Section~\ref{sec:experiments}, combining these components enables effective training of ISONet with more than $100$ layers on image classification tasks. \subsection{Isometry in Convolution} \label{sec:convolution} In this section, we show how to impose the property of isometry for convolutional layers in ConvNets, and explain how it can be achieved at initialization and through network training. \textbf{Notation.} For computation concerning convolution, we treat a 2D signal $\boldsymbol{\xi} \in \Re^{H \times W}$ as a function defined on the discrete domain $[1, \ldots, H] \times [1, \ldots, W]$ and further extended to the domain $\bb Z \times \bb Z$ by padding zeros. Similarly, we regard any 2D kernel $\boldsymbol{\alpha} \in \Re^{k\times k}$ with $k = 2k_0 + 1$ for some integer $k_0$ as a function defined on the discrete domain $[k_0-1, \ldots, 0, \ldots, k_0+1] \times [k_0-1, \ldots, 0, \ldots, k_0+1]$ and extended to $\bb Z \times \bb Z$ by padding zeros. $\boldsymbol{\xi}[i, j]$ represents the value of the function $\boldsymbol{\xi}$ at the coordinate $(i, j)$. Given any $\boldsymbol{\xi} \in \Re^{H \times W}$ and $\boldsymbol{\alpha} \in \Re^{k \times k}$, the convolution of $\boldsymbol{\xi}$ and $\boldsymbol{\alpha}$ is defined as \begin{equation}\label{eq:def-conv} (\boldsymbol{\alpha} * \boldsymbol{\xi})[i, j] = \sum_{p=-k_0}^{k_0} \sum_{q=-k_0}^{k_0} \boldsymbol{\xi}[i-p, j-q] \cdot \boldsymbol{\alpha}[p, q], \end{equation} and the correlation of $\boldsymbol{\xi}$ and $\boldsymbol{\alpha}$ is defined as \begin{equation}\label{eq:def-corr} (\boldsymbol{\alpha} \star \boldsymbol{\xi})[i, j] = \sum_{p=-k_0}^{k_0} \sum_{q=-k_0}^{k_0} \boldsymbol{\xi}[i+p, j+q] \cdot\boldsymbol{\alpha}[p, q]. \end{equation} In contrast to the conventions in signal processing, the convolution layers (i.e. $\{\mathcal{A}^\ell\}_{\ell=1}^L$ in \eqref{eq:forward}) in modern deep learning frameworks actually perform multi-channel \textit{correlation} operations that map a $C$-channel 2D signal to an $M$-channel 2D signal. Let $\boldsymbol{x} = (\boldsymbol{\xi}_1, \ldots, \boldsymbol{\xi}_C)\in \Re^{C\times H\times W}$ be the input signal where $\boldsymbol{\xi}_c \in \Re^{H \times W}$ for each $c \in \{1, \ldots, C\}$, and let \begin{equation}\label{eq:kernel} \resizebox{.9\hsize}{!}{$ \boldsymbol{A} = \begin{pmatrix} \boldsymbol{\alpha}_{11} & \boldsymbol{\alpha}_{12} & \boldsymbol{\alpha}_{13} & \dots & \boldsymbol{\alpha}_{1C} \\ \boldsymbol{\alpha}_{21} & \boldsymbol{\alpha}_{22} & \boldsymbol{\alpha}_{23} & \dots & \boldsymbol{\alpha}_{2C} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ \boldsymbol{\alpha}_{M1} & \boldsymbol{\alpha}_{M2} & \boldsymbol{\alpha}_{M3} & \dots & \boldsymbol{\alpha}_{MC} \end{pmatrix} \in \Re^{M\times C \times k \times k},$ } \end{equation} be the convolution kernel where each $\boldsymbol{\alpha}_{m,c}$ is a kernel of size $k \times k$ for $c\in\{1, \ldots, C\}$ and $m \in \{1, \ldots, M\}$. The convolution operator $\mathcal{A}$ associated with $\boldsymbol{A}$ is given by \begin{equation}\label{eq:conv_A} \mathcal{A} \boldsymbol{x} := \sum_{c=1}^C \big(\boldsymbol{\alpha}_{1c} \star \boldsymbol{\xi}_c, \ldots, \boldsymbol{\alpha}_{Mc} \star\boldsymbol{\xi}_c\big) \in \Re^{M \times H \times W}. \end{equation} The adjoint of $\mathcal{A}$ that appears in the backward dynamics \eqref{eq:backward}, denoted as $\mathcal{A}^*$, is a mapping from $\Re^{M \times H\times W}$ to $\Re^{C\times H \times W}$: \begin{equation}\label{eq:conv_At} \mathcal{A}^* \boldsymbol{y} := \sum_{m=1}^M \big(\boldsymbol{\alpha}_{m1} * \boldsymbol{\eta}_m, \ldots, \boldsymbol{\alpha}_{mC} * \boldsymbol{\eta}_m\big) \in \Re^{C \times H \times W}, \end{equation} where $\boldsymbol{y} = (\boldsymbol{\eta}_1, \ldots, \boldsymbol{\eta}_M)\in \Re^{M \times H \times W}$ and $\boldsymbol{\eta}_m \in \Re^{H \times W}$. We first study under what conditions of kernel $\boldsymbol{A}$ such that $\mathcal{A}$ and $\mathcal{A}^*$ are isometric. Starting from Definition~\ref{def:isometry} we arrive at the following theorem (see appendix for the proof). \begin{theorem}\label{thm:convolution_isometry} Given a convolution kernel $\boldsymbol{A}\in \Re^{M\times C \times k \times k}$ in \eqref{eq:kernel}, the operator $\mathcal{A}$ is an isometry if and only if \begin{equation}\label{eq:isometry-conv} \sum_{m=1}^M \boldsymbol{\alpha}_{mc} \star \boldsymbol{\alpha}_{mc'} = \begin{cases} \mathbf{\delta} & ~\text{if}~c = c',\\ \textbf{0} & ~\text{otherwise},\\ \end{cases} \end{equation} and the operator $\mathcal{A}^*$ is an isometry if and only if \begin{equation}\label{eq:coisometry-conv} \sum_{c=1}^C \boldsymbol{\alpha}_{mc} \star \boldsymbol{\alpha}_{m'c} = \begin{cases} \mathbf{\delta} & ~\text{if}~m = m',\\ \textbf{0} & ~\text{otherwise}.\\ \end{cases} \end{equation} In above, $\mathbf{\delta}$ is the Kronecker delta function defined on $\bb Z \times \bb Z$ that takes value $1$ at coordinate $(0, 0)$ and $0$ otherwise. \end{theorem} For the case of $M = C$, the isometry of $\mathcal{A}$ is equivalent to the isometry of $\mathcal{A}^*$\footnote{When $M=C$, the isometry of $\mathcal{A}$ implies that it is surjective, therefore unitary, hence $\mathcal{A}^*$ is also an isometry.}. We refer to $\boldsymbol{A}$ as an \emph{orthogonal convolution} kernel if $M=C$ and either $\mathcal{A}$ or $\mathcal{A}^*$ is isometric. On the other hand, if $M \ne C$ then $\mathcal{A}$ and $\mathcal{A}^*$ cannot be both isometric. Nonetheless, we can still enforce isometry of $\mathcal{A}$ (in the case $M\ge C$) or the isometry of $\mathcal{A}^*$ (in the case $M\le C$) by the conditions \eqref{eq:isometry-conv} and \eqref{eq:coisometry-conv}, respectively. \vspace{1em} \begin{example}[Delta kernel] \label{eg:delta} We refer to a convolution kernel $\boldsymbol{A} \in \Re^{ C \times M \times k \times k}$ as the (Kronecker) delta kernel, denoted as $\mathbf{\delta}^{C\times M \times k \times k}$, if its entries indexed by $(i, i, k_0, k_0)$ (assuming $k = 2k_0+1$) for all $i \in \{1, \ldots, \min(C, M)\}$ are set to $1$ and all other entries are set to zero. If $M \ge C$ (resp., $M \le C$), then the operator $\mathcal{A}$ (resp., $\mathcal{A}^*$) associated with a delta kernel is an isometry. Moreover, if $M = C$ then a delta kernel is orthogonal. \end{example} \textbf{Isometry at initialization.} As shown in Example~\ref{eg:delta}, we may initialize all convolution kernels to be isometric by setting them to be the delta kernel, which we refer to as the Delta initialization. Other orthogonal initialization, such as the Delta Orthogonal initialization \cite{xiao2018dynamical}, are also plausible choices. We empirically find that Delta initialization works well and often outperforms Delta Orthogonal initialization. Such initialization is also commonly used in initializing Recurrent Neural Networks~\cite{le2015simple}. \textbf{Isometry during training.} Isometry at initialization does not guarantee that isometry will be preserved through the training process. In addition to Delta initialization, we enforce isometry by penalizing the difference between the left and right hand sides of \eqref{eq:isometry-conv} (or \eqref{eq:coisometry-conv}). As we shown below, this can be easily implemented via modern deep learning packages. In particular, given an input that contains a batch of $N$ multi-channel signals $\boldsymbol{X} := (\boldsymbol{x}_1, \ldots, \boldsymbol{x}_N) \in \Re^{N \times C \times H \times W}$ where each $\boldsymbol{x}_n \in \Re^{C \times H \times W}$ for each $n \in \{1, \ldots, N\}$, and a convolution kernel $\boldsymbol{A} \in \Re^{M\times C \times k \times k}$ defined as in \eqref{eq:kernel}, a convolution function in a typical deep learning framework, denoted as $\text{Conv}(\boldsymbol{A}, \boldsymbol{X})$, performs correlation of $\boldsymbol{A}$ on each of the $N$ signals and stack the resulting $N$ multi-channel signals to a tensor: \begin{equation}\label{eq:conv-operator} \text{Conv}(\boldsymbol{A}, \boldsymbol{X}) = (\mathcal{A} \boldsymbol{x}_1, \ldots, \mathcal{A} \boldsymbol{x}_N). \end{equation} By replacing $\boldsymbol{X}$ in \eqref{eq:conv-operator} with the kernel $\boldsymbol{A}$ itself and using \eqref{eq:conv_A}, we obtain \begin{equation} \begin{split}\label{eq:convAA} & \text{Conv}(\boldsymbol{A}, \boldsymbol{A}) \\ =& \; \big( \mathcal{A}(\boldsymbol{\alpha}_{11}, \ldots, \boldsymbol{\alpha}_{1C}), \ldots, \mathcal{A}(\boldsymbol{\alpha}_{M1}, \ldots, \boldsymbol{\alpha}_{MC}) \big)\\ =& \begin{small} \begin{pmatrix} \sum_{c=1}^C \boldsymbol{\alpha}_{1c}\star \boldsymbol{\alpha}_{1c} & \cdots & \sum_{c=1}^C \boldsymbol{\alpha}_{Mc}\star \boldsymbol{\alpha}_{1c}\\ \vdots & \ddots & \vdots \\ \sum_{c=1}^C \boldsymbol{\alpha}_{1c}\star \boldsymbol{\alpha}_{Mc} & \cdots & \sum_{c=1}^C \boldsymbol{\alpha}_{Mc}\star \boldsymbol{\alpha}_{Mc} \end{pmatrix}. \end{small} \end{split} \end{equation} Comparing \eqref{eq:convAA} with the condition in \eqref{eq:coisometry-conv}, we see that the operator $\mathcal{A}^*$ is an isometry if and only if Conv$(\boldsymbol{A}, \boldsymbol{A})$ is a delta kernel $\mathbf{\delta}^{M \times M \times k \times k}$. Similarly, $\mathcal{A}$ is an isometry if and only if Conv$(\boldsymbol{A}^\top, \boldsymbol{A}^\top) = \mathbf{\delta}^{C \times C \times k \times k}$, where $\boldsymbol{A}^\top$ denotes a kernel with the first two dimension of $\boldsymbol{A}$ transposed. From these results, we can enforce isometry by adding one of the following regularization terms to the objective function: \begin{align}\label{eq:orth-reg} L(\boldsymbol{A}) &= \frac{\gamma}{2} \|\text{Conv}(\boldsymbol{A}, \boldsymbol{A}) - \mathbf{\delta}^{M \times M \times k \times k}\|_F^2, ~~\text{or}\\ L(\boldsymbol{A}^\top) &= \frac{\gamma}{2} \|\text{Conv}(\boldsymbol{A}^\top, \boldsymbol{A}^\top) - \mathbf{\delta}^{C \times C \times k \times k}\|_F^2, \end{align} where $\gamma$ is a regularization coefficient. We use $L(\boldsymbol{A})$ when $C > M$ and $L(\boldsymbol{A}^\top)$ otherwise. \subsection{Isometry in Nonlinear Activation} \label{sec:activation} The rectified linear unit (ReLU) is one of the most popular activation functions for deep learning applications \cite{nair2010rectified}. Defined entry-wise on the input as $\phi(x) = \max(0, x)$, ReLU is an identity map for nonnegative input, but completely removes all negative component. For an input signal that is normalized to zero mean and unit variance, ReLU is far from being an isometry. How can we develop an isometric nonlinear activation layer? \begin{figure}[t] \centering \begin{minipage}[t]{0.3\linewidth} \centering \includegraphics[width=\linewidth]{figs/srelu/linear.pdf} \scriptsize{Purely isometric \\ Linear \\ \vspace{1em} a) Linear} \end{minipage} ~ \begin{minipage}[t]{0.3\linewidth} \centering \includegraphics[width=\linewidth]{figs/srelu/srelu.pdf} \scriptsize{Partially isometric \\ Weakly nonlinear \\ \vspace{1em} b) SReLU} \end{minipage} ~ \begin{minipage}[t]{0.3\linewidth} \centering \includegraphics[width=\linewidth]{figs/srelu/relu.pdf} \scriptsize{Not isometric \\ Strongly nonlinear \\ \vspace{1em} c) ReLU} \end{minipage} \caption{Illustration of isometry in nonlinear activation} \label{fig:srelu} \end{figure} Unfortunately, isometry is innately at odds with nonlinearity. By Mazur-Ulam theorem, any surjective isometry between two normed spaces over $\Re$ is linear up to a translation \cite{nica2013mazur}. Therefore, isometry can never be achieved if any nonlinearity is present. On the other hand, a purely isometric network without nonlinearity is not interesting either, since the entire network becomes a linear transformation which has very limited learning ability. The design of the nonlinear activation function requires striking a good {\em trade-off between isometry and nonlinearity}. We advocate using a Shifted ReLU (SReLU) for achieving such a trade-off. SReLU is obtained by interpolating regular ReLU (for obtaining nonlinearity) and the identity (for obtaining isometry). Given a signal $\boldsymbol{y} \in \Re^{C\times H \times W}$ where $C$ is the number of channels, SReLU is defined point-wise as \begin{equation}\label{eq:SReLU} \phi_{b}(y) = \max(y, b), \end{equation} where $b$ is a parameter that is shared for each channel of $\boldsymbol{y}$. SReLU becomes the regular ReLU if $b = 0$ and the identity if $b \to -\infty$, therefore can be interpreted as a trade-off between nonlinearity and isometry (see Figure~\ref{fig:srelu}). In terms of backward dynamic (see \eqref{eq:backward}), the operator $\mathcal{D}$ associated with $\phi_{b}(\cdot)$ is given as $\mathcal{D}(x) = 1_{y \ge b} \cdot x$, which is an identity map if $y$ is larger than $b$. In our experiments, we find it beneficial to initialize $b$ to be negative values, which indicates the importance of such a trade-off between ReLU and identity. For simplicity, in all our experiments we initialize $b$ to be $-1$ and optimize it in the training process. \subsection{Isometry in Residual Structure} \label{sec:residual} We may further improve the isometric property of each layer of ISONet with a residual component \cite{he2016deep}, which we call a residual ISONet (R-ISONet). The core idea is to introduce a skip connection to ISONet, so that the network learns a \emph{residual} component that is added onto the path of signal propagation (see Figure~\ref{fig:net}). Such a network architecture is automatically near isometric if the residual component is small enough relative to the identity shortcut~\cite{tarnowski2019dynamical}. Motivated by such an observation, we add a scalar multiplier $s$ at the end of each residual branch and initialize $s$ to be zero ($s$ is shared within each channel). Similar design ideas have previously been explored to improve ResNet~\cite{szegedy2017inception,goyal2017accurate, zhang2019fixup}. Since skip connection helps to enforce isometry, R-ISONet exhibits better performance than ISONet. For image classification on ImageNet, R-ISONet obtains almost as good performance as regular ResNet, even though R-ISONet has no normalization layers. Since no normalization layer is required, R-ISONet is particularly suited for applications where normalization layers are ineffective. As we show in the next section, R-ISONet obtains better performance than regular ResNet for object detection tasks on COCO dataset. \section{Experiments} \label{sec:experiments} \subsection{Experimental Setup} \textbf{Setup.} We test the performance of ISONets on the ILSVRC-2012 image classification dataset~\cite{deng2009imagenet, russakovsky2015imagenet}. The training set contains $\app1.28$ million images from $1,\!000$ categories. Evaluation is performed on the validation set which contains $50,\!000$ images. 1-Crop, Top-1 accuracy is reported. \textbf{Network architectures.} The design of network architecture follows from the design of ResNet \cite{he2016deep, goyal2017accurate}, with the only difference being that we change the residual blocks to the block shown in Figure~\ref{fig:net}. In particular, the number of channels and layers in each stage remain the same as ResNet. We find that (R-)ISONet tends to overfit since BatchNorm is removed. Therefore we add one dropout layer right before the final classifier. The dropout probability is $0.4$ for R-ISONet and $0.1$ for ISONet. \textbf{Implementation details.} The hyperparameter settings follow from prior works~\cite{he2016deep, goyal2017accurate}. All models are trained using SGD with weight decay $0.0001$, momentum $0.9$ and mini-batch size $256$. The initial learning rate is 0.1 for R-ISONet and 0.02 for ISONet. The models are trained for 100 epochs with the learning rate subsequently divided by a factor of $10$ at the $30$th, $60$th and $90$th epochs. To stabilize training in the early stage, we perform linear scheduled warmup~\cite{goyal2017accurate} for the first $5$ epochs for both our methods and baseline methods. The orthogonal regularization coefficient $\gamma$ in \eqref{eq:orth-reg} (when used) is 0.0001 except for ISONet-101 where a stronger regularization (0.0003) is needed. For other baselines without normalization or skip connections, we choose the largest learning rate that makes them converge. \subsection{ISONet: Isometry Enables Training Vanilla Nets} In this section, we verify through extensive experiments that isometry is a central principle for training deep networks. In particular, we show that more than $100$-layer ISONet can be effectively trained with neither normalization layers nor skip connections. In addition, we demonstrate through ablation study that all of the isometric components in ISONet are necessary for obtaining good performance. \begin{table}[t] \centering \small \setlength{\tabcolsep}{4pt} \renewcommand{\arraystretch}{1.5} \begin{tabular}{c|c|ccc|c} & Method & SReLU & {\begin{mytabular}[1.2]{c} Delta \\ Init. \end{mytabular}} & \begin{mytabular}[1.2]{c} Ortho. \\ Reg. \end{mytabular} & \begin{mytabular}[1.2]{c} Top-1 \\ Acc. (\%) \end{mytabular} \\ \hline \hline (a) & \demph{ResNet} & & & & \demph{73.29}\\ \hline (b) & Vanilla & & & & 63.09 \\ \hline (c) & & & \checkmark & \checkmark & 46.83 \\ (d) & & \checkmark & & & 67.35 \\ (e) & & \checkmark & & \checkmark & 68.50 \\ (f) & & \checkmark & \checkmark & & 68.55 \\ \hline (g) & ISONet & \checkmark & \checkmark & \checkmark & \textbf{70.45} \\ \end{tabular} \caption{\textbf{Isometric learning (with SReLU, Delta initialization and orthogonal regularization) enables training ISONets on ImageNet without BatchNorm and skip connection. } (a) Regular $34$-layer ResNet with ReLU activation, Kaiming initialization and no orthogonal regularization. (b) Same as ResNet but without BatchNorm and skip connection. (g) Our ISONet with the same backbone as Vanilla. (c-f) Ablation for (g) that shows that the combination of all three isometric learning components is necessary for effectively training ISONet. } \label{tab:abl_iso} \end{table} \begin{figure*}[t] \centering \subfigure{\includegraphics[width=0.24\linewidth]{figs/bias/bias1.pdf}} \subfigure{\includegraphics[width=0.24\linewidth]{figs/bias/bias2.pdf}} \subfigure{\includegraphics[width=0.24\linewidth]{figs/bias/bias3.pdf}} \subfigure{\includegraphics[width=0.24\linewidth]{figs/bias/bias4.pdf}} \vspace{-8pt} \caption{Histogram of the parameter $b$ in SReLU computed for each of the four stages of a 34-layer ISONet. }\label{fig:bias} \end{figure*} \begin{table}[t] \centering \small \setlength{\tabcolsep}{3.5pt} \renewcommand{\arraystretch}{1.6} \begin{tabular}{c|ccccc} Orthogonal coefficient $\gamma$ & 0 & $1e^{-5}$ & $3e^{-5}$ & $1e^{-4}$ & $3e^{-4}$ \\ \hline \hline Top-1 Accuracy (\%) & 68.55 & 70.08 & 70.44 & \textbf{70.45} & 69.32 \\ \end{tabular} \caption{\textbf{Effect of orthogonal coefficients for 34-layer ISONets}. The performance is not sensitive to the coefficient in a wide range.} \label{tab:abl_coeff} \vspace{-0.5em} \end{table} \begin{table}[t] \centering \small \setlength{\tabcolsep}{4pt} \renewcommand{\arraystretch}{1.4} \begin{tabular}{c|c|c|c|c} & Activation & Adaptive $b$? & ~~Initial $b$~~ & Top-1 Acc. (\%) \\ \hline \hline (a) & ReLU & & - & 46.83 \\ \hline (b) & \multirow{3}{*}{SReLU} & & -1.0 & 70.27 \\ (c) & & \checkmark & -1.0 & 70.45 \\ (d) & & \checkmark & -2.0 & 70.04 \\ \end{tabular} \caption{\textbf{Effect of parameter $b$ in SReLU for 34-layer ISONets. }} \label{tab:abl_act} \vspace{-0.5em} \end{table} \textbf{Ablation study of ISONet components.} To demonstrate how each isometric component affects the trainability of deep neural networks, we perform experiments with $34$-layer vanilla neural networks and report results in Table~\ref{tab:abl_iso}. In Table~\ref{tab:abl_iso} (a), we show the result of regular ResNet. If the normalization layers and skip connections in ResNet are removed, the network performance drops by more than $10$ points as shown in Table~\ref{tab:abl_iso} (b). This shows a plain vanilla network cannot be easily optimized. In fact, $34$-layer is the deepest vanilla network we found trainable in our experiments. In contrast, ISONet with neither normalization layers nor skip connections can be effectively trained and obtain competitive $70.45\%$ Top-1 accuracy, as shown in Table~\ref{tab:abl_iso} (g). To our best knowledge, this is the only vanilla network that achieves $>70\%$ accuracy on ImageNet. We further show that all the three isometric components (i.e., Delta initialization, orthogonal regularization and SReLU) are indispensable for training deep ISONet. Firstly, enforcing isometry in convolution alone produces \raise.17ex\hbox{$\scriptstyle\sim$}$46\%$ Top-1 Accuracy, which is far lower than ISONet (see Table~\ref{tab:abl_iso} (c)). The reason is that orthogonal convolution is not suitable for vanilla networks with ReLU activation functions, since the energy may decrease exponentially through multiple layers of the network. Secondly, enforcing isometry in activation functions alone cannot achieve good performance, as shown in Table~\ref{tab:abl_iso} (d). Thirdly, for convolution layers, isometry must be enforced both at initialization as well as during training. This can be seen in Table~\ref{tab:abl_iso} (e) and (f), where the performance of ISONet drops by $2$ points if either Delta initialization or orthogonal regularization is removed. This demonstrates the critical role of isometry during the entire training process. \textbf{Analysis for orthogonal regularization.} To understand the effect of the orthogonal regularization term in \eqref{eq:orth-reg}, we conduct experiments with different values of the regularization coefficient $\gamma$ and report Top-1 accuracy in Table~\ref{tab:abl_coeff}. It is shown that our method is not sensitive to the choice of $\gamma$ in a wide range (from $1e^{-5}$ to $1e^{-4}$), whereas too large ($3e^{-4}$) or no regularization will hurt the performance. \textbf{Analysis for SReLU.} To verify the design idea of SReLU, we perform an ablation study on the effect of parameter $b$ in \eqref{eq:SReLU} and report the results in Table~\ref{tab:abl_act}. Comparing (b) and (c), a trainable threshold in SReLU is better than a fixed one. Comparing (c) and (d), changing the initial value of $b$ from $-1$ to $-2$ reduces the accuracy by less than $0.5$ percent. We also plot the histogram of the learned $b$ in SReLU computed within each of the four stages (corresponding to spatial resolutions $\{56, 28, 14, 7\}$) of ISONet and report the results in Figure~\ref{fig:bias}. In all cases, the histogram is bell-shaped and concentrates near $-1$. This explains why a fixed $b= -1$ produces a good performance as shown in Table~\ref{tab:abl_act} (b). \textbf{Training very deep ISONets. } To demonstrate the effectiveness of isometric principle for training deep networks, we report performance of ISONet with increasing number of layers and report the results in Table~\ref{tab:depth}. Firstly, we observe that a standard vanilla network, either without (Table~\ref{tab:depth} (c)) or with (Table~\ref{tab:depth} (d)) BatchNorm, cannot converge when networks are extremely deep. In contrast, ISONet maintains a competitive accuracy when the depth is beyond $100$ layers. Adding dropout to ISONet further improves the performance by \raise.17ex\hbox{$\scriptstyle\sim$} 0.5 points. On the other hand, the performance ISONet is not as good as ResNet. In the following, we show that when combined with skip connection, the performance of our R-ISONet is on par with ResNet. \begin{table}[t] \centering \small \setlength{\tabcolsep}{4pt} \renewcommand{\arraystretch}{1.5} \begin{tabular}{c|c|c|cccc} & \multirow{2}{*}{Method} & \multirow{2}{*}{\footnotesize{Dropout}} & \multicolumn{4}{|c}{Top-1 Accuracy (\%)} \\ & & & d=18 & d=34 & d=50 & d=101 \\ \hline \hline (a) & \multirow{2}{*}{\demph{ResNet}} & & \demph{69.67} & \demph{73.29} & \demph{76.60} & \demph{77.37} \\ (b) & & \demph{\checkmark} & \demph{68.91} & \demph{73.35} & \demph{76.40} & \demph{77.99} \\ \hline (c) & Vanilla & & 65.67 & 63.09 & \footnotesize{N/A} & \footnotesize{N/A} \\ (d) & Vanilla+BN & & 68.98 & 69.43 & 70.00 & \footnotesize{N/A} \\ \hline (e) & \multirow{2}{*}{ISONet} & & 67.94 & 70.45 & 70.73 & 70.38 \\ (f) & & \checkmark & 68.10 & 70.90 & 71.20 & 71.01 \end{tabular} \caption{\centering\textbf{ISONet with varying depth $d \in \{18, 34, 50, 101\}$ can be effectively trained on ImageNet.} (a, b) Regular ResNet with or without dropout. (c) Same as ResNet but without BatchNorm and skip connection. (d) Same as ResNet but without skip connection. (e, f) Our ISONet with the same backbone as Vanilla. N/A stands for not converging or obtaining an accuracy lower than $40$. } \vspace{-0.5em} \label{tab:depth} \end{table} \begin{table}[h!] \centering \small \setlength{\tabcolsep}{4pt} \renewcommand{\arraystretch}{1.5} \begin{tabular}{c|c|c|cccc} & \multirow{2}{*}{Method} & \multirow{2}{*}{\footnotesize{Dropout}} & \multicolumn{4}{|c}{Top-1 Accuracy (\%)} \\ & & & d=18 & d=34 & d=50 & d=101 \\ \hline \hline (a) & \multirow{2}{*}{ResNet} & & 69.67 & 73.29 & 76.60 & 77.37 \\ (b) & & \checkmark & 68.91 & 73.35 & 76.40 & 77.99 \\ \hline (c) & R-Vanilla & & 65.66 & \footnotesize{N/A} & \footnotesize{N/A} & \footnotesize{N/A} \\ \hline (d) & Fixup & & 68.63 & 71.28 & 72.40 & 73.18 \\ (e) & Fixup++ & & 67.37 & 72.56 & 76.00 & 76.17 \\ \hline (f) & \multirow{2}{*}{R-ISONet} & & 69.06 & 72.17 & 74.20 & 75.44 \\ (g) & & \checkmark & 69.17 & 73.43 & 76.18 & 77.08 \end{tabular} \caption{\textbf{Performance of R-ISONet with varying depth $d \in \{18, 34, 50, 101\}$ on ImageNet. } All networks do not have BatchNorm except (a, b). (c) ResNet with all BatchNorm removed. (d, e) Same as (c), but with Fixup initialization \cite{zhang2019fixup}. (f, g) Our R-ISONet performs comparable to ResNet in (a, b) and better than all networks in (c, d, e). N/A stands for not converging or obtaining an accuracy lower than $40$. Fixup results are reproduced from running the code in \cite{zhang2019fixup} with $100$ training epochs. Fixup++ denotes Fixup with Mixup data augmentation. } \label{tab:depth2} \end{table} \subsection{R-ISONet: a Practical Network without Normalization Layers} \label{sec:exp-R-ISONet} In this section, we evaluate the performance of R-ISONet for ImageNet classification and show that it is comparable to regular ResNet, despite the fact that R-ISONet does not contain BatchNorm. The results are reported in Table~\ref{tab:depth2}. From Table~\ref{tab:depth2} (c), ResNet without BatchNorm cannot converge for $d\ge34$. In contrast, our R-ISONet (Table~\ref{tab:depth2} (f)) can be effectively trained for varying network depth. In addition, R-ISONet is better than previous methods without BatchNorm such as Fixup~\cite{zhang2019fixup} (Table~\ref{tab:depth2} (d)). Since R-ISONet is prone to overfitting due to the lack of BatchNorm, we add dropout layer right before the final classifier and report the results in Table~\ref{tab:depth2} (g). The results show that R-ISONet is comparable to ResNet with dropout (Table~\ref{tab:depth2} (b)) and is better than Fixup with Mixup regularization~\cite{zhang2017mixup}. The superior performance that R-ISONet obtains even without any normalization layers makes it a favorable choice for tasks where statistics in BatchNorm cannot be precisely estimated. In Section~\ref{sec:exp-object}, we demonstrate such advantage of R-ISONet for object detection and instance segmentation tasks. \subsection{Transfer Learning on Object Detection} \label{sec:exp-object} We further evaluate our method for object detection and instance segmentation tasks on COCO dataset~\cite{lin2014microsoft}. The dataset contains $115$k training images and $5$k validation images. We use the mAP (over different IoU threshold) metric to evaluate the performance of the model, and the ``dilated conv5'' variant of Faster RCNN~\cite{ren2015faster} as our detector. The backbone of the network includes all the convolution layers in R-ISONet. The RoIAlign operator is added on top of the last convolution with the last stage having convolution with stride $1$ and dilation $2$. Two fully-connected layers are then used to predict the bounding box scores and regression output using this feature. This design follows prior works~\cite{wu2019detectron2, dai2017deformable, he2019momentum}. The hyper-parameter settings of both ResNet and R-ISONet follows detectron2~\cite{wu2019detectron2}. We train our model for 90k iterations. The learning rate is initialized to be $0.01$ and divide by $10$ at 60k and 80k iterations. The training is performed on 8 GPUs, each of which holds 2 images. To keep a fair comparison with standard protocols in object detection, dropout is not added. The results are reported in Table~\ref{tab:abl_det}. Although the classification accuracy of our R-ISONet is lower than that of ResNet with the same depth, the detection and instance segmentation performance of R-ISONet is better. This demonstrates that our model has better feature transfer abilities and can mitigate the disadvantages introduced by BatchNorm. \begin{table}[t] \centering \small \setlength{\tabcolsep}{5pt} \renewcommand{\arraystretch}{1.5} \begin{tabular}{c|c|cc} & Methods & mAP$^{\text{bbox}}$ & mAP$^{\text{mask}}$ \\ \hline \hline \multirow{2}{*}{34 layer} & ResNet & 35.0 & 32.2 \\ & R-ISONet & \textbf{36.2} & \textbf{33.0} \\ \hline \multirow{2}{*}{50 layer} & ResNet & 37.0 & 33.9 \\ & R-ISONet & \textbf{37.3} & \textbf{34.4} \\ \end{tabular} \caption{\textbf{Performance of R-ISONet with varying depth for object detection on COCO dataset. } R-ISONet \textit{outperforms} standard ResNet, indicating that our model has better transfer ability. } \label{tab:abl_det} \vspace{-0.5em} \end{table} \section{Related Work and Discussion} \label{sec:previouswork} In this paper, we contend that isometry is a central design principle that enables effective training and learning of deep neural networks. In the literature, numerous instantiations of this principle have been explicitly or implicitly suggested, studied, and exploited, often as an additional heuristic or regularization, for improving existing network training or performance. Now supported by the strong empirical evidence presented earlier about isometric learning, we reexamine these ideas in the literature from the unified perspective of isometry. Arguably, the notion of isometry was first explored in the context of weight initialization (Section \ref{sec:c_init}) and then in diverse contexts such as weight regularization (Section~\ref{sec:c_regu}), design of nonlinear activation (Section~\ref{sec:c_activation}), and training techniques for residual networks (Section~\ref{sec:c_residual}). \subsection{In Context of Weight Initialization} \label{sec:c_init} Early works on weight initialization are based on the principle that the variance of the signal maintains a constant level as it propagates forward or backward through multiple layers \cite{lecun2012efficient,glorot2010understanding}. A popular method that provides such a guarantee is the Kaiming Initialization \cite{he2015delving} which derives a proper scaled Gaussian initialization for weights in vanilla convolutional networks with ReLU activation functions. Derivations for general activation functions beyond ReLU is more difficult, but nonetheless can be achieved by working in the regime where the network is infinitely wide using mean-field theory \cite{poole2016exponential,schoenholz2016deep}. From the perspective of isometry, the aforementioned works guarantee that the average of the squared singular values of the input-output Jacobian matrix is close to $1$. However, this \emph{does not mean that the Jacobian is an isometry}, which requires that \emph{all} the singular values concentrate at $1$. In fact, with the common practice of Gaussian weight initialization, isometry can never be achieved regardless of the choice of activation functions \cite{pennington2018emergence}. To address such an issue, orthogonal weight initialization has been extensively studied in the past few years. For linear networks with arbitrary depth, orthogonality of each composing layers trivially leads to an isometry of the input-output Jacobian, and the benefit over Gaussian initialization in terms of training efficiency has been empirically observed \cite{saxe2013exact} and theoretically justified \cite{hu2020provable}. For deep nonlinear networks, isometry may also be achieved if the network works in a local regime that the nonlinearity becomes approximately linear \cite{pennington2018emergence}, and empirical good performance of orthogonal initialization is also observed \cite{mishkin2015all} particularly when combined with proper scaling. This line of work culminates at a recent work \cite{xiao2018dynamical} which shows that orthogonal initialization enables effective training of ConvNets with $10,\!000$ layers. Nonetheless, the performance of the network in \citet{xiao2018dynamical} is far below the state-of-the-art networks, perhaps due to the fact that isometry beyond the initialization point is not guaranteed. The Delta initialization adopted in our method is a particular case of orthogonal initialization for convolution kernels. Despite the existence of other orthogonal initialization \cite{xiao2018dynamical}, we advocate the Delta initialization due to its simplicity and good empirical performance in our evaluation for visual recognition tasks. \subsection{In Context of Weight Regularization} \label{sec:c_regu} A plethora of works has explored the idea of regulating the convolution operators in a ConvNet to be orthogonal in the training process \cite{harandi2016generalized,jia2017improving,cisse2017parseval,bansal2018can,zhang2019approximated,li2019efficient,huang2020controllable}. It is also found that orthogonal regularization helps with training GANs \cite{brock2018large,liu2019oogan} and RNNs \cite{arjovsky2016unitary,lezcano2019cheap}. Despite widely observed performance improvement, the explanation for the effectiveness of orthogonal regularization is rather diverse: it has been justified from the perspective of alleviating gradient vanishing or exploding \cite{xie2017all}, stabilizing distribution of activation over layers~\cite{huang2018orthogonal}, improving generalization~\cite{jia2019orthogonal}, and so on. In our framework, the benefit of orthogonal regularization lies in that it enforces the network to be close to an isometry. To make our argument precise, we first distinguish between the two related concepts of orthogonal weights and orthogonal convolution. When enforcing orthogonality of convolution kernels in convolutional neural networks, all of the works mentioned above are based on flattening a 4D kernel into a 2D matrix and imposing orthogonality on the matrix. We refer to such a method as imposing \emph{weight orthogonality}, which is not the same as the orthogonality of convolution as discussed in Section~\ref{sec:convolution}. For example, in \citet{bansal2018can} a kernel $\boldsymbol{A} \in \Re^{M \times C \times k \times k}$ is reshaped into a matrix of shape $M \times (C \times k \times k)$ and is enforced to be row-orthogonal. That is, \begin{equation}\label{eq:coisometry-conv-flatten} \sum_{c=1}^C \langle \text{vec}(\boldsymbol{\alpha}_{mc}), \text{vec}(\boldsymbol{\alpha}_{m'c}) \rangle = \begin{cases} 1 & ~\text{if}~m = m',\\ 0 & ~\text{otherwise},\\ \end{cases} \end{equation} where vec$(\boldsymbol{\alpha}_{mc})$ denotes a vector of length $k \times k$ obtained from flattening $\boldsymbol{\alpha}_{mc}$. Comparing \eqref{eq:coisometry-conv-flatten} with \eqref{eq:coisometry-conv}, it is clear that such a regularization is necessary, but not sufficient, for the operator $\mathcal{A}^*$ to be isometric. Therefore imposing weight orthogonality as in previous works can be interpreted as partially enforcing network isometry as well. To the best of our knowledge, the only works that have derived orthogonality for convolution kernels are \citet{xiao2018dynamical} and \citet{wang2019orthogonal}. \citet{xiao2018dynamical} provides a means of constructing orthogonal convolution kernels, but it can only represent a subset of all orthogonal convolutions \cite{li2019preventing}. In addition, while the method in \citet{xiao2018dynamical} can be used to generate a random orthogonal convolution, it does not provide a means of enforcing orthogonality in the training process. We become aware of a very recent work \cite{wang2019orthogonal} during the preparation of this paper, which derives the notion of orthogonal convolution that is equivalent to ours. However, the objective of our work is different from theirs. Instead of improving an existing network by adding an additional regularization, our work aims to show that isometry is the most central principle to design effective deep vanilla networks. And as shown in Table~\ref{tab:abl_iso}, using orthogonal regularization alone is not enough for training deep vanilla networks. Meanwhile, the derivation in \cite{wang2019orthogonal} is based on expressing convolution as matrix-vector multiplication using a doubly block-Toeplitz matrix and using the notion of orthogonality for matrices. Such a derivation is limited to 2D convolution while generalization to higher dimensional convolution may become very cumbersome. Moreover, the definition is restricted to discrete time signals and does not adapt to continuous time signals. In contrast, our definition of orthogonal convolution can be extended for higher-dimensional convolution and for continuous times signals by properly redefining the operator ``*'' in \eqref{eq:def-conv}, therefore may bear broader interests. \subsection{In Context of Nonlinear Activation} \label{sec:c_activation} Many of the important variants of nonlinear activation functions developed over the past few years can be interpreted as obtaining closer proximity to isometry. Early works on improving ReLU such as Leaky ReLU \cite{maas2013rectifier}, Parametric ReLU \cite{he2015delving} and Randomized ReLU \cite{xu2015empirical}, which are generically defined as \begin{equation}\label{eq:LReLU} f(x) = \begin{cases} x & \text{if}~~ x \ge 0, \\ \alpha x & \text{otherwise}, \end{cases} \end{equation} with the parameter $\alpha >0$ being fixed, learned and randomly chosen, respectively. Motivation for this family of activation functions comes from the dead neuron issue of ReLU, which states that negative input values give rise to zero gradients that prevents effective training of the network. The Exponential Linear Unit (ELU) \cite{clevert2015fast} and its variants \cite{trottier2017parametric,klambauer2017self}, defined as \begin{equation}\label{eq:ELU} f(x) = \begin{cases} \gamma x & \text{if}~~ x \ge 0, \\ \alpha (\exp(x/\beta)-1) & \text{otherwise,} \end{cases} \end{equation} with $\alpha, \beta$ and $\gamma$ being trainable or fixed parameters, is another family of activation functions that may solve the dead neuron issue. Another important motivation for ELU is that it pushes the mean of the activation closer to zero, therefore alleviates the issue with regular ReLU that the bias of the input signal is always shifted towards positivity. Such benefit is further confirmed by a theoretical study \cite{klambauer2017self} which shows that a zero mean and unit variance signal converges towards being zero mean and unit variance after propagating over multiple layers. Empirically, a very recent work \cite{huang2019sndcnn} demonstrates that a 50-layer neural network without batch normalization and skip connection may be effectively trained for speech recognition tasks by using ELU instead of ReLU. The SReLU that we adopt in the isometric network is closely related to the ELU family. To the best of our knowledge, a variant of SReLU (in which the parameter is fixed and not optimizable) first appears in \citet{clevert2015fast}, the paper that proposes ELU, where it is shown to outperform ReLU and Leaky ReLU by a large margin and has similar performance as ELU. Besides, SReLU is also adopted in \cite{qiu2018frelu} as an important baseline. Recently, SReLU is rediscovered in \cite{xiang2017effects,singh2019filter} for alleviating the bias shifting issue. We argue that aside from the benefits claimed by the original papers, the activation function families \eqref{eq:LReLU}, \eqref{eq:ELU} as well as the SReLU are advantageous over the regular ReLU as they bring the network closer to an isometry. At an intuitive level, both \eqref{eq:LReLU} (with $0 < \alpha < 1$), \eqref{eq:ELU} (with $\gamma=1$ and $0 < \alpha < 1$ and $\beta=1$) and SReLU lie between ReLU and identity, therefore may be considered as a tradeoff between obtaining nonlinearity and isometry. From a theoretical perspective, the analysis from \cite{pennington2018emergence} reveals that SReLU combined with random orthogonal initialization can achieve dynamic isometry, while regular ReLU cannot. \subsection{In Context of Residual Learning} \label{sec:c_residual} Ever since the inception of residual learning \cite{he2016deep}, there has been no lack of effort in further enhancing its performance. In particular, there is a line of work that demonstrates the benefit of reducing the energy on the residual branch of a ResNet. This is studied from different perspectives such as dynamic isometry~\cite{tarnowski2019dynamical,qiu2018frelu}, training failure modes~\cite{taki2017deep,hanin2018start,balduzzi2017shattered}. Such design is also empirically applied in different ways such as BatchNorm initialization~\cite{goyal2017accurate}, adding a small scalar in the residual branch~\cite{zagoruyko2017diracnets,szegedy2017inception}, and 0-initialized convolution~\cite{zhang2019fixup}, all of which brings the network closer to an isometry. With a careful design along this line of study \cite{zhang2019fixup}, deep ResNet can be effectively trained to obtain competitive performance on visual recognition tasks, even without the help of BatchNorm layers. This line of research as well as our simple R-ISONet verifies the effectiveness of isometry in the design the network structures of residual learning. \section{Conclusion} In this paper, we have demonstrated through a principle-guided design and strong empirical evidence why isometry is likely to be the main key property that enables effective learning of deep networks and ensures high performance on real visual recognition tasks. With this design principle, one may achieve competitive performance with much simplified networks and eased training. We also argue that isometric learning provides a unified principle that helps explain numerous ideas, heuristics and regularizations scattered in the literature that exploit this property and are found effective. We believe that the isometry principle may help people design or discover new simple network operators and architectures with much-improved performance in the future. \section*{Acknowledgements} The authors acknowledge support from Tsinghua-Berkeley Shenzhen Institute Research Fund. Haozhi is supported in part by DARPA Machine Common Sense. Xiaolong is supported in part by DARPA Learning with Less Labels. We thank Yaodong Yu and Yichao Zhou for insightful discussions on orthogonal convolution. We would also like to thank the members of BAIR for fruitful discussions and comments. \clearpage
\section{Introduction} Data sets are rarely clean and ready to use when first collected. More often than not, they need to undergo some form of pre-processing before analysis, involving expert human supervision and manual adjustments \cite{PRE1,PRE2}. Filling missing entries, correcting noisy samples, filtering collection artefacts and other similar tasks are some of the most costly and time consuming stages in the data modeling process and pose an enormous obstacle to machine learning at scale \cite{TIME}. Traditional data cleaning methods rely on some degree of supervision in the form of a clean dataset or some knowledge collected from domain experts. However, the exponential increase of the data collection and storage rates in recent years, makes any supervised algorithm impractical in the context of modern applications that consume millions or billions of datapoints. In this paper, we introduce a novel variational framework to perform automated data cleaning and recovery without any example of clean data or prior signal assumptions. \begin{figure}[t] \centering \vspace{-0.5cm} \includegraphics[width=\linewidth]{concept_6.pdf} \vspace{-0.3cm} \caption{\textbf{(a)} Example of Bayesian recovery from corrupted data with a Tomographic Auto-Encoder (TAE) on corrupted MNIST. The TAE recovers posterior probability densities $q(x|y_i)$ for each corrupted sample $y_i$. We can draw from these to explore different possible clean solutions. \textbf{(b)} Two dimensional Bayesian recovery experiment. (i) Observed set of corrupted data $Y$, with the point we are inferring from $y_i$ highlighted. (ii) Ground truth hidden clean data with the target point $x_i$ highlighted, along with the posterior $q(x|y_i)$ reconstructed by a VAE. (iii) Posterior $q(x|y_i)$ recovered with our TAE. While the VAE posterior collapses to a single point, the TAE reconstructs a rich posterior that adjusts to the data manifold.} \vspace{-0.3cm} \label{fig:concept} \end{figure} The Tomographic auto-encoder (TAE), is named in analogy with standard tomography. Tomographic techniques for signal recovery aim at reconstructing a target signal, such as a 3D image, by algorithmically combining different incomplete measurements, such as 2D images from different view points, subsets of image pixels or other projections \cite{TOM1}. The TAE extends this concept to the reconstruction of data manifolds; our target signal is a clean data set, where corrupted data is interpreted as incomplete measurements. Our aim is to combine these to reconstruct the clean data set. More specifically, we are interested in performing Bayesian recovery, where we do not simply transform degraded samples into clean ones, but recover probabilistic functions, with which we can generate diverse clean signals and capture uncertainty. Uncertainty is considerably important when cleaning data. If we are over-confident about specific solutions, errors are easily ignored and passed on to downstream tasks. For instance, in the example of figure \ref{fig:concept}(a), some corrupted observations are consistent with multiple digits. If we were to impute a single possibility for each sample, the true underlying solution may be ignored early on in the modeling pipeline and the digit will be consistently mis-classified. If we are instead able to recover accurate probability densities, we can remain adequately uncertain in any subsequent processing task. Several variational auto-encoder (VAE) models have been proposed for applications that can be considered special cases of this problem \cite{DEN_VAE1,MIS_VAE1,MUL_VAE1} and, in principle, they are capable of performing Bayesian reconstruction. However, we show that surrogating variational inference (VI) in a latent space with VAEs results in collapsed distributions that do not explore the different possibilities of clean samples, but only return single estimates. The TAE performs approximate VI in the space of recovered data instead, through our \textit{reduced entropy condition} method. The resulting posteriors adequately explore the manifold of possible clean samples for each corrupted observation and, therefore, adequately capture the uncertainty of the task. In our experiments we focus on data recovery from noisy samples and missing entries. This is one of the most common data corruption settings being encountered in a wide range of domains with different types of data \cite{MICE,MIS1}. By testing our approach in this prevalent scenario, we can closely compare with recently proposed VAE approaches \cite{MIS_VAE1, MIS_VAE2,MIS_VAE3}. We show how the existing VAE models exhibit the posterior collapse problem while the TAE produces rich posteriors that capture the underlying uncertainty. We further test TAEs on classification subsequent to imputation, demonstrating superior performance to existing methods in these downstream tasks. Finally, we use a TAE to perform automated missing values imputation on raw depth maps from the NYU rooms data set. \section{Method} We wish to build and train a parametric probability density function (PDF) $q(x|y)$, which takes as inputs corrupted samples $y$ and generates different possible corresponding clean data $x \sim q(x|y)$ through sampling. As natural data often lie on highly non-linear manifolds, we need this PDF to capture complicated modalities, e.g. the distribution of plausible images consistent with one of the corrupted observations in figure \ref{fig:concept}(a) explores diverse digits arranged in complex configurations in a high-dimensional space. A suitable recovery PDF $q(x|y)$ needs to be able to capture such complexity. \begin{figure} \includegraphics[width=\textwidth]{models_3.pdf} \vspace{-0.3cm} \caption{Training LVMs for data recovery. \textbf{(a)} Structure of a conditional LVM used to infer approximate posteriors $q(x|y)$ of clean data $x$ from corrupted observations $y$ as conditional inputs. \textbf{(b)} Training of $q(x|y)$ using a VAE. The clean data prior $p(x)$ and the approximate posterior $q(x|y)$ share the same latent space $z$ and generator $p(x|z)$, which results in collapsed posteriors. \textbf{(c)} Training of $q(x|y)$ using our TAE model. The prior $p(x)$ and posterior $q(x|y)$ are modelled with distinct LVMs, conceptually separating clean data structure from conditional inference.} \label{fig:models} \end{figure} In order to obtain distributions of sufficient capacity for the task, we construct $q(x|y)$ as a conditional latent variable model (LVM). Conditional LVM neural networks have achieved efficient and expressive variational inference in many recovery settings, capturing complex solution spaces in high dimensional problems, such as image reconstruction \cite{PLUG, CGAN, AH}. The conditional LVM consists of a first conditional distribution $q(z|y)$ mapping input corrupted data $y$ to latent variables $z$, and a second inference $q(x|z,y)$ mapping latent variables to output clean data $x$. The resulting PDF can be written \begin{equation}\label{lvm_post} \begin{split} q(x|y) = \int q(z|y) q(x|z,y) dz, \end{split} \end{equation} where both $q(z|y)$ and $q(x|z,y)$ are simple distributions, such as isotropic Gaussians, whose moments are inferred by neural networks taking the respective conditional arguments as inputs. Figure \ref{fig:models}(a) shows a graphical model for the conditional LVM. The approach to train $q(x|y)$ varies depending on the prior modelling assumptions we make and the data we have. For instance, in supervised variational inference, a training set of paired corrupted and clean data is used as training inputs $y$ and outputs $x$. The observed distributions of clean data $x$ can then be matched by parametric ones through a VAE or GAN training strategy \cite{CVAE,AH,VICI}. We are instead interested in the unsupervised situation, where we only have corrupted data $Y=\{ y_{1:N} \}$, a functional form for the corrupted data likelihood $p(y|x)$, e.g., missing values and additive noise, and we are interested in capturing the posterior $p(x|y)$, i.e, the distributions of possible clean data $x$ for each corrupted observation $y$. Training a conditional LVM to fit posteriors without any ground truth examples $x$ is rather challenging, as we do not have data to encode from, in the case of VAE architectures, or adversarially compare with, in the case of GAN models. \subsection{VAEs and the Posterior Collapse Problem} Variational auto-encoders (VAEs) have been proposed for several problems within this definition of unsupervised reconstruction \cite{MIS_VAE2,DEN_VAE1,MUL_VAE1}. These methods lead to good single estimates of the underlying targets. However, they easily over-fit their posteriors resulting in collapsed PDFs $q(x|y)$. Put differently, they are often unable to explore different possible solutions to the recovery problem and return single estimates instead. Figure \ref{fig:concept}(b-ii) shows this pathology in a two dimensional experiment. The reason for this can be explained considering the structure of a VAE when modelling corrupted data and the resulting objective optimised when training the reconstruction posterior $q(x|y)$. The VAE encodes latent vectors $z$ from corrupted observations $y$ with a conditional distribution $q(z|y)$ and reconstructs clean data $x$ with a decoding conditional $q(x|z)$. Reconstructed clean samples $x$ are then mapped back to corrupted samples $y$ with a corruption process likelihood $p(y|x)$, e.g. zeroing out missing entries, to maximise reconstruction of the observations $y$. Concurrently, regularisation in the latent space is induced with a user defined prior $p(z)$ (e.g. a unit Gaussian). The resulting lower bound to be maximised during training can be expressed as follows: \begin{equation}\label{VAE_ELBO} \begin{split} \mathcal{L}_{VAE} = \mathbb{E}_{q(z|y)} \log p(y|z) - KL(q(z|y)||p(z)), \end{split} \end{equation} where the observations likelihood is $p(y|z) = \int p(x|z)p(y|x)dx$ and in some cases, such as for missing values and additive noise, it is analytical. When using a VAE formulation for unsupervised recovery, target data $x$ is completely hidden and, therefore, the model is implicitly introducing a signal prior $p(x) = \int p(z)p(x|z)dz$, which exploits the same decoder as the reconstruction posterior $\int q(z|x)p(x|z) dz$. This is shown in figure \ref{fig:models}(b). This leads to variational inference to only occur in $z$, where the KL divergence is tractable, rather than the target space $x$, resulting in the lower bound of equation \ref{VAE_ELBO} (see derivation in supplementary section A.1). While this may be computationally desirable, if $p(x|z)$ is of sufficient capacity, the model can learn to collapse distributions in $z$ to single estimates in $x$, failing to capture uncertainty. In fact, this is induced by the objective function of equation \ref{VAE_ELBO}; the model finds broad distributions in the latent space $q(z|y)$, which maximise the KL divergence, but the generator $p(x|z)$ collapses them back to single maximum likelihood solutions in x, maximising $\mathbb{E}_{q(z|y)} \log p(y|z)$. \subsection{Separating Posterior and Prior: The Tomographic Auto-Encoder} The proposed TAE sees instead independent models for the variational posterior and the prior, by adopting separate LVMs $q(x|y) = \int q(z|y) q(x|z,y) dz$ and $p(x) = \int p(z_p) p(x|z_p) dz_p$ respectively (see figure \ref{fig:models}(c)). The de-coupling between prior and variational posterior results in variational inference occurring in clean data space $x$, instead of being surrogated to the latent space $z$ only, and we have freedom to design the signal prior LVM $p(x)$ as desired. The ELBO of the TAE model can be expressed as follows: \begin{equation*}\label{TAE_ELBO} \begin{split} \mathcal{L}_{TAE} = \mathbb{E}_{q(x|y)} \log p(y|x) + \mathbb{E}_{q(x|y)} \big[\mathbb{E}_{q(z_p|x)} \log p(x|z_p) - KL(q(z_p|x)||p(z_p)) \big] + H(q(x|y)). \end{split} \end{equation*} The above ELBO is derived in detail in supplementary section A.2. The main difficulty here is to compute and maximise the self entropy of the approximate posterior $H(q(x|y))$, as this conditional distribution is an LVM of the form $q(x|y) = \int q(z|y)q(x|z,y) dz$. \textbf{Reduced Entropy Condition:} Direct computation of the entropy of an LVM model $q(x|y) = \int_z q(z|y)q(x|z,y)dz$ is intractable in the general case. \cite{H_APP} proposed an approximate inference method to compute the gradient of the LVM's entropy for variational inference in latent spaces. However, this approach involves multiple samples to be drawn and evaluated with the LVM, which is expected to scale in complexity as the dimensionality and capacity of the target distribution increase. In our case, we aim to approximately compute and optimise the entropy $H(q(x|y))$ for a distribution capturing natural data, which can be high-dimensional and lie on complicated manifolds. In order to maintain efficiency in the entropy estimation, we propose a new strategy; we identify a class of LVM posteriors for which the entropy reduces to a tractable form and then approximately constrain the posterior to such a class in our optimisation. Our main result is summarized in the following theorem: \begin{theorem}\label{th} If $\frac{q(z|x,y)}{q(z|y)} = B \delta (z-g(x,y))$, where $\delta(\cdot)$ is the Dirac Delta function, $B$ is a real positive parameter and $g(x,y)$ is a deterministic function, then $H(q(x|y)) = H(q(z|y)) + \mathbb{E}_{q(z|y)} H(q(x|z,y))$. \end{theorem} We detail the proof in supplementary A.3. Theorem \ref{th} states that if the posterior over latent variables $q(z|x,y)$ is infinitely more localised than the latent conditional $q(z|y)$, then the LVM entropy $H(q(x|y))$ has the tractable form given above. This condition imposes the LVM posterior to present non-overlapping conditionals $q(x|z,y)$ for different latent variables $z$, but does not impose any explicit restriction to the capacity of the model. We can also formulate the condition as follows: \begin{eqnarray}\label{cond} \begin{split} \mathbb{E}_{q(x,z|y)} \log \frac{q(z|x,y)}{q(z|y)} = C, \quad C \to \infty. \end{split} \end{eqnarray} The proof is provided in supplementary section A.4. To train our posterior $q(x|y)$, we aim to maximise the ELBO $\mathcal{L}_{TAE}$ with the reduced entropy, while enforcing the condition of equation \ref{cond}: \begin{equation}\label{TAE_OBJ} \begin{split} \arg \max \quad & \mathbb{E}_{q(x|y)} \log p(y|x) + \mathbb{E}_{q(x|y)} \big[\mathbb{E}_{q(z_p|x)} \log p(x|z_p) - KL(q(z_p|x)||p(z_p)) \big] \\ + H(q(z|y)) &+ \mathbb{E}_{q(z|y)} H(q(x|z,y)), \quad s.t. \quad \mathbb{E}_{q(x,z|y)} \log \frac{q(z|x,y)}{q(z|y)} = C, \quad C \to \infty. \end{split} \end{equation} While the ELBO is now amenable to stochastic optimization, the constraint is intractable since $C \to \infty$ and the posterior $q(z|x,y)$ is intractable. \textbf{Relaxed Constraint:} To render the constraint tractable, we firstly relax $C$ to be a positive hyper-parameter. The higher the value of $C$, the more localised $q(z|x,y)$ is imposed to be compared to $q(z|y)$ and the closest the reduced entropy is to the true one. To address the intractability of the posterior $q(z|x,y)$, we employ a variational approximation with a parametric function $r(z|x,y)$. In fact, for any valid probability density $r(z|x,y)$, we can prove that \begin{eqnarray}\label{var_rel_lb} \begin{split} &\mathbb{E}_{q(x,z|y)} \log \frac{q(z|x,y)}{q(z|y)} \geq \mathbb{E}_{q(x,z|y)} \log \frac{r(z|x,y)}{q(z|y)}. \end{split} \end{eqnarray} The proof is given in supplementary section A.5. The above bound implicates the following: \begin{eqnarray*}\label{equiv} \begin{split} \mathbb{E}_{q(x,z|y)} \log \frac{r(z|x,y)}{q(z|y)} = C \equiv \mathbb{E}_{q(x,z|y)} \log \frac{q(z|x,y)}{q(z|y)} \geq C. \end{split} \end{eqnarray*} This means that imposing the condition with a parametric distribution $r(z|x,y)$, which is trained along with the rest of the model, ensures deviation from the set condition only by excess. As the exact condition is met only at $\mathbb{E}_{q(x,z|y)} \log \frac{q(z|x)}{q(z|y)} \to \infty$, we can never relax the constraint more than already set by the finite value of $C$. \textbf{The TAE Objective Function:} Having defined a tractable ELBO and a tractable condition, we need to perform the constrained optimisation \begin{equation}\label{TAE_OBJ_2} \begin{split} \arg \max \quad &\mathbb{E}_{q(x|y)} \log p(y|x) + \mathbb{E}_{q(x|y)} \big[\mathbb{E}_{q(z_p|x)} \log p(x|z_p) - KL(q(z_p|x)||p(z_p)) \big] \\ + &H(q(z|y)) + \mathbb{E}_{q(z|y)} H(q(x|z,y)), \quad s.t. \quad \mathbb{E}_{q(x,z|y)} \log \frac{r(z|x,y)}{q(z|y)} = C. \end{split} \end{equation} We use the commonly adopted penalty function method \cite{PF,MUT_VAE} and relax equation \ref{TAE_OBJ_2} to an unconstrained optimisation with the use of a positive hyper-parameter $\lambda$: \begin{equation}\label{TAE_OBJ_3} \begin{split} \arg \max \quad &\mathbb{E}_{q(x|y)} \log p(y|x) + \mathbb{E}_{q(x|y)} \big[\mathbb{E}_{q(z_p|x)} \log p(x|z_p) - KL(q(z_p|x)||p(z_p)) \big] \\ &+ H(q(z|y)) + \mathbb{E}_{q(z|y)} H(q(x|z,y)) - \lambda \left| \mathbb{E}_{q(z,x|y)} \log \frac{r(z|x,y)}{q(z|y)} - C \right|. \end{split} \end{equation} To train the model, we perform the maximisation of equation \ref{TAE_OBJ_3} using the ADAM optimiser. Once the model is trained, we can generate diverse reconstructions from a corrupt observation $y_i$ by sampling from the posterior $q(x|y_i)$. Details of our optimisation are reported in supplementary B.1. We describe how we handle parameters of the corruption process $p(y|x)$ in supplementary B.2. \section{Related Work} \subsection{Supervised Bayesian Reconstruction} The reconstruction of posterior densities from incomplete measurements has been recently investigated in supervised situations, where examples of clean data are available. In particular, conditional generative models were demonstrated with high dimensional data \cite{ITRA}. These methods work by exploiting an LVM to generate diverse realisations of targets conditioned on associated observations \cite{CGAN2,PLUG}. Both conditional generative adversarial networks (CGANs) \cite{CGAN,CGAN2} and conditional VAEs (CVAEs) \cite{CVAE,PLUG} have been studied in this context. These approaches proved successful in a range of recovery tasks, such as reconstruction of images with missing groups of pixels \cite{PLUG}, super-resolution \cite{ITRA}, medical computed tomography reconstructions \cite{AH} and semi supervised situations, where examples of clean data and conditions are available in different amounts \cite{SEMI1,VICI}. Other works aim at reconstructing manifolds of solutions from observations only, but can still be considered supervised as they exploit pre-trained generators \cite{PRET_GAN}. These works make the important observation that when learning to recover data from corrupted or partial observations, there is not a single right solution, but many differently likely ones. We aim to extend this ability to completely unsupervised scenarios, where no clean data examples are available. \subsection{Unsupervised Bayesian Reconstruction} Reconstructing posteriors in the unsupervised case is largely still an open problem. However, several tasks that fall within this definition have been recently approached with Bayesian machine learning methods. Arguably the most investigated is de-noising. Several works solve this problem by exploiting the natural tendency of neural networks to regularise outputs \cite{N2N,N2V,PN2V}. Other methods build LVMs that explicitly model the noise process in their decoder, retrieving clean samples upon encoding and generation \cite{DEN_VAE1,DEN_VAE2}. A second notable example is that of missing value imputation. Corrupted data corresponds to samples with missing entries. Recent works have explored the use of LVMs to perform imputation, both with GANs \cite{MI_GAN, MI_GAN2} and VAEs \cite{MIS_VAE1,MIS_VAE3}. In the former, the discriminator of the GAN is trained to distinguish real values from imputed ones, such that the generator is induced to synthesise realistic imputations. In the latter, the encoder of a VAE maps incomplete samples to a latent space, to then generate complete samples. Finally, Bayesian LVM methods have been used on other unsupervised tasks that can be cast as special cases of data recovery problems. Amongst these, we find Multi-view generation \cite{MV_GAN, MUL_VAE1}, where the target clean data includes all views for each samples, but the observed data only presents subsets. Blind source separation can also be cast as a recovery problem and has been approached with GANs and VAEs \cite{BSS_VAE,BSS_GAN}. \begin{figure} \vspace{-0.5cm} \includegraphics[width=\textwidth]{MNIST_2.pdf} \vspace{-0.5cm} \caption{MNIST data recovery from missing entries and noise. \textbf{(a)} Recoveries using an MVAE and our TAE, showing average reconstruction and samples from the trained posteriors. \textbf{(b)} PSNR between ground truths and mean reconstruction. \textbf{(c)} ELBO assigned by the recovered posteriors to the ground truth data. The mean inference performance is very similar for the two models (PSNR values), while the probabilistic performance (ELBO values) is significantly higher for our TAE model. We can see evidence of this difference in the reconstruction examples; The MVAE and TAE return similarly adequate mean solutions, but the MVAE posterior's draws are all very similar, suggesting that the posterior has collapsed on a particular reconstruction. Contrarily, the posteriors returned by the TAE explore different possible solutions that are consistent with the associated corrupted observation.} \label{fig:MNIST} \end{figure} These models proved to be successful at reconstructing data in their specific domain. However, in our work, we show how exploiting a standard VAE inference structure, similarly to several of the aforementioned methods, often leads to posteriors of clean data that collapse on single estimates, sacrificing the probabilistic capability of LVMs. \section{Experiments} \vspace{-0.1cm} \subsection{Posterior Recovery} We corrupt the MNIST dataset \cite{MNIST} by introducing missing values and additive Gaussian noise on the observed entry. We then train both a missing value imputation VAE (MVAE), analogous to those presented in \cite{MIS_VAE1} and \cite{MIS_VAE2}, and our TAE model with the corrupted data sets. The resulting variational posteriors are used to perform data recovery from the corrupted samples. Figure \ref{fig:MNIST}(a) shows, for different examples, the mean reconstruction and a set of draws from the posterior. We present analogous experiments for the missing-not-at-random case in supplementary D.2. We evaluate the accuracy of mean reconstruction at different ratios of observed entries by measuring the peak signal to noise ratio (PSNR) between the ground truth data and mean recoveries (Figure \ref{fig:MNIST}(b)). To evaluate probabilistic performance we approximately measure the likelihood assigned by the recovered posteriors to the ground truth data through a reconstruction ELBO, by training a new inference function with the clean ground truths, but leaving the posterior fixed, as is common for evaluating ELBOs in unsupervised settings \cite{REFIT_1,REFIT_2,MIS_VAE3}. Results are shown in figure \ref{fig:MNIST}(c). We further evaluate our TAE with Fashion-MNIST -- $28 \times 28$ grey-scale images of clothing \cite{ZALANDO}, and the UCI HAR dataset, which consists of filtered accelerometer signals from mobile phones worn by different people during common activities \cite{HAR}. As before, we test the recovery of these data sets from a version affected by missing values and additive noise. In addition to the MVAE baseline, we also compared against the recently proposed missing values importance weighted auto encoder (MIWAE) \cite{MIS_VAE3}, which optimises an importance weighted ELBO in place of the standard one. For each model and settings we compute the ELBO assigned to the ground truth data. Results are shown in Table~\ref{tab:ELBO}. Experimental details in Sec.\ C of supplementary material. \begin{center} \begin{table} \caption{Bayesian recovery from noisy data with different percentages of missing entries. Table shows the ELBO assigned by the retrieved posteriors to the ground truth clean data. Our TAE model consistently returns higher ELBO values compared to the competing variational methods, as it is able to retrieve rich posteriors that adequately sample the solution space. More values in supp. D.3.} \label{tab:ELBO} \vspace{0.2cm} \begin{tabular}{ l c c c c c c} \toprule & \multicolumn{2}{c}{MNIST} & \multicolumn{2}{c}{Fashion-MNIST} & \multicolumn{2}{c}{UCI HAR} \\ & $50\%$ & $80\%$ & $50\%$ & $80\%$ & $50\%$ & $80\%$ \\ \hline MVAE & $870 \pm 6$ & $803 \pm 15$ & $757 \pm 1$ & $723 \pm 7$ & $585 \pm 4$ & $471 \pm 10$ \\ MIWAE & $917 \pm 4$ & $780 \pm 6$ & $800 \pm 7$ & $766 \pm 8$ & $613 \pm 6$ & $584 \pm 8$ \\ TAE & $\mathbf{1719 \pm 7}$ & $\mathbf{1536 \pm 14}$ & $\mathbf{1326 \pm 7}$ & $\mathbf{1094 \pm 13}$ & $\mathbf{1014 \pm 6}$ & $\mathbf{854 \pm 52}$ \\ \end{tabular} \vspace{-0.4cm} \end{table} \end{center} \vspace{-0.7cm} \subsection{Downstream Tasks} To investigate the advantage of capturing complex uncertainties with our TAE model, we are interested in testing performance in downstream tasks. We test classification performance on subsets of the MNIST and Fashion-MNIST data sets, after recovery with our TAE. With both sets, we consider situations in which $10.000$ examples are available, but corrupted with missing entries and noise. $1,000$ of these are labelled with one of $10$ possible classes and we wish to classify the remaining $9,000$. To do so, we first train the TAE model on the full set, then use the recovered posteriors to generate multiple possible cleaned data for the labelled sub-set and use them to train a classifier. To perform classification on the $9,000$ remaining examples, we generate multiple possible cleaned data with the variational posteriors. Then, for each posterior sample, we perform classification and histogram the results. Examples are shown in figure \ref{fig:class}. To evaluate the performance, we take the class with the largest histogram as the inferred one. We repeat this experiment for different ratios of missing values and several repetitions, varying the subsets of labelled and unlabelled data to be used. Classification accuracy results are shown in figure \ref{fig:class_acc}. \begin{figure}[htb!] \centering \includegraphics[width=\linewidth]{class_4.pdf} \vspace{-0.6cm} \caption{Propagating uncertainty to a classification task. Draws from the MVAE posterior are all very similar to each other. As a result, the imputed images are almost always classified in the same way and the uncertainty of the task is underestimated. The TAE posterior explores varied possible solutions to the recovery task. These can be recognised as different classes, resulting in less concentrated distributed probabilities that better reflect the associated uncertainty.} \label{fig:class} \end{figure} \begin{figure} \centering \includegraphics[width=\linewidth]{class_acc_5.pdf} \vspace{-0.4cm} \caption{Classification accuracy after imputation. Classifying using TAE imputations gives an advantage in this downstream task over using raw corrupted data and MVAE imputations, especially when the number of missing entries is high. This is because the MVAE collapses on single imputations, while the TAE generates diverse samples for each corrupted observation. The TAE classifier trains with data augmentations consistent with observed corrupted images, instead of single estimates.} \vspace{-0.5cm} \label{fig:class_acc} \end{figure} \subsection{Missing Values in the NYU Depth Maps} As a final practical application, we use a convolutional version of our TAE to perform structured missing value imputation on depth maps of indoors rooms collected with a Kinect depth sensor. Missing entries are very common in depth maps recorded with structured light sensors, such as the Kinect \cite{DM_1}. We use raw depth data from the NYU rooms dataset \cite{NYU}. This is composed of both RGB and matched depth images of indoors rooms. A small sub-set of the depth maps has been corrected by imputing the missing entries and is popularly employed to train and test various learning systems \cite{NYU_app_1,NYU_app_2,NYU_app_3}. However, a much larger portion of the set is available only as raw data, which presents missing entries. These are especially concentrated around objects' edges and reflecting surfaces, breaking the common assumption of missing at random, making this task particularly challenging. \begin{figure}[htb] \centering \includegraphics[width=\linewidth]{rooms_5.pdf} \vspace{-0.4cm} \caption{Unsupervised missing value imputation with our TAE on raw depth maps from the NYU rooms data set. Missing pixels in the raw images are in black. The TAE generates possibilities for the imputed pixels, which can be aggregated to recover a mean and standard deviation to quantify uncertainty in the retrieved imputations. More examples are shown in supplementary D.4.} \label{fig:rooms} \end{figure} We train our TAE with a subset of this raw data set to perform imputation. In this case we are only interested in imputing missing entries and not denoising, as depth points that are registered by the Kinect present very low noise. Examples of results are shown in figure \ref{fig:rooms}. The imputation of this data set was carried out with no signal prior, no particular domain expertise, temporal or structural assumptions and no associated RGB images or examples of complete data. We simply run a convolutional version of the TAE on the raw depth maps to impute the missing values. \vspace{-.1cm} \section{Conclusion} We presented tomographic auto-encoders; a variational inference method for recovering posterior distributions of clean data from a corrupted data set alone. We derive the \textit{reduced entropy condition} method; a novel inference strategy that results in rich distributions of clean data given corrupted observations, thereby capturing the uncertainty of the task, while standard variational methods often collapse on single answers. In our experiments, we demonstrate this capability and show the advantage of capturing uncertainty with the TAE in downstream tasks, outperforming the state-of-the-art VAE based recovery methods. \newpage \section{Proofs and Derivations} \subsection{Derivation of VAE ELBO for Data Recovery} We aim to maximise the log likelihood of the observed corrupted data $y$ \begin{equation}\label{supp:VAE_ELBO_1} \begin{split} \log p(y) = \log \int_x \underbrace{\int_z p(z)p(x|z) dz}_{p(x)} p(y|x) dx. \end{split} \end{equation} We can introduce a variational distribution in both clean data space and latent space $q(x,z|y)$ and define a lower bound as \begin{equation}\label{supp:VAE_ELBO_2} \begin{split} \log p(y) \geq &\int_x \int_z q(x,z|y) \log \frac{p(z)p(x|z) dz}{q(x,z|y)} dz dx\\ + &\int_x \int_z q(x,z|y) \log p(y|x) dz dx. \end{split} \end{equation} To obtain the VAE ELBO used in data recovery settings, the choice of the variational posterior is $q(x,z|y) = q(z|y)p(x|z)$. The ELBO can then be simplified to give \begin{equation}\label{supp:VAE_ELBO_3} \begin{split} \log p(y) \geq &\int_x \int_z q(z|y)p(x|z) \log \frac{p(z)p(x|z) dz}{q(z|y)p(x|z)} dz dx \\ + &\int_x \int_z q(z|y)p(x|z) \log p(y|x) dz dx \\ = & \underbrace{\int_x p(x|z) dx}_{=1} \int_z q(z|y) \log \frac{p(z) dz}{q(z|y)} dz \\ + &\int_x \int_z q(z|y)p(x|z) dz \log p(y|x) dx \end{split} \end{equation} For situations in which the observations' likelihood $\int_x p(x|z)p(y|x) dx$ has a closed form, such as additive noise and missing entries, we can define a tighter bound to the likelihood by moving the integral in $x$ in the second term inside the logarithm \begin{equation}\label{supp:VAE_ELBO_4} \begin{split} \log p(y) \geq & \int_z q(z|y) \log \frac{p(z) dz}{q(z|y)} dz \\ + & \int_z q(z|y) \log \left[\int_x p(y|x)p(x|z) dx \right] dz \\ =& -KL(q(z|y)||p(z)) + \mathbb{E}_{q(z|y)} \log p(y|z) dx. \end{split} \end{equation} Because $p(x|z)$ simplifies in the KL term, this ELBO avoids variational inference in the space of clean data $x$. \subsection{Derivation of TAE ELBO} In our TAE model we defined separate LVMs for prior and posterior. To distinguish between the posterior latent variable and the prior latent variable, we name the former $z$ and the latter $z_p$. The likelihood we aim to maximise is \begin{equation}\label{supp:TAE_ELBO_1} \begin{split} \log p(y) = \log \int_x \underbrace{\int_{z_p} p(z_p)p(x|z_p) dz_p}_{p(x)} p(y|x) dx. \end{split} \end{equation} Similarly to the VAE ELBO case, we define a variational posterior $q(x,z_p|y)$ to find a lower bound \begin{equation}\label{supp:TAE_ELBO_2} \begin{split} \log p(y) \geq &\int_x \int_{z_p} q(x,z_p|y) \log \frac{p(z_p)p(x|z_p) dz_p}{q(x,z_p|y)} dz_p dx\\ + &\int_x \int_{z_p} q(x,z_p|y) \log p(y|x) dz_p dx. \end{split} \end{equation} However, in our model we do not make the assumption that the variational posterior has the special form described in section A.1 and instead set it to have the form $q(x,z_p|y) = q(x|y)q(z_p|x)$, separating posterior inference from observations $y$ to clean data $x$ and inference of prior latent variables $z_p$. The resulting lower bound is \begin{equation}\label{supp:TAE_ELBO_3} \begin{split} \log p(y) \geq &\int_x \int_{z_p} q(x|y)q(z_p|x) \log \frac{p(z_p)p(x|z_p)}{q(x|y)q(z_p|x)} dz_p dx \\ + &\int_x \int_{z_p} q(x|y)q(z_p|x) \log p(y|x) dz_p dx \\ = & \int_x q(x|y) \underbrace{\int_{z_p} q(z_p|x) \log \frac{p(z_p)p(x|z_p)}{q(z_p|x)} dz_p}_{\geq \log p(x)} dx \\ + &\int_x \underbrace{\int_{z_p} q(z_p|x)}_{=1} dz_p q(x|y) \log p(y|x) dx \\ - & \int_x \underbrace{\int_{z_p} q(z_p|x) dz_p}_{=1} q(x|y) \log q(x|y) dx \\ = & \mathbb{E}_{q(x|y)} \big[\mathbb{E}_{q(z_p|x)} \log p(x|z_p) \\ - &KL(q(z_p|x)||p(z_p)) \big] + \\ + &\mathbb{E}_{q(x|y)} \log p(y|x) + H(q(x|y)) . \end{split} \end{equation} \subsection{Proof of Theorem 1} \begin{eqnarray}\label{del_id} \begin{split} &\frac{q(z|x,y)}{q(z|y)} = B \delta (z-g(x,y)) \\ \implies &\frac{q(z|x,y)}{q(z|y)} \frac{q(z'|x,y)}{q(z'|y)} = 0, \quad \forall x, z \neq z' \\ \implies &\frac{q(x|z,y)}{q(x|y)} \frac{q(x|z',y)}{q(x|y)} = 0, \quad \forall x, z \neq z' \\ \implies &q(x|z,y)q(x|z',y) = 0, \quad \forall x, z \neq z' \\ \implies &q(x|z',y) = 0, \quad \forall x \sim q(x|z,y), z \neq z' \end{split} \end{eqnarray} Using the result of equation \ref{del_id}, we can derive the form of the entropy $H(q(x|y))$ for this special case as the following: \begin{eqnarray}\label{hx} \begin{split} H(q(x|y)) = &-\int_x \left[ \int_z q(z|y) q(x|z,y) dz \right] \\ \cdot & \log \bigg[ \int_{z'} q(z'|y) q(x|z',y) dz' \bigg] dx \\ = &-\int_x \int_z q(z|y) q(x|z,y) \\ &\cdot \log \bigg[ \int_{z'= z} q(z'|y) q(x|z',y) dz' \\ + &\underbrace{\int_{z'\neq z} q(z'|y) q(x|z',y) dz'}_{eq. \ref{del_id} \implies =0} \bigg] dz dx \\ &= -\int_z \int_x q(z|y) q(x|z,y) \log \left[q(z|y) q(x|z,y) \right] dx dz \\ &= -\int_z \int_x q(z|y) q(x|z,y) \log q(z|y) dx dz \\ &-\int_z \int_x q(z|y) q(x|z,y) \log q(x|z,y) dx dz \\ &= -\int_z q(z|y) \log q(z|y) dz \\&- \int_z q(z|y) \int_x q(x|z,y) \log q(x|z,y) dx dz \\ &= H(q(z|y)) + \mathbb{E}_{q(z|y)} H(q(x|z,y)). \end{split} \end{eqnarray} \subsection{Proof of the Equivalence Between Conditions} \textbf{proof of necessary condition:} \begin{eqnarray}\label{cond_eq_nec} \begin{split} \mathbb{E}_{q(x,z|y)} \log \frac{q(z|x,y)}{q(z|y)}& \\ = &\int_z q(z|y) \int_x q(x|z,y) \log \frac{q(z|x,y)}{q(z|y)} dx dz \\ = &\int_x q(x|y) \int_z q(z|x,y) \log \frac{q(z|x,y)}{q(z|y)} dz dx \\ = &\int_x q(x|y) \int_z q(z|x,y) \log q(z|x,y) dz dx \\ -&\int_x q(x|y) \int_z q(z|x,y) \log q(z|y) dz dx \\ =&\int_x q(x|y) \int_z q(z|x,y) \log q(z|x,y) dz dx \\ -& \underbrace{\int_x q(x|z,y)dx}_{=1} \int_z q(z|y) \log q(z|y) dz \\ = & \mathbb{E}_{q(x|y)} \underbrace{\int_z q(z|x,y) \log q(z|x,y) dz}_{-H(q(z|x,y))} \\ - &\underbrace{\int_z q(z|y) \log q(z|y) dz}_{-H(q(z|y))}. \end{split} \end{eqnarray} If the above expression tends to infinity, either $H(q(z|x,y)) \to -\infty$ or $H(q(z|y)) \to \infty$, meaning that either $q(z|x,y) \to $ a Delta function, or $q(z|y) \to $ uniform. Either condition implies $\frac{q(z|x,y)}{q(z|y)} = B \delta (z-g(x,y))$. \textbf{proof of sufficient condition:} \begin{eqnarray}\label{cond_eq_suff} \begin{split} &\mathbb{E}_{q(x,z|y)} \log \frac{q(z|x,y)}{q(z|y)} \\ = &\int_x q(x|y) \int_z q(z|x,y) \log \frac{q(z|x,y)}{q(z|y)} dz dx \\ = &\int_x q(x|y) \int_z q(z|y) \frac{q(z|x,y)}{q(z|y)} \log \frac{q(z|x,y)}{q(z|y)} dz dx. \end{split} \end{eqnarray} Now we set $\frac{q(z|x,y)}{q(z|y)} = B \delta (z-g(x,y))$: \begin{eqnarray}\label{cond_eq_suff_2} \begin{split} &\int_x q(x|y) \int_z q(z|y) B \delta (z-g(x,y)) \\ \cdot &\log B \delta (z-g(x,y)) dz dx \\ = & \int_x q(x|y) q(g(x,y)|y)\log B \underbrace{\delta (g(x,y)-g(x,y))}_{\to \infty, \forall x} dx. \end{split} \end{eqnarray} Therefore, $\frac{q(z|x,y)}{q(z|y)} = B \delta (z-g(x,y))$ is a sufficient condition for $\mathbb{E}_{q(x,z|y)} \log \frac{q(z|x,y)}{q(z|y)} \to \infty$. \subsection{Proof of Equation 6} \begin{eqnarray}\label{supp_cond_1} \begin{split} \mathbb{E}_{q(x,z|y)} \log &\frac{q(z|x,y)}{q(z|y)}\\ = &\int_z \int_x q(x,z|y) \log q(z|x,y) dzdx \\ - &\int_z \int_x q(x,z|y) \log q(z|y) dzdx \\ = &\int_x q(x|y) \int_z q(z|x,y) \log q(z|x,y) dz dx \\ - &\int_z \int_x q(x,z|y) \log q(z|y) dzdx \\ \geq &\int_x q(x|y) \int_z q(z|x,y) \log r(z|x,y) dz dx \\ - &\int_z \int_x q(x,z|y) \log q(z|y) dzdx \\ = &\mathbb{E}_{q(x,z|y)} \log \frac{r(z|x,y)}{q(z|y)}, \end{split} \end{eqnarray} Where the inequality derives from the positivity of the KL divergence $KL(q(z|x,y)||r(z|x,y))$. \section{Algorithm} \subsection{Details of Training} As detailed in section 3.2, to train our variational posterior $q(x|y)$, we maximise through gradient ascent the TAE ELBO with the reduced entropy penalty function \begin{equation}\label{TAE_OBJ} \begin{split} &\arg \max \quad \mathbb{E}_{q(x|y)} \log p(y|x)\\ + &\mathbb{E}_{q(x|y)} \big[ \underbrace{\mathbb{E}_{q(z_p|x)} \log p(x|z_p) - KL(q(z_p|x)||p(z_p))}_{Prior \quad ELBO, \quad \geq p(x)} \big] \\ + &H(q(z|y)) + \mathbb{E}_{q(z|y)} H(q(x|z,y)) \\ - &\lambda \left| \mathbb{E}_{q(z,x|y)} \log \frac{r(z|x,y)}{q(z|y)} - C \right|. \end{split} \end{equation} All expectations in the above expression are computed and optimised by sampling the corresponding conditional distributions using the re-parametrisation trick characteristic of VAEs. Because the prior LVM $p(x) = \int p(z_p)p(x|z_p) dz_p$ is training entirely with samples from the posterior LVM, which is also training, the model can easily obtain high values for the prior ELBO by generating collapsed samples $x$ with the posterior and get stuck in an unfavourable local minimum. TO avoid this, we employ a warm up strategy. We define a positive parameter $\gamma$ that multiplies the expectation of the prior ELBO and the entropy $H(x|z,y)$: \begin{equation}\label{TAE_WU} \begin{split} &\arg \max \quad \mathbb{E}_{q(x|y)} \log p(y|x)\\ + &\gamma \mathbb{E}_{q(x|y)} \big[ \underbrace{\mathbb{E}_{q(z_p|x)} \log p(x|z_p) - KL(q(z_p|x)||p(z_p))}_{Prior \quad ELBO, \quad \geq p(x)} \big] \\ + &H(q(z|y)) + \gamma \mathbb{E}_{q(z|y)} H(q(x|z,y)) \\ - &\lambda \left| \mathbb{E}_{q(z,x|y)} \log \frac{r(z|x,y)}{q(z|y)} - C \right|. \end{split} \end{equation} The value of $\gamma$ is initially set to zero. After a set number of iterations it is linearly increased to reach one and kept constant for the remaining training iterations. \subsection{Complete Objective Function} \textbf{Observation Parameters:} In the general case, the corruption process $p(y|x)$, mapping clean data $x$ to degraded samples $y$, is controlled by parameters that differ from sample to sample. We can distinguish these into observed parameters $\alpha$ and unobserved parameters $\beta$. For example, in the case of missing values and noise, the indexes of missing entries in each sample are often observed parameters, while the noise level is an unobserved parameter. The complete form of the corruption likelihood for a clean sample $x_i$ is then $p(y|x_i,\alpha_i,\beta_i)$. \textbf{Objective Function:} With the parameters conditionals described in subsection 3.2.4 and explicitly showing the parameters to be optimised, the objective function we maximise is the following \begin{equation}\label{TAE_OBJ} \begin{split} &\arg\max_{\theta,\phi} \quad \mathbb{E}_{q_{\phi}(x,\beta|y,\alpha)} \log p(y|x,\alpha,\beta)\\ + &\gamma \mathbb{E}_{q_{\phi}(x|y,\alpha)} \big[ \mathbb{E}_{q_{\phi_3}(z_p|x)} \log p_{\theta}(x|z_p) - KL(q_{\phi_3}(z_p|x)||p(z_p)) \big] \\ + &H(q_{\phi_1}(z|y,\alpha)) + \gamma \mathbb{E}_{q_{\phi_1}(z|y,\alpha)} H(q_{\phi_2}(x|z,y,\alpha)) \\ - &\lambda \left| \mathbb{E}_{q_{\phi}(z,x|y,\alpha)} \log \frac{r_{\phi_4}(z|x)}{q_{\phi_1}(z|y,\alpha)} - C \right|, \end{split} \end{equation} $q_{\phi}(x,\beta|y,\alpha) = \int_z q_{\phi_1}(z|y,\alpha) q_{\phi_2}(x|z,y,\alpha) q_{\phi_5}(\beta|z,y,\alpha) dz$, $q_{\phi}(x|y,\alpha) = \int_z q_{\phi_1}(z|y,\alpha) q_{\phi_2}(x|z,y,\alpha) dz$, $q_{\phi}(z,x|y,\alpha) = q_{\phi_1}(z|y,\alpha)q_{\phi_2}(x|z,y,\alpha)$, $\phi = \{ \phi_{1:5} \}$ are the parameters of the inference models and $\theta$ are the parameter of the prior model. \subsection{Pseudo-Code} \begin{algorithm}[h!] \caption{Training the TAE Model}\label{euclid} \vspace{0.2cm} \textbf{\textit{Inputs:}} Corrupted observations $Y = \{y_{1:N}\}$; Observed Parameters $A = \{\alpha_{1:N}\}$ initial model parameters, \{$\theta^{(0)}, \phi^{(0)}$\}; user-defined posterior latent dimensionality, $J$; user-defined prior latent dimensionality, $J_p$; user-defined condition strength $\lambda$; user-defined condition parameter $C$; user-defined latent prior $p(z_p)$; user-defined initial warm-up coefficient $\gamma_0$; user-defined final warm-up coefficient $\gamma_f$; warm-up start $N_{w0}$; warm-up end $N_{wf}$; user-defined number of iterations, $N_{iter}$. \vspace{0.2cm} \begin{algorithmic}[1] \State $\gamma^{(k=0)} \gets \gamma_0$ \State \textbf{for} \textit{the} $k$'th \textit{iteration} \textbf{in} $[0:N_{iter}-1]$ \\ \quad \textbf{for} \textit{the} $i$'th \textit{observation} \\ \quad \quad $z_{i} \sim q_{\phi_1^{(k)}}(z|y_i,\alpha_i)$ \\ \quad \quad $x_{i} \sim q_{\phi_2^{(k)}}(x| z_i,y_i,\alpha_i)$ \\ \quad \quad $\beta_{i} \sim q_{\phi_5^{(k)}}(\beta| z_i,y_i,\alpha_i)$ \\ \quad \quad $z_{p,i} \sim q_{\phi_3^{(k)}}(z_p| x_i)$ \\ \quad \quad $\textbf{E}^{(k)}_i\gets \log p(y_i|x_i,\beta_i)$ \\ \quad \quad $\textbf{P}^{(k)}_i\gets \log p_{\theta^{(k)}}(x_i|z_{p,i})$ \\ \quad \quad $\textbf{K}^{(k)}_i \gets D_{KL}(q_{\phi_3^{(k)}}(z_p|x_i)|| p(z_p)$) \\ \quad \quad $\textbf{Hz}^{(k)}_i \gets H(q_{\phi_1^{(k)}}(z|y_i,\alpha_i))$ \\ \quad \quad $\textbf{Hx}^{(k)}_i \gets H(q_{\phi_2^{(k)}}(x|z_i,y_i,\alpha_i))$ \\ \quad \quad $\textbf{R}^{(k)}_i \gets \log r_{\phi_4^{(k)}}(z_i|x_i,y_i,\alpha_i)$ \\ \quad \quad $\textbf{Q}^{(k)}_i \gets \log q_{\phi_1^{(k)}}(z_i|y_i,\alpha_i)$ \\ \quad \textbf{end} \Statex \\ \quad $\textbf{F}^{(k)} = \sum_i\bigg( \textbf{E}^{(k)}_i + \gamma^{(k)} \left[ \textbf{P}^{(k)}_i - \textbf{K}^{(k)}_i + \textbf{Hx}^{(k)}_i \right]$ \\ \quad \quad \quad $+ \textbf{Hz}^{(k)}_i - \lambda \left| \textbf{R}^{(k)}_i - \textbf{Q}^{(k)}_i - C \right|\bigg)$ \\ \quad $\theta^{(k+1)}, \phi^{(k+1)} \gets {\arg\max} (\textbf{F}^{(k)})$ \Statex \\ \vspace{0.2cm} \quad \textbf{if} $k>N_{w0}$ \textbf{and} $k<N_{wf}$ \\ \quad \quad $\gamma^{(k+1)} \gets \gamma^{(k)}+(\gamma_f-\gamma_0)/(N_{wf}-N_{w0})$ \\ \quad \textbf{else} \\ \quad \quad $\gamma^{(k+1)} \gets \gamma^{(k)}$ \\ \quad \textbf{end} \\ \textbf{end} \Statex \end{algorithmic} \end{algorithm} \section{Experimental Details} \subsection{Models' Architectures} In all experiments we carry out comparing our TAE with competitive methods, we make the independence assumption $q(x|z,y) = q(x|z)$, consequentially making $r(z|x,y) = r(z|x)$. In this way, the reconstruction posterior LVMs $q(x|y)$ we compare between TAE, MVAE and MIWAE all present identical structure and differences in performance are a result of the model constructed to train them alone. However, we note that, unlike the two competing method, the TAE is not formally limited to this choice and can infer conditionals $q(x|z,y)$ in the general case. We hereafter detail the architecture used for all quantitative experiments of section 4.1 and 4.2. \textbf{Posteriors structure:} The posterior parametric components are $q_{\phi_1}(z|y,\alpha)$ and $q_{\phi_2}(x|z)$ ($p_{\phi_2}(x|z)$ in the case of the MVAE and MIWAE). $q_{\phi_1}(z|y,\alpha)$ consists in a fully connected two layers neural network with leaky ReLu non-linearities, taking as input concatenated corrupted observations $y$ and a binary mask that labels the missing entries $\alpha$ and returning as output a vector of latent means and a vector of latent log variances. The two intermediate deterministic layers have $400$ hidden units, while the latent space $z$ is $20$-dimensional. $q_{\phi_2}(x|z)$, and $p_{\phi_2}(x|z)$ in the case of the MVAE and MIWAE, are similarly constructed, consisting in a fully connected two layers neural network with leaky ReLu non-linearities, taking as input latent variables $z$ and returning a vector of means and a vector of log variances of clean samples $x$. The two intermediate deterministic layers have $400$ hidden units. \textbf{TAE Prior LVM Structure:} The TAE prior encoder $q_{\phi_3}(z_p|x)$ has the same general structure as the posterior encoder, with two fully connected layers and leaky ReLu non-linearities, taking as input generated clean data $x$ and returning as outputs a vector of latent means and a vector of latent log variances for the prior latent variable $z_p$. As this model has less capacity than the posterior LVM, the two deterministic hidden layers have $50$ hidden units each and the latent variables $z_p$ are $5$-dimensional. $p_{\theta}(x|z_p)$ is similarly constructed, consisting in a fully connected two layers neural network with leaky ReLu non-linearities, taking as input latent variables $z_p$ and returning a vector of means and a vector of log variances of clean samples $x$. The two intermediate deterministic layers have $50$ hidden units. \textbf{Approximate Latent Posterior Structure:} The approximate latent posterior $r(z|x)$ has the same structure as the posterior encoder, consisting in a fully connected two layers neural network with leaky ReLu non-linearities, taking as input generated clean data $x$ and returning as outputs a vector of latent means and a vector of latent log variances. The two intermediate deterministic layers have $400$ hidden units. \textbf{Convolutional TAE Structure:} For the imputation of NYU missing data we use convolutional conditionals in our model, instead of fully connected ones. In this version. we do not make the independence assumption, using $q(x|z,y)$ and $r(z|x,y)$. $q(z|y,\alpha)$ takes concatenated $y$ and $\alpha$ and passes them through $4$ recurrent convolutional layers with filters of size $3 \times 3$ and 5 channels, each time down-sampling by two. the last layer is mapped to means and standard deviation of latent images $z$, which are $1/32$ of the original size in each axis and have $10$ channels, through two convolutional filter banks with strieds $1 \times 1$. $q(x|z,y, \alpha)$ is built to mirror this structure, with the addition of accepting inputs from $y$ and $\alpha$. Three recurrent transpose convolutional layers with $3 \times 3$ filters, $5$ channels and $2 \times 2$ upsampling each map $z$ to a deterministic layer with $1/2 \times 1/2$ of the original images size. concatenated $y$ and $\alpha$ are mapped to the same size with a single convolutional layer, downsampling it by $1/2 \times 1/2$ and $5$ channels. The two are concatenated and the resulting layer is finally upsampled to inferred clean image $x$ by a last convolution with a filter bank. All non-linearities are Elu. The prior networks are built in a similar way, but with shallower structures to give less capacity. $q(z_p|x)$ passes $x$ through $2$ convolutional layers, each with down-sampling of $4 \times 4$ and $5$ channels. as before, mens and standard deviations of latent images $z_p$ are generated from this last layers with $2 \times 2$ down-sampling and, in this case, $5$ channels. The prior generator $p(x|z_p)$ is built to exactly mirror this structure. $r(z|x,y,\alpha)$ has the same structure as $q(z|y,\alpha)$, with the only difference being that it accepts as input concatenated $x$, $y$ and $\alpha$. \subsection{Experimental Conditions} \textbf{Posterior Recovery:} All posterior recovery experiments, with each of the three data sets tested, are performed on samples that have been re-scaled from $0$ to $1$. In all cases, the sets are injected with additive Gaussian noise having standard deviation $0.1$. Subsequently, random binary masks are generated to block out some entries, resulting in missing values. The proportion of missing entries in the masks was set as described in the main body in each case. Experiments were repeated with re-generated binary masks $5$ times. The means and error bars shown in figure 4 and the uncertainty reported in table 1 were computed from these. The MIWAE was trained with 20 weights per sample. After training, all posteriors $q(x|y)$ have identical structure and are tested in the same way, by training an inference network on the test set to compute the ELBO values. \textbf{Classification Experiments:} The TAE models for the MNIST and Fashion-MNIST experiments were trained in the conditions described above. In each case, a random subset of $10,000$ samples is taken from the corrupted set and the TAE and MVAE models are trained with it. A random subset of $1,000$ of these is selected and ground-truth lables for these samples are made available. A classifier consisting in a single fully connected layer with leaky ReLu non-linearity is trained to perform classification on this subset. For each stochastic training iteration of this classifier, we generate samples associated with the corrupted observations and provide the associated labels. After the classifier is trained, we test classification performance on the remaining $9,000$ examples, by running the train classifier $400$ times per sample, each time generating clean data from a corrupted observation with the TAE and the MVAE. The histograms shown in figure 5 are built by aggregating the resulting classification. The above procedure is repeated $15$ times. The resulting means and standard deviations of the tested classification performance are shown in figure 6. \textbf{Training Conditions:} Hyper-parameters of optimisation for the models were cross validated with the MNIST data set at a proportion of missing entries of $0.9$. Hyper-parameters common to all models were determined by obtaining best performance with the MVAE model. Hyper- parameters specific to the TAE model were obtained by fixing the common parameters and cross validating these. The resulting optimal hyper parameters were then used in all other experiments of section 4.1 and 4.2, including those with different data sets. Common parameters are as follows: $500,000$ iterations with the ADAM optimiser in Tensorflow, an initial training of $2^{-4}$ and batch size of $20$. The hyper-parameters specific to the TAE are instead: $\gamma$ initially set to $0.01$ and then linearly increased to $1$ between $50,000$ and $100,000$ iterations, $\lambda = 2$ and $C = 10$. All experiments were performed using a TitanX GPU. \textbf{NYU Rooms Experiments:} For these experiments, we take a subset of $3612$ depth maps from the NYU raw data set. We slightly crop these in one dimension to be $480 \times 608$ images. The convolutional TAE to obtain the results of figure $7$, was trained for $500,000$ iterations using the ADAM optimiser in Tensorflow, with a batch size of $2$ images and an initial training rate of $2 \times 10^{-3}$. For the warm up, we initially set $\gamma = 0.01$ and linearly increase it to $1$ between $50,000$ and $200,000$ iterations. For these experiments, $\lambda = 2$ and $C = 10$. As we are interested only in imputation, we set the data likelihood $p(y|x,\alpha, \beta) = p(y|x,\alpha)$ and this function simply masks out missing entries by multiplying them by zero according to the binary marsks $\alpha$. We then only infer the missing entries upon testing, giving the results shown in figure $7$. \section{Additional Experiments} \subsection{$C$ and $\lambda$ Cross-Validation} $C$ and $\lambda$ in equation \ref{TAE_OBJ} are hyper-parameters of our inference algorithm and need to be user defined. In our experiments, we determine the optimal values by cross-validation, as described in section C. We report in figure \ref{fig:cross_val} a cross validation study where we measure the TAE ELBO for MNIST with $90$\% missing values and additive noise. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{cross_val_1.pdf} \vspace{-0.7cm} \caption{ELBO for MNIST with $90$\% missing values and additive noise as a function of chosen hyper-parameters $C$ and $\lambda$ (in log scale). The performance of TAE exceeds that of a standard VAE approach over a broad range of values. If the values are too large, the model collapses during optimisation, making such situation easy to diagnose.} \label{fig:cross_val} \end{figure} As shown in figure \ref{fig:cross_val}, the performance of TAEs is robust to variations in hyper-parameters $C$ and $\lambda$ over a broad range of values. They also have an intuitive meaning that helps in their selection. In practice, $C$ controls the final value of localisation and is desirable to be as high as stability of the optimisation allows. $\lambda$ controls how fast we are imposing the model to approach $C$. \subsection{Missing Not-at-Random} We test a TAE in a situation analogous to that shown in figure 4 of section 4, but with structured missing values instead of randomly missing ones. For each sample in MNIST, we only make visible a small $10 \times 10$ pixels window, randomly placed in each example, while the rest of the images remain hidden. In addition, the values in the observed window are subject to additive Gaussian noise, similarly to the missing-at-random case. Reconstructions with the comparative MVAE and our TAE are shown in figure \ref{fig:nr}. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{nr_1.pdf} \vspace{-0.7cm} \caption{Examples of Bayesian reconstructions with MVAE and TAE on structured missing values. the MVAE returns good mean reconstructions, but its posteriors collapse on single solutions, giving draws that are very similar to each other. The TAE returns posteriors which more broadly explore the different possible clean samples associated with the corrupted observations, giving more variation in the posterior's draws.} \label{fig:nr} \end{figure} Similarly to the missing-at-random case, the MVAE collapses on single solutions, giving draws from the posterior that are all very similar to each other. Contrarily, the TAE gives more variation in the possible solutions exploring more appropriately the uncertainty in the solution space. The MVAE ELBO over the clean data for this problem is $428$, while the TAE one is $638$. The performance improvement provided by the TAE is analogous to that observed with missing-at-random experiments. \newpage \subsection{More ELBO Evaluations} \begin{center} \begin{table}[h!] \caption{ELBO assigned by the retrieved posteriors to the ground truth clean data.} \label{tab:ELBO} \vspace{0.3cm} \begin{tabular}{ l p{1.3cm} p{1.3cm} p{1.6cm} } \toprule & MVAE & MIWAE & TAE \\ \hline MNIST, & $883 \pm 2$ & $940 \pm 3$ & $\mathbf{1831 \pm 8}$ \\ $20\%$ missing & & & \\ \hline MNIST, & $870 \pm 6$ & $917 \pm 4$ & $\mathbf{1719 \pm 7}$ \\ $50\%$ missing & & & \\ \hline MNIST, & $803 \pm 15$ & $780 \pm 6$ & $\mathbf{1536 \pm 14}$ \\ $80\%$ missing & & & \\ \hline Fashion-MNIST, & $775 \pm 4$ & $815 \pm 4$ & $\mathbf{1407 \pm 24}$ \\ $20\%$ missing & & & \\ \hline Fashion-MNIST, & $757 \pm 1$ & $800 \pm 7$ & $\mathbf{1326 \pm 7}$ \\ $50\%$ missing & & & \\ \hline Fashion-MNIST, & $723 \pm 7$ & $766 \pm 8$ & $\mathbf{1094 \pm 13}$ \\ $80\%$ missing & & & \\ \hline UCI HAR, & $611 \pm 3$ & $628 \pm 10$ & $\mathbf{1039 \pm 11}$ \\ $20\%$ missing & & & \\ \hline UCI HAR, & $585 \pm 4$ & $613 \pm 6$ & $\mathbf{1014 \pm 6}$ \\ $50\%$ missing & & & \\ \hline UCI HAR, & $471 \pm 10$ & $584 \pm 8$ & $\mathbf{854 \pm 52}$ \\ $80\%$ missing & & & \\ \bottomrule \end{tabular} \vspace{-0.6cm} \end{table} \end{center} \newpage \subsection{NYU Rooms Recovery Examples} \begin{figure}[h] \centering \includegraphics[width=\linewidth]{rooms_3.pdf} \vspace{-0.7cm} \caption{Unsupervised missing value imputation with our TAE on raw depth maps from the NYU rooms data set. The TAE generates different possibilities for the imputed pixels, which can be aggregated to recover a mean and a standard deviation to quantify uncertainty in the retrieved imputations.} \label{fig:rooms} \end{figure} \label{submission} \end{document}
\section{Introduction} Deep Neural Networks (DNNs) achieve state-of-the-art results on various tasks such as speech recognition, object detection or machine translation (\cite{DeepLearning}). Usually, DNNs are trained on a large amount of training data in order to generalize to similar, but unseen test data. However, gathering labeled data, which is needed for supervised learning methods, is both labor-intensive and time-consuming. Thus, it is desirable to increase the data-efficiency, i.e. to ensure good performance even when training data is limited. Furthermore, DNNs are afflicted by some key disadvantages when being applied in fields with strict safety requirements such as autonomous driving. In these fields, DNNs need to be robust and explainable in order to enable assessing their behavior in safety-critical cases. This contradicts the current approach of threatening DNNs as a black box and training them in an end-to-end fashion. Finally, the solution space of all parameters within deep neural networks is high-dimensional which impedes finding the optimal solution to the learning problem. Thus, it makes sense to restrict the solution space using problem-dependent, reasonable constraints. Consequently, current research tries to combine expert knowledge - e.g. the knowledge utilized to design classical pattern recognition systems - with the architectures and optimization methods of DNNs. This is often called a \textbf{hybrid approach} aiming to combine the best of both worlds: state-of-the-art results by data-driven optimization while using as few labeled training samples as needed. Additionally, an explainable, robust system behavior is desired. Expert knowledge can be expressed in many different ways. A simple example is knowledge about the expected size of different objects in images for object detection. A more sophisticated one is the exact definition of a filter sequence used to detect those objects. However, this kind of prior knowledge is hard to formalize which makes it difficult to include it into a neural network in a principled manner. Another possibility to incorporate knowledge is to model a prior distribution over the output of a neural network in order to predict a posterior distribution with a Bayesian neural network. For many tasks, certain transformations of the input which affect the desired output in a predictable way or do not affect it at all can be determined. Both, knowledge about physical transformations, e.g. when a camera is moved to a novel viewpoint (\cite{CoorsNoVA}), or knowledge about certain transformations frequently occurring in the input data, e.g. rotated and translated patterns, can be leveraged. The latter is referred to as \textbf{geometrical prior knowledge}. For example, a system for image classification should classify a dog correctly independent of its orientation. Therefore, it needs to learn a representation that does not change when the input is rotated, i.e. it should be \textbf{invariant} with respect to rotations. A common approach to increase the robustness of a neural network to such transformations is to randomly transform the input during the training phase, which is called \textbf{data augmentation}. While this approach is straightforward to implement, the DNN only approximates the desired properties and fails to provide mathematical guarantees. A renowned example of incorporating geometrical prior knowledge to DNNs in a mathematically guaranteed way are convolutional neural networks (CNNs) which share a convolutional kernel among their input space. This procedure is called \textit{translational weight tying} and allows to reduce the parameter consumption of DNNs while also facilitating the DNN to recognize patterns independent of their location in the input. Therefore, CNNs are \textbf{equivariant} to translations. The success of CNNs in computer vision tasks confirms that utilizing geometrical prior knowledge is an important \textit{inductive bias} for DNNs. In this work, we investigate the integration of geometric prior knowledge to neural networks such that their representations are mathematically guaranteed to be in- or equivariant. First, we review the mathematical concepts underlying in- and equivariant representations. We then provide an overview of several different approaches which allow to enforce those properties by summarizing current work investigating those fields. Afterwards, we give an overview over common datasets and benchmarks which are used to compare the different presented algorithms. Subsequently, we investigate how those methods can be applied to DNNs used for autonomous driving problems. Finally, we summarize our review paper and give a short outlook on open challenges and future work. \textbf{Remark:} In this paper, we focus mainly on work related to perception for autonomous driving, i.e. computer vision and processing 3D sensor data. We mention some work incorporating geometrical prior knowledge to other domains, but do not claim any completeness in those fields. We do not propose any new results but hope to give a broad overview over geometrical prior knowledge for neural networks. Thereby, we hope to ease both the entry into this interesting field of research for novel researchers and the comparison of different approaches for experienced researchers. \section{Preliminaries} In this section, we briefly introduce some core concepts needed to understand the work that incorporates geometrical prior knowledge to DNNs. Mainly, we discuss the mathematical concept of groups, group representation theory and steerable filters. \subsection{Group Theory} Groups are a mathematical abstraction used to describe invertible geometrical transformations. A group $G$ consists of a set of elements and a group operation, which combines two elements of the group to form a third. It fulfills the axioms of closure, associativity, identity and invertibility. Group theory is the basis to mathematically describe geometrical symmetries. Therefore, it is used to define in- and equivariance with respect to transformations $g \in G$. A function $f$ is equivariant with respect to a transformation group $G$, if there exists an explicit relationship between transformations $\mathcal{T}_g^{\mathcal{X}}$ of the function's input and the corresponding transformation $\mathcal{T}_g^{\mathcal{Y}}$ of its output: \begin{equation} f(\mathcal{T}_g^{\mathcal{X}}[x]) = \mathcal{T}_g^{\mathcal{Y}}[f(x)] \; \forall \; x \in X \text{.} \end{equation} It is important to note, that $\mathcal{T}_g^{\mathcal{X}}$ and $\mathcal{T}_g^{\mathcal{Y}}$ do not need to be the same kind of transformation. For example, rotating the input might induce a shift in the output space. Nevertheless, the notation is usually simplified to \begin{equation} f(gx) = g^\prime f(x) \; \forall \; x \in X \text{.} \end{equation} Invariance is a special case of equivariance, where the transformation in output space is the identity, i.e. the output is unaffected by transformations $g \in G$: \begin{equation} f(gx) = f(x) \quad \; \forall \; x \in X \text{.} \end{equation} As mentioned before, a common example of an equivariant function $f$ are convolutional neural networks, which introduce translation equivariance. Depending on the properties of the task to solve, equivariance is more suitable than invariance because it preserves information about the symmetry group. For example, a 3D object detector needs to be equivariant to rotations since one of the tasks is to estimate the detected objects' rotation angles. Invariance would destroy this information in the feature space, which is e.g. beneficial for the classification of those objects. \subsection{Group Representation Theory} The mathematical field of Group Representation Theory investigates, how a group $G$ acts linearly on a $n$-dimensional complex vector space $V$. This is an interesting theoretical field for DNNs because feature spaces can be modeled as vector spaces while symmetric input transformations can be modeled as groups. Hence, Group Representation Theory helps to understand how feature spaces of CNNs change under transformations of the input. For matrix Lie groups, a finite-dimensional complex representation $\Pi$ of $G$ is a group homomorphism $\Pi : G \to \text{GL}(V)$, that maps the group to the general linear group $\text{GL}(n,\mathbb{C})$, i.e. to the group of invertible $n\times n$ matrices representing the linear action of the group on the vector space (\cite{HallGroupRepresentation}). We define three common group representation types which are used throughout this survey. The \textbf{trivial} representation maps all group elements to the identity matrix, i.e. the vector space $V$ is left invariant under group transformations. The \textbf{regular} representation is determined by the action of $G$ on itself. In this case, $V$ is a $|G|$-dimensional vector space which is permuted under group actions $g \in G$. A representation is called \textbf{irreducible} (\textbf{irrep}), if its only invariant subspaces are the trivial subspaces $W=V$ and $W=\{0\}$. A subspace $W$ of $V$ is called invariant, if $\Pi(g)w \in W$ for all $w \in W$ and all $g \in G$. Importantly, \textit{Maschke's theorem} states that every representation of a finite group consist of a \textit{direct sum} of irreducible representations. Consequently, finding all irreps of a specific group is an interesting aspect of group representation theory. For a more detailed discussion of Group Representation Theory which forms the backbone of equivariant neural networks, we refer the interested reader to the recent paper by \cite{EstevesSurvey} or to the text book by \cite{HallGroupRepresentation}. \subsection{Steerable Filters}\label{sec:SteerableFilters} Steerable filters, proposed by \cite{Adelson}, are filters whose arbitrary rotated version $f^\theta$ can be synthesized using a linear combination of a finite number of basis filters $g_i$ . In the two-dimensional case, rotation-steerable filters are defined as: \begin{equation} f^\theta(r,\phi) = \sum_{i=1}^{M}k_i(\theta)g_i(r,\phi)\text{,} \end{equation} where $\theta$ is the rotation angle and $k_i(\theta)$ are called interpolation functions. Steerable filters are defined in the polar space $r=\sqrt{x^2+y^2}$, $\phi = \arctan(|\frac{y}{x}|)$. Steerable filters provide the advantage that arbitrary rotated versions of them can be calculated analytically without suffering from sampling effects. This is important for computer vision tasks, where multiple rotated versions of a filter are applied or learned frequently. Additionally, steerable filters can also be expanded towards other transformations in order to facilitate the mentioned advantages for arbitrary transformations. \section{Geometrical Prior Knowledge for Deep Neural Networks} For many machine learning tasks, experts can identify transformations, which should affect the output of the algorithm either in a predictable way or not at all. In literature, this kind of expert information is called \textbf{geometrical prior knowledge}. In general, incorporating geometrical prior knowledge to neural networks restricts the solution space of the neural network's learning algorithm. If the prior knowledge is carefully chosen, i.e. it is relevant for the task the network is trying to solve, this helps to raise the data-efficiency of the learning process. Since the available amount of training data is finite - especially for small datasets - incorporating geometrical prior knowledge leads to an improved overall performance of DNNs. A variety of current research investigates how to incorporate geometrical prior knowledge by enforcing in- or equivariance properties to the neural network. A well-known example are \textbf{Convolutional Neural Networks} (CNNs) which share a convolutional kernel among all positions of the input image or feature map (\cite{Fukushima, LeCun}). This process, called \textit{translational weight tying} makes their response equivariant with respect to translations. Translation equivariance is one of the key properties responsible for the success of CNNs in various practical applications. However, standard convolutions are not equivariant to other transformations such as rotations. Thus, changing or generalizing the convolution to enable equivariance to arbitrary transformations occurs as a promising approach to increase the data-efficiency of CNNs. We separate the presented ideas into approaches using \textbf{special filter types} to enforce in- or equivariance properties, approaches relying on the \textbf{group convolution} which is equivariant to a group by design and \textbf{learned feature transformations} which try to learn invariant features from data without explicitly enforcing it. Additionally, we explore \textbf{capsules}, \textbf{invariant integration} and other approaches, which do not fit one of the aforementioned categories, but nevertheless provide methods to incorporate geometrical prior knowledge. \subsection{Restricted Filters} One possibility to enforce in- or equivariance properties to functions is using restricted or fixed filters to process the input signal. In this section, we introduce methods based on the \textbf{scattering transformation} as well as methods based on circular or spherical \textbf{harmonic filters}. \subsubsection{Scattering Neural Networks} \begin{table*}[t] \centering \begin{tabular}{|c|c|c|c|} \hline Reference & Invariance group & Classifier & Learnable \\ \hline \cite{Scattering} & $\mathbb{Z}^2$ & SVM & \ding{55} \\ \cite{GenericScattering} & $\mathbb{Z}^2$ & Linear SVM & \ding{55} \\ \cite{DeepHybridNetworks, OyallonCompressingScattering, Scattering2} & $\mathbb{Z}^2$ & CNN & \ding{55} \\ \cite{Cotter15, Cotter2} & $\mathbb{Z}^2$ & CNN & \checkmark\\ \cite{RotoTranslationScattering} & $\mathbf{SE}(2)$ & Gaussian SVM & \ding{55} \\ \cite{Sifre} & $\mathbf{SE}(2) \rtimes S$ & PCA classifier & \ding{55} \\ \hline \end{tabular} \caption{Overview of Scattering CNNs classified by the invariance group $G$, the classifier used on top of the scattering coefficients and if the scattering coefficients are learnable.} \label{tab:Scatter} \end{table*} \cite{Scattering} propose to use a hand-crafted transformation called scattering transformation that enforces invariance to the representations of a DNN. It consists of a convolution of the input signal $x$ with a family of wavelets $\psi$ followed by a modulus non-linearity and an averaging filter $\phi$. The first-order scattering coefficients $S^{1}(x)$ at rotation and scale $\lambda_1 = \{\theta_1, j_1\}$ are defined as: \begin{equation} S^{1}(x) = |x\star\psi_{\lambda_1}|\star\phi_J \text{,} \end{equation} where the family of wavelets is computed by rotating and dilating a complex mother-wavelet $\psi$ using $L$ rotations and $J$ scales. Furthermore, it is possible to cascade multiple scattering transforms to obtain coefficients of order $m\geq0$: \begin{equation} S^{m}x = | \hdots || x \star \psi_{\lambda_1}| \star \psi_{\lambda_2}| \hdots \star \psi_{\lambda_m}| \star\phi_{J} \text{.} \end{equation} \cite{Scattering} use complex Morlet wavelets to obtain the scattering coefficients and process the features with a Support Vector Machine (SVM) for classification. While the calculated scattering coefficients are invariant to translations and stable to small deformations, they are not invariant to other transformation groups such as rotations. \cite{GenericScattering} compare a two-layer scattering network for image classification to a DNN of the same depth and conclude that the scattering transformation closely resembles the filters that are learned within the early layers of a CNN during training. \cite{GroupInvScattering} enhances the scattering operator to arbitrary transformations which can be represented as compact Lie groups $G$. He proves that the group scattering transformation is invariant under the action of $G$. Moreover, he proposes to apply this to the group of rotations and translations in 2D, which is conducted by \cite{RotoTranslationScattering}. \cite{Sifre} further advance this approach by cascading multiple scattering transformations with global space-scale averaging and invariant linear projectors to obtain a representation that is invariant to translation, rotation, scaling and small deformations. Finally, \cite{DeepHybridNetworks,Scattering2} propose to use a hybrid approach: The lower layers of a CNN are replaced by fixed scattering transforms while the upper layers are learned. Thus, the lower layers provide translation-invariant features without the need to learn the filters while the higher layers learn more abstract features. They show that the proposed method enables a performance boost when training on a limited subset of the entire training data. This demonstrates that the scattering transform does not loose any discriminative power while boosting the performance in the limited sample domain by incorporating geometrical prior knowledge. The scattering transformation can also be used to compress the input images processed by a CNN to reduce the spatial resolution. While this saves parameters and training time, it still captures most of the signal information needed for classification permitting state-of-the-art classification results (\cite{OyallonCompressingScattering}). \cite{Cotter} visualize the patterns that caused a large activation in each channel of a hybrid scattering CNN in order to further compare the filters used by scattering networks to those learned by conventional CNNs. Therefore, they use a method called DeScatterNet which sequentially inverts the operations of the scattering layers. They find that the CNN filters are more general, i.e. they are able to detect more complex shapes. To resolve this discrepancy, they propose to replace the averaging filters of the original scattering transformation by a more general filter which also has a spatial domain. They show that this procedure allows the scattering network to detect more complex shapes like corners, crosses and curves. Additionally, \cite{Cotter2} propose a learnable form of the scattering transformation called locally invariant convolutional layer obtained by multiplying the output of the scattering transformation with learnable weights. They prove that the layer is differentiable with respect to the learnable weights and its input which makes it suitable to use for end-to-end training via the backpropagation algorithm. They apply their novel layer at different depths of a CNN and conclude that it works best, when it is used in an early layer but not within the first layer of the CNN. To summarize, the scattering transformation allows to incorporate symmetry properties to neural networks while guaranteeing stability to small deformations, which is a desirable property for many learning tasks. While early proposals use the transformation in combination with classifiers such as the SVM, novel approaches try to include it into DNN architectures. One approach processes the signal with the scattering transformation and uses the calculated scattering coefficients as the input to a DNN, which can be interpreted as introducing hand-crafted filters to lower CNN layers. Another approach is to introduce learnable parameters to the scattering layer itself while ensuring that it is differentiable with respect to its input, making it suitable for end-to-end learning. \subsubsection{Harmonic Filters}\label{sec:RestrictedFilters} \cite{HarmonicNetworks} train a CNN where the filters are restricted to circular harmonics so that the convolution's output is equivariant with respect to continuous rotations. In particular, the filters are defined in the polar domain as \begin{equation} \mathbf{W}_m(r,\phi,R,\beta) = R(r)e^{i(m\phi+\beta)} \text{,} \end{equation} where $r$ and $\phi$ are the radius and angle of the polar representation, $m$ is the rotation-order while $R$ and $\beta$ are the learnable parameters of that layer, namely the radial profile and the phase offset. The filters are defined in the complex domain which automatically induces a complex output of the convolution operation that can easily be calculated using four standard convolutions. While the output's modulus is invariant to rotations of the input, the phase stores the equivariant information about its orientation. \cite{TensorFieldNetworks} use a mix of continuous convolutions on point clouds and filters restricted to spherical harmonics to learn representations that are locally equivariant to 3D rotations, translations and point permutations. Point-wise convolutions are used to process vector fields defined on points. The convolution is calculated using the equivariant tensor product. It can be calculated using the Clebsch-Gordan coefficients and the irreducible representations of $SO(3)$. \subsection{Group Convolution} \textit{Group equivariant convolutional neural networks} (G-CNNs), first proposed by \cite{GroupEquivariantCNNs}, enforce equivariance to symmetric transformations by replacing the standard convolution with a generalized form, called group convolution. In this section, we first introduce the group convolution by deriving it from the standard convolution. Afterwards, we introduce papers concerning the theory of group equivariant neural networks. Finally, we show how the group convolutional framework is applied to specific transformation groups. The discrete standard convolution acting on regular input data in two-dimensions is defined as\footnote{To be precise, the formula describes the discrete standard correlation. In neural network literature however, it is constantly referred to as convolution since its slightly easier implementation and the only difference being a flipped kernel. We will follow this nomenclature and subsequently call the presented operations convolution, although they technically are correlations.}: \begin{equation} (f\star k)(u) = \sum_{v\in\mathbb{Z}^2} f(v)k(v-u) \text{,} \label{eq:Conv} \end{equation} where the convolution kernel $k$ with spatial support $v$ is shifted (translated) over the domain $\mathbb{Z}^2$ of the input function $f$. Usually, the kernel's spatial support is significantly smaller than that of the input domain which results in two advantages: First, the number of parameters which need to be learned during training is reduced. Additionally, the same convolution kernel is applied at each position of the function's domain, which is called spatial parameter sharing and induces equivariance to translations $L_t$: \begin{align} \begin{split} [[L_t f]\star k](u) &= \sum_{v}f(v-t)k(v-u) \\ &= \sum_{v}f(v)k(v-(u-t)) \\ &= [[L_t[f\star k]](u) \text{.} \end{split} \label{eq:Proof_Equivariance} \end{align} \textbf{Group convolutions} are the generalization of the standard convolution for an arbitrary transformation group G. The continuous group convolution is defined as: \begin{equation} \label{eq:GConvCont} (f \star_G k)(u) = \int_{G}f(g)k(u^{-1}g)\; d\mu(g)\text{,} \end{equation} where $\mu$ is the Haar measure. The shift, i.e. the action of the translation group, in Formula \ref{eq:Conv} is replaced with the action $g$ of a transformation group $G$. The discrete version is defined as: \begin{equation} (f\star_G k)(u) = \sum_{g\in G}f(g)k(u^{-1}g) \text{.} \label{eq:GConv} \end{equation} It is easy to see, that the group convolution acts on the domain of the group $G$. Consequently, its input and filters are defined on $G$ as well. Again, we can prove that the group convolution defined for the group $G$ is equivariant with respect to transformations $L_h$ of that group: \begin{align} \begin{split} [[L_h f]\star_G k](u) &= \sum_{g\in G}f(h^{-1}g)k(u^{-1}g) \\ &= \sum_{g\in G}f(g)k((h^{-1}u)^{-1}g) \\ &= [[L_h[f\star_G k]](u) \text{.} \end{split} \end{align} Since the input data is usually not defined on the group manifold (i.e. images lie on a regular grid), a \textbf{lifting layer} needs to be defined, which lifts the input, e.g. from $\mathbb{Z}^2$ in images, to the group domain: \begin{equation} (f\star_G k)(u) = \sum_{v \in\mathbb{Z}^2} f(v)k(u^{-1}v) \text{,} \label{eq:GConvLifting} \end{equation} where $(f\star_G g) \in G$ and $k$ is a learnable filter defined in the input domain $\mathbb{Z}^2$. \subsubsection{Theoretical Aspects of Enforcing Equivariance} In general, CNNs do not only consist of multiple linear filter operations, but also use non-linearities. It can be shown, that if each single operation enforces or preserves equivariance, the whole neural network is equivariant. \cite{GroupEquivariantCNNs} prove that point-wise non-linearities and pooling operations acting on a region which is a subgroup $H\subset G$ preserves equivariance of the network. Hence, it is sufficient to prove equivariance for the convolutional layers used within a G-CNN, if no other non-linearities are used. While \citet{GroupEquivariantCNNs} primarily propose to use G-CNNs focused on an application, i.e. for rotation equivariant classification (see Section \ref{sec:GCNNApps}), several works investigate general theoretical frameworks that enable the classification of existing G-CNNs as well as the expansion towards more complex groups or other input domains, e.g. graphs (\cite{SteerableCNNs, Kondor, GeneralEquivariantCNNs, EstevesSurvey}). \citet{Kondor} provide a mathematical prove that a DNN is equivariant to the action of a compact group $G$ of its input if and only if each layer implements the generalized group convolution defined in Equation \ref{eq:GConv}. For their proof, they use concepts from group representation theory. Additionally, it is proven that those convolutions can be defined over quotient spaces of the transformation group $G$ because the network activations are usually defined on homogeneous spaces associated to the group. Finally, they emphasize the benefits of calculating convolutions using irreducible Fourier space representations which lead to sparse matrix multiplications when defined on the appropriate quotient spaces. \cite{GeneralEquivariantCNNs} expand Kondor and Trivedi's theory by defining convolutional feature spaces as fields defined over a homogeneous \textit{base space}. This enables a systematic classification of various equivariant convolutional layers based on their symmetry group, the base space the features are attached to and the field type, which can be regular, trivial or irreducible. The field type is closely related to group representation theory and describes, how the values change under transformations of the symmetry groups. Trivial representations are invariant, i.e. the individual values do not change under transformations, the values of regular fields are shifted along the group dimension and irreducible fields change according to the irreducible representation of the transformation group. Finally, \cite{GeneralEquivariantCNNs} use the Mackey theory to prove that a convolution with equivariant kernels is not only a necessary and sufficient condition for equivariance, but that this is also the most general class of equivariant linear maps. Finally, they propose a general framework on how to parameterize the learnable equivariant convolutional kernels within DNNs. \cite{EstevesSurvey} gives a broad overview over the mathematical concepts underlying group equivariant CNNs, which are: group representation theory, integration and harmonic analysis on non-Euclidean spaces, and differential geometry. Esteves shows applications of his theory for the group $\mathbf{SO}(3)$ and elucidates that spherical harmonics are directly related to the irreducible representations which arise when calculating the convolution using the Fourier transformation. Finally, based on results from group representation theory, both Kondor and Trivedi's and Cohen et al.'s definition of group equivariant CNNs are discussed. As mentioned in section \ref{sec:SteerableFilters}, \textbf{steerable filters} can be calculated in arbitrary rotations using a linear combination of basis filters. Similar to the convolution, this principle can be expanded to arbitrary transformations. Consequently, steerable filters provide an attractive alternative to avoid interpolation needed for the computation of arbitrarily transformed filters in equivariant CNNs. \cite{SteerableCNNs} propose a general framework where the features of an equivariant CNN are a steerable composition of feature types which encode certain transformation symmetries. This implies that the learned representations transform in a predictable linear manner under transformations of the input. The choice of elementary feature types imposes constraints on the network weights and architecture which reduces the number of learnable parameters. Cohen and Welling use concepts from group representation theory to describe the mappings learned by an equivariant CNN. Feature maps are modeled as fibers at each position of the base space (see Figure \ref{fig:fibers}). An equivariant map processing those fibers is called \textit{intertwiner} and can be expressed as a direct sum of \textit{irreducible representations}. Finally, they elaborate that the steerable CNN framework can be expanded to other forms of homogeneous spaces, e.g. graphs. \begin{figure} \centering \includegraphics[width=0.8\linewidth]{img/fibers.png} \caption{A typical CNN feature space can be divided into feature maps (left) or fibers at each position (right) \cite{SteerableCNNs}.} \label{fig:fibers} \end{figure} \subsubsection{Applications}\label{sec:GCNNApps} In this section, we present applications of group convolutional neural networks arranged by their equivariance group. Additionally, we categorize the approaches following the procedure proposed by \cite{GeneralEquivariantCNNs} (see Table \ref{tab:Equi}). \textbf{2D rotations and translations:} First, we present approaches equivariant to 2D translations and rotations. \cite{GroupEquivariantCNNs} apply the group convolution to the finite wallpaper groups $p4$ and $p4m$ consisting of 2D translations, $90^\circ$ rotations and flips. They show that by transforming the learned filters with all possible rotations and flips and stacking them along the \textit{group dimension}, they can apply the standard convolution to obtain the desired equivariance. An exemplary feature space is depicted in Figure \ref{fig:p4conv}. \begin{figure} \centering \includegraphics[width=0.7\linewidth]{img/p4_conv} \caption{A feature space obtained by applying a $p4$ group convolution and its rotation \cite{GroupEquivariantCNNs}.} \label{fig:p4conv} \end{figure} \cite{Bekkers} propose to expand the work by Cohen and Welling to the discrete group $\mathbf{SE}(2, N) \leqslant \mathbf{SE}(2)$, which includes $N$ two-dimensional rotations and all possible translations by applying bilinear interpolation to the points not lying on the regular grid during filter rotation. In their experiments, the best results are achieved using $N=8$ or $N=16$ rotation angles. Rotation-equivariant Vector Field Networks (\cite{MarcosRot}) reduce the parameter and memory consumption of rotation-equivariant CNNs by only storing the maximum activation and the orientation that caused it at each location. This can be seen as a vector field where the activation is responsible for the vector's length while the orientation is obtained from the corresponding rotation of the filter. The authors conclude that only storing dominant responses and orientations seems sufficient to solve in- and equivariant tasks. Harmonic networks (\cite{HarmonicNetworks}), mentioned in section \ref{sec:RestrictedFilters}, can also be considered from a group convolutional viewpoint since the circular harmonics are the irreducible representations of the two-dimensional rotation group. While \cite{SteerableCNNs} implement the steerable CNN framework for the group $p4m$ to obtain steerable features, a variety of other approaches rely on using steerable filters for the convolutional kernels. \cite{SFCNN} restrict the filters to a linear combination of steerable filters, learn the linear coefficients and apply the $\mathbf{SE}(2,N)$ group convolution. Using steerable filters enables an efficient calculation at arbitrary rotations without suffering from sampling artifacts while the group convolution ensures the desired equivariance properties. Additionally, a generalized weight initialization scheme is proposed that further improves the performance of the layer. \cite{E2STCNNs} generalize steerable CNNs to the Euclidean group $\mathbf{E}(2)$, which includes rotations, translations and flips in the image plane. The equivariant convolution kernels of $\mathbf{E}(2)$-CNNs are constrained through the symmetries they are designed to express. Those constraints can be formulated using the \textit{irreducible representations} of the symmetry groups. Hence, one can calculate a basis of equivariant kernels by solving the irrep constraints, reverting the change of basis and taking the union over the different blocks. This results in a general formulation of the kernel constraint using a Fourier basis which leads to harmonic basis elements. Additionally, the proposed framework allows for weaker group restrictions, i.e. to subgroups, for higher layers of G-CNNs which might not benefit from a full symmetry. In contrary to the steerable filter approach, \cite{Diaconu1} propose to replace the interpolation needed to obtain filters at arbitrary rotations by learning a filter basis and all its rotated versions through rotation-invariant coefficients. Therefore, they propose the \textbf{unitary group convolution}: \begin{equation} [f\star_G k](g) = \sum_{x\in X} f(x)L_g[k](x) \text{,} \end{equation} which is only equivariant, if the inner product is unitary, i.e. it is constant if both $f$ and $\psi$ are transformed by the same transformation group element $g$. The rotated filters are then learned using a novel equivariance loss. The unitary group convolution shows improved robustness to rotated activations and guarantees a better representation stability than the group convolution. \cite{Diaconu2} investigate combining the roto-translation group convolution with a self-attention mechanism to obtain equivariant data-dependent filters. By combining two contemporary fields of research, the proposed networks achieve improved results compared to each method on their own while reducing the number of model parameters - allowing to use data-dependent filters and incorporating geometrical prior knowledge at once. Inspired by the human visual system which is not fully rotation equivariant, \cite{RomeroCoAttentive} propose to use an attention mechanism to learn co-occurring transformations within the dataset. Thereby, the network can exploit information about co-occurring transformations without disrupting its global equivariance. For example, a network for face detection should exploit the relative orientation between the eyes and the nose. The authors show that this concept improves discrete rotation equivariant CNNs in both full and partial rotation equivariant tasks. \begin{table*}[t] \centering \begin{tabular}{|c|c|c|c|} \hline Reference & Equivariance group & Base space & Vector field type \\ \hline \cite{Fukushima, LeCun} & $\mathbb{Z}^2$ & $\mathbb{Z}^2$ & regular \\ \cite{GroupEquivariantCNNs} & $p4, p4m$ & $\mathbb{Z}^2$ & regular \\ \cite{SteerableCNNs} & $p4, p4m$ & $\mathbb{Z}^2$ & irrep \& regular \\ \cite{Diaconu2} & $p4$ & $\mathbb{Z}^2$ & regular \\ \cite{RomeroCoAttentive} & $p4$ & $\mathbb{Z}^2$ & regular \\ \cite{Bekkers} & $\mathbf{SE}(2, N)$ & $\mathbb{Z}^2$ & regular \\ \cite{SFCNN} & $\mathbf{SE}(2, N)$ & $\mathbb{R}^2$ & regular \\ \cite{Diaconu1} & $\mathbf{SE}(2, N)$ & $\mathbb{R}^2$ & regular \\ \cite{MarcosRot} & $\mathbf{SE}(2, N)$ & $\mathbb{R}^2$ & irrep \& regular \\ \cite{HarmonicNetworks} & $\mathbf{SE}(2)$ & $\mathbb{R}^2$ & irrep \\ \cite{E2STCNNs} & $\mathbf{E}(2)$ & $\mathbb{R}^2$ & any \\ \cite{SphericalCNNs} & $\mathbf{SE}(3) $ & $S^2$ & regular \\ \cite{Esteves, SphericalHourglass, EquivariantMultiView} & $\mathbf{SE}(3) $ & $S^2$ & trivial \\ \cite{Perraudin} & $\mathbf{SE}(3) $ & $S^2$ & trivial \\ \cite{DefferrardDeepSphere} & $\mathbf{SE}(3) $ & $S^2$ & trivial \\ \cite{Jiang} & $\mathbf{SE}(3) $ & $S^2$ & irrep \\ \cite{ClebschGordanNets} & $\mathbf{SE}(3)$ & $S^2$ & irrep \\ \cite{Winkels} & $D_4$, $D_{4h}$, $O$, $O_h$ & $\mathbb{Z}^3$ & regular \\ \cite{CubeNet} & $S_4$, $T_{4}$, $V$ & $\mathbb{Z}^3$ & regular \\ \cite{TensorFieldNetworks} & $\mathbf{SE}(3) $ & $\mathbb{R}^3$ & irrep \& regular \\ \cite{3DSTCNNs} & $\mathbf{SE}(3)$ & $\mathbb{R}^3$ & irrep \\ \cite{XuScale} & $\mathbb{R}^2 \rtimes S$ & $\mathbb{R}^2 $ & regular \\ \cite{LocalScaleInvariance} & $\mathbb{R}^2 \rtimes S$ & $\mathbb{R}^2 $ & trivial \\ \cite{MarcosScale} & $\mathbb{R}^2 \rtimes S$ & $\mathbb{R}^2 $ & irrep \& regular \\ \cite{Worrall19} & $\mathbb{R}^2 \rtimes S$ & $\mathbb{R}^2 $ & regular \\ \cite{ZhuScale} & $\mathbb{R}^2 \rtimes S$ & $\mathbb{R}^2 $ & regular \\ \cite{GhoshScale} & $\mathbb{R}^2 \rtimes S$ & $\mathbb{R}^2 $ & regular \& trivial \\ \cite{Sosnovik} & $\mathbb{R}^2 \rtimes S$ & $\mathbb{R}^2 $ & regular \\ \cite{IssakkimuthuS19} & $\mathbf{SE}(2) \rtimes S$ & $\mathbb{R}^2 $ & irrep \\ \cite{GIFT} & $\mathbf{SE}(2) \rtimes S$ & $\mathbb{R}^2$ & trivial\\ \cite{BekkersLie} & $\mathbb{R}^2 \rtimes H$ & $\mathbb{R}^2$ & regular \\ \hline \end{tabular} \caption{Overview of in- and equivariant CNNs classified by the equivariance group $G$, the base space $G/H$ and the field type $\rho$. Based on \cite{GeneralEquivariantCNNs}.} \label{tab:Equi} \end{table*} \textbf{3D rotations and translations:} A variety of approaches expand equivariance towards 3D signals and groups. Since finite groups grow exponentially with increasing dimension, sophisticated analytical solutions for equivariance are even more crucial than in the 2D case. First, we present work which achieves equivariance to 3D rotations and translations for inputs defined on the sphere $S^2$, e.g. spherical images or global climate models. \cite{SphericalCNNs} propose a spherical correlation incorporating the aforementioned equivariance properties. Therefore, they utilize the group Fourier transformation that allows to efficiently compute the convolution in the Fourier domain using a multiplication. \cite{Esteves} independently suggest to calculate the spherical convolution in the Fourier domain but use trivial instead of regular group representations. Both apply the spherical convolution for 3D shape recognition. \cite{SphericalHourglass} use the spherical convolutional layer to enforce invariance to the camera-pose in a DNN for semantic segmentation of spherical images. \cite{EquivariantMultiView} create a group representation from multiple views of a single object and process it with spherical CNNs in order to encode shape information equivariant to the icosahedral group. Additionally, they use the log-polar transformation which allows to use less viewpoints by exploiting the equivariance of related viewpoints since in-plane rotations act as translations in the log-polar domain. \cite{Perraudin} approximate a spherical convolution by treating the discrete sphere as a graph and applying a graph convolution. Their approach, called DeepSphere, achieves equivariance to 3D rotations by restricting the learned filters to be radial and is applied to cosmology images. While this approach fails to achieve exact equivariance, it allows to significantly reduce the computational complexity of spherical convolutions. In a subsequent paper, \cite{DefferrardDeepSphere} propose minor improvements of DeepSphere and show that the number of connected neighbors on the spherical graph can be used to trade-off between equivariance guarantees and computational complexity. Comparably, \cite{Jiang} process the sphere as a unstructured grid (mesh) and apply a mesh convolution. Rotation-equivariance is guaranteed by using a linear combination of parameterized differential operators. While the weights of the linear combination are learnable, the differential operators are efficiently estimated using one-ring neighbors. The operation itself is applicable to arbitrary unstructured grids and shows promising results for tasks in the spherical domain while being parameter-efficient. \cite{ClebschGordanNets} further generalize spherical $\mathbf{SO}(3)$-equivariant CNNs by proposing to use the Clebsch-Gordan transformation as a general purpose nonlinearity for rotation-equivariant spherical CNNs. The Clebsch-Gordan transformation, which decomposes a tensor into a product of its irreducible representations, was first used in neural networks for rotation-symmetric physical systems by \cite{Kondor1}. Since the transformation is calculated directly in the Fourier space, it avoids the frequent calculation of forward and backward Fourier transformations after each layer. Moreover, \cite{ClebschGordanNets} generalize the Fourier transformation to compact continuous groups. Multiple proposals achieve equivariance to 3D rotations and translations for three-dimensional inputs. \cite{Winkels} transfer the group convolution of \cite{GroupEquivariantCNNs} to 3D by transforming the filters using the finite 3D groups $D_4, D_{4h}, O$ and $O_h$ which describe the symmetries of cuboids and cubes, respectively. \cite{CubeNet} independently propose the same procedure using the cube group $S_4$ containing 24 right-angle rotations, the tetrahedral group $T_4$ including the 12 even rotations and Klein's four-group $V$, which is commutative and the smallest non-cyclic group. \cite{3DSTCNNs} expand the theory of steerable equivariant CNNs to 3D. They propose to parameterize 3D rotation steerable convolutional kernels as linear combinations of spherical harmonics with learnable weights. Additionally, they show that only the angular part of the spherical harmonics is restricted by the equivariance constraints, while the radial part can be chosen arbitrarily. \textbf{Scale}: Another interesting transformation that naturally occurs in many Computer Vision tasks is scale, which for example results from variable recording distances. Consequently, investigating how to expand group-equivariant CNNs to scaling transformations seems beneficial. Compared to rotations, this is more challenging because the scale group is not cyclic and unbounded. Additionally, scaling is often modeled as a semi-group due to the information loss when down-scaling an image which makes the group action non-invertible. In mathematical terms, scale transformations are often called dilation. \cite{XuScale} use a fairly similar approach to G-CNNs to obtain scale invariance in a convolutional neural network which they call multi-column CNN. The core idea is to share scaled versions of the same convolutional filter among different columns, each resulting in a maximum response at a different scale of the same pattern. The scaled versions of the filters are calculated using bilinear interpolation for upscaling while the minimum $L_2$-norm filter is used for downscaling. The columns, which can be seen as the group transformation channel in the G-CNN framework, process the input independently, resulting in a column-flip when a pattern is scaled. Finally, the column activations are concatenated and used for classification. \begin{figure} \centering \includegraphics[width=0.85\linewidth]{img/ScaleInvariantConv} \caption{A scale-invariant convolution layer proposed by \cite{LocalScaleInvariance}.} \label{fig:ScaleConv} \end{figure} Conversely, \cite{LocalScaleInvariance} process multiple scaled versions of the same input obtained using bilinear interpolation at each convolutional layer and keep the maximum response at each location by applying the max pooling operation over all scales (see Figure \ref{fig:ScaleConv}). Thereby, each layer guarantees local scale-invariance. While this approach leads to promising results, it involves two transformations of the input per convolution layer. \cite{MarcosScale} expand this approach by additionally storing the information about which scale caused the maximum response at each location. Thereby, they disentangle the scale and the magnitude of the response, which is stored as a vector field. Higher convolutional layers process both information at once using a vector field convolution. \cite{GhoshScale} adapt the local scale-invariant convolutions of Kanazawa et al. by transforming scale-steerable filters instead of the signal itself. The filters are composed of linear combinations of log-radial harmonics, an adapted version of the circular harmonics. By using the steerable filter approach, interpolation artifacts are avoided which leads to an improved scale robustness and performance. Additionally, the second scale operation of Kanazawa's approach is avoided because the filters are transformed instead of the signals. \cite{Worrall19} propose to formally enhance the group convolution such that it can be applied to transformations modeled as a semigroup: \begin{equation} [k \star_S f](s) = \sum_{x\in X} k(x)L_s[f](x) \text{.} \end{equation} In comparison to the group convolution (Equation \ref{eq:GConv}), the signal is transformed instead of the filter, which is similar to the approach used by \cite{LocalScaleInvariance}. Again, a transformation acting on the input induces a shift in the semi-group convolution's output. By defining the input images as scale-spaces, i.e. the input and multiple blurred versions of it, and modeling dilations as a discrete semigroup, a scale equivariant NN can be defined. \cite{Worrall19} restrict their approach to integer scaling to avoid interpolation when creating the scale space, which on the downside leads to unwanted boundary effects. \cite{ZhuScale} propose a scale-equivariant CNN using joint convolutions across the space and scaling group. In order to reduce the model complexity, they decompose the convolutional filters under two pre-fixed separable Fourier-Bessel bases with trainable expansion coefficients. At the same time, they truncate the filters to low frequency components which leads to an improved deformation robustness and a reduced parameter consumption. \cite{Sosnovik} use steerable filters and scale-equivariant group convolutions in combination with a discrete number of scales. This approach allows to efficiently calculate filters for arbitrary real-valued scaling factors. Two-dimensional Hermite polynomials with a Gaussian envelope are used as the steerable filter basis. As usual for steerable filter CNNs, the filter basis is pre-computed while the weights of the linear combinations are learned using the backpropagation algorithm. While the network could learn from inter-scale interactions in theory, the experiments show that the DNNs perform better using limited inter-scale interactions. \cite{IssakkimuthuS19} propose to learn rotation-equivariant filter bases using an autoencoder with $\mathbf{SO}(2)$-equivariant mapping and tensor nonlinearities. Additionally, scale-coupled bases are used in combination with the tensor nonlinearity to obtain scale-robust filter bases. Finally, they show that the learned bases closely resemble their Fourier counterparts and allow for good performance in classification tasks. \cite{GIFT} use a two-step approach to obtain pixel-wise visual descriptors invariant to scale and rotations, which can be used to find correspondence points in a set of images. First, they process transformed versions of the input image using a standard CNN. Second, they use the group convolution for rotations and scales as well as bilinear group pooling to obtain invariant features, which they call GIFT descriptors. \textbf{Arbitrary Groups}: \cite{Gauge} extend group convolutions to local gauge transformations, which enables equivariant CNNs on manifolds instead of on homogeneous base spaces. The convolutions only depend on the intrinsic geometry of the manifold. Compared to previous work, equivariance is guaranteed with respect to local transformations instead of global ones. This framework is applied to signals on a icosahedron which is an approximation of the sphere. \cite{Finzi2020} propose a convolutional layer equivariant to transformations which can be expressed as a Lie group based on a surjective exponential map. The novel layer can be applied to arbitrary continuous data, including regular grids (images) and point clouds. Equivariance to a new group can be achieved by only implementing the group exponential and logarithm maps and using the general layer framework. Hence, the proposed layer is flexible and can be used for a variety of different problem settings. Comparably, \cite{BekkersLie} introduces a convolutional layer equivariant to groups that are a semidirect product of the translation group and arbitrary Lie groups. Therefore, the convolutional kernels are parameterized using B-spline basis functions defined on the Lie algebra of the corresponding Lie group. By altering the respective type of the B-spline basis functions localized, dilated and deformable group convolutions can be implemented. In summary, group convolutions have been applied to a variety of transformations in both two and three dimensions. While most applications thus far are limited to simple transformations on homogeneous base spaces, e.g. scale and rotations, current research investigates how to generalize the group convolution to more complex groups and input domains. \subsection{Learned Feature Transformations} \begin{figure}[t] \centering \begin{subfigure}[b]{\linewidth} \centering \includegraphics[width=0.8\linewidth]{img/SpatialTransformer} \caption{Spatial Transfomer Network (\cite{STN})} \label{fig:STN} \end{subfigure} \begin{subfigure}[b]{\linewidth} \centering \includegraphics[width=0.85\linewidth]{img/EquivariantTransformer} \caption{Equivariant Transformer Network (\cite{ETN})} \label{fig:ETN} \end{subfigure} \caption{Architecture of spatial and equivariant transformer networks \cite{ETN}.} \end{figure} Another possibility to obtain a transformation invariant feature space is to estimate the transformations acting on the input in order to subsequently re-transform it to its \textit{canonical} form. Moreover, this procedure can be applied in the feature space of DNNs - not only on the input. Hence, we refer to this approach as \textbf{learned feature transformations}. Spatial Transformer Networks (STNs, \cite{STN}) implicitly learn invariance to affine transformations - including translation, rotation and scale - at once without additional supervision. A three-step approach is used to estimate and perform transformations of the input or feature spaces of CNNs to obtain invariant representations: A localization network estimates the transformation parameters of an affine transformation, which is used to calculate a parameterized sampling grid. A differentiable image sampling, e.g. bilinear interpolation, is then used to reverse transform the input (see Figure \ref{fig:STN}). This facilitates the usage of the backpropagation algorithm to train both the convolution operator as well as the localization network at once. \cite{PolarTN} enhance STNs by using a polar coordinate transformation to learn features for object classification that are invariant to translations and equivariant to rotations and scale. A CNN predicts the object center which is used as the origin for the log-polar transformation of the input. Effectively, the transformed representation is invariant with respect to the object location. Additionally, rotations and scales in the regular image domain appear as shifts in polar space because they are the \textit{canonical coordinates} with respect to those transformations. Consequently, a standard CNN can be used processing the log-polar representation for a rotation- and scale-equivariant classification. Since the log-polar transformation is differentiable, the whole architecture including the polar origin predictor can be optimized end-to-end. \cite{ETN} further generalize this method towards arbitrary continuous transformation groups and call their method Equivariant Transformer Networks (ETNs). Similar to the procedure in STNs, a separate network is trained to estimate, how the input is transformed. The estimated parameters are used to re-transform the input back to its \textit{canonical} form. However, in contrast to STNs, the input is transformed to the canonical coordinate system corresponding to the desired symmetry transformation. Thereby, the inverse transformation parameters are estimated in an equivariant manner using standard convolutions. In comparison to Polar Transformer Networks, ETNs only transform their input to canonical coordinates to estimate the transformation parameters. The classification itself is performed in the regular Euclidean domain, see Figure \ref{fig:ETN}. While learned feature transformations facilitate learning invariant representations, they do not incorporate geometrical prior knowledge in a guaranteed way. In contrast, invariance is learned in a task-specific manner without any additional supervision. However, \cite{ETN} and \cite{PolarTN} show how to combine equivariant convolutions and learned feature transformations. \subsection{Capsules} \begin{figure*}[t] \centering \includegraphics[width=0.75\linewidth]{img/Capsule} \caption{Example of a capsule network architecture \cite{Capsules}.} \label{fig:Capsule} \end{figure*} \cite{HintonTransformingAE} introduce the notion of a group of neurons called \textbf{capsules} that perform internal calculations to output a small vector of highly informative outputs. This vector consists of the probability that the visual entity the capsule specializes on is present and its instantiation parameters, e.g. its pose, lightning conditions or deformation. While the former part should be invariant to changes of the instantiation parameters, the latter part should be equivariant. The proposed capsules are trained on pairs of transformed images with known transformation matrix using a transforming autoencoder. Capsules can be arranged in a \textit{capsule network} similar to other DNNs consisting of multiple layers with multiple nodes (see Figure \ref{fig:Capsule}). In capsule networks, a \textit{routing algorithm} is used to determine, which lower-layer capsules send information to their higher-layer counterparts. \cite{DynamicRoutingCapsules} propose a variation of capsules by encoding the instantiation parameters using the orientation of the capsule's output vector, while its length determines the probability that the entity exists in the input. This enables to use a dynamic routing approach between lower- and higher-level capsules. It is based on calculating a scalar product between their respective vectors to determine part-whole relationships. Convolutional layers are used within the capsules to benefit from weight sharing. The approach enables capsules to learn the pose information inherently through the routing mechanism. \cite{Capsules} introduce a novel type of capsules consisting of a logistic unit indicating the presence of an entity and a pose matrix storing the entity's pose information. The logistic unit allows to optimize an objective function specialized on detecting entities while the pose matrix allows to calculate simplified transformation matrices between capsules. Moreover, a new routing algorithm based on Expectation Maximization (EM) is proposed such that active capsules receive a cluster of similar pose votes from lower-level capsules. \cite{LenssenGroupCapsules} combine capsules with group convolutions to guarantee transformation-invariant output activations and equivariant pose vectors. Therefore, the capsules utilize group convolutions for their calculations, store the pose information as group elements and adapt the dynamic routing algorithm to guarantee equivariance under specified conditions. The group equivariant capsules are applied to SO(2) using spline-based convolutional kernels to avoid interpolation. While the proposed capsules now incorporate guaranteed equivariance properties, restricting the pose vector to group representations prevents the capsule from extracting arbitrary pose information, e.g. lighting. \cite{VenkDeepEquivariantCapsules} propose space-of-variation capsules in order to improve the scalability of capsule networks and guaranteeing equivariance properties at the same time. Instead of learning pair-wise relationships between capsules, each capsule learns to encode the manifold of legal pose-variations, called space-of-variations, through a neural network that uses group convolutions to benefit from increased parameter sharing. Additionally, a provably equivariant routing procedure guarantees that learned part-whole relationships are preserved under transformations. In comparison to \cite{LenssenGroupCapsules}, the pose information is not embedded as group elements. While this reduces the transformation efficiency of the representation, compositionalities involving non-geometrical properties can be learned more efficiently. A broad field of research applies capsules to different problem settings or adapts their technicalities, e.g. the routing mechanism. However, listing these proposals is beyond the scope of this survey which focuses on methods to obtain in- or equivariant representations. \subsection{Invariant Integration} Invariant Integration is an approach to construct a complete feature space with respect to a transformation first proposed for pattern recognition tasks by \cite{SM_Existence}. A complete feature space maps all equivalent patterns according to a transformation group $G$ from the signal space $S$ to the same point in the feature space $F$, whereas all non-equivalent patterns are mapped to distinct points. \cite{SM_Existence} mathematically defines conditions for the existence of complete feature spaces in pattern recognition tasks. For finite groups, a complete feature space can be computed by calculating all possible monomials \begin{equation} f(x) = x_0^{b_0}x_1^{b_1} \hdots x_{n-1}^{b_n-1} \quad \text{with} \quad b_1 + b_2 + \hdots + b_{n-1} \leq |G| \end{equation} with the monomial exponents $b_i$ and calculating the group average, which is defined as \begin{equation}\label{eq:groupAverage} A[f](x) := \int_{G} f(gx)dg \text{.} \end{equation} It is closely related to the group convolution (cf. Eq. \ref{eq:GConvCont}) and can be interpreted as a special case using a uniform kernel $k$ and the monomial output $f(x)$. For finite groups, equation \ref{eq:groupAverage} is reduced to a sum over all group elements. The group average using all possible monomials is a valid basis representing the set of invariants. However, it is just an upper bound and computationally inefficient, especially for larger groups. Thus, it is important to reduce the number of monomials by carefully selecting them to improve the separability of the invariant feature space. The separability can also be improved by constructing weak $G$-commutative maps acting on them (\cite{SM_Existence}). \cite{SM_Algos} expands this theory to non-compact groups and continuous signals by introducing the notion that combining invariance to compact subgroups induces invariance to more general groups. For example, features invariant to the general linear group $GL(n,\mathbb{C})$ can be built by a quotient of homogeneous features invariant to the special unitary group $SU(n, \mathbb{C})$. Continuous signals within a Hilbert space are decomposed using a basis and an appropriate inner product to construct stable subsets. Subsequently, invariants to these subsets can be determined. \cite{SM_Gray} applies the derived methods to 2D transformations and rotations on gray-scale images. The calculated invariant features are used to classify objects in an image. Twelve different monomials are processed via the group average to obtain invariance to global rotations and translations. In practice however, there might not only exist global transformations but also multiple local ones. In this case, the group-averaged monomials are not fully invariant, but vary only slowly. This also holds for small overlaps and articulated objects. Multiple objects within the same image are additive, i.e. their invariant feature values add, as long as they do not overlap. While the obtained features are invariant, they are not optimal for the specific application. Additional desirable properties, e.g. separability or robustness to distortions, need to be included by designing additional maps before applying invariant integration. \cite{Condurache} combine multiple approaches in order to achieve invariance to multiple transformations. First, they compute Fourier descriptors of humans' contours to obtain features invariant to color changes, starting point, rotation and translation. Moreover, they use invariant integration with monomials in Fourier space which guarantees invariance to rotations in Fourier space. This corresponds to invariance with respect to anthropomorphic changes, i.e. different size and build among humans, in signal space. In total, this approach can be modeled as using a chain of invariant transformations to achieve an induced invariance in the input domain. Eventually, a Support Vector Machine (SVM) processes the invariant features for human event detection in video scenes. \cite{Rath} propose to use invariant integration in combination with equivariant group convolutions to compute a representation invariant to rotations and translations for image classification. The proposed Invariant Integration Layer's exponents $b_i$ can be optimized using the backpropagation algorithm which makes it a drop-in replacement for pooling layers that are usually utilized for the transition between the equivariant and invariant feature space in equivariant neural networks. Thereby, the data-efficiency of those networks is improved. In summary, Invariant Integration is a method to construct a complete feature space with respect to a transformation. Comparably to the scattering transformation, most proposals use it to construct a feature space for classifiers such as a SVM, while novel approaches try to combine it with deep learning approaches in order to increase their data-efficiency. \subsection{Other Methods} \begin{figure} \centering \includegraphics[width=\linewidth]{img/TIPooling} \caption{Network architecture using TI Pooling \cite{Laptev}.} \label{fig:TIPooling} \end{figure} In this section, we introduce approaches which do not fit into one of the previous subcategories. \cite{GensDeepSymmetry} suggest to form feature maps over arbitrary symmetry groups. A kernel-based interpolation scheme is used to find all transformed points in the lower layer contributing to a point of the symmetry feature map. The same kernel is used at every point of the symmetry feature map which leads to weight-tying among transformations. To reduce the computational complexity especially for higher-order transformations, a sub-sampling of the $N$ most important points in a neighborhood, determined by Gauss-Newton optimization, is performed. TI-Pooling (\cite{Laptev}) is a method to compute transformation-invariant features. The input of a CNN is transformed with all transformation elements the network should be invariant to, one forward-pass per transformation element is computed using the same weights and max-pooling is applied among all responses, as shown in Figure \ref{fig:TIPooling}. While this procedure is a straight-forward way to obtain transformation-invariance, it is computationally expensive since - due to its \textit{brute-force} nature - $|G|$ forward-passes need to be computed per input. This is especially problematic for bigger transformation groups. \cite{HenriquesWarpedConv} propose to warp the input of a CNN using the exponential map of arbitrary transformation groups such that transformations of the input result in translations of the warped image map. Hence, a standard convolution can be applied in the warped space to achieve equivariance - decreasing computational requirements compared to group convolutions. This approach is applied to three transformations: scale and aspect ratio, scale and rotation and perspective 3D rotations. However, in their implementation, the arbitrary groups need to be Abelian and only have two parameters in order to avoid more complex computations. \cite{RegularizedInvariance} model the worst-case transformations a DNN needs to be robust to as spatial adversarial attacks. This facilitates the use of a regularization term in combination with data augmentation to encourage learning constant values for all transformed versions. Consequently, invariance to transformation sets is guaranteed. This is a weaker requirement than invariance to transformation groups that allows to impose the desired properties on subsets not forming a group, e.g. rotations in $[-90^\circ, 90^\circ]$. In contrary to usual adversarial defense regularization, the proposed method does not include a trade-off between accuracy and adversarial robustness, but is able to improve the overall performance of the DNN. \cite{Feige} uses a Variational Autoencoder (VAE) to learn an invariant class representation and equivariant information about the transformation needed to obtain the specific sample from the canonical group sample. During reconstruction, the decoder only gets the invariant latent variable from samples of the same class, but not of the sample itself. Contrarily, the equivariant information is sample-specific and is thus used to adapt the reconstructed class sample to the specific instance using a smooth transformation. Hence, the equivariant representation is able to encode arbitrary smooth transformations. The learned latent representation of the VAE can be used for other tasks, e.g. classification. \section{Datasets and Benchmarks} \begin{figure} \centering \begin{subfigure}{0.15\linewidth} \includegraphics[width=\linewidth]{img/mnist_rot/0} \end{subfigure} \begin{subfigure}{0.15\linewidth} \includegraphics[width=\linewidth]{img/mnist_rot/1} \end{subfigure} \begin{subfigure}{0.15\linewidth} \includegraphics[width=\linewidth]{img/mnist_rot/2} \end{subfigure} \begin{subfigure}{0.15\linewidth} \includegraphics[width=\linewidth]{img/mnist_rot/3} \end{subfigure} \vspace{2pt} \begin{subfigure}{0.15\linewidth} \includegraphics[width=\linewidth]{img/mnist_scale/0} \end{subfigure} \begin{subfigure}{0.15\linewidth} \includegraphics[width=\linewidth]{img/mnist_scale/1} \end{subfigure} \begin{subfigure}{0.15\linewidth} \includegraphics[width=\linewidth]{img/mnist_scale/2} \end{subfigure} \begin{subfigure}{0.15\linewidth} \includegraphics[width=\linewidth]{img/mnist_scale/3} \end{subfigure} \vspace{2pt} \begin{subfigure}{0.15\linewidth} \includegraphics[width=\linewidth]{img/affnist/0} \end{subfigure} \begin{subfigure}{0.15\linewidth} \includegraphics[width=\linewidth]{img/affnist/1} \end{subfigure} \begin{subfigure}{0.15\linewidth} \includegraphics[width=\linewidth]{img/affnist/2} \end{subfigure} \begin{subfigure}{0.15\linewidth} \includegraphics[width=\linewidth]{img/affnist/3} \end{subfigure} \caption{Examples from rotated MNIST (top), MNIST-Scale (middle) and affNIST (bottom).} \label{fig:MNIST} \end{figure} \begin{table*}[t] \centering \begin{tabular}{|l|c|} \hline Method & Test Error [$\%$] \\ \hline Conventional CNN & 5.03 \\ \cite{Scattering} & 4.4 \\ \cite{LenssenGroupCapsules} & 2.6\\ \cite{PolarTN} & 1.83 \\ \cite{HarmonicNetworks} & 1.69 \\ \cite{Laptev} & 1.2 \\ \cite{MarcosRot} & 1.09 \\ \cite{Rath} & 0.72 \\ \cite{SFCNN} & 0.71\\ \cite{E2STCNNs} & 0.68 \\ \hline \end{tabular} \caption{Mean test error $[\%]$ on the rotated MNIST dataset.} \label{tab:RotMNIST} \end{table*} \begin{table*}[t] \centering \begin{tabular}{|l|c|} \hline Method & Test Error [$\%$] \\ \hline Conventional CNN & 3.48 \\ \cite{LocalScaleInvariance} & 3.13 \\ \cite{MarcosScale} & 2.44 \\ \cite{STN} & 1.97 \\ \cite{GhoshScale} & 1.91 \\ \cite{Sosnovik} & 1.68 \\ \hline \end{tabular} \caption{Mean test error $[\%]$ on the MNIST-scale dataset.} \label{tab:ScaledMNIST} \end{table*}\begin{table*}[t] \centering \begin{tabular}{|l|c|} \hline Method & Test Error [$\%$] \\ \hline Conventional CNN (\cite{DynamicRoutingCapsules}) & 34.0 \\ \cite{DynamicRoutingCapsules} & 21.0 \\ Conventional CNN (\cite{ETN}) & 12.7 \\ \cite{LenssenGroupCapsules} & 10.9 \\ \cite{Capsules} & 6.9 \\ \cite{VenkDeepEquivariantCapsules} & 2.99 \\ \cite{ETN} & 1.7 \\ \hline \end{tabular} \caption{Test error $[\%]$ on the affNIST dataset.} \label{tab:AffNist} \end{table*} Most of the algorithms presented in this paper evaluate their performance on artificially transformed versions of MNIST (\cite{MNIST}), a well-known dataset for hand-written digit recognition, to prove the incorporated in- or equivariance properties. We summarize the reported performances of different in- or equivariant algorithms on transformed MNIST datasets in this section to allow an easy comparison. The rotated MNIST dataset (\cite{RotMNIST}) contains digits that are randomly rotated by angles $\phi \in (0, 360)^\circ$. It consists of a training set with $10,000$, a validation set with $2,000$ and a test set with $50,000$ samples. Examples of the dataset are shown in Figure \ref{fig:MNIST} (top). Due to the relatively small amount of training samples, the variability of all possible rotations is not captured in the training dataset. Hence, DNNs incorporating in- or equivariance to rotations achieve comparably better results. The reported results of various proposals are shown in Table \ref{tab:RotMNIST}. The MNIST-Scale dataset (\cite{MNIST-Scale}) consists of digits which are randomly scaled by uniformly sampled factors $s \in (0.3, 1)$. The size of the training, validation and test set is the same as for rotated MNIST. Examples are depicted in Figure \ref{fig:MNIST} (middle) and the reported results are shown in Table \ref{tab:ScaledMNIST}. Finally, the affNIST dataset (\cite{affNIST}) is used to test the robustness of algorithms, mainly capsule networks, to unseen affine transformations. Therefore, the networks are trained on randomly translated digits from the MNIST dataset and tested on digits which are randomly transformed with small affine transformations. Examples are shown in Figure \ref{fig:MNIST} (bottom) while the reported results are listed in Table \ref{tab:AffNist}. Additionally, most authors also apply their approach to a real world dataset where the incorporated prior knowledge often allows to outperform conventional algorithms. We refrain from listing the latter since their uniqueness and variety prevents us from comparing multiple algorithms. \section{Towards Geometrical Prior Knowledge for Autonomous Driving} Systems for automated driving need to solve a variety of problems that could benefit from deep learning approaches. This includes processing and fusing signals from different sensors, perceiving the environment, i.e. reliably detecting and locating other objects in a driving scene, understanding and assessing the environment, localizing the ego vehicle and finally, planning and executing driving maneuvers. Especially for the perception part, deep learning approaches have been established to provide state-of-the-art results on several benchmarks (e.g. \cite{KITTI3D, nuScenes}). Moreover, DNNs are used within cutting edge prototype vehicles already driving on real streets autonomously. We refer the reader to \cite{SurveyAutonomous} for a concise overview over datasets, methods and challenges concerning deep learning and autonomous driving. Nevertheless, there remain some open problems which need to be solved before DNNs can safely be used within self-driving cars. Foremost, collecting and labelling the data needed for supervised learning is both time-consuming and cost-expensive. Particularly, labelling three-dimensional objects in driving scenes is a non-trivial task. Furthermore, DNNs are hard to evaluate due to their black box behavior which makes it hard to predict outcomes given data-points the network has not been trained on. This is delicate since self-driving cars must operate safely even in unexpected circumstances, e.g. a car behaving in a way that was not included in the training data. We argue that incorporating geometrical prior knowledge to deep learning systems for autonomous driving helps to mitigate both depicted problems. On the one hand, the data-efficiency of DNNs is increased which means that less data needs to be collected, stored and labelled to achieve the same performance level. On the other hand, in- or equivariance guarantees aid the interpretability of DNNs. \textbf{Equivariant 3D Object Detection}: As an example, we show how 3D object detection can benefit from in- or equivariance to various transformations. In this section, we list several transformation groups that affect the output of an 3D object detector in a predictable way. An ideal 3D object detector should be stable to shape deformation and varying object size (i.e. scale) and equivariant to translation and rotation of the object to be detected since the pose information is needed to predict the exact location. Moreover, neural nets processing point clouds must be invariant to permutations and varying point cloud densities. Contrarily, color changes in images, including variable illumination, should be considered. Ideally, the detection should also be equivariant to more complicated transformations, e.g. (partial) occlusions. Object detection can be divided in several sub-tasks: Recognition, object type classification and estimation of the relative position, orientation and size. While recognition and classification build invariants, it is important to preserve information about position, orientation and size to be able to estimate them. Therefore, equivariant outputs are more appropriate in this case. \section{Conclusion} In this section, we first summarize the various methods presented and their different advantages and disadvantages. Afterwards, we draw a conclusion and give a short outlook on possible future work. \textbf{Data augmentation} is easy to implement and highly adaptable towards a variety of transformations. Additionally, it can easily be used in combination with other approaches. On the downside, it does not provide any mathematical guarantees, augmenting the data with all possible transformations is computationally inefficient, the solution space is not restricted effectively and the equivariance is only learned for the network as a whole, not at each layer. \textbf{Restricted filters} provide a provable way to obtain in- or equivariant representations in neural networks and reduce the space of learnable parameters. However, the restrictions might be too strict and prevent the network from learning informative representations, especially when the filters are fixed rather than learnable. Enforcing equivariance properties using \textbf{group convolutions} provides a mathematically guaranteed way to incorporate geometrical prior knowledge to DNNs and leads to state-of-the-art results in a variety of tasks benefiting from in- or equivariance properties. Up to now, group convolutions are restricted to fairly simple and often finite transformation groups and suffer from a computational overhead. Moreover, important symmetries occurring in tasks are not expressible using the concept of groups, e.g. viewpoint changes in images. Incorporating in- or equivariance to multiple transformation groups at once is also an area which needs further investigation. \textbf{Learned Feature Transformations} provide a way to learn invariance from data rather than defining and incorporating it manually. Feature transformation layers are easy to include to existing neural network architectures. The transformations are learned from data and not restricted to groups. Nonetheless, learned feature transformations usually lack mathematical guarantees. \textbf{Capsules} disentangle learned object representations into invariant object information and equivariant pose parameters. This includes sophisticated transformations such as viewpoint-changes or lighting which can not be modeled as groups. However, capsules do not guarantee the desired properties. Adaptations leveraging group symmetry exist but either suffer from a reduced transformation efficiency or restrictions regarding the equivariant pose information. Capsule networks are non-straightforward to train because they need a carefully-designed routing algorithm to assign activations to other layers as well as for backpropagation. \textbf{Invariant Integration} is a method to guarantee invariance while increasing the separability of distinct patterns. However, it suffers from computational complexity, is restricted to group transformations, the monomials are hard to choose in a principled manner and disposes the information about the symmetry group. Consequently, it is best used in combination with equivariant G-CNNs to improve the separability of learned invariant representations while exploiting the properties of equivariant learnable filters. In this survey, we showed how utilizing prior knowledge can enhance state-of-the-art deep learning systems and used 3D object detection as an example. Foremost, defining problem-specific symmetry groups and introducing in- or equivariance to them can greatly improve the performance of neural networks, especially when the amount of training data is scarce. This has been proven in a broad variety of interesting applications from medical imaging to 3D shape recognition. Moreover, this approach improves the interpretability of neural network layers which is important for validation. We expect future work to investigate further generalizations to more complex input domains and symmetry groups as well as to more complicated, non-invertible transformations, e.g. occlusions. Moreover, DNNs incorporating multiple symmetries at once could be of interest. {\small
\section{Introduction} With the rise of manycore accelerators, such as graphics processing units (GPUs), there is an increasing demand for linear algebra libraries that can efficiently transform the massive hardware concurrency available in a single compute node into high arithmetic performance. At the same time, more and more application projects adopt object-oriented software designs based on C++. In this paper, we present the result from our effort toward the design and development of \textsc{Ginkgo}\xspace, a next-generation, high performance sparse linear algebra library for multicore and manycore architectures. The library combines ecosystem extensibility with heavy, architecture-specific kernel optimization using the platform-native languages CUDA (for NVIDIA GPUs), HIP (for AMD GPUs), and OpenMP (for general-purpose multicore processors, such as those from Intel, AMD or ARM). The software development cycle that drives \textsc{Ginkgo}\xspace ensures production-quality code by featuring unit testing, automated configuration and installation, Doxygen\footnote{\url{http://www.doxygen.nl/}} code documentation, as well as a continuous integration and continuous benchmarking framework. \textsc{Ginkgo}\xspace is an open source effort licensed under the BSD 3-clause.\footnote{\url{https://opensource.org/licenses/BSD-3-Clause}} \begin{figure}[t] \begin{center} \includegraphics[width=0.98\textwidth]{figures/ginkgo_overview-crop.pdf} \end{center} \caption{\textsc{Ginkgo}\xspace library architecture separating the core containing the algorithms from architecture-specific backends.} \label{fig:ginkgooverview} \end{figure} The object-oriented \textsc{Ginkgo}\xspace library is constructed around two principal design concepts. The first principle, aiming at future technology readiness, is to consequently separate the numerical algorithms from the hardware-specific kernel implementation to ensure correctness (via comparison with sequential reference kernels), performance portability (by applying hardware-specific kernel optimizations), and extensibility (via kernel backends for other hardware architectures), see Figure~\ref{fig:ginkgooverview}. The second design principle, aiming at user-friendliness, is the convention to express functionality in terms of linear operators: every solver, preconditioner, factorization, matrix-vector product, and matrix reordering is expressed as a linear operator (or composition thereof). The rest of the paper is organized as follows. In \Cref{sec:design}, we leverage a simple use case to motivate the design choices underlying \textsc{Ginkgo}\xspace, and elaborate on the concept of linear operators, memory management, hardware-specific kernel optimization, and event logging. \Cref{sec:solvers} provides additional details on \textsc{Ginkgo}\xspace's current solvers, realizations for the sparse matrix-vector product (\textsc{SpMV}\xspace) kernel, and preconditioner capabilities. \Cref{sec:extensibility} elaborates on how the design allows for easy extension, so that users can contribute new algorithmic technology or additional hardware backends. As many applications are in desperate need for high performance sparse linear algebra technology, \Cref{sec:external_libraries} showcases the usage of \textsc{Ginkgo}\xspace as a backend library in scientific applications, and also reviews \textsc{Ginkgo}\xspace's integration into the extreme-scale Software Development Kit (xSDK). In~\Cref{sec:sustainability} we describe how \textsc{Ginkgo}\xspace's design and development cycle promotes sustainable software development; and in~\Cref{sec:evaluation}, we offer representative performance results indicating \textsc{Ginkgo}\xspace's competitiveness for sparse linear algebra on high-end GPU architectures. We conclude in~\Cref{sec:conclusion} with a summary of the paper and the potential of the library design becoming a role model for future developments. \section{An Overview of Ginkgo's design} \label{sec:design} \begin{figure}[t] \begin{center} \includegraphics[width=0.9\textwidth]{figures/ginkgo-hierarchy.pdf} \end{center} \caption{\textsc{Ginkgo}\xspace's class hierarchy showcasing the main namespaces (colored boxes) and classes (gray boxes) for \textsc{Ginkgo}\xspace.} \label{fig:gko-hierarchy} \end{figure} \Cref{fig:gko-hierarchy} displays \textsc{Ginkgo}\xspace's rich class hierarchy together with its main namespaces and classes. To better understand the role of each object, this section introduces \textsc{Ginkgo}\xspace's interface using a minimal, concrete example as a starting point, and gradually presenting more advanced abstractions that demonstrate \textsc{Ginkgo}\xspace's high composability and extensibility. These abstractions include: \begin{itemize} \item the \class{LinOp} and \class{LinOpFactory} classes which are used to implement and compose linear algebra operations, \item the \class{Executor} classes that allow transparent algorithm execution on multiple devices; and \item other utilities such as the \class{Criterion} classes, which control the iteration process, as well as the memory passing decorators that allow fine-grained control of how memory objects are passed between different components of the library and the application. \end{itemize} \subsection{\textsc{Ginkgo}\xspace usage example} \label{sec:intro/example} \Cref{fig:gko-flowchart} illustrates the specific flowchart \textsc{Ginkgo}\xspace uses to solve a linear system, highlighting the interactions between \textsc{Ginkgo}\xspace's classes. In the program code for this example given in \Cref{lst:gko_code}, the system matrix \texttt{A}, the right-hand side \texttt{b}, and the initial solution guess \texttt{x}, are initially read from the standard input using \textsc{Ginkgo}\xspace's `read' utility (lines~9--11). Next, the program creates a factory for a CG Krylov solver preconditioned with a block-Jacobi scheme (lines~13--15). The solver is configured to stop either after 20 iterations or having improved the original residual by 15 orders of magnitude (lines~16--19). (Stopping criteria are further discussed in \Cref{sec:intro/criteria}.) The system matrix is bound to the iterative solver, which is used to solve the system with the right-hand side and initial guess. The initial guess is overwritten with the computed solution (line~23). Solvers (and more generally \class{LinOp} and \class{LinOpFactory}) are discussed in detail in \Cref{sec:intro/linop}. Finally, the solution is printed to the standard output (line~25). \begin{center} \begin{minipage}{\linewidth \begin{lstlisting}[caption={A minimal example that uses \textsc{Ginkgo}\xspace to solve a linear system. The system matrix, right-hand side, and the initial solution guess are read from the standard input. The system is solved on an NVIDIA-enabled GPU using the CG method enhanced with a block-Jacobi preconditioner. Two stopping criteria are combined to limit the maximum number of iterations and set the desired relative error. The solution is written to the standard output.}, label=lst:gko_code] #include <iostream> #include <ginkgo/ginkgo.hpp> int main() { // Instantiate a CUDA executor auto cuda = gko::CudaExecutor::create(0, gko::OmpExecutor::create()); // Read data auto A = gko::read<gko::matrix::Csr<>>(std::cin, cuda); auto b = gko::read<gko::matrix::Dense<>>(std::cin, cuda); auto x = gko::read<gko::matrix::Dense<>>(std::cin, cuda); // Create the solver factory auto solver_factory = gko::solver::Cg<>::build() .with_preconditioner(gko::preconditioner::Jacobi<>::build().on(cuda)) .with_criteria( gko::stop::Iteration::build().with_max_iters(20u).on(cuda), gko::stop::ResidualNormReduction<>::build() .with_reduction_factor(1e-15) .on(cuda)) .on(cuda); // Create the solver from the factory and solve the system solver_factory->generate(gko::give(A))->apply(gko::lend(b), gko::lend(x)); // Write result write(std::cout, gko::lend(x)); } \end{lstlisting} \end{minipage} \end{center} \begin{figure}[tbh] \begin{center} \includegraphics[width=0.9\textwidth]{figures/ginkgo-flowchart.pdf} \end{center} \caption{Flowchart providing an alternative view of the code example shown in \Cref{lst:gko_code}. All object interactions are represented by arrows. The colors correspond to the type of the objects following the color convention in \Cref{fig:gko-hierarchy}.} \label{fig:gko-flowchart} \end{figure} \textsc{Ginkgo}\xspace supports execution on GPU and CPU architectures using different backends (currently, CUDA, HIP, and OpenMP). To accommodate this, when creating an object, the user passes an instance of an \class{Executor} in order to specify where the data for that object should be stored and the operations on that data should be performed. The particular example in \Cref{lst:gko_code} creates a CUDA \class{Executor} (line~7) that employs the first GPU device (the one returned by \texttt{cudaGetDevice(0)}). Since CUDA GPU accelerators are controlled by the CPU, an OpenMP \class{Executor} is needed to orchestrate the execution on the GPU. (\Cref{sec:intro/executor} describes the executors model in more detail.) \textsc{Ginkgo}\xspace avoids expensive memory movement and copies. At the same time, sharing data between different modules in the code might cause unexpected results (e.g.,\ one module changes a matrix used by a solver in a different module, which causes that solver to tackle the wrong system). \textsc{Ginkgo}\xspace resolves the dilemma by allowing both shared and exclusive (unique) ownership of the objects. This comes at the price of some verbosity in argument passing: in most cases, plain arguments cannot be passed directly, but have to be wrapped in special ``decorator'' functions that specify in which ``mode'' they are passed (shared, copied, etc.). The minimal example in \Cref{lst:gko_code} already utilizes two of the decorator functions, \texttt{gko::give} and \texttt{gko::lend}, both in line~23. The first one, \texttt{gko::give(A)}, causes the caller to yield the ownership of matrix \texttt{A} to the solver, leaving the caller's version of \texttt{A} in a valid, but undefined state (e.g.,\ accessing any of its methods is not defined, but the object can still be de-allocated or assigned to). The second decorator, appearing twice, in \texttt{gko::lend(x)} and \texttt{gko::lend(b)}, ``lends'' objects \texttt{x} and \texttt{b} to the solver by temporarily passing ownership to it until the control flow returns from \texttt{apply} back to the caller. This is a special ownership mode that is only used when the callee does not need permanent ownership of the object. Different ownership modes, as well as their relation to \texttt{std::move} are discussed in \Cref{sec:intro/memory-management}. \subsection{\class{LinOp} and \class{LinOpFactory}} \label{sec:intro/linop} \subsubsection{Motivation} \label{sec:intro/linop/motivation} \textsc{Ginkgo}\xspace exposes an application programming interface (API) that allows to easily combine different components for the iterative solution of linear systems: solvers, matrix formats, preconditioners, etc. The API enables running distinct iterative solvers and enhancing the solvers with different types of preconditioners. A preconditioner can be a matrix or even another solver. Furthermore, the system matrix does not need to be stored explicitly in memory, but can be available only as a function that is applied to a vector to compute a matrix-vector product (matrix-free). The objective of providing a clean and easy-to-use interface mandates that all these special cases are uniformly realized in the API. The central observation that guides \textsc{Ginkgo}\xspace's design is that the operations and interactions between the solver, the system matrix, and the preconditioner can be represented as the application of \textit{linear operators}: \begin{enumerate} \item The major operation that an iterative solver performs on the system matrix \texttt{A} is the multiplication with a vector (realized as a Matrix-Vector product, or \textsc{MV}\xspace). This operation can be viewed as the application of the induced linear operator $L_A : z \mapsto Az$. In some cases, multiplication with the transpose is also needed, which is yet another application of a linear operator $L_{A^T} : z \mapsto A^Tz$. \item The solver itself solves a system $Ax = b$, which is the application of the linear operator $S_A : b \mapsto A^{-1}b (= x)$. Here, the term ``solver'' is not used to denote a function $f$ that takes $A$ and $b$ as inputs and produces $x$, but instead a function with the system matrix $A$ already fixed (that is, $S_A = f(A\,, \cdot)$). \item The application of the preconditioner $M$, as in $v = M^{-1}u$, can be viewed as the application of the linear operator $P_M : u \mapsto M^{-1}u (=v)$. \end{enumerate} There are several remarks that have to be made regarding the observations above. First, in the context of numerical computations, with finite precision arithmetic, the term ``linear operator'' should be understood loosely. In fact, none of the previous categories strictly satisfy the linearity definition of the linear operator: $L(\alpha x + \beta y) = \alpha L(x) + \beta L(y)$, where $\alpha,\beta$ are scalars and $x,y$ denote vectors. Instead, they are just approximations of the linear operators that satisfy the formula $L(\alpha x + \beta y) = \alpha L(x) + \beta L(y) + E$, where the error term $E = E(L, \alpha, \beta, x, y)$ is the result of one or more of the following effects: \begin{enumerate} \item rounding errors introduced by storing non-representable values in floating-point format; \item rounding errors introduced by finite-precision floating-point arithmetic; \item instability and inaccuracy of the method used to apply the linear operator to a vector; and \item inexact operator application, e.g. only few iterations of an iterative linear solver. \end{enumerate} The data layout and the implementation of any linear operator is internal to that operator, and the interface does not expose implementation details. For example, a direct solver could store its matrix data in factored form, as two triangular factors (e.g.,\ $A=LU$) and implement its application as two triangular solves (with $L$ and $U$). In contrast, an iterative solver could just store the original system matrix, and the entire implementation of the method could be a part of the linear operator application. Nonetheless, both operators can still expose the same public interface. \subsubsection{\class{LinOp}} \label{sec:intro/linop/linop} In coherence with the observations in \Cref{sec:intro/linop/motivation}, the central abstraction in \textsc{Ginkgo}\xspace's design is the abstract class (interface) \class{LinOp}, which represents the mathematical concept of a linear operator. All concrete linear operators (solvers, matrix formats, preconditioners) are instances of \class{LinOp}. Furthermore, this generic operator $L$ exposes a pure virtual method \texttt{apply(b,~x)} that is overridden by a concrete linear operator with an implementation that computes the result $x = L(b)$ with conformal dimensions for $L$, $x$ and $b$, where vectors are interpreted as dense matrices of dimension $n\times 1$. This design enables that a single interface can be leveraged to compute an {\textsc{MV}\xspace} with different matrix formats, the application of distinct types of preconditioners, the solution of linear systems using various solvers, or even the application of a user-defined linear operator. Using the \class{LinOp} abstraction, an iterative solver can be implemented via references to other {\class{LinOp}}s that represent the system matrix and the preconditioner. The solver does not have to be aware of the type of the matrix or the preconditioner --- it is sufficient to know that they are both conformal with the \class{LinOp} interface. This means that the same implementation of the solver can be configured to integrate various preconditioners and matrices. Furthermore, the linear operator abstraction can also be used to compose ``cascaded'' solvers where the preconditioner can be replaced by another, less accurate solver, or even to create matrix-free methods by supplying a specialized operator as the system matrix, without explicitly storing the matrix. \subsubsection{\class{LinOpFactory}} \label{sec:intro/linop/factory} \class{LinOp} exposes a uniform interface to different types of linear algebra operations. A missing piece in the puzzle is how these {\class{LinOp}}s are created in the first place. For example, in order to solve a system with a matrix $A$ represented by the linear operator $L_A$, an operation has to be provided which, given the operator $L_A$, creates a solver operator $S_A$. Similarly, to create a preconditioner $P_A$ for a matrix $A$, an operator that maps $L_A$ to $P_A$ is needed. These are both examples of higher-order (non-linear) functions that map linear operators to other linear operators (in this case $\Sigma : L_A \mapsto S_A$ and $\Phi : L_A \mapsto P_A$). \textsc{Ginkgo}\xspace provides an abstract class \class{LinOpFactory} that represents mappings such as $\Sigma$ and $\Phi$. Concretely, the class \class{LinOpFactory} provides an abstract method \texttt{generate(\class{LinOp})} which, given a linear operator from the domain of the mapping, returns the corresponding \class{LinOp} from its input. The linear operators constructed by using operator factories are usually solvers and preconditioners. For example, in order to construct a BiCGSTAB solver operator that solves a problem with the system matrix $A$, represented by the operator $L_A$, one would first create a BiCGSTAB factory (which implements the \class{LinOpFactory} interface and represents the operator $S$); and then call \texttt{generate} on $S$, passing the operator $L_A$ as input, to obtain a BiCGSTAB operator $S_A$, with the system matrix, $A$. Some factories are designed to be combined with other factories. For instance, to create an iterative refinement solver, which uses CG preconditioned with Jacobi as the inner solver, one would create an iterative refinement factory $S$, and as the inner solver factory, pass a CG factory constructed with a Jacobi factory as the preconditioner factory. Then, when calling the \texttt{generate} method on $S$ with the system matrix represented by a linear operator $L_A$, this linear operator is propagated to the CG and Jacobi factories, to create CG and Jacobi operators with the system matrix $A$. Instead of using \class{LinOpFactory}, an alternative (and more obvious) approach would have been to just use the constructor of \class{LinOp} to provide all the ``component'' linear operators. However, this alternative presents the drawback that the ``type'' of the operator cannot be decoupled from its data. To illustrate this, consider the scenario of a solver $S$ which tackles a linear system using the LU factorization; and then invokes two triangular solvers on the resulting $L$ and $U$ factors. There are multiple algorithms for the solution of the triangular systems, which in \textsc{Ginkgo}\xspace are represented by different linear operators. Thus, the operators to use should somehow be passed as input parameters to the solver $S$. The problem is that they cannot be constructed outside of $S$, since their factors are not known at that point. \class{LinOpFactory} provides an elegant solution to this problem, since instead of a \class{LinOp}, the solver $S$ can be provided with linear operator factories, which are then used to construct the triangular solver operators once the factors $L$ and $U$ are known. \subsubsection{Re-visiting the example} \label{sec:intro/linop/example} After the previous elaboration on \class{LinOp} and \class{LinOpFactory}, it is timely to re-visit the example in \Cref{lst:gko_code}. The objects \texttt{A}, \texttt{b} and \texttt{x} in lines~9--11 are \class{LinOp} objects that store their data as ``matrices'' in CSR (compressed sparse row~\cite{saad_iter_methods}) and dense matrix formats, respectively. Calling the method \texttt{apply} on these objects has the effect of calculating the matrix-vector product using that data. The \texttt{solver\_factory} object (defined in lines~13--21), is actually a compound \class{LinOpFactory} used to create a solver with the CG method. In this particular case, the CG solver is preconditioned with a block-Jacobi method (specified by providing a block-Jacobi factory as the preconditioner factory to the CG factory). All the work actually occurs in line~23. First, the CG factory \texttt{solver\_factory} is used to generate a linear operator object representing the CG solver by calling the \texttt{generate} method. Since \texttt{solver\_factory} has a block-Jacobi factory set as the preconditioner factory, the \texttt{solver\_factory}'s \texttt{generate} method invokes \texttt{generate} on the block-Jacobi factory; and the system matrix \texttt{A} is passed as input argument, which has the effect of generating a block-Jacobi preconditioner operator for that matrix. Then, the resulting linear operator is immediately used to solve the system by applying it on \texttt{b}. This will have the effect of iterating the CG solver preconditioned with the generated block-Jacobi preconditioner operator on the system matrix \texttt{A}, thus solving the system. \subsubsection{Linear operator algebra} \label{sec:intro/linop/algebra} Traditional linear algebra libraries, such as BLAS~\cite{blas} and LAPACK~\cite{laug}, use vectors and matrices as basic objects, and provide operations such as matrix products and the solution of linear systems on these objects as functions. In contrast, \textsc{Ginkgo}\xspace achieves composability and extensibility (cf.\ \Cref{sec:extensibility}) by treating linear operations as basic objects, and providing methods to manipulate these operations in order to express the desired complex operation. This is the principle guiding the design of \textsc{Ginkgo}\xspace, which motivates the title of this paper: while other libraries can be characterized as ``linear algebra libraries'', \textsc{Ginkgo}\xspace's algebra is performed on linear operators, making it a ``linear operator algebra library''. While the current focus of \textsc{Ginkgo}\xspace is on the iterative solution of sparse linear systems, other types of operations on linear operators also fit into \textsc{Ginkgo}\xspace's concept of \class{LinOp} and \class{LinOpFactory}. For example, a matrix factorization $A = UV$ can be viewed as a linear operator factory $\Psi : L_A \mapsto F_{U, V}$, where the linear operator $F_{U, V} : b \mapsto UVb$ stores the two factors $U$ and $V$, and provides public methods to access the factors. \subsection{Executors for transparent kernel execution on different devices} \label{sec:intro/executor} An appealing feature of \textsc{Ginkgo}\xspace is the ability to run code on a variety of device architectures transparently. In order to accommodate this functionality, \textsc{Ginkgo}\xspace introduces the \class{Executor} class at its core. In consequence, the first task a user has to do when using \textsc{Ginkgo}\xspace is to create an \class{Executor}. The \class{Executor} specifies the memory location and the execution space of the linear algebra objects and represents computational capabilities of distinct devices. Currently, four executor types are provided: \begin{itemize} \item \class{CudaExecutor} for CUDA-enabled GPUs; \item \class{HipExecutor} for HIP-enabled GPUs; \item \class{OmpExecutor} for OpenMP execution on multicore CPUs; and \item \class{ReferenceExecutor} for sequential execution on CPUs (used for correctness checking). \end{itemize} Each of these executors implements methods for allocating/deallocating memory on the device targeted by that executor, copying data between executors, running operations, and synchronizing all operations launched on the executor. \Cref{lst:gko_code} illustrated the use of \class{Executor}. Combined with the \texttt{gko::clone(Executor, Object)} utility function, the \class{Executor} class makes it straight-forward to move all data and operations to a host OpenMP executor, as in \Cref{lst:gko_matrix_copy_example}. That code creates an \texttt{gko::OmpExecutor} object for execution on the CPU (line~1). Next, a CUDA executor representing a GPU device with ID 0 is created (line~2); and the system matrix data is read from a file and allocated on the \texttt{gko::CudaExecutor}'s device memory (line~4). Finally, the function \func{gko::clone} creates a copy of \texttt{A} on the \texttt{gko::OmpExecutor}, that is, in the platform's main memory (line~6). \begin{center} \begin{minipage}{\linewidth} \begin{lstlisting}[caption={Copy of a matrix in CSR format from a CUDA device to a CPU through the \class{OmpExecutor}.}, label={lst:gko_matrix_copy_example}] auto omp = gko::OmpExecutor::create(); auto cuda = gko::CudaExecutor::create(0, omp); // As in previous example, A is allocated on a CUDA device auto A = gko::read<gko::matrix::Csr<>>("data/A.mtx", cuda); // copy A to an OpenMP-capable device auto A_copy = gko::clone(omp, A); // All subsequent operations triggered from A_copy will use executor omp \end{lstlisting} \end{minipage} \end{center} \begin{figure}[t] \begin{center} \includegraphics[width=0.8\textwidth]{figures/code_distribution_develop_19052020.pdf} \end{center} \caption{Code distribution among different modules in \textsc{Ginkgo}\xspace develop version 1.1.1. The entire code base in this release is 8.0~MB (represented by the entire figure). The top level rectangles represent different top-level directories; these are: the \textit{core} (1.4~MB) module, examples (1.2~MB), the \textit{HIP} module (928~KB), the \textit{CUDA} module (920~KB), the \textit{reference} module (924~KB), the include directory with the core module's public headers (852~KB), the \textit{omp} module (612~KB), the \textit{common} directory which contains shared HIP and CUDA kernels (388~KB) and the benchmark (244~KB) and doc directories (212~KB each). The first rectangles in the \textit{core}, \textit{CUDA}, \textit{HIP}, \textit{omp} and \textit{reference} modules represent unit tests for these modules, which amount to 644, 396, 400, 308 and 612~KB, respectively. } \label{fig:code-distribution} \end{figure} In order to allow a transparent execution of operations on multiple executors, the kernels in \textsc{Ginkgo}\xspace have separate implementations for each executor type, organized into several modules, see Figure~\ref{fig:ginkgooverview} and Figure~\ref{fig:code-distribution} for the code distribution, respectively. The \textit{core} module contains all class definitions and non-performance critical utility functions that do not depend on an executor. In addition, there is a module for each executor, which contains the kernels and utilities specific for that executor. Each module is compiled as a separate shared library, which allows to mix-and-match modules from different sources. This paves the road for hardware vendors to provide their own proprietary modules: they only have to optimize their module, make it available in binary form, and users can then link it with \textsc{Ginkgo}\xspace. We note that the similarities between HIP and CUDA allow the usage of \textit{common} template kernels that are identical in kernel design but are compiled with architecture-specific parameters to either the \class{HipExecutor} or the \class{CudaExecutor}. This strategy reduces code replication and favors productivity and maintainability. \textsc{Ginkgo}\xspace contains dummy kernel implementations of all modules that throw an exception whenever they are called. This allows a user to deactivate certain modules if no hardware support is available or to reduce compilation time. In general, during the configuration step, \textsc{Ginkgo}\xspace's automatic architecture detection activates all modules for which hardware support has been detected. The \class{Executor} design allows switching the target device where the solver in \Cref{lst:gko_code} is executed through a one-line change that replaces the executor used for it. In addition, if one of the arguments for the \texttt{apply} method is not on the same executor as the operator being applied, the library will temporarily move that argument to the correct executor before performing the operation, and return it back once the operation is complete. Even though this is done automatically, the user may attain higher performance by explicitly moving the arguments in order to avoid unnecessary copies (in the case, for example, of repeated kernel invocation). \subsection{Memory management} \label{sec:intro/memory-management} Libraries have to specify several key memory management aspects: memory allocation, data movement and copy, and memory deallocation. In contrast to traditional libraries such as BLAS and LAPACK, which leave memory management to the user, \textsc{Ginkgo}\xspace allocates/deallocates its memory automatically, using the C++ ``Resource Acquisition Is Initialization'' (RAII\footnote{\url{https://en.cppreference.com/w/cpp/language/raii}}) concept combined with the native allocation/deallocation functions of the executor (cf.\ \Cref{sec:intro/executor}). Alternatively, to eliminate unnecessary allocations and data copies, \textsc{Ginkgo}\xspace's matrix formats can be configured to use raw data already allocated and managed by the application by using \textit{Array views}. A more difficult problem is to realize data movement and copies between different entities of the application (e.g.,\ functions and other objects). The memory management has to not only protect against memory leaks or invalid memory deallocations, but also avoid unnecessary data copies. The problem is usually solved by specifying a well-defined owner for each object, responsible for deallocating the object once it is no longer needed. For simple C++ types, this behavior is enabled via the use of parameter qualifiers: Parameters are passed \textit{by-value} and thus copied unless explicitly declared as references (which is when they are passed \textit{by-reference} without copying). The C++11 standard added \textit{move semantics} as a third alternative where an input parameter that is either explicitly (using \texttt{std::move}) or implicitly (by not having a name) designated a temporary value may move its internal data into the function without copying, leaving it in a valid but unspecified state. However, trying to pass polymorphic objects \textit{by-value} would lead to object slicing~\cite{object-slicing}. In \textsc{Ginkgo}\xspace, we avoid these issues with polymorphic types like \texttt{Executor} and \texttt{LinOp} by always passing and returning them as pointers. To this goal, we use the smart pointer types \texttt{std::unique\_ptr} and \texttt{std::shared\_ptr}, which were added in the C++11 standard. They provide safe resource management using RAII while still providing (almost) the same semantics as raw pointers. \textsc{Ginkgo}\xspace uses pointers for parameters and return types in three different contexts, where we say that a function parameter is used in a non-owning context if the object will only be used during the function call, and in an owning context if the object needs to be accessible even after the function call completed. Figure~\ref{fig:memory-management} shows the different ways to pass a polymorphic object as a parameter in \textsc{Ginkgo}\xspace. Functions that only need to modify a polymorphic object in a non-owning context take this object as a raw pointer parameter \texttt{T*}. To simplify the interaction with smart pointers, \textsc{Ginkgo}\xspace provides the overloaded \texttt{gko::lend} function which returns the underlying raw pointer for both smart and raw pointers. This decorator function allows for a concise and uniform way to pass polymorphic objects to functions without ownership transfer. ``Lending'' an object can be compared with normal \textit{by-reference} semantics for value types. When \textit{by-value} semantics are necessary, we can explicitly pass a copy using \texttt{gko::lend(gko::clone($\cdot$))}. Functions that need to receive a polymorphic object in an owning context take this object as a \texttt{std::shared\_ptr<T>}. We can pass an object to such a parameter in three ways: \texttt{gko::clone} creates a copy of the current object to be passed to the function (\textit{by-value}), \texttt{gko::give} specifies that the object will not be used afterwards and can thus be moved into the function (\textit{move semantics}) and \texttt{gko::share} specifies that the ownership should be shared with the function (\textit{by-reference}). Note that the gko::share annotation can usually be left out, since all owning smart pointers in C++ already provide conversions to \textit{std::shared\_ptr}. Functions that create new instances of a polymorphic object return a \texttt{std::unique\_ptr<T>}, while access to already existing objects is provided with \texttt{std::shared\_ptr<const T>} to allow the objects to be used in both owning and non-owning contexts. The overloaded decorator functions \texttt{gko::clone}, \texttt{gko::lend}, \texttt{gko::give} and \texttt{gko::share} provide a uniform interface for all types of smart and raw pointers, while still ensuring type safety. For example, calling \texttt{gko::give} with a non-owning pointer will fail to compile and output an appropriate error message. \begin{figure}[t] \begin{center} \includegraphics[width=0.8\textwidth]{figures/memory_management-crop.pdf} \end{center} \caption{Different ways of passing polymorphic objects as parameters in \textsc{Ginkgo}\xspace:\\\texttt{gko::clone}, \texttt{gko::lend}, \texttt{gko::give}, \texttt{gko::share} together with the lifetime of the passed object.} \label{fig:memory-management} \end{figure} \subsection{Control of the iteration process} \label{sec:intro/criteria} Virtually all iterative methods include the concept of a ``stopping criterion'' that evaluates whether the current approximation to the solution of the linear systems is accurate enough. To facilitate controlling the iteration process, \textsc{Ginkgo}\xspace provides a collection of stopping criteria. All of them are implementations of the base \class{Criterion} class, which specifies what type of information can be passed to the stopping criterion. A concrete criterion provides an implementation of the \func{check()} method that verifies if its condition has been met and, therefore, the iteration process has to be stopped. The stopping criteria are initially generated from criterion factories (created by the user) by passing the system matrix, right-hand side, and an initial guess. In addition, during the iteration process, information can be updated when calling the \func{check()} function with the new iteration count, residual, solution or residual norm. Currently, three basic stopping criteria are provided in \textsc{Ginkgo}\xspace: \begin{itemize} \item The \class{Time} criterion, which automatically stops the iteration process after a certain amount of time; \item the \class{Iteration} criterion, which stops the iteration process once a certain iteration count has been reached; and \item the \class{ResidualNormReduction} criterion, which stops the iteration process once the initial relative residual norm has been reduced by the certain specified amount. \end{itemize} Additionally, \textsc{Ginkgo}\xspace provides a \class{Combined} criterion, which can be used to combine multiple criteria together through a logical--\textit{OR} operation (\texttt{|}), so that the first subcriterion that is fulfilled stops the iteration process. This is illustrated in lines 16--19 of \Cref{lst:gko_code}. This design implies some stopping criteria may detain the iteration process before ``convergence'' is reached, in particular the \class{Time} and \class{Iteration} criteria. \textsc{Ginkgo}\xspace provides a \class{stopping\_status} class, which can be inspected to find out which criterion stopped the iteration process. The \class{Criterion} class hierarchy is designed to avoid negative impact on the performance, and may even improve it. For example, in case an iterative method is applied with multiple right-hand side vectors, the \class{stopping\_status} is evaluated for each right-hand side individually, skipping vector updates in subsequent iterations for those right-hand side vectors where convergence has been achieved. Also, all operations required to control the iteration process can be handled inside the \class{Criterion} classes. The consequence is that, for most solvers, the residual norm and related operations are computed only when using the \class{ResidualNormReduction} criterion. Therefore, the user can combine a solver with a simple stopping criterion to make it more lightweight or choose a more precise but more expensive stopping criterion. In summary, \textsc{Ginkgo}\xspace's design of stopping criteria tries to honor the C++ philosophy of ``only paying for what you use''. \subsection{Event logging} \label{sec:intro/logging} Another utility that is provided to users in \textsc{Ginkgo}\xspace is the logging of events with the purpose to record information about \textsc{Ginkgo}\xspace{}'s execution. This covers many aspects of the library, such as memory allocation, executor events, \class{LinOp} events, stopping criterion events, etc. For ease of use, the event logging tools provide different forms of output formats, and allow the usage of multiple loggers at once. As with the rest of \textsc{Ginkgo}\xspace, this tool is designed to be controllable, extensible, and as lightweight as possible. To offer support for all those capacities, the Logger infrastructure follows the visitor and observer design patterns~\cite{gamma1994design}. This design implies a minimal impact of logging on the logged classes and allows to accommodate any logger. The following four loggers are currently provided in \textsc{Ginkgo}\xspace: \begin{itemize} \item the \class{Stream} logger, which logs the events to a stream (e.g.,\ file, screen, etc.); \item the \class{Record} logger, which stores the events in a structure which has a history of all received events that the user can retrieve at any moment; \item the \class{Convergence} logger is a simple mechanism that stores the relative residual norm and number of iterations of the solver on convergence; and \item the \class{PAPI SDE} logger uses the PAPI Software Defined Events backend~\cite{papisde} in order to enable access to Ginkgo's internal information through the PAPI interface and tools. \end{itemize} Almost every class in \textsc{Ginkgo}\xspace possesses multiple corresponding logging events. The logged classes are: \class{Executor}, \class{Operation}, \class{PolymorphicObject}, \class{LinOp}, \class{LinOpFactory} and \class{Criterion}. The user has the freedom to choose whether he/she wants to log all events or select only some of them. When an event is not selected for logging by the user, as a result of the implementation of the logging facilities, the event is not propagated and generates a ``no-op''. \section{Using \textsc{Ginkgo}\xspace as a library} \label{sec:solvers} \subsection{Solver} \label{sec:solver} Currently, \textsc{Ginkgo}\xspace provides a list of Krylov solvers (BICG, BiCGSTAB, CG, CGS, FCG, GMRES) for the iterative solution of sparse linear systems, fixed-point methods, and direct solvers for sparse triangular systems such as those that appear in incomplete factorization preconditioning. In order to generate a solver, a solver factory (of type \class{LinOpFactory}) must first be created, where solver control parameters, such as the stopping criterion, are set. The concrete solver is then generated by binding the system matrix to the solver factory. This allows to generate multiple solvers for distinct problems with the same solver settings, e.g. in time-stepping methods. Except for Iterative Refinement~(IR), where the internal solver can be chosen, all iterative solvers have the option to attach a preconditioner of the class \class{LinOp}. Furthermore, all solvers implement the abstract \class{LinOp} interface, which not only simplifies the solver usage, but also allows to use the same notation for calling solvers, preconditioners, SpMV, etc. This allows the user to compose iterative solvers by choosing another iterative solver as a preconditioner. \subsection{Preconditioner} \label{sec:preconditioner} \textsc{Ginkgo}\xspace allows any solver to be used as a preconditioner, i.e., to cascade Krylov solvers. Additionally, \textsc{Ginkgo}\xspace features diagonal scaling preconditioners (block-Jacobi) as well as incomplete factorization (ILU-type) preconditioners. As any of the other solvers, preconditioners are generated through a \class{LinOpFactory} and implement the abstract class \class{LinOp}. The block-Jacobi preconditioners can switch between a ``standard'' mode and an ``adaptive precision'' mode~\cite{anzt2019adaptive}. In the latter case, the memory precision is decoupled from the arithmetic precision, and the storage format for each inverted diagonal block is optimized to preserve the numerical properties while reducing the memory access cost~\cite{tomsadaptive}. The ILU-based preconditioners can be generated by interfacing vendor libraries, via the ParILU algorithm~\cite{chow2015asynchronous}, or via a variant known as the ParILUT algorithm~\cite{anzt2018parilut} that dynamically adapts the sparsity pattern of the incomplete factorization to the problem characteristics~\cite{anzt2019parilut}. For the application of an ILU-type preconditioner, \textsc{Ginkgo}\xspace leverages two distinct solvers: one for the lower triangular matrix $L$ and one for the upper triangular matrix $U$. The default choices are the direct lower and upper triangular solvers but the user can change this to use iterative triangular solves. \iffalse In~\Cref{lst:ilu-preconditioner-default}, we create a BiCGSTAB solver with a default ILU preconditioner. Only a single line of code (line~20) is needed to enhance the BiCGSTAB solver with an ILU preconditioner. When the solver is generated in line~22 with the system matrix $A$, the ILU preconditioner (by default, with the ILU(0) factorization) is also generated. \begin{center} \begin{minipage}{\linewidth} \begin{lstlisting}[caption={An example of creating a CG solver with ILU preconditioning with default parameters.}, label=lst:ilu-preconditioner-default] ... // Create solver factory with ILU preconditioning auto solver_factory = gko::solver::Bicgstab<>::build() .with_criteria( gko::stop::ResidualNormReduction<>::build() .with_reduction_factor(1e-15) .on(exec)) .with_preconditioner(gko::preconditioner::Ilu<>::build().on(exec)) .on(exec); // Generate the solver from the solver factory. auto solver = solver_factory->generate(A); // Solve the linear system. solver->apply(gko::lend(b), gko::lend(x)); ... } \end{lstlisting} \end{minipage} \end{center} \unsure[inline]{I would try to make the code in Listing 3 as similar as possible to that of Listing 1.\\ An alternative is to drop the Listing completely. If the only purpose is to illustrate how to integrate an ILU-type preconditioner, you can refer to Listing 1 and explain that there is only one line to be changed there. That is the only relevant difference I find between the two.} \unsure[inline]{PN: I agree that this Listing can be removed, moreover because we already have a preconditioner in Listing 1} \fi In \Cref{lst:ilu-preconditioner-custom} we illustrate how an ILU preconditioner can be customized in almost all aspects. In this case, we select a CGS solver for solving the upper triangular system by first creating the factory in lines~18--23 and then attaching it to the preconditioner factory in lines~26--28. Instead of relying on the internal generation of the incomplete factors, we generate them ourselves in lines~13--15. Afterwards, we generate the ILU preconditioner in line~29. In the end, we employ the now already generated preconditioner in line~40 with a BiCGSTAB solver. \begin{center} \begin{minipage}{\linewidth} \begin{lstlisting}[caption={An example of creating a CG solver with ILU preconditioning with an iterative solver for the upper triangular factor.}, label=lst:ilu-preconditioner-custom] #include <iostream> #include <ginkgo/ginkgo.hpp> int main() { // Instantiate a CUDA executor auto cuda = gko::CudaExecutor::create(0, gko::OmpExecutor::create()); // Read data auto A = gko::read<gko::matrix::Csr<>>(std::cin, cuda); auto b = gko::read<gko::matrix::Dense<>>(std::cin, cuda); auto x = gko::read<gko::matrix::Dense<>>(std::cin, cuda); // Generate ILU(0) factorization auto ilu_factorization = gko::factorization::ParIlu<>::build().on(cuda) ->generate(A); // Create a custom upper solver factory auto upper_solver_factory = gko::solver::Cgs<>::build() .with_criteria( gko::stop::ResidualNormReduction<>::build() .with_reduction_factor(1e-5) .on(cuda)) .on(cuda); // Create an ILU preconditioner factory with a CGS upper solver auto ilu_factory = gko::preconditioner::Ilu<gko::solver::LowerTrs<>, gko::solver::Cgs<>>::build() .with_u_solver_factory(gko::share(upper_solver_factory)) .on(cuda); auto ilu_prec = ilu_factory->generate(gko::share(ilu_factorization)); // Create the solver factory with ILU preconditioning auto solver_factory = gko::solver::Bicgstab<>::build() .with_criteria( gko::stop::ResidualNormReduction<>::build() .with_reduction_factor(1e-15) .on(cuda), .with_generated_preconditioner(gko::share(ilu_prec)) .on(cuda); // Create the solver from the factory and solve the system solver_factory->generate(gko::give(A))->apply(gko::lend(b), gko::lend(x)); // Write result write(std::cout, gko::lend(x)); } \end{lstlisting} \end{minipage} \end{center} \section{Using \textsc{Ginkgo}\xspace as a framework} \label{sec:extensibility} As described in \Cref{sec:design}, \textsc{Ginkgo}\xspace provides a set of generic linear operators, including various general matrix formats, popular solvers, and simple preconditioners. However, sparse linear algebra often includes problem-specific knowledge. This means that, in general, a highly-optimized implementation of a generic algorithm will still be outperformed by a carefully crafted custom algorithm employing application-specific knowledge. To tackle this, \textsc{Ginkgo}\xspace promotes extensibility so that users can develop their own implementation for specific functionality without needing to modify \textsc{Ginkgo}\xspace's code (or recompile it). Domain-specific extensions can be elaborated as part of the application that uses them, or even bundled together to create an ecosystem around \textsc{Ginkgo}\xspace. Currently, this is possible for all linear operators, stopping criteria, loggers, and corresponding factories. Adding custom data types also requires only minor changes in a single header file and a recompilation. \iffalse While header file changes can be removed in the future by extending the configuration options of the build system, \textit{compile-time polymorphism} prevents the removal of the recompilation requirement. \fi The only extension that requires more significant efforts is the addition of new architectures and executors. This involves modifying a key portion of \textsc{Ginkgo}\xspace as it requires the addition of specialized implementations of all kernels for the new architecture and executor. In contrast to the previous section, where \textsc{Ginkgo}\xspace is used as a library and the application is built around it, this section describes how \textsc{Ginkgo}\xspace can be used as a framework in which the application inserts its own custom components to work in harmony with \textsc{Ginkgo}\xspace's built-in technology. \subsection{Utilities supporting extensibility} \label{sec:extensibility/utils} \textsc{Ginkgo}\xspace's facilities for memory management (e.g.,\ automatic allocation and deallocation, or transparent copies between different executors) are designed to simplify its use as a library. As a result, the implementation burden is then shifted to the developers of these facilities, which are either the developers of \textsc{Ginkgo}\xspace or, in case the application using \textsc{Ginkgo}\xspace needs custom extensions, the developers of that application. To alleviate the burden and help developers focus on their algorithms, \textsc{Ginkgo}\xspace provides basic building blocks that handle memory management and the implementation of interfaces supported by the component being developed. \subsubsection{\class{Array}} \label{sec:extensibility/utils/array} Most components in \textsc{Ginkgo}\xspace have some sort of associated data, which should be stored together with its executor. When copying a component, its data should also be copied, possibly to a different executor. When the object is destroyed, the data should be deallocated with it. Doing this manually for every class introduces a large amount of boilerplate code, which increases the effort of developing new components, and can lead to subtle memory leaks. In addition, different devices have different APIs for memory management, so a separate version would have to be written for each executor. To handle these issues in a single point in code, while removing some of the burden from the developer, \textsc{Ginkgo}\xspace provides the \class{Array} class. This is a container which encapsulates fixed-sized arrays stored on a specific \class{Executor}. It supports copying between executors and moving to another executor. In addition, it leverages the RAII idiom\footnote{\url{https://en.cppreference.com/w/cpp/language/raii}} to automatically deallocate itself from the memory when it is no longer needed. \begin{center} \begin{minipage}{\linewidth} \begin{lstlisting}[caption={Usage examples of the \class{Array} class.}, label={lst:gko_array_example}] auto omp = gko::OmpExecutor::create(); auto cuda = gko::CudaExecutor::create(0, omp); using arr = gko::Array<int>; arr x(cuda, {1, 2, 3, 4}); // an array of integers on the GPU arr cpu_x(omp, x); // a copy of x on the CPU arr z(omp, 10); // an uninitialized array of 10 integers on the CPU z = x; // copy x from the GPU to z (on the CPU) z.set_executor(cuda); // move z to the GPU auto d[] = {1, 2, 3, 4}; auto d_arr = arr::view(omp, 4, d); // use existing data auto size = x.get_num_elems(); // get the size of x auto x_data = x.get_data(); // get raw pointer to x's data // Note that x_data[0] would cause a segmentation fault if called from the CPU. // Memory used for x, cpu_x and z is automatically deallocated. // d_arr does not try to deallocate the memory. \end{lstlisting} \end{minipage} \end{center} \Cref{lst:gko_array_example} shows some common usage examples of arrays. Lines~5--7 display several ways of initializing the \class{Array}: using an initializer list, copying from an existing array (from a different executor), or allocating a specified amount of uninitialized memory. The last constructor will only allocate the memory, without calling the constructors on individual elements, which remains the responsibility of the caller. While this is not the usual behavior in C++, properly parallelizing the construction of the elements in multi- and manycore systems is a non-trivial task. Nevertheless, the elements of the arrays used in \textsc{Ginkgo}\xspace are mostly \textit{trivial types}, so there is usually no need to call the constructor in the first place. Lines~9--10 shown in \Cref{lst:gko_array_example} illustrate how the assignment operator can be used to copy arrays and how the executor of the array can be changed via the \func{set\_executor} method. The combination of the assignment operator and the RAII idiom usually means that classes using arrays as building blocks do not require user-defined destructors or assignment operators, since the ones synthesized by the compiler behave as expected (in particular, this is true for all of \textsc{Ginkgo}\xspace's linear operators, stopping criteria, and loggers). Lines~12--13 show that \class{Array} can also be used to store data in a non-owning fashion in a \textit{view}, i.e., the data will not be de-allocated when the \class{Array} is destroyed. This feature is particularly useful when using \textsc{Ginkgo}\xspace to operate on data owned by the application or another library. Finally, raw data stored in the \class{Array} can be retrieved as shown in Lines~15--17. The \func{get\_data} method will return a raw pointer on the device where the array is allocated, so trying to dereference the pointer from another device will result in a runtime error. \subsubsection{Introduction to mixins} \label{sec:extensibility/utils/mixins} Most components in \textsc{Ginkgo}\xspace expose a rich collection of utility functions, usually related to conversion, object creation, and memory movement. These utilities are usually trivial to implement, and do not differ much between components. However, they still require that the developer implements them, which steers the focus away from the actual algorithm development. \textsc{Ginkgo}\xspace addresses this issue by using \textit{mixins}~\cite{mixin-pattern}. Since those are neither well-known by the community\footnote{The only mixin known to the authors is \class{std::enable\_shared\_from\_this} from the C++ standard library.} nor well-supported in languages commonly used in high performance computing (e.g.,\ C, C++, Fortran), this subsection provides a simple example where mixins are leveraged to reduce boilerplate code. The remaining parts of \Cref{sec:extensibility} introduce mixins provided by \textsc{Ginkgo}\xspace when extending certain aspects of its ecosystem. As a toy example, assume there is an interface \class{Clonable}, which consists of a single method \func{clone} exposed to create a clone of an object. This method is useful if the object that should be cloned is only available through its base class (i.e.,\ the static type of the object differs from its dynamic type). A common example where this is used is the prototype design pattern~\cite{gof-design-patterns}. Obviously, the implementation of the \func{clone} method should just create a new object using the copy constructor. \Cref{lst:clonable-no-mixin} is an example implementation of such a hierarchy consisting of three classes \class{A}, \class{B} and \class{C}. Classes \class{A} and \class{B} directly implement \class{Clonable}, while \class{C} indirectly implements it through \class{B}. \begin{center} \begin{minipage}{\linewidth \begin{lstlisting}[caption={An example hierarchy implementing clonable without the use of mixins.}, label=lst:clonable-no-mixin] struct Clonable { virtual ~Clonable() = default; virtual std::unique_ptr<Clonable> clone() const = 0; }; struct A : Clonable { std::unique_ptr<Clonable> clone() const override { return std::unique_ptr<Clonable>(new A{*this}); } }; struct B : Clonable { std::unique_ptr<Clonable> clone() const override { return std::unique_ptr<Clonable>(new B{*this}); } }; struct C : B { std::unique_ptr<Clonable> clone() const override { return std::unique_ptr<Clonable>(new C{*this}); } }; \end{lstlisting} \end{minipage} \end{center} The implementation of the \func{clone} method is almost identical in all classes, so it represents a good candidate for extraction into a mixin. Mixins are not supported directly in C++, so their implementation is handled via inheritance, usually coupled with the Curiously Recurring Template Pattern (CRTP)~\cite{crtp-reference}. Nevertheless, using inheritance in this context should not be viewed as establishing a parent--child relationship between the mixin and the class inheriting from it, but instead as the class ``including'' the generic implementations provided by the mixin. \Cref{lst:clonable-with-mixin} shows the implementation of the same hierarchy using the \class{EnableCloning} mixin designed to provide a generic implementation of the \func{clone} method. The mixin relies on the knowledge of the type of the implementer to call the appropriate constructor, which is provided as a template parameter. The base interface implemented by the mixin is also passed as a template parameter to allow indirect implementations, as is the case in class \class{C}. Once the mixin is set up, any class that wishes to implement \class{Clonable} can just include the mixin to automatically get a default implementation of the interface, making the class cleaner, and removing the burden of writing boilerplate code. \begin{center} \begin{minipage}{\linewidth \begin{lstlisting}[caption={An example hierarchy implementing clonable using the \class{EnableCloning} mixin.}, label=lst:clonable-with-mixin] struct Clonable { virtual ~Clonable() = default; virtual std::unique_ptr<Clonable> clone() const = 0; }; template <typename Implementer, typename Base = Clonable> struct EnableCloning : Base { std::unique_ptr<Clonable> clone() const override { return std::unique_ptr<Clonable>( new Implementer{*static_cast<const Implementer*>(this)}); } }; struct A : EnableCloning<A> {}; struct B : EnableCloning<B> {}; struct C : EnableCloning<C, B> {}; \end{lstlisting} \end{minipage} \end{center} \textsc{Ginkgo}\xspace uses mixins to provide default implementations, or parts of implementations of polymorphic objects, linear operators, various factories, as well as a few of other utility methods. To better distinguish mixins from regular classes, mixin names begin with the ``\class{Enable}'' prefix. \subsection{Creating new linear operators} \label{sec:extensibility/linop} The matrix structure is one of the most common types of domain-specific information in sparse linear algebra. For example, the discretization of the 1D Poisson's differential equation with a 3-point stencil results in a tridiagonal matrix with a value $2$ for all diagonal entries and $-1$ in the neighboring diagonals. This special structure enables designing a matrix format which only needs to store the two values on and below/above the diagonal. Such compact matrix formats require far less memory than general ones, which directly translates into performance gains in the \textsc{SpMV}\xspace computation. We adopt the example of the stencil matrix to demonstrate how to implement a custom matrix format. The code structure is shown in \Cref{lst:custom-matrix-format}. The actual implementations of the OpenMP, CUDA, and reference kernels are not shown here for brevity as they do not use any important features of \textsc{Ginkgo}\xspace. A full implementation is available in \textsc{Ginkgo}\xspace's \texttt{custom-matrix-format}~example, which is included in \textsc{Ginkgo}\xspace's source distribution. Line~1 includes the \class{EnableLinOp} mixin, which implements the entire \class{LinOp} interface except the two \func{apply\_impl} methods. These methods are called inside the default implementation of the \func{apply} method to perform the actual application of the linear operator. The default implementation of \func{apply} contains additional functionalities (executor normalization, argument size checking, logging hooks, etc.). Thus, by using the two-stage design with \func{apply} and \func{apply\_impl}, the implementers of matrix formats do not have to worry about these details. Line~2 includes the \class{EnableCreateMethod} mixin, which provides a default implementation of the static \func{create} method. The default implementation will forward all the arguments to the \class{StencilMatrix}' constructor, allocate and construct the matrix using the \func{new} operator, and return a unique pointer (\class{std::unique\_ptr}) to the constructed object. The constructor itself is defined in lines~4--8. Its parameters are the executor where the matrix data should be located and operations performed, the size of the stencil, and the three coefficients of the stencil. The executor and the size are handled by \class{EnableLinOp}, and the coefficients are stored in an \class{Array} (defined in line~55) located on the executor used by the matrix. Linear operators provide two variants of the \func{apply} method. The ``simple'' version performs the operation $x = Ab$ and the ``advanced'' version for $x = \alpha Ab + \beta x$. Both of them are often used in linear algebra, and can be expressed in terms of each other: A ``simple'' application is just an ``advanced'' one with $\alpha = 1$ and $\beta = 0$. The ``advanced'' application can be expressed by combining $x$ and the result of ``simple'' application using the \textsc{scal} and \textsc{axpy} BLAS routines (called \func{scale} and \func{add\_scaled} in \textsc{Ginkgo}\xspace). In general, specialized versions result in superior performance. Thus, \textsc{Ginkgo}\xspace provides both of them separately. However, for the sake of brevity, this example implements the ``advanced'' version in terms of the ``simple'' one (lines~14--42). The remainder of the code (lines~15--57) contains the implementation structure of the ``simple'' application. The input parameters contain the input vector \class{b} and the vector \class{x} where the solution will be stored. Each input and solution vector is represented by one column of a linear operator. To accommodate future extensions (e.g.,\ sparse matrix--sparse vector multiplication), both \class{x} and \class{b} are general linear operators. However, the only type supported by this example (and all of \textsc{Ginkgo}\xspace's built-in operators) is \class{matrix::Dense}. Downcasting these vectors to \class{matrix::Dense} is realized in lines~15--16 using the \func{gko::as} utility, which throws an exception if one of them is not in fact a dense matrix. The implementation of the \func{apply} operation depends on the hardware architecture. The Reference version uses a simple sequential CPU implementation; the OpenMP version relies on a parallel implementation based on OpenMP; and the CUDA and HIP versions launch a CUDA kernel and a HIP kernel, respectively. To support all four implementations, \textsc{Ginkgo}\xspace defines the \class{Operation} interface. An object that implements this interface is passed to the executor's \func{run} method, which will select the appropriate implementation depending on the executor (lines~40--41). Thus, \class{StencilMatrix} has to define a class (called \class{stencil\_operation} in this example, lines~18--39) which implements the \class{Operation} interface and encapsulates the four implementations. The implementations are placed into the four overloads of the \func{run} method: the reference version in lines~23--25; the OpenMP version in lines~26--28; the CUDA version in lines~29--31; and the HIP version in lines~32--34. References to the required data also have to be passed to \class{stencil\_operation} so that the implementation can access it. The new matrix format can be used instead of the CSR format in the example in \Cref{lst:gko_code} by changing the definition of \class{A} in line~9 as shown in line~59 of \Cref{lst:custom-matrix-format}, and placing the definition of $A$ after the definition of \class{b}. In addition, lines~14--15 defining the preconditioner have to be removed, since the block-Jacobi preconditioning requires additional functionalities of the matrix format.\footnote{\class{StencilMatrix} would have to define conversion to \class{matrix::Csr} for block-Jacobi preconditioning to work.} Matrix formats are not the only linear operators that can be extended. A similar approach can be used to define new solvers and preconditioners. \begin{center} \begin{minipage}{\linewidth} \begin{lstlisting}[caption={Example implementation of a user-defined matrix format specialized for 3-point stencil matrices.}, label=lst:custom-matrix-format] class StencilMatrix : public gko::EnableLinOp<StencilMatrix>, public gko::EnableCreateMethod<StencilMatrix> { public: StencilMatrix(std::shared_ptr<const gko::Executor> exec, gko::size_type size = 0, double left = -1.0, double center = 2.0, double right = -1.0) : gko::EnableLinOp<StencilMatrix>(exec, gko::dim<2>{size}), coefficients(exec, {left, center, right}) {} protected: using vec = gko::matrix::Dense<>; using coef_type = gko::Array<double>; void apply_impl(const gko::LinOp *b, gko::LinOp *x) const override { auto dense_b = gko::as<vec>(b); auto dense_x = gko::as<vec>(x); struct stencil_operation : gko::Operation { stencil_operation(const coef_type &coefficients, const vec *b, vec *x) : coefficients{coefficients}, b{b}, x{x} {} void run(std::shared_ptr<const gko::ReferenceExecutor>) const override { // Reference kernel implementation } void run(std::shared_ptr<const gko::OmpExecutor>) const override { // OpenMP kernel implementation } void run(std::shared_ptr<const gko::CudaExecutor>) const override { // CUDA kernel implementation } void run(std::shared_ptr<const gko::HipExecutor>) const override { // HIP kernel implementation } const coef_type &coefficients; const vec *b; vec *x; }; this->get_executor()->run( stencil_operation(coefficients, dense_b, dense_x)); } void apply_impl(const gko::LinOp *alpha, const gko::LinOp *b, const gko::LinOp *beta, gko::LinOp *x) const override { auto dense_b = gko::as<vec>(b); auto dense_x = gko::as<vec>(x); auto tmp_x = dense_x->clone(); this->apply_impl(b, gko::lend(tmp_x)); dense_x->scale(beta); dense_x->add_scaled(alpha, gko::lend(tmp_x)); } private: coef_type coefficients; }; // using the matrix format: auto A = StencilMatrix::create(exec, b->get_size()[0], -1.0, 2.0, -1.0); \end{lstlisting} \end{minipage} \end{center} \subsection{Creating new stopping criteria} \label{sec:extensibility/stop} Implementing new stopping criteria requires a deeper understanding of the concept than that explained in \Cref{sec:intro/criteria}. To accommodate higher generality, a criterion is allowed to maintain state during the execution of a solver (e.g.,\ a criterion based on a time limit may need to record the point in time when the solver was started). On the other hand, a linear operator may invoke a solver multiple times, every time its \func{apply} method is called. As a consequence, the same criterion cannot be reused for multiple runs, as the state from the previous invocation may interfere with a subsequent run. The solution is to prevent users from directly instantiating criteria. Instead, the user instantiates a criterion factory, which is then used by the solver to create a new criterion instance every time the solver is invoked. When creating the criterion, the solver will pass basic information about the system being solved, which includes the system matrix, the right-hand side, the initial guess, and optionally the initial residual. During its execution, the solver will call the criterion's \func{check} method to decide whether to stop the process. This method receives a list of parameters that includes the current iteration number, and optionally one or more of the following: the current residual, the current residual norm, and the current solution. Based on this information, the criterion decides, separately for each right-hand side, whether the iteration process should be detained. Currently, \textsc{Ginkgo}\xspace includes conventional stopping criteria for iterative solvers based on iteration count, execution time or residual thresholds, as well as mechanisms to combine multiple criteria. Nevertheless, users may achieve tighter control of the iteration process by defining their own stopping criteria. \Cref{lst:iteration-stopping-criterion} offers a sample stopping criterion based on the number of iterations which, even though already available in \textsc{Ginkgo}\xspace as \class{gko::stop::Iteration}, is simple enough to show in full as part of this paper. As mentioned in \Cref{sec:intro/criteria}, all stopping criteria, including custom ones, should implement the \class{Criterion} interface. In addition to the \func{check} method, the interface provides various other utility methods which facilitate memory management. To reduce the volume of boiler-plate code needed for new stopping criteria, \textsc{Ginkgo}\xspace provides the \class{EnablePolymorphicObject} mixin. This mixin inherits an interface supporting memory management (in this case \class{Criterion}), and implements utility methods related to it (line~2). For the mixin to work properly, the class being enabled has to provide a constructor with an executor as its only parameter (lines~21--23). Creating a criterion factory can be simplified by using the \func{CREATE\_FACTORY\_PARAMETERS}, \func{FACTO\-RY\_PARAMETER} and \func{ENABLE\_CRITERION\_FACTORY} macros. The first one creates a member type \class{parameters\_type}, which contains all of the parameters of the criterion (lines~4--6). Each parameter is defined using the \func{FACTORY\_PARAMETER} macro, which adds a data member of the requested name and default value, as well as a utility method ``\func{with\_<parameter~name>}'' that can be used when constructing the factory to set the parameter. In this case, the only parameter is the maximum number of iterations (line~5). Finally, the \func{ENABLE\_CRITERION\_FACTORY} macro creates a factory member type named \class{Factory} that uses the parameters to create the criterion. The macro also adds a data member \class{parameters\_} which holds those parameters (line~7). When used to instantiate a new criterion, the factory will pass itself, as well as an instance of \class{parameters\_type}, to the constructor of the criterion. This constructor is defined in lines~25--29. Finally, the implementation of the criterion logic is comprised inside the \func{check} method (lines~10--19). The current state of the solver is passed via the \class{Updater} object. This particular criterion uses the \class{Updater::num\_iterations} property to check whether the limit on the number of iterations has been reached (line~13). If this is not the case, the criterion returns \texttt{false}, indicating to the solver that iterative process should continue (line~14). Otherwise, the stopping statuses of all columns are set (line~16), and the \class{one\_changed} property is set to \texttt{true} to indicate that at least one of the statuses changed (lines~14--17). Finally, once the iteration process for all right-hand sides has been completed, the criterion returns \texttt{true}. The \class{stoppingId} and the \class{setFinalized} flags are additional descriptors that may be used to retrieve additional details about the event that stopped the iteration process. \begin{center} \begin{minipage}{\linewidth} \begin{lstlisting}[caption={An example of a stopping criterion that stops the iteration proces once a certain iteration limit is reached.}, label=lst:iteration-stopping-criterion] class Iteration : public gko::EnablePolymorphicObject<Iteration, gko::stop::Criterion> { GKO_CREATE_FACTORY_PARAMETERS(parameters, Factory) { gko::size_type GKO_FACTORY_PARAMETER(max_iters, 0); }; GKO_ENABLE_CRITERION_FACTORY(Iteration, parameters, Factory); public: bool check(gko::uint8 stoppingId, bool setFinalized, gko::Array<stopping_status> *stop_status, bool *one_changed, const gko::stop::Updater &updater) override { if (updater.num_iterations_ < parameter_.max_iters) { return false; } this->set_all_statuses(stoppingId, setFinalized, stop_status); *one_changed = true; return true; } explicit Iteration(std::shared_ptr<const gko::Executor> exec) : gko::EnablePolymorphicObject<Iteration, gko::stop::Criterion>( std::move(exec)) {} explicit Iteration(const Factory *factory, const gko::stop::CriterionArgs &args) : gko::EnablePolymorphicObject<Iteration, Criterion>( factory->get_executor()), parameters_{factory->get_parameters()} {} }; \end{lstlisting} \end{minipage} \end{center} \subsection{Executors and extending Ginkgo to new architectures} \label{sec:extensibility/executors} The executor is a central class in \textsc{Ginkgo}\xspace{} that provides all important primitives for allocating/deallocating memory on a device, transferring data to other supported devices, and basic intra-device communication (e.g.,\ synchronization). An executor always has a \texttt{master} executor which is a CPU-side executor capable of allocating/deallocating space in the main memory. This concept is convenient when considering devices such as CUDA or HIP accelerators, which feature their own separate memory space. Although implementing a \textsc{Ginkgo}\xspace{} executor that leverages features such as unified virtual memory (UVM) is possible via the interface, in order to attain higher performance we decided to manage all copies by direct calls to the underlying APIs. Support for new devices (e.g.,\ optimized versions of the library for different architectures, new accelerators or co-processors, new programming models) in a heterogeneous node can be added to \textsc{Ginkgo}\xspace by creating new executors for those devices. This requires 1) creating a new class which implements the \class{Executor} interface; 2) adding kernel declarations in all \textsc{Ginkgo}\xspace{} classes with kernels for the new executor; 3) extending the internal \texttt{gko::Operation} to execute kernel operations on the new executor; and 4) implementing kernels for all \textsc{Ginkgo}\xspace{} classes on the new architectures. Although this is an involved process and implies modifications in multiple parts of \textsc{Ginkgo}\xspace{}, the process has been successfully executed to extend \textsc{Ginkgo}\xspace{} to support a new HIP executor. Thanks to \textsc{Ginkgo}\xspace{}'s design, most changes to \textsc{Ginkgo}\xspace{}'s base classes transfer to \texttt{gko::Executor} and its related \texttt{gko::Operation} classes. In addition, although most matrix formats, solvers, preconditioners, and utility functions rely on kernels that need to be implemented to support a new execution space, a good first step is to declare all kernels as \texttt{GKO\_NOT\_IMPLEMENTED}. This allows to obtain a compiling first version featuring the new executor with kernels throwing an exception when called. The required kernel implementations can then be progressively added without endangering the successful compilation of the software stack. \section{Using \textsc{Ginkgo}\xspace with external libraries} \label{sec:external_libraries} In this section we describe and demonstrate how to interface \textsc{Ginkgo}\xspace from other libraries. Specifically, we showcase the usage of \textsc{Ginkgo}\xspace's solver and preconditioner functionality from the \textsc{deal.ii}\xspace\cite{dealII90} and \textsc{MFEM}\xspace\cite{mfem2019} finite element software packages. \subsection{Using \textsc{Ginkgo}\xspace as a solver} \label{sec:external_libraries/solver} To use \textsc{Ginkgo}\xspace as a solver in an external library, one must first adapt the data structures of the external library to \textsc{Ginkgo}\xspace's data structures. We accomplish this by borrowing the raw data from the external library's data structures; next operate on this data - e.g. solve a linear system; and then return the result back to the application in the original data format. \begin{center} \begin{minipage}{\linewidth \begin{lstlisting}[caption={Usage of \textsc{Ginkgo}\xspace's solver capabilities in a \textsc{deal.ii}\xspace application. The code snippet only shows the solution step and assumes that the system matrix and right-hand side are available from \textsc{deal.ii}\xspace.}, label=lst:gko_dealii_code] #include <deal.II/lac/ginkgo_solver.h> #include <deal.II/lac/sparse_matrix.h> #include <deal.II/lac/vector.h> #include <deal.II/lac/vector_memory.h> #include "../testmatrix.h" #include "../tests.h" #include <iostream> #include <typeinfo> int main() { // Set solver parameters SolverControl control(200, 1e-6); const unsigned int size = 32; unsigned int dim = (size - 1) * (size - 1); // Setup a simple matrix FDMatrix testproblem(size, size); SparsityPattern structure(dim, dim, 5); testproblem.five_point_structure(structure); structure.compress(); SparseMatrix<double> A(structure); testproblem.five_point(A); Vector<double> f(dim); f = 1.; Vector<double> u(dim); u = 0.; // Instantiate a Reference executor. auto ref = gko::ReferenceExecutor::create(); // Create a ginkgo preconditioner. auto jacobi = gko::preconditioner::Jacobi<>::build().on(ref); // Use ginkgo to solve the system on the gpu using the CG solver with jacobi // preconditioning. // Note that this is an additional constructor that takes in a created // LinOpFactory object and hence is generic. GinkgoWrappers::SolverCG<> solver(control, "reference", jacobi); // Solves the system and copies the data back to deal.ii's solution variable. solver.solve(A, u, f); } \end{lstlisting} \end{minipage} \end{center} \begin{center} \begin{minipage}{\linewidth \begin{lstlisting}[caption={Usage of \textsc{Ginkgo}\xspace's solver capabilities in a \textsc{MFEM}\xspace application.}, label=lst:gko_mfem_code] #include "mfem.hpp" int main() { . . // Setup the finite element space and assemble the linear . // and bilinear forms . OperatorPtr A; Vector B, X; a->FormLinearSystem(ess_tdof_list, x, *b, A, X, B); // Solve the linear system with CG + ILU from Ginkgo. // Instantiate a Reference executor. auto ref = gko::ReferenceExecutor::create(); // Setup the preconditioner. auto ilu_precond = gko::preconditioner::Ilu<gko::solver::LowerTrs<>, gko::solver::UpperTrs<>>::build() .on(ref); // Create the solver object with convergence parameters. GinkgoWrappers::CGSolver ginkgo_solver("reference", 1, 2000, 1e-12, 0.0, ilu_precond.release()); // The solve method internally converts the MFEM objects to Ginkgo's // objects if necessary, computes the solution and returns the solution. ginkgo_solver.solve(&((SparseMatrix &)(*A)), X, B); // Get solution back to MFEM a->RecoverFEMSolution(X, *b, x); . . // Clean up . } \end{lstlisting} \end{minipage} \end{center} \Cref{lst:gko_dealii_code,lst:gko_mfem_code} showcase the explotation of \textsc{Ginkgo}\xspace functionality in \textsc{deal.ii}\xspace and \textsc{MFEM}\xspace applications. Our main objective is to expose \textsc{Ginkgo}\xspace's functionalities to the external libraries while maintaining an uniform interface within those libraries. The interfaces preserve the libraries' own solver interface, and take the executor determining the execution space as the only additional parameter. All data movement is handled automatically and remains transparent to the user. \subsection{Using \textsc{Ginkgo}\xspace's preconditioners } \label{sec:external_libraries/preconditioners} \textsc{Ginkgo}\xspace provides a multitude of preconditioners on both the CPU and the GPU. An example of such a preconditioner is the block-jacobi preconditioner. To accomodate the use of ginkgo's preconditioners in \textsc{deal.ii}\xspace or \textsc{MFEM}\xspace, an additional constructor for each of the concrete solver classes has been provided which takes in a \texttt{gko::LinOpFactory} as an argument. In the most general case this can be taken to be any generic linear operator factory with an overloaded apply implementation to serve as a preconditioner. \subsection{Interoperability with \textsc{xSDK}\xspace} \label{sec:external_libraries/interop} \textsc{Ginkgo}\xspace is a part of the extreme-scale Scientific Software Development Kit (\textsc{xSDK}\xspace~\cite{xsdk}), a software stack that comprises some of the most important research software libraries and that is available on all US leadership computing facilities. \textsc{Ginkgo}\xspace is included in the \textsc{xSDK}\xspace release 0.5.0~\cite{xsdk-release} which is available as a Spack metapackage. Within the \textsc{xSDK}\xspace effort, interoperability examples with \textsc{MFEM}\xspace and \textsc{deal.ii}\xspace showcase the \class{LinOp} concept of \textsc{Ginkgo}\xspace, and the use of \textsc{Ginkgo}\xspace as a solver using partial assembly of the finite element operator within \textsc{MFEM}\xspace. \section{Software sustainability efforts} \label{sec:sustainability} An important aspect of the \textsc{Ginkgo}\xspace library is its orientation towards software sustainability, ease of use, and openness to external contributions. Aside from \textsc{Ginkgo}\xspace being used as a framework for algorithmic research, its primary intention is to provide a numerical software ecosystem designed for easy adoption by the scientific computing community. This requires sophisticated design guidelines and high quality code. With these goals in mind, \textsc{Ginkgo}\xspace follows the guidelines and policies of the xSDK and the Better Scientific Software (BSSw~\cite{bssw}) initiative. In order to facilitate easy adoption, \textsc{Ginkgo}\xspace is open source with a modified BSD license, which does not restrict commercial use of the software. The main repository is publicly available on github and only prototype implementations of ongoing research are kept in a private repository. The github repository is open to external contributions through a peer-review concept and uses issues for bug tracking and to bolster development efforts. A Continuous Integration (CI) system realizes the automatic synchronization of repositories, and the compilation and testing of the distinct branches. The CI is also setup to ensure quality of the library in terms of memory leaks, threading issues, detection of bugs thanks to static code analyzers, etc. The configuration and compilation processes are facilitated with CMake. The testing is realized using Google Test~\cite{googletest} and comprises a comprehensive list of unit tests ensuring the library's functionality. A feature spearheading sustainable high performance software development is \textsc{Ginkgo}\xspace's Continuous Benchmarking (CB) framework. This component of \textsc{Ginkgo}\xspace's ecosystem automatically runs performance tests on each code change; archives the performance results in a public git repository; and allows users to investigate the performance via an interactive web tool, the Ginkgo Performance Explorer\footnote{\url{https://ginkgo-project.github.io/gpe/}}~\cite{anzt2019towards}. Finally, the documentation is automatically kept up-to date-with the software, and multiple wiki pages containing examples, tutorials, and contributor guidelines are available. \section{Experimental Evaluation} \label{sec:evaluation} \subsection{Experimental setup} In the performance evaluation, we consider two GPU-centric HPC nodes from different hardware vendors: The AMD node consists of an AMD Threadripper 1920X (12 x 3.5 Ghz) CPU, 64 GB RAM, and an AMD RadeonVII GPU. The RadeonVII GPU features 16 GB of main memory accessible at of 1,024 GB/s (according to the specifications), and has a theoretical peak of 3.4 (double precision) TFLOP/s. The NVIDIA node is integrated into the Summit supercomputer, and consists of two IBM POWER9 processors and six NVIDIA Volta V100 accelerators. The NVIDIA V100 GPUs each have a theoretical peak of 7.8 (double-precision) TFLOP/s and feature 16 GB of high-bandwidth memory (HBM2). The board specifications indicate a memory bandwidth of 920 GB/s for this accelerator. We run all our experiments on a single GPU. We note that we do not intend this to be a performance-focused paper, and therefore refrain from showing a comprehensive performance evaluation, but only show selected performance results that are representative for the common usage of \textsc{Ginkgo}\xspace. \subsection{The cost of runtime polymorphism} Relying on static and dynamic polymorphism largely simplifies code maintenance and extendability. A common concern when using these C++ features is the runtime overhead induced by runtime polymorphism. Due to \textsc{Ginkgo}\xspace{}'s design, multiple runtime polymorphisms are evaluated at different levels. For example, calling the SpMV \texttt{apply()} functionality goes through 3 polymorphism forks: Format selection, Executor selection, and Kernel variant selection. Solvers undergo a similar process, except that during each iteration they call multiple kernels: an SpMV, possibly a preconditioner, etc. To evaluate the performance impact of the multiple runtime polymorphism branches, in \Cref{tab:solver_polymorphism_cost} we first measure the overhead for all \textsc{Ginkgo}\xspace{}'s solvers. The results there are obtained using a matrix of size $1$, with an initial solution $x=0$ and the right-hand side ($b$) set to $NaN$. This allows running the full solver algorithm executing all runtime polymorphism branches with negligible kernel execution time. We report results for 1.000 solver iterations averaged over 10.000 solver runs. \Cref{tab:solver_polymorphism_cost} shows that the time per iteration is at most 1.5$\mu{}s$ for any of the solvers. \begin{table} \begin{tabular}{|r||r|r|r|r|r|} \hline Solver & BiCGSTAB & CG & CGS & FCG & GMRES \\ \hline \hline Time per iteration ($\mu{}s$) & 1.2 & 1.2 & 1.0 & 1.4 & 1.5 \\\hline \end{tabular} \caption{Overhead of the main Ginkgo solvers measured by averaging 10.000 solver runs, each doing 1.000 iterations.} \label{tab:solver_polymorphism_cost} \end{table} \begin{figure} \begin{tabular}{lr} \includegraphics[width=0.49\columnwidth]{figures/profile_r7.png} & \includegraphics[width=0.49\columnwidth]{figures/profile_v100.png} \end{tabular} \caption{Performance profile comparing the runtime of \textsc{Ginkgo}\xspace{}'s SpMV kernels with the vendor libraries on the AMD RadeonVII (left) and the NVIDIA V100 (right). The plain names represent the \textsc{Ginkgo}\xspace kernels, the ``hipsp\_'' and ``cusp\_'' labels refer to the vendor implementations in AMD's hipSPARSE and NVIDIA's cuSPARSE libraries, respectively.} \label{fig:perfprofile} \end{figure} \subsection{SpMV kernel performance} We next evaluate the performance of the SpMV kernel for all matrices available in the Suite Sparse Matrix Collection~\cite{saad_iter_methods,suitesparse} on the AMD RadeonVII and the NVIDIA V100 GPU~\cite{isc20}. For this purpose, we compare the performance profile of the SpMV kernels available in the Ginkgo library with their counterparts available in the NVIDIA cuSPARSE and the AMD hipSPARSE libraries. The performance profile indicates for how many test matrices from the Suite Sparse Matrix Collection a specific format is the fastest (maximum slowdown factor 1.0), and how well a specific format generalized. I.e., for a given ``acceptable slowdown factor,'' which percentage of the problems from the Suite Sparse Matrix Collection can be covered. The performance profiles reveal that \textsc{Ginkgo}\xspace{}'s kernels are at least competitive, and in many cases superior to the vendor libraries. \begin{table} \begin{tabular}{l|r|r} Solver & Read access volume & Write access volume \\ \hline \hline BiCGSTAB & \begin{minipage}{5cm}$(5 \cdot n + 2 \cdot nnz) \cdot VT + 2 \cdot nnz \cdot IT + \lceil{}iter/2\rceil{} \cdot ((16 \cdot n + 2 \cdot nnz) \cdot VT + 2 \cdot nnz \cdot IT) + \lfloor{} iter/2 \rfloor{} \cdot ((13 \cdot n + 2 \cdot nnz) \cdot VT + 2 \cdot nnz \cdot IT)$ \end{minipage} &\begin{minipage}{5cm} $(10 \cdot n + 6) \cdot VT + \lceil{} iter/2 \rceil{} \cdot ((4 \cdot n + 2) \cdot VT)+ \lfloor{} iter/2 \rfloor{} \cdot ((4 \cdot n + 3) \cdot VT)$\end{minipage}\\ \hline CG & \begin{minipage}{5cm}$(4 \cdot n + 2 \cdot nnz) \cdot VT + 2 \cdot nnz \cdot IT + iter \cdot ((15 \cdot n + 2 \cdot nnz) \cdot VT + 2 \cdot nnz \cdot IT)$ \end{minipage} &\begin{minipage}{5cm} $(5 \cdot n + 2) \cdot VT + iter \cdot ((5 \cdot n + 2) \cdot VT)$\end{minipage}\\ \hline CGS & \begin{minipage}{5cm}$(5 \cdot n + 2 \cdot nnz) \cdot VT + 2 \cdot nnz \cdot IT + \lceil{} iter/2 \rceil{} \cdot ((14 \cdot n + 2 \cdot nnz) \cdot VT + 2 \cdot nnz \cdot IT) + \lfloor{} iter/2 \rfloor{} \cdot ((6 \cdot n + 2 \cdot nnz) \cdot VT + 2 \cdot nnz \cdot IT)$ \end{minipage} &\begin{minipage}{5cm} $(10 \cdot n + 2) \cdot VT + \lceil{} iter/2 \rceil{} \cdot (6 \cdot n + 3) \cdot VT + \lfloor{} iter/2 \rfloor{} \cdot (4 \cdot n \cdot VT)$\end{minipage}\\ \hline FCG & \begin{minipage}{5cm}$(4 \cdot n + 2 \cdot nnz) \cdot VT + 2 \cdot nnz \cdot IT + iter \cdot ((17 \cdot n + 2 \cdot nnz) \cdot VT + 2 \cdot nnz \cdot IT)$ \end{minipage}& \begin{minipage}{5cm} $(6 \cdot n + 3) \cdot VT + iter \cdot ((6 \cdot n + 3) \cdot VT)$\end{minipage}\\ \hline GMRES & \begin{minipage}{5cm} $(11 \cdot n + 2 \cdot nnz + 5/2 \cdot r + n \cdot r + r^2/2 + 1) \cdot VT + 2 \cdot nnz \cdot IT + \lfloor{}iter/k\rfloor{} \cdot ((1 + 5/2 \cdot k + 10 \cdot n + 2 \cdot nnz + k^2/2 + k \cdot n) \cdot VT + 2 \cdot nnz \cdot IT) + iter \cdot ((7 \cdot n + 5 + 2 \cdot nnz) \cdot VT + 2 \cdot nnz \cdot IT + 8) + iter_r \cdot ((4 \cdot n + 4) \cdot VT)$ \end{minipage} & \begin{minipage}{5cm}$(6 \cdot n + r + 2 \cdot k + 3) \cdot VT + 8 + \lfloor{}iter/k\rfloor{} \cdot ((k + 6 \cdot n + 2) \cdot VT + 8) + iter \cdot ((4 \cdot n + 8) \cdot VT + 8) + iter_r \cdot ((n + 2) \cdot VT)$ \end{minipage} \\ \hline \end{tabular} \caption{Memory access volume of a full run of the distinct solver. Here $VT$ is the value type size in bytes (e.g., for double it is 8 bytes); $IT$ is value type for the index type; and $iter$ is the number of iterations the solver does. In GMRES, $k$ is the Krylov dimension (or restart iteration setting); $r = iter \% k$; and $iter_r = \lfloor{} iter/k \rfloor{} * (k - 1) * k / 2 + (iter\%k - 1) * iter\%k / 2$.} \label{tab:solvermemcost} \end{table} \subsection{Ginkgo solver performance} Prior to evaluating the performance of \textsc{Ginkgo}\xspace's Krylov solvers, we point out that Krylov solvers operating with sparse linear systems are memory-bound algorithms. For this reason, we initially assess the bandwidth efficiency of the implementations of the different Krylov solvers. Concretely, we select the COO matrix format for the SpMV kernel, and run the Krylov solvers without any preconditioner. In \Cref{tab:solvermemcost} we list the target Krylov solvers along with their memory access volume (as a function of the iteration count). The formula for the GMRES algorithm is more involved as we implement a variant enhanced with restart. For the experimental evaluation, we run 10,000 solver iterations on 10 different but representative test matrices from the Suite Sparse collection. For GMRES, we set the restart parameter to 100. In \Cref{fig:solverbandwidth}, we visualize the memory bandwidth usage of the different Krylov solvers for both a V100 GPU executing CUDA code and an AMD RadeonVII GPU executing HIP code. In each graph we indicate the experimental peak bandwidth achieved by a reference stream triad\footnote{$a[i]=b[i]+\alpha{}c[i]$} bandwidth benchmark~\cite{babelstream}. Both test machines reach a very similar STREAM triad bandwidth ($809.8$~GB/s on RadeonVII vs $812.6$~GB/s on V100), although the theoretical bandwidth of the RadeonVII is higher ($1024$~GB/s on RadeonVII vs $900$~GB/s on V100). The bandwidth performance analysis reveals that the algorithms are achieving bandwidth rates in the range of $500$ to $700$~GB/s on the RadeonVII machine and $600$ to $800$~GB/s on the V100 machine. This means that the Ginkgo solver performance reaches more than $70\%$ of the observed bandwidth on the RadeonVII machine (slightly less for GMRES), whereas it is more than $80\%$ on the V100 machine. To better understand this performance discrepancy, in \Cref{tab:stream_bandwidth_comp} we provide detailed bandwidth results on both machines for key operations. The machines show different behaviors: for the copy operation the RadeonVII reaches $6\%$ better performance than the V100, whereas for the dot operation it reaches $25\%$ less performance than the V100, most likely due to the lack of independent thread scheduling. The relatively poor performance for global reductions on the AMD GPU may explain the performance difference of the \textsc{Ginkgo}\xspace solvers between the two machines, as global reductions are essential components of any Krylov solver. \begin{figure} \begin{tabular}{lr} \includegraphics[width=0.48\columnwidth]{figures/cuda_solver_bandwidth.png} & \includegraphics[width=0.48\columnwidth]{figures/hip_solver_bandwidth.png} \end{tabular} \caption{Memory efficiency of \textsc{Ginkgo}\xspace's Krylov solvers.} \label{fig:solverbandwidth} \end{figure} \begin{table} \begin{tabular}{l|r|r} Operation & V100 performance (GB/s) & RadeonVII performance (GB/s)\\ \hline \hline Copy & 790.475 & 841.669 \\ \hline Mul & 787.301 & 841.934\\ \hline Add & 811.312 & 806.632\\ \hline Triad & 812.617 & 809.754\\ \hline Dot & 844.321 & 635.677\\ \hline \end{tabular} \caption{Stream bandwidth results from~\cite{babelstream} on the V100 and RadeonVII machines for key operations.} \label{tab:stream_bandwidth_comp} \end{table} \subsection{Ginkgo preconditioner performance} \textsc{Ginkgo}\xspace provides both (block-Jacobi type) preconditioners based on diagonal scaling and (ILU type) incomplete factorization preconditioners. \textsc{Ginkgo}\xspace{}'s ILU preconditioner technology is spearheading the community, including ParILUT, the first threshold-based ILU preconditioner for GPU architectures~\cite{anzt2019parilut}. This preconditioner approximates the values of the preconditioner via fixed-point iterations while dynamically adapting the sparsity pattern to the matrix properties~\cite{anzt2018parilut}. Depending on the matrix characteristics, this preconditioner can significantly accelerate the solution process of linear system solves; see~\Cref{fig:parilut}. \begin{figure} \begin{tabular}{c} \includegraphics[width=0.6\columnwidth]{figures/parilut.png} \end{tabular} \caption{Time-to-solution comparison between standard ILU preconditioning (NVIDIA's cuSPARSE) and \textsc{Ginkgo}\xspace's ParILUT for solving anisotropic flow problems on two NVIDIA GPU generations. The GMRES solver is taken from the \textsc{Ginkgo}\xspace library.} \label{fig:parilut} \end{figure} Advanced techniques for the ILU preconditioner generation are complemented with fast triangular solvers, including iterative methods~\cite{anzt2015iterative,europar20} and the approximation of the inverse of the triangular factors via a sparse matrix (incomplete sparse approximate inverse preconditioning~\cite{anzt2018incomplete}). \begin{figure} \begin{tabular}{c} \includegraphics[width=0.98\columnwidth]{figures/fig5-left.png} \end{tabular} \caption{Performance of the block-Jacobi preconditioner generation on the NVIDIA V100 GPU. The preconditioner generation includes the Gauss-Jordan elimination featuring pivoting, the condition number calculation and exponent range analysis, the storage format optimization, the format conversion, and the preconditioner storage in GPU main memory. The Different bars for each size represent the distinct memory precision scenarios and the scenarios where the performance data includes the automatic precision detection based on the block condition number and exponent range.} \label{fig:bgje} \end{figure} The block-Jacobi preconditioner available in \textsc{Ginkgo}\xspace outperforms its competitors by automatically adapting the memory precision to the numerical requirements, therewith reducing the memory access time of the memory-bound preconditioner application~\cite{anzt2019adaptive,tomsadaptive}. The inversion of the diagonal block is realized via a heavily-tuned batched variable size Gauss-Jordan elimination~\cite{anzt2019variable}; see~\Cref{fig:bgje}. \section{Conclusions and perspectives} \label{sec:conclusion} \textsc{Ginkgo}\xspace is a modern C++-based sparse linear algebra library for GPU-centric HPC architectures with many appealing features including the Linear Operator abstraction, which fosters easy adoption of the library. Some other aspects that we have elaborated on include the execution control, memory management via smart pointers, software quality measures, and library extensibility. We have also provided example codes for software integration into the deal.ii and MFEM finite element ecosystems, and demonstrated the high performance of Ginkgo on high end GPU architectures. We believe that the design of the library and the sustainability measures that are taken as part of the development process have the potential to become role models for the future efforts on scientific software packages. \section*{Acknowledgments} This work was supported by the ``Impuls und Vernetzungsfond of the Helmholtz Association" under grant VH-NG-1241. G. Flegar and E. S. Quintana-Ort\'{\i} were supported by project TIN2017-82972-R of the MINECO and FEDER and the H2020 EU FETHPC Project 732631 ``OPRECOMP''. This research was also supported by the Exascale Computing Project (17-SC-20-SC), a collaborative effort of the U.S. Department of Energy Office of Science and the National Nuclear Security Administration. The authors want to acknowledge the access to the Summit supercomputer at the Oak Ridge National Lab (ORNL). \bibliographystyle{ACM-Reference-Format}
\section{Introduction} This paper shows that, when goods are indivisible and there are income effects, the existence of competitive equilibrium fundamentally depends on agents' substitution effects---i.e., the effects of compensated price changes on agents' demands. We provide general existence results that do not depend on income effects. In contrast to the case of divisible goods, competitive equilibrium does not generally exist in settings with indivisible goods \citep{henry1970indivisibilites}. Moreover, most previous results about when equilibrium does exist with indivisible goods assume that utility is transferable---ruling out income effects but allowing tractable characterizations of (Pareto-)efficient allocations and aggregate demand that can be exploited to analyze competitive equilibrium.\footnote{For example, methods based on integer programming (see, e.g., \cite{koopmans1957assignment}, \cite{BiMa:97}, \cite{Ma:98}, \cite{CaOzPa:15}, and \cite{tran2019product}) rely on characterizations of the set of Pareto-efficient allocations as the solutions to a welfare maximization problem, while methods based on convex programming (see, e.g., \cite{Muro:2003}, \cite{ikebe2015stability}, and \cite*{CaEpVo:17}) and tropical geometry \citep{BaKl:14,BaKl:19} rely on representing aggregate demand as the demand of a representative agent.} But understanding the role of income effects is important for economies with indivisible goods, as these goods may comprise large fractions of agents' budgets. Furthermore, in the presence of income effects, the distribution of wealth among agents affects both Pareto efficiency and aggregate demand, making it necessary to develop new methods to analyze competitive equilibrium with indivisible goods. The cornerstone of our analysis is an application of the relationship between Marshallian and Hicksian demand. As in classical demand theory, Hicksian demand is defined by fixing a utility level and minimizing the expenditure of obtaining it. We combine Hicksian demands to construct a family of ``Hicksian economies'' in which prices vary, but agents' utilities---rather than their endowments---are held constant. Our key result, which we call the Equilibrium Existence Duality, states that competitive equilibria exist for all endowment allocations if and only if competitive equilibria exist in the Hicksian economies for all utility levels. Preferences in each Hicksian economy reflect agents' substitution effects. Therefore, by the Equilibrium Existence Duality, the existence of competitive equilibrium fundamentally depends on substitution effects. Moreover, as fixing a utility level precludes income effects, agents' preferences are quasilinear in each Hicksian economy. Hence, the Equilibrium Existence Duality allows us to transport (and so generalize) \emph{any} necessary or sufficient condition for equilibrium existence from settings with transferable utility to settings with income effects.\footnote{Outside the case of substitutes (which we describe in detail), \cite{BiMa:97} and \cite{Ma:98} gave necessary and sufficient conditions on profiles of valuations, and \cite{CaOzPa:15} gave sufficient conditions on agents' individual valuations, for the existence of competitive equilibrium in transferable utility economies.} In particular, our most general existence result gives a necessary and sufficient condition for a pattern of agents' substitution effects to guarantee the existence of competitive equilibrium in the presence of income effects. Consider, for example, the case of substitutable goods in which each agent demands at most one unit of each good. With transferable utility, substitutability is sufficient for the existence of competitive equilibrium \citep{KeCr:82} and defines a maximal domain for existence \citep{GuSt:99}. With income effects, \citet{FlJaJaTe:19} showed that competitive equilibrium exists under gross substitutability. The Equilibrium Existence Duality tells us that, with income effects, competitive equilibrium in fact exists under \emph{net} substitutability and that net substitutability defines a maximal domain for existence. Moreover, we show that gross substitutability implies net substitutability; the reverse direction is not true in the presence of income effects. An implication of our results is that it is unfortunate that \cite{KeCr:82}, and much of the subsequent literature, used the term ``gross substitutes'' to refer to a condition on quasilinear preferences. Indeed, gross and net substitutability are equivalent without income effects, and our work shows that it is net substitutability, not gross substitutability, that is critical to the existence of competitive equilibrium with substitutes.\footnote{\cite{KeCr:82} were aware of the equivalence between gross and net substitutability in their setting (see their Footnote 1) but used the term ``gross substitutes'' due to an analogy of their arguments for existence with t\^{a}tonnement from general equilibrium theory.} To appreciate the distinction between gross and net substitutability, suppose that Martine owns a house and is thinking about selling her house and buying one of two different other houses: a spartan one and a luxurious one \citep{quinzii1984core}. If the price of her own house increases, she may wish to buy the luxurious house instead of the spartan one---exposing a gross complementarity between her existing house and the spartan one. However, Martine regards the houses as net substitutes: the complementarity emerges entirely due an income effect. Competitive equilibrium is therefore guaranteed to exist in economies with Martine if all other agents see the goods as net substitutes, despite the presence of gross complementarities. Our most general equilibrium existence theorem characterizes the combinations of substitution effects that guarantee the existence of competitive equilibrium. It is based on \citeposs{BaKl:19} classification of valuations into ``demand types.'' A demand type is defined by the set of vectors that summarize the possible ways in which demand can change in response to a small generic price change. For example, the set of all substitutes valuations forms a demand type, as does the set of all complements valuations, etc. Applying \citeauthor{BaKl:19}'s taxonomy to changes in Hicksian demands, we see that their definition easily extends to general utility functions, capturing agents' substitution effects. Examples of demand types in our setting with income effects, therefore, include the set of all net substitutes preferences, the set of all net complements preferences, etc. The Equilibrium Existence Duality then makes it straightforward that the Unimodularity Theorem\footnote{See Theorem 4.3 of \cite{BaKl:19}; an earlier version was given by \cite{DaKoMu:01}.}---which encompasses many standard results on the existence of competitive equilibrium as special cases\footnote{It generalizes the quasilinear case of \cite{KeCr:82}, and results of \cite{SuYa:06}, \cite{MiSt:09}, \cite{HaKoNiOsWe:11}, and \cite{Teyt:14}.}---is unaffected by income effects. Therefore, as with the case of substitutes, conditions on complementarities and substitutabilities that guarantee the existence of competitive equilibrium in settings with transferable utility translate to conditions on net complementarities and substitutabilities that guarantee the existence of competitive equilibrium in settings with income effects. In particular, there are patterns of net complementarities that are compatible with the existence of competitive equilibrium. Our results may have significant implications for the design of auctions that seek competitive equilibrium outcomes, and in which bidders face financing constraints. For example, they suggest that versions of the Product-Mix Auction \citep{klemperer2008new}, used by the Bank of England since the Global Financial Crisis, may work well in this context. Several other papers have considered the existence of competitive equilibrium in the presence of indivisibilities and income effects. \cite{quinzii1984core}, \cite{gale1984equilibrium}, and \cite{svensson1984competitive} showed the existence of competitive equilibrium in a housing market economy in which agents have unit demand and endowments. Building on those results, \cite{kaneko1986existence}, \cite{van1997existence,van2002existence}, and \cite{yang2000equilibrium} analyzed settings with multiple goods, but restricted attention to separable preferences. By contrast, our results---even for the case of substitutes---allow for interactions between the demand for different goods. We also clarify the role of net substitutability for the existence of competitive equilibrium. In a different direction, \cite{DaKoMu:01} proved a version of the sufficiency direction of the Unimodularity Theorem for settings with income effects. \cite{DaKoMu:01} also defined domains of preferences using an optimization problem that turns out to be equivalent to the expenditure minimization problem. However, they did not note the connection to the expenditure minimization problem or Hicksian demand, and, as a result, did not interpret their sufficient conditions in terms of substitution effects or establish the role of substitution effects in determining the existence of equilibrium. We proceed as follows. Section~\ref{sec:setting} describes our setting---an exchange economy with indivisible goods and money. Section~\ref{sec:EED} develops the Equilibrium Existence Duality. Since the existing literature has focused mostly on the case in which indivisible goods are substitutes, we consider that case in Section~\ref{sec:subst}. Section~\ref{sec:demTypes} develops demand types for settings with income effects and states our Unimodularity Theorem with Income Effects. Section~\ref{sec:auctions} remarks on implications for auction design, and Section~\ref{sec:conclusion} is a conclusion. Appendix~\ref{app:EEDproof} proves the Equilibrium Existence Duality. Appendix~\ref{app:grossToNet} proves the connection between gross and net \substity. Appendices~\ref{app:dualDemPrefs} and~\ref{app:maxDomain} adapt the proofs of results from the literature to our setting. \section{The Setting} \label{sec:setting} We work with a model of exchange economies with indivisibilities---adapted to allow for income effects. There is a finite set $J$ of agents, a finite set $I$ of indivisible goods, and a divisible num\'eraire that we call ``money.'' We allow goods to be undesirable, i.e., to be ``bads." We fix a \emph{total endowment} $\tot \in \mathbb{Z}^I$ of goods in the economy.\footnote{In particular, we allow for multiple units of some goods to be present in the aggregate, unlike \cite{GuSt:99} and \cite{CaOzPa:15}.} \subsection{Preferences and Marshallian Demand} Each agent $j \in J$ has a finite set $\Feas{j} \subseteq \mathbb{Z}^I$ of \emph{feasible bundles} of indivisible goods and a lower bound $\feas{j} \ge -\infty$ on her consumption of money. As bundles that specify negative consumption of some goods can be feasible, our setting implicitly allows for production.\footnote{Technological constraints on production (in the sense of \cite{HaKoNiOsWe:11} and \cite{FlJaJaTe:19}) can be represented by the possibility that some bundles of goods are infeasible for an agent to consume (see Example 2.15 in \cite{BaKl:14}).} The principal cases of $\feas{j}$ are $\feas{j} = -\infty$, in which case all levels of consumption of money are feasible, and $\feas{j} = 0$, in which case the consumption of money must be positive. Hence, the set of feasible consumption bundles for agent $j$ is $\Feans{j} = (\feas{j},\infty) \times \Feas{j}$. Given a bundle $\bunn \in \Feans{j},$ we let $\numer$ denote the amount of money in $\bunn$ and $\bun$ denote the bundle of goods specified by $\bunn,$ so $\bunn = (\defbunn)$. The utility levels of agent $j$ lie in the range $\feasUtil{j}$, where $-\infty \le \minu{j} < \maxu{j} \le \infty.$ Furthermore, each agent $j$ has a \emph{utility function} $\utilFn{j}: \Feans{j} \to \feasUtil{j}$ that we assume to be continuous and strictly increasing in $\numer$, and to satisfy \begin{equation} \label{eq:ulimits} \lim_{\numer \to (\feas{j})^+} \util{j}{\defbunn} = \minu{j} \quad \text{and} \quad \lim_{\numer \to \infty} \util{j}{\defbunn} = \maxu{j} \end{equation} for all $\bun \in \Feas{j}.$ Condition (\ref{eq:ulimits}) requires that some consumption of money above the minimum level $\feas{j}$ be essential to agent $j$.\footnote{\citet[pages 543--544]{henry1970indivisibilites}, \citet[Theorem 1(i)]{mas1977indivisible}, and \citet[Equation (3.1)]{DeGa:85} made similar assumptions. If consuming money is inessential but consumption of money must be nonnegative, then it is known that \ce\ may not exist \citep{mas1977indivisible}---even in settings in which agents have unit demand for goods (see, e.g., \cite{herings2019competitive}). However, the existence of \ce\ can be guaranteed when the agents trade lotteries over goods \citep{Gul.etal2020}.} We let $\pnumer = 1$. Given an endowment $\bunndow = (\defbunndow) \in \Feans{j}$ of a feasible consumption bundle and a price vector $\p \in \mathbb{R}^I,$ agent $j$'s \emph{Marshallian demand} for goods is \[\dM{j}{\p}{\bunndow} = \left\{\bun^* \lgiv \bunn^* \in \argmax_{\bunn \in X^j \mid \pall \cdot \bunn \le \pall \cdot \bunndow} \util{j}{\bunn}\lgivend\right\}.\] As usual, Marshallian demand is given by the set of bundles of goods that maximize an agent's utility, subject to a budget constraint, given a price vector and an endowment. An \emph{income effect} is a change in an agent's Marshallian demand induced by a change in her money endowment, holding prices fixed.\footnote{Note that income effects also correspond to changes in an agent's Marshallian demand induced by changes in the value of her endowment, holding prices fixed.} Our setup is flexible enough to capture a wide range of preferences with and without income effects, as the following two examples illustrate. \begin{example}[Quasilinear Utility] \label{eg:quasilin} Given a \emph{valuation} $\valFn{j}: \Feas{j} \to \mathbb{R},$ letting $\feas{j} = \minu{j}= -\infty$ and $\maxu{j} =\infty,$ one obtains a quasilinear utility function given by \[\util{j}{\defbunn} = \numer + \val{j}{\bun}.\] When agents utility functions are quasilinear, they do not experience income effects. When all agents have quasilinear utility functions, we say that utility is \emph{transferable} \end{example} \begin{example}[Quasilogarithmic Utility] \label{eg:quasilog} Given a function $\quasivalFn{j}: \Feas{j} \to (-\infty,0)$, which we call a \emph{quasivaluation},\footnote{Here, we call $\quasivalFn{j}$ a quasivaluation, and denote it by $\quasivalFn{j}$ instead of $\valFn{j}$, to distinguish it from the valuation of an agent with quasilinear preferences.} and letting $\minu{j}= -\infty$, $\maxu{j} =\infty,$ and $\feas{j} = 0,$ there is a \emph{quasilogarithmic} utility function given by \[\util{j}{\bunn} = \log \numer - \log(- \quasival{j}{\bun}).\] Unlike with quasilinear utility functions, agents with quasilogarithmic utility functions exhibit income effects. \end{example} \subsection{Hicksian Demand, \DualVal{s}, and the \DualEcons} The concept of Hicksian demand from consumer theory plays a key role in our analysis. Given a utility level $\ub \in \feasUtil{j}$ and a price vector $\p,$ agent $j$'s \emph{Hicksian demand} for goods is \begin{equation} \label{eq:costMin} \dH{j}{\p}{\ub} = \left\{\bun^* \lgiv \bunn^* \in \argmin_{\bunn \in \Feans{j} \mid \util{j}{\bunn} \ge \ub} \pall \cdot \bunn\lgivend\right\}. \end{equation} As in the standard case with divisible goods, Hicksian demand is given by the set of bundles of goods that minimize the expenditure of obtaining a utility level given a price vector. A \emph{substitution effect} is a change in an agent's Hicksian demand induced by a change in prices, holding her utility level fixed. As in classical demand theory, Marshallian and Hicksian demand are related by the duality between the utility maximization and expenditure minimization problems. Specifically, a bundle of goods is expenditure-minimizing if and only if it is utility-maximizing.\footnote{Although Fact~\ref{fac:dualDem} is usually stated with divisible goods (see, e.g., Proposition 3.E.1 and Equation (3.E.4) in \cite{MaWhGr:95}), the standard proof applies with multiple indivisible goods and money under Condition~(\ref{eq:ulimits}). For sake of completeness, we give a proof of Fact~\ref{fac:dualDem} in Appendix~\ref{app:dualDemPrefs}.} \begin{fact}[Relationship between Marshallian and Hicksian Demand] \label{fac:dualDem} Let $\p$ be a price vector. \begin{enumerate}[label=(\alph*)] \item For all endowments $\bunndow$, we have that $\dM{j}{\p}{\bunndow} = \dH{j}{\p}{\ub},$ where \[\ub = \max_{\bunn \in \Feans{j} \mid \pall \cdot \bunn \le \pall \cdot \bunndow} \util{j}{\bunn}.\] \item For all utility levels $\ub$ and endowments $\bunndow$ with \[\pall \cdot \bunndow = \min_{\bunn \in \Feans{j} \mid \util{j}{\bunn} \ge \ub} \pall \cdot \bunn,\] we have that $\dH{j}{\p}{\ub} = \dM{j}{\p}{\bunndow}.$ \end{enumerate} \end{fact} If an agent has a quasilinear utility function, then, as she experiences no income effects, her Marshallian and Hicksian demands coincide and do not depend on endowments or utility levels. Under quasilinearity, we therefore refer to both Marshallian and Hicksian demand simply as \emph{demand}, which we denote by $\dQL{j}{\p}$. Formally, if $j$ has quasilinear utility with valuation $\valFn{j},$ defining $\dQL{j}{\p}$ as the solution to the quasilinear maximization problem \begin{equation}\label{eqn:quasilin} \dQL{j}{\p} = \argmax_{\bun \in \Feas{j}} \{\val{j}{\bun} - \p \cdot \bun\}, \end{equation} we have that $\dM{j}{\p}{\bunndow} = \dQL{j}{\p}$ for all endowments $\bunndow$ and that $\dH{j}{\p}{\ub} = \dQL{j}{\p}$ for all utility levels $\ub$. We next show that the interpretation of the expenditure minimization problem as a quasilinear maximization problem persists in the presence of income effects. Specifically, we can rewrite the expenditure minimization problem of Equation (\ref{eq:costMin}) as a quasilinear optimization problem by using the constraint to solve for $\numer$ as a function of $\bun$. Formally, for a bundle $\bun \in \Feas{j}$ of goods and a utility level $\ub \in \feasUtil{j},$ we let $\cf{j}{\bun}{\ub} = \util{j}{\cdot,\bun}^{-1}(\ub)$ denote the level of consumption of money (or \emph{s}avings) needed to obtain utility level $\ub$ given $\bun.$\footnote{The function $\cfFn{j}$ is the \emph{compensation function} of \cite{DeGa:85} (see also \cite{DaKoMu:01}).} By construction, we have that \[\dH{j}{\p}{\ub} = \argmin_{\bun \in \Feas{j}} \left\{\cf{j}{\bun}{\ub} + \p \cdot \bun\right\}.\] It follows that agent $j$'s expenditure minimization problem at utility level $\ub$ can be written as a quasilinear maximization problem for the valuation $-\cf{j}{\cdot}{\ub}$, which we therefore call the Hicksian valuation. \begin{definition} The \emph{\dualval} of agent $j$ at utility level $u$ is $\valHDef{j} = -\cf{j}{\cdot}{\ub}$. \end{definition} Note that $\cf{j}{\cdot}{\ub}$ is continuous and strictly increasing in $\ub,$ and hence $\valHDef{j}$ is continuous and strictly decreasing in $\ub$. The following lemma formally states that agent $j$'s Hicksian demand at utility level $\ub$ is the demand correspondence of an agent with valuation $\valHDef{j}$. \begin{lemma} \label{lem:dHvalH} For all price vectors $\p$ and utility levels $\ub$, we have that \[\dH{j}{\p}{\ub} = \argmin_{\bun \in \Feas{j}} \left\{\cf{j}{\bun}{\ub} + \p \cdot \bun\right\} = \argmax_{\bun \in \Feas{j}} \left\{\valH{j}{\bun}{\ub} - \p \cdot \bun\right\}.\] \end{lemma} \begin{proof} As $\utilFn{j}(\bunn)$ is strictly increasing in $\numer,$ we have that \[\dH{j}{\p}{\ub} = \left\{\bun^* \lgiv \bunn^* \in \argmin_{\bunn \in \Feans{j} \mid \util{j}{\bunn} = \ub} \pall \cdot \bunn\lgivend\right\}.\] Applying the substitution $\numer = \cf{j}{\bun}{\ub}=-\valH{j}{\bun}{\ub}$ to remove the constraint from the minimization problem yields the lemma \end{proof} It follows from Lemma~\ref{lem:dHvalH} that an agent's \dualval\ at a utility level gives rise to a quasilinear utility function that reflects the agent's substitution effects at that utility level. Lemma~\ref{lem:dHvalH} also yields a relationship between the family of \dualvals\ and income effects. Indeed, by Fact~\ref{fac:dualDem}, an agent's income effects correspond to changes in her Hicksian demand induced by changes in her utility level, holding prices fixed. By Lemma~\ref{lem:dHvalH}, these changes in Hicksian demand reflect the changes in the \dualval\ that are induced by the changes in utility levels. Hence, the \dualvals\ at each utility level determine an agent's substitution effects, while the variation of the \dualvals\ with the utility level captures her income effects. To illustrate how an agent's family of \dualvals\ reflects her income effects, we consider the cases of quasilinear and quasilogarithmic utility. \begin{example}[Example~\ref{eg:quasilin} continued] With quasilinear utility, the \dualval\ at utility level $\ub$ is $\valH{j}{\bun}{\ub} = \val{j}{\bun} - \ub.$ Changes in $\ub$ do not affect the relative values of bundles under $\valH{j}{\cdot}{\ub}$, so changes in the utility level do not affect Hicksian demand. Indeed, there are no income effects. By construction, a utility function $\util{j}{\bunn}$ is quasilinear in $\numer$ if and only if $\cf{j}{\bun}{\ub}$ is quasilinear in $\ub$---or, equivalently, $\valH{j}{\bun}{\ub}$ is quasilinear in $-\ub$. \end{example} In general, it follows from Fact~\ref{fac:dualDem} and Lemma~\ref{lem:dHvalH} that agent $j$'s preferences exhibit income effects if and only if $\cf{j}{\bun}{\ub}$---or, equivalently, $\valH{j}{\bun}{\ub}$---is not additively separable between $\bun$ and $\ub$. \begin{example}[Example~\ref{eg:quasilog} continued] \label{eg:quasilogDualVal} With quasilogarithmic utility, the \dualval\ at utility level $\ub$ is $\valH{j}{\bun}{\ub} = e^{\ub} \quasival{j}{\bun}.$ In this case, each \dualval\ is a positive linear transformation of $\quasivalFn{j}$. Income effects are reflected by the fact that $\valH{j}{\bun}{\ub}$ is not additively separable between $\bun$ and $\ub$. \end{example} We use Lemma~\ref{lem:dHvalH} to convert preferences with income effects into families of valuations. It turns out that each continuously decreasing family of valuations is the family of \dualvals\ of a utility function, so a utility function can be represented equivalently by a family of \dualvals. \begin{fact}[Duality for Preferences] \label{fac:dualPrefs} Let $F: \Feas{j} \times \feasUtil{j} \to (-\infty,-\feas{j})$ be a function. There exists a utility function $\utilFn{j}: \Feans{j} \to \feasUtil{j}$ whose \dualval\ at each utility level $\ub$ is $F(\cdot,\ub)$ if and only if for each $\bun \in \Feas{j},$ the function $F(\bun,\cdot)$ is continuous, strictly decreasing, and satisfies\footnote{A version of Fact~\ref{fac:dualPrefs} for the function $\cfFn{j}$ in a setting in which utility is increasing in goods is proved in Lemma 1 in \cite{DaKoMu:01}. For sake of completeness, we give a proof of Fact~\ref{fac:dualPrefs} in Appendix~\ref{app:dualDemPrefs}. Fact~\ref{fac:dualPrefs} is also similar in spirit to the duality between utility functions and expenditure functions (see, e.g., Propositions 3.E.2 and 3.H.1 in \cite{MaWhGr:95}). However, the arguments of the expenditure function (at each utility level) are prices, while the arguments of the \dualval\ (at each utility level) are quantities.}\footnote{Condition (\ref{eq:vlimits}) is analogous to Condition (\ref{eq:ulimits}) and ensures that the corresponding utility function is defined everywhere on $\Feans{j}$. Note that Condition (\ref{eq:vlimits}) is essentially automatic in the context of \cite{DaKoMu:01} and therefore does not appear explicitly in their result (Lemma 1 in \cite{DaKoMu:01}).} \begin{equation} \label{eq:vlimits} \lim_{\ub \to (\minu{j})^+} F(\bun,\ub) = -\feas{j} \quad \text{and} \quad \lim_{\ub \to (\maxu{j})^-} F(\bun,\ub) = -\infty. \end{equation} \end{fact} Finally, we combine the families of \dualval{s} to form a family of \dualecons, in each of which utility is transferable and agents choose consumption bundles to minimize the expenditure of obtaining given utility levels. \begin{definition} The \emph{\dualecon\ for a profile of utility levels $(\ubj)_{j \in J}$} is the transferable utility economy in which agent $j$'s valuation is $\valH{j}{\cdot}{\ubj}$. \end{definition} The family of \dualecons\ consists of the ``duals" of the original economy in which income effects have been removed and \totpriceeffs\ are given by substitution effects. Like the construction of \dualvals, the construction of the \dualecons\ allows us to convert economies with income effects to families of economies with transferable utility and is a key step of our analysis \section{The Equilibrium Existence Duality} \label{sec:EED} We now turn to the analysis of \ce\ in exchange economies. \Andowallocemph\ consists of an endowment $\bunndowj \in \Feans{j}$ for each agent $j$ such that $\sum_{j \in J} \bundowj = \tot,$ where $\tot$ is the total endowment. Given \andowalloc, a \ce\ specifies a price vector such that markets for goods clear when agents maximize utility. By Walras's Law, it follows that the market for money clears as well. \begin{definition} Given \andowalloc\ $(\bunndowj)_{j \in J}$, a \emph{\ce} consists of a price vector $\p$ and a bundle $\bunj \in \dM{j}{\p}{\bunndowj}$ for each agent such that $\sum_{j \in J} \bunj = \tot$. \end{definition} In transferable utility economies, a \ce\ consists of a price vector $\p$ and a bundle $\bunj \in \dQL{j}{\p}$ for each agent such that $\sum_{j \in J} \bunj = \tot$. In this case, the \dowalloc\ does not affect \ce\ because endowments do not affect (Marshallian) demand. We therefore omit the \dowalloc\ when considering \ce\ in transferable utility economies in which \andowalloc\ exists---i.e., $\tot \in \sum_{j \in J} \Feas{j}$. On the other hand, the total endowment $\tot$ affects \ce\ even when utility is transferable. Recall that utility is transferable in the \dualecons. Furthermore, by Lemma~\ref{lem:dHvalH}, a \ce\ in the \dualecon\ for a profile $(\ubj)_{j \in J}$ of utility levels consists of a price vector $\p$ and a bundle $\bunj \in \dH{j}{\p}{\ubj}$ for each agent such that $\sum_{j \in J} \bunj = \tot$. Thus, agents act as if they minimize expenditure in \ce\ in the \dualecons.\footnote{\label{fn:quasiEquil}As a result, \ces\ in the \dualecons\ coincide with \emph{quasiequilibria with transfers} from the modern treatment of the Second Fundamental Theorem of Welfare Economics (see, e.g., Definition 16.D.1 in \cite{MaWhGr:95}). As the set of feasible levels of money consumption is open, agents always can always reduce their money consumption slightly from a feasible bundle to obtain a strictly cheaper feasible bundle. Hence, quasiequilibria with transfers coincide with equilibria with transfers in the original economy (see, e.g., Proposition 16.D.2 in \cite{MaWhGr:95} for the case of divisible goods). If the endowments of money were fixed in the \dualecons, this concept would coincide with the concept of \emph{compensated equilibrium} of \cite{arrow1971general} and the concept of \emph{quasiequilibrium} introduced by \cite{debreu1962new}. } Building on Fact~\ref{fac:dualDem} and Lemma~\ref{lem:dHvalH}, our Equilibrium Existence Duality connects the equilibrium existence problems in the original economy (which can feature income effects) and the \dualecon\ (in which utility is transferable). Specifically, we show that \ce\ always exists in the original economy if and only if it always exists in the \dualecons. Here, we hold agents' preferences and the total endowment (of goods) fixed but allow the \dowalloc\ to vary. \begin{theorem}[Equilibrium Existence Duality] \label{thm:existDualExchange} Suppose that the total endowment and the sets of feasible bundles are such that \andowalloc\ exists. \Ces\ exist for all \dowallocs\ if and only if \ces\ exist in the \dualecons\ for all profiles of utility levels. \end{theorem} By Lemma~\ref{lem:dHvalH}, agents' substitution effects determine their preferences in each \dualecon. Therefore, Theorem~\ref{thm:existDualExchange} tells us that \emph{any} condition that ensures the existence of \ces\ can be written as a condition on substitution effects alone. That is, substitution effects fundamentally determine whether \ce\ exists. Both directions of Theorem~\ref{thm:existDualExchange} also have novel implications for the analysis of \ce\ in economies with indivisibilities. As demands in the \dualecons\ are given by Hicksian demand in the original economy (Lemma~\ref{lem:dHvalH}), the ``if" direction of Theorem~\ref{thm:existDualExchange} implies that every condition on demand $\dQLFn{j}$ that guarantees the existence of \ce\ in settings with transferable utility translates into a condition on \emph{Hicksian} demand $\dHFn{j}$ that guarantees the existence of \ce\ in settings with income effects. In Sections~\ref{sec:subst} and~\ref{sec:demTypes}, we use the ``if" direction of Theorem~\ref{thm:existDualExchange} to obtain new domains for the existence of \ce\ with income effects from previous results on the existence of \ce\ in settings with transferable utility \citep{KeCr:82,BaKl:19}. Conversely, the ``only if" direction of Theorem~\ref{thm:existDualExchange} shows that if a condition on demand defines a maximal domain for the existence of \ce\ in settings with transferable utility, then the translated condition on Hicksian demand defines a maximal domain for the existence of \ce\ in settings with income effects. In Sections~\ref{sec:subst} and~\ref{sec:demTypes}, we also use this implication to derive new maximal domain results for settings with income effects. To prove the ``only if" direction of Theorem~\ref{thm:existDualExchange}, we exploit a version of the Second Fundamental Theorem of Welfare Economics for settings with indivisibilities. To understand connection to the existence problem for the \dualecons, note that the existence of \ce\ in the \dualecons\ is equivalent to the conclusion of the Second Welfare Theorem---i.e., that each Pareto-efficient allocation can be supported in an equilibrium with endowment transfers---as the following lemma shows.\footnote{Recall that an allocation $(\bunnj)_{j \in J} \in \bigtimes_{j \in J} \Feans{j}$ is \emph{Pareto-efficient} if there does not exist an allocation $(\hbunnj)_{j \in J} \in \bigtimes_{j \in J} \Feans{j}$ such that \[\sum_{j \in J} \hbunnj = \sum_{j \in J} \bunnj,\] and $\util{j}{\hbunnj} \ge \util{j}{\bunnj}$ for all agents $j$ with strict inequality for some agent.} \begin{lemma} \label{lem:dualEconSWT} Suppose that the total endowment and the sets of feasible bundles are such that \andowalloc\ exists. \Ces\ exist in the \dualecons\ for all profiles of utility levels if and only if, for each Pareto-efficient allocation $(\bunnj)_{j \in J}$ with $\sum_{j \in J} \bunj = \tot$, there exists a price vector $\p$ such that $\bunnj \in \dM{j}{\p}{\bunnj}$ for all agents $j$. \end{lemma} We prove Lemma~\ref{lem:dualEconSWT} in Appendix~\ref{app:EEDproof}. Intuitively, as utility is transferable in the \dualecons, variation in utility levels between \dualecons\ plays that same role as endowment transfers in the Second Welfare Theorem. It is well-known that the conclusion of the Second Welfare Theorem holds whenever \ces\ exist for all \dowallocs\ \citep{maskin2008fundamental}.\footnote{While \cite{maskin2008fundamental} assumed that goods are divisible, their arguments apply even in the presence of indivisibilities---as we show in Appendix~\ref{app:EEDproof}.} It follows that \ce\ always exists in the \dualecons\ whenever it always exists in the original economy, which is the ``only if" direction of Theorem~\ref{thm:existDualExchange}. We use a different argument to prove the ``if" direction. Our strategy is to show that there exists a profile of utility levels and a \ce\ in the corresponding \dualecon\ in which all agents' expenditures equal their budgets in the original economy. To do so, we apply a topological fixed-point argument that is similar in spirit to standard proofs of the existence of \ce. Specifically, we consider an auctioneer who, for a given profile of candidate equilibrium utility levels, evaluates agents' expenditures over all \ces\ in the \dualecon\ and adjusts candidate equilibrium utility levels upwards (resp.~downwards) for agents who under- (resp.~over-) spend their budgets.\footnote{This approach is similar in spirit to \citeposs{negishi1960welfare} proof of the existence of \ce\ with divisible goods. \cite{negishi1960welfare} instead applied an adjustment process to the inverses of agents' marginal utilities of money. However, \citeposs{negishi1960welfare} approach does not generally yield a convex-valued adjustment process in the presence of indivisibilities.} The existence of \ce\ in the \dualecons\ ensures that the process is nonempty-valued, and the transferability of utility in the \dualecons\ ensures that the process is convex-valued. Kakutani's Fixed Point Theorem implies the existence of a fixed-point utility profile. By construction, there exists a \ce\ in the corresponding \dualecon\ at which agents' expenditures equal the values of their endowments. By Lemma~\ref{lem:dHvalH}, agents must be maximizing utility given their endowments at this equilibrium, and hence once obtains a \ce\ in the original economy. The details of the argument are in Appendix~\ref{app:EEDproof}. \subsection{Examples} We next illustrate the power of Theorem~\ref{thm:existDualExchange} using the two examples. Our first example is a ``housing market'' in which agents have unit-demand preferences, may be endowed with a house, and can experience arbitrary income effects. We can use Theorem~\ref{thm:existDualExchange} to reduce the existence problem to the assignment game of \cite{koopmans1957assignment}---reproving a result originally due to \cite{quinzii1984core} \begin{example}[A Housing Market---\citealp{quinzii1984core,gale1984equilibrium,svensson1984competitive}] \label{eg:house} For each agent $j,$ let $\Feas{j} \subseteq \{\mathbf{0}\} \cup \{\e{i} \mid i \in I\}$ be nonempty. In this case, in \dualecon, utility is transferable and agents have unit demand for the goods. As the \dowalloc\ does not affect \ce\ when utility is transferable, the results of \cite{koopmans1957assignment} imply that \ces\ exist in the \dualecons\ for all profiles of utility levels (provided that \andowalloc\ exists). Hence, Theorem~\ref{thm:existDualExchange} implies that \ces\ exist for all endowment allocations---even in the presence of income effects. \end{example} In the second example, we revisit the quasilogarithmic utility functions from Example~\ref{eg:quasilog}. We provide sufficient conditions on agents' quasivaluations for \ce\ to exist. These conditions are related to, but not in general implied by, the conditions developed in Sections~\ref{sec:subst} and~\ref{sec:demTypes}. \begin{example}[Existence of \CE\ with Quasilogarithmic Preferences] \label{eg:quasilogExist} For each agent $j,$ let $\quasivalFn{j}: \Feas{j} \to (-\infty,0)$ be a quasivaluation. Let agent $j$'s utility function be quasilogarithmic for the quasivaluation $\quasivalFn{j}$, as in Example~\ref{eg:quasilog}. In this case, agent $j$'s \dualval\ at each utility level is a positive linear transformation of $\quasivalFn{j}$ (Example~\ref{eg:quasilogDualVal}). Hence, by Theorem~\ref{thm:existDualExchange}, \ces\ exist for all \dowallocs\ as long as \ce\ exists when utility is transferable and each agent $j$'s valuation is an (agent-dependent) positive linear transformation of $\quasivalFn{j}$---e.g., if the quasivaluations $\quasivalFn{j}$ are all \ssubst\ valuations \citep{MiSt:09}, or all valuations of a unimodular demand type \citep{BaKl:19}. Additionally, in the case in which one unit of each good is available in total (i.e., $\totComp{i} = 1$ for all goods $i$), \cite{CaOzPa:15} showed that \ce\ exists when utility is transferable and all agents have sign-consistent tree valuations. Hence, if one unit of each good is available in total, then Theorem~\ref{thm:existDualExchange} implies that \ces\ exist with quasilogarithmic utility for all \dowallocs\ if all agents' quasivaluations are sign-consistent tree valuations. \end{example} In the remainder of the paper, we use Theorem~\ref{thm:existDualExchange} to develop novel conditions on preferences that ensure the existence of \ce. \section{The Case of Substitutes} \label{sec:subst} In this section, we apply the Equilibrium Existence Duality (Theorem~\ref{thm:existDualExchange}) to prove a new result regarding the existence of \ce\ with substitutable indivisible goods and income effects: we show that a form of \emph{net} \substity\ is sufficient for, and in fact defines a maximal domain for, the existence of \ce. We begin by reviewing previous results on the existence of \ce\ under (gross) \substity. We then derive our existence theorem for \nsubstity\ and relate it to the previous results. In this section, we focus on the case in which each agent demands at most one unit of each good. Formally, we say that an agent $j$ \emph{demands at most one unit of each good} if $\Feas{j} \subseteq \{0,1\}^I$. We extend to the case in which agents can demand multiple units of some goods in Section~\ref{sec:ssub}. \subsection{\GSubstity\ and the Existence of \CE} \label{sec:subOld} We recall a notion of \gsubstity\ for preferences over indivisible goods from \cite{FlJaJaTe:19}, which extends the \gsubstity\ condition from classical demand theory. It requires that \emph{uncompensated} increases in the price of a good weakly raise demand for all other goods. With quasilinear utility, the modifier ``gross'' can be dropped---as in classical demand theory (see also Footnote 1 in \cite{KeCr:82}). \begin{definition}[\GSubstity] \label{def:gsub} Suppose that agent $j$ demands at most one unit of each good. \begin{enumerate}[label=(\alph*)] \item \label{part:gsub} A utility function $\utilFn{j}$ is a \emph{\gsubst\ utility function at endowment $\bundow \in \Feas{j}$ of goods} if for all money endowments $\numerdow > \feas{j}$, price vectors $\p$, and $\lambda > 0,$ whenever $\dM{j}{\p}{\bunndow} = \{\bun\}$ and $\dM{j}{\p + \lambda \e{i}}{\bunndow} = \{\bunpr\},$ we have that $\bunprComp{k} \ge \bunComp{k}$ for all goods $k \not= i$.\footnote{Our definition of \gsubstity\ holds the endowment of goods fixed, but, unlike \cite{FlJaJaTe:19}, imposes a condition at every feasible endowment of money. Imposing the ``full substitutability in demand language'' condition from Assumption D.1 in Supplemental Appendix D of \cite{FlJaJaTe:19} at every money endowment is equivalent to our \gsubstity\ condition.} \item A \emph{\subst\ valuation} is a valuation for which the corresponding quasilinear utility function is a \gsubst\ utility function \footnote{Note that \substity\ is independent of the endowment of goods as endowments do not affect the demands of agents with quasilinear utility functions. Our definition of \substity\ coincides with \citeposs{KeCr:82} definition \citep*{DaKoLa:2003}.} \end{enumerate} \end{definition} Technically, Definition~\ref{def:gsub} imposes a \substity\ condition on the locus of prices at which Marshallian demand is single-valued---following \cite{AuMi:02}, \cite{HaKoNiOsWe:11}, \cite{BaKl:19}, and \cite{FlJaJaTe:19}.\footnote{By contrast, \cite{KeCr:82} imposed a \gsubstity\ condition at all price vectors. Imposing \citeposs{KeCr:82} condition at every money endowment leads to a strictly stronger condition than Definition~\ref{def:gsub}\ref{part:gsub} in the presence of income effects \citep{schlegel2018trading}.} It is well-known that when utility is transferable, \ce\ exists under \substity. \begin{fact} \label{fac:subExist} Suppose that utility is transferable and that \andowalloc\ exists. If each agent demands at most one unit of each good and has a \subst\ valuation, then \ce\ exists.\footnote{Fact~\ref{fac:subExist} is a version of Theorem 1 in \cite{HaKoNiOsWe:11} for exchange economies and follows from Proposition 4.6 in \cite{BaKl:19}. See \cite{KeCr:82} and \cite{GuSt:99} for earlier versions that assume that valuations are monotone.} \end{fact} Moreover, the class of \subst\ valuations forms a maximal domain for the existence of \ce\ in transferable utility economies. Specifically, if an agent has a non-\subst\ valuation, then \ce\ may not exist when the other agents have \subst\ valuations. Technically, we require that one unit of each good be present among agents' endowments (i.e., that $\totComp{i} = 1$ for all goods $i$) as complementarities between goods that are not present are irrelevant for the existence of \ce. \begin{fact} \label{fac:subMaxDomain} Suppose that $\totComp{i} = 1$ for all goods $i$. If $|J| \ge 2$, agent $j$ demands at most one unit of each good, and $\valFn{j}$ is not a \subst\ valuation, then there exist sets $\Feas{k} \subseteq \{0,1\}^I$ of feasible bundles and \subst\ valuations $\valFn{k}: \Feas{k} \to \mathbb{R}$ for agents $k \not= j$, for which there exists \andowalloc\ but no \ce.\footnote{Fact~\ref{fac:subMaxDomain} is a version of Theorem 2 in \cite{GuSt:99} and Theorem 4 in \cite{yang2017maximal} that applies when $\Feas{k}$ can be strictly contained in $\{0,1\}^I$, as well as a version of Theorem 7 in \cite{HaKoNiOsWe:11} for exchange economies. For sake of completeness, we give a proof of Fact~\ref{fac:subMaxDomain} in Appendix~\ref{app:maxDomain}. The proof shows that the statement would hold if $|J| \geq |I|$ and agents $k \not= i$ were restricted to unit-demand valuations---as in Theorem 2 in \cite{GuSt:99}.} \end{fact} While Fact~\ref{fac:subMaxDomain} shows that there is no domain strictly containing the domain of \subst\ valuations for which the existence of \ce\ can be guaranteed in transferable utility economies, it does not rule out the existence of other domains for which the existence of \ce\ can be guaranteed. For example, \cite{SuYa:06}, \cite{CaOzPa:15}, and \cite{BaKl:19} gave examples of domains other than \substity\ for which the existence of \ce\ is guaranteed. Generalizing Fact~\ref{fac:subExist} to settings with income effects, \cite{FlJaJaTe:19} showed that \ce\ exists for \andowalloc\ $(\bunndowj)_{j \in J}$ if each agent $j$'s utility function is a \gsubst\ utility function at her endowment $\bundowj$ of goods.\footnote{\cite{FlJaJaTe:19} worked with a matching model and considered equilibrium with personalized pricing, but their arguments also apply in exchange economies without personalized pricing. However, \cite{FlJaJaTe:19} only required that each agent sees goods as \gsubst\ for a fixed endowment of goods and money. Our notion of \gsubstity\ considers a fixed endowment of goods but a variable endowment of money, and therefore the existence result of \cite{FlJaJaTe:19} is not strictly a special case of Theorem~\ref{thm:netSubExist}. Moreover, \cite{FlJaJaTe:19} also allowed for frictions such as transaction taxes and commissions in their existence result.} However, \cite{FlJaJaTe:19} did not offer a maximal domain result for \gsubstity. In the next section, we show that \gsubstity\ does not actually drive existence of \ce\ with substitutable indivisible goods. \subsection{\NSubstity\ and the Existence of \CE} \label{sec:nsub} In light of Theorem~\ref{thm:existDualExchange} and Fact~\ref{fac:subExist}, \ce\ exists if agents' Hicksian demands satisfy an appropriate \substity\ condition---i.e., if preferences satisfy a \emph{net} analogue of \substity. We build on Definition~\ref{def:gsub} to define a concept of \nsubstity\ for settings with indivisibilities. \Nsubstity\ is a version of the \nsubstity\ condition from classical consumer theory. It requires that \emph{compensated} increases in the price of a good (i.e., price increases that are offset by compensating transfers) weakly raise demand for all other goods. \begin{definition}[\NSubstity] \label{def:nsub} Suppose that agent $j$ demands at most one unit of each good. A utility function $\utilFn{j}$ is a \emph{\nsubst\ utility function} if for all utility levels $\ub$, price vectors $\p$, and $\lambda > 0,$ whenever $\dH{j}{\p}{\ub} = \{\bun\}$ and $\dH{j}{\p + \lambda \e{i}}{\ub} = \{\bunpr\}$, we have that $\bunprComp{k} \ge \bunComp{k}$ for all goods $k \not= i$. \end{definition} For quasilinear utility functions, \nsubstity\ coincides with (gross) \substity. More generally, \nsubstity\ can be expressed as a condition on \dualvals. \begin{remark} \label{rem:netSubDual} By Lemma~\ref{lem:dHvalH}, if an agent demands at most one unit of each good, then she has a \nsubst\ utility function if and only if her \dualvals\ at all utility levels are \subst\ valuations. \end{remark} We can apply Fact~\ref{fac:dualPrefs} and Remark~\ref{rem:netSubDual} to construct large classes of \nsubst\ preferences with income effects from families of \subst\ valuations. There are several rich families of \subst\ valuations, including endowed assignment valuations \citep{HaMi:05} and matroid-based valuations \citep{ostrovsky2015gross}. This leads to a large class of quasilogarithmic \nsubst\ utility functions. \begin{example}[Example~\ref{eg:quasilog} continued] \label{eg:quasilogSubs} A quasilogarithmic utility function $\utilFn{j}$ is a \nsubst\ utility function if and only if the quasivaluation $\quasivalFn{j}$ is a \subst\ valuation.\footnote{Indeed, recall that Example~\ref{eg:quasilogDualVal} tells us that agent $j$'s \dualval\ at each utility level is a positive linear transformation of $\quasivalFn{j}$. The conclusion follows by Remark~\ref{rem:netSubDual}.} \end{example} More generally, in light of Fact~\ref{fac:dualPrefs} and Remark~\ref{rem:netSubDual}, each family of \subst\ valuations leads to a class of \nsubst\ utility functions with income effects consisting of the utility functions whose \dualvals\ all belong to the family. These classes are defined by conditions on substitution effects and do not restrict income effects. By contrast, \gsubstity\ places substantial restrictions on the form of income effects.\footnote{See Remark E.1 in the Supplemental Material of \cite{FlJaJaTe:19}).} To understand the difference between gross and \nsubstity, we compare the conditions in a setting in which agents have unit demand for goods. \begin{example}[Example~\ref{eg:house} continued] \label{eg:houseGrossNet} Consider an agent, Martine, who owns a house $i_1$ and is considering selling it to purchase (at most) one of houses $i_2$ and $i_3$. If Martine experiences income effects, then her choice between $i_2$ and $i_3$ generally depends on the price she is able to procure for her house $i_1$. For example, if $i_3$ is a more luxurious house than $i_2,$ then Martine may only demand $i_3$ if the value of her endowment is sufficiently large---i.e., if the price of her house $i_1$ is sufficiently high. As a result, when Martine is endowed with $i_1$, she does not generally have \gsubst\ preferences: increases in the price of $i_1$ can lower Martine's demand for $i_2$. That is, Martine can regard $i_2$ as a gross complement for $i_1$. In contrast, Martine has \nsubst\ preferences---no compensated increase in the price of $i_1$ could make Martine stop demanding $i_2$---a condition that holds generally in the housing market economy.\footnote{\citet[Example 2]{DaKoMu:01} also showed the connection between \citeposs{quinzii1984core} housing market economy and a \substity\ condition, but formulated their discussion in terms of the shape of the convex hull at domains at which demand is multi-valued instead of \nsubstity. Their discussion is equivalent to ours by Corollary 5 in \cite*{DaKoLa:2003} and Remark~\ref{rem:netSubDual}.} Note also that, unlike \nsubstity, \gsubstity\ generally depends on endowments: if Martine were not endowed a house, she would have \gsubst\ preferences \citep{kaneko1982central,kaneko1983housing,DeGa:85}. \end{example} While Example~\ref{eg:houseGrossNet} shows that \nsubstity\ does not imply \gsubstity, it turns out that \gsubstity\ implies \nsubstity. \begin{proposition} \label{prop:ssubst} If agent $j$ demands at most one unit of each good and there exists an endowment $\bundow$ of goods at which $\utilFn{j}$ is a \gsubst\ utility function, then $\utilFn{j}$ is \nsubst\ utility function. \end{proposition} Proposition~\ref{prop:ssubst} and Example~\ref{eg:houseGrossNet} show that \gsubstity\ (at any one endowment of goods) implies \nsubstity\ but places additional restrictions on income effects. Nevertheless, the restrictions on substitution effects alone, entailed by \nsubstity, are sufficient for the existence of \ce. \begin{theorem} \label{thm:netSubExist} If all agents demand at most one unit of each good and have \nsubst\ utility functions, then \ces\ exist for all \dowallocs. \end{theorem} Theorem~\ref{thm:netSubExist} is an immediate consequence of the Equilibrium Existence Duality and the existence of \ces\ in transferable utility economies under \substity. \begin{proof} Remark~\ref{rem:netSubDual} implies that the agents' \dualvals\ at all utility levels are \subst\ valuations. Hence, Fact~\ref{fac:subExist} implies that \ces\ exist in the \dualecons\ for all profiles of utility levels if \andowalloc\ exists. The theorem follows by the ``if'' direction of Theorem~\ref{thm:existDualExchange}. \end{proof} As \gsubstity\ implies \nsubstity\ (Proposition~\ref{prop:ssubst}), the existence of \ce\ under \gsubstity\ is a special case of Theorem~\ref{thm:netSubExist}. But Theorem~\ref{thm:netSubExist} is more general: as Example~\ref{eg:houseGrossNet} shows, \nsubstity\ allows for forms of gross complementarities between goods, in addition to \gsubstity. The following example illustrates how the distinction between \gsubstity\ and \nsubstity\ relates to the existence of \ce\ when agents caan demand multiple goods. \begin{example}[\GSubstity\ versus \NSubstity\ and the Existence of \CE] \label{eg:grossVersusNetNumerical} There are two goods and the total endowment is $\tot = (1,1)$. There are two agents, which we call $j$ and $k,$ and $j$'s feasible set of consumption bundles of goods is $\Feas{j} = \{0,1\}^2$. We consider the price vectors $\p = (2,2)$ and $\ppr = (4,2)$ and consider two examples in which agent $j$'s Marshallian demand changes from $(1,1)$ to $(0,0)$ as prices change from $\p$ to $\ppr$---a \gcompity. But the consequences for the existence of \ce\ are different across the two cases. In Case~\ref{eg:numericalComp}, the \gcompity\ reflects a net complementarity for $j$, and \ce\ may not exist if $k$ sees goods as net substitutes. In Case~\ref{eg:numericalLog}, the \gcompity\ reflects only an income effect for $j$, as in Example~\ref{eg:houseGrossNet}, so \ce\ is guaranteed to exist if $k$ sees goods as net substitutes. \begin{enumerate}[label=(\alph*),wide] \item \label{eg:numericalComp} Suppose that $j$ has a quasilinear utility function with valuation given by \[\val{j}{\bun} = \begin{cases} 0 & \text{if } \bun = (0,0),(0,1),(1,0)\\ 5 & \text{if } \bun = (1,1). \end{cases}\] Here, $\valFn{j}$ is not a \subst\ valuation because $\dQL{j}{\p} = \{(1,1)\}$ while $\dQL{j}{\ppr} = \{(0,0)\}$: i.e., increasing the price of the first good can lower $j$'s demand for the second good. If $\Feas{k} = \{(0,0),(0,1),(1,0)\}$ and agent $k$ has a quasilinear utility function with a \subst\ valuation given by \begin{equation} \label{eq:kUnitDem} \val{k}{\bun} = \begin{cases} 0 & \text{if } \bun = (0,0)\\ 4 & \text{if } \bun = (1,0)\\ 3 & \text{if } \bun = (0,1), \end{cases} \end{equation} then no \ce\ exists.\footnote{The existence of a feasible set of bundles of goods and a \subst\ valuation for $k$ for which no \ce\ exists follows from Fact~\ref{fac:subMaxDomain}. To check that $\valFn{k}$ is an example of such a valuation, suppose, for sake of deriving a contradiction, that $(\bunj,\bunag{k})$ is the allocation of goods in a \ce. The First Welfare Theorem implies that $\bunj = (1,1)$ and that $\bunag{k} = (0,0)$. But for agent $j$ to demand $(1,1),$ the equilibrium prices would have to sum to at most 5, while for agent $k$ to demand $(0,0)$, the equilibrium prices would both have to be at least 3---a contradiction. Hence, we can conclude that no \ce\ exists.} \item \label{eg:numericalLog} Suppose instead that $\utilFn{j}$ is quasilogarithmic (as defined in Example~\ref{eg:quasilog}) with quasivaluation given by \[\quasival{j}{\bun} = \begin{cases} -11 & \text{if } \bun = (0,0)\\ -7 & \text{if } \bun = (0,1)\\ -4 & \text{if } \bun = (1,0)\\ -1 & \text{if } \bun = (1,1). \end{cases}\] At the endowment $\bundowj = (0,1)$ of goods, $\utilFn{j}$ is not a \gsubst\ utility function as, letting $\numerdowj = 3,$ we have that $\dM{j}{\p}{\bunndowj} = \{(1,1)\}$ while $\dM{j}{\ppr}{\bunndowj} = \{(0,0)\}$.\footnote{\label{fn:evalU}To show this, note that $\numerdowj - \ppr \cdot ((1,1) - \bundowj) = -1,$ so it would violate $j$'s budget constraint to demand $(1,1)$ at the price vector $\ppr$. For the other bundles, note that \[\begin{array}{c|c|c|c|c} \bun & (0,0) & (0,1) & (1,0) & (1,1)\\ \hline \util{j}{\numerdowj - \p \cdot (\bun - \bundowj),\bun} & \log \frac{5}{11} & \log \frac{3}{7} & \log \frac{3}{4} & \log 1\\ \hline \util{j}{\numerdowj - \ppr \cdot (\bun - \bundowj),\bun} & \log \frac{5}{11} & \log \frac{3}{7} & \log \frac{1}{4} & \text{undef.,} \end{array}\] so $\dM{j}{\p}{\bunndowj} = \{(1,1)\}$ and $\dM{j}{\ppr}{\bunndowj} = \{(0,0)\}$. } That is, increasing the price of the first good can lower $j$'s Marshallian demand for the second good. By contrast, as $\quasivalFn{j}$ is a \subst\ valuation, Example~\ref{eg:quasilogSubs} implies that $\utilFn{j}$ is a \nsubst\ utility function: the \gcompity\ is entirely due to an income effect. For example, at the utility level \[\ub = \max_{\bunn \in \Feans{j} \mid \pprall \cdot \bunn \le \pprall \cdot \bunndowj} \util{j}{\bunn} = \log \frac{5}{11},\] we have that $\dH{j}{\p}{u} = \{(1,0)\}$ and that $\dH{j}{\ppr}{\ub} = \{(0,0)\}$,\footnote{The expressions for $\dH{j}{\p}{\ub}$ and $\dH{j}{\ppr}{\ub}$ hold because agent $j$'s Hicksian valuation at utility level $\ub$ is $\frac{5}{11}$ times the quasivaluation $\quasivalFn{j}$ (by Example~\ref{eg:quasilogDualVal}) } so the decrease in the Marshallian demand for the second good as prices change from $\p$ to $\ppr$ at the endowment $\bunndowj$ reflects an income effect. By Theorem~\ref{thm:netSubExist}, \ce\ exists whenever $k$ has a \nsubst\ utility function. For example, if $k$ has a quasilinear utility function with a \subst\ valuation given by Equation (\ref{eq:kUnitDem}), then for the \dowalloc\ defined by $\bundowj = (0,1)$, $\bundowag{k} = (1,0)$, and $\numerdowj = \numerdowag{k} = 3,$ the price vector $(3,2)$ and the allocation of goods defined by $\bunj = (1,0)$ and $\bunag{k} = (0,1)$ comprise a \ce.\footnote{To show this, let $\hp = (3,2)$. It is clear that $(0,1) \in \dQL{k}{\hp}$. It remains to show that $(1,0) \in \dM{j}{\hp}{\bunndowj}$. Note that $\numerdowj - \hp \cdot ((1,1) - \bundowj) = 0,$ so it would violate $j$'s budget constraint to demand $(1,1)$ at the price vector $\hp$. For the other bundles, note that \[ \util{j}{\numerdowj - \hp \cdot (\bun - \bundowj),\bun} = \begin{cases} \log \frac{5}{11} & \text{if } \bun = (0,0)\\ \log \frac{3}{7} & \text{if } \bun = (0,1)\\ \log \frac{1}{2} & \text{if } \bun = (1,0), \end{cases} \] so $\dM{j}{\hp}{\bunndowj} = \{(1,0)\}$.} \end{enumerate} \indent In Case~\ref{eg:numericalLog}, agent $j$ has \nsubst\ preferences---leading to the guaranteed existence of \ce\ when agent $k$ has \nsubst\ preferences. By contrast, in Case~\ref{eg:numericalComp}, agent $j$ does not have \nsubst\ preferences---and \ce\ may not exist when $k$ has \nsubst\ preferences. \end{example} In general, net substitutability forms a maximal domain for the existence of \ce. Specifically, if an agent does not have \nsubst\ preferences, then \ce\ may not exist when the other agents have \subst\ quasilinear preferences. \begin{proposition} \label{prop:netSubstMaxDomain} Suppose that $\totComp{i} = 1$ for all goods $i$. If $|J| \ge 2$, agent $j$ demands at most one unit of each good, and $\utilFn{j}$ is not a \nsubst\ utility function, then there exist sets $\Feas{k} \subseteq \{0,1\}^I$ of feasible bundles and \subst\ valuations $\valFn{k}: \Feas{k} \to \mathbb{R}$ for agents $k \not= j$, and \andowalloc\ for which no \ce\ exists. \end{proposition} Proposition~\ref{prop:netSubstMaxDomain} is an immediate consequence of the Equilibrium Existence Duality and the fact that \substity\ defines a maximal domain for the existence of \ce\ with transferable utility. \begin{proof} By Remark~\ref{rem:netSubDual}, there exists a utility level $\ub$ at which agent $j$'s \dualval\ $\valHDef{j}$ is not a \subst\ valuation. Fact~\ref{fac:subMaxDomain} implies that there exist feasible sets $\Feas{k} \subseteq \{0,1\}^I$ and \subst\ valuations $\valFn{k}$ for agents $k \not= j$, for which \andowalloc\ exists but no \ce\ would exist with transferable utility if agent $j$'s valuation were $\valHDef{j}$. With those sets $\Feas{k}$ of feasible bundles and valuations $\valFn{k}$ for agents $k \not= j,$ the ``only if'' direction of Theorem~\ref{thm:existDualExchange} implies that there exists \andowalloc\ for which no \ce\ exists. \end{proof} Proposition~\ref{prop:netSubstMaxDomain} entails that any domain of preferences that contains all \subst\ quasilinear preferences and guarantees the existence of \ce\ must lie within the domain of \nsubst\ preferences. Therefore, Proposition~\ref{prop:netSubstMaxDomain} and Theorem~\ref{thm:netSubExist} suggest that \nsubstity\ is the most general way to incorporate income effects into a \substity\ condition to ensure the existence of \ce. By contrast, the relationship between the nonexistence of \ce\ and failures of \gsubstity\ depends on why \gsubstity\ fails. \Gsubstity\ can fail due to substitution effects that reflect net complementarities, as in Example~\ref{eg:grossVersusNetNumerical}\ref{eg:numericalComp}, or due to income effects, as in Example~\ref{eg:grossVersusNetNumerical}\ref{eg:numericalLog}. If the failure of \gsubstity\ reflects a net complementarity, then Proposition~\ref{prop:netSubstMaxDomain} tells us that \ce\ may not exist if the other agents have \subst\ quasilinear preferences, as in Example~\ref{eg:grossVersusNetNumerical}\ref{eg:numericalComp}. On the other hand, the failure of \gsubstity\ is only due to income effects, then Theorem~\ref{thm:netSubExist} tells us that \ce\ exists if the other agents have \nsubst\ preferences (e.g., \subst\ quasilinear preferences), as in Example~\ref{eg:grossVersusNetNumerical}\ref{eg:numericalLog}. \section{Demand Types and the Unimodularity Theorem} \label{sec:demTypes} In this section, we characterize exactly what conditions on patterns of substitution effects guarantee the existence of \ce. Specifically, we consider \citeposs{BaKl:19} classification of valuations into ``demand types'' based on sets of vectors that summarize the possible ways in which demand can change in response to a small generic price change. We first review the definition of demand types from \cite{BaKl:19}. We then extend the concept of demand types to settings with income effects, and develop a version of the \citeposs{BaKl:19} Unimodularity Theorem that allows for income effects and characterizes which demand types guarantee the existence of \ce\ (see also \cite{DaKoMu:01}). A special case of the Unimodularity Theorem with Income Effects extends Theorem~\ref{thm:netSubExist} to settings in which agents can demand multiple units of some goods. \subsection{Demand Types and the Unimodularity Theorem with Transferable Utility} \label{sec:demTypesTU} We first review the concept of demand types for quasilinear settings, as developed by \citet{BaKl:19}. An integer vector is \emph{primitive} if the greatest common divisor of its components is 1. By focusing on the directions of demand changes, we can restrict to primitive demand change vectors. A \emph{\dtvs} is a set $\mathcal{D} \subseteq \mathbb{Z}^I$ of primitive \intvecs\ such that if $\dvec \in\mathcal{D}$ then $- \dvec \in\mathcal{D}$. \begin{definition}[Demand Types for Valuations] \label{def:demTypeTU} Let $\valFn{j}$ be a valuation. \begin{enumerate}[label=(\alph*)] \item A bundle $\bun$ is \emph{uniquely demanded by agent $j$} if there exists a price vector $\p$ such that $\dQL{j}{\p} = \{\bun\}.$ \item A pair $\{\bun,\bunpr\}$ of uniquely demanded bundles are \emph{adjacently demanded by agent $j$} if there exists a price vector $\p$ such that $\dQL{j}{\p}$ contains $\bun$ and $\bunpr$ but no other bundle that is uniquely demanded by agent $j$. \item If $\mathcal{D}$ is a \dtvs, then $\valFn{j}$ is \emph{of demand type $\mathcal{D}$} if for all pairs $\{\bun,\bunpr\}$ that are adjacently demanded by agent $j$, the difference $\bunpr - \bun$ is a multiple of an element of $\mathcal{D}$.\footnote{Definition~\ref{def:demTypeTU}(c) coincides with Definition 3.1 in \cite{BaKl:19} by Proposition 2.20 in \cite{BaKl:19}.} \end{enumerate} \end{definition} \begin{figure} \centering \def0.4\columnwidth{0.4\columnwidth} \input{Fig1.eps_tex} \caption{Depiction of Agent $j$'s Demand in Example~\ref{eg:demTypeDef}. The labels indicate demand in the regions of price vectors at which demand is single-valued.} \label{fig:demTypeDef} \end{figure} For intuition, suppose that a small price change causes a change in demand. Then, generically, demand changes between adjacently demanded bundles. Thus, the demand type vectors represent the possible directions of changes in demand in response to small generic price changes (see Proposition 3.3 in \cite{BaKl:19} for a formal statement). To illustrate Definition~\ref{def:demTypeTU}, we consider an example. \begin{example} \label{eg:demTypeDef} Suppose that there are two goods and let \[\Feas{j} = \{0,1,2,3\}^2 \ssm \{(2,3),(3,2),(3,3)\}.\] Consider the valuation defined by $\val{j}{\bun} = \bunComp{1} + \bunComp{2}$. As Figure~\ref{fig:demTypeDef} illustrates, the uniquely demanded bundles are $(0,0)$, $(0,3),$ $(1,3),$ $(3,0)$, and $(3,1)$. When $1 = \pComp{1} < \pComp{2},$ agent $j$'s demand is $\dQL{j}{\p} = \{(0,0),(1,0),(2,0),(3,0)\}$. Hence, as the bundles $(1,0)$ and $(2,0)$ are not uniquely demanded, the bundles $(0,0)$ and $(3,0)$ are adjacently demanded. As a result, for $\valFn{j}$ to be of demand type $\mathcal{D}$, the set $\mathcal{D}$ must contain the vector $(1,0)$, which is the primitive \intvec\ proportional to the demand change $(3,0) - (0,0) = (3,0)$. Similarly, the bundles $(0,0)$ and $(0,3)$ are adjacently demanded, and any \dtvs\ $\mathcal{D}$ such that $\valFn{j}$ is of demand type $\mathcal{D}$ must contain the vector $(0,1)$. When $\pComp{1} < \pComp{2} = 1,$ demand is $\dQL{j}{\p} = \{(3,0),(3,1)\}$. Hence, the bundles $(3,0)$ and $(3,1)$ are adjacently demanded. Similarly, the bundles $(0,3)$ and $(1,3)$ are adjacently demanded. These facts respectively imply, again, that $(0,1)$ and $(1,0)$ are in any \dtvs\ $\mathcal{D}$ such that $V^j$ is of demand type $\mathcal{D}$. Last, when $p_1 = p_2 < 1,$ agent $j$'s demand is $\dQL{j}{\p} = \{(1,3),(2,2),(3,1)\}$. Hence, as the bundle $(2,2)$ is not uniquely demanded, the bundles $(1,3)$ and $(3,1)$ are adjacently demanded. As a result, for $\valFn{j}$ to be of demand type $\mathcal{D}$, the set $\mathcal{D}$ must contain the vector $(1,-1)$, which is the primitive \intvec\ proportional to the demand change $(3,1) - (1,3) = (2,-2)$. By contrast, the bundles $(0,0)$ and $(3,1)$ are not adjacently demanded: the only price vector at which agent $j$ demands them both is $\p = (1,1),$ but $\dQL{j}{1,1}$ also contains the uniquely demanded bundles $(0,3)$, $(1,3),$ and $(3,0)$. Similarly, the bundles $(0,0)$ and $(1,3)$ are not adjacently demanded. Hence, \begin{equation*} \mathcal{D} = \pm \left\{\begin{bmatrix}1 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 1\end{bmatrix}, \begin{bmatrix} 1 \\ -1\end{bmatrix}\right\} \end{equation*} is the minimal \dtvs\ $\mathcal{D}$ such that $\valFn{j}$ is of demand type $\mathcal{D}$. \end{example} Consider any valuation of the same demand type $\mathcal{D}$ as in Example \ref{eg:demTypeDef}, and a change in price from $\p$ to $\ppr=\p+\lambda \e{1}$ for some $\lambda>0$. For generic choices of $\p$ and $\lambda$, the demand at any price on the straight line from $\mathbf{p}_I$ to $\mathbf{p}_I'$ either is unique, or demonstrates the adjacency of two bundles uniquely demanded at prices on this line. The change in demand between such bundles must therefore be a multiple of an element of $\mathcal{D}$ (by Definition \ref{def:demTypeTU}). Moreover, since only the price of good 1 is changing and that price is increasing, the law of demand entails that demand for good 1 must strictly decrease upon any change in demand.\footnote{As there are no income effects here, the compensated law of demand (see, e.g., Proposition 3.E.4 in \cite{MaWhGr:95}) reduces to the law of demand.} Thus, the change in demand between the two consecutive uniquely demanded bundles must be a positive multiple of either $(-1,0)$ or $(-1,1)$. Therefore, demand for good 2 must (weakly) increase, reflecting \substity\ between the goods. This two-good example is a special case of an important class of demand types. \begin{example}[The Strong Substitutes Demand Type] \label{eg:ssubDemType} The \emph{strong substitutes \dtvs} consists of all vectors in $\mathbb{Z}^I$ with at most one $+1$ component, at most one $-1$ component, and no other nonzero components. As illustrated in Example~\ref{eg:demTypeDef}, this \dtvs\ captures one-to-one substitution between goods through demand type vectors with one component of $1$ and one component of $-1$. Furthermore, if an agent $k$ demands at most one unit of each good, then $\valFn{k}$ is a \subst\ valuation if and only if it is of the strong substitutes demand type (see Theorems 2.1 and 2.4 in \cite{fujishige2003note}). \end{example} In settings in which agents can demand multiple units of each good, a form of concavity is needed to ensure the existence of \ce. A valuation is concave if, under that valuation, each bundle of goods that is a convex combination of feasible bundles of goods is demanded at some price vector. For the formal definition, we let $\conv(T)$ denote the \emph{convex hull} of a set $T \subseteq \mathbb{R}^I.$ \begin{definition}[Concavity]\label{def:concave} A valuation $\valFn{j}$ is \emph{concave} if for each bundle $\bun \in \conv(\Feas{j}) \cap \mathbb{Z}^n,$ there exists a price vector $\p$ such that $\bun \in \dQL{j}{\p}$. \end{definition} In Section~\ref{sec:subOld}, we discussed that \substity\ guarantees the existence of \ce\ in transferable utility economies when agents demand at most one unit of each good. Generalizing that result, \citet{BaKl:19} identified a necessary and sufficient condition for the concave valuations of a demand type to form a domain for the guaranteed existence of \ce. \begin{definition}[Unimodularity] A set of vectors in $\mathbb{Z}^I$ is \emph{unimodular} if every linearly independent subset can be extended to be a basis for $\mathbb{R}^I$, of \intvecs, such that any square matrix whose columns are these vectors has determinant $\pm 1$. \end{definition} For example, the \dtvs\ in Example~\ref{eg:demTypeDef} is unimodular, while the \dtvs\ \begin{equation} \label{eq:subsComp} \pm \left\{\begin{bmatrix} 1 \\ -1\end{bmatrix}, \begin{bmatrix}1 \\ 1\end{bmatrix}\right\} \end{equation} is not unimodular, because \[\left|\begin{matrix} 1 & 1\\ -1 & 1 \end{matrix}\right| = 2.\] The \dtvs\ in (\ref{eq:subsComp}) represents that the two goods can be substitutable or complementary for agents---a possibility that can cause \ce\ to fail to exist, as in Example~\ref{eg:grossVersusNetNumerical}\ref{eg:numericalComp}. \cite{BaKl:19} showed that the unimodularity of a \dtvs\ is precisely the condition for the corresponding demand type to guarantee the existence of \ce. \begin{fact}[Unimodularity Theorem with Transferable Utility] \label{fac:unimod} Let $\mathcal{D}$ be a \dtvs. \Ces\ exist for all finite sets $J$ of agents with concave valuations of demand type $\mathcal{D}$ and for all total endowments for which \dowallocs\ exist if and only if $\mathcal{D}$ is unimodular.\footnote{\label{fn:classDiscConv}The ``if'' direction of Fact~\ref{fac:unimod} is a case of the ``if" direction of Theorem 4.3 in \cite{BaKl:19}. The ``only if'' direction of Fact~\ref{fac:unimod}, which we prove in Appendix~\ref{app:maxDomain}, is a mild strengthening of the ``only if" direction of Theorem 4.3 in \cite{BaKl:19} that applies in exchange economies.} \end{fact} \cite{DaKoMu:01} used conditions on the ranges of agents' demand correspondences to describe classes of concave valuations, which correspond to the concave valuations of \citeposs{BaKl:19} unimodular demand types;\footnote{To understand the correspondence, let $\mathcal{D}$ be a unimodular \dtvs. In the terminology of \cite{DaKoMu:01}, a valuation $\valFn{j}$ is \emph{$\mathscr{D}(\mathscr{P}t(\mathcal{D},\mathbb{Z}))$-concave} if, for each price vector $\p$, we have that $\dQL{j}{\p} = \conv(\dQL{j}{\p}) \cap \mathbb{Z}^I$ and each edge of $\conv(\dQL{j}{\p})$ is parallel to an element of $\mathcal{D}$ (see Definition 4 and pages 264--265 in \cite{DaKoMu:01}). It follows from Lemma 2.11 and Proposition 2.16 in \cite{BaKl:19} that a valuation is $\mathscr{D}(\mathscr{P}t(\mathcal{D},\mathbb{Z}))$-concave if and only if it is concave and of demand type $\mathcal{D}$.} they formulated a version of the ``if" direction of Fact~\ref{fac:unimod} with those conditions.\footnote{See Definition 4, Theorem 3, and pages 264--265 in \cite{DaKoMu:01}.} As \cite{poincare1900second} showed, the strong substitutes \dtvs\ is unimodular. Therefore, in light of Example~\ref{eg:ssubDemType}, the existence of \ce\ in transferable utility economies in which agents demand at most one unit of each good and have substitutes valuations (Fact~\ref{fac:subExist}) is a special case of Fact~\ref{fac:unimod}. Moreover, Fact~\ref{fac:unimod} is strictly more general: as \cite{BaKl:19} showed, there are unimodular \dtvs{s} for which the existence of \ce\ cannot be deduced from the corresponding result for strong substitutes by applying a change of basis to the space of bundles of goods.\footnote{By contrast, the existence results of \cite{SuYa:06} and \cite{Teyt:14} can be deduced from Fact~\ref{fac:subExist} applying an appropriate change of basis. Those results are also special cases of Fact~\ref{fac:unimod}.} To illustrate the additional generality, we discuss an example of such a demand type.\footnote{Section 6.1 in \cite{BaKl:19} provides another example that includes only complements valuations.} \begin{example} \label{eg:5D} There are five goods. Consider the \dtvs\ \[\mathcal{D} = \pm\left\{\begin{bmatrix}1 \\ 0 \\ 0 \\ 0 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 1 \\ 0 \\ 0 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 0 \\ 1 \\ 0 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 0 \\ 0 \\ 1 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 0 \\ 0 \\ 0 \\ 1\end{bmatrix}, \begin{bmatrix}1 \\ -1 \\ 1 \\ 0 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 1 \\ -1 \\ 1 \\ 0\end{bmatrix}, \begin{bmatrix}0 \\ 0 \\ 1 \\ -1 \\ 1\end{bmatrix}, \begin{bmatrix}1 \\ 0 \\ 0 \\ 1 \\ -1\end{bmatrix}, \begin{bmatrix}-1 \\ 1 \\ 0 \\ 0 \\ 1\end{bmatrix}\right\}.\] Intuitively, this \dtvs\ allows for independent changes in the demand for each good (through the first five vectors), as well as for substitution from a good to the bundle consisting of its two neighbors if the goods are arranged in a circle (through the last five vectors). This \dtvs\ is unimodular, and cannot be obtained from the strong substitutes \dtvs\ by a change of basis of the space of integer bundles of goods (see, e.g., Section 19.4 of \cite{schrijver1998theory}). \end{example} Moreover, the demand types defined by maximal, unimodular \dtvs{s} turn out to define maximal domains for the existence of \ce\ in settings with transferable utility. Here, we say that a unimodular \dtvs\ is \emph{maximal} if it is not strictly contained in another unimodular \dtvs. \begin{fact} \label{fac:unimodMaxDomain} Let $\mathcal{D}$ be a maximal unimodular \dtvs. If $|J| \ge 2$ and $\valFn{j}$ is non-concave or not of demand type $\mathcal{D}$, then there exist sets $\Feas{k}$ of feasible bundles and concave valuations $\valFn{k}: \Feas{k} \to \mathbb{R}$ of demand type $\mathcal{D}$ for agents $k \not= j$, as well as a total endowment, for which there exists \andowalloc\ but no \ce.\footnote{Fact~\ref{fac:unimodMaxDomain} is related to Proposition 6.10 in \cite{BaKl:14}, which connects failures of unimodularity to the non-existence of \ce\ in specific economies. We supply a proof of Fact~\ref{fac:unimodMaxDomain} in Appendix~\ref{app:maxDomain}.} \end{fact} While Fact~\ref{fac:unimod} shows that there exist valuations in each non-unimodular demand type for which \ce\ does not exist, Fact~\ref{fac:unimodMaxDomain} shows that for \emph{every} valuation outside a maximal unimodular demand type, there exist concave valuations within the demand type that lead to non-existence. Hence, the necessity direction of Fact~\ref{fac:unimod}, together with Fact~\ref{fac:unimodMaxDomain}, provide complementary perspectives on the way in which \ce\ can fail to exist outside the context of unimodular demand types. \subsection{Demand Types and the Unimodularity Theorem with Income Effects} We now use Fact~\ref{fac:dualPrefs} to extend the demand types framework to settings with income effects \begin{definition}[Demand Types with Income Effects] \label{def:demTypeIncEff} An agent's preferences are \emph{of demand type $\mathcal{D}$} if her \dualvals\ at all utility levels are of demand type $\mathcal{D}$ \end{definition} Lemma~\ref{lem:dHvalH} leads to an economic interpretation of Definition~\ref{def:demTypeIncEff}: a utility function is of demand type $\mathcal{D}$ if $\mathcal{D}$ summarizes the possible ways in which Hicksian demand can change in response to a small generic price change. In particular, Definition~\ref{def:demTypeIncEff} extends the concept of demand types to settings with income effects by placing conditions on substitution effects. Indeed, Definition~\ref{def:demTypeIncEff} considers only the properties of \dualvals\ at each utility level (which, by Lemma~\ref{lem:dHvalH}, reflect substitution effects), and not how an agent's \dualvals\ vary with her utility level (which, by Fact~\ref{fac:dualDem} and Lemma~\ref{lem:dHvalH}, reflects income effects). \cite{DaKoMu:01} translated their conditions on the ranges of agents' demand correspondences from quasilinear settings to settings with income effects by using Fact~\ref{fac:dualPrefs} in an analogous manner (see Assumption 3$'$ in \cite{DaKoMu:01}). However, the economic interpretation in terms of substitution effects that Lemma~\ref{lem:dHvalH} leads to was not clear from \citeposs{DaKoMu:01} formulation. As with the case of transferable utility, a concavity condition is needed to ensure the existence of \ce. With income effects, the relevant condition is a version of the quasiconcavity condition from classical demand theory for settings with indivisible goods. We define quasiconcavity based on concavity and duality.\footnote{It is equivalent to define quasiconcavity in terms of the convexity of the upper contour sets, but Definition \ref{def:quasiConc} is more immediately applicable for us.} \begin{definition}[Quasiconcavity] \label{def:quasiConc} An agent's utility function is \emph{quasiconcave} if her \dualvals\ at all utility levels are concave. \end{definition} As with the case of transferable utility, unimodularity is a necessary and sufficient condition for the existence of \ce\ to be guaranteed for all quasiconcave preferences of a demand type when income effects are present. \begin{theorem}[Unimodularity Theorem with Income Effects] \label{thm:unimod} Let $\mathcal{D}$ be a \dtvs. \Ces\ exist for all finite sets $J$ of agents with quasiconcave utility functions of demand type $\mathcal{D}$, for all total endowments, and for all \dowallocs\ if and only if $\mathcal{D}$ is unimodular. \end{theorem} The ``only if'' direction of Theorem~\ref{thm:unimod} is a special case of the Unimodularity Theorem with Transferable Utility (Fact~\ref{fac:unimod}). The ``if'' direction of Theorem~\ref{thm:unimod} is an immediate consequence of the Equilibrium Existence Duality and Fact~\ref{fac:unimod}. \begin{proof}[Proof of the ``if" direction of Theorem~\ref{thm:unimod}] Consider a finite set $J$ of agents with quasiconcave preferences of demand type $\mathcal{D}$ and a total endowment for which \andowalloc\ exists. By definition, the agents' \dualval{s} at all utility levels are concave and of demand type $\mathcal{D}$. Hence, \ces\ exist in the \dualecons\ for all profiles of utility levels by the ``if'' direction of Fact~\ref{fac:unimod}. By the ``if'' direction of Theorem~\ref{thm:existDualExchange}, \ces\ must therefore exist in the original economy for all \dowallocs. \end{proof} \cite{DaKoMu:01} proved a version of the ``if'' direction of Theorem~\ref{thm:unimod} under the assumptions that utility functions are monotone in goods, that consumption of goods is nonnegative, and that the total endowment is strictly positive (see Theorems 2 and 4 in \cite{DaKoMu:01}).\footnote{\citeposs{DaKoMu:01} existence result is not formally a special case of ours because they allowed for unbounded sets $\Feas{j}$ of feasible bundles of goods.} Note that they formulated their result in terms of Fact~\ref{fac:dualPrefs} and a condition on the ranges of demand correspondences (see their Assumption 3$'$) instead of in terms of unimodular demand types. \citeposs{DaKoMu:01} approach was to show the existence of \ce\ in a convexified economy and that, under unimodularity, \ces\ in the convexified economy give rise to \ces\ in the original economy. In contrast, our approach of using the Equilibrium Existence Duality illuminates the role of substitution effects in ensuring the existence of \ce. Moreover, it yields a maximal domain result for unimodular demand types with income effects. \begin{proposition} \label{prop:netUnimodMaxDomain} Let $\mathcal{D}$ be a maximal unimodular \dtvs. If $|J| \ge 2$ and $\utilFn{j}$ is not quasiconcave or not of demand type $\mathcal{D}$, then there exist sets $\Feas{k}$ of feasible bundles and concave valuations $\valFn{k}: \Feas{k} \to \mathbb{R}$ of demand type $\mathcal{D}$ for agents $k \not= j$, as well as a total endowment and \andowalloc, for which no \ce\ exists. \end{proposition} Proposition~\ref{prop:netUnimodMaxDomain} is an immediate consequence of the Equilibrium Existence Duality and the maximal domain result for unimodular demand types under the transferability of utility. \begin{proof} By definition, there exists a utility level $\ub$ at which agent $j$'s \dualval\ $\valHDef{j}$ is non-concave or not of demand type $\mathcal{D}$. In either case, Fact~\ref{fac:unimodMaxDomain} implies that there exist sets $\Feas{k}$ of feasible bundles and concave valuations $\valFn{k}: \Feas{k} \to \mathbb{R}$ of demand type $\mathcal{D}$ for agents $k \not= j$, and a total endowment for which \andowalloc\ exists but no \ce\ would exist with transferable utility if agent $j$'s valuation were $\valHDef{j}$. With those sets $\Feas{k}$ of feasible bundles and valuations $\valFn{k}$ for agents $k \not= j$ and that total endowment, the ``only if" direction of Theorem~\ref{thm:existDualExchange} implies that there exists \andowalloc\ for which no \ce\ exists. \end{proof} Intuitively, Proposition~\ref{prop:netUnimodMaxDomain} and Theorem~\ref{thm:unimod} suggest that Definition~\ref{def:demTypeIncEff} is the most general way to incorporate income effects into unimodular demand types from the quasilinear setting and ensure the existence of \ce. Indeed, Proposition~\ref{prop:netUnimodMaxDomain} entails that any domain of preferences that contains all concave quasilinear preferences of a maximal, unimodular demand type and guarantees the existence of \ce\ must lie within the corresponding demand type constructed in Definition~\ref{def:demTypeIncEff}. \subsection{The Strong Substitutes Demand Type and Net \Substity\ with Multiple Units} \label{sec:ssub} We now use the case of Theorem~\ref{thm:unimod} for the strong substitutes demand type to extend Theorem~\ref{thm:netSubExist} to settings in which agents can demand multiple units of some goods. In such settings, if utility is transferable, the \substity\ condition needed to ensure the existence of \ce\ is \emph{\ssubstity}---the condition requiring that agents see units of goods as \subst\ \citep{MiSt:09}. As \cite{shioura2015gross} and \cite{BaKl:19} showed, there is a close relationship between strong (net) \substity\ and the strong substitutes demand type.\footnote{Requiring that different goods, rather than different units of goods, be \subst\ leads to a condition called \emph{\osubstity}. However, \osubstity\ does not ensure the existence of \ce\ when agents can demand multiple units of some goods \citep*{DaKoLa:2003,MiSt:09,BaKl:19}. \Osubstity\ in turn corresponds to an ``ordinary substitutes'' demand type (see Definitions 3.4 and 3.5 and Proposition 3.6 in \cite{BaKl:19}).} \begin{definition}[\SSubstity] \begin{enumerate}[label=(\alph*)] \item A valuation is a \emph{\ssubst\ valuation} if it corresponds to a \subst\ valuation when each unit of each good is regarded as a separate good. \item A utility function is a \emph{\snsubst\ utility function} if it corresponds to a \nsubst\ utility function when each unit of each good is regarded as a separate good. \end{enumerate} \end{definition} \begin{fact} \label{fac:ssubDemTypeConc} A valuation (resp.~utility function) is a strong (net) \subst\ valuation (resp. utility function) if and only if it is concave (resp.~quasiconcave) and of the strong substitutes demand type.\footnote{The quasilinear case of this fact is part of Theorem 4.1(i) in \cite{shioura2015gross} (see also Proposition 3.10 in \cite{BaKl:19}). The general case follows from the quasilinear case by Lemma~\ref{lem:dHvalH} and Remark~\ref{rem:netSubDual}.}\footnote{In particular, if agent $j$ demands at most one unit of each good, then $\utilFn{j}$ is a \nsubst\ utility function if and only if it is of the strong substitutes demand type.} \end{fact} As the strong substitutes \dtvs\ is unimodular \citep{poincare1900second}, the existence of \ce\ under \snsubstity\ is therefore a special case of the Unimodularity Theorem with Income Effects. \begin{corollary} \label{cor:snsubExist} If all agents have \snsubst\ utility functions, then \ces\ exist for all \dowallocs. \end{corollary} Corollary~\ref{cor:snsubExist} can also be proven directly using the Equilibrium Existence Duality and the existence of \ce\ under \ssubstity\ in transferable utility economies \citep{MiSt:09,ikebe2015stability}. Theorem~\ref{thm:netSubExist} is the special case of Corollary~\ref{cor:snsubExist} for settings in which agents demand at most one unit of each good. As there are unimodular \dtvs{s} unrelated to the strong substitutes \dtvs\ (such as the one in Example~\ref{eg:5D}), Theorem~\ref{thm:unimod} is strictly more general than Corollary~\ref{cor:snsubExist} (and hence Theorem~\ref{thm:netSubExist}). In particular, Theorem~\ref{thm:unimod} also illustrates that certain patterns of net complementarities can also be compatible with the existence of \ce. As the strong substitutes \dtvs\ is maximal as a unimodular \dtvs\ (see, e.g., Example 9 in \cite{danilov2004discrete}), Proposition~\ref{prop:netUnimodMaxDomain} yields a maximal domain result for \snsubstity. \begin{corollary} \label{cor:snsubMax} If $|J| \ge 2$ and $\utilFn{j}$ is not a \snsubst\ utility function, then there exist \ssubst\ valuations $\valFn{k}$ for agents $k \not= j$, as well as a total endowment and \andowalloc, for which no \ce\ exists. \end{corollary} \section{Auction Design} \label{sec:auctions} \defcitealias{baldwin2020implementing}{Baldwin and Klemperer (in preparation)} Our work has several implications for auction design. First, our perspective of analyzing preferences by using the expenditure\-/minimization problem may yield new approaches for extending auction bidding languages to allow for income effects. Second, our equilibrium existence results suggest that some auctions with competitive equilibrium pricing may work well for indivisible goods even in the presence of financing constraints. One set of examples are Product-Mix Auctions, such as the one implemented by the Bank of England\footnote{See \cite{klemperer2008new,klemperer2010product,klemperer2018product} and \citetalias{baldwin2020implementing}. Iceland planned a Product-Mix Auction for bidders with budget constraints \citep{klemperer2018product}, but that auction was for a setting with divisible goods.}---these implement competitive equilibrium allocations assuming that the submitted sealed bids represent bidders' actual preferences, since truth-telling is a reasonable approximation in these auctions when there are sufficiently many bidders. However, while we have shown that gross complementarities do not lead to the nonexistence of competitive equilibrium, they do create problems for dynamic auctions. When agents see goods as gross substitutes, iteratively increasing the prices of over-demanded goods leads to a competitive equilibrium \citep{KeCr:82,FlJaJaTe:19}. In contrast, when there are gross complementarities between goods, increases in the price of an over-demanded good can lead to other goods being under-demanded due to an income effect. So, even though competitive equilibrium always exists when agents see goods as (strong) net substitutes, it may not be possible to find a competitive equilibrium using a monotone, dynamic auction. In particular, simple ``activity rules'' that require bidders to bid on a smaller total number of units of goods as prices increase may result in inefficient outcomes. So, the Product-Mix Auction approach of finding competitive equilibrium based on a single round of sealed bids seems especially useful in the presence of income effects. \section{Conclusion} \label{sec:conclusion} The Equilibrium Existence Duality is a useful tool for analyzing economies with indivisible goods. It is based on the relationship between Marshallian and Hicksian demands, and on an interpretation of Hicksian demand in terms of a quasilinear maximization problem. The Equilibrium Existence Duality shows that competitive equilibrium exists (for all endowment allocations) if and only if competitive equilibrium exists in each of a family of Hicksian economies. An application is that it is net substitutability, not gross substitutability, that is relevant to the existence of equilibrium. And extending the demand types classification of valuations \citep{BaKl:19} allows us to state a Unimodularity Theorem with Income Effects that gives conditions on the patterns of substitution effects that guarantee the existence of competitive equilibrium. In short, with income effects, just as without them, existence does not depend on agents seeing goods as substitutes; rather, substitution effects are fundamental to the existence of competitive equilibrium. Our results point to a number of potential directions for future work. First, it would be interesting to investigate applications of the Equilibrium Existence Duality to other results on the existence of equilibrium with transferable utility---such as those of \cite{BiMa:97}, \cite{Ma:98}, and \cite{CaOzPa:15}. Second, our results could be used to further develop auction designs that find competitive equilibrium outcomes given the submitted bids, such as \citeposs{klemperer2008new} Product-Mix Auction. More broadly, our approach may lead to new results about the properties of economies with indivisibilities and income effects.
\section{Introduction} \label{sec:intro} \begin{figure*} \centering \begin{minipage}[t]{0.49\linewidth} \centering \includegraphics[height=5cm]{figs/dspn_fig_v21.pdf} \vspace{-4.5em} \caption{ \glsreset{DSPN}\Gls{DSPN} starts with a deterministic set that is gradually changed into the desired prediction with gradient descent on a learned loss function. } \label{fig:dspn} \end{minipage} \hfill \begin{minipage}[t]{0.49\linewidth} \centering \includegraphics[height=5cm]{figs/transformer_dspn_fig.pdf} \vspace{-5.5em} \caption{ Our \glsreset{TSPN}\gls{TSPN} extends \gls{DSPN} to use more expressive permutation-equivariant set transformations based on the Transformer \cite{Vaswani2017transformer}. Additionally, \gls{TSPN} explicitly learns the set cardinality, which allows it to generalize to much larger sets. } \label{fig:transformer} \end{minipage} \end{figure*} It is natural to reason about a group of objects as a set. Therefore many machine learning tasks involving predicting objects or their properties can be cast as a set prediction problem. These predictions are usually conditioned on some input feature that can take the form of a vector, a matrix or a set. Some examples include predicting future states for a group of molecules in a simulation \cite{No2020molecular}, object detection from images \cite{Carion2020detr} and generating correlated samples for sequential Monte Carlo in object tracking \cite{Zhu2020diffresampling,Neiswanger2014dependent}. Elements of a set are unordered, which brings about two challenges that set prediction faces. First, the model must be permutation-equivariant; that is, the generation of a particular permutation of the set elements must be equally probable to any other permutation. Second, training a generative model for sets typically involves comparing a predicted set against a ground-truth set. Since the result of this comparison should not depend on the permutation of the elements of either set, the loss function used for training must be permutation-invariant. While it is possible to create a set model that violates either or both of these requirements, such a model has to \emph{learn} to meet them, which is likely to result in lower performance. Permutation equivariance imposes a constraint on the structure of the model \cite{Bloemreddy2018exchangable,Bloemreddy2019probabilistic}, and therefore sets are often treated as an ordered collection of items, which allows using standard machine learning models. For example assuming that a set has a fixed size, we can treat it as a tensor and turn set-prediction into multivariate regression \cite{Achlioptas2018aae}. If the ordering is fixed but the size is not, we can treat set prediction as a sequence prediction problem \cite{Vinyals2016seq2set}. Both approaches require using permutation-invariant loss functions to allow the model to learn a deterministic ordering policy \cite{Eslami2016air}. However imposing such an ordering can lead to a pathology that is commonly referred to as the \textit{responsibility problem} \citep{Zhang2019dspn, Zhang2020fspool}; there exist points in the output set space where a small change in set space (as measured by a set loss) requires a large change in the generative model's output. This can lead to sub-optimal performance, as shown in \citet{Zhang2020fspool}. Some approaches choose to learn the ordering of set elements \cite{Rezatofighi2018dpspn}, but this also suffers the same problem as well as adding further complexity to the set prediction problem. Recently, \citet{Zhang2019dspn} introduced the \glsreset{DSPN}\gls{DSPN}---a model that generates sets in a permutation-equivariant manner using permutation-invariant loss functions. \Gls{DSPN} relies on the observation that the gradient of a permutation-invariant function is equivariant with respect to the permutation of its inputs, also noticed by \citet{Papamakarios2019flowreview}. \Gls{DSPN} uses this insight to generate a set by gradient-descent on a learned loss function with respect to an initially-guessed set. \Gls{DSPN} has several limitations, however. The functional form of the update step is limited, as the gradient information is only used to tanslate the set elements. This, in turn, means that the method can be computationally costly: not only is the backward pass expensive, but many such passes might be needed to arrive at an accurate prediction. In this paper we develop the \glsreset{TSPN}\gls{TSPN}, where we replace the gradient-based updates of \gls{DSPN} with a Transformer \cite{Vaswani2017transformer}, that is also permutation-equivariant and learns to jointly update the elements of the initial set. We make the following contributions: \begin{itemize}[leftmargin=*] \setlength\itemsep{-.25em} \item We show that the set-cardinality learning method of \citet{Zhang2019dspn} is prone to falling into local minima. \item We thus introduce an alternative, principled method for learning set cardinality. \item We learn a distribution over the elements of the initial set (as opposed to \gls{DSPN} that learns a fixed initial set). This allows one to directly generate sets with cardinality determined by the model (by sampling the correct number of points), and to dynamically change the size of the generated sets as test time. \item We demonstrate that \gls{TSPN} outperforms \gls{DSPN} on conditional point-cloud generation and object-detection tasks. \end{itemize} We show that our model is not only more expressive than the \gls{DSPN}, but can also generalize at test-time to sets of vastly different cardinality than the sets encountered during training. We evaluate our model on auto-encoding \gls{SETMNIST} \cite{Lecun2010mnist} and on object detection on \gls{CLEVR} \cite{Johnson2017clevr}. We now proceed to describe \gls{DSPN} and our method \gls{TSPN} in detail, followed by experiments. \section{Permutation-Equivariant Set Generation} \label{sec:background} \subsection{Permutation-Equivariant Generator} The \glsreset{DSPN}\gls{DSPN} iteratively transforms an initial set into the final prediction, and the transformation is conditioned on some input. That is, given a conditioning $\by \in \RR^{d_y}$ and an initial set $\bx \coloneqq \set{\bx_i^0}_{i=1}^N$ of $N$ points in $\RR^d$, \gls{DSPN} iteratively applies a permutation-equivariant $f$ to transform this initial set into the final prediction $\bx^K \coloneqq \set{\bx_i^K}_{i=1}^N$ over $K$ iterations: \begin{equation} \set{\bx_i^K}_{i=1}^N = f^K\left(\set{\bx_i^0}_{i=1}^N, \by\right)\,.% \end{equation} In \gls{DSPN}, the points $\bx_i^0$ are initialised randomly as model parameters and learned, hence the model assumes fixed set cardinality. For handling variable set sizes, each element of the predicted set is augmented with a \textit{presence} variable $p_i \in \interval{0, 1}$, which are transformed by $f$ along with the $x_i$ and then thresholded to give the final prediction. The ground-truth sets are padded with all-zero vectors to the same size. Note, however, that this mechanism does not allow to extrapolate to set sizes beyond the maximum size encountered in training. \Gls{DSPN} employs a permutation-invariant set encoder (e.g.\ deep-sets \cite{Zaheer2017deepset}, relation networks \cite{Santoro2017relnet}) to produce a set embedding, and updates the initial prediction using the gradients of an embedding loss, arriving at a permutation-equivariant final prediction. This leads to the following set-generation procedure. Given the input embedding $\bm{h} = \operatorname{\mathrm{input\_encoder}}(\by)$, an initial set\footnote{We drop the explicit indication of cardinality to avoid clutter.} $\bx^0$, and a permutation-invariant $\mathrm{set\_encoder}$, we can arrive at the final prediction by performing gradient descent, \begin{align} \widehat{\bm{h}}^k &= \operatorname{\mathrm{set\_encoder}} \left( \bx^k \right)\,,\\ \bx^{k} = \bx^{k-1} - \lambda &\nabla_\set{\bx} \operatorname{d}(\bm{h}, \widehat{\bm{h}}^{k-1}) \text{ for } k=1,\ldots,K\,, % \end{align} with step size $\lambda~\in~\RR_+$, distance function $d$ and number of iterations $K$. The final prediction is $\bx^K$. This set-generator can be used as a decoder of an autoencoding framework (with a permutation-invariant $\mathrm{input\_encoder}$) as well as for any conditional set-prediction task (\eg in object-detection where $\by$ is an image and $\mathrm{input\_encoder}$ is a \textsc{CNN}). \subsection{Permutation-Invariant Loss} \label{sec:loss} The model is trained using a set loss, i.e.\ a permutation-invariant loss. Common choices are the Chamfer loss or the Hungarian loss: \begin{align} \loss[\mathrm{cham}](A, B) &= \sum_{a \in A} \min_{b \in B} \operatorname{d}(a, b) + \sum_{b \in B} \min_{a \in A} \operatorname{d}(a, b) \label{eq:chamfer}\\ \loss[\mathrm{hung}](A, B) &= \min_{\pi \in P} \sum_{a_i \in A} \operatorname{d}(a_i, b_{\operatorname{\pi}(i)}) \label{eq:hungarian}\,, \end{align} where $\pi$ is a permutation in the space of all possible permutations $P$ and $d$ can be any distance or loss function defined on pairs of set points. Note that the computational complexity of the Chamfer loss is $O(N^2)$ for sets of size $N$, whereas the Hungarian loss is $O(N^3)$---it uses the Hungarian algorithm to compute the optimal permutation, whose complexity is $\mathcal{O}(N^3)$ \cite{Bayati2008mwn}. Hence the Chamfer loss is suitable for larger sets, and the Hungarian loss for smaller sets. For $d$, \citet{Zhang2019dspn} use the Huber loss defined as $\operatorname{d}(\bm{a}, \bm{b}) = \sum_i \min\left(\nicefrac{1}{2}(a_i-b_i)^2, |a_i-b_i| - \nicefrac{1}{2}\right)$\,. Recall that in the implementation of \gls{DSPN}, the ground truth set is padded with zero vectors so that all sets have the same size. Padding a set $A$ to a fixed size with constant elements $\widehat{a}$ turns it into a \textit{multiset} $\widehat{A}$. A Multiset is a set that contains repeated elements, that can be represented by an augmented set where each unique element is paired with its multiplicity. If we use a multiset in its default form (\ie with repeated elements) as the ground-truth in the Chamfer loss, then it is enough for the model to predict a set $B$ containing exactly one element $b_i=\widehat{a}$ equal to the repeated element of the set $\widehat{A}$ in order to account for all its repetitions in the first term of \Cref{eq:chamfer}. The remaining superfluous elements $b_j \in B$ predicted by the model can match \textit{any} other element in $A$ without increasing the second term of \Cref{eq:chamfer}. This implies that padding a ground-truth set of size $N$ with $M$ constant elements creates $\binom{N+1}{M-1}$ predictions that are all optimal and hence indistinguishable under the Chamfer loss. These predictions have a set size that varies from $N$ to $N+M-1$, and hence the model is likely to fail to learn the correct set cardinality---an effect clearly visible in our experiments, \cf \Cref{sec:set_mnist} and \Cref{tab:set_mnist}. \Gls{DSPN} uses an additional regularization term {\small $\loss[\mathrm{repr}]{\bm{h}, \widehat{\bm{h}}} = \operatorname{d}(\bm{h}, \widehat{\bm{h}})$} defined as the distance between the model's input features and the encoding of the generated set, which improves the performance of the internal optimization loop. \section{Size-Conditioned Set Generation with Transformers} \label{sec:method} We follow \gls{DSPN} in that we generate sets by transforming an initial set. However, we employ Transformers \cite{Vaswani2017transformer,Lee2019settransformer} as a learnable set-transformation, which can readily account for any interactions between the set elements. This change implies that the elements of the initial set can have a different (higher) dimensionality to the elements of the final predicted set, increasing the flexibility of the model. Moreover, instead of concatenating a presence variable to each set point, \gls{TSPN} uses a \gls{MLP} to directly predict the number of points from the input embedding $\bm{h}$, which then chooses the size $N$ of the initial set $\set{\bx}_{i=1}^N$. Given this size, we must generate the elements of the initial set such that the final predicted set is permutation-equivariant. One solution is to sample the intial set from a permutation-invariant distribution \eg \textit{iid} samples from a fixed distribution , for which we choose $\gauss{\alpha\bm{1}, \operatorname{diag}(\beta\bm{1})}$ with learnable $\alpha \in \RR$, $\beta \in \RR_+$. This makes the model stochastic, but also allows one to choose an arbitrary size for the generated set, even to sizes that lie outside the range of set sizes encountered in training. Formally, let $\bm{h}$ be the input embedding; the generating process reads as follows: \begin{align} N &= \operatorname{\textsc{mlp}}(\bm{h})\,,\\ \bx_i \sim&~\gauss{\alpha\bm{1}, \operatorname{diag}(\beta\bm{1})}, \quad i=1,\ldots,N\,,\\ \widehat{\bx}_i &= \operatorname{\mathrm{concatenate}}(\bx_i, \by)\,,\\ \set{\bx} &= \operatorname{\mathrm{transformer}}\left(\set{\widehat{\bx}}\right)\,.% \end{align} While training \gls{TSPN}, we use the ground-truth set-cardinality to instantiate the initial set, and we separately train the \gls{MLP} by minimizing categorical cross-entropy with the ground-truth set sizes. The cardinality-\gls{MLP} is used only at test-time. Note that, in contrast to \gls{DSPN}, \gls{TSPN} does not require any additional regularization terms applied to its representations. We describe our work in relation to \gls{DSPN} \cite{Zhang2019dspn}, but we note that there are concurrent works that share the ideas presented here. Both \textsc{detr}~\cite{Carion2020detr} and Slot Attention~\cite{Locatello2020slot} use a variant of the transformer \cite{Vaswani2017transformer} for predicting a set of object properties. \textsc{Detr} uses an object-specific query initialization and is, therefore, not equivariant to permutations, similarly to \cite{Zhang2019dspn}. Slot Attention is perhaps the most similar to our work---transforms a randomly sampled point-cloud, same as \gls{TSPN}, but it uses attention normalized along the query axis instead the key axis. \section{Experiments} \label{sec:experiments} We apply \gls{TSPN} and our implementations of \gls{DSPN} and a \gls{CDSPN} to two tasks: point-cloud prediction on \gls{SETMNIST} and object detection on \gls{CLEVR}. Point-cloud prediction is an autoencoding task, where we use a set encoder to produce vector embeddings of point clouds of varying sizes, and explore the use of the above set prediction networks for reconstructing the point clouds conditioned on these embeddings. Object detection, instead, requires predicting sets of bounding boxes conditioned on image features. While generating point-clouds requires predicting large numbers of points, which are often assumed to be conditionally independent of each other, detecting objects typically requires generating much smaller sets. Due to possible overlaps between neighbouring bounding boxes, however, it is essential to take relations between different objects into account. We implemented all models in \textsc{jax} \cite{Jax2018github} and \textsc{haiku} \cite{Haiku2020github} and run experiments on a single Tesla V100 GPU. Models are optimized with \textsc{adam} \cite{Kingma2015adam} with default $\beta_1, \beta_2$ parameters. We used batch size $=32$ and trained all models for $100$ epochs. \subsection{Point-Cloud Generation on \textsc{Set-Mnist}} \label{sec:set_mnist} \begin{figure} \centering \includegraphics[width=\linewidth]{figs/set_mnist.png} \caption{Set reconstructions (rows 1-5) and inputs (row 6) from different models, annotated with the number of points (above). \Gls{DSPN} fails to learn set cardinality, see \Cref{sec:loss} for an explanation of why this happens. \Gls{CDSPN} learns the cardinality well, but produces reconstructions of lower fidelity than \gls{TSPN}. } \label{fig:mnist} \end{figure} \begin{table} \centering \begin{tabular}{c|c|c} \toprule Model & Chamfer $\left[10^{-5}\right]$ $\downarrow$ & Set Size \textsc{Rmse} $\downarrow$\\ \midrule \textsc{dspn} & $8.2 \pm 0.66$ & $165 \pm 54.7$\\ \textsc{dspn-big} & $8.5 \pm 1.83$ & $182 \pm 29.2$\\ \textsc{c-dspn} & $8.92 \pm 0.78 $ & \bm{$0.3 \pm 0.13$}\\ \textsc{c-dspn-big} & $9.63 \pm 1.17$ & \bm{$0.3 \pm 0.09$}\\ \textsc{tspn}& \bm{$5.42 \pm 0.15$} & $0.8 \pm 0.08$\\ \bottomrule \end{tabular} \caption{ \Gls{SETMNIST} results, averaged over 5 runs. \textsc{Rmse} is root-mean-square error. Note that our \gls{DSPN} results match the Chamfer loss reported in \cite{Zhang2019dspn}. \textsc{C-dspn} stands for the \gls{DSPN} conditioned on the number of points. The \textsc{-big} variants use wider layers with the same number of parameters as \gls{TSPN}. For conditional models, sets were generated with the number of points inferred by the model. } \label{tab:set_mnist} \end{table} We convert \gls{MNIST} into point clouds by thresholding pixel values with the mean value in the training set; then normalize coordinates of remaining points to be in $\interval{0, 1}$. We use the same hyperparameters for \gls{DSPN} as reported in \cite{Zhang2019dspn}. \gls{CDSPN} uses the same settings, except instead of presence variables $p_i$ it uses an \gls{MLP} with one hidden layer of size $128$ to predict the set size, as used in \gls{TSPN}. \Gls{TSPN} uses a three-layer Transformer, with parameters shared between layers\footnote{This gives 383k parameters compared to 190k for \gls{DSPN}, which shares parameters between its encoder and gradient-based decoder. Not sharing parameters between layers does not improve results, but significantly increases parameter count. Sharing parameters and increasing layer width to match the number of parameters does not increase performance, either.}. Each layer has $256$ hidden units and $4$ attention heads. The initial set is two-dimensional (same as the output), but it is linearly-projected into $256$-dimensional space. The outputs of the transformer layers are kept at $256$ dimensions, too, and we project them back into $2$ dimensions after the last layer. \Gls{TSPN} uses the same input encoder as (\textsc{c}-)\gls{DSPN}, that is a two-layer \textsc{deepset} with \textsc{fspool} pooling layer \cite{Zhang2020fspool}. All models are trained using the Chamfer loss with learning rate~$=10^{-3}$. \Cref{tab:set_mnist} shows quantitative results. Conditioning on the set size does not improve the Chamfer loss for \gls{CDSPN} but it does significantly improve the accuracy of set-size prediction. Further, replacing the decoder with the Transformer (\Gls{TSPN}) leads to a significant loss reduction with respect to \gls{DSPN}. \Cref{fig:mnist} shows inputs set and model reconstructions. Note that in our experiments, \gls{DSPN} almost always predicts the same number of points ($323$), which is close to the maximum number of points we used (here, $342$). Interestingly, \gls{TSPN} performs very well while extrapolating to much bigger sets than the ones encountered in training: \Cref{fig:tspn_mnist_extrapolation} in \Cref{sec:mnist_app} shows reconstructions, where we manually change the desired set size up to $1000$ points. This is in contrast to \gls{CDSPN}, whose performance decreases significantly when we require it to generate a set whose size differs only slightly from the input, \cf \Cref{fig:dspn_mnist_extrapolation} in \Cref{sec:mnist_app}. We conjecture that this is caused by how \textsc{fspool} handles sets of different sizes, which leads to incompatibility between embeddings of sets of different cardinality. This, in turn, causes the distances in the latent space to be ill-defined, and breaks the internal gradient-based optimization. \subsection{Object Detection on \textsc{Clevr}} \begin{figure} \centering \includegraphics[width=\linewidth]{figs/clevr_obj_det.png} \caption{ Object detection on \gls{CLEVR}, with the number of detected objects in the lower-left corner of each image. \Gls{DSPN} fails to detect the correct number of objects. The ground-truth bounding boxes are approximate. } \label{fig:clevr} \vspace{-1em} \end{figure} \begin{table*} \centering \begin{tabular}{c|c|c|c|c|c|c|c} \toprule Model & $\textsc{ap}_{50}$ & $\textsc{ap}_{95}$ & $\textsc{ap}_{95}$ & $\textsc{ap}_{98}$ & $\textsc{ap}_{99}$ & Set Size \textsc{Rmse} $\downarrow$ & \#Params\\ \midrule \textsc{dspn} & $67.7 \pm 5.49$ & $7.4 \pm 0.91$ & $0.6 \pm 0.10$ & $0.0 \pm 0.01$ & $0.0 \pm 0.00$ & $2.53 \pm 0.221$ & $0.3$\,M\\ \textsc{c-dspn} & $71.6 \pm 3.40$ & $10.8 \pm 1.50$ & $0.9 \pm 0.21$ & $0.0 \pm 0.01$ & $0.0 \pm 0.00$ & $1.74 \pm 0.301$ & $0.3$\,M\\ \textsc{tspn}& \bm{$81.2 \pm 1.03$} & \bm{$20.7 \pm 0.16$} & \bm{$3.0 \pm 0.20$} & \bm{$0.1 \pm 0.02$} & $0.0 \pm 0.00$ & \bm{$0.58 \pm 0.046$} & $1.9$\,M\\ \bottomrule \end{tabular} \caption{ \Gls{CLEVR} object detection results averaged over 5 runs. These results are not directly comparable to the ones reported in \citet{Zhang2019dspn}, since all our models were trained using Chamfer loss. We subtract the resnet parameters ($21.8$\,M) when reporting the number of model parameters. } \label{tab:clevr} \end{table*} \Gls{CLEVR} images consist of up to 10 rendered objects on plain backgrounds. Following \citet{Zhang2019dspn}, we use the \gls{CLEVR} dataset to test the efficacy of our models for object detection in a simple setting, which might pave the way for more advanced object-based inference in future works. We use the same hyperparameters for \gls{CDSPN} as \citet{Zhang2019dspn}. \Gls{TSPN} uses four layers with four attention heads and $256$ neurons each, without parameter sharing between layers. We apply layer normalization \cite{Xiong2020Oonln} before attention as in \cite{Ba2016ln}. The last transformer layer is followed by an \gls{MLP} with a single hidden layer of % All models use a \textsc{resnet34} \cite{He2016resnet} as the input encoder, and are trained with the Chamfer loss; \gls{DSPN}-based models are trained for $200$ epochs with learning rate~$=3\times10^{-5}$; \gls{TSPN} uses learning rate~$=10^{-4}$ and is trained for $1200$ epochs. Longer training for \gls{DSPN}-based models lead to overfititng and decreased validation performance. Note that \gls{DSPN} in \cite{Zhang2019dspn} use the Hungarian loss (\Cref{eq:hungarian}), which leads to better results than using Chamfer. We report the average precision scores at different thresholds and the set size root-mean-square error in \Cref{tab:clevr}. Qualitative results are available in \Cref{fig:clevr}. We see that \gls{TSPN} outperforms \gls{CDSPN} and produces bounding boxes that are better aligned with ground-truth, although these results are worse than the ones reported in \citet{Zhang2019dspn}---we expect improvements when using the Hungarian loss as well. \section{Related Work} \label{sec:related_work} \section{Conclusions} \label{sec:conclusion} We introduced the \glsreset{TSPN}\gls{TSPN}---a transformer-based model for conditional set prediction. \Gls{TSPN} infers the cardinality of the set, randomly samples an initial set of the desired size and applies a transformer to generate the final prediction. Set prediction in \gls{TSPN} is permutation-equivariant, and the model can be applied to any set-prediction tasks. Interesting directions include scaling the model to large-scale point-clouds and object detection (\eg similar to \citet{Carion2020detr}), as well as turning this model into a generative model in either the \textsc{vae} or \textsc{gan} framework. \section*{Acknowledgements} We would like to thank George Papamakarios, Karl Stelzner, Thomas Kipf, Teophane Weber and Yee Whye Teh for helpful discussions. \section{Set Size Extrapolation on \textsc{Set-Mnist}} \label{sec:mnist_app} \begin{figure*}[b] \centering \begin{minipage}[t]{.49\linewidth} \centering \includegraphics[width=\linewidth]{figs/tspn_mnist_extrapolation.pdf} \caption{ \Gls{TSPN} extrapolates to far bigger set sizes than encountered in training. Here, the model was trained with up to 342 points, and yet can generate sets of up to 1000 points. The bottom row contains the ground-truth annotated with the number of points at the bottom. This figure uses a smaller marker size than \Cref{fig:mnist}, hence ground-truth appears less dense. } \label{fig:tspn_mnist_extrapolation} \end{minipage} \hfill \begin{minipage}[t]{.49\linewidth} \centering \includegraphics[width=\linewidth]{figs/dspn_mnist_extrapolation.pdf} \caption{ The size-conditional \gls{DSPN} fails to reconstruct sets when we slightly change the output set size. Here, we take the size of the reconstructed set to be within $\interval{-4, 5}$ points of the input size. As the size of the reconstruction strays from the original size, the reconstruction quality quickly deteriorates. The bottom row contains the input sets with their respective sizes. } \label{fig:dspn_mnist_extrapolation} \end{minipage} \end{figure*}
\section{Introduction} Macroscopic systems, in absence of an external drive, equilibrate with the environment. However, relaxation may be slow, i.e. with a relaxation time which exceeds any attainable observation time~\cite{Palmer}. In that case, only dynamical properties are accessible to observation and the question naturally arises of what can be learnt about equilibrium from dynamics. Paradigmatical examples of slow relaxation are glassy systems~\cite{BCKM} or systems undergoing phase ordering after a sudden temperature quench from above to below the critical point~\cite{BCKM,Bray}. Here we shall look at the problem in the latter context, whose prototypical instance is the quench of a ferromagnetic system. In order to make the presentation as simple as possible, we shall mostly concentrate on the Ising model. The extension to other phase-ordering systems will be discussed at the end of the paper, with the example of the spherical model. Phase ordering in the Ising model by now is a mature subject, generally considered to be well understood. For reviews see Refs.~\cite{Bray,Puri,Jo,Henkel}. Among the many interesting features of the process, in this paper we shall be primarily concerned with the lack of equilibration in any finite time, if the system is infinite. This is frequently referred to with the catchy expression that the system remains permanently out of equilibrium, whose meaning, however, has never been fully clarified. For instance, a similar circumstance arises also when the quench is made to the critical temperature $T_c$, because, due to critical slowing down, again equilibrium is not reached in any finite time. Nonetheless, in that case, the process cannot be regarded as substantially different from one of equilibration, because as time grows the system gets closer and closer to the equilibrium critical state, which is unique in the sense that in the thermodynamic limit it is independent of the boundary conditions (BC). Instead, in the quench to below $T_c$ the picture is qualitatively different, because, although the state extrapolated from dynamics is unique, the same cannot be said of the equilibrium state, which depends on BC even in the thermodynamic limit. This we have shown in Ref.~\cite{FCZ} (to be referred to as I in the following), where we have investigated the nature of the equilibrium state in the Ising model below $T_c$, under different symmetry-preserving BC. We have found that while periodic boundary conditions (PBC) lead to the usual ferromagnetic ordering, due to the breaking of ergodicity with the consequential spontaneous breaking of the $\mathbb{Z}_2$ up-down symmetry, the scenario changes dramatically with antiperiodic boundary conditions (APBC), because ergodicity breaking is precluded. Then, the system cannot order and complies with the requirement of the transition by remaining critical also below $T_c$, all the way down to $T=0$. We have argued that this new transition, without spontaneous symmetry breaking and without ordering, consists in the condensation of fluctuations. In the $1d$ case, since $T_c=0$, the low temperature phase is shrunk to just $T=0$. Motivated by the existence of such diversity in the equilibrium properties, in this paper we address the next natural question, formulated in the title of the paper, of matching statics and dynamics. Using the equal-time correlation function as the probing observable, we shall see that the asymptotic state, extrapolated from dynamics, that is by taking the $t \to \infty$ limit after the thermodynamic limit, is unique and {\it critical}. Now, the point is that this, which we may call the time-asymptotic state and which, we emphasize, is the same for both choices of BC, is found to coincide with the bona fide equilibrium state, i.e. the one computed from equilibrium statistical mechanics, in the APBC case but to be remote from it in the PBC case. Thus, we have the one and the same dynamical evolution which, although not reaching equilibrium in any finite time, turns out to be informative of the true equilibrium state in one case (APBC), but not in the other (PBC). It is, then, appropriate to regard the APBC case as one in which equilibrium is approached, just as in a quench to $T_c$, while the PBC case offers an instance of a system remaining permanently out of equilibrium. The poor performance in approaching equilibrium with PBC is traceable to the presence of ergodicity breaking at the working temperature, which, instead, is preserved when APBC are applied. At the end of the paper we shall argue that the connection between the presence/absence of ergodicity breaking and the absence/presence of equilibration goes beyond the Ising example, by showing that it takes place with the same features in the rather different context of the spherical and mean-spherical model. The paper is organized as follows: in section~\ref{II} we formulate the problem. In section~\ref{III} the relation between equilibrium and relaxation in the quench to above $T_c$ is analyzed by using scaling arguments. The cases of the quench to $T_c$ with $d=2$, to $T=0$ with $d=1$ and to below $T_c$ with $d=2$ are analyzed in sections~\ref{IV}, \ref{V} and \ref{VI}, respectively. The spherical and mean spherical model are introduced and investigated in section~\ref{SM}. Concluding remarks are made in section~\ref{CR}. \section{The problem} \label{II} We are concerned with the relaxation dynamics of a system initially prepared in an equilibrium state at the temperature $T_I$ and suddenly quenched to the lower temperature $T_F$. We consider the Ising model on a lattice of size $V=L^d$, with the usual nearest neighbours interaction \begin{equation} {\cal H}(\boldsymbol{s}) = -J\sum_{<ij>} s_is_j, \label{Ham.1} \end{equation} where $J > 0$ is the ferromagnetic coupling, $\boldsymbol{s} = [s_i]$ is a configuration of spin variables $s_i=\pm1$ and $<ij>$ is a pair of nearest neighbours. We shall study the $d=1$ and $d=2$ cases, where in the thermodynamic limit there is a critical point at $T_c=0$ and $T_c=2.269J$, respectively. Since the system's size is finite, BC must be specified and, because of the major role that these will play in the following developments, it is necessary to enter in some detail from the outset. As anticipated in the Introduction, we shall consider PBC and APBC (precisely cylindrical antiperiodic BC) implemented by adding to the interaction an extra term ${\cal B}(\boldsymbol{s})$ with couplings among spins on the boundary~\cite{Gallavotti,Antal,FCZ}. In the $d=2$ case spins on opposite edges are coupled ferromagnetically, just like spins in the bulk, if PBC are applied. Instead, in the APBC case, spins on one pair of opposite edges are coupled ferromagnetically, while those on the other pair antiferromagnetically. Hence, the boundary term reads \begin{equation} {\cal H}_{b}(\boldsymbol{s}) = -J \sum_{y=1}^L s_{1,y} s_{L,y} - b J \sum_{x=1}^L s_{x,1}s_{x,L}, \label{bdr.1} \end{equation} where we have denoted by $b=\pm$ the sign of $J$, which identifies PBC $(+)$ or APBC $(-)$. In the $d=1$ case this term simplifies to \begin{equation} {\cal H}_b (\boldsymbol{s}) = - bJ s_{1}s_{L}, \label{bdr.2} \end{equation} where $L$ is the length of the chain. It is important to note that both these BC preserve the up-down symmetry of the Ising interaction. Taking as it is customary $T_I = \infty$ in order to have an uncorrelated initial state, the system is put in contact with a thermal reservoir at the lower and finite temperature $T_F$ and let to evolve according to a dynamical rule which does not conserve the order parameter, like Glauber or Metropolis. This simply corresponds to running a Markov chain at the fixed temperature $T_F$, with the so-called hot start, that is with a uniformly random initial condition. The relaxation process is monitored through the equal-time spin-spin correlation function \begin{equation} \mathcal{C}(r, \epsilon,t^{-1},L^{-1}; b) = \left [ \langle s_{i}(t)s_{j}(t)\rangle - \langle s_{i}(t) \rangle \langle s_{j}(t) \rangle \right ], \label{corr.0} \end{equation} where the angular brackets denote averages taken over the noisy dynamics and the initial conditions, while the square brackets stand for the average over all pairs of sites $(i,j)$ keeping fixed the distance $r$ between $i$ and $j$. In the set of control parameters, $\epsilon=T_F-T_c$ is the temperature difference from criticality, $t^{-1}$ is the inverse time and $L^{-1}$ is the inverse linear size. We are interested in taking both the large-time and the thermodynamic limit of the above quantity, and then to compare the outcomes, depending on the order in which these two limits have been taken. Letting $t^{-1} \to 0$ first, while keeping $L$ fixed, the equilibrium correlation function is obtained \begin{equation} \lim_{t^{-1} \to 0}\mathcal{C}(r,\epsilon,t^{-1},L^{-1};b) = \mathcal{C}_{\rm eq}(r,\epsilon,L^{-1};b) = \left [ \langle s_{i}s_{j}\rangle_{\rm eq} - \langle s_{i} \rangle_{\rm eq} \langle s_{j} \rangle_{\rm eq} \right ], \label{D3.7} \end{equation} where now the angular brackets stand for the Gibbs ensemble average and the square brackets have the same meaning as in Eq.~(\ref{corr.0}). Then, the subsequent thermodynamic limit implements the prescription~\cite{Gallavotti} for the construction of the equilibrium correlation function in the infinite system \begin{equation} \lim_{L^{-1} \to 0} \lim_{t^{-1} \to 0}\mathcal{C}(r,\epsilon,t^{-1},L^{-1};b) = C_{\rm eq}(r,\epsilon;b). \label{D3.6} \end{equation} The crux of the matter is that, after reversing the order of these limits, the end result might not be the same as the one above, because the large-time limit of the time-dependent correlation function for the infinite system \begin{equation} \lim_{t^{-1} \to 0} \lim_{L^{-1} \to 0} \mathcal{C}(r,\epsilon,t^{-1},L^{-1};b) = C^*(r,\epsilon;b), \label{D3.5} \end{equation} exists but does not necessarily coincide with $C_{\rm eq}(r,\epsilon;b)$. Referring to $C^*(r,\epsilon;b)$ as the time-asymptotic correlation function, if it matches $C_{\rm eq}(r,\epsilon;b)$ then the infinite system equilibrates. If not, it remains permanently out of equilibrium. Which is the case depends on $T_F$ and on the choice of BC. In the quench to $T_F \geq T_c$ both $C_{\rm eq}(r,\epsilon)$ and $C^*(r,\epsilon)$ are independent of the BC choice and do coincide, signaling equilibration. Instead, in the quench to below $T_c$, as we shall see, $C^*(r,\epsilon)$ does not depend on $b$, while $C_{\rm eq}(r,\epsilon;b)$ retains this dependence, implying that equilibration can be achieved at most with one of the two BC, but certainly not with both. As anticipated in the Introduction, the equilibration condition is fulfilled with APBC, but not with PBC. In the next section we shall substantiate the above statements with results for the $1d$ and $2d$ Ising model. We shall take the aforementioned limits, after setting up the general scaling scheme which unifies static and dynamic phenomena into one single framework encompassing both. In order to do this, it is convenient to treat separately the three cases: $\epsilon > 0$, $\epsilon = 0$ and $\epsilon < 0$. \section{Statics and Dynamics: $\boldsymbol{\epsilon > 0}$} \label{III} \begin{figure}[ht] \centering \includegraphics[width=8cm]{FigPPT1SXa.pdf} \hspace{-2cm} \includegraphics[width=8cm]{FigPPT1DXb.pdf} \caption{Parameter space of the $1d$ model (a) and of the $2d$ model (b).} \label{fig:pspace} \end{figure} Let us assume that at a generic point in the $\epsilon > 0$ sector of the three-dimensional space of the parameters $(\epsilon,t^{-1},L^{-1})$, depicted in Fig.\ref{fig:pspace}, the correlation function obeys scaling in the form~\footnote{This is a finite-size extension of the scaling form derived in Ref.~\cite{Janssen}.} \begin{equation} \mathcal{C}(r,\epsilon,t^{-1},L^{-1};b) = \frac{1}{r^a} \mathcal{F} \left ( \frac{r}{\ell}, \frac{\ell}{R},\frac{R}{L};b \right ), \label{anml.1} \end{equation} where the exponent $a$ is related to the anomalous dimension exponent $\eta$ by $a = d-2+\eta$ and to the fractal dimensionality $D$ of the Coniglio-Klein (CK)~\cite{CK,FK} correlated clusters~\cite{CF} by \begin{equation} a = 2(d-D). \label{anml.2} \end{equation} From the exact results~\cite{Stanley,Goldenfeld} \begin{equation} \eta = \left \{ \begin{array}{ll} 1, \;\; $for$ \;\; d=1,\\ 1/4,\;\; $for$ \;\; d=2, \end{array} \right . \label{z.0} \end{equation} follows \begin{equation} a = \left \{ \begin{array}{ll} 0, \;\; $for$ \;\; d=1,\\ 1/4,\;\; $for$ \;\; d=2, \end{array} \right . \label{z.1} \end{equation} and \begin{equation} D = \left \{ \begin{array}{ll} 1, \;\; $for$ \;\; d=1,\\ 15/8,\;\; $for$ \;\; d=2, \end{array} \right . \label{z.2} \end{equation} which shows that the CK clusters are compact in $1d$ and fractals in $2d$. Up to a proportionality constant, the scaling variable $\ell$ is the equilibrium correlation length of the infinite system, given by~\cite{Stanley} \begin{equation} \ell(\epsilon) = \left \{ \begin{array}{ll} -[\ln \tanh (J/\epsilon)]^{-1}, \;\; $for$ \;\; d=1,\\ \epsilon^{-\nu},\;\; $with$ \;\; \nu=1 \;\; $for$ \;\; d=2. \end{array} \right . \label{anml.3} \end{equation} The other characteristic length $R(t)$ obeys the power law~\cite{Janssen} \begin{equation} R(t) = t^{1/z}, \label{anml.3bis} \end{equation} with the dynamical exponent~\cite{1d,Nightingale} \begin{equation} z = \left \{ \begin{array}{ll} 2, \;\; $for$ \;\; d=1,\\ 2.16,\;\; $for$ \;\; d=2. \end{array} \right . \label{z.1} \end{equation} The connection between $R(t)$ and the time dependent correlation length will be clarified shortly and is summarized in Fig.\ref{fig:R}. Both lengths diverge as the critical point, which is at the origin of the reference frame in Fig.\ref{fig:pspace}, is approached along the $\epsilon$ axis and the $t^{-1}$ axis, respectively. The scaling ansatz~(\ref{anml.1}) is dense of information and allows to predict what should be expected in different regions of the parameter space. The foremost relevant features are the power-law decay $1/r^{a}$ of correlations at short distance and the large-distance cutoff enforced by the scaling function. The separation between short and large distances is fixed by the correlation length \begin{equation} \xi(\epsilon,t^{-1},L^{-1};b) = \left [ \frac{\int_0^L dr \, r^2 \, \mathcal{C}(r,\epsilon,t^{-1},L^{-1};b) } {\int_0^L dr \, \mathcal{C}(r,\epsilon,t^{-1},L^{-1};b) } \right ]^{1/2}, \label{corrl.0} \end{equation} which scales as \begin{equation} \xi(\epsilon,t^{-1},L^{-1};b) = R f \left ( \frac{R}{\ell}, \frac{\ell}{L};b \right ). \label{crrl.1} \end{equation} The behaviour of $\xi$, as parameters are changed, can be unraveled by the following argument. Suppose that $\ell$ and $L$ are fixed in a region where $\ell \ll L$ and let us survey what happens as the quench unfolds and $R$ grows. \begin{figure}[ht] \centering \includegraphics[width=8cm]{FigPPT2SXa.pdf} \hspace{-2cm} \includegraphics[width=8cm]{FigPPT2DXb.pdf} \caption{Schematic representation of the saturation of $\xi$ vs $R$ for $\ell \ll L$ (a) and for $\ell \gg L$ (b).} \label{fig:R} \end{figure} Approximating the above equation by \begin{equation} \xi(\epsilon,t^{-1}) \simeq R f \left ( \frac{R}{\ell},0 \right ), \label{crrl.101} \end{equation} in the early stage of the quench, when $R \ll \ell$, it can be further reduced to \begin{equation} \xi \sim R, \label{xiR.1} \end{equation} because the system behaves as if it was approaching the critical point along the $t^{-1}$ axis. As $R$ is let to grow further, equilibrium is eventually reached when $R \sim \ell$ and the correlation length saturates to the limiting value \begin{equation} \xi \sim \ell, \label{elle.1} \end{equation} as illustrated in the left panel of Fig.\ref{fig:R}, with the equilibration time given by $t_{\rm eq} = \ell^z$. The BC are immaterial throughout, because $\xi$ remains always much smaller than $L$ so that the system as a whole behaves as a collection of independent finite systems, on which the far away BC have no effect. By the same reasoning, in the region where $\ell \gg L$ we still have $\xi \sim R$ in the early stage, when $R \ll L$, with independence from BC. But then BC come into play when the system equilibrates and $\xi$ saturates to the limiting value $L$, as illustrated in the right panel of Fig.\ref{fig:R}, since correlations extend up to distances where the BC are effective. In this connection see Ref.~\cite{Das}. Summarizing, $\xi$ is given by the shortest of the three lengths $(\ell, R,L)$, that is \begin{equation} \xi(\epsilon,t^{-1},L^{-1}) \sim \min(\ell,R,L), \label{crrl.4} \end{equation} in the regions of the parameter space where one of the three is considerably shorter than the other two, with crossovers connecting these regions. It is clear from Fig.\ref{fig:R} that $\xi$ and $R$ coincide at all times if both $\ell$ and $L$ are infinite. Next to the correlation length, it is useful to keep track also of the susceptibility \begin{equation} \chi(\epsilon,t^{-1},L^{-1};b) = \int d^d r \, \mathcal{C}(r,\epsilon,t^{-1},L^{-1};b), \label{susc.0} \end{equation} which is related to the correlation length by \begin{equation} \chi \sim \xi^{2D-d}. \label{susc.1} \end{equation} This is an important relation, because it is independent of the direction of approach to the critical point and depends only on the geometrical nature of the correlated clusters through $D$. According to the above reasoning, when the limits $t^{-1} \to 0$ and $L^{-1} \to 0$ are taken in the $\epsilon > 0$ sector, we necessarily have $\xi \sim \ell$, independently of the order in which these limits are taken, because $\ell$ is finite. Moreover, the finite correlation length guarantees that the system equilibrates with independence from BC \begin{equation} \lim_{L^{-1} \to 0} \lim_{t^{-1} \to 0} \mathcal{F} \left ( \frac{r}{\ell}, \frac{\ell}{R},\frac{R}{L};b \right ) = \lim_{t^{-1} \to 0} \lim_{L^{-1} \to 0} \mathcal{F} \left ( \frac{r}{\ell}, \frac{\ell}{R},\frac{R}{L};b \right ) = F_{\rm eq} \left (\frac{r}{\ell} \right ). \label{D3.6bis} \end{equation} \subsection{Example: $1d$ system} As an example, let us check the above statements against exact results in the particular case of the $t^{-1} \to 0$ limit of the $1d$ model with finite $L$. The equilibrium correlation function is given by \begin{equation} \mathcal{C}_{\rm eq}(r,\epsilon,L^{-1};b) = \frac{1}{r^a} \mathcal{F}_{\rm eq} \left ( \frac{r}{L}, \frac{L}{\ell};b \right ), \label{anml.4} \end{equation} where $a=0$ according to Eq.~(\ref{z.1}), while the two explicit forms of the scaling function (see I and Ref.~\cite{Antal}) read \begin{equation} \mathcal{F}^{(p)}_{\rm eq}(z,\zeta) = \frac{\cosh[\zeta(1-z)]}{\cosh(\zeta)}, \label{anml.6} \end{equation} \begin{equation} \mathcal{F}^{(a)}_{\rm eq}(z,\zeta) = \frac{\sinh[\zeta(1-z)]}{\sinh(\zeta)}, \label{anml.7} \end{equation} where we have set \begin{equation} z=r/L, \quad \zeta = L/\ell. \label{anml.8} \end{equation} We have considered a chain of length $2L$ in order to simplify notation. The superscripts $(p)$ and $(a)$ have been used for PBC and for APBC, respectively. The equilibrium correlation length, defined through the second moment as in Eq.~(\ref{corrl.0}), scales as \begin{equation} \xi_{\rm eq}(\epsilon,L^{-1};b) = \ell f_{\rm eq}(\zeta;b), \label{crrl.1bis} \end{equation} with the scaling functions \begin{equation} f_{\rm eq}^{(p)} (\zeta) = \left [2-\frac{2\zeta}{\sinh (\zeta)} \right ]^{1/2}, \quad f_{\rm eq}^{(a)} (\zeta) = \left [2-\frac{\zeta^2}{\cosh(\zeta) - 1} \right ]^{1/2}, \label{crrl.5} \end{equation} from which follows \begin{equation} \xi_{\rm eq}^{(p)}(\epsilon,L^{-1}) = \left \{ \begin{array}{ll} \sqrt{2} \, \ell, \;\; $for$, \;\; \ell \ll L,\\ \frac{1}{\sqrt{3}} \, L,\;\; $for$, \;\; L \ll \ell, \end{array} \right . \quad \xi_{\rm eq}^{(a)}(\epsilon,L^{-1}) = \left \{ \begin{array}{ll} \sqrt{2} \, \ell, \;\; $for$, \;\; \ell \ll L,\\ \frac{1}{\sqrt{6}} \, L,\;\; $for$, \;\; L \ll \ell, \end{array} \right . \label{crrl.10} \end{equation} showing that in the regimes $\ell \ll \L$ and $\ell \gg L$, indeed one has $\xi \sim \min(\ell,L)$. Completing, next, the sequence of limits by letting $L^{-1} \to 0$, it is straightforward to check that the dependence on BC disappears, yielding \begin{equation} \lim_{L^{-1} \to 0} \mathcal{F}^{(p)}_{\rm eq}(z,\zeta) = \lim_{L^{-1} \to 0} \mathcal{F}^{(a)}_{\rm eq}(z,\zeta) = e^{-r/\ell}. \label{anml.9} \end{equation} Using the definition, it is immediate to verify that also $\chi \sim \ell$ and, therefore, that moving toward the critical point along the $\epsilon$ axis one has \begin{equation} \chi \sim \xi, \label{susc.2} \end{equation} in agreement with Eq.~(\ref{susc.1}), because $D=1$ when $d=1$. \section{Statics and Dynamics: $\boldsymbol{\epsilon = 0, d=2}$} \label{IV} When $\epsilon = 0$, the $1d$ and $2d$ cases are quite different and need to be treated separately. In the latter one, which we shall now consider, $T_c > 0$ and ergodicity does not break. In the former, instead, $T_c = 0$ and ergodicity may break, depending on BC. This makes it more akin to the $2d$ quench to below $T_c$. So, it will be dealt with in the next section. \begin{figure}[ht] \centering \includegraphics[width=10cm]{fig3.pdf} \caption{Scaling function of the time-dependent correlation function in the quench to $T_c$ of the $2d$ model, demonstrating independence from BC, in the system with $L=256$. PBC (black symbols) and APBC (empty symbols).} \label{fig:collapseTc} \end{figure} The specificity of the quench to $\epsilon = 0$ is that $\ell$ diverges and, consequently, that $\xi$ can be limited only by $R$ or $L$. Thus, when the $t^{-1} \to 0$ limit is taken first and $L$ is kept fixed, $\xi$ crosses over from $R$ to $L$ in the finite time $t_{\rm eq} \sim L^z$, as in the right panel of Fig.\ref{fig:R}, and the system equilibrates to \begin{equation} \mathcal{C}_{\rm eq}(r,L^{-1};b) = \frac{1}{r^{1/4}} \mathcal{F}_{\rm eq} \left ( \frac{r}{L};b \right ), \label{sat.1} \end{equation} which depends on BC because correlations extend up to the boundary. Letting next $L^{-1} \to 0$, the BC dependence disappears from the critical correlation function of the infinite system \begin{equation} C_{\rm eq}(r) \sim \frac{1}{r^{1/4}}. \label{sat.2} \end{equation} Instead, if the $L^{-1} \to 0$ limit is taken first, $R$ is the only length left in the problem. This implies $\xi \sim R$ at all times, so that there is no finite equilibration time. However, the time-dependent correlation function \begin{equation} C(r,t^{-1}) = \frac{1}{r^{1/4}} F_c (r/R), \label{sat.3} \end{equation} which is BC independent (see Fig.\ref{fig:collapseTc}), gets arbitrarily close to the equilibrium counterpart~(\ref{sat.2}) as time grows, because the limit \begin{equation} \lim_{t^{-1} \to 0} C(r,t^{-1}) = C^*(r) \sim \frac{1}{r^{1/4}}, \label{sat.4} \end{equation} coincides with it. In summary, in the quench to $\epsilon = 0$ of the $2d$ system, like in the $\epsilon > 0$ case previously considered, the equilibrium correlation function of the infinite system $C_{\rm eq}(r)$ does not depend on BC and coincides with the time-asymptotic one $C^*(r)$, warranting the conclusion that the system can get arbitrarily close to equilibrium by waiting long enough. Comparing Eqs.~(\ref{sat.1}) and~(\ref{sat.3}), it is evident that the scaling structure is the same, the only difference being in the specific forms of the scaling functions, which is inessential for the present considerations. This shows that the time direction along the $t^{-1}$ axis, as far as scaling is concerned, is just another direction of approach to the critical point, on the same footing with the other two. In addition, from the formal similarity of the two scaling expressions follows straightforwardly that the susceptibility satisfies Eq.~(\ref{susc.1}) in the form \begin{equation} \chi \sim \xi^{7/4}, \label{suscett.1} \end{equation} irrespective of the direction of approach, with $\xi \sim L$ along the $L^{-1}$ axis and $\xi \sim R$ along the $t^{-1}$ axis. \section{Statics and Dynamics: $\boldsymbol{\epsilon = 0, d=1}$} \label{V} As mentioned above and explained at length in I, in the $1d$ system at $\epsilon = 0$ we are confronted with a radically different situation, because ergodicity, which holds for both BC above $T_c$, is now broken with PBC, but not with APBC. In order to ease the comparison, and to highlight the contrast, with the less familiar case of a transition without ergodicity breaking, let us first briefly summarize the well-established concept of ergodicity breaking~\cite{Palmer}. In the PBC case there are two degenerate ground states: the two ordered configurations with all spins either up $\boldsymbol{s}_+ = [s_i=+1]$ or down $\boldsymbol{s}_- = [s_i=-1]$. These, by themselves, form two absolutely-confining ergodic components, which are dynamically disconnected because the activated moves needed to go from one to the other are forbidden at zero temperature. Consequently, time averages coincide with ensemble averages taken with either one of the two broken-symmetry ferromagnetic pure states $P_-(\boldsymbol{s})=\delta_{\boldsymbol{s},\boldsymbol{s}_-}, P_+(\boldsymbol{s})=\delta_{\boldsymbol{s},\boldsymbol{s}_+}$ and {\it do not} coincide with the symmetric ensemble averages taken in the Gibbs state, which is the even mixture of the pure states \begin{equation} P^{(p)}(\boldsymbol{s}) = \frac{1}{2}[P_-(\boldsymbol{s}) + P_+(\boldsymbol{s})]. \label{mixt.0} \end{equation} In such a situation, only time averages are physically meaningful. Conversely, in the APBC case all the $4L$ degenerate ground-state configurations with one defect (or domain wall) belong to the same ergodic component, because the defect can freely sweep the whole system at no energy cost. Then, in this case time and ensemble averages coincide. The qualitative difference between the two zero-temperature states is well illustrated (see Fig.\ref{fig:1}) by the probability distribution $P_b(m)$ of the magnetization density $m=\frac{1}{2L}\sum_i s_i$, which is demonstrated~\cite{Antal} to be double peaked in the PBC case \begin{equation} P^{(p)}(m) = \frac{1}{2} [\delta(m+1) + \delta(m-1)], \label{mxt.1} \end{equation} \begin{figure}[ht] \centering \includegraphics[width=5cm]{fig1a-sublabel.pdf} \includegraphics[width=5cm]{fig1b-sublabel.pdf} \caption{Magnetization density distributions at $\epsilon=0$ in the $1d$ Ising model, with $m_\pm = \pm 1$. The spikes in the panel (a) stand for $\delta$ functions.} \label{fig:1} \end{figure} and uniform over the $[-1,1]$ interval in the APBC case \begin{equation} P^{(a)}(m) \to \left \{ \begin{array}{ll} 1/2, \;\; $for$, \;\; m \in [-1,1],\\ 0,\;\; $for$, \;\; m \notin [-1,1]. \end{array} \right . \label{mxt.2} \end{equation} So, if we now take the $t^{-1} \to 0$ limit while keeping $L^{-1}$ fixed, we find BC-related differences in the results. With PBC, as explained above, the meaningful averages are those in the broken symmetry pure states, yielding \begin{equation} \mathcal{C}^{(p)}_{\rm eq}(r,L^{-1}) = [\langle s_is_j \rangle_\pm - \langle s_i \rangle_\pm \langle s_j \rangle_\pm] = 0, \label{1dI.0} \end{equation} where the angular brackets stand for the average with respect to $P_-(\boldsymbol{s})$ or $P_+(\boldsymbol{s})$. The vanishing of correlations for any $r$ holds independently of $L$ and clearly implies that also the correlation length vanishes. Notice that if the correlation function had been extracted by taking the $\epsilon \to 0$ limit of the Gibbs average taken with the distribution~(\ref{mixt.0}), as in Eq.~(\ref{anml.6}), the result would have been \begin{equation} \mathcal{C}^{(p)}_{\rm eq}(r,L^{-1}) = 1, \label{1dI.16} \end{equation} which is independent of $r$ and does not decay. However, this would have been just an artefact of the mixture. Conversely, in the APBC case the ensemble Gibbs average, as calculated in Eq.~(\ref{anml.7}), gives the correct time-average result because ergodicity is not broken. Hence, in the $\epsilon \to 0$ limit, from Eq.~(\ref{anml.7}) one has \begin{equation} \mathcal{C}^{(a)}_{\rm eq}(r,L^{-1}) = (1-r/L). \label{1dI.17} \end{equation} The dependence on $r/L$ in the above expression reveals that correlations extend over a distance of order L in agreement with the general argument expounded in section~\ref{III}. Hence, by letting $L^{-1} \to 0$ the correlation length diverges, leading to the conclusion that the state at the origin of the parameter space is a {\it critical point} for the APBC system, where the correlation function displays the constant behaviour \begin{equation} C^{(a)}_{\rm eq}(r) = 1. \label{corrl.01} \end{equation} Contrary to Eq.~(\ref{1dI.16}), now the lack of decay is a real physical effect, which corresponds to the critical power law decay $1/r^{a}$ with a vanishing exponent $a$, due to the compactness of the CK correlated clusters. When the sequence of limits is reversed, after taking the thermodynamic limit we are again in the situation in which $R$ is the only length in the problem. Therefore $\xi \sim R$, as in the previous section, and we get the BC independent result \begin{equation} C(r,t^{-1}) = \frac{1}{r^a} F (r/R ), \label{q.1} \end{equation} with $a=0$. The function $F(x)$ is known from exact analytical computation with PBC~\cite{1d,Bray} and is given by \begin{equation} F(x) = \mathrm{erfc}\,(x), \quad \text{with} \quad x=r/2R. \label{quench.1} \end{equation} That the same scaling function applies also to the case of APBC is demonstrated by the numerical data displayed in Fig.~\ref{fig:scaledC}, which have been obtained by simulating the quench dynamics with the Metropolis algorithm on a system with $L=10^5$, after imposing PBC and APBC. The plot shows that the above result indeed holds irrespective of the BC choice, because the PBC and APBC data superimpose to the theoretical curve of Eq.~(\ref{quench.1}) with great accuracy, as long as $R(t) \ll L$. The existence of an endlessly growing correlation length $R(t)$ means that the relaxation dynamics along the $t^{-1}$axis drives both systems, with PBC and with APBC, toward the same asymptotic critical state at the origin \begin{figure}[ht] \centering \includegraphics[width=10cm]{fig5.pdf} \caption{Collapse on the master curve of Eq.~(\ref{quench.1}) of the data for $C(r,t^{-1},L^{-1})$ in the time regime $R \ll L$. PBC (black symbols) and APBC (empty symbols). The data for $R/L=10^{-4},10^{-3}$ have been obtained with $L=10^5$, those with $R/L=10^{-2}$ with $L=10^4$.} \label{fig:scaledC} \end{figure} with the unique time-asymptotic correlation function given by \begin{equation} \lim_{t^{-1} \to 0} C(r,t^{-1}) = C^*(r)= 1, \label{elle.2} \end{equation} which coincides with the APBC equilibrium result in Eq.(\ref{corrl.01}). So, if we compare the asymptotic result of Eq.~(\ref{elle.2}) with the APBC static one of Eq.~(\ref{corrl.01}), and with the PBC equilibrium result of Eq.~(\ref{1dI.0}), we see, as stated in the Introduction, that the APBC system tends toward equilibrium, although with an infinite relaxation time, while the PBC system remains permanently out of equilibrium. It is evident that the origin of the diversity of behaviours is in the presence or absence of ergodicity breaking. In fact, we shall see in the next section that the same behaviour occurs in the quench of the $2d$ system to below the critical point. In order to complete the picture of critical behaviour, let us check on the validity of Eq.~(\ref{susc.1}). From Eqs.~(\ref{anml.9},\ref{1dI.17},\ref{quench.1}) follows that along the three directions one has $\xi \sim \ell, \xi \sim R, \xi \sim L$, as well as $\chi \sim \ell, \chi \sim R, \chi \sim L$, yielding \begin{equation} \chi \sim \xi, \label{susc.10} \end{equation} independently of the direction of approach to the critical point, as it should be since $D=1$. \section{Statics and Dynamics: $\boldsymbol{\epsilon < 0, 2d}$} \label{VI} As in the previous case, the nature of the equilibrium state of the $2d$ model below $T_c$ depends strongly on BC, even in the thermodynamic limit. In I we have shown that the segment with $\epsilon < 0$ in the parameter space (see right panel of Fig.\ref{fig:pspace}) is the coexistence line of states spontaneously-magnetized in opposite directions, when PBC are imposed, while it is a line of critical points with APBC. Since this is a crucial point, let us overview the equilibrium picture before turning to the discussion of the quench dynamics. \begin{figure}[ht] \centering \includegraphics[width=10cm]{pannello2-sublabel.pdf} \caption{Typical equilibrium configurations below $T_c$. In the PBC case (a) one black domain of up spins fills the entire systems. Thermal fluctuations produce the small white domains of down spins. In the APBC case (b) there are two large domains separated by one interface cutting across the system. Within each domain there are the small patches of reversed spins due to thermal fluctuations.} \label{fig:conf} \end{figure} \subsection{{\bf Equilibrium with PBC}} \label{PBCsotto} When PBC are imposed, two confining components of spins aligned either prevalently up or prevalently down, are formed in phase space. A configuration typical of the up component is shown in the left panel of Fig.\ref{fig:conf}. In the thermodynamic limit these components become absolutely confining, ergodicity breaks down and, therefore, we are confronted with the same situation discussed in the $1d$ case at $T=0$. Namely, the Gibbs state becomes the even mixture of the two broken-symmetry pure states like in Eq.~(\ref{mixt.0}), that is \begin{equation} P_{\rm eq}^{(p)}(\boldsymbol{s}) = \sum_\alpha p(\alpha) P_\alpha (\boldsymbol{s}). \label{mix.1} \end{equation} Here, $\alpha = \pm$ is the component label, the mixing probability is uniform $p(\alpha)=1/2$ and $P_\alpha (\boldsymbol{s})$ is the ferromagnetic pure state. The nonvanishing spontaneous magnetization density $m_\alpha$ is given by \begin{equation} m_-=-m_+, \quad |m_\alpha| = |\epsilon|^\beta, \quad \beta=1/8. \label{mix.2} \end{equation} Using the above definitions and rewriting the Gibbs average in terms of the component averages, i.e. $\langle \cdot \rangle_{\rm eq} = \sum_\alpha p(\alpha) \langle \cdot \rangle_\alpha$, the equilibrium correlation function can be rearranged in the form \begin{equation} C_{\rm eq}^{(p)}(r,\epsilon) = \overline{ \langle (s_i -m_\alpha) (s_{i+r} -m_\alpha) \rangle_\alpha} \; + \; \overline{[\langle s_i \rangle_\alpha - \overline{m_\alpha}] [\langle s_{i+r} \rangle_\alpha - \overline{m_\alpha}]}, \label{mix.4} \end{equation} where the overline denotes averaging with respect to $p(\alpha)$. The first contribution is the average over components of the {\it intra}-component correlation function $\langle \psi_i \psi_{i+r} \rangle_\alpha$, where the variables $\psi_i = s_i - m_\alpha$ represent the thermal fluctuations in the pure state $P_\alpha (\boldsymbol{s})$. As it is intuitively clear, deviations from the average by symmetry do not depend on $\alpha$, so we shall use the notation $G_{\rm eq}(r,\epsilon)$ for $\langle \psi_i \psi_{i+r} \rangle_\alpha$. At low $T_F$ this quantity is short ranged, since in the broken-symmetry state the correlation length $\xi_\psi$ of the $\psi$ variables vanishes as $T_F \to 0$. The second term, instead, represents the {\it inter}-components contribution, which reduces to $m^2_\alpha$, since $\overline{m_\alpha}=0$ and $m^2_\alpha$ is independent of $\alpha$. Thus, in the end, from the Gibbs average we have \begin{equation} C_{\rm eq}^{(p)}(r,\epsilon) = G_{\rm eq}(r,\epsilon) +m^2_\alpha. \label{mix.5} \end{equation} It is important, for what follows, to keep in mind that the constant term $m^2_\alpha$, which is the variance of the variable $m_\alpha$ distributed according to $p(\alpha)$, arises exclusively from the mixing as the constant term in Eq.~(\ref{1dI.16}). Therefore, in the PBC case the only dynamical variables are the $\psi_i$, which means that the dynamical rule updates $\psi_i$, but not $m_\alpha$. The magnetization distribution exhibits the double peak structure~\cite{Binder,Bruce} which, in the thermodynamic limit, becomes the sum of the two $\delta$ functions \begin{equation} P^{(p)}(m|\epsilon) = \frac{1}{2} [ \delta(m-m_-) + \delta(m-m_+)]. \label{mix.60} \end{equation} Hence, as explained in the $1d$ case, the meaningful averages are those taken with the broken symmetry ensembles $P_\alpha (\boldsymbol{s})$, which coincide with time averages and give \begin{equation} C_{\alpha,\rm eq}^{(p)}(r,\epsilon) = G_{\rm eq}(r,\epsilon). \label{mix.5bis} \end{equation} \subsection{{\bf Equilibrium with APBC}} \label{APBCeq} When APBC are imposed, like in the $1d$ case ergodicity does not break. As explained in I, there is only one ergodic component, whose typical configurations at sufficiently low $T_F$ are composed of two large ordered domains, separated by one interface cutting across the system and sweeping through it, as illustrated in the right panel of Fig.\ref{fig:conf}. This suggests to split the spin variable into the sum of two independent components \begin{equation} s_i = m_{\alpha(i)}+ \psi_i, \label{split.1} \end{equation} where $\alpha(i)=\pm$ is the label of the domain to which the site $i$ belongs and $\psi_i=s_i - m_{\alpha(i)}$ is, as before, the thermal fluctuation variable. The significant difference with respect to the previous case is that now $\psi_i$ and $m_{\alpha(i)}$ are both dynamical variables, since the fluctuations of the latter one are not due to the mixing of pure states, but to the transit of the interface through the site $i$, which means that the dynamical rule updates both $\psi_i$ and $m_{\alpha(i)}$. Using the independence of these variables and the vanishing of averages $\langle s_i \rangle_{\rm eq} = \langle m_{\alpha(i)} \rangle_{\rm eq} =\langle \psi_i \rangle_{\rm eq} =0$, the correlation function can be written as the sum of two contributions \begin{equation} C_{\rm eq}^{(a)}(r,\epsilon,L^{-1}) = G_{\rm eq}(r,\epsilon) + D_{\rm eq}(r,\epsilon,L^{-1}), \label{mix.6} \end{equation} which have quite different properties. The first one, which is the same as in Eq.~(\ref{mix.5}), is short ranged. The $L$ dependence has been neglected, because we may always assume that the conditions for $\xi_\psi \ll L$ are realized. The second one, which contains the correlations of the background variables $m_{\alpha(i)}$, i.e. \begin{equation} D_{\rm eq}(r,\epsilon,L^{-1}) = \frac{1}{V} \sum_i \langle m_{\alpha(i)} m_{\alpha(i+r)} \rangle_{\rm eq}, \label{mix.7} \end{equation} has been studied numerically in I and scales as \begin{equation} D_{\rm eq}(r,\epsilon,L^{-1}) = \frac{1}{r^a}Y(\epsilon,r/L), \quad \text{where} \quad Y(\epsilon,x) = m^2_\alpha (1-x). \label{mix.8} \end{equation} We have retained the power-law prefactor $r^{-a}$ in front, even though now $a=0$ because the correlated clusters of the background variables are compact, in order to emphasize the similarity with Eq.~(\ref{sat.1}) and to render it evident by inspection that the correlation length $\xi_m$ of these variables coincides with $L$. Notice that $\epsilon$ does not enter the scaling function but only its amplitude through $m^2_\alpha$. From the divergence of $\xi_m$ in the thermodynamic limit, there follows that the whole segment on the $\epsilon$ axis with $\epsilon < 0$ is a locus of critical points, as anticipated above. The corresponding critical properties can be extracted by using $L^{-1}$ as the parameter of approach to criticality. It should be clear that this is bulk criticality, in no way related to the properties of the interface, to which the attention of previous studies of the APBC model was primarily directed. In I we have shown that the exponents satisfy the relations $\dot{\beta}/\dot{\nu} = 0$ and $\dot{\gamma}/\dot{\nu}=d$, where the dots identify the exponents with respect to $L^{-1}$, e.g. from $\xi_m \sim L$, follows $\dot{\nu} = 1$. This implies $\dot{\beta} = 0$ and $\dot{\gamma} = d$. Hence, the hyperscaling relation $2\dot{\beta} + \dot{\gamma} = \dot{\nu}d$ is satisfied, suggesting that the upper critical dimensionality might diverge. So, if now we take the thermodynamic limit, from Eqs.~(\ref{mix.6}) and~(\ref{mix.8}) we get \begin{equation} C_{\rm eq}^{(a)}(r,\epsilon) = G_{\rm eq}(r,\epsilon) + \frac{m^2_\alpha}{r^a}, \label{mix.6bis} \end{equation} and, consequently, the susceptibility of the background variables $\chi^{(a)}_m$ diverges like \begin{equation} \chi^{(a)}_m(\epsilon,L^{-1}) \sim L^d, \label{mix.9bis} \end{equation} in agreement with Eq.~(\ref{susc.1}), the $m$-CK clusters being compact. The strong magnetization fluctuations, implied by the divergence of the susceptibility, are indeed exhibited by the distribution $P^{(a)}(m)$ which, instead of being double peaked like in Eq.~(\ref{mix.60}), has been shown in I to be uniform over the interval $[m_-,m_+]$. The qualitative difference between $P^{(p)}(m)$ and $P^{(a)}(m)$ is the same previously analyzed in the $1d$ case and schematically represented in Fig.\ref{fig:1}. The uniformity of $P^{(a)}(m)$ is the distinctive feature which highlights the difference between condensation of fluctuations and the usual ordering transition associated to the double-peak structure of Eq.~(\ref{mix.60}). \subsection{Relaxation Dynamics} When the relaxation of the infinite system is studied, by taking first the thermodynamic limit, the dependence on BC is expected to disappear, because at any finite time the correlation length is limited by $R$. This is confirmed by the snapshots of the typical configurations (see Fig.\ref{fig:conf1}) taken after the quench to $T_F/T_c = 0.79$. The top panel depicts the PBC case and the bottom panel the APBC one. In each panel time increases from left to right. The first three snapshots, taken at $t=1,10,100$, display the self-similar morphology characteristic of coarsening domains, which does not show to be affected by the type of the imposed BC, because $R \ll L$. The BC influence is evident, instead, in the fourth snapshot taken at $t=10^5$, when $R \gtrsim L$ and the system has equilibrated. \begin{figure}[ht] \centering \includegraphics[width=10cm]{pannello-sublabel.pdf} \caption{The two panels show the sequence of snapshots taken at $t=1, 10, 100, 10^5$ with PBC (a) and APBC (b), after a quench at $T_F=1.8$, with $L=256$. Time increases from left to right. The first three configurations belong to the coarsening regime and show independence from BC. The last pair of configurations is morphologically similar to those in Fig.~\ref{fig:conf} and shows that at $t=10^5$ the system has equilibrated.} \label{fig:conf1} \end{figure} The configurations morphology, with large compact growing domains containing in their interior small patches of thermal fluctuations, suggests to generalize to the off-equilibrium regime the split of variables~(\ref{split.1}) by $s_i(t) = m_{\alpha(i,t)}+ \psi_i(t)$, where $\alpha(i,t)$ is the label of the domain to which the site $i$ belongs at the time $t$. Then, as in Eq.~(\ref{mix.6}), the correlation function separates into the sum of two contributions \begin{equation} C(r,\epsilon,t^{-1}) = G_{\rm eq}(r,\epsilon) + D(r;\epsilon,t^{-1}), \label{gen.19} \end{equation} where the first one is BC-independent, time-independent and identical to the analogous term appearing in Eqs.~(\ref{mix.5}) and~(\ref{mix.6}), because thermal fluctuations equilibrate quickly. The second contribution contains the correlations of the background variables and obeys scaling in the form \begin{equation} D(r,\epsilon,t^{-1}) = \frac{m^2_\alpha}{r^a} F(r/R), \label{gen.20} \end{equation} where $a=0$, due to the compactness of domains, the growth law $R(t) = t^{1/z}$ is the same of Eq.~(\ref{anml.3bis}) with $z=2$ and the $\epsilon$ dependence has been factorized in the amplitude $m^2_\alpha$. Comparing with Eq.~(\ref{sat.3}), we see that the same behavior as in the quench to $T_c$ is obtained, apart for the change of the exponents $z$ and $a$, and for the specific forms of the functions $F_c(x)$ and $F(x)$. \begin{figure}[ht] \centering \includegraphics[width=10cm]{fig8.pdf} \caption{Collapse on the master curve of Eq.~(\ref{quench.1}) of the data for $C(r,t^{-1},L^{-1})$ in the time regime $R \ll L$, system size $L=256$. PBC (black symbols) and APBC (empty symbols). The continuous line is the plot of the Ohta-Jasnow-Kawasaki function defined in Eq.~(\ref{OJK}).} \label{fig:scaledCbis} \end{figure} The above statements are substantiated by the plot in Fig.\ref{fig:scaledCbis} of the numerical data for the equal-time correlation function, generated for a quench to $T_F/T_c=0.666$, which corresponds to $\epsilon = -0.9$, with $L=256$ and with both PBC and APBC. The APBC data have been circularly averaged to smooth out the anisotropy induced by the cylindrical BC. The good collapse of the data, in the time regime such that $R \ll L$, shows that for the chosen value of $T_F$ the thermal fluctuations contribution is negligible. Moreover, the master curve $F(x)$ compares well with the Otha-Jasnow-Kawasaki~\cite{OJK} approximate result \begin{equation} F(x) = \left (\frac{2}{\pi} \right ) \arcsin (\gamma), \quad \gamma = \exp(-x^2/b), \label{OJK} \end{equation} where $b$ is a constant, as it is demonstrated by Fig.\ref{fig:scaledCbis}. Therefore, the relaxation to below $T_c$ is not qualitatively different from the one to $T_c$. Both are coarsening processes and both do not depend on the imposed BC. Differences between the two are in the quantitative details, like the values of the $z$ exponent, the dimensionality of correlated clusters and the shape of the scaling functions. The implication is that also in the quench to below $T_c$ the system tends toward a critical state, because the time-dependent correlation length $R$ diverges, eventually yielding the time-asymptotic critical correlation function \begin{equation} C^*(r,\epsilon)= G_{\rm eq}(r,\epsilon) + \frac{m^2_\alpha}{r^a}. \label{dyna.5} \end{equation} It is then evident, according to the discussion made at the end of subsection~\ref{APBCeq}, that this asymptotic form, which we emphasize once more is the same for both choices of BC, matches $C^{(a)}_{\rm eq}(r;\epsilon)$ but not $C^{(p)}_{\rm eq}(r;\epsilon)$. Finally, recalling that $a=0$, it is straightforward to see from Eq.~(\ref{gen.20}) that the background susceptibility scales like \begin{equation} \chi (\epsilon,t^{-1}) \sim R^d, \label{dyna.6} \end{equation} in agreement with the result~(\ref{mix.9bis}) for $\chi^{(a)}_m(\epsilon,L^{-1})$. In conclusion, in the PBC case, as anticipated in the Introduction, the asymptotic state and the equilibrium one are remote one from the other, and the system may be regarded as remaining strongly out of equilibrium, because in the former one there are long-range correlations, which are absent in the second one. In the APBC case, instead, both the asymptotic and the equilibrium state are critical and with the same universal properties, hence the system equilibrates although with an infinite equilibration time, just as in the quench to $T_c$. \subsection{Summary} So far we have shown that when the Ising model is quenched in the two-phase region, i.e. to below $T_c$ for $d=2$ and to $T_F=0$ for $d=1$, the APBC system equilibrates and the PBC one remains off equilibrium. The basic elements of the mechanism underlying this phenomenology are as follows: \begin{enumerate} \item To different BC, in principle, there correspond different statistical ensembles. \item These ensembles become {\it equivalent} when the limits are taken according to the sequence: $L^{-1} \to 0$ first and then $t^{-1} \to 0$, for all temperatures $T_F$. \item Instead, the ensembles {\it may} become {\it non equivalent}, depending on BC, when the limits are taken in the reverse sequence: $t^{-1} \to 0$ first and then $L^{-1} \to 0$ with $T_F < T_c$. \item Equivalence fails with PBC because of ergodicity breaking, and holds with APBC since ergodicity is preserved. \item Ergodicity breaking induces spontaneous symmetry breaking, which makes correlations short-ranged. \item Instead, when ergodicity holds an unusual type of criticality sets in, with long-range correlations and {\it compact} correlated domains. \end{enumerate} In the next section we shall show that this is not just a peculiarity of the Ising model, but that it is a more general phenomenon, since it takes place with the same characteristics also in the quench to below the critical point of the spherical model, without invoking the imposition of different types of BC. In fact, two different ensembles arise not from the choice of BC, which is taken to be the standard PBC one, but from enforcing the spherical constraint either sharply or smoothly. These ensembles turn out to be equivalent or non equivalent, just as in the Ising case, depending on the order of the $L^{-1} \to 0$ and $t^{-1} \to 0$ limits. \section{Spherical models} \label{SM} \subsection{Equilibrium} Let us briefly recall what the spherical model is about starting from equilibrium, which means that the $t^{-1} \to 0$ limit has been taken beforehand. Consider a classical paramagnet in the volume $V=L^d$ and with the energy function~\cite{Ma} \begin{equation} {\cal H}(\boldsymbol{\varphi}) = \int_V d\vec r \, \varphi(\vec r) \left (-\frac{1}{2}\nabla^2 \right )\varphi(\vec r), \label{gauss.1} \end{equation} where $\boldsymbol{\varphi}$ stands for a configuration of the local, continuous and unbounded spin variable $\varphi(\vec r)$. PBC are understood throughout. Due to its bilinear character, the above Hamiltonian can be diagonalized by Fourier transform \begin{equation} {\cal H} = \frac{1}{2V}\sum_{\vec k} k^2|\varphi_{\vec k}|^2. \label{gauss.1bis} \end{equation} In the spherical model (SM) of Berlin and Kac~\cite{BK} a coupling among the modes is induced by the imposition of an overall sharp constraint on the square magnetization density \begin{equation} \mathit{s}(\boldsymbol{\varphi}) = \frac{1}{V} \int_V d \vec r \, \varphi^2(\vec r) = \frac{1}{V^2}\sum_{\vec k} |\varphi_{\vec k}|^2 = 1. \label{gauss.2} \end{equation} Then, in thermal equilibrium the statistical ensemble is given by \begin{equation} P_\textrm{SM}(\boldsymbol{\varphi}) = \frac{1}{Z_\textrm{SM}} e^{-\beta {\cal H}(\boldsymbol{\varphi})} \, \delta \left (\mathit{s}(\boldsymbol{\varphi})-1 \right ), \label{Gauss.4} \end{equation} where $Z_\textrm{SM}$ is the partition function. A variant of the model, called the mean-spherical model (MSM)~\cite{LW,KT}, is obtained by imposing the constraint in the mean: An exponential bias is introduced in place of the $\delta$ function \begin{equation} P_\textrm{MSM}(\boldsymbol{\varphi}) = \frac{1}{Z_\textrm{MSM}}e^{-\beta [{\cal H}(\boldsymbol{\varphi}) +\frac{\kappa}{2} {\cal S}(\boldsymbol{\varphi})]}, \label{Gauss.3} \end{equation} where ${\cal S}(\boldsymbol{\varphi}) = V\mathit{s}(\boldsymbol{\varphi})$ and the parameter $\kappa$ must be so adjusted to satisfy the requirement \begin{equation} \langle \mathit{s}(\boldsymbol{\varphi}) \rangle_\textrm{MSM} = 1. \label{msph.1} \end{equation} Although it is the common usage to refer to these as models, it should be clear from Eqs. (\ref{Gauss.4}) and (\ref{Gauss.3}) that we are dealing with two conjugate ensembles, distinguished by conserving or letting to fluctuate the density $\mathit{s}$. In both models there exists a phase transition at the same critical temperature $T_c$, above which they are equivalent and below which they are not, which means that the nature of the low temperature phase is different. It is worth, here, to go in some detail~\cite{CSZ} because the point is quite illuminating on the equivalence or lack-of issue. Let us separate in $\mathit{s}$ the excitations from the ground-state contribution \begin{equation} \mathit{s} = \mathit{s}_0 + \mathit{s}^*, \quad \text{with} \quad \mathit{s}_0 = \frac{1}{V^2}\varphi_0^2, \quad \quad \mathit{s}^*= \frac{1}{V^2} \sum_{\vec k \neq 0} |\varphi_{\vec k}|^2. \label{s.1} \end{equation} Then, taking the average in either ensemble, from the spherical constraint follows the sum rule \begin{equation} \langle \mathit{s}_0 \rangle + \langle \mathit{s}^* \rangle = 1, \label{s.2} \end{equation} which must be satisfied at all temperatures and it is the motor of the transition. In fact, in the thermodynamic limit the excitations contribution is superiorly bounded~\cite{CSZ} by \begin{equation} \langle \mathit{s}^* \rangle \leq TB, \label{s.3} \end{equation} where $B$ is a dimensionality-dependent positive constant, which is finite for $d > 2$ and diverges at $d=2$. Therefore, by enforcing the constraint~(\ref{s.2}) there remains defined the critical temperature \begin{equation} T_c = 1/B, \label{s.4} \end{equation} above which the sum rule~(\ref{s.2}) is saturated without any contribution from $\langle \mathit{s}_0 \rangle$, while below there must necessarily be a finite contribution from the ground state, yielding \begin{equation} \langle \mathit{s}_0 \rangle = \left \{ \begin{array}{ll} 0, \;\; $for$, \;\; T \geq T_c,\\ 1 - T/T_c,\;\; $for$, \;\; T < T_c. \end{array} \right . \label{s.5} \end{equation} Rewriting $\mathit{s}_0 = \psi_0^2$, where $\psi_0$ is the density $\frac{1}{V}\varphi_0$, the question is how can there arise a finite contribution to $\langle \mathit{s}_0 \rangle$ from this single degree of freedom and here is precisely where the two models differ. In the SM the sharp version~(\ref{gauss.2}) of the constraint introduces enough nonlinearity for the transition to take place by {\it ordering}. This means that ergodicity breaks down inducing the spontaneous breaking of the $\mathbb{Z}_2$ symmetry. Then, exactly like in the Ising model with PBC, the probability distribution of the magnetization density, that is of $\psi_0$, results from the mixture of the two pure ferromagnetic states \begin{equation} P_\textrm{SM}(\psi_0) = \frac{1}{2}[\delta (\psi_0 - m_-) + \delta (\psi_0 - m_+)], \label{ensmbl.010} \end{equation} where $m_\pm = \pm \sqrt{1 - T/T_c}$ is the spontaneous magnetization. Thus, in this case $\langle \mathit{s}_0 \rangle_{SM}$ stands for the square of the spontaneous magnetization $m_\pm^2$. Instead, in the MSM ordering cannot take place, because the soft version~(\ref{msph.1}) of the constraint leaves the statistics Gaussian. Neither ergodicity nor symmetry break down, as in the Ising APBC case. Then, below $T_c$, the only mean to build up the finite value of $\langle \mathit{s}_0 \rangle_{MSM}$ needed to saturate the sum rule is by growing the fluctuations of $\psi_0$ through the spread out probability distribution given by \begin{equation} P_\textrm{MSM}(\psi_0) = \frac{e^{-\frac{\psi_0^2}{2(1-T/T_c)}}}{\sqrt{2\pi (1 - T/T_c)}}. \label{ensmbl.001} \end{equation} Therefore, now $\langle \mathit{s}_0 \rangle_{MSM}$ stands for the macroscopic variance of $\psi_0$. Elsewhere~\cite{EPL,CCZ,Zannetti,Merhav,Marsili}, this type of transition, characterized by the fluctuations of an extensive quantity condensing into one microscopic component, has been referred to as {\it condensation of fluctuations}. \begin{figure}[!tb] \centering \includegraphics[width=5cm]{fig9a-sublabel.pdf} \hspace{0cm} \includegraphics[width=5cm]{fig9b-sublabel.pdf} \caption{Magnetization distribution in the MSM model (a) and in the SM model (b), for $T < T_c$. The spikes in the right panel stand for $\delta$ functions.} \label{fig1} \end{figure} Comparing Figs.~\ref{fig1} and~\ref{fig:1}, it is evident that the distributions are the same in the two cases where ergodicity breaks down, that is in the Ising model with PBC and in the SM. In the other two cases, Ising with APBC and MSM, the distributions are not superimposable but show the same physical phenomenon: ergodicity is preserved by developing macroscopic fluctuations of the magnetization, which remain finite in the thermodynamic limit and reveal the critical nature of the low temperature phase. In fact, in the MSM the structure factor, i.e. the Fourier transform of the correlation function, is given by~\cite{CCZ} \begin{equation} C_\textrm{MSM}(\vec k) = \frac{T}{k^2} + m_\pm^2 \delta(\vec k). \label{str.1} \end{equation} The two terms appearing above are the anolouges in Fourier space of those entering $C_{\rm eq}^{(a)}(r;\epsilon)$ in Eq.~(\ref{mix.6bis}), with the correspondences \begin{equation} G_{\rm eq}(r;\epsilon) \longleftrightarrow \frac{T}{k^2}, \quad \frac{m^2_\alpha}{r^a} \longleftrightarrow m_\pm^2 \delta(\vec k). \label{str.2} \end{equation} Notice that, as it is well known, the thermal fluctuations contribution in the MSM is massless, i.e. is critical, at all temperatures below $T_c$. For simplicity, let us set $T=0$ in order to get rid on this contribution and to focus on the interesting one, which is the $\delta$-function term (Bragg peak). We emphasize that this is the Fourier transform of the background {\it critical} contribution with compact correlated clusters, just as the corresponding term in the Ising APBC case. Finally, we point out that the $d=2$ case is analogous to Ising with $d=1$, because $T_c$ vanishes. However, for brevity, we shall not elaborate on this case here. \subsection{Dynamics} Let us next consider the relaxation dynamics in the quench to $T_F=0$. In Ref.~\cite{Fusco} it was shown that, when the thermodynamic limit is taken first, the two models are equivalent at all times. Then, it is an exact result that the dynamical structure factor both for the SM and MSM is given by \begin{equation} C(\vec k,t) = \Delta \left (1 +\frac{2r^2_0}{R^2} \right )^{d/2} R^d \, e^{-(kR)^2}, \label{str.3} \end{equation} where $C(\vec k,0)=\Delta$ is the spatially uncorrelated initial condition at $T_I=\infty$, $R = \sqrt{2t}$ is the growth law for nonconserved dynamics and $r_0 = 1/(\sqrt{2}\Lambda)$ is the microscopic length related to the momentum cutoff $\Lambda$, which is imposed exponentially when integrating over $\vec k$ and is responsible for the corrections to scaling in the early regime. From the normalization condition at $t=0$ \begin{equation} \int \frac{d^d k}{(2\pi)^d} \, C(\vec k,0) e^{-k^2/\Lambda^2} = 1, \label{str.4} \end{equation} there follows $\Delta = (2\sqrt{\pi})^d$. Inserting this into Eq.~(\ref{str.3}), with little algebra one can verify that indeed the normalization is satisfied at all times. Then, since the peak grows like $C(0,t) \sim R^d$, one can conclude that the asymptotic structure factor is the $\delta$ function \begin{equation} \lim_{t \to \infty} C(\vec k,t) = C^*(\vec k) = \delta(\vec k), \label{str.5} \end{equation} which matches the equilibrium Bragg peak~(\ref{str.1}) in the MSM. Since the growth of $R$ implies that the asymptotic state is critical and with compact correlated clusters, in the quench to below $T_c$ the MSM approaches equilibrium arbitrarily close, while the SM, which is not critical in the equilibrium state, remains permanently out of equilibrium. In conclusion, going through all the items listed at the end of the previous section, one can check that perfect correspondence between Ising-PBC and SM on one side and Ising-APBC and MSM on the other is established. \section{Concluding Remarks} \label{CR} In this paper we have addressed a problem which is of basic interest in the physics of slowly relaxing systems. Since slow relaxation means that equilibrium is not reached in the observable time scale, relevant questions are whether a criterion for equilibration, or for lack of, can be established and, if so, whether the nature of the equilibrium state can be inferred from the available dynamical information. Although the task of giving general answers to these questions is of formidable difficulty, we have shown that, at least in the restricted realm of phase-ordering systems, it is possible to arrive at some definite conclusions. By analyzing the relaxation of the Ising model after temperature quenches, we have found that the system does or does not equilibrate, depending on whether the dynamics at the final temperature of the quench is ergodic or not. This has been established by investigating the dependence of the spin-spin correlation function upon the order of the large-time and thermodynamic limits, when different BC are imposed. The findings are that the APBC system equilibrates in all conditions, because the dynamics are ergodic at all temperatures, while the PBC system does not equilibrate for $T_F < T_c$, because that's where ergodicity does not hold. These statements are strengthened and corroborated by exact analytical results from the quench of the spherical and mean spherical model, which reproduce very closely, although in a quite different context, the picture just outlined. We may then answer the first question asked at the beginning of the section by saying that it might take an infinite time to equilibrate, but nonetheless the system can get arbitrarily close to equilibrium if the dynamics are ergodic. Instead, if ergodicity is broken, and if the initial state is symmetric, the system does not get close to equilibrium, no matter how long is let to relax. For what concerns the second question, the answer is that, yes, once it is established that the system approaches equilibrium, then the nature of the equilibrium state can be inferred from the dynamical information. Consider first the quench to $T_c$, in which case the time-dependent correlation function obeys the scaling form~(\ref{sat.3}), while in the equilibrium state it decays according to the pure power law~(\ref{sat.2}). It is then evident that the latter result can be reconstructed from the short distance behaviour, i.e. for $r \ll R$, at times finite but large enough to detect a clean scaling behaviour. The same procedure applies also in the case of the quench to below $T_c$ with APBC, where the background component of the correlation function is given by Eq.~(\ref{gen.20}). Then, again the short distance approximation, which in this case is a constant term since $a=0$, reproduces correctly the form of the equilibrium critical correlation function. Finally, let us comment on the nature of the line of critical points on the $\epsilon < 0$ segment in the Ising APBC case. According to the view put forward in this paper, $t^{-1}$ is just another relevant parameter measuring the distance from criticality, on the same footing with $\epsilon$ and $L^{-1}$, so that these critical points control both statics and dynamics. In subsection \ref{APBCeq} we have pointed out that the static critical exponents, defined with respect to $L^{-1}$, satisfy the hyperscaling relation $2\dot{\beta} + \dot{\gamma} = \dot{\nu }d$ for all $d$, suggesting that the upper critical dimension is at $d=\infty$. It is then interesting to note the concomitance with the fact that the Otha-Jasnow-Kawasaki approximate theory, which accounts well for the time dependent correlation function as shown in Fig.\ref{fig:scaledCbis}, becomes exact in the $d \to \infty$ limit~\cite{Bray}. \begin{acknowledgements} A.F. acknowledges financial support of the MIUR PRIN 2017WZFTZP "Stochastic forecasting in complex systems". \end{acknowledgements}
\section{Introduction} A finite graph $\Delta$ is a \emph{minor} of the graph $\Gamma$ if $\Delta$ can be obtained from $\Gamma$ by contracting edges and deleting edges and vertices. A graph $\Gamma$ is said to be \emph{minor excluded} if there exists some finite graph that is not a minor of $\Gamma$. Many interesting graph-theoretic properties can be characterised using minor exclusion, or more precisely, exclusion of specific minors. The famous theorem of Kuratowski \cite{Kur} states that a graph is planar if and only if it does not have the graphs $K_5$ and $K_{3,3}$ as minors. In fact, it is a consequence of the relatively recent Robertson--Seymour Theorem \cite{RS} that any minor-closed property of finite graphs (i.e. a property preserved by passing to a minor) can be characterised via a finite set of forbidden minors -- i.e. for such a property, there is a finite set of graphs such that having this property is equivalent to not possessing any minors in this finite set. One can apply graph-theoretic notions to study finitely generated groups, by considering their Cayley graphs. Whether or not a given graph appears as a minor can depend on the choice of generating set -- we must therefore choose whether we would like the graph-theoretic property in question to hold for at least one choice of generating set, or for any choice of generating set. There already exists a large body of work on the topic of planarity of Cayley graphs. The question of which groups admit a planar Cayley graph was first answered for finite groups by Maschke in 1896. Since, there has been much study of this property for finitely generated groups, see for example \cite{AC, Dro, DSS, Geo, Ren}. The more general property of having excluded minors has not been explored as much in geometric group theory. In \cite{AC}, Arzhantseva and Cherix prove that generic (in a certain precise sense) finitely presented groups admit a $K_{2m+1}$ minor, where $m$ is the number of generators of the groups. Our main reference for this topic is \cite{OR}, in which Ostrovskii and Rosenthal prove several fundamental results on minor exclusion in Cayley graphs. In particular, they show the following. \begin{itemize} \item If $G$ is a finitely generated group with one end, then there is a finite generating set $S$ of $G$ such that $\Cay(G,S)$ is not minor excluded. \item There exist groups (e.g. $\mathbb{Z}^2$) that are minor excluded with respect to one choice of generating set, and not minor excluded with respect to another. \item Admitting a Cayley graph that is minor excluded is preserved under free products. \item Virtually free groups are minor excluded for any choice of generating set. \end{itemize} It is surprisingly often the case in graph theory that an obviously necessary condition also turns out to be sufficient. Ostrovskii and Rosenthal ask the following question about the reverse implication of their final result above. \begin{question}[\cite{OR}, Problem 4.2] Is an infinite, finitely generated group that is minor excluded with respect to any choice of generating set necessarily virtually free? \end{question} Being virtually free is equivalent to many diverse properties, for example, being quasi-isometric to a tree \cite{GdlH}, being finitely presentable with asymptotic dimension equal to $1$ \cite{Gen,JS}, and having context-free word problem \cite{MS}. Many of these characterisations use Dunwoody's theorem on the accessibility of finitely presented groups \cite{Dun} (see \cite{Ant} for proofs of several characterisations that do not depend on this result). We answer the question of Ostrovskii and Rosenthal affirmatively, providing a new graph-theoretic characterisation of virtually free groups. We note that this characterisation does not use the accessibility of finitely presented groups. \begin{thm} A finitely generated, infinite group is virtually free if and only if for any finite generating set, the corresponding Cayley graph is minor excluded. \end{thm} The ``only if'' direction of the theorem is Theorem 3.7 of \cite{OR}. In \Cref{ResultSection}, we first prove that any finitely generated group that is minor excluded with respect to every finite generating set is accessible, using a graph-theoretic characterisation of accessibility due to Thomassen and Woess \cite{TW}. We then show that if a finitely generated, infinite group is such that all of its Cayley graphs with respect to finite generating sets are minor excluded, then it is virtually free. The relevant preliminaries are introduced in Sections \ref{EndSection} and \ref{MinorSection}. \section{Ends and accessibility}\label{EndSection} Two one-way infinite paths in a graph $\Gamma$ are said to be equivalent if the tails of the paths remain in the same connected component of $\Gamma \setminus F$ for any finite subset of vertices $F$ of $\Gamma$. The set of equivalence classes of one-way infinite paths induced by this equivalence relation is the \emph{set of ends} of $\Gamma$. The number of ends of a graph is a quasi-isometry invariant. In particular, when the graph in question is the Cayley graph of a finitely generated group $G$, the number of ends is independent of the choice of finite generating set, and we can thus refer to the number of ends of the group $G$. The following are well-known results linking the number of ends of a group to its algebraic properties. \begin{Thm}[\cite{Hop}]\label{Hopf} Let $G$ be a finitely generated group. Then \begin{itemize} \item $G$ has $0$, $1$, $2$, or infinitely-many ends; \item $G$ has $0$ ends if and only if it is finite; \item $G$ has $2$ ends if and only if it is virtually $\mathbb{Z}$. \end{itemize} \end{Thm} \begin{Thm}[\cite{Sta}] Let $G$ be a finitely generated group. Then $G$ has infinitely many ends if and only if $G$ splits as an amalgamated free product $A*_C B$ or HNN-extension $A*_C$ with $C$ finite and $|A/C|\geq 3$ and $|B/C|\geq 2$. \end{Thm} Thus, a group with $\geq 2$ ends can be decomposed into smaller pieces via one of the splittings described above. It may be that the groups $A$ and $B$ can themselves be decomposed via an amalgamated free product or HNN extension over a finite subgroup. Iterating such (non-trivial) decompositions may not always terminate in a finite number of steps. When it does, the group is termed \emph{accessible}. Otherwise, we say it is \emph{inaccessible}. Finitely presented groups are known to be accessible by a result of Dunwoody \cite{Dun}, as are groups with a bound on the order of their finite subgroups by a result of Linnell \cite{Lin}. In \cite{TW}, Thomassen and Woess explore graph-theoretic counterparts to accessibility. We now summarise the necessary terminology and results from Section 4 of \cite{TW}. Given a connected, locally finite graph $\Gamma$, let $\omega$ be an end. We say that a pairwise disjoint sequence of vertex subsets $X_0, X_1, \ldots$ is a \emph{defining sequence of vertex sets for $\omega$} if for all $i\geq 0$, $$X_{i+1} \subset \Gamma_i \ \ \text{ and } \ \ \Gamma_{i+1} \subset \Gamma_i,$$ where $\Gamma_i$ is the component of $\Gamma \setminus X_i$ which contains $\omega$. These conditions imply that a path lies in $\omega$ if and only if it has infinite intersection with $\sqcup_i X_i$. If there is an integer $m$ such that the $X_i$ can all be chosen to have cardinality $m$, then the end $\omega$ is said to be \emph{thin}, and the minimal such $m$ is called the \emph{size} $s(\omega)$ of $\omega$. As shown in the discussion ahead of Proposition 4.1 of \cite{TW}, $s(\omega)$ is the maximum number of pairwise disjoint one-way infinite paths in $\omega$. Thomassen and Woess give a graph-theoretic characterisation of accessibility which in the case of finitely generated groups is equivalent to the usual notion of accessibility. We summarise the result we will use as follows. \begin{Thm}[\cite{TW}, Theorem 1.1 and Corollary 8.5]\label{Inaccess} Let $G$ be a finitely generated group, and let $S$ be a finite generating set of $G$. Then $G$ is inaccessible if and only if for each $m>0$, $\Cay(G,S)$ has a thin end of size $\geq m$. \end{Thm} \section{Graph minors}\label{MinorSection} Let $\Gamma$ be a graph and let $\Delta$ be a finite graph. Write $V(\Delta)$ to mean the vertex set of $\Delta$. We say that $\Delta$ is a \emph{minor} of $\Gamma$ if there exist $|V(\Delta)|$ pairwise-disjoint connected finite subsets $V_1, V_2, \ldots V_{|V(\Delta)|}$ of $V(\Gamma)$ that are in bijection with the vertices of $\Delta$, such that there is an edge between some vertex of $V_i$ and some vertex of $V_j$ in $\Gamma$ whenever the corresponding vertices of $\Delta$ are connected by an edge in $\Delta$. We say the graph $\Gamma$ is \emph{minor excluded} if there exists some finite graph that is not a minor of $\Gamma$. Note that a graph $\Gamma$ is minor excluded if and only if there is some $m\in \mathbb{N}$ such that the complete graph $K_m$ on $m$ vertices is not a minor of $\Gamma$. This is because every finite graph is a subgraph of some $K_m$. For groups, whether or not the Cayley graph contains a given minor clearly depends on the choice of generating set. A very simple example is the group $\mathbb{Z}_5$ taken with the generating sets $S:= \{\pm 1\}$ and $T:=\mathbb{Z}_5$: $\Cay(\mathbb{Z}_5, S)$ is clearly planar and does not contain $K_5$ as a minor, while $\Cay(\mathbb{Z}_5,T)$ is precisely $K_5$. In \cite{OR}, Ostrovskii and Rosenthal prove that the property of minor exclusion also depends on the generating set, by exhibiting a generating set with respect to which the group $\mathbb{Z}^2$ is not minor excluded i.e. contains all finite graphs as minors; however $\mathbb{Z}^2$ is planar and thus minor excluded with respect to the standard generating set $\{(\pm 1,0),(0,\pm 1)\}$. Note that this gives an example of a $1$-ended group which can be minor excluded, or not, depending on the generating set. The concept of ends defined in the previous section is intuitively a relevant one for minor exclusion. We can summarise the known relationships between the number of ends of a finitely generated group and minor exclusion as follows. \begin{itemize} \item $0$-ended groups are finite and are thus minor excluded with respect to any generating set. \item $1$-ended groups admit a generating set with respect to which they are not minor excluded (\cite{OR}, Theorem 3.11). \item $2$-ended groups are virtually free and are thus are minor excluded with respect to any generating set (\cite{OR}, Theorem 3.7). \end{itemize} Only the case of groups with infinitely many ends remains. In the next section, we show that there do exist groups with infinitely many ends that admit a Cayley graph that is not minor excluded (\Cref{infinity2}). This can also be deduced from our main result, \Cref{result}, which characterises virtually free groups as exactly those groups that are infinite and are minor excluded with respect to any generating set. Finally, we note the following easy lemma, which we will use in the last section. \begin{Lemma}\label{Subgroup} Let $G$ be a finitely generated group and let $H$ be a finitely generated subgroup of $G$. If $H$ is not minor excluded for some finite generating set $S$, then there exists a finite generating set of $G$ with respect to which $G$ is not minor excluded. \end{Lemma} \begin{proof} Let $T$ be a finite generating set of $G$. The Cayley graph $\Cay(G,S\cup T)$ contains a copy of $\Cay(H,S)$ as a subgraph, an thus any minors of $\Cay(H,S)$ are also minors of $\Cay(G,S\cup T)$. \end{proof} \section{Characterising virtually free groups}\label{ResultSection} In \cite{OR}, Ostrovskii and Rosenthal show that a virtually free group is minor excluded with respect to any finite generating set. We will now show that a finitely generated, infinite group that is minor excluded with respect to any finite generating set is virtually free. We will in fact prove that if a finitely generated group is minor excluded with respect to any finite generating set, then it is accessible. We then complete the proof of the theorem with the following proposition. \begin{Prop}\label{Access} An accessible, infinite, finitely generated group that is minor excluded with respect to any finite generating set is virtually free. \end{Prop} \begin{proof} Let $G$ be an accessible, infinite, finitely generated group that is minor excluded with respect to any finite generating set. Since $G$ is accessible, it can be realised as the fundamental group of a finite graph of groups where each edge group is finite and each vertex group is finitely generated and has $\leq 1$ end. By Theorem 3.11 of \cite{OR}, a group with one end admits a finite generating set with respect to which it is not minor excluded. Since $G$ is minor excluded for all finite generating sets, by \Cref{Subgroup}, there can be no vertex groups with 1 end. Thus, all vertex groups are finite, whence $G$ is virtually free by \cite{KPS}. \end{proof} \begin{Thm}\label{Main} A finitely generated group that is minor excluded with respect to any finite generating set is accessible. \end{Thm} \begin{proof} We will show that an inaccessible group admits a generating set with respect to which it is not minor excluded. Suppose that $G$ is inaccessible, and fix some generating set $S$ of $G$. Then by \Cref{Inaccess}, for each integer $m>0$, $\Cay(G,S)$ has a thin end $\omega$ of size $\geq m$, and thus, there are $\geq m$ pairwise disjoint one-way infinite paths in $\omega$. We will use these to build a $K_m$ minor in the Cayley graph $\Cay(G,S\cup S^2\cup S^3)$, using a technique from the proof of Lemma 3.12 of \cite{OR}. Here, $S^k$ denotes the set $\{s_1 s_2 \cdots s_k: s_i\in S\}$. This will show that $\Cay(G,S\cup S^2\cup S^3)$ is not minor excluded. Let $R_1, R_2, \ldots R_m$ be vertex subsets in $\Cay(G,S)$ making up $m$ pairwise disjoint one-way infinite paths in $\omega$. We will now modify these sets so that they form branch sets of a $K_m$ minor in $\Cay(G,S\cup S^2\cup S^3)$. We will look at pairs $R_i, R_j$ in turn and show that, possibly after some modification, they can be connected by paths $P_{i,j}$ in $\Cay(G,S\cup S^2\cup S^3)$ which do not intersect each other, nor any of the other (possibly modified) sets $R_k$. We start with the sets $R_1$ and $R_2$. Since $\Cay(G,S)$ is connected, there is a path $P_{1,2}$ linking some vertex of $R_1$ to some vertex of $R_2$. If $P_{1,2}$ does not intersect any of the other sets $R_3, R_4, \ldots, R_m$, then we leave $R_1, R_2$ and $P_{1,2}$ unchanged. If $P_{1,2}$ does intersect some $R_k$, then we can modify the sets to remove this intersection as follows. Suppose that the vertices of the one-way infinite path $R_k$ are $\{v_{k,1}, v_{k,2}, \ldots\}$, in the order that they appear as the path goes to infinity. If $P_{1,2}$ intersects $R_k$ in just one vertex $v_{k,i}$, then remove the offending vertex from $R_k$. The new set, which we will continue to call $R_k$, is still connected and still a one-way infinite path in $\Cay(G,S\cup S^2\cup S^3)$, and remains disjoint from $R_1$ and $R_2$. If $P_{1,2}$ intersects $R_k$ in two vertices $v_{k,i}, v_{k,i+1}$ appearing consecutively on the path $R_k$, then remove both from $R_k$. Again, the new set $R_k$ is still connected and still a one-way infinite path in $\Cay(G,S\cup S^2\cup S^3)$, and remains disjoint from $R_1$ and $R_2$. In case of an intersection that doesn't fall under these two cases, we need to modify both $P_{1,2}$ and $R_k$. Let $v_{k,i}$ be the first vertex of $R_k$ that $P_{1,2}$ intersects, and let $v_{k,j}$ be the last vertex that it intersects, with $j> i+1$. Remark first that any number $N\geq 2$ can be decomposed as a sum $N=2r +3s$, with $r,s\in \mathbb{N}$. So, since there are $j-i\geq 2$ edges along $R_k$ between $v_{k,i}$ and $v_{k,j}$ in $\Cay(G,S)$, we can find a path $L$ using elements in $S^2 \cup S^3$ between $v_{k,i}$ and $v_{k,j}$, and also a path $L'$ using elements in $S^2\cup S^3$ between $v_{k,i+1}$ and $v_{k,j+1}$, such that the vertices of $L$ and $L'$ lie in $R_k$ and $L$ does not intersect $L'$. We then modify the path $P_{1,2}$ by replacing the section between $v_{k,i}$ and $v_{k,j}$ by the path $L$, and we modify $R_k$ by replacing the section between $v_{k,i+1}$ and $v_{k,j+1}$ by the path $L'$. The new set $R_k$ now forms a one-way infinite path in $\Cay(G,S\cup S^2\cup S^3)$ that does not intersect $R_1$ and $R_2$, nor the modified path $P_{1,2}$ that joins them. The above modifications have removed the intersections of $P_{1,2}$ with $R_k$, without introducing any new intersections with other $R_i$, $i\neq 1,2$. We can thus look at each $R_i$, $i\neq 1,2$ in turn and remove any intersections with $P_{1,2}$ via the modifications above. We will then have a path $P_{1,2}$ joining $R_1$ and $R_2$ that does not intersect any of the other (possibly modified) $R_i$, $i\neq 1,2$. We then proceed inductively to join all pairs of sets $R_i, R_j (i\neq j)$ via paths that do not intersect any of the other $R_k$, nor any of the paths already created. Once such a path between one pair has been obtained via the process above, we can then find a ball $B$ about the identity in $\Cay(G,S)$ that is large enough to contain all of the paths $P_{i,j}$ that we have formed thus far, and all of the vertices that were used in modifications of the $R_k$. We can then consider $\Cay(G,S)\setminus B$. Since the one-way infinite paths $R_i$ correspond to the same end $\omega$, the restrictions of the sets $R_i$ to $\Cay(G,S)\setminus B$ are still in the same connected component of $\Cay(G,S)\setminus B$, whence we can run the above procedure on (the restrictions of) the next pair of one-way infinite paths. This next round of modifications of the $R_i$ will not destroy the previous connections, as the new modifications take place outside of $B$. At the end, we will have paths $P_{i,j}$ for every pair of sets $R_i,R_j$, that do not intersect any of the other $R_k$, nor any of the other paths between them. Moreover, there is some ball $B'$ of finite radius in $\Cay(G,S\cup S^2\cup S^3)$ containing all of the paths $P_{i,j}$. For each path $P_{i,j}$ from $R_i$ to $R_j$, attribute the first half of vertices appearing along the path to $R_i$, and the second half to $R_j$ (making a choice for a vertex in the middle, if it exists). For each $i$, take the truncation of the set $R_i$ to $B'$ together with the vertices in the paths $P_{i,j}$, $j\neq i$, attributed to $R_i$. These sets now form the branch sets of a $K_m$ minor in $\Cay(G,,S\cup S^2\cup S^3)$. Since we can do this for any $m$, we see that $\Cay(G,S\cup S^2\cup S^3)$ is not minor excluded. \end{proof} From the proof, we can directly deduce the following incidental corollary, which has an implication in the case of infinitely many ends. \begin{Corollary}\label{infinity1} An inaccessible group $G$ is not minor excluded with respect to any generating set of the form $S\cup S^2 \cup S^3$, where $S$ is any generating set of $G$. \end{Corollary} \begin{Corollary}\label{infinity2} There exist finitely generated groups with infinitely many ends that are not minor excluded with respect to some finite generating set. \end{Corollary} \begin{proof} By a result of Dunwoody \cite{Du93}, there exist inaccessible groups, which have infinitely many ends. Now apply \Cref{infinity1}. \end{proof} We can now deduce the main theorem, which solves Problem 4.2 of \cite{OR}. \begin{Thm}\label{result} A finitely generated, infinite group is virtually free if and only if it is minor excluded for any finite generating set. \end{Thm} \begin{proof} The ``only if'' direction of the theorem is Theorem 3.7 of \cite{OR}. For the other implication, \Cref{Main} tells us that such a group must be accessible. \Cref{Access} now completes the proof of the theorem. \end{proof} As being virtually free is equivalent to being quasi-isometric to a tree (see \cite{GdlH} for a proof), we also immediately obtain the following. \begin{Corollary} For finitely generated groups, the property of being minor excluded with respect to any generating set is a quasi-isometry invariant. \end{Corollary} \begin{acknow} Thanks to Yago Antol\'{i}n, Laura Ciobanu, and Henry Wilton for helpful comments on a first draft of this paper. \end{acknow}
\section{Proof of the First Zonklar Equation} \ifCLASSOPTIONcaptionsoff \newpage \fi \bibliographystyle{IEEEtran} \section{Introduction}\label{sec:intro}} \IEEEPARstart{D}{etermining} visual saliency of image objects is a broadly studied subject, highly applicable to a vast number of tasks, such as image quality assessment \cite{liu2011visual}, content-based image retrieval \cite{chen2009sketch2photo}, and image compression \cite{guo2009novel}. Many algorithms have been proposed to estimate visual saliency, and they can be categorized as supervised and unsupervised approaches. Supervised saliency estimators use pixel-wise ground-truth images to learn discriminant features of salient objects. The most accurate supervised algorithms are based on deep-learning techniques \cite{wang2019salient}, but they require large amounts of training data annotated by humans, and the generalization of the trained models across image datasets or image domains usually requires retraining and adaptations. Unsupervised saliency estimators, however, model saliency based on prior knowledge about the salient objects and local image characteristics, usually compromising accuracy in exchange for removing the requirement for intensive data annotation, but being more flexible across image domains. In this work, we are focused on unsupervised saliency estimators. Most unsupervised methods for saliency estimation adopt a combination of bottom-up image-extracted information and top-down domain-specific assumptions. The bottom-up information is often extracted from image regions that, given modeled assumptions, have a high likelihood of being either foreground (salient) or background. These regions, namely \concept{queries}, are compared to the rest of the image, and a similarity score defines how salient the other regions are. Top-down assumptions, on the other hand, use \concept{prior} knowledge of how humans perceive saliency -- \textit{e.g.,} increase the saliency of centered, focused, and vivid-colored objects. The available methods use a combination of pre-selected priors and query-comparison strategies to model the saliency perception of an average viewer. This pre-selection of assumptions allows for off-the-shelf methods that are easy to use and perform well in many scenarios. On the other hand, they are not extensible to applications that drift off of their pre-determined guesses. For example, if we shift the image domain from natural images to medical images, the desired saliency is not modeled after the average viewer; Rather, it is modeled after a specialist's perception. For instance, say a physician is analyzing an x-ray image of the thorax: object centering and vivid colors cease to be salient object characteristics, causing the off-the-shelf methods to perform poorly. To the best of our knowledge, there is no unsupervised saliency estimation algorithm that allows the user to select or incorporate a problem-specific set of assumptions. To fulfill this gap, we propose the \concept{ITerative Saliency Estimation fLexible Framework (ITSELF)}. ITSELF is a graph-based framework that allows user-defined \concept{priors} and \concept{query-region selection}, making it flexible to multiple image domains (Figures \ref{fig:framework} and \ref{fig:inflexibility-limitations}). Saliency is estimated by computing similarities on a superpixel graph, where the nodes are superpixels, and the arcs connect superpixels according to some adjacency relation based on the query regions. The saliency score is improved using multiple top-down prior information combined into a single prior map. Additionally, ITSELF proposes a novel approach to enhance saliency maps iteratively by using object-based superpixel delineation \cite{belem2019oisf}. This approach uses saliency information to better represent the salient objects as the union of a few superpixels. By revisiting the saliency estimation with the improved superpixels, we can also create better saliency maps and use them to re-segment the image into superpixels (Figure \ref{fig:framework}). This virtuous cycle improves saliency over time and creates more intuitive saliency maps (Figure \ref{fig:itself-superpixel-semantic}). When compared to the existing unsupervised approaches, ITSELF can leverage the object saliency map under construction to improve the process and output a superpixel segmentation as a byproduct. In this work, our focus is on the saliency estimator only. \begin{figure}[t!] \centering \begin{tabular}{c} \includegraphics[width=0.4\textwidth]{figs/ITSELF_diagram_super_simplified.jpg} \end{tabular} \caption{ITSELF's components and structure. Note the saliency-superpixel loop depicted in red. } \label{fig:framework} \end{figure} We propose new prior modeling for specific scenarios, including a shape-based, a saliency-based, and a user-drawn scribble-based prior. Also, we present query selection strategies based on image boundary, and previously computed saliency maps. It is worth noting that ITSELF allows for any number of prior maps and query selection strategies. Therefore, the results presented in this paper are just possible implementations of the framework. \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/xray-limitations.jpg} & \includegraphics[width=0.18\textwidth]{figs/ITSELF-xray-limitations.jpg} \\ (a) & (b) \\ \includegraphics[width=0.18\textwidth]{figs/SMD-xray-limitations.jpg} & \includegraphics[width=0.18\textwidth]{figs/DRFI-xray-limitations.jpg} \\ (c) & (d) \end{tabular} \caption{(a) Original image. (b-d) ITSELF, SMD and DRFI saliency maps.} \label{fig:inflexibility-limitations} \end{figure} We compare ITSELF to two state-of-the-art methods --- namely DRFI \cite{jiang2013drfi} and SMD \cite{peng2016salient} --- using four well-established natural-image datasets, an in-house biomedical image dataset of parasite-eggs, and an x-ray dataset of lung gray-scale images. Even though the selected datasets provide three different image domains, ITSELF provided appropriate saliency estimations for all of them. We achieved comparable results to the state-of-the-art algorithms on natural images and considerably outperformed them on non-natural images. Thus, the contributions of this work are: (1) a saliency estimation framework that easily allows the incorporation of domain-specific information; (2) the improvement of saliency estimation by using object-information during superpixel segmentation; (3) a novel method for iteratively enhancing both saliency maps and superpixel segmentation. \begin{figure}[t!] \centering \begin{tabular}{c c c} \includegraphics[width=0.13\textwidth]{figs/DUT-52.jpg} & \includegraphics[width=0.13\textwidth]{figs/DRFI-chair.jpg} & \includegraphics[width=0.13\textwidth]{figs/SMD-chair.jpg} \\ (a) & (b) & (c) \\ \includegraphics[width=0.13\textwidth]{figs/1-iter-contrasted.jpg} & \includegraphics[width=0.13\textwidth]{figs/5-iter.jpg} & \includegraphics[width=0.13\textwidth]{figs/8-iter.jpg} \\ & (d) & \\ \includegraphics[width=0.13\textwidth]{figs/1-iter-superpixels.jpg} & \includegraphics[width=0.13\textwidth]{figs/5-iter-superpixels.jpg} & \includegraphics[width=0.13\textwidth]{figs/8-iter-superpixel.jpg} \\ & (e) & \end{tabular} \caption{(a) Original image. (b) DRFI saliency map; (c) SMD saliency map. (d-e) ITSELF saliency maps and superpixel segmentation at iterations 1, 5 and 8. Note how the iterations reduced the initial errors and how ITSELF also highlighted the other chairs.} \label{fig:itself-superpixel-semantic} \end{figure} The core elements of ITSELF are presented in Section \ref{sec:framework}. Sections \ref{sec:query-estimation} and \ref{sec:prior-estimation} present strategies to implement queries and priors. The results of some ITSELF create saliency estimator are presented on Section \ref{sec:experiments}, together with their setup and the databases used for comparison. Lastly, conclusions are drawn on Section \ref{sec:conclusion}. \section{\textit{Iterative Saliency Estimation fLexible Framework}}\label{sec:framework} The \emph{ITerative Saliency Estimation fLexible Framework} (ITSELF) is a graph-based algorithm that leverages domain knowledge and low-level image information to estimate and enhance object-based superpixels and saliency iteratively. The interaction between superpixel-based saliency and saliency-based superpixels allows for an iterative enhancement cycle that characterizes the core of ITSELF (Figure \ref{fig:framework}). The framework's flexibility comes from user-defined query-regions and prior maps. Queries define examples of foreground/background regions to be compared to, while the priors enhance the initial estimation. On this work we represent an image as a pair $I = (\set{P},\function{I})$, in which $\set{P} \subseteq \mathbb{Z}^2$ is the set of pixels, and $\function{I} : \set{P}\rightarrow \mathbb{R}^{m}$. In this work, we consider colored and grayscale images --- \textit{i.e.,} $m \geq 1$. Similarly, we consider a saliency map to be a pair $SM = (\set{P},\function{S})$, in which $\function{S} : \set{P}\rightarrow \mathbb{R}^{1}$. \subsection{Object-based Superpixel Segmentation}\label{subsec:superpixel-segmentation} Superpixel segmentation is partitioning an image into $n$ connected regions of pixels (\textit{i.e.,} superpixels) that share similar characteristics. Superpixels are extensively used in saliency estimation for reducing the algorithm's input, and provide better object boundary definition. However, when it comes to saliency estimators, the choice of which superpixel segmentation algorithm to use is somewhat overlooked. Recent studies have allowed the incorporation of object information (\textit{e.g.}, saliency) into superpixel segmentation \cite{belem2019oisf, belem2019importance}. To the best of our knowledge, the only method that leverages saliency maps for superpixel segmentation is the Object-based Iterative Spanning Forest (\textit{OISF}) \cite{belem2019oisf}, an extension of the \textit{Iterative Spanning Forest} \cite{vargas2019iterative} framework. \textit{OISF} is composed of three main steps: (i) estimate a representative set with one pixel for each superpixel (namely seed set); (ii) form pixel groups according to how strongly connected they are to the seeds; (iii) recompute the seeds. Through $n_r$ iterations, the segmentation result is improved through subsequent executions of steps (ii) and (iii). For seed estimation, \textit{Belem et.al} \cite{belem2019importance} proposed two approaches that takes object information into consideration, Object-based grid (OGRID) and Object Saliency Map sampling by Ordered Extraction (OSMOX). On both strategies, the user can control the number of superpixels and the percentage of object seeds $\rho \in [0..1]$ --- \textit{i.e.,} how many seeds will fall into salient regions (Figure \ref{fig:oisf-example}). However, OGRID loses saliency information by requiring a thresholded map when determining the salient regions. On the other hand, OSMOX is faster, has equivalent results, and takes advantage of the saliency map's nuances. \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/pato.jpg} & \includegraphics[width=0.18\textwidth]{figs/pato_gt.jpg} \\ (a) & (b) \end{tabular} \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/pato_super_obj.jpg} & \includegraphics[width=0.18\textwidth]{figs/pato_sub_obj.jpg} \\ (c) & (d) \end{tabular} \caption{(a) Input image. (b) Ground-truth; (c) Super-segmented salient object \cite{belem2019oisf}; (d) Sub-segmented salient object. Both segmentation images were computed using OISF \cite{belem2019oisf} with 200 superpixels and the ground-truth as the input saliency map} \label{fig:oisf-example} \end{figure} Let $n_o = n \rho$ to denote the number of object seeds. Briefly explaining OSMOX, $n_o$ seeds are selected from a priority queue of pixels, where the priority is defined according to the saliency of the pixel's neighbors. To ensure better seed distribution, for each pixel selected as object seed, the priority of adjacent pixels is reduced, and the priority queue is rearranged. The previous steps are repeated until the number of seeds is obtained --- it is analogous for $n - n_o$ background seeds. With the seeds selected, \textit{OISF} runs the \textit{Image Foresting Transform} (\textit{IFT}) algorithm \cite{falcao2004ift} for delineating the superpixels. The \textit{IFT} computes an optimum-path forest, where the seeds are the roots of the trees, and optimality is defined in terms of a path-cost function. Non-seed pixels are aggregated to the tree that provides the minimum path-cost to it. Each tree of the resulting forest is taken as a superpixel. Let $p, q \in \set{P}$, $\pi_p$ be a path with terminus $p$, $\pi_p \cdot \langle p, q\rangle$ be the extension of $\pi_p$ by $q$, and $r_p$ be the root of the tree $p$ belongs to. \textit{OISF} proposes the path cost to be additive, where the added value is derived from the color and the saliency difference between pixels: \begin{eqnarray} &f(\pi_p \cdot \langle p, q\rangle) = f(\pi_p) + \|q - p\| + \\ & \left[\alpha\|\function{I}(r_p) - \function{I}(q)\|\gamma^{|\function{S}(r_p)-\function{S}(q)|} + \gamma|\function{S}(r_p)-\function{S}(q)|\right]^\beta, \nonumber, \end{eqnarray} where $ \alpha $ controls the size regularity of the superpixels, $ \beta $ the border adherence, and $ \gamma $ indirectly controls the saliency score's influence when defining superpixel borders. Even though OISF's path-cost function may not satisfy some conditions to achieve optimality \cite{ciesielski2018path}, the resulting trees are suitable for image representation. After the first segmentation is finished, the results can be improved by recomputing the seeds and running another iteration of the pipeline. In this work, at each \textit{OISF} iteration, the seed is re-positioned to be the pixel whose color is closer to the mean color of the superpixel (\textit{i.e.,} the superpixel medoid on the feature space). Additionally, by enhancing the saliency map over iterations of \textit{ITSELF}, the next \textit{OISF} segmentation is being performed on an improved initial set of seeds. At each ITSELF iteration $t$, the number of superpixels may change in order to compute saliency on multiple scales. For that, we added a parameter $\kappa \in (0..1]$ that redefines the number of superpixels on each iteration: $n^{t+1} = n^t \kappa$; in which $n^1 = n$. \subsection{Superpixel-based Saliency Estimation}\label{subsec:saliency-estimation} Let $\superset{S}$ be the set of all superpixels, $\set{S}, \set{R} \in \superset{S}$, and $\set{Q} \subset \superset{S}$ be the subset of query superpixels. We start by representing the image as a superpixel weighted graph $\mathcal{G} = (\superset{S}, \set{E})$ where the vertices are the superpixels and $\set{E} = \set{E}_\mathcal{A} \cup \set{E}_T \cup \set{E}_Q$, where $\set{E}_\mathcal{A}$ is the set of \emph{adjacency edges}, $\set{E}_T$ is the set of \emph{transitively extended edges}, and $\set{E}_Q$ of \emph{query edges}. The query edges connect every superpixel to every query, \textit{i.e.,} $\set{E}_Q = \{(\set{S},\set{R}) \in \superset{S}\times\set{Q} \; | \; \set{S} \neq \set{R} \}$. Let $\mathcal{A}_8 \subset \set{P}^2$ denote a 8-adjacency neighborhood; then, the adjacency edge set connect every vertex to its adjacents in the image domain, \textit{i.e.,} $E_{\mathcal{A}} = \{(\set{S},\set{R}) \in \superset{S}^2 \; | \; \exists \; (p,q) \in \mathcal{A}_8 \text{ for } p \in \set{S}, q\in \set{R}, \text{ and } \set{S} \neq \set{R}\}$. Lastly, the transitively edges extend the image adjacency by one level, $E_T = \{(\set{S},\set{R}) \in \superset{S}^2 \; | \; \exists \; \set{W} \in \superset{S} \text{ that } (\set{S}, \set{W}),(\set{W}, \set{R}) \in E_{\mathcal{A}}\}$. To allow for the user to control the importance of query over non-query edges, the edges start with parametrically defined weight $\function{e}(S,R)$, where query edges have weight $\psi \in [0..1]$ and adjacency edges have weight $1 - \psi$. We define dissimilarity in terms of color differences between superpixels. Let $\set{C}_I$ be the set of all unique colors that compose $I$, $\set{C}_S \subseteq \set{C}_I$ be the existing colors in a superpixel $\set{S}$, and $p(c, \set{S}), c \in \set{C}_S$ be the percentage of $c$ colored pixels on $\set{S}$. We incorporate the dissimilarity measure to the graph by updating the edge weights using a Gaussian function: \begin{equation} \function{e'}(\set{S},\set{R}) = \function{e}(\set{S},\set{R}) \sum\limits_{\forall c_i \in \set{C}_\set{S}}{\sum\limits_{\forall c_j \in \set{C}_\set{R}}{\exp^{-\frac{\|c_i - c_j\|}{\sigma_s}} p(c_i, \set{S}) p(c_j, \set{R})}} , \end{equation} where $\sigma_s \in (0, 1]$ is the variance and controls the rate in which the distance function increases, and $(\set{S}, \set{R}) \in \set{E}$. Then, let $\set{E}_F \subset \set{E}_Q$ be the subset of foreground-query edges. We invert the foreground query weights to account for similarity instead dissimilarity, defining \textit{vertex saliency} to be: \begin{equation} \function{VS}(\set{S}) = \sum_{\forall \set{R} \in \set{E}\setminus\set{E}_F}{\function{e'}(\set{S},\set{R})} + \sum_{\forall \set{F} \in \set{E}_F}{1 - \function{e'}(\set{S},\set{F})}. \end{equation} Finally, we incorporate the prior domain information simply by multiplying the saliency score of each vertex by the \emph{normalized combined prior map} $\function{PS}$ (detailed in Subsection \ref{subsec:prior-integration}) to get the final saliency score: \begin{equation} \function{S}(\set{S}) = \function{VS}(\set{S}) \function{PS}(\set{S}) \label{eq:saliency-computation} \end{equation} The resulting saliency image maps to each pixel $p$ the saliency value of its corresponding superpixel. Additionally, instead of taking the last iteration result as final, we used the prior integration step to combine the multiple computed maps. We only discard the first estimated map as it often highlights a big part of the background. \subsection{Prior map integration}\label{subsec:prior-integration} Prior knowledge of how humans perceive saliency allows for assumptions to be drawn on which characteristics are determinant when defining saliency. These assumptions alone are often insufficient to accurately identify salient regions. However, by combining multiple priors, it is possible to create more accurate models (Figure \ref{fig:priors_example}). We propose ITSELF to be flexible and allow any number of priors to be incorporated into the model. For such, we provide a combination strategy that allows multiple prior maps to be combined into a single map. The resulting prior map is then used during the saliency estimation step (Equation \ref{eq:saliency-computation}). \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/bounday.jpg} & \includegraphics[width=0.18\textwidth]{figs/center_prior.jpg} \\ (a) & (b) \end{tabular} \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/red_yellow_prior.jpg} & \includegraphics[width=0.18\textwidth]{figs/white_prior.jpg} \\ (c) & (d) \end{tabular} \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/global_contrast_prior.jpg} & \includegraphics[width=0.18\textwidth]{figs/combined_priors.jpg} \\ (e) & (f) \end{tabular} \caption{(a) Input image. (b) Center-surround prior; (c) Red-yellow prior; (d) White prior; (e) Global color contrast prior; (f) Combined priors.} \label{fig:priors_example} \end{figure} Yao Qin \textit{et.al} \cite{qin2015saliency} has proposed an iterative saliency-estimation algorithm that uses Cellular-Automata and a Bayesian framework to combine multiple saliency maps. A cellular automaton is a collection of grid-disposed cells that evolve iteratively according to their neighbors' state and a set of rules. The automaton cells are the pixels of all saliency maps organized so that they form a 3D grid $G = (\mathcal{C}, \function{S}^t_\oplus)$, lastly updated on iteration $t$. For an ordered list of saliency maps $\langle SM_1 .. SM_m\rangle$, $\mathcal{C} = \{(x_p, y_p, i) \in \set{P}^2\times \mathbb{N}^* \; | \; p = (x_p, y_p) \in \set{P}_i\}$ and $\function{S}_{\oplus}^1(\mathtt{c}_i) = \log(\function{S}_i(p))$, for $SM_i = (\set{P}_i, \function{S}_i)$, and $1 \leq i \leq m$. Let $\mathtt{c}_i = (x_p, y_p, i)$, $\mathtt{c}_j = (x_q, y_q, j) \in \mathcal{C}$, we consider that a cell impacts the evolution of another if they are connected by a \emph{cuboid adjacency relation} $\mathcal{A}_\square$. We formally define the cuboid adjacency to be $\mathcal{A}_{\square} = \{(\mathtt{c}_i,\mathtt{c}_j) \in \mathcal{C} \; | \; \exists \; (p,q) \in \mathcal{A}_4 \text{ which } p = (x_p, y_p) \text{ and } q = (x_q, y_q)\}$. We consider a cell $\mathtt{c}_i$ to be salient if its saliency score is higher than the mean saliency value ($\mu_i$) of its originating map $SM_i$. The saliency of each cell is increased over time ($t$) based on the saliency of its neighborhood: \begin{equation} \function{S}_{\oplus}^t(\mathtt{c}_i) = \function{S}_{\oplus}^{t-1}(\mathtt{c}_i) + \Lambda \sum\limits_{\forall \mathtt{c}_j \; | \; (\mathtt{c}_i,\mathtt{c}_j) \in \mathcal{A}_{\square}}{sign(\function{S}_{\oplus}^{t-1}(\mathtt{c}_j) - \mu_j)} \end{equation}{} where $\Lambda \in (0..1]$ is a constant that controls the strength of the update (Figure \ref{fig:integration-lambda}). The final updated saliency score of each pixel on each map is than normalized: $\function{S}^t_{\oplus}(\mathtt{c}_i) \leftarrow \frac{\exp^{\function{S}^t_{\oplus}(\mathtt{c}_i)}}{(1 + \exp^{\function{S}^t_{\oplus}(\mathtt{c}_i)})}$. \begin{figure}[t!] \centering \begin{tabular}{c c c} \includegraphics[width=0.13\textwidth]{figs/focus_flower.jpg} & \includegraphics[width=0.13\textwidth]{figs/integration-flower-001.jpg} & \includegraphics[width=0.13\textwidth]{figs/integration-flower-01.jpg} \\ \includegraphics[width=0.13\textwidth]{figs/integration-horse.jpg} & \includegraphics[width=0.13\textwidth]{figs/integration-horse-001.jpg} & \includegraphics[width=0.13\textwidth]{figs/integration-horse-01.jpg} \\ (a) & (b) & (c) \\ \end{tabular} \caption{(a) Input image. (b-c) Result of saliency map integration using $\lambda \in \{0.01, 0.1\}$, respectively. Note that although a higher $\lambda$ creates more homogeneous salient objects, less salient object parts may be lost.} \label{fig:integration-lambda} \end{figure} After $t$ iterations, the final saliency map is the cell combination on the $z$ coordinate: \begin{equation} \function{PS}(p) = \frac{1}{m}\sum\limits_{i = 1}^{m}{\function{S}^t_{\oplus}(\mathtt{c}_i)}, \end{equation} where $\mathtt{c}_i = (x_p, y_p, i)$. The same automaton is used on every iteration of ITSELF; however, the number of cells may change if more priors are added on later iterations. We also use this prior integration step to combine the output saliency maps from each ITSELF's iterations. By changing the number of superpixels used to compute each saliency map, the automaton is considering multiple scales. \section{Query Selection}\label{sec:query-estimation} We propose three different approaches to estimate queries: (A) border-based query, assuming most of the image boundary regions are background on natural images; (B) saliency-based, used to incorporates any pre-computed saliency map into the framework. \subsection{Border-based Query Selection}\label{subsec:border-based-query} We propose combining both boundary connectivity \cite{zhu2014saliency} and multi-map estimation \cite{zhang2018hypergraph, peng2016salient, zhang2016ranking} to further reduce the miss-selection of background regions. For such, instead of using the four sides of the image as the multiple maps, we propose clustering the superpixels based on their color similarity. We then compute a saliency map for each of the clusters that contain at least one superpixel on the image boundary. During this computation, we only use the cluster's superpixels touching the image boundaries as queries. Any clustering algorithm could be used; however, we opted on using the \textit{Unsupervised Optimum-Path Forest (OPF)} \cite{rocha2009data}: A graph-based algorithm that performs clustering by solving an optimum-path forest on a graph of samples. OPF finds an adequate number of clusters $g$ automatically; therefore, different images may have a different number of clusters. Let $\superset{S}_g \ \subset \superset{S}$ be the set of superpixels contained in cluster $g$, and $\superset{B}_g \subset \superset{S}_g$ be the set of superpixels in $\superset{S}_g$ that touches the image borders. For each cluster, we compute a saliency map $\function{SM}_g$ using Equation \ref{eq:saliency-computation} and a boundary-connectivity score $w_g$. In this work, the \concept{boundary connectivity score} of cluster measures how many of its superpixels touch the image border, and is defined as $w_g = |\superset{B}_g| / |\superset{S}_g|$. We then perform a weighted average to attribute to each superpixel a single saliency score: \begin{equation} \function{CS}(\set{S}) =\frac{1}{W}\sum_{g}^{n_g} w_g SM_g(S) \end{equation} where $W = \sum_{g}^{n_g} w_g$. With the saliency score of each superpixel, the final saliency map is the propagation of the saliency scores of each superpixel to every pixel that composes it. A visual representation of the combination of clustering and the boundary-connectivity score is depicted in Figure \ref{fig:boundary-clustering}. \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/sword.jpg} & \includegraphics[width=0.18\textwidth]{figs/combined-clusters.jpg} \\ (a) & (b) \end{tabular} \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/worst-cluster-142.jpg} & \includegraphics[width=0.18\textwidth]{figs/best-cluster-453.jpg} \\ (c) & (d) \end{tabular} \caption{(a) Input image. (b) The result combination of the boundary clusters; (c) The highest boundary-connectivity score cluster with $w_c = 0.453$; (d) A boundary cluster containing most of the object with boundary-connectivity score $w_c = 0.142$. Note that the combined saliency map is not the final result of ITSELF, rather it is the simple combination of the boundary clusters.} \label{fig:boundary-clustering} \end{figure} \subsection{Saliency-based Query Selection}\label{subsec:saliency-based-query} Queries are subsets of image regions that are representative when estimating saliency, given a set of predicates. Whether the queries are good representations of foreground or background, the importance of such regions can be encoded by a saliency map. Thus, given a saliency map $\function{SS}$ and a threshold $\mu$, a superpixel is selected as a query if its saliency value exceeds the threshold. \section{Prior Modeling}\label{sec:prior-estimation} In this section, we present the models we implemented for each prior used in our experiments. The prior maps are represented the same way as a saliency map, however, to easily differentiate between both, the prior maps on this paper are represented as heat maps where lower values are represented on cold colors(blue$\rightarrow$green) and higher values on hot colors(yellow$\rightarrow$red). \subsection{Center-surround prior}\label{subsec:center-surround-prior} A widespread assumption for natural images is that the salient object will be near the center of the image \cite{cheng2014global, shen2012unified}. In this regard, let $p_c \in P$ be the center pixel of the image. The center distance of a superpixel to the image center is defined as: $\function{CD}(\set{S}) = \frac{1}{|S|}\sum\limits_{\forall q \in \set{S}}{\|q - p_c\|}$. However, to change the increase rate of the distance function, the values are put into a Gaussian centered on $p_c$, thus, the center prior score is defined as follows: \begin{equation} \function{CP}(\set{S}) = \exp^{-\frac{\function{CD(S)}}{\sigma_{1}^2}} \end{equation} Smaller values of $\sigma_{1} \in (0..1)$ causes superpixel farthest to center to be less relevant (Figure \ref{fig:center-sigma-showcase}). \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/star.jpg} & \includegraphics[width=0.18\textwidth]{figs/star-superpixels.jpg} \\ (a) & (b) \end{tabular} \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/center-sigma-01.jpg} & \includegraphics[width=0.18\textwidth]{figs/center-sigma-09.jpg} \\ (c) & (d) \end{tabular} \caption{(a) Original image. (b) Superpixel Segmentation; (c) and (d) Center prior maps with $\sigma_1=0.1$ and $\sigma_1=0.9$, respectively.} \label{fig:center-sigma-showcase} \end{figure} \subsection{Global color uniqueness prior}\label{subsec:global-color-prior} The saliency score represents how much an object stands-out in a scene. A defining characteristic when estimating said score is color uniqueness. Colors that appear the least are rarer in the image and may stand out \cite{cheng2014global, jiang2013salient}. Let $\set{C}_I$ be the set of all unique colors that compose $I$, $\set{P}_c \subset \set{P}$ be the set of all pixels of color $c \ in \set{C}_I$, and $p(c) = \frac{|\set{P}_c|}{|\set{P}|}$. Similar to the center prior, we use a Gaussian function to control the increasing rate of the the distance measure. In this regard, we define the \textit{Color Uniqueness Score} as $\function{US}(c) = \exp^{\frac{p(c)}{\sigma_2^2}}$. However, even after quantization, there are several similar colors (\textit{e.g.,} slightly different tones of the same color), creating artifacts counter-intuitive to the human perspective. To reduce the impact of similar color uniqueness, similar to Cheng \textit{et. al.} \cite{cheng2014global}, we smooth the uniqueness score based on the average uniqueness of similar colors. For every pair $(c_i, c_j), c_i \neq c_j$, we define the color similarity weight to be $\function{ws}(c_i, c_j) = \exp^{-\frac{\|c_i,c_j\|}{\sigma_2^2}}$, and prose the final global color-uniqueness score to be: \begin{equation} \function{US}'(c_i) = \sum\limits_{\forall c_j \in \set{C}_I}{\function{US}(c_j) \function{ws}(c_i, c_j)} \end{equation} Figure \ref{fig:global-contrast-showcase} depicts the improvement when smoothness is applied. Each superpixel is then assigned a value according to the colors of the pixels that composes it: $\function{GP}(\set{S}) = \frac{1}{\|\set{C}_S\|} \sum\limits_{\forall c \in \set{C}_S}{p(c, \set{S}) \function{US}'(c)}$. \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/red-flower.jpg} & \includegraphics[width=0.18\textwidth]{figs/red-flower-superpixel.jpg} \\ (a) & (b) \end{tabular} \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/global-contrast-without-smoothness.jpg} & \includegraphics[width=0.18\textwidth]{figs/global-contrast-with-smoothness.jpg} \\ (c) & (d) \end{tabular} \caption{(a) Original image. (b) Superpixel Segmentation; (c) and (d) Global color-contrast prior maps without and with the smoothness step, respectively. Note how slight changes on tones of green impact negatively the method without smoothness.} \label{fig:global-contrast-showcase} \end{figure} \subsection{Color-based priors}\label{subsec:color-prior} Based on observation of the Human Visual System, a common assumption is that red and yellow tones are naturally salient. Identifying red and yellow colors is straightforward in the \textbf{L*a*b*} colorspace: higher values on the \textbf{a} channel describe red tones,while high values on the \textit{b} channel, yellow. Therefore, we define a red/yellow score $\function{RY}(c)$ to be the sum of its \textit{a} and \textit{b} channels. As in the previous priors, we use a Guassian function to exert control over the functions increase rate, redefining the score to be $RY'(c) = \exp^{\function{RY}(c)/ \sigma_3^2}$. Lastly, we propagate the color values to every superpixel using a weighted average: \begin{equation} \function{RP}'(\set{S}) = \sum\limits_{\forall c \in \set{C}_S}{p(c, \set{S}) \function{RY}'(c))} \label{eq:color} \end{equation} Although red and yellow are the most naturally salient colors, the same algorithm can be applied to other colors when required for specific objects. As an example, we know that on x-ray images of the thorax, the lungs are often darker than the other structures. So, we implemented a color prior that highlights black regions (Figure \ref{fig:black-prior-showcase}). \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/lungs-xray.jpg} & \includegraphics[width=0.18\textwidth]{figs/black_prior.jpg} \\ (a) & (b) \end{tabular} \caption{(a) Original image with object scribbles in light-blue. (b) Black prior map with $\sigma_3=0.5$. Additionally, we reduced the saliency of black regions connected to the image boundaries because of the natural color of the xray plate.} \label{fig:black-prior-showcase} \end{figure} All color-based priors follow the same principle of adding or subtracting the \textbf{L*a*b*} channels: white and black requires \textbf{a} and \textbf{b} to be closer to 0, with white having higher values on the \textbf{L} channel; the more negative the value of the \textbf{a} channel, the greener the color tone is, and the same goes for blue on the \textbf{b} channel. Changing the operations done on the channels yields new color priors. \subsection{Saliency-based priors}\label{subsec:color-smoothing-prior} Due to the iterative nature of \textit{ITSELF}, we created a method that extrapolates a prior map from a previously computed saliency map, trying to reduce spurious saliency values of background regions sharing non-salient colors. We propose a color-saliency prior that attributes a saliency value to a superpixel depending on how globally salient its colors are (Figure \ref{fig:saliency-based-prior-showcase}). \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.2\textwidth]{figs/smoothing-car.jpg} & \includegraphics[width=0.2\textwidth]{figs/sm-before-smoothing.jpg} \\ (a) & (b) \end{tabular} \begin{tabular}{c c} \includegraphics[width=0.2\textwidth]{figs/smoothed_color.jpg} & \includegraphics[width=0.2\textwidth]{figs/sm-after-smoothing.jpg} \\ (c) & (d) \end{tabular} \caption{(a) Original image. (b) Saliency map before combining the proposed color-saliency based prior; (c) the color-saliency based prior derived from (b); (d) the result of combining the proposed prior.} \label{fig:saliency-based-prior-showcase} \end{figure} The global saliency of a color is defined as: \begin{equation} \function{SC}(c) = \frac{1}{|\set{P}_c|}\sum\limits_{\forall p \in \set{P}_c}{\function{S}(p)} \end{equation} Let $\set{C}_I$ be the set of all unique colors that compose $I$, $\set{C}_S \subset \set{C}_I$ be the subset of colors that compose a superpixel $\set{S}$. We then compute the saliency prior score to each superpixel, combining their color scores: \begin{equation} \function{CS}(\set{S}) =\frac{1}{|\set{C}_S|} \sum\limits_{\forall c \in \set{C}_S}{\function{SC}(c) } \end{equation} Despite only presenting a color-based saliency prior, other features (\textit{e.g.,} texture, shape, or size) could be used to create new priors similarly. \subsection{Focus prior}\label{subsec:focus-prior} One could draw a natural correlation between focus and saliency. When observing a picture with different focal points, our eyes naturally ignore blurred regions prioritizing focused ones. Accordingly, identifying focused regions can improve the saliency estimation task \cite{jiang2013salient}. As presented by Jiang \textit{et.al} \cite{jiang2013salient}, the focus of a region is closely related to its degree of blur. With blurriness being the lack of sharply defined edges, \textit{focusness} is more easily quantifiable by looking at the edges of objects rather than their interior. Consequently, the first step when computing focusness is to identify object edges on the image. There are several edge detection algorithms available in the literature, however, we opted on using a simple thresholded gradient image. Let the gradient $\nabla(p) = \|\function{I}(p), \function{I}(q)\| \forall q \in \mathcal{A}_4$, and $\set{P}_e \subset P$ be the set of edge pixels. We consider that $p \in \set{P}_e \leftrightarrow \nabla(p) > \omega$, where $\omega$ is the Otsu threshold \cite{otsu1979threshold} of $\mathcal{I}$. Within \textit{ITSELF}, the regions are delimited by superpixels and, thus, the focusness score can be defined by correlating superpixels to the detected edges. Superpixel segmentation also uses gradient information, and the created superpixel boundaries are frequently located in regions with a higher gradient. However, in blurred regions, the natural image edges will not exceed the threshold and will not be present on the estimated edges. In this regard, focused regions should have a higher match between superpixel boundaries and sharp image edges (Figure \ref{fig:focus-prior-showcase}). \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/focus_flower.jpg} & \includegraphics[width=0.18\textwidth]{figs/focus_prior.jpg} \\ (a) & (b) \\ \includegraphics[width=0.18\textwidth]{figs/focus_borders.jpg} & \includegraphics[width=0.18\textwidth]{figs/focus_superpixel.jpg} \\ (c) & (d)\\ \end{tabular} \caption{(a) Original image. (b) Result of the focus prior. (c) Estimated object edges; (d) Object-based superpixel segmentation. } \label{fig:focus-prior-showcase} \end{figure} Let $\set{P}_b \subset{S}$, $p_b \in \set{P}_b$ be a boundary pixels of $\set{S}$ --- \textit{i.e.,} $\exists q \in \{\mathcal{A}_8(p_b), \set{R}\}, \set{R} \neq \set{S}$. We define the focusness score of $\set{S}$ by: \begin{equation} \function{FS}(\set{S}) = \frac{|\set{P}_b \cap \set{P}_e|}{|\set{P}_b|} \end{equation} Like the other priors, we map the focusness score to its location within a Gaussian function: \begin{equation} \function{FP}(\set{S}) = 1 - \exp^{-\frac{\function{FS}(\set{S})}{\sigma_4^2}} \end{equation} \subsection{Ellipse-matching prior}\label{subsec:ellipse-matching-prior} Thanks to OISF's capability of representing objects with few superpixels, shape-based priors are viable. As an example, we created a prior that highlights elliptical objects to increase ITSELF's precision on an in-house dataset of intestinal parasite eggs (Section \ref{sec:datasets}). To score how elliptical the superpixels are, we first compute a Tensor Scale Representation (\textit{TSR}) of each of them. The \textit{TSR} of a homogeneous region is a parametric representation of the best fit ellipse enclosed inside the region. Each ellipse is defined through its orientation (the angle between the ellipse's major axis and the image's y-axis), its anisotropy (the ratio between its major and minor axis), and thickness (size of the minor-axis). To compute the \textit{TSR} for every superpixel, we use a slightly modified version of Miranda's optimized algorithm \cite{miranda2005tsd}. The algorithm consists of identifying the edges of the homogeneous regions, finding the orientation of the best-fit ellipse, and computing the length of the ellipse's semi-axis. The main difference of our implementation when compared to Miranda's is when defining the region edges. Let $p \in \set{S}, q \in \set{R}, \set{S} \neq \set{R}$, and $\set{P}_e \subset{P}$ be the set of all region edges. We consider that $p \in \set{P}_e \leftrightarrow \exists q \in \mathcal{A}_8(p)$. The last two stages are implemented as described in \cite{miranda2005tsd}, taking the superpixels as the homogeneous regions and the center pixel of the superpixel as the center of the ellipse. Afterwards, we estimate an ellipse matching for each superpixel (Figure \ref{fig:ellipse_matching}): \begin{equation} \function{EM}(\set{S}) = \frac{1}{|\set{S}|}\sum\limits_{\forall p \in \set{S}}{\delta_e([\|p, f_1\| + \|p, f_2\|] < 2l)}, \end{equation} \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/ellipse-parasite.jpg} & \includegraphics[width=0.18\textwidth]{figs/ellises-parasite-mask.jpg} \\ (a) & (b) \\ \includegraphics[width=0.18\textwidth]{figs/ellipses-superpixel.jpg} & \includegraphics[width=0.18\textwidth]{figs/ellipses.jpg} \\ (c) & (d)\\ \end{tabular} \caption{(a) Original image. (b) Object mask of the parasite. (c) Superpixel segmentation; (d) Ellipse Matching of each superpixel } \label{fig:ellipse_matching} \end{figure} \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.2\textwidth]{figs/ellipses-non-filtered-prior.jpg} & \includegraphics[width=0.2\textwidth]{figs/ellipses_prior.jpg} \\ (a) & (b) \end{tabular} \caption{(a) Ellipse-based prior without size filtering (b) Result of reducing region saliency by size. } \label{fig:ellipse_prior} \end{figure} where $\delta_e(\cdot) = \{0,1\}$ determines whether a pixel is positioned inside its respective ellipse, and $f_i$ are the estimated \textit{foci}. The final Ellipse-matching prior is also weighted by a Gaussian and is computed as follows: \begin{equation} \function{EP}(\set{S}) = 1 - \exp^{-\frac{\function{ES}(\set{S})}{\sigma_5^2}} \end{equation} Specific to the parasite dataset, we improve the ellipse prior result by adding a size constraint: \begin{eqnarray} \function{EP}'(\set{S}) & = & \left\{\begin{array}{ll} \function{EP}(\set{S}) & \mbox{ if $|S| \in (s_0, s_1) $,}\\ min(\function{EP}(\superset{S})) & \mbox{otherwise,} \end{array}\right. \label{eq.ellipse-size} \end{eqnarray} where $s_0$ and $s_1$ are, respectively, the lower and upper limits of the size range defined empirically. Figure \ref{fig:ellipse_prior} shows the improvement achieved by size filtering. \subsection{Scribbles based priors}\label{subsec:scribble-based-prior} Object saliency maps have been frequently used to assist interactive object segmentation \cite{falcao2019role, yang2010user, tang2013grabcut}. In this scenario, the objects' locations are given by the user who interactively places scribbles in the object and background. These user placed scribbles can be used as precise object detection, allowing the creation of several new priors with high accuracy. As a simple example, we can create location priors (similar to \concept{center-surround}) regarding the detected objects: A point has brighter values when they are close to object scribbles or far from background ones. Figure \ref{fig:scribbles_prior_showcase} shows the result of using object scribbles as a location prior. \begin{figure}[t] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/scribbled-flamingos.jpg} & \includegraphics[width=0.18\textwidth]{figs/scribbles_distance_prior.jpg} \\ (a) & (b) \\ \includegraphics[width=0.18\textwidth]{figs/scribbled-flamingo.jpg} & \includegraphics[width=0.18\textwidth]{figs/scribbles_distance_prior-single.jpg} \\ (c) & (d) \end{tabular} \caption{(a) Original image with three object scribbles in light-blue. (b) Scribble-based location prior map of (a); (c) Original image with a single object scribble in light-blue. (d) Scribble-based location prior map of (c).} \label{fig:scribbles_prior_showcase} \end{figure} It is worth noting that scribble based location priors can be used, for instance, segmentation. The challenge in instance segmentation is to individually segment objects of the same class in a picture with multiple objects. Take the single scribble example in Figure \ref{fig:scribbles_prior_showcase}: There are multiple flamingos on the image, but one may only interested in the top right flamingo. To fulfill such needs, we use the location scribble-based prior, reducing the saliency of all other objects that are not close to the user-provided marker. Note that other highly accurate priors could be created by using scribbles. They could be based on color, texture, or even shape and size by exploring object-based superpixels. We strongly advise exploring these possibilities in further works. \section{Experiments and Results}\label{sec:experiments} We compare ITSELF to two other popular saliency estimators, namely the \textit{DiscriminativeRegional Feature Integration Approach} (DRFI) and the \textit{Structured Matrix Decomposition} (SMD). Assuming the background to be more homogeneous than the foreground, SMD uses the low-rank (LR) matrix theory to approximate the redundant background regions on a low-rank feature matrix, while a sparse sensory matrix represents sparse salient object regions. They use connectivity constraints, and a regularization step used to assist images with a cluttered background. Additionally, SMD incorporates location, color, and background priors to improve its results further. Despite DRFI being a supervised algorithm, it uses only hand-crafted features extracted from the input image, using a Random Forest to combine them and form the saliency score. The features are similar to other unsupervised methods (color, texture, and guess location). They compute multiple saliency scores on multiple scales and combine them at a fusion step. By learning the importance of each feature for different datasets, DRFI can be more easily extensible to other image domains. We did not include comparisons to the state-of-the-art graph-based algorithms because there was no code available, and we could not run the same experiments and evaluate using the same metrics as we did the others. However, they have the same inflexibility of the other methods, incorporating pre-selected assumptions into their models. \subsection{Datasets}\label{sec:datasets} To validate our method, we used four popular natural image datasets: the \textbf{MSRA10K} \cite{liu2010learning}, which is the largest dataset selected (10000 images) and is composed of images with a singular salient object and a somewhat simple background; the \textbf{ECSSD} dataset \cite{yan2013hierarchical}, containing 1000 images of a singular salient object in a complex background; the \textbf{DUT-OMRON} dataset \cite{yang2013saliency}, which was proposed to n saliency detection dataset, composed of 5,168 complex images containing one or more salient objects; and \textbf{ICoSeg} \cite{batra2011interactively}, which is composed of 643 images, most of them containing multiple salient objects. Additionally, we ran experiments on an in-house biomedical image dataset of intestinal \textbf{parasite eggs}. The dataset is composed of 630 images of \textit{schistosoma-mansoni} eggs obtained via TF-test \cite{}, with. The background is overloaded with fecal impurities that share similar characteristics to the eggs, posing a challenge to highlight the wanted objects alone (Figure \ref{fig:parasite-example}). Differently than the impurities, the eggs are elliptical and fall into a specific size range. \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/parasite-impurity.jpg} & \includegraphics[width=0.18\textwidth]{figs/cluttered-image.jpg} \\ (a) & (b) \end{tabular} \caption{(a) A parasite egg (red arrow) and a fecal impurity (blue arrow) that shares similar characteristics to the eggs; (b) A heavily cluttered image with one parasite egg (red arrow)} \label{fig:parasite-example} \end{figure} Lastly, we used a \textbf{lung x-ray} dataset proposed in a Kaggle segmentation challenge to showcase that ITSELF can be extended to grayscale medical images. This dataset is composed of 704 images and contains normal and abnormal x-rays with manifestations of tuberculosis. It is required to attribute the data source to the National Library of Medicine, National Institutes of Health, Bethesda, MD, USA, and to the Shenzhen No.3 People's Hospital, Guangdong Medical College, Shenzhen, China. This dataset was made viable thanks to \cite{jaeger2013automatic, candemir2013lung}. \subsection{Parameter tuning and Experimental setup}\label{subsec:parameter-tunning} For optimizing the methods' parameters we created subsets of size $N = min(\frac{\|D\|}{l10}, 100)$ where $|D|$ is the dataset size. We want to make sure that the user does not need many images to achieve satisfactory results, so $N$ limits the MSRA10K and DUT-OMRON training set size. Regarding the parameters, some parameters were fixed, and others changed for each dataset. The dataset-specific parameters values are grouped on Table \ref{tab:parameters}. The fixed parameter values will be presented as we list them. For superpixel segmentation, there are six parameters: the number of superpixels $n$; the number of foreground seeds $n_o = 3$; the number of OISF iterations over recomputed seeds $\hat{t}$, the superpixel size regularity ($\alpha = 0.8$), the border adherence weight ($\beta = 12$) and the saliency weight ($\gamma'$). On the saliency computation, there are two parameters: the query region importance $\psi$ and the saliency variance ($\sigma_s = 0.4$). For the prior integration step, there are also two parameters: the number of iterations $t' = 1$; and the updated strength $\Lambda$. Despite $t' = 1$, the automaton updates over the number of ITSELF iterations. We used two different color priors, one that highlights red/yellow colors and another to highlight color intensities. The intensity prior was used on all natural-image datasets and the x-ray dataset; however, on the x-ray dataset, we highlight darker intensities. For prior estimation, there are eight parameters: the variance of each prior variance ($\sigma_i \| i \in (1..6)$ --- where $\sigma_3$ is related to the red/yellow prior and $\sigma_3'$ to intensities; and the size constrains for the ellipse prior $s_0 = 1500$, $s_1 = 5000$. Lastly, we run all the experiments using $i = 8$ full ITSELF iterations. Regarding SMD, they proposed a method to be used without any training step. In this regard, we used their available code without any modifications or parameter tuning. Note that SMD did a pre-training on the used datasets but are not clear regarding the size of their training split. As for DRFI, we used their available implementation and the same splits as we did for ITSELF. \begin{table}[ht] \resizebox{\columnwidth}{!}{% \begin{tabular}{|c|c|c|c|c|c|c|} \hline & ECSSD & DUT\_OMRON & ICOSEG & MSRA10K & Lungs & Parasites \\ \hline $\sigma_{1}$ & 0.2 & 0.2 & 0.2 & 0.2 & --- & --- \\ \hline $\sigma_{2}$ & 0.2 & 0.5 & 0.5 & 0.5 & --- & 0.2 \\ \hline $\sigma_{3}$ & 0.2 & --- & 0.2 & 0.8 & 0.5 & --- \\ \hline $\sigma_{3}'$ & 0.2 & 0.5 & 0.8 & 0.8 & --- & 0.2 \\ \hline $\sigma_{4}$ & 0.5 & 0.5 & 0.5 & 0.8 & 0.8 & --- \\ \hline $\sigma_{5}$ & --- & --- & --- & --- & --- & 1.0 \\ \hline $n$ & 200 & 200 & 200 & 200 & 200 & 500\\ \hline $\gamma$ & 2.0 & 2.0 & 2.0 & 1.0 & 2.0 & 0.5\\ \hline $\Lambda$ & 0.01 & 0.008 & 0.01 & 0.01 & 0.01 & 0.05 \\ \hline $\psi'$ & 0.5 & 0.3 & 0.8 & 0.3 & 0.3 & 0.5\\ \hline $\hat{t}'$ & 0.5 & 0.3 & 0.8 & 0.3 & 0.3 & 0.5\\ \hline \end{tabular}% } \caption{A list of all parameters values that changed over the datasets.} \label{tab:parameters} \end{table} The query selection strategies employed for each dataset were different from the first iteration of the framework. On further iterations, every dataset used the result of the past iteration to estimate foreground queries. For the natural-image datasets, the first framework iteration uses image-borders background queries to estimate a first saliency map and then uses the result to estimate foreground queries. For the parasites and x-ray datasets, the first iteration uses the combined prior map to estimate foreground queries. Lastly, when combining the multiple iteration's outputs, we observed that the first saliency estimation is often noisy; thus, we discard it. \subsection{Evaluation Metrics} We used four traditional saliency metrics: weighted F-Measure (WF-Measure); weighted Precision (PRE$^\omega$); weighted Recall (REC$^\omega$); the mean-average error. Moreover, we propose using boundary recall to quantify this characteristic of the over-salient values of regions close to the object. By increasing the saliency of regions close to the object, the estimated objects, boundaries are moved away from the real object boundaries, reducing the BR (Figure \ref{fig:boundary-recall}). The weighted F-Measure is the harmonic mean of PRE$^\omega$ and REC$^\omega$. The PRE$^\omega$ measures the exactness (\textit{i.e.}, whether non-salient regions were defined as salient) and REC$^\omega$ measures completeness (\textit{i.e.}, whether salient regions were defined as non-salient). These metrics were proposed to substitute the traditional binary-image-based precision and recall metrics, removing the need for computing the results on multiple threshold-segmented maps \cite{margolin2014evaluate}. Rather, the positive and negative ratios are computed based on the difference between a binary map and the saliency probability. The \emph{mean absolute error} (MAE) is the mean difference between the saliency map and the ground-truth. Even though the MAE compares the saliency map to the Having well-defined boundaries between object and background is particularly useful on tasks such as weakly-supervised semantic segmentation, where saliency maps may be used as estimates of a pixel-wise mask from an image-level annotation \cite{wei2016stc} to train more robust algorithms. We use the boundary recall (BR) over saliency maps thresholded by the mean saliency value. BR measures the percentage of match between the estimated object boundaries to the object boundaries in the ground-truth. We consider a boundary tolerance distance of two pixels, as proposed by Achanta \textit{et.al} \cite{achanta2012slic}. \subsection{Natural-image dataset comparisons} As shown in Table \ref{tab:quantitative-results}, regarding the four traditional saliency metrics, ITSELF was ranked second on all but one dataset, with SMD getting the best scores. However, not only was SMD pre-trained with an unknown number of images, SMD often highlights non-salient regions close to salient ones. Comparing the boundary recall of the three methods, ITSELF and DRFI often alternate between first and second place, with SMD always on the bottom. \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/ECSSD-62.jpg} & \includegraphics[width=0.18\textwidth]{figs/GT-ECSSD-62-segm.jpg} \\ (a) & (b) \\ \includegraphics[width=0.18\textwidth]{figs/ITSELF-ECSSD-62-border.jpg} & \includegraphics[width=0.18\textwidth]{figs/ITSELF-ECSSD-62-segm.jpg} \\ (c) & (d) \\ \includegraphics[width=0.18\textwidth]{figs/SMD-ECSSD-62-border.jpg} & \includegraphics[width=0.18\textwidth]{figs/SMD-ECSSD-62-segm.jpg} \\ (e) & (f) \end{tabular} \caption{(a) Input image. (b) Ground-truth segmentation; (c-f) ITSELF/SMD saliency maps with mean-saliency threshold segmentation boundaries depicted on green/blue, respectively.} \label{fig:boundary-recall} \end{figure} The saliency/superpixel loop provides a final saliency estimation with more semantic meaning than previous methods. Even though ITSELF was not completely accurate given the ground-truth in Figure \ref{fig:boundary-recall}, the wrongfully salient regions are highly different from most of the background or highly similar to the foreground. The WF-Measure of ITSELF and SMD are, respectively, $0.689$ and $0.781$. Nevertheless, SMD increases the saliency of background regions close to the horse. ITSELF does have a big non-salient region segmented on the top of the image; however, this region does not share similar characteristics to most of the background, unlike SMD's miss-estimation. More examples can be seen on Figure \ref{fig:segmentation_results}. These datasets are composed of profoundly different objects, and using priors assumptions does make the model prone to error on images that these assumptions fail to describe important salient characteristics (Figure \ref{fig:bad-priors-example}). Another fail case scenario is when the salient object is too large or when they are too similar to most of the background (Figure \ref{fig:itself-fail}). \begin{figure}[t!] \centering \begin{tabular}{c c c c} \includegraphics[width=0.09\textwidth]{figs/hut-orig.jpg} & \includegraphics[width=0.09\textwidth]{figs/hut-gt.jpg} & \includegraphics[width=0.09\textwidth]{figs/hut-itself-1.jpg} & \includegraphics[width=0.09\textwidth]{figs/hut-itself-2.jpg} \\ (a) & (b) & (c) & (d) \end{tabular} \caption{(a) Original image. (b) Superpixel Segmentation; (c) Reported ITSELF result; (d) Improved result by removing the center and focus priors.} \label{fig:bad-priors-example} \end{figure} \begin{figure}[t!] \centering \begin{tabular}{c c c} \includegraphics[width=0.13\textwidth]{figs/panda-orig.jpg} & \includegraphics[width=0.13\textwidth]{figs/panda-gt.jpg} & \includegraphics[width=0.13\textwidth]{figs/panda-itself.jpg} \end{tabular} \begin{tabular}{c c c} \includegraphics[width=0.13\textwidth]{figs/turtle-orig.jpg} & \includegraphics[width=0.13\textwidth]{figs/turtle-gt.jpg} & \includegraphics[width=0.13\textwidth]{figs/turtle-itself.jpg} \\ (a) & (b) & (c) \end{tabular} \caption{(a) Original image. (b) Ground-truth; (c) ITSELF saliency map. On the second image, note how there are contrasting green parts on the image background.} \label{fig:itself-fail} \end{figure} \begin{table}[ht] \resizebox{\columnwidth}{!}{% \renewcommand{\arraystretch}{2} \begin{tabular}{|c|c|c|c|c|c|c|} \hline \multirow{4}{*}{\begin{turn}{90}ECSSD\end{turn}} & Methods & WF-Measure & BR & MAE & PRE$^\omega$ & REC$^\omega$ \\ \cline{2-7} & \textbf{ITSELF} & 0.509 & {\color[HTML]{0000FE} 0.473} & {\color[HTML]{0000FE}0.177} & {\color[HTML]{0000FE}0.601} & 0.491 \\ \cline{2-7} & SMD & {\color[HTML]{0000FE}0.517} & 0.425 & 0.227 & 0.543 & {\color[HTML]{FE0000}0.660} \\ \cline{2-7} & DRFI & {\color[HTML]{FE0000} 0.547} & {\color[HTML]{FE0000} 0.556} & {\color[HTML]{FE0000}0.159} & {\color[HTML]{FE0000}0.606} & {\color[HTML]{0000FE}0.564} \\ \hline\hline \multirow{4}{*}{\begin{turn}{90}DUT OMRON\end{turn}} & Methods & WF-Measure & BR & MAE & PRE$^\omega$ & REC$^\omega$ \\ \cline{2-7} & \textbf{ITSELF} & {\color[HTML]{0000FE}0.406} & {\color[HTML]{FE0000}0.436} & {\color[HTML]{0000FE}0.144} & {\color[HTML]{FE0000}0.416} & 0.540 \\ \cline{2-7} & SMD & {\color[HTML]{FE0000} 0.424} & 0.353 & {\color[HTML]{FE0000} 0.136} & {\color[HTML]{0000FE}0.387} & {\color[HTML]{0000FE}0.659}\\ \cline{2-7} & DRFI & 0.357 & {\color[HTML]{0000FE} 0.356} & 0.193 & 0.290 & {\color[HTML]{FE0000}0.679}\\ \hline\hline \multirow{4}{*}{\begin{turn}{90}ICOSEG\end{turn}} & Methods & WF-Measure & BR & MAE & PRE$^\omega$ & REC$^\omega$ \\ \cline{2-7} & \textbf{ITSELF} & {\color[HTML]{0000FE}0.580} & {\color[HTML]{0000FE}0.571} & {\color[HTML]{0000FE}0.149} & {\color[HTML]{0000FE}0.676} & 0.618\\ \cline{2-7} & SMD & {\color[HTML]{FE0000} 0.611} & 0.527 & {\color[HTML]{FE0000} 0.138} & {\color[HTML]{FE0000}0.696} & {\color[HTML]{FE0000}0.656} \\ \cline{2-7} & DRFI & {\color[HTML]{333333} 0.547} & {\color[HTML]{FE0000} 0.591} & 0.152 & 0.657 & {\color[HTML]{0000FE}0.635} \\ \hline\hline \multirow{4}{*}{\begin{turn}{90}MSRA10K\end{turn}} & Methods & WF-Measure & BR & MAE & PRE$^\omega$ & REC$^\omega$ \\ \cline{2-7} & \textbf{ITSELF} & {\color[HTML]{0000FE}0.675} & {\color[HTML]{FE0000}0.634} & {\color[HTML]{0000FE}0.116} & {\color[HTML]{0000FE}0.724} & 0.680\\ \cline{2-7} & SMD & {\color[HTML]{FE0000} 0.704} & 0.594 & {\color[HTML]{FE0000} 0.104} & {\color[HTML]{FE0000}0.730} & {\color[HTML]{FE0000}0.733} \\ \cline{2-7} & DRFI & 0.583 & {\color[HTML]{0000FE} 0.435} & 0.149 & 0.525 & {\color[HTML]{0000FE}0.724} \\ \hline \hline \multirow{4}{*}{\begin{turn}{90}Lungs\end{turn}} & Methods & WF-Measure & BR & MAE & PRE$^\omega$ & REC$^\omega$ \\ \cline{2-7} & \textbf{ITSELF} & {\color[HTML]{FE0000} 0.621}& {\color[HTML]{0000FE}0.208} & {\color[HTML]{FE0000} 0.141} & {\color[HTML]{FE0000}0.857} & 0.506 \\ \cline{2-7} & SMD & {\color[HTML]{0000FE}0.404} & 0.095 & {\color[HTML]{0000FE}0.325} & {\color[HTML]{0000FE}0.294} & {\color[HTML]{FE0000}0.724} \\ \cline{2-7} & DRFI & 0.325 & {\color[HTML]{FE0000}0.255} & 0.412 & 0.224 & {\color[HTML]{0000FE}0.664} \\ \hline \hline \multirow{4}{*}{\begin{turn}{90}Parasites\end{turn}} & Methods & WF-Measure & BR & MAE & PRE$^\omega$ & REC$^\omega$ \\ \cline{2-7} & \textbf{ITSELF} & {\color[HTML]{FE0000} 0.538} & {\color[HTML]{FE0000}0.382} & {\color[HTML]{FE0000} 0.013} & {\color[HTML]{FE0000}0.490} & {\color[HTML]{FE0000}0.683} \\ \cline{2-7} & SMD & {\color[HTML]{0000FE}0.121} & 0.192 & {\color[HTML]{0000FE}0.155} & {\color[HTML]{0000FE}0.078} & {\color[HTML]{0000FE}0.662} \\ \cline{2-7} & DRFI & 0.041 & {\color[HTML]{0000FE}0.320} & 0.164 & 0.022 & 0.433 \\ \hline \end{tabular}% } \vspace{0.2cm} \caption{The best scores are colored in red and blue, respectively.} \label{tab:quantitative-results} \end{table} \begin{figure*}[t!] \centering \begin{tabular}{c c c c c c c c c} \includegraphics[width=0.09\textwidth]{figs/ECSSD-16.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-ECSSD-16-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ECSSD-16-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ECSSD-16-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ECSSD-16-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ECSSD-16-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ECSSD-16-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ECSSD-16-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/ECSSD-391.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-ECSSD-391-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ECSSD-391-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ECSSD-391-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ECSSD-391-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ECSSD-391-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ECSSD-391-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ECSSD-391-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/ECSSD-982.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-ECSSD-982-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ECSSD-982-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ECSSD-982-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ECSSD-982-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ECSSD-982-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ECSSD-982-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ECSSD-982-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/ICOSEG-3271.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-ICOSEG-3271-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ICOSEG-3271-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ICOSEG-3271-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ICOSEG-3271-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ICOSEG-3271-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ICOSEG-3271-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ICOSEG-3271-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/ICOSEG-2600.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-ICOSEG-2600-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ICOSEG-2600-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ICOSEG-2600-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ICOSEG-2600-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ICOSEG-2600-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ICOSEG-2600-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ICOSEG-2600-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/ICOSEG-5835.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-ICOSEG-5835-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ICOSEG-5835-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ICOSEG-5835-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ICOSEG-5835-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ICOSEG-5835-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ICOSEG-5835-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ICOSEG-5835-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/MSRA-938.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-MSRA-938-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-MSRA-938-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-MSRA-938-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-MSRA-938-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-MSRA-938-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-MSRA-938-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-MSRA-938-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/ECSSD-480.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-ECSSD-480-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ECSSD-480-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-ECSSD-480-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ECSSD-480-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-ECSSD-480-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ECSSD-480-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-ECSSD-480-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/DUT-35.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-DUT-35-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-DUT-35-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-DUT-35-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-DUT-35-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-DUT-35-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-DUT-35-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-DUT-35-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/DUT-165.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-DUT-165-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-DUT-165-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-DUT-165-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-DUT-165-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-DUT-165-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-DUT-165-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-DUT-165-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/DUT-671.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-DUT-671-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-DUT-671-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-DUT-671-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-DUT-671-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-DUT-671-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-DUT-671-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-DUT-671-segm.jpg} & \\ (a) & (b) & (c) & (d) & (e) & (f) & (g) & (h) \end{tabular} \caption{(a) Input image. (b) Ground-truth segmentation; (c-h) DRFI/ITSELF/SMD saliency maps with mean-saliency threshold segmentation boundaries depicted on red/green/blue, respectively. Note how ITSELF tend to create more accentuated contrast between the object and background, adhering to the boundaries. } \label{fig:segmentation_results} \end{figure*} \subsection{Non-natural-image dataset comparisons} Concerning the two evaluated non-natural-image datasets, ITSELF outperformed both SMD and DRFI by a big margin, especially on the parasite dataset (Table \ref{tab:quantitative-results}). Figure \ref{fig:segmentation_results-non-natural} shows side-by-side example results of the three methods. While DRFI and SMD create over-salient regions, ITSELF provides a better definition of the objects. On the x-ray images, the inside of the lungs has different characteristics compared to the ribs. Because most of the patients' lung boundaries overlap with their ribs, ITSELF's results cannot achieve a high BR score. However, ITSELF obtained substantially higher precision when compared to the other methods. ITSELF fails to correctly detect both lungs on images where one is too small or has higher intensities than the other (Figure \ref{fig:fail-xray-unhealthy}). These are characteristics of not healthy images, so future works might use ITSELF segmentation error to indicate unhealthy patients. \begin{figure}[t!] \centering \begin{tabular}{c c c} \includegraphics[width=0.13\textwidth]{figs/fail-xray-orig.jpg} & \includegraphics[width=0.13\textwidth]{figs/fail-xray-gt.jpg} & \includegraphics[width=0.13\textwidth]{figs/fail-xray-itself.jpg} \\ (a) & (b) & (c) \end{tabular} \caption{(a) Original image. (b) Ground-truth; (c) ITSELF saliency map. ITSELF completely lost the smaller and brighter lung.} \label{fig:fail-xray-unhealthy} \end{figure} A similar issue to the ribs happens on the parasite-eggs dataset. The parasite-eggs are enclosed by a membrane that often gets less colored than the egg's core (Figure \ref{fig:parasite-membrane}). \begin{figure}[t!] \centering \begin{tabular}{c c} \includegraphics[width=0.18\textwidth]{figs/parasite-boundary-orig.jpg} & \includegraphics[width=0.18\textwidth]{figs/parasite-boundary-gt-segm.jpg} \\ (a) & (b) \end{tabular} \caption{(a) Original image. (b) Ground-truth (red) and ITSELF (green) segmentations overlayed. Note the lighter yellow membrane segmented on the ground-truth that was lost by ITSELF.} \label{fig:parasite-membrane} \end{figure} ITSELF fails to accurately detect the salient parasite eggs on a few images where the impurities are elliptical, share similar colors, and are within the size range (Figure \ref{fig:fail-parasite-membrane}). However, ITSELF's BR, and $REC^\omega$ scores are mostly affected by the miss-estimation of the membrane saliency. \begin{figure}[t!] \begin{tabular}{c c c} \includegraphics[width=0.13\textwidth]{figs/fail-parasites-orig.jpg} & \includegraphics[width=0.13\textwidth]{figs/fail-parasites-gt.jpg} & \includegraphics[width=0.13\textwidth]{figs/fail-parasites-itself.jpg} \\ (a) & (b) & (c) \end{tabular} \caption{(a) Original image. (b) Ground-truth; (c) ITSELF saliency map. ITSELF highlights the top right impurity instead of the parasite-egg.} \label{fig:fail-parasite-membrane} \end{figure} \begin{figure*}[t!] \centering \begin{tabular}{c c c c c c c c c} \includegraphics[width=0.09\textwidth]{figs/XRAY-67.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-XRAY-67-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-XRAY-67-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-XRAY-67-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-XRAY-67-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-XRAY-67-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-XRAY-67-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-XRAY-67-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/XRAY-119.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-XRAY-119-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-XRAY-119-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-XRAY-119-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-XRAY-119-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-XRAY-119-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-XRAY-119-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-XRAY-119-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/XRAY-245.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-XRAY-245-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-XRAY-245-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-XRAY-245-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-XRAY-245-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-XRAY-245-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-XRAY-245-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-XRAY-245-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/XRAY-316.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-XRAY-316-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-XRAY-316-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-XRAY-316-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-XRAY-316-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-XRAY-316-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-XRAY-316-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-XRAY-316-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/XRAY-331.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-XRAY-331-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-XRAY-331-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-XRAY-331-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-XRAY-331-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-XRAY-331-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-XRAY-331-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-XRAY-331-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/Parasites-1.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-Parasites-1-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-Parasites-1-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-Parasites-1-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-Parasites-1-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-Parasites-1-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-Parasites-1-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-Parasites-1-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/Parasites-4.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-Parasites-4-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-Parasites-4-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-Parasites-4-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-Parasites-4-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-Parasites-4-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-Parasites-4-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-Parasites-4-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/Parasites-11.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-Parasites-11-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-Parasites-11-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-Parasites-11-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-Parasites-11-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-Parasites-11-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-Parasites-11-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-Parasites-11-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/Parasites-627.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-Parasites-627-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-Parasites-627-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-Parasites-627-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-Parasites-627-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-Parasites-627-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-Parasites-627-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-Parasites-627-segm.jpg} & \\ \includegraphics[width=0.09\textwidth]{figs/Parasites-629.jpg} & \includegraphics[width=0.09\textwidth]{figs/GT-Parasites-629-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-Parasites-629-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/DRFI-Parasites-629-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-Parasites-629-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/ITSELF-Parasites-629-segm.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-Parasites-629-border.jpg} & \includegraphics[width=0.09\textwidth]{figs/SMD-Parasites-629-segm.jpg} & \\ (a) & (b) & (c) & (d) & (e) & (f) & (g) & (h) \end{tabular} \caption{(a) Input image. (b) Ground-truth segmentation; (c-h) DRFI/ITSELF/SMD saliency maps with mean-saliency threshold segmentation boundaries depicted on red/green/blue, respectively Note how ITSELF tend to create more accentuated contrast between the object and background, adhering to the boundaries. } \label{fig:segmentation_results-non-natural} \end{figure*} \section{Conclusion}\label{sec:conclusion} We have presented ITSELF, a saliency estimation framework that is flexible for multiple image domains and allows the user to tailor salient characteristics. By using object-based superpixels, we proposed a novel loop interaction between saliency estimation and superpixel segmentation that iteratively improves both results. Thanks to that interaction, our method creates more semantically explainable maps and segmentation. We compared implementations of our framework to two state-of-the-art saliency methods on six datasets, four of which are composed of natural images and two non-natural ones. We achieve competitive results on the natural images and outperformed by a significant margin on non-natural images. Note that we do not claim these are optimal implementations of our framework; instead, they demonstrate the framework's flexibility to different scenarios. For future work, we want to explore two ideas presented in this paper. One is to combine ITSELF to other saliency estimators, including deep-neural-networks, and evaluate its performance. Another lane is to further explore the usage of user-provided scribbles to model more priors and queries, allowing ITSELF to be used in weakly-supervised segmentation and interactive segmentation. \section{Related Works}\label{sec:related} \subsection{Superpixels on saliency estimation} Early methods used single pixels or $n \times n$-blocks of pixels to compute contrast \cite{valenti2009image, itti1998model, achanta2008salient} but they usually lack well-defined separation between object and background, overly increasing the saliency of blocks adjacent to actual salient regions. To better define these regions, most modern methods adopt the usage of superpixels. Many methods have been proposed to super-segment the image into superpixels (\textit{e.g.,} \cite{achanta2012slic, felzenszwalb2004efficient, comaniciu2002mean, vargas2019iterative}), however, choosing which superpixel segmentation to use is a somewhat overlooked task when estimating saliency. Most methods opt for using SLIC \cite{achanta2012slic}, which is a fast grid-based segmentation method that creates regular superpixels (superpixels are of similar size and shape). Despite superpixel regularity being an essential feature for many applications, there is always a trade-off between regularity and object-boundary adherence. Additionally, recent advances in superpixel algorithms allow the usage of object information (\textit{e.g.,} saliency maps) to improve segmentation and provide control over the behavior of superpixels \cite{belem2019oisf, belem2019importance}. To the best of our knowledge, no saliency estimator has explored a saliency-based superpixel segmentation yet. \subsection{Priors and Queries} Most unsupervised saliency estimators model saliency using a combination of prior domain-specific knowledge, and salient characteristics extracted from the input image. The prior knowledge is used to create global assumptions that do not depend on image-specific characteristics: On natural images, for example, the salient object is most likely centered \cite{peng2016salient, shen2012unified}, focused \cite{jiang2013salient} and composed of vivid colors \cite{peng2016salient, shen2012unified}. It is not hard to imagine scenarios where these assumptions fail, and the results are sub-par. On the other hand, bottom-up information can be used to model saliency based on similarities of intrinsic low-level image information: For example, one may assume that regions with high color contrast to its adjacency are likely to be salient \cite{cheng2014global}. However, the over-segmentation of the regions (superpixels) may introduce errors. In this regard, several methods propose saliency to be computed on multiple scales \cite{lin2018saliency, zhang2018hypergraph, tong2014saliency, jiang2013drfi}, and then combined later on. Another common approach defines global query regions as representing the background or foreground. Assuming that the object is usually centered and fully enclosed on natural images, the most common background query selection strategy is to use regions on the image borders. However, when the object touches the image border, errors may occur. Multiple strategies have then been proposed to reduce the influence of miss-selected queries. One strategy is to combine multiple saliency maps using subsets of the boundary regions, say one map for each of the four sides (top, right, bottom, and left) \cite{zhang2018hypergraph, peng2016salient, zhang2016ranking}. Another option is to assign a confidence value to boundary-regions based on its part connected to the image border \cite{zhu2014saliency}. Instead of assuming the background to be on the image borders, another set of algorithms expect the image background to be composed of highly redundant information. They solve saliency estimation using \concept{low-rank matrix recovery} (LR) theory. LR-based methods use a low-rank feature matrix to approximate the background regions, and sparse salient object regions, on the other hand, are represented by a sparse sensory matrix. One method that stands out on this approach uses a \concept{Structured Matrix Decomposition (SMD)} \cite{peng2016salient} model, which adds connectivity constraints and a regularization step used to assist images with a cluttered background. Note that all approaches have to make assumptions based on prior knowledge of the image domain. In this regard, by pre-selecting a set of query strategies and top-down priors, even bottom-up strategies are constrained to specific scenarios. \subsection{Graph-based saliency estimation} In recent years, many methods have been proposed using graphs to model saliency \cite{zhu2014saliency, tong2014saliency, zhang2018hypergraph, yang2013saliency, wu2018salient}. Each image is represented by a graph, where the vertices are image regions (superpixels), and an edge connects two related vertices. Regions are usually connected to their adjacency and query regions, and saliency is estimated in a bottom-up manner. Yang \textit{et.al} \cite{yang2013saliency} proposed using the four image borders as background queries to compute four saliency maps using manifold ranking. Even though the multiple maps strategy reduces the error compared to using all background regions simultaneously, the resulting combination commonly highlights only parts of the salient objects. As a further step, the method thresholds the resulting background-map combination to use it as a foreground query to estimate the final saliency map. Wu \textit{et. al.} \cite{wu2018salient} use a similar framework, but they further improve the background queries by estimating how salient each border region is amongst themselves. Zhu \cite{zhu2014saliency}, instead of computing multiple maps, propose a weighting function to determine the confidence of a border region to be the background. They also include a smoothness term to regularize the optimization of cluttered regions of the image. Taking closer attention to the role superpixels have in the process, Tong \cite{tong2014saliency} proposed computing saliency on multiple scales of superpixels and added a filtering property to improve edge preservation on the resulting map. They compute multiple single-scale saliency maps and integrates them by proposing an integration function that optimizes a pixel-to-superpixel similarity measure. Similarly, Zhang \cite{zhang2018hypergraph} proposes using multiple scales of superpixels to compute a background and foreground-query based hypergraph saliency estimator. They present their results using both foreground and background or using a single query. Combining both queries outperforms both other options. All the aforementioned graph-based strategies use a bottom-up only approach and do not leverage top-down prior knowledge. As shown by Peng \cite{peng2016salient}, combining both top-down and bottom-up strategies may be beneficial.
\section{Introduction} The Cosmological Constant problem remains the largest unsolved mystery in modern cosmology, even though it has been known for more than a decade now that a Dark Energy (DE) component is required to fit the observational data \cite{Riess1998,Sullivan2011}. Planck's latest results in 2018, combined with Type Ia Supernovae, measures an equation of state (EOS) parameter for DE of $w_{\text{DE}}= -1.03\pm0.03$ \cite{Plank2018}. Although the nature of DE lacks an exact theoretical explanation, the $\Lambda$CDM remains one of the most successful cosmological models so far from an observational perspective \cite{Peacock1999}. According to the $\Lambda$CDM paradigm, $\Lambda$ and DM consist of about 68\% and 27\% respectively of the content of the Universe and there is compelling observational evidence pointing to their existence \cite{Plank2018,Allen2011,Clowe2003,Corbelli1999}. This strongly motivates our main assumption in this work in particular, that the cosmological expansion history is well described by the $\Lambda$CDM model. A range of theoretical possibilities have been proposed beyond $\Lambda$CDM. The first category makes use of canonical scalar fields \cite{Thorsrud2019} or effective fluids \cite{Nunes2000}. Whether a scalar field or effective fluids are considered, they both have the possibility of interacting with each other. The second category is modified gravity \cite{Clifton2012}, which involves the extensions to GR such as considering a $f(R)$ correction to the gravitational action and other scalar-tensor theories. In this article, we focus on the cosmological dynamics of the quintessence model, under a number of assumptions (discussed below), which lead to several new perspectives. It is normally assumed that the dark sector can only be observed through gravitational effects because this form of mass-energy does not interact directly with ordinary (baryonic) matter and light. Hence, the possibility that quintessence interacts with DM is an interesting avenue to investigate \cite{Wang2016}. Such interactions (referred to as coupled quintessence) were first introduced in \cite{Amendola1999,Holden1999}. In what follows, we first assume (for the sake of simplicity) that the quintessence is allowed to interact with a single generic and effective fluid and we investigate the novel phenomenology that arises due to these interactions. The second assumption concerns the geometry in which the quintessence exists. In fact, the theory of gravitation might actually require two geometries: (i) a gravitational geometry - describing the curvature on the fabric of space-time, and (ii) a physical geometry - which describes how the matter fields propagate. There exist many such examples \cite{BransDicke1962,Dirac1973,HOROWITZ1991}. If $g_{ab}$ is the metric of the gravitational geometry, and $\tilde{g}_{ab}$ is the metric of the physical geometry, then both metrics could be related to each other by the conformal transformation below, where $C(\phi)$ is the conformal function and usually depends of the quintessence field $\phi$: \begin{equation}\label{E1} \tilde{g}_{ab} = C(\phi)g_{ab}\;\;. \end{equation} The effect of the conformal transformation can be understood as rescaling the length of original metric $g_{ab}$ \cite{Clifton2012}. Hence we have $C(\phi)=1$ in the case of GR, which is based on single-geometric description. Any dually geometric theory of gravity i.e., $C(\phi)\neq1$, will break the strong equivalence principle \cite{Bekenstein1992}. However, in such theories of gravity, the relation between the physical metric to gravitational metric is still constrained by the weak equivalence principle and causality \cite{Bekenstein1992}. Moreover, in dually geometric gravitation, the only way to maintain the principle of general covariance is the addition of new fields and hence the use of the quintessence seems convenient \cite{Bekenstein1992}. As shown by \cite{Bekenstein1992}, the disformal relation is obtained by extending the conformal transformation with an extra scaled kinetic term of the scalar field: \begin{equation}\label{E2} \tilde{g}_{ab} = C(\phi)g_{ab} + D(\phi)\partial_{a}\phi\partial_{b}\phi\;\;, \end{equation} where $D(\phi)$ is the disformal coefficient. The effect of a disformal transformation can be understood as the distortion of angles and lengths in the original metric $g_{ab}$ due to compression, which occurs in the direction of the gradient of the field \cite{Bekenstein1992,Teixeira2019}. The occurence of the disformal relation happens in many theories such as Horndeski-type scalar tensor theory \cite{Zuma2013}\cite{Bettoni2013}, non-linear massive gravity theory \cite{deRham2010,Do2016}, brane cosmology with higher dimensions \cite{Koivisto2013} and this framework has attracted considerable attention lately \cite{Teixeira2019,Gannouji2018,Brax2019,Xiao2018}. The popular $\Lambda$CDM cosmology is known to bring about tensions between the relatively high level of clustering found in cosmic microwave background experiments and the smaller one obtained from large-scale observations in the late Universe. A way to alleviate this issue is to consider a scalar field dark energy component conformally coupled to dark matter maintaining a $\Lambda$CDM background cosmology \cite{Barros2018,Barros2019}. In this article we extend these studies to allow in addition disformal couplings, which we explore by performing a dynamical system analysis \cite{Landim2016,Shahalam2015, Boehmer2015}. The article is organised in the following order; Section I motivates the premises upon which our cosmological model is built. In Section II, the Lagrangian description of the coupled quintessence model is provided under disformal transformation. Section III presents how the coupled quintessence model mimics the $\Lambda$CDM background, which explains the reasoning behind not having to specify the quintessence potential. In Section IV, the fluid continuity equations are described as a dynamical system using dimensionless dynamical variables and the bounds of a compact phase space are defined to represent the behaviour of the dynamical system. In Section V, a brief description of the three studied scenarios is given, as well as the suggested approach used to analyse the dynamical system. Section VI entails the analysis of the conformal couplings in the three studied scenarios, which includes the conformal equations, the fixed points, and 2D phase portrait. Sections VII and VIII present the analysis of the disformal couplings in the three studied scenarios, which includes the disformal equations, the additional disformal fixed points, the topological features and the investigation of the trajectories on a 3D phase portrait. Finally in Section IX, we shall present our remarks about the expansion history of the coupled quintessence of Secnario I (where both generic fluids are DM) from the early universe to present, and (ii) the effect of the mass scale on the interaction. \section{Constructing the model} The well known theoretical idea of quintessence is to have a scalar field $\phi$, which can substitute the cosmological constant $\Lambda$. Therefore, the Lagrangian function for the quintessence $\mathcal{L}_{\phi}$, which depends on the gravitational metric $g^{ab}$, should consist of a kinetic and a potential function: \begin{equation} \label{E3} \mathcal{L}_{\phi} = -\dfrac{1}{2}g^{ab}\partial_{a}\phi\partial_{b}\phi - V(\phi). \end{equation} The Lagrangian for matter $\mathcal{L}_{m}$, on the other hand, depends on the physical metric $\tilde{g}^{ab}$, which defines the geodesic upon which the matter fields $\psi$ propagate. If the Einstein-Hilbert action is extended to include the quintessence, the new action in the Einstein frame becomes: \begin{equation} \label{E4} S = \int \! \left( \dfrac{1}{2 \kappa^2}R \; + \;\mathcal{L}_{\phi}(g_{ab} ,\phi)\; + \;\mathcal{L}_{m}(\tilde{g}_{ab} ,\psi) \right) \,\sqrt{-g} \;\rm{d}^{4}x \; , \end{equation} where the first term is the standard GR gravitational action, with Ricci scalar $R$ and $\kappa^2 \equiv 8\pi G = M_{\rm{pl}}^{-2}$. The Planck's mass is taken as $ M_{\rm{pl}} = 2.4 \times 10^{18} \; \rm{GeV}$ with the speed of light and reduced Planck's constant to be assumed as unity $(\hbar = c = 1)$. The metric variation of \eqref{E4} with respect to the metric $g^{ab}$ results in the Einstein field equations in the Einstein frame: \begin{equation} \label{E5} G_{ab} \equiv R_{ab} - \dfrac{1}{2}g_{ab}R = \kappa^2 T_{ab}^{(tot)} =\; \kappa^2 ( T_{ab}^{\phi} + T_{ab}) \;, \end{equation} where $G_{ab}$ and $R_{ab}$ are the Einstein and Ricci tensors respectively. The field equations can be re-arranged to express the quintessence and a coupled fluid as two separate source terms, $T_{ab}^{\phi}$ and $T_{ab} $ respectively. The energy-momentum tensors $T_{ab}^{\phi}$ and $T_{ab}$ are usually defined as: \begin{equation}\label{E6} T_{ab}^{\phi} = -\dfrac{2}{\sqrt{-g}}\dfrac{\delta (\sqrt{-g}\mathcal{L}_{\phi})}{\delta g^{ab}} \hspace{0.25cm} \text{and}\hspace{0.25cm} T_{ab} = -\dfrac{2}{\sqrt{-g}}\dfrac{\delta (\sqrt{-g}\mathcal{L}_{m})}{\delta g^{ab}} \hspace{0.25cm}\text{such that}\hspace{0.25cm} \tilde{T}_{ab} = \dfrac{\sqrt{-g}}{\sqrt{-\tilde{g}}}\dfrac{\delta g^{ab}}{\delta \tilde{g}^{ab}} T_{ab}\;, \end{equation} where the energy-momentum tensor of the disformal frame (denoted by $\tilde{T}_{ab}$) can still be related to that of the Einstein frame under the transformation $\tilde{T}_{ab} \rightarrow T_{ab}$. The Jacobian of the disformal relation \eqref{E2} provides how the determinants of the metrics are related. \begin{equation}\label{E7} J = \dfrac{\sqrt{-g}}{\sqrt{-\tilde{g}}} =C^{2}(\phi)\sqrt{1+\dfrac{D}{C}g^{ab}\partial_{a}\phi\partial_{b}\phi }\;. \end{equation} Moreover, the energy-momentum tensor of any perfect fluid reduces to: \begin{equation} T^{ab}_{l} = (\rho_l + P_l)u^{a}u^{b} + P_l g^{ab}\;, \end{equation} Where $\rho_l $ and $P_l$ are the energy density and pressure respectively for an $l^{th}$ fluid moving with four velocity $u^{a}$ with respect to comoving observer. In our case, the metric $g_{ab}$ is now specified to be spatially flat Friedmann-Lema\^{i}tre-Robertson-Walker (FLRW), which inherently assumes a homogeneous and isotropic universe: \begin{equation} \label{E16} \rm{d}s^2 = g_{ab}\rm{d}x^{a}\rm{d}x^{b} = -\rm{d}t^2 + a^2(t)\;\delta_{\textit{ij}}\rm{d}x^{\textit{i}}\rm{d}x^{\textit{j}} \;, \end{equation} where $a(t)$ is the scale factor, $t$ is the cosmic time and $i,j= 1,2,3$ denote the spatial coordinates. After contracting the Ricci tensor $R_{ab}$ in the Einstein equations \eqref{E5}, the spatial Ricci scalar $^{(3)}R$ hence gives us a general form of the Friedmann equation, which then simplifies into: \begin{equation} \label{E17} H^{2} = \dfrac{\kappa^2}{3}(\rho_{\phi} + \rho_c)\;, \hspace*{1.0 cm} \text{and} \hspace*{1.0 cm} \dot{H} = -\dfrac{1}{2}\kappa^2\left[ (\rho_{\phi} + P_{\phi}) + (1+w_c)\rho_c\right] \;, \end{equation} where $H$ is the Hubble parameter $H \equiv \dot{a}/a$. The energy density and the pressure for the quintessence in the Einstein frame can be computed from the components of $T^{ab}_{\phi}$ to be: \begin{equation} \label{E9} \rho_{\phi} \equiv \dfrac{1}{2}\dot{\phi}^{2} + V(\phi) \hspace{0.5cm}\text{and}\hspace{0.5cm} P_{\phi} \equiv \dfrac{1}{2}\dot{\phi}^{2} - V(\phi)\;, \hspace{0.5cm}\text{with}\hspace{0.5cm} w_{\phi} = \dfrac{P_{\phi} }{\rho_{\phi}} \;. \end{equation} As mentioned earlier, the first premise is that the quintessence is allowed to interact with a single generic and effective perfect fluid with EOS parameter $w_{\rm{c}}$. Assuming $T^{ab}$ is a perfect fluid, the energy density, the pressure and the EOS parameter for the coupled fluid in Einstein frame can be mapped into the disformal frame (See Appendix A.4 of \cite{vandeBruck2015c}): \begin{equation}\label{E8} \tilde{\rho_c}=\dfrac{\rho_c}{C^{2}}\sqrt{1+\dfrac{D}{C}g^{ab}\partial_{a}\phi\partial_{b}\phi }\;,\hspace{0.2cm} \tilde{P}_{c}=\dfrac{P_{c}}{C^{2}\sqrt{1+\dfrac{D}{C}g^{ab}\partial_{a}\phi\partial_{b}\phi }}\;,\hspace{0.2cm} \tilde{w}\equiv \dfrac{\tilde{P}_{c}}{\tilde{\rho}_{c}}=\dfrac{w_{c}}{\left(1+\dfrac{D}{C}g^{ab}\partial_{a}\phi\partial_{b}\phi \right)}\;. \end{equation} If we further assume the quintessence to be isotropic (i.e. $\phi =\phi(t)$ is only a function of time), then in the Einstein frame, the EOS parameter for the coupled fluid and its time-derivative are as below, where the dot means derivative with respect to cosmic time: \begin{eqnarray}\label{E10} w_{\rm{c}}= \left(1-\dfrac{D}{C}\dot{\phi}^2 \right)\tilde{w} \hspace{1.0cm}\text{and}\hspace{1.0cm} \dot{w}_{\rm{c}}= - \tilde{w}\dot{\phi}\dfrac{D}{C}\left[ \left(\dfrac{D_{,\phi}}{D}-\dfrac{C_{,\phi}}{C}\right)\dot{\phi}^2 + 2\ddot{\phi} \right] \;. \end{eqnarray} The variation of the action \eqref{E4} with respect to the quintessence $\phi$ results in the modified Klein-Gordon equation, with $\square \equiv g^{ab}\nabla_{a}\nabla_{b} $, being the D'Alembertian operator \cite{Carsten2016a}: \begin{equation}\label{E11} \square\phi = V_{,\phi} - Q(\phi) \;, \end{equation} where $V_{,\phi}$ denotes the derivative of $V(\phi)$ with respect to $\phi$, and the interaction term for the coupling between the quintessence and a single fluid is given by \cite{Carsten2016a}: \begin{equation}\label{E13} Q(\phi) = \dfrac{C_{,\phi}}{2C}T + \dfrac{D_{,\phi}}{2C}T^{ab}\nabla_{a}\phi\nabla_{b}\phi - \nabla_{a}\left( \dfrac{D}{C}T^{ab} \nabla_{b}\phi \right) \;, \end{equation} where $C_{,\phi}$ and $D_{,\phi}$ are the derivatives of conformal and disformal coefficients $C(\phi)$ and $D(\phi)$ respectively. From the expression provided in \eqref{E6}, one can derive the following conservation equations for the energy-momentum tensors $T_{ab}$ and $T_{ab}^{\phi}$: \begin{eqnarray} \label{E12} \nabla^{a}T_{ab}^{\phi}= -Q\partial _{b} \phi \;, \hspace{0.5cm} \text{and} \hspace{0.5cm} \nabla^{a}T_{ab}= +Q \partial _{b} \phi \;, \end{eqnarray} such that it follows that there is a flow of energy and momentum between two coupled fluids in the model, which is dictated by the interaction term $Q(\phi)$. The total energy-momentum tensor is conserved although their individual components are not separately conserved. By projecting the conservation equations \eqref{E12} along $u_{a}$, we obtain the continuity equations for each fluid: \begin{eqnarray} \ddot{\phi} +3H\dot{\phi} + V_{,\phi} &=& +Q \;\;, \label{E14} \\ \dot{\rho}_{\rm{c}} + 3H\rho_{\rm{c}}(1+w_{\rm{c}}) &=& -Q\dot{\phi} \;. \label{E15} \end{eqnarray} The Einstein field equations \eqref{E5}, the modified Klein-Gordon equation \eqref{E11} and the disformal interaction term $Q(\phi)$ in equation \eqref{E13} may be applied to general cosmological models. \section{Mimicking the $\Lambda$CDM background} In the following, we consider a cosmological background, which has only two fluids, i.e., the cosmological constant $\Lambda$ and an uncoupled generic fluid $\rho_{u}$, whose EOS parameter is $w_{u}$. In the exact $\Lambda$CDM background, the uncoupled generic fluid is simply the cold dark matter $\rho_{\rm{cdm}}$ but we rather treat this background with uncoupled generic fluid to investigate other interesting scenarios (See Sections VI, VII, VIII below). Assuming the FLRW metric \eqref{E16}, the Friedmann and Raychaudhuri equations for this background are: \begin{equation} \label{E18} H^{2}_{\Lambda \rm{CDM}} = \dfrac{\kappa^2}{3}(\rho_{\Lambda} + \rho_u)\;, \hspace*{1.0 cm} \text{and} \hspace*{1.0 cm} \dot{H}_{\Lambda \rm{CDM}} = -\dfrac{1}{2}\kappa^2\left[ (\rho_{\Lambda} + P_{\Lambda}) + (1+w_u)\rho_u\right]\;. \end{equation} On the other hand, the quintessence model, constructed in Section II, also has two fluids i.e, the quintessence $\phi$ and the coupled fluid $\rho_{c}$, whose EOS parameter is $w_{c}$. As mentioned in the Introduction, the novelty of this work is to extend the cosmological background of the coupled quintessence, mimicking $\Lambda$CDM background (See \cite{ Barros2018}), to include a disformal coupling. Hence after equating their Friedmann equations \eqref{E17} and \eqref{E18} from the two cosmological backgrounds, we can express the energy density of the quintessence in terms of the energy densities for the cosmological constant and the coupled fluid, and that of uncoupled fluid: \begin{eqnarray} \label{E19} H^{2} = \dfrac{\kappa^2}{3}(\rho_{\phi} + \rho_c)& = & \dfrac{\kappa^2}{3}(\rho_{\Lambda} + \rho_u) = H^{2}_{\Lambda \rm{CDM}}\;,\\ \label{E20} \rho_{\phi}& = & \rho_{\Lambda} +\rho_{u} - \rho_{c} \;. \end{eqnarray} By equating their Raychaudhuri equations from the two cosmological backgrounds $\dot{H} = \dot{H}_{\Lambda CDM}$, we can express the pressure of the quintessence in terms of the pressure for the cosmological constant and the pressure of the uncoupled fluid, and that of coupled fluid: \begin{eqnarray} \label{E21} \dot{H} = -\dfrac{1}{2}\kappa^2\left[ (\rho_{\phi} + P_{\phi}) + (1+w_c)\rho_c\right] & = & -\dfrac{1}{2}\kappa^2\left[ (\rho_{\Lambda} + P_{\Lambda}) + (1+w_u)\rho_u\right] = \dot{H}_{\Lambda \rm{CDM}} \\ \label{E22} P_{\phi} & = & -\rho_{\Lambda} + w_{u}\rho_{u} - w_{c}\rho_{c} \;. \end{eqnarray} One can therefore write $(\rho_{\phi} + P_{\phi})$ using equations \eqref{E20} and \eqref{E22} to find an expression for $\rho_{u}$: \begin{eqnarray}\label{E23} \rho_{u} & = & \dfrac{\dot{\phi}^{2}}{1+ w_{u}}+ \rho_{c}\;\frac{1+w_{c}}{1+ w_{u}}\;. \end{eqnarray} Then after plugging $\rho_{u}$ back into equation \eqref{E20} using \eqref{E23}, the expression for $\rho_{\phi}$ in terms of quintessence $\phi$ is obtained: \begin{eqnarray}\label{E26} \rho_{\phi} &=& \rho_{\Lambda} + \dfrac{\dot{\phi}^{2}}{1+ w_{u}}+ \rho_{c}\;\frac{w_{c}-w_{u}}{1+ w_{u}}\;. \end{eqnarray} Substituting equation \eqref{E26} and $ \dot{\phi}^{2} =\rho_{\phi} + P_{\phi}$ into the Friedmann and the Raychaudhuri equations \eqref{E17} respectively, we obtain the following form: \begin{equation} H^{2} = \dfrac{\kappa^2}{3}\left[ \dfrac{\dot{\phi}^{2}}{1+ w_{u}} + \rho_{\Lambda} +\rho_{c}\left(\frac{1+w_{c}}{1+ w_{u}}\right) \right]\;, \hspace*{1.0 cm} \dot{H} = -\dfrac{1}{2}\kappa^2\left[\; \dot{\phi}^{2} +\rho_{c} (1+w_c)\;\right]\;. \label{E27} \end{equation} From equation \eqref{E27}, when $\dot{\phi}= 0$, it follows that the coupled system is exactly mimicking $\Lambda$CDM with an uncoupled fluid. This assumption of mimicking an uncoupled setup brings the convenience of not having to define a potential. The potential function of the quintessence and its time-derivative is obtained by inserting relation \eqref{E26} into $V(\phi) = \rho_{\phi} - \frac{1}{2}\dot{\phi}^{2}$ and are given below: \begin{eqnarray} \label{E28} V(\phi) & = & \rho_{\Lambda} + \dfrac{\;\dot{\phi}^{2}}{2}\left(\dfrac{1- w_{u}}{1+ w_{u}}\right) + \rho_{c}\frac{w_{c}-w_{u}}{1+ w_{u}} \;, \\ \label{E29} \dot{V}= V_{,\phi}\dot{\phi} & = & \dot{\phi}\ddot{\phi}\;\dfrac{1- w_{u}}{1+ w_{u}} + \dot{\rho}_{c}\frac{w_{c}-w_{u}}{1+ w_{u}} + \rho_{c}\dot{w_{c}}\;. \end{eqnarray} Moreover, the EOS parameter for an uncoupled fluid is the same constant in both Einstein frame and the disformal frame, i.e. $w_{u} = \tilde{w}_{u} = \text{constant} \Rightarrow \dot{w}_{\textit{u}} = 0$, whereas for the coupled fluid, the EOS parameter $w_{c}$ and its time-derivative $\dot{w}_{c}$ are given by \eqref{E10}. Therefore plugging \eqref{E10} and the continuity equation \eqref{E15} into \eqref{E29} and after simplifying, we obtain the derivative of the potential $V_{,\phi}$: \begin{eqnarray}\label{E30} V_{,\phi} & = & \dfrac{\ddot{\phi}}{1+ w_{u}}\left(1- w_{u} - 2\tilde{w}\rho_{c}\dfrac{D}{C}\right)\; + \; \dfrac{\tilde{w}\rho_{c}}{1+ w_{u}}\left(\dfrac{D_{,\phi}}{D}-\dfrac{C_{,\phi}}{C}\right)\dfrac{D}{C}\dot{\phi}^2 \nonumber \\ && - \left(\dfrac{3H\rho_{c}}{\dot{\phi}}\right)\dfrac{(w_{c}-w_{u})(1+ w_{c})}{1+ w_{u}}\; - \dfrac{w_{c}-w_{u}}{1+ w_{u}}Q(\phi)\;. \end{eqnarray} This $V_{,\phi} $ in equation \eqref{E30} can be plugged into the continuity equation \eqref{E14} to find an expression for $\ddot{\phi}$, which is useful when computing the interaction term $Q(\phi)$: \begin{small} \begin{eqnarray} \label{E31} \hspace{-1.0cm} \ddot{\phi} = \dfrac{(1+ w_{c})Q(\phi) - 3H\dot{\phi}(1+ w_{u}) + \tilde{w}\rho_{c}\left(\dfrac{D}{C}\right)\left(\dfrac{D_{,\phi}}{D}-\dfrac{C_{,\phi}}{C}\right)\dot{\phi}^2 + \left(\dfrac{3H\rho_{c}}{\dot{\phi}}\right)(w_{c}-w_{u})(1+ w_{c})}{\left(2-2\tilde{w}\rho_{c}\dfrac{D}{C}\right)}. \end{eqnarray} \end{small} Lastly, the interaction term $Q(\phi)$ for a single generic coupled fluid can be computed by evaluating the covariant derivative of time components for the energy-momentum tensor in equation \eqref{E13}: \begin{small} \begin{eqnarray} \label{E32} Q(\phi) =-\dfrac{\rho_c}{2}\dfrac{C_{,\phi}}{C}(1 -3 w_c) -\rho_{c}\dfrac{D}{C}\left(\dfrac{D_{,\phi}}{D}-\dfrac{C_{,\phi}}{C}\right)\dot{\phi}^2 + \dfrac{D}{C}Q\dot{\phi}^2+3\dfrac{D}{C}w_{c}\rho_{c}H\dot{\phi}- \rho_{c}\ddot{\phi} \dfrac{D}{C}\;. \end{eqnarray} \end{small} After plugging \eqref{E31} into the last term of equation \eqref{E32}, one can obtain this form for the interaction term: \begin{eqnarray} \label{E33} Q(\phi) &=&\dfrac{-\rho_{c}\left(2-2\tilde{w}\dfrac{D}{C}\right)\left[ \dfrac{C_{,\phi}}{2C}(1 -3 w_c) + \dfrac{D}{C}\left(\dfrac{D_{,\phi}}{2D}-\dfrac{C_{,\phi}}{C}\right)\dot{\phi}^2 - 3Hw_{c}\dfrac{D}{C}\dot{\phi} \right]}{\left[\left( 1- \dfrac{D}{C}\dot{\phi}^2\right)\left(2-2\tilde{w}\rho_{c}\dfrac{D}{C}\right) + \rho_{c}(1+ w_{c})\left( \dfrac{D}{C}\right)\right]} + \\ && \frac{\dfrac{D\rho_{c}}{C}\left[ 3H\dot{\phi}(1+ w_{u}) - \tilde{w}\rho_{c}\left(\dfrac{D}{C}\right)\left(\dfrac{D_{,\phi}}{D}-\dfrac{C_{,\phi}}{C}\right)\dot{\phi}^2 - \left(\dfrac{3H\rho_{c}}{\dot{\phi}}\right)(w_{c}-w_{u})(1+ w_{c})\right] }{\left[\left( 1- \dfrac{D}{C}\dot{\phi}^2\right)\left(2-2\tilde{w}\rho_{c}\dfrac{D}{C}\right) + \rho_{c}(1+ w_{c})\left( \dfrac{D}{C}\right)\right]}\;. \nonumber \end{eqnarray} Following the literature, the conformal and disformal coefficients are chosen \cite{Carsten2016a} : \begin{eqnarray} \label{E34} C(\phi) = \exp(2\alpha \kappa \phi) \;, \hspace{1.0cm} D(\phi) = \dfrac{\exp(2(\alpha + \beta) \kappa \phi)}{M^4}\; , \\ \label{E35} \lambda_C \equiv - \dfrac{1}{\kappa}\dfrac{C_{,\phi}}{C} =-2\alpha \;, \hspace{0.5cm} \lambda_D \equiv - \dfrac{1}{\kappa}\dfrac{D_{,\phi}}{D} =-2(\alpha + \beta) \;, \end{eqnarray} where the parameters $\alpha$ and $\beta$ are constants. $M$ is the mass scale in the disformal coupling. In a purely conformal case, functions $D(\phi)$ and $ D_{,\phi}$ vanish. \newpage \section{The dynamical systems approach} The dynamical system of any cosmological model can be constructed by considering that certain properties (e.g. energy density) of the different fluids evolve with time $t$ or e-folds $N = \ln a $. In our case, we shall define the dimensionless dynamical variables \cite{Carsten2016a} as follows: \begin{eqnarray} \label{E36} x^2 \equiv \dfrac{\kappa^2\dot{\phi}^{2} }{3H^2} , \hspace{1cm} y^2 \equiv \dfrac{\kappa^2\rho_{\Lambda}}{3H^2} ,\hspace{1cm} z^2 \equiv \dfrac{\kappa^2\rho_{c}}{3H^2} ,\hspace{1cm} \sigma \equiv \dfrac{D(\phi)}{\kappa^2 C(\phi)}H^2 \;. \end{eqnarray} It follows that the set of equations, governing the evolution of these dynamical variables, can be inferred from the continuity equations \eqref{E14} and \eqref{E15}. At this point, let us emphasise that the dynamical variable $\sigma$ measures the strength of the disformal coupling. These variables are constrained to obey the Friedmann and Raychaudhuri equations \eqref{E27} yielding: \begin{eqnarray} 1+ w_{u}= x^2 + (1+ w_{u})y^2 + (1+w_{c})z^2\;, \hspace{0.1cm} \\ \dfrac{ \;H^{\prime}}{H} =-\dfrac{3}{2}\left[x^2 + (1+w_{c})z^2\right] = -\dfrac{3}{2}(1+w_{\text{eff}}) \;, \label{E37} \end{eqnarray} where $^{\prime}$ means derivative with respect to e-fold $N$. The $w_{\text{eff}}$ has been introduced as an effective equation of state, which must satisfy $ w_{\text{eff}} <-1/3$ for accelerated expansion and $w_{\text{eff}} >-1/3$ for decelerated expansion. The set of first order differential equations for the dynamical system is obtained by taking the derivative of the defined variables \eqref{E36} and plugging into the continuity equations \eqref{E14} and \eqref{E15}: \begin{eqnarray}\label{E38} x^{\prime} &=& - \dfrac{ \;H^{\prime}}{H}x - \dfrac{3x}{2}\dfrac{(1+ w_{u})}{(1-3\tilde{w}z^2\sigma)} + \dfrac{3\sqrt{3}\tilde{w}x^2z^2\sigma(\lambda_{C}-\lambda_{D})}{2(1-3\tilde{w}z^2\sigma)} + \dfrac{3z^2}{2x}\dfrac{(w_{c}-w_{u})(1+w_{c})}{(1-3\tilde{w}z^2\sigma)} \; \nonumber\\ && + \; \dfrac{(1+w_{c})}{(1-3\tilde{w}z^2\sigma)} \frac{\kappa}{2\sqrt{3}}\dfrac{Q}{H^2} \;,\\ [5pt] \label{E39} z^{\prime} &=& -\dfrac{ \;H^{\prime}}{H}z -\dfrac{3}{2}z(1+w_c) - \frac{\kappa}{2\sqrt{3}}\dfrac{Q}{H^2}\dfrac{x}{z} \;, \\ \label{E40} y^{\prime} &=& -\dfrac{ \;H^{\prime}}{H}y\;, \\ \label{E41} \sigma^{\prime} &=& \left((\lambda_C - \lambda_D)\sqrt{3}x + 2\dfrac{ \;H^{\prime}}{H} \right)\sigma \;. \end{eqnarray} After substituting the above dynamical variables \eqref{E36} into the interaction term \eqref{E33}, we obtain \eqref{E42}. This is a closed system because $\left(\frac{H^{\prime}}{H}\right)$ can be eliminated by using \eqref{E37}. \begin{eqnarray} \label{E42} \hat{Q} \equiv \dfrac{\kappa Q}{H^2}&=& \dfrac{6z^2(1-3\tilde{w}\sigma z^2)\left[ \dfrac{\lambda_{C}}{2}(1-3w_c) + \dfrac{3}{2}\sigma x^2 (\lambda_{D} -2\lambda_{C}) + 3\sqrt{3}w_{c}\sigma x \right]}{(1-3\sigma x^2)(2-6\tilde{w}\sigma z^2) +3\sigma z^2(1+w_c)} + \nonumber \\ && \; \dfrac{9\sqrt{3}\sigma z^2\left[ x(1+w_u) + \sqrt{3}\tilde{w}\sigma x^2 z^2(\lambda_{D} -\lambda_{C}) - (w_{c}-w_{u})(1+ w_{c})\dfrac{z^2}{x} \right]}{(1-3\sigma x^2)(2-6\tilde{w}\sigma z^2) +3\sigma z^2(1+w_c)}\;. \end{eqnarray} These differential equations \eqref{E38}-\eqref{E42} govern the overall behaviour for a FLRW Universe. The interaction term $Q(\phi)$ is a function of $\lambda_C =-2\alpha $ and $ \lambda_D =-2(\alpha + \beta)$. Thus the choice of the functions $C(\phi)$ and $D(\phi)$ determines how the coupled fluid and the quintessence are interacting. Using the Friedmann constraint i.e. the first equation in \eqref{E37}, one can express $z$ in terms of $x,\;y$ and then substitute it in the evolution equations \eqref{E38}-\eqref{E42} to reduce the dimensions of the dynamical system, with only $x,\;y$ and $\sigma$. This set of equations is more useful and straightforward to be solved, and we can always recover $z$ through the constraint equation whenever required. Finally, one can write the density parameter $\Omega_{\phi}$ from equation \eqref{E26} and using \eqref{E22} together with \eqref{E23} we can find the EOS for the quintessence $w_{\phi}$, in terms of the dynamical variables: \begin{eqnarray} \label{E43} \Omega_{\phi} \equiv \dfrac{\kappa^2\rho_{\phi}}{3H^2} = \dfrac{x^2}{1+w_u} + y^2 + \dfrac{w_c -w_u}{1+w_u}z^2 = 1-z^2 \;\hspace{1cm} \text{and} \;\hspace{1cm} w_{\phi}= \dfrac{x^2 + y^2 -1}{1-z^2}\;. \end{eqnarray} The solutions of this dynamical system with the differential equations \eqref{E38}-\eqref{E42} can be represented on a phase space of $x$, $z$, and $\sigma$, where each point denotes a specific state of the system (see Figures 2, 5 and 8). However this phase space cannot be infinite as physical conditions must be imposed, for instance, the energy density can only be positive and therefore the existence of fixed points is limited by $ 0 <\Omega_{\phi} < 1 $. Also, the values of the disformal strength, $0 <\sigma <\infty $, is compactified by defining $\Sigma \equiv \arctan \sigma$. The resulting phase space, therefore, results in a compact set, defined by \begin{eqnarray} \label{E44} -1 < x < 1 \hspace{0.6cm} \text{and} \hspace{0.6cm} z>0 \hspace{0.6cm}\text{and}\hspace{0.5cm} 0 < \Sigma < \pi/2 \;, \\ \hspace{0.2cm}\text{and} \hspace{0.2cm} 0 < x^2 + (1+w_u)y^2 + (w_c -w_u)z^2 < (1+w_u) \;. \nonumber \end{eqnarray} We verify whether the transformation \eqref{E2} is indeed real and invertible, by computing the Jacobian of the equation \eqref{E2}, which is expressed in terms of the dynamical variables below: \begin{equation} \label{E45} J = \dfrac{\sqrt{-g}}{\sqrt{-\tilde{g}}} =C^{2}\sqrt{1+\dfrac{D}{C}g^{ab}\partial_{a}\phi\partial_{b}\phi } = C^{2}\sqrt{1-3\sigma x^2}\;. \end{equation} It can be noted that if $3\sigma x^2 > 1 $, the Jacobian $J$ is not real and in the limit $\sqrt{1-3\sigma x^2} \to 0$, a singularity appears in this phase space. Therefore, the following condition must be imposed on the phase space: \begin{equation} \label{E46} 3\sigma x^2 \leq 1 \;. \end{equation} The dynamical system \eqref{E38}-\eqref{E42} is also invariant under the simultaneous transformation of the parameters $(\alpha, \beta) \rightarrow (-\alpha,-\beta)$. Thus, the phase space is still fully described by taking only positive values of $(\alpha, \beta)$. \section{Scenarios, Fixed points, and Trajectories} The dynamical system is described by the evolution equations \eqref{E38},\eqref{E39}, \eqref{E41}, the Friedmann constraint equation \eqref{E37}, two free parameters ($\alpha\;\text{and}\;\beta$) and the two fluids ($\rho_{\phi} \;\text{and}\; \rho_c$) mimicking the cosmological constant $\Lambda$ and an uncoupled fluid $\rho_u$. The choice of EOS parameter $\tilde{w}$ and $\tilde{w}_u$ for the coupled fluid and uncoupled fluid respectively give rise to different scenarios: \begin{enumerate} \item Scenario I : $\tilde{w} =0$ and $\tilde{w}_u =0$, implies that a pressureless fluid (e.g DM) is coupled to quintessence and both fluids are mimicking a $\Lambda \rm{CDM}$ background, where DM starts to dominate after matter-dark energy equality. \item Scenario II: $\tilde{w} =1/3$ and $\tilde{w}_u =0$, implies that a relativistic fluid is coupled to quintessence and both fluids are mimicking a $\Lambda \rm{CDM}$ background. \item Scenario III: $\tilde{w} =1/3$ and $\tilde{w}_u =1/3$, implies that a relativistic fluid coupled to quintessence and both fluids are mimicking a background with a cosmological constant $\Lambda$ and an uncoupled relativistic fluid. An example of this scenario refers to relativistic neutrinos which are coupled to quintessence in the early universe as compared to uncoupled radiation. \end{enumerate} Our analysis of the dynamical system in each specific scenario i.e., after specifying the EOS parameters $\tilde{w}$ and $\tilde{w}_u$ is done by investigating two aspects: \begin{enumerate} \item The nature of the fixed points -- which are static solutions of the dynamical system, that correspond to $x^{\prime} = y^{\prime} = z^{\prime} = \sigma^{\prime} = 0$ \cite{Bahamonde2017}. \item The trajectories on the phase space -- which are non-static solutions of the dynamical variables. Those trajectories correspond to the evolution of the system from one cosmological state to another on the compactified phase space. \end{enumerate} According to linear stability theorem \cite{Bahamonde2017}, one can then determine how the system behaves around any point, by applying a Taylor expansion. The Jacobian matrix of the set of three evolution equations is first worked out and then its corresponding three eigenvalues of that Jacobian matrix are evaluated for each of the fixed points. The nature of the fixed point is then determined as: \begin{enumerate} \item If all three eigenvalues $ \Re(E_1) < 0 \; \text{and}\; \Re(E_2) < 0\; \text{and}\; \Re(E_3) < 0$, then the fixed point is stable, \item If all three eigenvalues $\Re(E_1) > 0 \; \text{and}\; \Re(E_2) > 0\; \text{and}\; \Re(E_3) > 0$, then the fixed point is unstable, \item If any combination of three eigenvalues being positive and negative, then the fixed point is saddle, \end{enumerate} where $\Re(E_n)$ denote the real part of the $n^{th}$ eigenvalue. These eigenvalues can still have a dependence on the parameters $\alpha$ and $\beta$ and the conditions for which the fixed points are either stable, unstable or saddle, must be worked out. In other cases, where the eigenvalues are found to be null, the linear stability theorem is inadequate to determine their nature. Then the nature of the point is then evaluated numerically using the Lyapunov theorem \cite{Bahamonde2017} to investigate the asymptotic and global stability. Given certain initial conditions and choice of parameters ($\alpha$ and $\beta$), the nature of the trajectories of this phase space can be determined. In what follows we determine the evolution of the dynamical variables $x, z$ and $\sigma$ for the two following cases: \begin{enumerate} \item Fixed parameters ($\alpha$ and $\beta$) but different Initial Conditions (IC). \item Fixed Initial Conditions (IC) but different parameters ($\alpha$ and $\beta$). \end{enumerate} Our approach is to investigate all the different theoretical possibilities for (a) the trajectories, (b) the effect of disformal coupling constant on the evolution of the Universe, and (c) the sensitivity of the dynamical system to the initial conditions. In the upcoming sections VI-VIII, we will analyse the nature of the fixed points and trajectories for three different scenarios in both conformal and disformal framework. \section{Conformal Framework} We investigate the fixed points and the phase portrait of the dynamical system in a conformal framework (i.e. $C(\phi) \neq 1$ in equation \eqref{E1}) for the three studied scenarios. In a purely conformal framework, the disformal coefficient and its derivative vanish $D(\phi)=D_{,\phi}=0$ and the variable $\sigma$ also vanishes. We obtain the differential equations for $x$ and $z$ as below for the three studied scenarios. \begin{enumerate} \item In Scenario I ($\tilde{w} =0$ and $\tilde{w}_u =0$), the interaction between quintessence and is still present but simplies reduces to $Q = \alpha \rho\nabla^{b}\phi$ \cite{Amendola1999}, where the parameter $\alpha$ is the conformal coupling constant. \begin{eqnarray} \label{E47} x^{\prime} &=& \dfrac{3x}{2}(x^2 + z^2)-\dfrac{3x}{2} - \dfrac{\kappa}{2}\sqrt{3}\alpha z^{2} \;, \\ \label{E48} z^{\prime} &=& \dfrac{3z}{2}(x^2 + z^2) - \dfrac{3z}{2} + \dfrac{\kappa}{2}\sqrt{3}\alpha xz \;. \end{eqnarray} \item When $\tilde{w} =1/3$, the quintessence and the radiation do not interact at all with each other, and so the interaction term $Q(\phi)$, vanishes as well for both scenarios II and III. In Scenario II: ($\tilde{w} =1/3$ and $\tilde{w}_u =0$), the differential equations becomes: \begin{eqnarray} \label{E57S3} x^{\prime} &=&\dfrac{3}{2} x \left(x^2+\dfrac{4 z^2}{3}\right)-\frac{3 x}{2} +\frac{2 z^2}{3 x}\;, \\ \label{E58S3} z^{\prime} &=& \dfrac{3}{2} z \left(x^2+\dfrac{4 z^2}{3}\right)-2 z\;. \end{eqnarray} \item In Scenario III ($\tilde{w} =1/3$ and $\tilde{w}_u =1/3$), the differential equations becomes: \begin{eqnarray} \label{E62b} x^{\prime} &=&\frac{3}{2} x \left(x^2+\frac{4 z^2}{3}\right)-2 x\;, \\ \label{E63} z^{\prime} &=&\frac{3}{2} z \left(x^2+\frac{4 z^2}{3}\right)-2 z\;. \end{eqnarray} \end{enumerate} The phase portraits of the dynamical system \eqref{E47}-\eqref{E48}, as well as \eqref{E57S3}-\eqref{E58S3} and \eqref{E62b}-\eqref{E63} was computed, as shown in Figure \ref{fig:stream-sc1}. The following points were noted: \vspace{-0.2cm} \begin{enumerate} \item Point $A_0$, i.e. ($0,0$), is a scalar field dominated fixed point which exists in scenario I, II, and III. It is located at the origin of the phase space. It is an attractor when evaluated according to Lyapunov theorem. Most of the trajectories seem to end at this fixed point. It always exists since it has no dependence on parameters $\alpha$. It satisfies the acceleration condition of $ w_{\text{eff}} <-1/3$. \item Points $(C_{\pm})$, i.e. ($\pm1,0$), which are two kinetic-dominated fixed points, which exist in scenario I, II, but not III. They are located on the $xz$ plane at unit length of $x$. They have no dependence on the parameter $\alpha$ and always exists. In scenario I, when $\alpha >0 $, Point $(C_{+})_{\textbf{I}}$ is unstable and Point $(C_{-})_{\textbf{I}}$ is saddle and when $\alpha < 0$, Point $(C_{+})_{\textbf{I}}$ is unstable and Point $(C_{-})_{\textbf{I}}$ is saddle. In scenario II, Points $(C_{\pm})_{\textbf{I}}$ are both saddle. \item In scenario II, the line $x = 0$ is an equilibrium line, which consist of repeller fixed points and it separates $x<0$ and $x>0$. \end{enumerate} \begin{figure}[h!] \centering \includegraphics[scale=0.4]{ConformalSI.png} \includegraphics[scale=0.375]{ConformalSIInSIII.png} \caption{\label{fig:stream-sc1}Trajectories of the dynamical system \eqref{E47}-\eqref{E48} in the scenario I (i.e. $\tilde{w} =0$ and $\tilde{w}_u =0$), are shown in the top panels, with $\alpha = 0.05$ in the top left and $\alpha = 1.0$ in the top right respectively. In the top panels, the Friedmann constraint \eqref{E37} becomes $1 = x^2 + z^2$ and represents the half-circle. Trajectories of the dynamical system \eqref{E57S3}-\eqref{E58S3} in the conformal scenario II (i.e $\tilde{w} =1/3$ and $\tilde{w}_u =0$), are shown in the bottom left panel, where the red line is equilibrium line consisting of repeller fixed points and it separates $x<0$ and $x>0$. In the bottom left panel, the Friedmann contraint \eqref{E37} becomes $3 = 3x^2 + 4z^2$ and represents the half-ellipse. The trajectories of the dynamical system \eqref{E62b}-\eqref{E63} in the conformal scenario III (i.e $\tilde{w} =1/3$ and $\tilde{w}_u =1/3$), are shown in the bottom right panel. In conformal scenario III, the Friedmann contraint \eqref{E37} becomes $4 = 3x^2 + 4z^2$ and represents the half-ellipse. In all panels, the blue dots represents the fixed points i.e. $A_{0}$ and $(C_{\pm})$, which are the attractor and saddle points respectively. The yellow shaded region corresponds to a region of accelerated expansion, satisfying $ w_{\text{eff}} <-1/3$. } \end{figure} In scenario I, the values of $\alpha$ were constrained to be $\alpha = \pm 0.079^{+0.016}_{-0.019}$ for an exponential potential, as mentioned in \citep{Barros2018}. Thus, two phase portraits were produced with $\alpha = 0.05$ and $\alpha = 1.0$ for illustrative purposes. In scenario II and III, the dynamical systems \eqref{E57S3}-\eqref{E58S3} and \eqref{E62b}-\eqref{E63} does not depend on the parameters $\alpha$ and $\beta$ at all. \section{Disformal Framework} We extend now our analysis of the fixed points and the phase portrait to a disformal framework for the three studied scenarios. The dynamical variable $\sigma$ and the disformal constant $\beta$ now play an important role. The form of the differential equations for \eqref{E38}, \eqref{E39}, \eqref{E41} and the reduced interaction term \eqref{E42} can be written for the respective scenarios as follows: \begin{enumerate} \item In scenario I ($\tilde{w} =0$ and $\tilde{w}_u =0$): The dynamical system, described by \eqref{E49}, \eqref{E50} and \eqref{E51}, has 9 fixed points, which are summarized in Table \ref{table:points-sc1} with respective eigenvalues in Table \ref{table:eigen-sc1}. \begin{eqnarray} \label{E49} x^{\prime} &=& \dfrac{3x}{2}(x^2 + z^2)-\dfrac{3x}{2} +\dfrac{ \hat{Q}}{2\sqrt{3}}\;, \\ \label{E50} z^{\prime} &=& \dfrac{3z}{2}(x^2 + z^2) - \dfrac{3z}{2} -\dfrac{\hat{Q}}{2\sqrt{3}}\left(\dfrac{x}{z}\right)\;, \\ \label{E51} \sigma^{\prime} &=& \left[\sqrt{3} x \left(\lambda _C-\lambda _D\right)-3 \left(x^2+z^2\right)\right] \sigma\;, \\ \label{EQ1} \hat{Q } &=& \frac{3 z^2 \left[\lambda _C \left(1-6 \sigma x^2\right)+3 \sigma x \left(x \lambda _D+\sqrt{3}\right)\right]}{-6 \sigma x^2+3 \sigma z^2+2}\;. \end{eqnarray} \item In scenario II ($\tilde{w} =1/3$ and $\tilde{w}_u =0$): The dynamical system, described by \eqref{E57}, \eqref{E58} and \eqref{E59}, has 5 fixed points which are in Table \ref{table:points-sc2} with their Eigenvalues in Table \ref{table:eigen-sc2}. \begin{eqnarray} \label{E57} x^{\prime} &=&+\frac{3}{2} x \left[x^2 +\frac{z^2}{3} \left(4-3 \sigma x^2\right) \right] - \frac{3 x}{2 \left(1-\sigma z^2\right)} + \frac{z^2 \left(4 - 3 \sigma x^2\right) \left(1-3 \sigma x^2\right)}{6 x \left(1 -\sigma z^2\right)} \hspace{1.0cm} \\ &&\; + \frac{\sqrt{3} \sigma x^2 z^2 \left(\lambda _C-\lambda _D\right)}{2 \left(1-\sigma z^2\right)} + \dfrac{\left(4-3 \sigma x^2\right)}{6 \sqrt{3} \left(1-\sigma z^2\right)}\hat{Q}\;, \nonumber \\ \label{E58} z^{\prime} &=& +\frac{3}{2} z \left[x^2 +\frac{z^2}{3} \left(4-3 \sigma x^2\right) \right] - \frac{z}{2}\left(4-3 \sigma x^2\right) -\frac{x}{2 \sqrt{3} z}\hat{Q} \;, \\\label{E59} \sigma^{\prime} &=& \sigma \left\lbrace\sqrt{3} x \left(\lambda _C-\lambda _D\right)- \left[3x^2 +z^2\left(4-3 \sigma x^2\right)\right]\right\rbrace\;, \\ \label{E60} \hspace{0.5cm} \hat{Q}&=& \frac{\sigma z^2 \left\lbrace 9 x^3 (\lambda _D-\lambda _C)+\sqrt{3} \left[9 \sigma x^4 \left(\sigma z^2-2\right)+3 x^2 \left(3 \sigma z^2+5\right)-4 z^2\right]\right\rbrace}{\sigma z^2 \left(4-3 \sigma x^2\right)+2 \left(1-3 \sigma x^2\right) \left(1-\sigma z^2\right)}\;. \end{eqnarray} \item In scenario III ($\tilde{w} =1/3$ and $\tilde{w}_u =1/3$), The dynamical system \eqref{E64}-\eqref{E67}, has 7 fixed points, which are summarized in Table \ref{table:points-sc3}, together with their eigenvalues. \begin{eqnarray} \label{E64} x^{\prime} &=&+\frac{3}{2} x \left[x^2 +\frac{z^2}{3} \left(4-3 \sigma x^2\right) \right] - \frac{2 x}{\left(1-\sigma z^2\right)} -\frac{\sigma xz^2 \left(4-3 \sigma x^2\right)}{2 \left(1 -\sigma z^2\right)} + \nonumber \\&&\; \frac{\sqrt{3} \sigma x^2 z^2 \left(\lambda _C-\lambda _D\right)}{2 \left(1-\sigma z^2\right)} + \dfrac{\left(4-3 \sigma x^2\right)}{6 \sqrt{3} \left(1-\sigma z^2\right)}\hat{Q}\;, \\ \label{E65} z^{\prime} &=& +\frac{3}{2} z \left[x^2 +\frac{z^2}{3} \left(4-3 \sigma x^2\right) \right] - \frac{z}{2}\left(4-3 \sigma x^2\right) -\frac{x}{2 \sqrt{3} z}\hat{Q} \;, \end{eqnarray} \begin{eqnarray}\label{E66} \sigma^{\prime} &=& \sigma \left\lbrace\sqrt{3} x \left( \lambda _C-\lambda _D\right)- \left(3x^2 +z^2\left[4-3 \sigma x^2\right)\right]\right\rbrace \;, \\ \label{E67} \hspace{0.5cm} \hat{Q}&=& \frac{3 \sigma x z^2 \left\lbrace 3 x( \lambda _D -\lambda _C)+\sqrt{3} \left[3 \sigma x^2 \left(\sigma z^2-2\right)+2 \sigma z^2+6\right]\right\rbrace}{3 \sigma x^2 \left(\sigma z^2-2\right)+2 \sigma z^2+2}\;. \end{eqnarray} \end{enumerate} All the disformal fixed points and features of the general dynamical system \eqref{E38}-\eqref{E42} are iterated below and the following remarks are made: \begin{enumerate} \item Point $A_0$, is a scalar field dominated fixed point, which exists in Scenario I, II and III (same as in the conformal framework). It is located at the origin of the phase space. It is an attractor when evaluated according to Lyapunov theorem. Most of the trajectories end at this fixed point. It always exists since it does not depend on parameters $\alpha$ and $\beta$. It satisfies the acceleration condition of $ w_{\text{eff}} <-1/3$. The fixed point $A_0$ has a null eigenvalue and it was found to be stable by using Lyapunov theorem instead. \item Point $(C_{\pm})$, i.e. ($\pm1,0,0$) are two kinetic-dominated fixed points which exist in scenario I and II, but not scenario III. They are located on the $xz$ plane at unit length of $x$. They are similar as in the conformal framework except that $\beta$ can now influence its nature. \begin{enumerate}[label=(\roman*)] \item In scenario I, they always exist for all values of $\alpha$ and $\beta$ but their different choices determine whether the fixed points are either unstable or saddle points. For Point $(C_{+})_{\textbf{I}}$, the conditions are the following: \begin{small} \begin{eqnarray} \label{E52} \text{Unstable:}&\Rightarrow & \hspace{0.2cm} \beta >\frac{\sqrt{3}}{2} \hspace{0.2cm} \text{and} \hspace{0.2cm} \alpha > 0\;.\\ \text{Saddle:} &\Rightarrow &\hspace{0.2cm} \beta <\frac{\sqrt{3}}{2} \hspace{0.2cm} \text{and} \hspace{0.2cm} \alpha <0 \hspace{0.2cm} \text{OR} \hspace{0.2cm} \beta <\frac{\sqrt{3}}{2} \hspace{0.2cm} \text{and} \hspace{0.2cm} \alpha >0 \hspace{0.2cm} \text{OR}\hspace{0.2cm} \beta >\frac{\sqrt{3}}{2} \hspace{0.2cm} \text{and} \hspace{0.2cm} \alpha <0\;. \nonumber \end{eqnarray} \end{small} For Point $(C_{-})_{\textbf{I}}$, the conditions are the following: \begin{small} \begin{eqnarray} \label{54} \text{Unstable:}&\Rightarrow & \hspace{0.2cm} \beta <-\frac{\sqrt{3}}{2} \hspace{0.2cm} \text{and} \hspace{0.2cm} \alpha <0\;.\\ \text{Saddle:} &\Rightarrow &\hspace{0.2cm} \beta >-\frac{\sqrt{3}}{2} \hspace{0.2cm} \text{and} \hspace{0.2cm} \alpha >0 \hspace{0.2cm} \text{OR} \hspace{0.2cm} \beta >-\frac{\sqrt{3}}{2}\hspace{0.2cm} \text{and} \hspace{0.2cm} \alpha <0 \hspace{0.2cm} \text{OR}\hspace{0.2cm} \beta <-\frac{\sqrt{3}}{2} \hspace{0.2cm} \text{and} \hspace{0.2cm} \alpha >0\;. \nonumber \end{eqnarray} \end{small} \item In scenario II, the fixed points always exist as saddle points and the conditions are: \begin{small} \begin{eqnarray} \label{E61} \text{For $(C_{+})_{\textbf{II}}$ } &:& \beta <\frac{\sqrt{3}}{2} \hspace{0.2cm} \text{OR} \hspace{0.2cm} \beta >\frac{\sqrt{3}}{2}\;. \\ \label{E62} \text{For $(C_{-})_{\textbf{II}}$ } &:& \beta >-\frac{\sqrt{3}}{2} \hspace{0.2cm} \text{OR} \hspace{0.2cm} \beta <-\frac{\sqrt{3}}{2}\;. \end{eqnarray} \end{small} \end{enumerate} \item Point $(B_{\pm})$ are two disformal scaling points which are possible solutions in scenario I and II. They both can only exist if either $\beta \leq -\frac{\sqrt{3}}{2}$ or $\beta \geq \frac{\sqrt{3}}{2}$. The location of the two fixed points depends on the parameter $\beta$. When $\beta = 0$ in conformal case, and those fixed points do not exist at all, so there is no issue of singularity at all. But unfortunately, the Points $(B_{\pm})_{\textbf{I}}$ and $(B_{\pm})_{\textbf{II}}$ are unable to satisfy the condition \eqref{E46}, which means the points are neither real nor physical points. In scenario I, these fixed points could only be saddle points and the conditions are: \begin{eqnarray}\label{EPtB} 0<\beta <\frac{\sqrt{3}}{2} \;\text{if}\; \alpha<0 \; \text{and} \;-\frac{\sqrt{3}}{2}<\beta <0 \;\text{if}\; \alpha>0\;\\ \text{OR} \;\beta >\frac{\sqrt{3}}{2} \;\text{if}\; \alpha<0 \;\text{and} \;\beta <-\frac{\sqrt{3}}{2} \;\text{if}\; \alpha>0. \end{eqnarray} \item Points $(D_{\pm})_{\textbf{III}}$ i.e. ($0, \pm1,0$), are two radiation-dominated fixed points which exists only in scenario III. They are located on the $xz$ plane at $z=\pm1$. It is an unstable point when evaluated according to Lyapunov theorem. The point $(D_{-})_{\textbf{III}}$ is unphysical because the energy density must be positive. The point $(D_{+})_{\textbf{III}}$ always exists as an unstable point. Since its effective EOS $w_{\text{eff}} = 1/3$, this fixed points leads to a decelerated expansion. \item Points $(S_{\pm})$, i.e. $(0, 0,\pm \infty)$, arise due to the restriction imposed by the condition \eqref{E46} since they lie at $x=0$ , and $\sigma =\pm \infty$. Hence these fixed points exist in each scenario I, II and III. Since the phase portrait is compactified and defined by \eqref{E44}, and by the definition of the $\sigma$ variable is only positive, the Point $(S_{-})$ is unphysical. Point $(S_{+})$ is a Saddle. \item Points $(T_{\pm})$, i.e. $(0, +1 ,\pm \infty)$, arise due to the restriction imposed by the condition \eqref{E46} since they lie at $x=0$ , and $\sigma =\pm \infty$. These fixed points exist in scenario I and III only but not in scenario II. Since the phase portrait is compactified and defined by \eqref{E44}, and by the definition of the $\sigma$ variable is only positive, Point $(T_{-})$ is unphysical. Point $(T_{+})$ is a repeller. \item The line $L_{\rm{E}}$ i.e. $(x=0,z=0, \forall\; \sigma)$ constitutes a line of equilibrium points and it connects the fixed points $A_0$ and $(S_{+})$. This line exists in each scenario I, II and III. \item In scenario II, the $z\sigma$ surface at $(x=0\; \forall\; \sigma)$ forms a topological surface of repeller points. \end{enumerate} \section{Disformal Trajectories} \subsection*{8.1.1 Disformal Scenario I: Fixed ($\alpha,\beta$) values but various Initial Conditions} After having studied the fixed points, we move to the analysis of the non-static solutions in this scenario I (i.e $\tilde{w} =0$ and $\tilde{w}_u =0$). In order to fix ($\alpha,\beta$) values, we consider that $\beta \geq \sqrt{3}/2$ for Point $(B_{+})_{\textbf{I}}$ to exist and that $\alpha =0.05$ as constrained in \citep{Barros2018}. Let us now fix the values $\alpha = 0.05, \;\text{and}\; \beta = 1.5$ and analyse how our dynamical system evolves from different sets of initial conditions (IC). Under the evolution of the dynamical system, the initial condition pre-determines the endpoints. The following was found from analysing figure \ref{fig:ic-sc1}: \begin{enumerate} \item The dynamical system flows from one fixed point to another within this closed compactified space, where the Points $(S_{+})_{\textbf{I}}$ and $(T_{+})_{\textbf{I}}$ are asymptotes, and trajectories tend towards that limit. \item If the starting point is near or on the $xz$ plane and satisfying $x^2 + z^2 \leq 1$, the end point is only the attractor point $A_{0}$, as in the conformal case. The conformal invariant sub-manifold is preserved. \item The dynamical system is sensitive to the chosen initial conditions. i.e., different initial conditions around the proximity of the fixed points can lead to different endpoints. For example, when the IC is chosen near $(C_{+})_{\textbf{I}}$, the dynamical system can end up at either $A_{0}$ or on the equilibrium line near$(S_{+})_{\textbf{I}}$. Similarly, IC is chosen near $(T_{+})_{\textbf{I}}$, the endpoints could be either at $A_{0}$ or $(S_{+})_{\textbf{I}}$ or on the equilibrium line $L_{\rm{E}}$. $(C_{-})_{\textbf{I}}$ is a saddle fixed point where the dynamical system can be momentarily at rest such that point $A_{0}$ is the final end point. \end{enumerate} \begin{figure}[h!] \includegraphics[scale=0.4]{3DStream1.png} \caption{\label{fig:ic-sc1}This figure shows scenario I, where the quintessence is disformally coupled to a pressureless fluid (i.e $\tilde{w} =0$ and $\tilde{w}_u =0$) with $\alpha = 0.05, \;\text{and}\; \beta = 1.5$ and the $x\sigma z$ phase portrait is shown with the different trajectories, which correspond to different chosen initial conditions (including the fixed points $(C_{\pm})_{\textbf{I}}$ and $(T_{+})_{\textbf{I}}$).At the boundary of the phase space, the Friedmann contraint \eqref{E37} becomes $1 = x^2 + z^2$ and represents the surface for the half cylinder. The black solid line is the equilibrium line $L_{\rm{E}}$ i.e. $(x=0,z=0, \forall\; \sigma)$. The $xz$ plane ($\sigma =0$) is the conformal invariant submanifold and the fixed point $A_0$ is an attracting end point. The shaded region corresponds to the forbidden region, where condition \eqref{E46} is not satisfied.} \end{figure} \subsection*{8.1.2 Disformal Scenario I: Fixed Initial Conditions but various ($\alpha, \beta$) values} \vspace*{0.5cm} At this stage, it makes sense to choose initial conditions (IC) close to a fixed point, because then, one can already know whether the chosen IC behaves like a saddle or a repeller. Moreover, it is preferable not to choose the IC near an attractor. The aim here is to investigate any deviation from the conformal case. Thus, it is in our interest to chose the IC set near to the repeller point $(T_{+})_{\textbf{I}}$. i.e ($x_{\rm{ic}}=0.0,z_{\rm{ic}}=+1.0$, and $\Sigma_{\rm{ic}} = \pi/2$). The different combination of parameters ($\alpha,\beta$) can now be tested in order to determine how they affect the evolution of the dynamical system and are shown in figure \ref{fig:param-sc1}. \begin{figure}[h!] \centering \includegraphics[scale=0.39]{3DStream1b.png} \caption{\label{fig:param-sc1}This figure shows scenario I, where the quintessence is disformally coupled to pressureless fluid (i.e. $\tilde{w} =0$ and $\tilde{w}_u =0$). Given $(T_{+})_{\textbf{I}}$ as the same initial condition, the evolution of the dynamical system \eqref{E49}, \eqref{E50} and \eqref{E51} depend on the choice of parameters ($\alpha$ and $\beta$). At the boundary of the phase space, the Friedmann contraint \eqref{E37} becomes $1 = x^2 + z^2$ and represents the surface for the half cylinder. The different trajectories in the $xz\sigma$ phase space correspond to different combination of parameters.} \end{figure} We make the following remarks based on figure \ref{fig:param-sc1}: \begin{enumerate} \item For $\alpha >0$, the trajectories flow in the region bounded by $x<0$ and for $\alpha <0$, the trajectories flow in the region bounded $x>0$. A larger value of $\alpha$ causes the trajectory to pass nearer to the conformal point$(C_{\pm})_{\textbf{I}}$ before ending at the attractor $A_0$ or on the equilibrium line $L_{\rm{E}}$. \item For $\alpha <0$ and for $\beta >0$, a larger value of $\beta$ causes the trajectory to end nearer the disformal saddle point $(S_{+})_{\textbf{I}}$, otherwise for smaller value of $\beta$, it ends on equilibrium line $L_{\rm{E}}$, nearer to the attractor $A_0$. \item For $\alpha >0$ and for $\beta >0$, any value of $\beta$ causes the trajectory to repel away from the disformal saddle point $(S_{+})_{\textbf{I}}$ and nearer to the attractor $A_0$. \item For $\alpha <0$ and for $\beta <0$, any value of $\beta$ causes the trajectory to repel away from the disformal saddle point $(S_{+})_{\textbf{I}}$ and end unto the attractor $A_0$. \item The parameters ($\alpha,\beta$) determine how much the dynamical system \eqref{E49}, \eqref{E50} and \eqref{E51} gets influenced by either the conformal fixed points $(C_{\pm})_{\textbf{I}}$ or disformal fixed point $(S_{+})_{\textbf{I}}$, as it evolves on its trajectory within the phase space. \end{enumerate} \vspace*{0.2cm} \subsection*{8.2.1 Disformal Scenario II: Fixed ($\alpha,\beta$) values but various Initial Conditions} \vspace*{0.2cm} The next two subsections now consider the phase portrait in the scenario II (i.e $\tilde{w} =1/3$ and $\tilde{w}_u =0$). Let us now fix the values $\alpha = 0.05,\; \beta = 1.5$ to same choice as previous scenarios for sake of comparison and analyse the trajectories from different sets of initial conditions. \begin{figure}[h!] \centering \includegraphics[scale=0.4]{3DStream2.png} \caption{\label{fig:ic-sc2}This figure shows scenario II, where the quintessence is disformally coupled to relativistic fluid (i.e $\tilde{w} =1/3$ and $\tilde{w}_u =0$) with $\alpha = 0.05, \;\text{and}\; \beta = 1.5$ and the $x\sigma z$ phase portrait is shown with the different trajectories, which correspond to different chosen initial conditions from the repeller $z\sigma$ plane surface. The blue surface represents the boundary of the phase space and satisfies the Friedmann contraint \eqref{E37}, which becomes $3 x^2 \left(\sigma z^2-1\right)+3=4 z^2$. The black solid line is the equilibrium line $L_{\rm{E}}$ i.e. $(x=0,z=0, \forall\; \sigma)$. The $xz$ plane ($\sigma =0$) is the conformal invariant submanifold and the fixed point $A_0$ is an attracting end point. The $z\sigma$ plane constitute a topological separation between $x<0$ and $x>0$. The shaded region correspond to the forbidden region as where the condition \eqref{E46} is not satisfied.} \end{figure} The following remarks were noted based on Figure \ref{fig:ic-sc2}: \begin{enumerate} \item We recover the conformal behaviour (compare with bottom left panel of Figure \ref{fig:stream-sc1}) on the plane of $\sigma = 0$ as expected. The dynamical variable $\Sigma$ gives an additional degree of freedom for the dynamical system to evolve. The equilibrium line of repeller points in Figure \ref{fig:ic-sc2} extends to a $z\sigma$ plane constitutes a topological separation between $x<0$ and $x>0$. \item All the trajectories starting on that $z\sigma$ plane end on the equilibrium line $L_{\rm{E}}$, which connects both $(S_{+})_{\textbf{II}}$ and attractor point $A_0$. \item If IC are set close to $z\sigma$ surface for $x>0$ and further away from the equilibrium line $L_{\rm{E}}$, the trajectory gets attracted to the saddle point $(S_{+})_{\textbf{II}}$ than $A_0$ before ending onto the equilibrium line $L_{\rm{E}}$. \item If IC are set close to $z\sigma$ surface for $x<0$ and further away from the equilibrium line $L_{\rm{E}}$, the trajectory gets repelled by the saddle point $(S_{+})_{\textbf{II}}$ but also attracted to the attractor point $A_0$ before ending onto the equilibrium line $L_{\rm{E}}$. \item For $z=0$, and $x<0\; \text{and}\; \forall\; \Sigma$, all trajectories end up at the attractor $A_0$. For $z=0$, and $x>0 \; \text{and}\; \Sigma > 0$, all trajectories end up closer to the saddle point $(S_{+})_{\textbf{II}}$, but if $\Sigma = 0$, the trajectory will end up at the attractor $A_0$ as expected from the conformal behaviour. \end{enumerate} \subsection*{8.2.2 Disformal Scenario II: Fixed Initial Conditions but various ($\alpha, \beta$) values} As done in subsection 8.1.2, in order to describe the disformal coupling, it makes sense to choose initial conditions (IC) close to a disformal fixed point. \begin{figure}[h!] \includegraphics[scale=0.375]{3DStream2b.png} \caption{\label{fig:ic-sc5}This figure shows scenario II, where the quintessence is disformally coupled to relativistic fluid (i.e $\tilde{w} =1/3$ and $\tilde{w}_u =0$). Given the same initial condition of $x=0.01, z= 0.85 , \Sigma =\pi/4)$ on the surface of repeller points, the evolution of the dynamical system \eqref{E57}, \eqref{E58} and \eqref{E59} depend on the choice of parameters ($\alpha$ and $\beta$). The blue surface represents the boundary of the phase space and satisfies the Friedmann contraint \eqref{E37}, which becomes $3 x^2 \left(\sigma z^2-1\right)+3=4 z^2$. The different trajectories in the $xz\sigma$ phase space correspond to different combination of parameters. The blue trajectory ($\alpha =0.05$) and green trajectory ($\alpha =1.00$) overlap implying that $\alpha$ does not affect the trajectories on the dynamical system.} \end{figure} However, the disformal point i.e. $(B_{\pm})_{\textbf{II}}$ is not physical and the conformal framework ($\Sigma =0$) for this scenario II, does not depend on the parameters $\alpha$ and $\beta$. The $z\sigma$ surface at $x=0$ and $\forall \sigma$, however, consists of a surface of repeller fixed points and any point on that surface should be adequate for analysing how our dynamical system behaves with different combination of parameters. Since an IC which is further away from the equilibrium line $L_{\rm{E}}$ produce appreciable trajectories, we choose the IC as ($x_{\rm{ic}}=0.01,\; z_{\rm{ic}}= 0.85,\; \Sigma_{\rm{ic}} = \pi /4$). The different combination of parameters ($\alpha,\beta$) can now be tested and we make the following remarks according to figure \ref{fig:ic-sc5}: \begin{enumerate} \item The IC are set close to $z\sigma$ with $x\geq 0$ and further away from the equilibrium line $L_{\rm{E}}$, the trajectory gets attracted, as expected nearer to the saddle point $(S_{+})_{\textbf{II}}$ than $A_0$ before ending onto the equilibrium line $L_{\rm{E}}$. \item The blue trajectory ($\alpha =0.05$) and green trajectory ($\alpha =1.00$) overlap each other which implies that $\alpha$ does not affect the trajectories on the dynamical system \eqref{E57}, \eqref{E58} and \eqref{E59}. \item The value of $\beta$ determines, where trajectory ends on the equilibrium line $L_{\rm{E}}$. If the value $\beta$ is large, the trajectory ends near the saddle point $(S_{+})_{\textbf{II}}$ and if the value $\beta$ is small, the trajectory ends near $A_0$. \item There is also no effect on the trajectories when the parameter $\alpha \rightarrow -\alpha$. but if $\beta \rightarrow -\beta$, then the trajectory ends up only at $A_0$, such that they are repelled from $ (S_{+})_{\textbf{II}}$. \end{enumerate} \subsection*{8.3.1 Disformal Scenario III: Fixed ($\alpha,\beta$) values but various Initial Conditions} \vspace*{0.25cm} We now move to the analysis of the trajectories in the scenario III in the next two subsections (i.e $\tilde{w} =1/3$ and $\tilde{w}_u =0$). The values $\alpha = 0.05,\; \beta = 1.5$ are fixed for sake of comparison. Similar to the previous subsections, few different initial conditions were chosen near the fixed points e.g. $(T_{+})_{\textbf{III}}$ and $(D_{+})_{\textbf{III}}$. Additionally, few other different initial conditions were chosen on edge of the phase portrait on the line of intersection between the boundary surface satisfying the Friedmann constraint i.e. $4 = 4 z^2 + 3 x^2 (1 - \sigma z^2)$ and the region satisfying \eqref{E46}. The reason to choose those initial conditions is to appreciate how the trajectories span out unto the phase portrait. We make the following remarks, according to figure \ref{fig:ic-sc6}: \begin{enumerate} \item We recover the conformal behavior (compare with Figure \ref{fig:stream-sc1}) on the plane of $\Sigma = 0$ as expected. The dynamical variable $\Sigma$ gives an additional degree of freedom for the dynamical system to evolve. \item When the IC is chosen from the fixed point $(T_{+})_{\textbf{III}}$, the trajectory ends at $(S_{+})_{\textbf{III}}$ and when the IC is chosen from the fixed point $(D_{+})_{\textbf{III}}$, the trajectory ends at $ A_{0}$. \item All these trajectories whose IC are on the line of intersection between the surface of the blue surface shown as $4 = 4 z^2 + 3 x^2 (1 - \sigma z^2)$ and the surface satisfying \eqref{E46}, flow away from the repelling point $(T_{+})_{\textbf{III}}$ originally towards an endpoint on the equilibrium line $L_{\rm{E}}$. \item All trajectories for all the IC without exception end eventually on the equilibrium line $L_{\rm{E}}$. If the IC have $x_{ic} <0$, the trajectories tend to approach the attractor $ A_{0}$ and if the IC have $x_{ic} >0$, the trajectories tend to approach the saddle fixed point $(S_{+})_{\textbf{III}}$. \end{enumerate} \begin{figure}[h!] \vspace*{-0.1cm} \centering \includegraphics[scale=0.425]{3DStream3.png} \caption{\label{fig:ic-sc6}This figure shows the scenario III, where the quintessence is disformally coupled to relativistic fluid (i.e $\tilde{w} =1/3$ and $\tilde{w}_u =1/3$) with $\alpha = 0.05, \;\text{and}\; \beta = 1.5$ and the $x\sigma z$ phase portrait is shown with the different trajectories, which correspond to different chosen initial conditions. The blue surface represents the boundary of the phase space and satisfies the Friedmann constraint \eqref{E37}, which becomes $4 = 4 z^2 + 3 x^2 (1 - \sigma z^2)$. The black solid line is the equilibrium line $L_{\rm{E}}$ i.e. $(x=0,z=0, \forall\; \sigma)$. The $xz$ plane ($\sigma =0$) is the conformal invariant submanifold and the fixed point $A_0$ is an attracting end point. The $z\sigma$ plane constitutes a topological separation between $x<0$ and $x>0$. The shaded region is where the condition \eqref{E46} is not satisfied.} \end{figure} \subsection*{8.3.2 Disformal Scenario III: Fixed Initial Conditions but various ($\alpha, \beta$) values} \vspace*{0.25cm} Similar to the previous subsections, we choose initial conditions (IC) close to a fixed point and evaluate the dependence of the trajectories on the parameters $\alpha$ and $\beta$. The IC was not chosen at $(T_{+})_{\textbf{III}}$ but near it, otherwise the behaviour is assymptotic and regardless of the ($\alpha, \beta$) values, the trajectory flows straight to $(S_{+})_{\textbf{III}}$. But instead, in order to have appreciable effect of the parameters, the IC are set near the disformal repeller point$(T_{+})_{\textbf{III}}$ i.e. ($x_{ic}=-0.1,z_{ic}=+1.0$, and $\Sigma_{ic} = \pi/2$). The different combination of parameters ($\alpha,\beta$) can now be tested, and we make the following remarks, given the results of figure \ref{fig:param-sc3}: \begin{enumerate} \item The blue trajectory and green trajectory overlap each other, which implies that $\alpha$ does not affect the trajectories on the dynamical system \eqref{E64}-\eqref{E67}. \item The value of $\beta$ determines, where trajectory ends on the equilibrium line $L_{\rm{E}}$. If the value $\beta$ is large, the trajectory ends further away from the saddle point $(S_{+})_{\textbf{III}}$ and if the value $\beta$ is small, the trajectory ends close to $(S_{+})_{\textbf{III}}$ \item There is also no effect on the trajectories when the parameter $\alpha \rightarrow -\alpha$. but if $\beta \rightarrow -\beta$, then the trajectory ends up only at $ (S_{+})_{\textbf{III}}$. \end{enumerate} \begin{figure}[h!] \hspace*{-1.0cm} \includegraphics[scale=0.425]{3DStream3b.png} \caption{\label{fig:param-sc3}This figure shows the scenario III, where the quintessence is disformally coupled to relativistic fluid (i.e $\tilde{w} =1/3$ and $\tilde{w}_u =1/3$). Given the same initial condition of $(x=-0.1, z= 0.85 , \Sigma =\pi/4)$ on the surface of repeller points, the evolution of the dynamical system \eqref{E64}-\eqref{E67} depends on the parameters $\alpha$ and $\beta$. The blue surface represents the boundary of the phase space and satisfies the Friedmann constraint \eqref{E37}, which becomes $4 = 4 z^2 + 3 x^2 (1 - \sigma z^2)$. The blue trajectory and green trajectory overlap each other which implies that $\alpha$ does not affect the trajectories on the dynamical system. } \end{figure} \subsection*{8.4 Summary of all disformal fixed points} In this subsection, we summarise all disformal fixed points and their eigenvalues which were obtained from the three studied scenarios in the following tables. The conformal fixed points are a subset of the disformal fixed points, irrespective of the scenario. \begin{table}[ht] \begin{tabular}{|| c| c | c | c | c c c | c |c||} \hline Point & $x$ & $z$ &$\sigma$ & $ \Omega_{\phi} $& $ w_{\phi} $ & $w_{\text{eff}}$ &Existence & Acceleration\\ [0.5ex] \hline\hline $A_{0}$ &$0$& 0 & 0 &1& -1 & 0 &$\forall \beta,\alpha$& Yes\\ \hline $(C_{\pm})_{\textbf{I}}$ & $\pm 1$& 0 & 0 &1& 0& 0 &$\forall \beta,\alpha$& No\\ \hline $(B_{\pm})_{\textbf{I}}$ & $\dfrac{\sqrt{3}}{2 \beta }$ & $\pm\dfrac{\sqrt{4 \beta^2-3}}{2 \beta}$ & $\dfrac{4 \beta ^2}{9}$ &$\dfrac{3}{4 \beta ^2}$& 0 & $\frac{3}{4 \beta ^2}-1$& $\beta \leq -\frac{\sqrt{3}}{2}$ or $\beta \geq \frac{\sqrt{3}}{2}$ & No \\ [1.5ex] \hline $(S_{\pm})_{\textbf{I}}$ & 0 & 0 &$\pm \infty$ & $ 1 $& $ - $ & $-$ & $\forall \beta,\alpha$& -\\ \hline $(T_{\pm})_{\textbf{I}}$ & 0 & $\pm 1$ &$\pm \infty$ & $ 0 $& $ - $ & $-$ & $\forall \beta,\alpha$& -\\ \hline \end{tabular} \caption{\label{table:points-sc1} This table shows a summary of all the fixed points which was obtained by solving the dynamical system \eqref{E49}, \eqref{E50} and \eqref{E51} for a quintessence disformally coupled with pressureless fluid in the Scenario I ($\tilde{w} =0$ and $\tilde{w}_u =0$). For each fixed point, the existence and the effective equation of state, as defined in \eqref{E43}, are evaluated. The $``-"$ means undetermined.} \end{table} \begin{table}[ht] \begin{tabular}{|| l | c c c |} \hline & Conformal &&\\ \hline Point & $E_{1}$&$E_{2}$ &\hspace*{0.5cm}$E_{3}$\hspace*{0.5cm}\\ \hline Point $A_0$ &$-\frac{3}{2}$&$-\frac{3}{2}$ &$0$ \\[1.2ex] \hline Point $(C_{\pm})_{\textbf{I}}$ &$+3$& $+\dfrac{3}{2}$ & $\pm\frac{\sqrt{3} \alpha }{2}$ \\[1.2ex] \hline \end{tabular} \begin{tabular}{|| l | c c c |} \hline & Disformal &&\\ \hline Point & $E_{1}$&$E_{2}$ &\hspace*{0.cm}$E_{3}$\hspace*{0.7cm} \\ \hline Point $A_0$ &$-\frac{3}{2}$&$-\frac{3}{2}$ &$0$ \\[1.2ex] \hline Point $(C_{\pm})_{\textbf{I}}$ &$+3$& $\pm \frac{\sqrt{3} \alpha }{2}$ & $\pm 2 \sqrt{3} \beta -3$ \\[1.2ex] \hline \end{tabular} \caption{\label{table:eigen-sc1} This table shows all the eigenvalues, which are evaluated at each fixed point, for scenario I ($\tilde{w} =0$ and $\tilde{w}_u =0$). The left tabular corresponds to the eigenvalues of the conformal dynamical system \eqref{E47} and \eqref{E48}. The right tabular corresponds to the eigenvalues of the disformal dynamical system \eqref{E49}, \eqref{E50} and \eqref{E51}. The eigenvalues of the disformal fixed points $(B_{\pm})_{\textbf{I}}$, $(S_{\pm})_{\textbf{I}}$ and $(T_{\pm})_{\textbf{I}}$ are undetermined.} \end{table} \begin{table}[ht] \begin{tabular}{|| c | c | c | c | c | c | c | c |c||} \hline Point &$x$&$z$&$\sigma$ & $ \Omega_{\phi} $& $ w_{\phi} $ & $w_{\text{eff}}$ &Existence & Acceleration \\ \hline\hline $ A_{0}$ &$0$& 0 & 0 &1& -1 &-1&$\forall \beta,\alpha$& Yes \\ \hline $(C_{\pm})_{\textbf{II}}$ & $\pm 1$& 0 & 0 &1& 0 &0&$\forall \beta,\alpha$ & No\\ \hline $(B_{\pm})_{\textbf{II}}$ & $\dfrac{\sqrt{3}}{2 \beta }$ & $\pm\dfrac{\sqrt{4 \beta^2-3}}{2 \beta}$ & $\dfrac{4 \beta ^2}{9}$ &$\dfrac{3}{4 \beta ^2}$& 0 & $\frac{3}{4 \beta ^2}-1$& $\beta \leq -\frac{\sqrt{3}}{2}$ or $\beta \geq \frac{\sqrt{3}}{2}$ & No \\ [1.5ex] \hline $(S_{\pm})_{\textbf{II}}$ & 0 & 0 &$\pm \infty$ & $ 1 $& $ - $ & $-$ & $\forall \beta,\alpha$& -\\ \hline \end{tabular} \caption{\label{table:points-sc2}A summary of all the fixed points for the dynamical system \eqref{E57}-\eqref{E59} for a quintessence disformally coupled with relativistic fluid in the Scenario II ($\tilde{w} =1/3$ and $\tilde{w}_u =0$). The $``-"$ means undetermined.} \end{table} \begin{table}[ht] \begin{tabular}{|| l | c c c |} \hline & Conformal &&\\ \hline Point & $E_{1}$&$E_{2}$ &\hspace*{0.5cm}$E_{3}$\hspace*{0.5cm} \\ \hline Point $A_0$ &$-2$&$-\frac{3}{2}$ &$0$ \\[1.4ex] \hline Point $(C_{\pm})_{\textbf{II}}$ &$+3$& $+\dfrac{3}{2}$ & $-\dfrac{1}{2}$ \\[1.4ex] \hline &&&\\[1.2ex] \hline \end{tabular} \begin{tabular}{|| l | c c c |} \hline & Disformal &&\\ \hline Point & $E_{1}$&$E_{2}$ &\hspace*{0.7cm}$E_{3}$\hspace*{0.7cm} \\ \hline Point $A_0$ &$-2$&$-\frac{3}{2}$ &$0$ \\[1.2ex] \hline Point $(C_{\pm})_{\textbf{II}}$ &$+3$& $-\dfrac{1}{2}$ & $\pm 2 \sqrt{3} \beta -3$ \\[1.2ex] \hline Point $(B_{\pm})_{\textbf{II}}$ &$-2$& $-\dfrac{3}{2}$ & $+ 3$ \\[1.2ex] \hline \end{tabular} \caption{\label{table:eigen-sc2}This table shows all the eigenvalues, which are evaluated at each fixed point, for scenario II ($\tilde{w} =1/3$ and $\tilde{w}_u =0$). The left tabular corresponds to the eigenvalues of the conformal dynamical system \eqref{E57S3} and \eqref{E58S3}. The right tabular corresponds to the eigenvalues of the disformal dynamical system \eqref{E57}, \eqref{E58} and \eqref{E59}. The disformal eigenvalues of $(S_{\pm})_{\textbf{II}}$ are undertermined.} \end{table} \begin{table}[ht] \begin{tabular}{|| c | c | c | c | c | c | c | c |c|c|c|c||} \hline Point &$x$&$z$&$\sigma$ & $ \Omega_{\phi} $& $ w_{\phi} $ & $w_{\text{eff}}$ &Existence & Acceleration & $E_{1}$&$E_{2}$ &$E_{3}$ \\ \hline\hline $ A_{0}$ &$0$& 0 & 0 &1& -1 &-1&$\forall \beta,\alpha$& Yes &$-2$&$-2$ &$0$ \\ \hline $(D_{\pm})_{\textbf{III}}$ & 0 & $\pm 1$& 0 &0& - &$\dfrac{1}{3}$&$\forall \beta,\alpha$& No &$-4$&$-4$ &$0$\\ \hline $(S_{\pm})_{\textbf{III}}$ & 0 & 0 &$\pm \infty$ & $ 1 $& $ - $ & $-$ & $\forall \beta,\alpha$& -&$- $&$- $&$- $\\ \hline $(T_{\pm})_{\textbf{III}}$ & 0 & $\pm 1$ &$\pm \infty$ & $ 0 $& $ - $ & $-$ & $\forall \beta,\alpha$ & -&$- $&$- $&$- $\\ \hline \end{tabular} \caption{\label{table:points-sc3}This table shows a summary of all the fixed points for the Scenario III ($\tilde{w} =1/3$ and $\tilde{w}_u =1/3$). The $``-"$ means undetermined. This table also includes the Eigenvalues which are evaluated at these fixed points for the disformal dynamical system \eqref{E64}-\eqref{E67}. The fixed point $A_0$ has same Eigenvalues for the conformal dynamical system \eqref{E62b}-\eqref{E63}. The nature of fixed point $A_0$ and $(D_{\pm})_{\textbf{III}}$ are found to be stable and unstable respectively using Lyapunov theorem. } \end{table} \newpage \pagebreak \section{Cosmological Analysis} After performing an analysis of the dynamical system for each disformal scenario, we will consider a universe with a radiation-dominated phase, and DM dominated phase, before it enters a de-Sitter evolution. In this section, the expansion history of this coupled quintessence model (which is constructed to mimic $\Lambda$CDM background) is studied in terms of cosmological redshift $Z = 1/a -1 $. The redshift $Z$ is not to be confused with dynamical variable $z$. The quintessence is coupled to DM throughout the cosmological timeline, implying that $z$ represents the energy density of DM, therefore this is expansion history of the cosmological model in disformal scenario I, whose dynamical system is described by \eqref{E49}-\eqref{EQ1} \begin{figure}[h!] \centering \includegraphics[scale=0.4]{EnergyDensity.png} \caption{\label{fig:energies}The energy density for the quintessence, radiation, DM and baryons, obtained when the dynamical system is evolved from the early universe ($Z_i=10^4$) to present using three different mass scales of the quintessence.} \end{figure} Contrary to the three previous sections, where the initial values were theoretical and motivated by the fixed points on the phase space, it also makes sense to consider more realistic initial conditions for our universe, similar to $\Lambda$CDM background at redshift $Z_i = 10^4$. \\ From the above definition \eqref{E36}, one evaluates the initial values of the dynamical variables as well at redshift $Z_{i}$ for an early universe according to the relations, \begin{eqnarray} \label{E68} x_{i}=0 ,\hspace{0.5cm} y_{i}=\sqrt{\frac{\Omega _{\Lambda o}}{h^2_{i}}},\hspace{0.5cm} z_{i}&=&\sqrt{\frac{\Omega _{\rm{cdm}0}(1+Z_{i})^3}{h^2_{i}}},\hspace{0.5cm} \sigma_{i} = \dfrac{D H^2_{0}}{\kappa^2 C}h^2_{i}, \hspace{0.5cm} h_{i}=h(Z_i), \end{eqnarray} where $h^2(Z) \equiv H^2/H_{0}^2$, is the reduced Hubble function and $H_{0}$ is Hubble's constant.The density parameters $\Omega _{\rm{cdm}0}$ and $ \Omega _{\Lambda 0}$ correspond to DM and DE evaluated today. The parameters are set to $\alpha = 0.05$ and $ \beta = 1.5$, which are chosen similar to the two previous sections and the value of $x_{i}$ is set to zero, as suggested by \cite{Barros2018}. Additionally from equation \eqref{E34}, it can be noticed that $D(\phi_{i}) \propto M^{-4}$, thus the mass scale of the coupled quintessence becomes relevant in specifying the initial value for $\sigma_{i}$ in \eqref{E68}. In the literature \citep{Carsten2013,vandeBruck2015c}, it has been constrained that the mass scale $M$ is at least larger than $M_{1} \geq 15\; \rm{meV}$. In addition to this masses $M_{1}$, we consider two hypothetical mass scales ($M_{2} = 50 \; \rm{meV},\; \rm{and}\;$ $M_{3} = 350 \; \rm{meV}$) to test how large $M$ must be in order to render the disformal contribution negligible. We hence investigate how the different mass scales $M_{1},\; M_{2}$ and $M_{3}$ influence the dynamical system \eqref{E49}-\eqref{EQ1}. Figure \ref{fig:energies} shows the expansion history of this coupled quintessence model in terms of cosmological redshift and how the energy densities of the quintessence, radiation, DM and baryons evolves from $Z_i = 10^4$ to the present. The following remarks were noted based on the results from figure \ref{fig:energies}: \begin{enumerate} \item The features of $\Lambda$CDM are reproduced as expected such as the radiation-matter transition and the DM-DE transition. \item The effect of different mass scales clearly affects the evolution of the energy density for quintessence $\rho_{\phi}$ as seen in figure \ref{fig:energies} and its density parameter $\Omega_{\phi} = x^2 + y^2$. However, from definition \eqref{E36}, the dynamical variables $x$ and $y$ do not depend on the mass. Rather, this effect only happens because of $\sigma$, which measures the strength of the disformal coupling, and depends on the mass $M$, given the definition of $D(\phi)$ in \eqref{E34}. This effect shows the deviation from the conformal framework ($\sigma =0 $), which is more apparent and important at early times. \item The energy density of the quintessence traces that of a cosmological constant, when low mass scale is utilised. A larger mass scale causes deviation from the conformal framework. \end{enumerate} Now that we understand that the disformal framework plays a more important role at early times, it becomes relevant to investigate how the disformal nature of the dynamical system \eqref{E49}-\eqref{EQ1} evolves from the early times to present. As mentioned in Section VII.1., in a purely conformal framework, the interaction term $Q$ does reduce to $Q = \alpha \rho\nabla^{b}\phi$ \cite{Amendola1999}, which is function of $\alpha$ only. In essence, the general form of $Q(\phi)$ defined in \eqref{E32} which is a function of $\alpha$ and $\beta$, behold both the disformal and conformal character of the dynamical system. It makes sense to define an effective conformal coupling \cite{Teixeira2019}: \begin{equation} \alpha_{\text{eff}} = -\dfrac{Q}{\kappa \rho}\;, \end{equation} Where $Q(\phi)$ is initially defined as in equation \eqref{E40} but reduces to equation \eqref{EQ1} in this scenario and $\rho$ is related to dynamical variable $z$, as in \eqref{E36}. In other words, if $\alpha$ characterises only the rescaling of the metric via the conformal transformation \eqref{E1}, and $\beta$ characterises only the deviation from pure conformal framework, i.e., distortion of angles of the metric by the disformal transformation \eqref{E2}, $\alpha_{\text{eff}}$ provides an interplay of both these characteristics. Figure \ref{fig:alphaeff} shows the evolution of the $\alpha_{\text{eff}}$ with redshift $Z$ for the three different mass scales $M_{1}, M_{2}$ and $M_{3}$. From the results of figure \ref{fig:alphaeff}, the following interpretation was noted: \begin{enumerate} \item When the $\alpha_{\text{eff}}$ is close to zero, the disformal coupling is cancelling the conformal coupling as shown in \cite{vandeBruck2015}. \item There exists a turn over point, which indicates the redshift at which the contribution from the disformal coupling is of the same magnitude as the conformal coupling. \item After the turn over point, the decay of the disformal coupling continues until it becomes insignificant and the $\alpha_{\text{eff}}$ becomes the chosen value of the conformal coupling constant $\alpha = 0.05$. The framework can be approximated as nearly conformal and the dynamical system \eqref{E49}-\eqref{EQ1} reduces to a system described by \eqref{E47} and \eqref{E48} at late times. \item The $\alpha_{\text{eff}}$ is sensitive to the mass scale, which alters the redshift of the turnover point at which the disformal coupling becomes insignificant. A heavier (lower) mass scale would cause turnover to occur at a much higher (lower) redshift. \end{enumerate} \begin{figure}[h!] \centering \includegraphics[scale=0.375]{zAlphaEff2.png} \caption{\label{fig:alphaeff}The evolution of the effective conformal coupling ($\alpha_{\text{eff}}$) from initial redshift $Z_i = 10^4$ to present was carried out for three mass scales $M_{1}, M_{2}$ and $M_{3}$. The turn over point, i.e. when the bump occurs, indicates the redshift when the contribution of the disformal coupling is of the same magnitude as the conformal coupling. After the turn over point, the effective conformal coupling $\alpha_{\text{eff}} \to \alpha$, because the disformal coupling becomes insignificant.} \end{figure} The dynamical variable $\sigma$, which represents the strength of the disformal coupling, starts with large value initially but then decays at constant logarithmic rate throughout the whole expansion history as seen in Figure \ref{fig:sigma}. From definition \eqref{E34} and taking the logarithm of $\sigma$ in \eqref{E36}, one can find that the mass scale does not affect the rate of decay but only the time when $\sigma$ becomes ${\cal O}(1)$. \begin{figure}[h!] \includegraphics[scale=0.39]{SigmaDecay.png} \caption{\label{fig:sigma}The decay of the dynamical variable $\sigma$, which represent the strength of the disformal coupling, is shown to occur at approximately a constant logarithmic rate throughout the whole expansion history for the three mass scales.} \end{figure} In short, after making the cosmological analysis for coupled quintessence mimicking $\Lambda$CDM, we find that different mass scales clearly do affect the evolution of the energy density for quintessence $\rho_{\phi}$ in a similar way to what was found in previous studies with an exponential potential \citep{vandeBruck2015,Teixeira2019}. More specifically, the presence of a disformal coupling has the effect of screening the interaction between matter and the scalar field at high redshifts. The time of crossover to the dominant conformal coupling might be revealed when studying the evolution of density perturbations \citep{vandeBruck2015}. \newpage \section{Conclusion} In this article, we investigated the cosmological dynamics of coupled quintessence (where the quintessence $\phi$ interacts with a generic fluid $\rho_c$) in a disformal framework. The novelty of this work is that it extends the idea of coupled quintessence, mimicking the cosmological constant $\rho_{\Lambda}$ and an uncoupled fluid $\rho_u$ \cite{Barros2018}, to include a disformal coupling, and (ii) to bring these conformal and disformal couplings with $\Lambda$CDM background to a dynamical system analysis for the first time in the literature. This brings the convenience of not having to specify the scalar field potential. The choice for EOS parameters in the disformal frame for the coupled fluid and uncoupled fluid i.e. $\tilde{w}$ and $\tilde{w}_u$ respectively give rise to different scenarios. There are three studied scenarios, which are (a) Scenarios I ($\tilde{w} =0$ and $\tilde{w}_u =0$) consists of a pressureless fluid (e.g DM) is coupled to quintessence and both fluids are mimicking a $\Lambda \rm{CDM}$ background with a cosmological constant $\Lambda$ and CDM, (b) Scenarios II ($\tilde{w} =1/3$ and $\tilde{w}_u =0$) consists of a relativistic fluid is coupled to quintessence and both fluids are mimicking a $\Lambda \rm{CDM}$ background with a cosmological constant $\Lambda$ and CDM, (c) Scenarios III ($\tilde{w} =1/3$ and $\tilde{w}_u =1/3$) consists of a relativistic fluid coupled to quintessence and both fluids are mimicking a background with a cosmological constant $\Lambda$ and an uncoupled relativistic fluid. Section VI entails the analysis of the conformal couplings in the three studied scenarios, which includes the conformal equations, the fixed points, and 2D phase portrait. Section VII entails the analysis of the disformal couplings in the three studied scenarios, which includes the disformal equations, the additional disformal fixed points, the topological features and the investigation of the trajectories on a 3D phase portrait. \newpage The differential equations \eqref{E38}-\eqref{E42} which govern the behaviour for the dynamical system bring novel phenomenology in each scenario regarding particular solutions (fixed points) and dynamics connecting such solutions. The nature of the fixed points were studied and their conditions for them to be either stable, unstable and saddle were given. It is worth briefly mentioning a few comparisons for which we find the following differences. In the scenarios I , II, and III, there are nine, seven and seven fixed points respectively. The conformal framework for scenario II and scenario III, does not depend on the parameters $\alpha$ and $\beta$. The unstable point $(D_{+})_{\textbf{II}}$ is radiation-dominated point which appears only in the scenario III. The repeller point $(T_{+})_{\textbf{II}}$ does not appear in the scenario II. There exists a separating topological feature, namely $z\sigma$ plane, in scenario II and III but is absent in scenario I. The physical fixed points in scenario I are $A_0, (C_{\pm})_{\textbf{I}}, (S_{+})_{\textbf{I}} , (T_{+})_{\textbf{I}} $, and in scenario II are $A_0, (C_{\pm})_{\textbf{II}},(S_{+})_{\textbf{II}} $ and lastly in scenario III are $A_0, (D_{+})_{\textbf{III}}, (S_{+})_{\textbf{III}} , (T_{+})_{\textbf{III}} $. In all scenarios, we commonly find the invariant sub-manifold $xz$ plane, the attractor $A_0$, $S_{\pm}$, and the equilibrium line $L_{\rm{E}}$ i.e $(x=0,z=0, \forall\; \sigma)$, as well as the shaded region in which \eqref{E46} is not satisfied. A rich phenomenology of the dynamical system can be understood when comparing between scenarios. Further analysis focused more on the trajectories for fixed initial conditions and various parameters ($\alpha$ and $\beta$). For each scenario, we recover the conformal behaviour on the plane of $\Sigma = 0$ as expected (Compare top panel of Figure \ref{fig:stream-sc1} with Figure \ref{fig:ic-sc1}, and similarly bottom left panel of Figure \ref{fig:stream-sc1} with Figure \ref{fig:ic-sc2}, and lastly bottom right panel of Figure \ref{fig:stream-sc1} with Figure \ref{fig:ic-sc6}). The dynamical variable $\Sigma$ gives an additional degree of freedom for the dynamical system to evolve. For instance in all scenarios, there is an equilibrium line of fixed points, namely $L_{\rm{E}}$. Particularly, in scenario II, there is an entire plane of repeller fixed points to consider. For each scenario, all trajectories end on the equilibrium line $L_{\rm{E}}$, which connects the attractor $A_0$ and $S_{+}$. The dynamical system flows from one fixed point to another within this closed compactified space. The dynamical system is sensitive to the chosen initial conditions. i.e. different initial conditions around the proximity of the fixed points can lead to different endpoints. For instance in scenario I, when the IC is chosen near $(C_{+})_{\textbf{I}}$, the dynamical system can end up at either $A_{0}$ or on the equilibrium line near$(S_{+})_{\textbf{I}}$. Similarly, IC is chosen near $(T_{+})_{\textbf{I}}$, the endpoints could be either at $A_{0}$ or $(S_{+})_{\textbf{I}}$ or on the equilibrium line $L_{\rm{E}}$. The analysis of the trajectories was also done for fixed initial conditions but different parameters ($\alpha$ and $\beta$). One remark from scenario I is that the parameters ($\alpha,\beta$) determines how much the dynamical system \eqref{E49}, \eqref{E50} and \eqref{E51} gets influenced by either the conformal fixed points $(C_{\pm})_{\textbf{I}}$ or the disformal fixed point $(S_{+})_{\textbf{I}}$, as it evolves on its trajectory within the phase space. Another remark from scenario II and III, that $\alpha$ does not affect the trajectories on the dynamical system. Furthermore in scenario II and III, the value of $\beta$ determines, where trajectory ends on the equilibrium line $L_{\rm{E}}$. The two analysis of the trajectories allowed us to better understand how the choice of IC and parameters affect the dynamical system. A more realistic cosmological analysis of the coupled quintessence was then carried out where the quintessence is coupled to DM throughout the cosmological evolution. Therefore this expansion history corresponds to the cosmological model in disformal scenario I, whose dynamical system is described by \eqref{E49}-\eqref{EQ1}. The features of $\Lambda$CDM are reproduced as expected such as the radiation-matter transition and the DM-DE transition. By construction, our dynamical system is exactly the same as $\Lambda$CDM at late-time cosmologies. The effect of different mass scales clearly affects the evolution of the energy density for quintessence $\rho_{\phi}$ as seen in figure \ref{fig:energies} and its density parameter $\Omega_{\phi}$. This effect shows the deviation from the conformal framework ($\sigma =0 $), which is more important at early times. The energy density of the quintessence is effectively mimicking a cosmological constant, when low mass scale is utilised. A larger mass scale will cause greater deviation from the conformal framework. The effect of the mass scale of the quintessence influences the disformal characteristics of the dynamical system, which is quantified by the effective conformal coupling (see Figure \ref{fig:alphaeff}). This behaviour is similar to what was found in \cite{Teixeira2019}. There exists a turn over point, which indicates the redshift at which the contribution from the disformal coupling is of the same magnitude as the conformal coupling. After the turn over point, the decay of the disformal coupling continues until it becomes insignificant and the $\alpha_{\text{eff}}$ becomes the chosen value of the conformal coupling constant. The $\alpha_{\text{eff}}$ is sensitive to the mass scale, which alters the redshift of the turnover point at which the disformal coupling becomes insignificant. A heavier (lower) mass scale would cause turnover point at much higher (lower) redshift. It would be interesting to further explore this model by studying the evolution of linear density perturbations and test them against Redshift Space Distortion data. It is also important to study the spherical collapse of over-densities when going to the non-linear evolution. \acknowledgments AdlCD and AD acknowledge financial support from NRF Grants No.120390, Reference: BSFP190-416431035, and No.120396, Reference: CSRP190405427545, and No 101775, Reference: SFH1507-27131568. AdlCD also acknowledges financial support from Project No. FPA2014-53375-C2-1-P from the Spanish Ministry of Economy and Science, MICINN Project No. PID2019-108655GB-I00, Project No. FIS2016-78859-P from the European Regional Development Fund and Spanish Research Agency (AEI), and support from Projects Nos. CA15117 and CA16104 from COST Action EU Framework Programme Horizon 2020. AdlCD \& PD thanks the hospitality of the Institute of Theoretical Astrophysics - University of Oslo (Norway) during the later steps of the manuscript. AdlCD and NN also acknowledge funding from the University of Cape Town Visiting Scholars Fund 2018. This research was supported by Funda\c{c}\~ao para a Ci\^encia e a Tecnologia (FCT) through the research grants: UID/FIS/04434/2019, PTDC/FIS-OUT/29048/2017 (DarkRipple), COMPETE2020: POCI-01-0145-FEDER-028987 \& FCT: PTDC/FIS-AST/28987/2017 (CosmoESPRESSO), CERN/FIS-PAR/0037/2019 (MGiCAP) and IF/00852/2015 (Dark Couplings).
\section{Introduction and statement of main results}\label{S:intro} We denote by ${\mathbb D}$ the open unit disk, and by $\hol({\mathbb D})$ the Fr\'echet space of holomorphic functions on ${\mathbb D}$, equipped with the topology of uniform convergence on compact sets. A \emph{Hilbert holomorphic function space on ${\mathbb D}$} is a Hilbert space $H$ that is a subset of $\hol({\mathbb D})$, such that the inclusion map $H\hookrightarrow\hol({\mathbb D})$ is continuous. There are many examples of such spaces, including the Hardy space \cite{CR00,Ni19}, the Dirichlet space \cite{EKMR14}, the Bergman space \cite{HKZ00}, the local Dirichlet spaces \cite{RS91}, as well as the de Branges--Rovnyak spaces \cite{Sa94}. Most of these spaces contain the polynomials as a dense subspace. Our main result is the following surprising theorem. As usual, we say that a function $f$ is \emph{odd} if $f(-z)=-f(z)$. \begin{theorem}\label{T:horrible} There exists a Hilbert holomorphic function space $H$ on ${\mathbb D}$ such that: \begin{itemize} \item $H$ contains the polynomials, \item the polynomials are dense in $H$, \item the odd polynomials are \emph{not} dense in the odd functions in $H$. \end{itemize} Moreover, given any positive sequence $(\omega_n)_{n\ge0}$ such that $\sum_n 1/\omega_{n}<\infty$, the space $H$ can be chosen so that $\|z^n\|_H\le 1+\omega_n$ for all $n\ge0$. \end{theorem} We shall prove this result in \S\ref{S:proof}, and explore some variants in \S\ref{S:variations}. For example can we replace the odd functions by the even functions? Can we apply these ideas to other Hilbert spaces, for instance spaces arising in Fourier analysis? In the rest of this section, we explore the implications of Theorem~\ref{T:horrible}. In most spaces, density of polynomials is proved by a direct construction. For example, in the Hardy space $H^2$, every function $f$ can be approximated by the partial sums $s_n(f)$ of its Taylor expansion. Clearly the $s_n(f)$ are polynomials, and, from the very definition of the $H^2$-norm, we have that $\|s_n(f)-f\|_{H^2}\to0$ as $n\to\infty$. A similar argument works in the classical Bergman and Dirichlet spaces. However, there are spaces $H$ where this simple procedure breaks down, even though the polynomials are dense. One such space is $H={\mathcal D}_\zeta$, the local Dirichlet space at a point~$\zeta$ in the unit circle. As in the well-known case of the disk algebra, there exists a function $f\in{\mathcal D}_\zeta$ for which $\sup_n\|s_n(f)\|_{{\mathcal D}_\zeta}=\infty$, so in particular $s_n(f)$ does not converge to $f$ in norm. Just as for the disk algebra, however, the Ces\`aro means \[ \sigma_n(f):=\frac{s_0(f)+s_1(f)+\cdots+s_n(f)}{n+1} \] do always converge to $f$ in norm. For details, we refer to \cite{MR19b}. Even worse is the case when $H={\mathcal H}(b)$, a de Branges--Rovnyak space. Then it can happen that, even though polynomials are dense, neither the Taylor partial sums $s_n(f)$, nor their Ces\`aro means $\sigma_n(f)$ converge to $f$. Worse still, the radial dilates $f_r(z):=f(rz)$ may tend to infinity in norm as $r\to1^-$, even though they clearly converge pointwise to $f$. For details, we refer to \cite{EFKMR16}. There is however a general approximation procedure that works in any Hilbert holomorphic function space $H$ in which the polynomials are dense. Using the Gram--Schmidt process, we can find an orthonormal basis $(p_n)$ of $H$ consisting of polynomials. If we define $T_n:H\to H$ by \[ T_n(f):=\sum_{k=1}^n \langle f,p_k\rangle p_k, \] then $(T_n)$ is a \emph{linear polynomial approximation scheme} for $H$, namely a sequence of bounded linear self-maps of $H$ with the property that, for every $f\in H$, the sequence $(T_n(f))$ consists of polynomials converging to $f$ in the norm of $H$. It was shown in \cite{MR19a} that, more generally, every Banach holomorphic function space $X$ on ${\mathbb D}$ admits a linear polynomial approximation scheme $(T_n)$, provided that merely polynomials are dense and that $X$ has the bounded approximation property. It was further shown that $T_n$ can always be chosen so that $\deg T_n(f)\le n$ for all $n$. In view of this, it seems reasonable to ask if $T_n$ can be chosen to have the form \begin{equation}\label{E:triangular} T_n(f)=\sum_{k=0}^n c_{nk}s_k(f) \end{equation} for some triangular array of complex numbers $(c_{nk})_{0\le k\le n<\infty}$. The following result answers this question in the negative, even in the special case of a Hilbert holomorphic function space. \begin{corollary}\label{C:summability} Let $H$ be as in Theorem~\ref{T:horrible}. Then, despite the fact that polynomials are dense in $H$, there exists $f\in H$ lying outside the closed linear span of $\{s_n(f):n\ge0\}$. Hence there is no sequence of linear maps $T_n :H\to H$ of the form \eqref{E:triangular} such that $\|T_n(f)-f\|_H\to0$. \end{corollary} \begin{proof} Let $f\in H$ be an odd function not approximable by odd polynomials. Since the partial sums $s_n(f)$ of its Taylor series are odd polynomials, their closed linear span does not contain $f$. Evidently this precludes the possibility of approximating $f$ by polynomials of the form \eqref{E:triangular}. \end{proof} The formula \eqref{E:triangular} describes a so-called triangular summability method. The conclusion of Corollary~\ref{C:summability} is that no such method applied to the Taylor partial sums $s_n(f)$ will converge to $f$ in $H$. For background on summability methods, we refer to \cite{Ha92}. Exactly the same analysis applies to approximation of $f$ by functions of the form \begin{equation}\label{E:infinite} T_n(f):=\sum_{k=0}^\infty c_{nk}s_k(f), \end{equation} \emph{provided} that these series converge in $H$. This is where the last part of Theorem~\ref{T:horrible} comes in. We have the following result. \begin{corollary}\label{C:infinite} Let $H$ and $(\omega_n)$ be as in Theorem~\ref{T:horrible}. Suppose, in addition, that the sequence $(\omega_n)$ is chosen so that $\lim_{n\to\infty}\omega_n^{1/n}= 1$. Then, despite the fact that polynomials are dense in $H$, there exists $f\in H$ such that: \begin{itemize} \item $\sum_{k=0}^\infty c_{k}s_k(f)$ converges in $H$ whenever $\limsup_{k\to\infty}|c_k|^{1/k}<1$, \item $f$ lies outside the closed linear span of the set of all such series. \end{itemize} \end{corollary} \begin{proof} Let $f$ be chosen as in Corollary~\ref{C:summability}. Since \[ \limsup_{n\to\infty}\|z^n\|_H^{1/n}\le\limsup_{n\to\infty}(1+\omega_n)^{1/n}\le1, \] elementary estimates give that $\|s_k(f)\|=O(R^k)$ for each $R>1$, and consequently $\sum_{k\ge0}|c_k|\|s_k(f)\|_H<\infty$ whenever $\limsup_{k\to\infty}|c_k|^{1/k}<1$. This establishes the first point, and the second one follows immediately from the choice of $f$ and the fact every sum $\sum_{k=0}^\infty c_{k}s_k(f)$ belongs to the closed linear span of $\{s_k(f):k\ge0\}$. \end{proof} An important special case of the above is the so-called Abel summation method, where one takes $c_k:=(1-r)r^k$ for $r<1$. Clearly we have $\lim_{k\to\infty}|c_k|^{1/k}=r<1$, so Corollary~\ref{C:infinite} applies. A simple calculation gives that \[ \sum_{k\ge0}(1-r)r^ks_k(f)=f_r, \] where $f_r(z):=f(rz)$, a radial dilate of $f$. We thus obtain the following corollary. \begin{corollary}\label{C:dilates} Let $H$ and $(\omega_n)$ be as in Theorem~\ref{T:horrible}, and suppose that the sequence $(\omega_n)$ is chosen so that $\lim_{n\to\infty}\omega_n^{1/n}= 1$. Then, despite the fact that polynomials are dense in $H$, there exists $f\in H$ lying outside the closed linear span of its set of radial dilates $\{f_r:0<r<1\}$. \end{corollary} \section{Proof of Theorem~\ref{T:horrible}}\label{S:proof} The proof of Theorem~\ref{T:horrible} is an adaptation of a construction outlined in \cite[Proposition~1.34]{HMVZ08}, where it is attributed to W.~B.~Johnson. We begin with the following lemma. \begin{lemma}\label{L:Mbasis} Let $(e_n)_{n\ge0}$ be the standard unit vector basis of $\ell^2=\ell^2({\mathbb Z}^+)$. Let $(a_n)_{n\ge0}$ and $(b_n)_{n\ge1}$ be two sequences of complex numbers. For $n\ge0$, define \begin{align*} &\begin{cases} x_{2n}:=e_{2n},\\ x_{2n+1}:=e_{2n+1}-a_ne_{2n}+b_ne_{2n-2}, \end{cases}\\ &\begin{cases} y_{2n}:=e_{2n}+a_ne_{2n+1}-b_{n+1}e_{2n+3},\\ y_{2n+1}:=e_{2n+1}, \end{cases} \end{align*} where, for convenience, we write $e_{-2}:=0$. Then $(x_n,y_n)_{n\ge0}$ is a M-basis for $\ell^2$, i.e., \begin{itemize} \item it is a biorthogonal system: $\langle x_n,y_m\rangle=\delta_{nm}$ for all $n,m\ge0$, \item each of the sequences $(x_n)_{n\ge0}$ and $(y_n)_{n\ge0}$ spans a dense subspace of $\ell^2$. \end{itemize} \end{lemma} \begin{proof} First we prove biorthogonality. We need to check four cases: \begin{align*} \langle x_{2n},y_{2m}\rangle&=\delta_{nm}, &\langle x_{2n+1},y_{2m+1}\rangle&=\delta_{nm},\\ \langle x_{2n},y_{2m+1}\rangle&=0, &\langle x_{2n+1},y_{2m}\rangle&=0. \end{align*} The first three are obviously true. For the fourth one, we calculate: \begin{align*} \langle x_{2n+1},y_{2m}\rangle &=\bigl\langle e_{2n+1}-a_ne_{2n}+b_ne_{2n-2},\, e_{2m}+a_me_{2m+1}-b_{m+1}e_{2m+3}\bigr\rangle\\ &=a_m\delta_{2n+1,2m+1}-a_n\delta_{2n,2m}-b_{m+1}\delta_{2n+1,2m+3}+b_n\delta_{2n-2,2m}\\ &=0. \end{align*} To show that $(x_n)_{n\ge0}$ spans a dense subspace of $\ell^2$, observe that, for each $n\ge0$, we have $e_{2n}=x_{2n}$ and $e_{2n+1}\in \spn\{x_{2n+1}, e_{2n},e_{2n-2}\}=\spn\{x_{2n+1},x_{2n},x_{2n-2}\}$ (where $x_{-2}:=0$). Therefore the span of $(x_n)_{n\ge0}$ contains the span of $(e_n)_{n\ge0}$, so it is indeed dense in $\ell^2$. Likewise, for each $n\ge0$, we have $e_{2n+1}=y_{2n+1}$ and $e_{2n}\in\spn\{y_{2n},e_{2n+1},e_{2n+3}\}=\spn\{y_{2n},y_{2n+1},y_{2n+3}\}$, so $(y_n)_{n\ge0}$ spans also a dense subspace of $\ell^2$. \end{proof} \begin{proof}[Proof of Theorem~\ref{T:horrible}] Let $(\eta_n)_{n\ge0}$ be a sequence such that $\eta_n>0$ and $\sum_n\eta_n^2<\infty$, to be chosen later. Set $a_n:=1/\eta_n^2~(n\ge0)$ and $b_n:=1/\eta_n\eta_{n-1}~(n\ge1)$, and let $(x_n,y_n)_{n\ge0}$ be the M-basis for $\ell^2$ constructed in Lemma~\ref{L:Mbasis}. For $x\in \ell^2$, define \[ J(x)(z):=\sum_{n\ge0}\frac{\langle x,y_n\rangle}{\|y_n\|} z^n \quad(z\in{\mathbb D}). \] Since \[ \sum_{n\ge0}\Bigl|\frac{\langle x,y_n\rangle}{\|y_n\|} z^n\Bigr| \le \|x\|\sum_{n\ge0}|z|^n =\frac{\|x\|}{1-|z|} \quad(z\in{\mathbb D}), \] we see that $J(x)\in\hol({\mathbb D})$ for each $x\in\ell^2$, and $J:\ell^2\to\hol({\mathbb D})$ is a continuous linear map. Moreover, since the sequence $(y_n)$ spans a dense subspace of $\ell^2$, it follows that $J$ is injective. Define $H:=J(\ell^2)$, with the inner product $\langle\cdot,\cdot\rangle_H$ inherited from $\ell^2$. Then the inclusion $H\hookrightarrow\hol({\mathbb D})$ is continuous, in other words, $H$ is a Hilbert holomorphic function space on ${\mathbb D}$. Furthermore, since the sequence $(x_n)$ spans a dense subspace of $\ell^2$ and $J(\|y_n\|x_n)=z^n$ for each $n$, it follows that $H$ contains the polynomials and that polynomials are dense in $H$. We now show that the odd polynomials are not dense in the odd functions of $H$. To do this, it suffices to construct $f,g\in H$ such that $f$ is odd, $\langle z^{2n+1},g\rangle_H=0$ for all $n\ge0$, yet $\langle f,g\rangle_H\ne0$. We do this as follows. Define $u,v\in\ell^2$ by \[ u:=\sum_{j\ge0} \eta_j e_{2j+1} \quad\text{and}\quad v:=\frac{1}{\eta_0}e_1+\sum_{k\ge0} \eta_k e_{2k}, \] and set $f:=J(u)$ and $g:=J(v)$. For each $n\ge0$, the coefficient $\widehat{f}(2n)$ of $z^{2n}$ in the Taylor expansion of $f$ satisfies \begin{align*} \|y_{2n}\|\widehat{f}(2n) &=\langle u,y_{2n}\rangle\\ &=\sum_{j\ge0}\eta_j\langle e_{2j+1},y_{2n}\rangle\\ &=\sum_{j\ge0} \eta_j \langle e_{2j+1},~e_{2n}+a_ne_{2n+1}-b_{n+1}e_{2n+3}\rangle\\ &=\eta_n a_n-\eta_{n+1}b_{n+1}=0. \end{align*} Thus $\widehat{f}(2n)=0$ for all $n$, and $f$ is an odd function. Also, for each $n\ge0$, we have \begin{align*} \|y_{2n+1}\|^{-1}\langle z^{2n+1}, g\rangle_H &=\langle x_{2n+1},v\rangle\\ &=\langle x_{2n+1},e_1/\eta_0\rangle +\sum_{k\ge0}\eta_k\langle x_{2n+1}, e_{2k}\rangle\\ &=\langle e_{2n+1}-a_ne_{2n}+b_ne_{2n-2}, ~e_1/\eta_0\rangle\\ &\quad+ \sum_{k\ge0}\eta_k \langle e_{2n+1}-a_ne_{2n}+b_ne_{2n-2}, ~e_{2k}\rangle\\ &= \begin{cases} -\eta_n a_n+\eta_{n-1}b_n, &n\ge1,\\ 1/\eta_0-\eta_0a_0, &n=0, \end{cases}\\ &=0. \end{align*} Lastly, we have \[ \langle f,g\rangle_H=\langle u,v\rangle =\Bigl\langle \sum_{j\ge0}\eta_je_{2j+1},~(1/\eta_0)e_1+\sum_{k\ge0}\eta_ke_{2k}\Bigr\rangle =\frac{\eta_0}{\eta_0}=1\ne0. \] This completes the proof that odd polynomials are not dense in the odd functions in $H$. Finally, we turn to the question of the estimation of $\|z^n\|_H$. Since $z^n=J(\|y_n\|x_n)$, we have \[ \|z^n\|_H=\Big\|\|y_n\|x_n\Bigr\|=\|x_n\|\|y_n\|. \] Recalling the construction of $x_n$ and $y_n$, we deduce the following estimates: \begin{align*} \|z^{2n}\|_H&\le 1+|a_n|+|b_{n+1}|=1+\frac{1}{\eta_n^2}+\frac{1}{\eta_n\eta_{n+1}} \quad(n\ge0)\\ \|z^{2n+1}\|_H&\le 1+|a_n|+|b_n|=1+\frac{1}{\eta_n^2}+\frac{1}{\eta_n\eta_{n-1}} \quad(n\ge1)\\ \|z\|_H&\le 1+|a_0|=\frac{1}{\eta_0^2}. \end{align*} In order to have $\|z^n\|_H\le 1+ \omega_n$ for all $n$, it therefore suffices that \[ \frac{3}{\eta_n^2}\le \omega_{2n}, \quad \frac{1}{\eta_{n+1}^2}\le \omega_{2n}, \quad \frac{3}{\eta_{n}^2}\le \omega_{2n+1}, \quad \frac{1}{\eta_{n-1}^2}\le \omega_{2n+1}. \] To achieve this, we therefore define $(\eta_n)$ by \[ \eta_n^2:= \frac{3}{\omega_{2n}}+\frac{1}{\omega_{2n-2}}+\frac{3}{\omega_{2n+1}}+\frac{1}{\omega_{2n+3}}, \] with the second term omitted in the case $n=0$. The condition that $\sum_n1/\omega_n<\infty$ then guarantees that $\sum_n\eta_n^2<\infty$, as required. The proof is complete. \end{proof} \section{Variations on a theme}\label{S:variations} Does Theorem~\ref{T:horrible} hold with even functions instead of odd ones? Certainly! In fact, the arithmetic structure of the odd/even numbers plays no real role. As the following result shows, all that matters is that these are infinite subsets of ${\mathbb Z}^+$ with infinite complement. In what follows, we write $\widehat{f}(n)$ for the coefficient of $z^n$ in the Taylor expansion of $f$. Also, $\supp\widehat{f}:=\{n\in{\mathbb Z}^+:\widehat{f}(n)\ne0\}$. \begin{theorem} Let $I$ be any subset of ${\mathbb Z}^+$ such that both $I$ and ${\mathbb Z}^+\setminus I$ are infinite. Then there exists a Hilbert holomorphic function space $H$ on ${\mathbb D}$ in which the polynomials are dense, but the set of polynomials $p$ with $\supp\widehat{p}\subset I$ is not dense in $\{f\in H:\supp \widehat{f}\subset I\}$. \end{theorem} \begin{proof} Let $\sigma$ be a permutation of ${\mathbb Z}^+$ taking the odd integers to $I$ and the even ones to ${\mathbb Z}^+\setminus I$. Then, repeating the construction in \S\ref{S:proof} with $J$ defined by \[ J(x)(z):=\sum_{n\ge0}\frac{\langle x,y_n\rangle}{\|y_n\|} z^{\sigma(n)} \quad(z\in{\mathbb D}), \] we obtain a Hilbert holomorphic function space $H$ with the required properties. \end{proof} \begin{remarks} (i) It is not hard to see that the conditions that $I$ and ${\mathbb Z}^+\setminus I$ be infinite are both necessary for this theorem to hold. (ii) The estimate on monomials now becomes $\|z^{\sigma(n)}\|_H\le 1+\omega_n$. \end{remarks} By varying the definition of $J$, it is possible to embed $H$ in function spaces other than $\hol({\mathbb D})$. There are many possibilities. The following theorem illustrates the general idea in the context of Fourier series. We write ${\mathbb T}$ for the unit circle, $L^2({\mathbb T})$ for the usual space of square-integrable functions on ${\mathbb T}$, and $H^2$ for the Hardy space, now considered as a closed subspace of $L^2({\mathbb T})$. \begin{theorem}\label{T:Fourier} There exists a Hilbert space $H$ continuously embedded in $L^2({\mathbb T})$ such that \begin{itemize} \item $H$ contains the trigonometric polynomials; \item the trigonometric polynomials are dense in $H$; \item the holomorphic polynomials are \emph{not} dense in $H\cap H^2$. \end{itemize} \end{theorem} \begin{proof} Let $\sigma$ be a bijection of ${\mathbb Z}^+$ onto ${\mathbb Z}$ mapping the odd integers onto ${\mathbb Z}^+$ and the even integers onto ${\mathbb Z}\setminus{\mathbb Z}^+$. Then, repeating the construction in \S\ref{S:proof} with $J$ defined by \[ J(x)(e^{it}):=\sum_{n\ge0}\frac{\langle x,y_n\rangle}{\|y_n\|} \frac{e^{i\sigma(n)t}}{2^n} \quad(e^{it}\in{\mathbb T}), \] we obtain a Hilbert space $H$ continuously embedded in $L^2({\mathbb T})$ with the required properties. \end{proof} This theorem has the following consequence. Here $\widehat{f}(k)$ denotes the $k$-th Fourier coefficient of $f$. \begin{corollary} Let $H$ be as in Theorem~\ref{T:Fourier}. Then, despite the fact that trigonometric polynomials are dense in $H$, there exists $f\in H$ lying outside the closed linear span of the functions $s_n(f):=\sum_{k=-n}^n \widehat{f}(k)\exp(ikt)$. \end{corollary} \begin{proof} Let $f$ be a function in $H\cap H^2$ not approximable in $H$ by holomorphic polynomials. Since $f\in H^2$, each of the functions $s_n(f)$ is a holomorphic polynomial, and so their closed linear span does not contain $f$. \end{proof} \bibliographystyle{plain}
\section{Extension to Other Languages} \label{sec:analysis} While our focus was on Chinese-English language projects, we also included one project from each of three additional languages in our experiments as a preliminary proof of concept. These projects were Korean, Japanese, and German -- all combined with English. In all cases, including the German language, we were able to use Unicode to identify its presence in English sentences. While we were able to identify language occurrences in our study (i.e., Chinese, Japanese, Korean, and German) from English using Unicode, we will need to adopt more diverse approaches (e.g., Python's langdetect project), for language detection\cite{faq}. Traceability results for these projects are reported throughout the paper (shown on the right hand side of Table \ref{tab:data_status}, and the graphs of Figures Fig.~\ref{Fig:exp2_gvsm_performance} and Fig.~\ref{fig:exp1_box}). They show that for both Asian languages (Korean and Japanese) our conclusion derived from the Chinese datasets is still valid, while for the European language (German), the CLG model outperformed WEG$_{tr}$. We leave a deeper analysis of this observation to future work. \section{Generalized Vector Space Models} \label{sec:approach} Even though the results from our first experiment showed that integrating an NMT approach as a preprocessing step can improve trace accuracy in IBA datasets, we also identified three translation related pitfalls. To address these problems we propose a novel approach that combines the use of the Generalized Vector Space Model (GVSM) with both cross-lingual and mono-lingual word embeddings. We specifically address the following research questions which are described more extensively in subsequent sections: \begin{itemize}[leftmargin=*] \item {\bf RQ3:} To what extent does cross-lingual word embedding improve GVSM performance for tracing across IBA datasets? \end{itemize} \begin{itemize}[leftmargin=*] \item {\bf RQ4:} Which of the tracing techniques presented in this paper perform best on IBA datasets? \end{itemize} \subsection{Brief Overview of GVSM} GVSM \cite{DBLP:conf/sigir/WongZW85} is a generalization of the traditional VSM, designed specifically for information retrieval tasks. One of the known weaknesses of VSM is that terms only contribute to the similarity score if they appear in both source and target artifacts. GVSM directly addresses this problem by creating an additional layer of latent space, in which the distance between the terms is determined by their semantic similarity. Given a collection of artifacts $a_i \in A_S\cup A_T$, $a_i$ is vectorized using the standard VSM approach such that $a_i=\{w_1,w_2,\dots,w_n\}$ where $w_n$ are the weights for the terms in artifact $a_i$. Considering the vocabulary $V=\{t_1,t_2,\dots,t_N\}$ composed by all the terms in artifacts, the pairwise term-correlation can be represented as a correlation matrix G of $N \times N$ shape, where $sim(t_i,t_j)$ is the semantic relevance for term $t_i$ and $t_j$ \begin{equation} G = \begin{vmatrix} sim(t_1,t_1) & sim(t_1,t_2) & \dots\\ \vdots & \ddots & \\ sim(t_N,t_1) & & sim(t_N,t_N)\\ \end{vmatrix} \end{equation} In GVSM the similarity between two artifacts is then calculated as follow: \begin{equation}\label{GVSM_EQ} Similarity(a_i,a_j) = \frac{a_i^T \cdot G \cdot a_j}{\sqrt{a_i^T\cdot G \cdot a_i}\sqrt{a_j^T\cdot G \cdot a_j}} \end{equation} GVSM has been effectively used for to support bilingual tasks related to document clustering \cite{DBLP:conf/ijcnlp/TangXZLZ11}, query processing\cite{DBLP:journals/is/WongZRW89}, and text retrieval\cite{DBLP:conf/eacl/TsatsaronisP09}. \subsection{Word Embedding (WE)} \label{sec:word_embedding} For text processing purposes, all terms need to be represented in a format that is conducive to machine learning. Many traceability algorithms encode terms as distinct symbols without considering their semantic associations. A common approach is to use `one hot encoding' in which terms are represented as vectors in a high dimensional orthogonal space in which each term is a dimension of the vector space. In contrast, word embeddings transform the word representation from a high dimensional orthogonal space to a low dimensional non-orthogonal space. The distribution of vectors within the space varies depending on the specific approach taken. The use of word embedding has achieved significant success for addressing NLP challenges in domains such as ad-hoc information retrieval\cite{DBLP:conf/ecir/AlmasriBC16}\cite{DBLP:conf/sigir/VulicM15}, bug localization\cite{DBLP:conf/bigdataconf/YeQM15}, question answering\cite{DBLP:conf/acl/DhingraZFMC16} and also trace link recovery\cite{DBLP:conf/apsec/ZhaoCS17}\cite{DBLP:conf/icse/0004CC17}. \subsubsection{Mono-lingual Neural Word Embedding} \label{sec:mono_wv} Word embeddings typically represent terms from a single language, and have the intuitive assumption that terms with similar distribution patterns have closer semantic meaning than those with dissimilar distributions \cite{harris54}. This means that term vectors tend to form clusters according to their semantic affinity. Mono-lingual neural word embeddings (MNWE) leverage the context of each term and include the Skip-Gram model and Continuous Bag Of Words (CBOW) model \cite{DBLP:journals/corr/abs-1301-3781}. While both of these models are built upon simple three-layer neural networks, the Skip-Gram model makes predictions of surrounding terms based on the current terms while the CBOW model predicts a single term using all surrounding terms as context. In our study, we adopt pre-trained mono-lingual word embedding that are trained on Common Crawl dataset with enhanced CBOW model\cite{mikolov2018advances}. Vectors in such a space have 300 dimensions. \subsubsection{Cross-lingual Word Embedding (CLWE)} \label{sec:cl_wv} Cross-lingual word embeddings project the vocabulary from two or more distinct languages into a single vector space. As with mono-lingual embeddings, a reasonable cross-lingual embedding model should be capable of organizing term vectors in an embedding space according to their semantic affinities. Cross-lingual embeddings can therefore serve as a semantic bridge between different languages, and can be used to support diverse cross-lingual NLP tasks such as machine translation, cross-lingual IR, and cross-lingual entity linking. Various techniques have been explored for aligning multiple mono-lingual vector spaces \cite{Ruder2017ASO}. Techniques based on word-level alignment tend to leverage cross-lingual lexicons to supervise the vector mapping. With this approach, mono-lingual word embeddings are first created for both languages, and then the unseen term vectors for both languages are transformed using a trained mapping model. Researchers have explored other approaches for relaxing word-level alignment constraints, for example by leveraging alignment information at the sentence level \cite{DBLP:conf/icml/GouwsBC15} or even the document level \cite{DBLP:conf/eacl/Vulic17}, or entirely foregoing supervision \cite{DBLP:journals/corr/abs-1809-02306}, in order to extend the use of cross-lingual word embedding to additional scenarios.\\ \vspace{-8pt} For our experiments we utilized \emph{relaxed cross-domain similarity local scaling} (RCSLS), which is based on word-level alignment \cite{DBLP:conf/emnlp/JoulinBMJG18}. We selected RCSLS for two reasons. First it has been shown to deliver the best overall performance in comparison to other state-of-the-art techniques across 28 different languages \cite{DBLP:conf/emnlp/JoulinBMJG18}, and second, pre-trained models with support for 44 languages is available from Facebook \cite{joulin2018loss}. Facebook trained their model using Wikipedia documents, and leveraged the MUSE library\cite{conneau2017word} which includes bilingual dictionaries for over 110 languages and mono-lingual word embeddings for 157 languages including English and Chinese. Vectors in cross-lingual embedding space also have a dimension of 300. \subsection{Combining GVSM with Cross-Lingual WE} \label{sec:combine_gvsm_we} Prior work has already investigated the application of GVSM for cross-lingual information retrieval tasks in other domains. For example, Tang et al. \cite{DBLP:conf/ijcnlp/TangXZLZ11} proposed CLGVSM which exploited semantic information from (1) a knowledge base e.g. HowNet (Xia et al., 2011), (2) statistical similarity measures, e.g cosine similarity of term vector covariance (COV), and (3) a bilingual dictionary which contains the translation probability between terms. Another branch of study attempts to leverage Cross-Lingual Word Embedding to address cross-lingual information retrieval tasks. Vulic et al. \cite{DBLP:conf/sigir/VulicM15} proposed a model known as cross-lingual information retrieval (CLIR) which directly leverages the distributed representation of cross-lingual vocabulary to accomplish document embedding (DE). Given documents represented by term vectors $d = \{\Vec{t_1},\Vec{t_2},\dots,\Vec{t_n}\}$ where $\Vec{t_i}$ is the vector representation of terms, a document vector $\Vec{d}$ can be created by merging the term vectors with simple addition. The self-information of the terms \cite{Cover:2006:EIT:1146355}, e.g. frequency of terms within a document, can be combined to weight the vectors. The final representation of a document is given as: \begin{equation} \Vec{d} = w_1 \Vec{t_1} + w_2 \Vec{t_2} + \dots + w_n\Vec{t_n} \end{equation} This method, referred to as ADD-SI, projects the documents into the same vector space of terms so that the document affinities can be evaluated using distance measures such as cosine similarity. However, we could not find any publications describing the combined use of both GVSM and Cross-Lingual Word Embedding. We replaced the cross-lingual knowledge base in CLGVSM with (Cross-Lingual) Word Embedding, because knowledge tended to be domain-specific and costly to construct for individual software project domains. We therefore propose three different techniques for combining GVSM with Word Embeddings. \input{tables/method_table.tex} \subsubsection{Cross-Lingual Word Embedding with GVSM (CLG)} Our first approach uses a modified cross-lingual word embedding based on GVSM. As shown in Equation \ref{GVSM_EQ}, a GVSM model is composed of TF-IDF vectors $a_i$ and a semantic relatedness matrix $G$. The semantic relatedness matrix $G$ can be constructed using external knowledge\cite{DBLP:conf/eacl/TsatsaronisP09, DBLP:conf/ijcnlp/TangXZLZ11} (e.g HowNet, WordNet) to evaluate term relatedness based on their distance in the knowledge network; or using statistical models that predict the probability of term co-occurrence\cite{DBLP:conf/sigir/WongZW85}. In the first approach, the size of the semantic relatedness matrix is constrained by the vocabulary of the knowledge base. This is a critical limitation for trace link recovery, as software artifacts tend to include a large number of technical terms which are not commonly found in general purpose knowledge sources. Statistical approaches therefore fall far short of capturing the true semantics of these terms. However, these weaknesses can be addressed using word embeddings. Given an IBA dataset with primary and foreign language vocabulary $L_p = \{t_{p_1}, t_{p_2}, \dots, t_{p_m}\}$, $L_f = \{t_{f_1}, t_{f_2}, \dots, t_{f_n}\}$, the mono-lingual vector for $t_{p_i}$ and $t_{f_i}$ is represented as $x_i,z_i \in \mathbb{R}^d$ where d refers to the dimension of the vector space. As previously discussed, the RCSLC model is capable of projecting vectors from two separate spaces into a shared latent space by learning an internal translation matrix W with the supervision of bilingual lexicons. With this translation matrix W, the vectors can be projected as $Wx_i \ and \ Wz_i$. The vocabulary vector space of a given IBA dataset is then represented as: \begin{equation} \label{eq:vocab_vec} V_S= \{Wx_1,\dots, Wx_m,Wz_1,\dots,Wz_n\} \end{equation} As the vectors in RCSLC are $l-$2 normalized\cite{DBLP:conf/emnlp/JoulinBMJG18}, the semantic relevance matrix $G$ can be created through the simple dot product of $V_S$ and $V_S^T$. The GVSM formula shown as equation \ref{GVSM_EQ} can be transformed into the following: \begin{equation} \label{eq:gvsm_sim} Similarity(a_i,a_j) = \frac{a_i^T \cdot V_S \cdot V_S^T \cdot a_j}{\sqrt{a_i^T \cdot a_i}\sqrt{a_j^T\cdot a_j}} \end{equation} In our case, $V_S$ is the pre-built vector space provided by FastText library as described in Sec. \ref{sec:word_embedding} \begin{figure*}[t!] \centering\includegraphics[width=\linewidth]{figures/exp2/exp2_gvsm_barplot.png} \vspace{-16pt} \caption{Average performance of three primary GVSM models for all 17 IBA datasets} \label{Fig:exp2_gvsm_performance} \end{figure*} \begin{figure}[tbh!] \centering\includegraphics[width=\linewidth]{figures/exp2/exp2_gvsm_boxplot.png} \caption{A comparison of the best basic model (VSM$_{tr}$) against all three GVSM-based models. WEG and WEG$_{tr}$ with full size English embedding are represented as WEG$^{*}$ and WEG$^{*}_{tr}$} \vspace{-12pt} \label{Fig:exp2_gvsm_performance_detail} \end{figure} \subsubsection{Transforming CLG to a Mono-lingual Tracing Task} For experimental purposes we also explored a mono-lingual version of CLG. The intrinsic difference between mono-lingual and bilingual trace tasks lies in the dataset vocabulary. As shown in Equation \ref{eq:vocab_vec}, the vocabulary vector space $V_s$ of IBA dataset is composed from two types of vectors 1) term vectors projected from the foreign language space and 2) term vectors projected from English space. For mono-lingual tracing tasks, the vocabulary vector space $V_{S^{'}}$ contains term vectors of only one language; however, by simply substituting the $V_s$ with $V_{S^{'}}$ in Equation \ref{eq:gvsm_sim} we can migrate CLG to address mono-lingual tracing tasks. This can be accomplished by training and applying a word embedding model with mono-lingual text corpus. We name this mono-lingual model the `Word Embedding GVSM' (WEG) to distinguish it from CLG. \subsubsection{NMT preprocessing with Mono-lingual Trace Task} As we described above, WEG is the mono-lingual version of CLG in which cross-lingual word embedding is replaced with an English mono-lingual embedding. We also propose a third approach which combines WEG with NMT to extend its ability to trace IBAs. We followed the same approach used in our initial experiments with VSM$_{tr}$, LDA$_{tr}$ and LSI$_{tr}$, by using Google Translation services to translate the IBA datasets back into English mono-lingual datasets before running WEG. We refer to this method as \emph{WEG$_{tr}$} to distinguish it from the other two GVSM models. \section{Multilingual Artifacts in Practice} \label{sec:IBAPractice} To lay a foundation for our work, we first investigate how terms from two different languages are intermingled across issues and commits in projects where both English and Chinese are used. Our first research question is therefore defined as follows: \begin{itemize}[leftmargin=*] \item {\bf RQ1:} How are Chinese and English terms intermingled across different artifacts? \end{itemize} \subsection{Approach} First, we applied stratified random selection to collect 5 issues and 5 commits from each of the first 10 projects listed in Table.~\ref{tab:project_summary}, producing an overall dataset of 50 issues and 50 commits. To analyze the Chinese and English usage patterns we adopted an inductive open coding technique\cite{khandkar2009open}. For each artifact, we first determined whether it was primarily written in Chinese or English (i.e., its dominant language). We then identified all phrases not written in the dominant language, and manually evaluated the role of those phrases within the artifact. Based on these observations, we created distinctive tags to categorize the discovered roles and used these tags to mark up each issue and commit artifact. We report results in Table \ref{tab:tags}. \subsection{Observations} Observing the combinations and occurrence of these tags, enables us to infer how Chinese and English languages were intermingled in the analyzed artifacts. In the following discussion we use the tags reported in \citetable{tab:tags} annotated with subscripts for Chinese (C) and English (E). \begin{itemize}[leftmargin=1.5em] \item 87\% of our analyzed issues were tagged with ID$_C$ or IA$_C$, meaning that in our datasets, the majority of issues were primarily described and answered in Chinese. \item While 28\% of issues were tagged with ID$_E$ or IA$_E$, we did not observe any cases in which they also included Chinese words. \item In contrast, ID$_C$ and IA$_C$ were combined with most types of English tags listed in Table.~\ref{tab:tags}. Chinese sentences were frequently intermingled with English terms. \item 86\% of the commits are tagged as CM$_E$, meaning that commit message were likely to be written in English and 14\% in Chinese \item 68\% of commits were tagged with CC$_C$ and 38\% with CD$_C$ because Chinese frequently appeared in code comments and source code especially where database query and UI elements were discussed such as SQL query condition, output messages and UI widget labels. \item For the commits contain Chinese Commits (with CC$_C$ tag), 58\%, 51\%, 6\% and 6\% of them are also tagged with CR$_E$, T$_E$, V$_E$ and TAG$_E$. It indicates that Chinese comments are also likely to intermingled with English phrase, in which CR and T are the most common intermingle scenarios. \end{itemize} To summarize, we observed that Chinese sentences tended to include intermingled English phrases in both issue and source code, while English sentences rarely included Chinese phrases. Finally, the predominant role of a secondary language within the context of the primary language was to reference components or to use specific terminology. In related work, Timo et al. \cite{pawelka2015code}, investigated 15 OSS projects in which English was intermingled with other European languages. They found both identifiers and comments written in a second language were intermingled with source code. This differs from our observations of Chinese-English projects, in which we only found comments, but not identifiers, written in Chinese or pinyin (an alphabetic representation of Chinese characters). \section{Basic Translation Approaches} \label{sec:trace_algorithms} For our first series of traceability experiments, we utilize three commonly adopted tracing algorithms with and without the use of a basic translation step. This preliminary research question is an important one, because it addresses the question of whether the IBA issue can be addressed simply through applying a preprocessing translation step. We explore the improvement obtained by leveraging neural machine translation (NMT) as part of the tracing process to address the following research question: \begin{itemize}[leftmargin=*] \item {\bf RQ2:} To what extent does the use of a neural machine translation (NMT) approach improve the traceability performance of VSM, LDA and LSI for an IBA dataset? \end{itemize} \subsection{Baseline Algorithms} The Vector Space Model (VSM), Latent Dirichlet Allocation (LDA) and Latent semantic indexing (LSI) are three models commonly used to generate trace links. Researchers have successfully applied those models for various tracing scenarios within mono-lingual environments \cite{6341764,lormans2006can,asuncion2010software}. However, it is unknown whether those models are effective for IBA datasets. In this section, we therefore describe these three common trace models. \subsubsection{Vector Space Model} \label{sec:trace_algorithm_vsm} VSM is one of the simplest techniques for computing similarity between documents and has been used to support diverse trace link recovery tasks \cite{DBLP:journals/tosem/LuciaFOT07,DBLP:journals/tse/HayesDS06}. Despite its simplicity it has been shown to frequently outperform other techniques across many different datasets \cite{DBLP:conf/sigsoft/LoharAZC13}. VSM represents the vocabulary of discourse as an indexed linear vector of terms, while individual documents (aka artifacts) are represented as weighted vectors in this space. Weights are commonly assigned using TF-IDF (Term frequency-inverse document frequency) in which the importance of a term is based on its occurrence and distribution across the text corpus. VSM assumes the Bag of Words (BOW) model in which the ordering of words is not preserved. Let $A_S$ be the collection of source artifacts and $A_T$ the collection of target artifacts then each artifact $a_i \in A_S\cup A_T$ is represented by the terms $\{t_1...t_n\}$ it contains regardless of their order. Each artifact $a_i$ is transformed into a numeric format $a_i = \{w_1,w_2,\dots,w_n\}$ where $w_n$ indicates the TF-IDF score for $t_i$. The similarity of two artifacts is then estimated by measuring the distance between their vector representations -- often by computing the cosine similarity between source and target vectors as follows: \vspace{-4pt} \begin{equation}\label{VSM_EQ} Similarity(a_i,a_j) = \frac{a_i^T \cdot a_j}{\sqrt{a_i^T \cdot a_i}\sqrt{a_j^T \cdot a_j}} \end{equation} \vspace{-4pt} From the perspective of VSM, words are indexed as atomic units and are orthogonal to each other regardless of their semantic similarity. Therefore, the affinity between two artifacts is evaluated based on the volume and quality of their common vocabulary. IBA datasets, in contrast to mono-lingual ones, have a richer vocabulary composed from two different languages; therefore, source and target artifacts could be semantically similar, yet written using terminology from two distinct languages. This consequently could lead to an underestimation of the artifacts' affinity. \subsubsection{Topic Modeling Approaches} Topic modeling is also frequently used to support automated trace link generation \cite{DBLP:conf/icse/AsuncionAT10}.Topic modeling techniques discover the hidden semantic structures of artifacts as abstract concepts and then represent the artifact as a distribution over the concepts. The most commonly adopted approaches are Latent Dirichlet Allocation (LDA), Latent Semantic Indexing (LSI) and Probabilistic Latent Semantic Indexing (PLSI). LSI, also known as Latent Semantic Analysis (LSA), represents each artifact $a_i$ as a vector of word counts $c_n$ such that each word is represented as $a_i= \{c_1,c_2,...,c_n\}$. Thus the artifact corpus $A$ can be represented as a matrix $A =\{a_1,a_2,...,a_m\}$ where $m$ refers to the total number of all artifacts in $A$. LSI learns the latent topics by applying matrix decomposition, e.g Singular Value Decomposition (SVD) \cite{DBLP:journals/tosem/LuciaFOT07}. Hofmann et al. proposed a probabilistic variant of LSI which is known as PLSI in 1999 \cite{DBLP:conf/sigir/Hofmann99} in which a probabilistic model with latent topics is leveraged as a replacement of SVD. LDA then can be regarded as a Bayesian version of PLSI where dirichlet priors are introduced for the topic distribution. Given the topic distribution vector of source and target artifacts, the affinity between two artifacts can be calculated either with Cosine similarity or with Hellinger distance \cite{1089532} which quantifies the similarity between two probability distributions. As we know, topic modeling methods represent each topic by eliciting a group of distinctive words associated with a similar theme. The per-artifact topic distribution probability, indicating the affinity between the artifact and a topic, is obtained by analyzing the artifact vocabulary and those selected words. When project artifacts contain foreign languages, the representative topic words are constituted from two (or more) distinct languages. Topic modeling methods therefore face similar vocabulary challenges to VSM. The use of foreign languages introduces a new set of words from a different language and thereby reduces the likelihood that related artifacts use the same words. \subsection{Leveraging Neural Machine Translation} \label{sec:impact_of_binlingual} Neural machine translation services, such as Google Translate, are capable of translating documents with complex grammars into diverse languages. Wu et al. demonstrated that, for a specific set of datasets, Google Translate achieved the average accuracy of bilingual human translators. Furthermore, current versions of Google Translate have addressed approximately 60\% of known translation errors in popular languages such as English-Chinese, thereby significantly improving performance \cite{DBLP:journals/corr/WuSCLNMKCGMKSJL16}. Fu \cite{fu} manually compared the performance of 7 translation services and found Google Translate to be one of the best English-Chinese translations. We therefore opted to use Google translation services for this series of experiments. \subsubsection{Translation as a Preprocessing Step} Our basic approach uses an NMT (Google Translation services) to transform all artifacts in our dataset into mono-lingual (English) representations. This is accomplished by translating the documents sentence by sentence. Artifacts were first split into sentences using the pre-trained sentence tokenizer provided by NLTK's PunktSentenceTokenizer \cite{DBLP:conf/acl/Bird06}. Regular expressions were then used to identify bilingual sentences. In our case, both English and Chinese used within an artifact are represented with UTF-8 encoding, regular expressions capture non-English sentences by checking the encoding of their characters. Finally, each of the bilingual sentences were processed by Google Translate to generate their English counterparts. These were then used to replace the bilingual sentences in their relevant artifacts. As a result, the IBA dataset was transformed into an English mono-lingual dataset. Although Markus et al. \cite{muhr2010external} suggested the use of token-by-token translation, we opted for sentence level translation for several reasons. First, the sentence-level approach allows words to be considered within context and thereby to better retain their semantics following the translation. Furthermore, Google Translation Service is capable of handling intermingled terms and phrases within a sentence automatically, as it leverages a single NMT model to translate between multiple languages even in cases where a sentence contains intermingled phrases \cite{johnson2017google}. Taking the commit message in Table~\ref{tab:commit_example} as an example, Google's sentence level translation will generate a result such as "PagerUtils offset bug, when offset needs to be modified to 0, the value is incorrect", while token level translation will produce a sentence such as "PagerUtils offset of bug, when offset need modify for 0 time, value incorrect". In this case, the token level translation distorted the sentence semantics as it translated the Chinese phrases without fully understanding their context. Our approach is also more efficient and cost-effective than document-level translation, as it significantly reduces the volume of data submitted to translation service by removing sentences written in pure English. This is important as Google Translate charges more money and responds more slowly on a larger text corpus. \begin{figure*}[t!] \label{fig: exp1_bar} \begin{subfigure}{.32\linewidth} \centering \includegraphics[width=\linewidth]{figures/exp1/exp1_vsm_map.png} \caption{VSM. Average AP score 0.62 (VSM) and 0.68 (VSM$_{tr}$)}\label{fig:exp1_vsm} \end{subfigure} \hfill \begin{subfigure}{.32\linewidth} \centering \includegraphics[width=\linewidth]{figures/exp1/exp1_lda_map.png} \caption{LDA. Average AP score 0.45 (LDA) and 0.48 (LDA$_{tr}$)}\label{fig:exp1_lda} \end{subfigure} \hfill \begin{subfigure}{.32\linewidth} \centering \includegraphics[width=\linewidth]{figures/exp1/exp1_lsi_map.png} \caption{LSI. Average AP score 0.55 (LSI) and 0.58 (LSI$_{tr}$)}\label{fig:exp1_lsi} \end{subfigure} \caption{ AP scores for three basic trace models, with and without Google Translate, for 17 IBA datasets. Overall best results are observed for the Vector Space Model (VSM).} \label{fig:exp1_bar} \vspace{-12pt} \end{figure*} \begin{figure}[tbh!] \centering\includegraphics[width=\linewidth]{figures/exp1/exp1_box_map.png} \vspace{-12pt} \caption{AP score distribution achieved when applying three models for 14 Chinese IBA datasets } \vspace{-12pt} \label{fig:exp1_box} \end{figure} \subsection{Evaluating NMT as a preprocessing step} We utilized VSM, LSI, and LDA models, to automatically generate trace links for both sets of artifacts (i.e., the original IBA artifacts and the translated mono-lingual ones). We then applied the time-constraints described in Section \ref{sec:datasets} to filter the resulting links. \subsubsection{Metrics} Results were evaluated using the commonly adopted average precision (AP) metric \cite{DBLP:conf/icse/ShinHC15}. AP evaluates the extent to which correct links are returned at the top of a list of ranked links. In this sense, it is considered more insightful than recall and precision metrics which simply measure whether a link is found within a set of candidate links. AP is calculated as follows: \begin{equation} \label{eq:AP} AP = \frac{\sum_{i=1}^{n} Precision(i) \times rel(i) }{|true \ links|} \end{equation} where $n$ is the number of candidate links, and rel(i) is an indicator function returning 1 if the link at $i_{th}$ ranking is a true link, otherwise return 0. Precision(i) is the precision score at the cut-off of $i_{th}$ ranking in the returned result. The $|true links|$ denominator refers to the total number of true links, meaning that we evaluate average precision for all true links and report AP scores at recall of 100\%. \subsubsection{Results and Analysis} To address RQ2 we compared the AP scores produced for each of the models, with and without Google Translate, for all 14 IBA datasets. The basic models are labeled VSM, LDA and LSI and the corresponding models using NMT are labeled VSM$_{tr}$, LDA$_{tr}$, and LSI$_{tr}$. Detailed results for each project are reported in Fig. \ref{fig:exp1_bar}, and aggregated results across all projects are presented in Fig. \ref{fig:exp1_box}. We used the Wilcoxon signed-rank test \cite{woolson2007wilcoxon} to measure whether the use of translation statistically improved the performance for each technique. This is a standard test used to evaluate tracing algorithms due to the non-normal distribution of data points. We tested 14 pairs of AP scores achieved from the 14 datasets, with and without translation, using Scipy's \cite{scipy} Wilcoxon test function and adopted the standard significance threshold of 0.05. Results showed that VSM$_{tr}$ outperformed VSM with statistical significance (W=2, P = 0.001). On the other hand, in the cases of LSI vs LSI$_{tr}$ and LSI, (W = 34,P = 0.079) and for LDA$_{tr}$ and LDA (W = 43, P = 0.113) there was no statistically significant difference, given that in both cases, the p-values were above the significance threshold. These results indicate that translation improves performance in the case of VSM, but not necessarily for LSI and LDA, quite possibly because both of these techniques create topic models which can include terms from both languages. As we can see in Fig. \ref{fig:exp1_box}, both LDA$_{tr}$, and LSI$_{tr}$ have higher medians, Q1, and Q3 values than their non-translation versions but a lower minimum value. It indicates that in certain cases, translation can degrade the performance of the tracing algorithm instead of improving it. This phenomenon is highlighted in Fig. \ref{fig:exp1_bar}, where we observe that in most projects, the `trans' version of LDA and LSI have a higher AP score, but there are a few exceptions in which the basic trace models perform better. This result also confirms previous findings that VSM often outperforms LDA and LSI in various mono-lingual tracing scenarios \cite{DBLP:conf/iwpc/OlivetoGPL10,DBLP:conf/sigsoft/LoharAZC13}, our experiment therefore extends this finding to the IBA domain. Given that VSM tends to outperform LSI and LDA on software engineering traceability datasets, it is particularly significant that VSM$_{tr}$ provides additional improvements. These results show that in the case of VSM, the translational preprocessing step improves accuracy of the results, and further imply that the presence of bilingual artifacts has a negative effect on traceability results. \subsubsection{Translation Related Pitfalls} \label{sec:trans_limitaiton} A careful analysis of individual tracing results unearthed three scenarios in which translation negatively impacted the results. \vspace{-8pt}\\ \noindent{\bf Scenario 1: } A single Chinese term occurring in both source and target artifacts is sometimes translated into different English terms by NMT due to differing contexts. For example, before the translation step, a foreign term \begin{CJK*}{UTF8}{gbsn}‘启动’\end{CJK*} appeared as a verb written in Chinese and was shared by both source and target artifacts. It resulted in high similarity scores between the artifacts. Following the translation step, the term was transformed to `start' in the source artifact and as `startup' in the target artifact. Neither VSM, LDA, or LSI captured the semantic similarity between these terms. As observed in our earlier study of usage patterns, English sentences seldom contain intermingled Chinese terms; therefore we primarily observed this scenario when tracing between pairs of artifacts written in Chinese (e.g., issues and code comments).\vspace{-8pt}\\ \noindent{\bf Scenario 2: } A relatively specific term in Chinese, translated into a common English term could introduce noise and subsequently increase the number of false positive links. As summarized in RQ1, commits with $CD_C$ tags may contain Chinese terms representing SQL query keywords or UI widget labels. Although these terms are usually sparse with respect to the size of the source code, they serve as strong indicators of true links when directly referenced in an issue discussion. \vspace{-8pt}\\ \noindent{\bf Scenario 3:} Unique phrases that describe specific features in Chinese, are eliminated or weakened by the translation step. We observed that artifact creators appeared to deliberately reference Chinese language content from other artifacts as signature features, indicating that two artifacts are closely related. Translation may inadvertently weaken the association by translating distinctive Chinese terms into common English words, some of which might even be removed as common stop words. This scenario was observed in some artifacts tagged as TAG$_C$ tag. Despite these limitations, our results show that adding a translation step into the tracing workflow generally improves results with statistical significance as previously discussed. The main reason that NMT impairs tracing results is that similar terms can become distant from each other following translation. We therefore leveraged word embedding as a semantic layer to enable those terms to be mapped closer together in the multi-dimensional space in order to improve the tracing results. \section{Conclusion } \label{conclusion} The work in this paper was motivated by the needs of our industrial collaborators who were seeking enterprise-wide traceability solutions across software repositories containing artifacts written in a combination of English and Chinese. This paper has made several contributions. First, it explored the use of intermingled Chinese and English terms across 14 different projects and identified common usage patterns. It then showed that using a preprocessing translation step in IBA projects in conjunction with three commonly used trace models improved accuracy of the generated trace links. This clearly indicates that the multi-lingual problem must be addressed for traceability in IBA datasets. We then proposed three GVSM based methods which leveraged the strength of word embedding to address the IBA vocabulary issue. Our experiment results showed that, WEG$^{*}_{tr}$ can outperform NMT combined classic trace models and two other GVSM based methods proposed by us. In the cases where NMT may not be available (due to costs of an external service provider), we propose CLG and WEG as viable alternatives, because it is easier, more effective, and less costly to train a word embedding based model than an NMT translator. Furthermore, an internally trained CLG and WEG model could potentially include domain-specific terminology, thereby potentially boosting its performance. \section*{Acknowledgements} The work described in this paper is funded by NSF grant CCF-1649448 \section{Experimental Datasets} \label{sec:datasets} To establish the experimental environment used throughout the experiments described in this paper, we collected a dataset of 17 OSS projects, each containing artifacts written in English plus one additional language. We refer to this second language as the \emph{foreign} language. All projects met the following criteria: \begin{enumerate} \item The Project contains at least 40 issues and commits in its overall development history. \item Foreign terms constituted at least 1\% of the vocabulary. \item Tags were routinely created to include issue IDs in the commit messages (i.e., to generate trace links for evaluation purposes) \item The project exhibited diversity in size of links between issues and commits, in comparison to other selected projects. This enabled us to observe the performance of our model in both large and small projects. \end{enumerate} \input{tables/project_info_table.tex} \input{tables/example_data.tex} To identify datasets meeting these criteria we (1) collected the names of top Chinese IT companies based on a survey published by Meeker et al. \cite{meeker2018internet}. Nine Chinese companies, including Alibaba, Tencent, Meitaun, JD, Baidu, NetEase and XiaoMi, were recognized amongst the top 30 global IT companies and were included in our project search. (2) We searched Github using these company names to retrieve a list of their open source repositories. We found enterprise-level open source repositories for eight of the nine companies (excluding JD). (3) We then sorted the projects in the retrieved repositories by the numbers of stars to identify the most active projects. (4) Finally, we selected the top scoring projects that met our defined criteria. In addition, while our focus throughout this paper is on English-Chinese projects, we also included three additional projects based on Korean, Japanese, and German. However, as large companies in those three countries, e.g. Samsung, Hitachi and Siemens, produce few bilingual projects, we selected three popular personal projects in those languages instead. We searched by the language name, and then followed steps (3) and (4) as described above. We discuss results from these additional languages towards the end of the paper. The selected projects are depicted in Table \ref{tab:project_summary}. \input{tables/data_status_table.tex} We used the Github Rest API to parse each of the selected projects and to extract information from commits and issues. We retrieved both the \textbf{commit message} and the \textbf{source code change set} to establish source artifacts for the trace links. We then collected \textbf{issue discussions}, and \textbf{issue summaries} to construct our target artifact sets. We removed personal identifications from all issues, while retaining comments. By selecting issues and commits for our tracing artifacts we were able to automatically establish a golden link set by using regular expressions to parse commit messages and extracting explicitly defined connections between commits and issues. An example of a commit and issue is depicted in Table \ref{tab:commit-issue}, and statistics for the collected datasets are shown in \citetable{tab:data_status_1}. Rath et al., studied commit messages in five OSS projects and found that an average of 48\% were not linked to any issue ID \cite{DBLP:conf/icse/0002RGCM18}. This implies that our golden link set is likely to be incomplete and that `true positive' instances in the evaluation step could be mistakenly treated as `false positives'. To partially mitigate this problem, we limited the scope of artifacts to those included in at least one of the explicitly specified links from the golden link set. All other artifacts (i.e., issues and commits) were removed. This created a dataset with denser ground-truth link coverage and fewer inaccuracies. Furthermore, we decided to remove all artifacts that were not impacted, directly or indirectly, by the IBAs. For each link in the golden artifact set, if at least one artifact associated with that link included a foreign language term, then we retained both artifacts and labeled the link as an intermingled link. All other artifacts were removed. In effect, it removed artifacts that were never involved in any intermingled link, and allowed us to focus the evaluation on artifacts and links that were impacted by the use of foreign language terms. Applying these two pruning steps reduced the pruned dataset to an average of approximately 27\% of the original issues, 17\% of the commits, and 77\% of the links as shown in Table \ref{tab:data_status_2} \footnote{{Dataset can be found at http://doi.org/10.5281/zenodo.3713256}}. For all tracing experiments using these datasets, we applied a time-based heuristic proposed by Rath et al.\cite{DBLP:conf/icse/0002RGCM18}. This heuristic states that as $Issue_{create} < Commit_{create}< Issue_{close}$, then commits can only be linked to currently open issues, as closed issues are unlikely to represent a valid trace link. \subsection{Experiments} \subsection{Experiment} \label{sec:rq2} All three GVSM models (i.e., CLG, WEG and WEG$_{tr}$) shown in Table \ref{tab:gvsm_models} were applied against our experimental datasets. However, due to different amounts of training data available, the size of the cross-lingual embedding tends to be smaller than the mono-lingual word embedding. To make a fair comparison between the techniques of using mono-lingual and cross-lingual embeddings, we randomly sampled the vocabulary of the mono-lingual word embedding to reduce its size. The full mono-lingual embedding included 2,519,371 records, while the cross-lingual embedding and the down-sized mono-lingual embedding included only 332,648 records. However, in reality, it is far easier to construct a large mono-lingual word embedding, and therefore we wanted to see how WEG$_{tr}$ and WEG performed when allowed to use the fully available embedding data. We therefore also include these results, labeled as WEG$^{*}_{tr}$ and WEG$^{*}$ respectively. Finally, as an additional point of comparison, we include both VSM and VSM$_{tr}$ from our earlier experiment. Results are reported in Figures \ref{Fig:exp2_gvsm_performance} and \ref{Fig:exp2_gvsm_performance_detail}. \subsubsection{RQ3: Analysis of Cross-lingual Word Embedding} To address our research question ``To what extent does cross-lingual word embedding improve GVSM performance for tracing across IBA datasets?'' we explore the difference between CLG, WEG, and WEG$_{tr}$ models. By comparing average precision achieved for the 14 Chinese datasets as reported in Figure \ref{Fig:exp2_gvsm_performance} we observe that in 12 out of 14 cases, WEG$_{tr}$ was the winner. Of the remaining two cases, CLG and WEG each won once. Furthermore, as reported in Figure \ref{Fig:exp2_gvsm_performance_detail}, WEG$_{tr}$ has a significantly higher median, Q1, and Q3 value than either mono-lingual WEG or CLG. Applying full size word embedding to WEG$_{tr}$ further improves the performance by increasing the median value of the results distribution. This indicates that combining WEG with NMT can effectively improve the tracing performance. When comparing WEG and WEG$^{*}$, we observed that increasing the embedding size for mono-lingual WEG has little impact on model performance; however, this contrasts with the marked improvement observed when using an increased English embedding size on WEG$_{tr}$, reinforcing our conjecture that the vocabulary mismatch introduced by IBA has a clear negative impact upon trace performance. To determine if it would be possible to avoid the costs of building or contracting a translation service such as Google Translation services, we also compared the mono-lingual and cross-lingual approaches (i.e., WEG vs. CLG) without the benefit of translation. In this case, we observe that CLG outperforms WEG in 10 out of 14 Chinese projects, achieves equivalent performance in one project, and underperforms in 3 projects. However, an analysis of results in Figure \ref{Fig:exp2_gvsm_performance_detail} shows that its median, Q1, and Q3 values in comparison to other models, show that it does not statistically outperform WEG. We therefore answer RQ3 by stating that the cross-lingual word embedding failed to outperform either of the mono-lingual word embedding approaches based on the available resources, and that the use of a preprocessing translation step followed by the use of GVSM with mono-lingual word embedding was clearly superior. \subsubsection{RQ4: Comparison of all models} Finally, to address our research question ``Which of the tracing techniques presented in this paper perform best on IBA datasets?'' we compare VSM$_{tr}$, LDA$_{tr}$, and LSI$_{tr}$ with our new GVSM-based techniques. As Fig. \ref{fig:exp1_box} and Fig. \ref{Fig:exp2_gvsm_performance_detail} report VSM$_{tr}$ and WEG$^{*}_{tr}$ are observably the best models. We compared AP scores achieved for these two models for all 14 Chinese datasets, against each of the other models using the Wilcoxon signed-rank test and Cohen's d effect size. P-value of Wilcoxon signed-rank test are reported in Table \ref{tab:wilcoxon}, show that both VSM$_{tr}$ and WEG$^{*}_{tr}$ are statistically significant better than other models given the P-values are all below 0.05 with effect size ranging from 0.3 to 0.9 indicating a "medium" to "large" effect. However, a similar comparison of WEG$^{*}_{tr}$ and VSM$_{tr}$ returns a P-value 0.0615 and effect size of 0.09, meaning that neither technique is significantly better than the other even though Fig. \ref{Fig:exp2_gvsm_performance_detail} shows that WEG$^{*}_{tr}$ has a higher maximal, Q1, Q3 than VSM$_{tr}$. \input{tables/wilcoxon.tex} \section{Introduction} \label{introduction} Software traceability establishes links between related artifacts such as requirements, design, code, and test cases \cite{DBLP:conf/icse/Cleland-HuangGHMZ14, DBLP:conf/re/GotelF94}. It provides useful supports for software engineering activities such as change impact analysis, safety assurance, test selection, and compliance analysis \cite{DBLP:journals/jss/MaderG12, RERoadmap}, and is prescribed in many safety-critical domains \cite{DBLP:conf/se/RempelMKC15}. The process of manually creating trace links is arduous and error-prone \cite{DBLP:journals/tse/HayesDS06} and therefore researchers have focused significant effort on automating the process through adopting diverse information retrieval techniques \cite{DBLP:journals/tosem/LuciaFOT07, DBLP:conf/icse/0002RGCM18, DBLP:journals/tse/HayesDS06, DBLP:conf/icse/0004CC17}. Automated techniques are of particular importance for reconstructing trace links after-the-fact, for example to fill in the gaps of an existing trace matrix, trace back to a new set of regulatory codes, or to establish trace links across existing Open Source Systems (OSS) for integration into safety-critical solutions \cite{SCS-OSS}. The most prevalent automated tracing techniques include the Vector Space Model (VSM) \cite{DBLP:journals/tse/HayesDS06}, Latent Dirichlet Allocation (LDA) \cite{DBLP:books/daglib/p/AsuncionT12}, Latent Semantic Indexing (LSI) \cite{DBLP:journals/tse/AntoniolCCLM02}, and deep-learning techniques \cite{DBLP:conf/icse/0004CC17}. Automated approaches typically analyze the textual content of each artifact, compute their syntactic and semantic similarity, and assign a relatedness score between each pair of artifacts that depicts the likelihood that the artifacts are associated. Despite the fact that industrial projects in involving international corporations often include artifacts with intermingled languages, research efforts have not addressed the challenge of intermingled languages. We observed the problem of intermingled language use in a recent collaboration with an international corporation. Our goal was to help the company implement state-of-the-art automated tracing techniques across a repository of diverse artifacts; however, we found that many documents included a combination of two different languages (in this case English and Chinese). We then searched for other examples of intermingled language use in issues, requirements, and source code in OSS projects developed in common outsourcing countries, especially those that exhibited lower than average scores on the English Proficiency Index (EPI)\cite{epi}. This observation raised new questions about the effectiveness of different tracing algorithms when applied to artifacts containing two or more different languages. We hypothesized that existing trace algorithms that are effective in mono-lingual environments are not necessarily effective when applied to bilingual ones. We focused our efforts primarily on intermingled bilingual artifacts (IBAs) that included English and Chinese because our collaborators' project included these two languages, and because we found this to be the most prevalent language combination in OSS. This paper, therefore, investigates the automatic generation of trace links within software projects with IBAs, which we formally specify as follows. Given a dataset of artifacts $D$ with source artifact set $A_S$ and target artifact set $A_T$, then source artifact $a_{s_i} \in A_S$ is composed of terms in a vocabulary V, where $V = L_p \cup L_f $. The target artifacts are constituted similarly to the source artifacts. Further, $L_p$ and $L_f$ are vocabulary subsets of primary language and foreign language. The remainder of the paper is laid out as follows. Section \ref{sec:datasets} describes the datasets that were used throughout the remainder of the paper. Section \ref{sec:IBAPractice} analyzes the usage of intermingled language across 10 different Chinese-English projects and identifies commonly occurring usage patterns. Section \ref{sec:trace_algorithms} describes three classic tracing algorithms -- namely the Vector Space Model (VSM), Latent Dirichlet Allocation (LDA) and Latent Semantic Indexing (LSI), and evaluates their accuracy in multilingual project environments with and without the use of translation as a preprocessing step. Section \ref{sec:approach} then introduces the Generalized Vector Space Model (GVSM) and evaluates its effectiveness in combination with both mono- and cross-lingual word embeddings. We show that utilizing mono-lingual word embeddings with a preprocessing translation step tends to be more effective than the use cross-lingual embeddings; however, to avoid the costs of an external translation service, an individual corporation might opt for the cross-lingual approach which is easier to train than a language translator. Finally, in Sections \ref{sec:threats} to \ref{conclusion}, we discuss applications to other languages, threats to validity, related work, and finally conclude by summarizing our results and discussing their relevance. \section{Related Work} \label{related_work} Prior work related to cross-lingual translation has already been extensively described throughout the paper. In this section we therefore focus on the very limited body of work that exists in the use of multiple languages in the software development environment. This phenomenon tends to occur in two primary settings -- first in organizations in which English is not the primary language of many stakeholders, but is the language of choice for supporting the development process; and second, in global software development environments with geographically dispersed teams speaking multiple languages. As Abufardeh et al. \cite{5488634} points out, this kind of geographical localization for development teams is a critical element of the success of multi-national projects. Multi-lingual problems in global software development (GSD) have been identified and discussed by previous researches. Although English is widely accepted as an official languages in most international IT corporations, the practice of utilizing a second language is quite common. For example, Lutz \cite{DBLP:conf/icgse/Lutz09} investigated the issue in Siemens' English-German work space and pointed out that utilizing English as the primary language for non-native speakers can lead to misunderstandings in both oral and written communication. Researchers have proposed different methods to address the multi-lingual linguistic problem. One branch of studies has focused on developing best-practices\cite{DBLP:journals/cacm/KrishnaSW04} to enhance the work quality and efficiency, while others have proposed using machine translation as a solution for minimizing the misunderstanding brought by multi-lingual environment \cite{DBLP:conf/icgse/CalefatoLP11, DBLP:conf/cscwd/MoulinSFWM09, DBLP:conf/icse/Cleland-HuangCDGHKLMPSZABEM11}. Our approach best fits into this second category as we have observed the problem of multi-lingual language use in software artifacts and have applied diverse machine-learning solutions to compensate for in the traceability task. \section{Threats to Validity} \label{sec:threats} There are several threats to validity in this study. First, we used Google as our black-box translator. As the vocabulary selection strategy of the NMT has a direct impact on the final trace link quality, results could be different if other types of machine translation methods are applied. However, we chose Google translation as it has been empirically shown to deliver high quality translations across numerous languages. Another important threat is that the training material used for CLG was composed of general documents from Wikipedia and did not include domain specific corpora. We made this decision in order to deliver a more generalized solution, and because collecting a domain specific corpus for all 17 projects would have been prohibitively expensive. CLG might perform better than WEG if a domain-specific corpus of technical documents had been available and used for training purposes. An external threat was introduced by limiting the raw artifacts to the coverage area of intermingled links to alleviate the link sparsity issue (see Table \ref{tab:data_status_2}). This enabled us to focus on the IBA-impacted traces, but reduced the number of participating artifacts, thereby potentially inflating AP scores for all results. Also, we did not yet explore the impact of embedding size on CLG. On the other hand, our experiments showed that WEG$_{tr}$ still outperformed CLG, when equal sized embeddings were used. The reality is that larger mono-lingual embeddings are more readily available, and should be pragmatically leveraged. We leave experimentation with different sized embeddings to future work. Finally, we extensively evaluated the results on Chinese-English projects, but study is required to generalize our finding to other languages.
\section{Introduction} \label{sec:intro} For more than 130 years (cf. Lehmann \cite{lehmann1889krystalle}) liquid crystals inspire many scientists in a lot of ways. Their field of applications ranges from photonics and optics (e.g. liquid crystal displays (LCD)) over materials science (cf. \cite{palffy2007lc}) up to biophysics, for example to describe the cytoskeleton (cf. \cite{ahmadi2006activeLC, kierfeld2008active}). In the latter, there is often an activity mechanism involved which drives the system out of equilibrium and which will be discussed in more detail later. Liquid crystals can be considered as a system which has mesomorphic states between an ordinary liquid and a crystal. In particular, such systems consist of rodlike polymers which interact pairwise and are characterized by long-range orientational order and not or only partially by positional order. In the 1980s, Doi developed a model for rodlike molecules which describes the properties of liquid crystal polymers in a solvent (cf. \cite[Chapter 8]{doi1986theory}, \cite{doi1981molec_dynamics, degennes1993LC}). This model consists of a Smoluchowksi equation describing the evolution of a pseudo probability density of particles $\psi(\mathbf{x}, \mathbf{m}, t)$ with center of mass in $\mathbf{x} \in \Omega$ and orientation $\mathbf{m} \in {\SMat^{d-1}}$ at time $t \geq 0$, where ${\SMat^{d-1}}$ denotes the unit sphere and $\Omega \subset \mathbb{R}^d$ is a bounded domain for $d \in \{2, 3\}$. If the interaction of the rodlike polymers is very strong or if the concentration of them is very high, the rods line up with each other and build a nematic phase. This phase transition problem was first described by Onsager (cf. \cite{onsager1949colloidal, zhang2007review}). In the homogeneous case, that is in the absence of effects of fluid dynamics, this model is often referred to as Doi-Onsager model whereas the model is referred to as Doi-Hess model in the inhomogeneous case. In the past, these models have been the subject of many mathematical studies (cf. \cite{constantin2005nonlFP, constantin2007smolNast, constantin2008smolNaSt2d, liu2005classification, luo2004structure, otto2008velocityGrad, zhou2005equilibria}).\\ However, the models for inhomogeneous flow did not take distortional elasticity into account (cf. \cite{e_zhang_2006_kinetic, zhang2008existenceNewModel}). There have been many attempts to extend the theory for inhomogeneous flow to include distortional elasticity on a microscopic level (cf. \cite{marruci1991nematics, tsuji1998nematicLC, rey1998LCrheology, wang2002nematicLC}). Unfortunately, these models are all phenomenological in nature and hence, they consist of many unknown parameters which are very difficult to determine in experiments. Moreover, they often lack consistency with other theories and among themselves (cf. \cite{e_zhang_2006_kinetic}).\\ Then, E and Zhang (cf. \cite{e_zhang_2006_kinetic}) extended the Doi model for homogeneous flow of rodlike liquid crystalline polymers to inhomogeneous flow and introduced a nonlocal intermolecular potential which results in an extra term in the form of an elastic body force to take into account distortional elasticity.\\ In this paper, we consider unflexible rodlike polymers with constant length $l > 0$, diameter $b > 0$, ratio $r:= \frac{b}{l} \ll 1$ (see Figure \ref{fig:rod}), and a mean number density $\ndens > 0$ given by \begin{align*} \ndens := \frac{1}{\abs{\Omega}} \int_{\OmSph} \psi \, \text{d}\mathscr{H}^{d-1} \, \text{d}\xflow. \end{align*} In particular, we restrict ourselves to solutions with a concentrated regime described by $\nu b l^2 > 1$ such as liquid crystals (cf. \cite[Chapter 10.1]{doi1986theory}). \begin{figure}[!htbp] \begin{tikzpicture}[scale=0.75] \def\mx{0} \def\my{0} \def3/4{0.5} \def6*\b{6*3/4} \def1.4142{1.4142} \def0.70711{0.70711} \def\llx{\mx - 0.70711*3/4/2 - 0.70711*6*\b} \def\lly{\my + 0.70711*3/4/2 - 0.70711*6*\b} \def\ulx{\mx - 0.70711*3/4/2 + 0.70711*6*\b} \def\uly{\mx + 0.70711*3/4/2 + 0.70711*6*\b} \def\lrx{\mx + 0.70711*3/4/2 - 0.70711*6*\b} \def\lry{\my - 0.70711*3/4/2 - 0.70711*6*\b} \def\urx{\mx + 0.70711*3/4/2 + 0.70711*6*\b} \def\ury{\my - 0.70711*3/4/2 + 0.70711*6*\b} \def\radellipsex{3/4/2} \def\radellipsey{3/4/4} \def\disttorod{3/4*2/3} \draw (\llx, \lly) -- (\ulx, \uly); \draw (\lrx, \lry) -- (\urx, \ury); \node[circle,fill=black,inner sep=0pt,minimum size=5pt,label=below left:{$\mathbf{x}$}] (a) at (\mx, \my) {}; \draw[rotate around={-45:(\llx/2 + \lrx/2, \lly/2 + \lry/2)}] (\llx/2 + \lrx/2, \lly/2 + \lry/2) ellipse ({\radellipsex} and {\radellipsey}); \draw[rotate around={-45:(\urx, \ury)}] (\urx, \ury) arc(0:180: {\radellipsex} and {\radellipsey}); \draw[arrows={angle 90 - angle 90}] (\llx - \disttorod, \lly + \disttorod) -- (\ulx - \disttorod, \uly + \disttorod); \draw[arrows={angle 90 - angle 90}] (\ulx + \disttorod, \uly + \disttorod) -- (\urx + \disttorod, \ury + \disttorod); \node (nameL) at (\mx - 0.70711*3/4 - \disttorod - 3/4/2, \my + 0.70711*3/4 + \disttorod + 3/4/2) {$l$}; \node (nameB) at (\ulx/2 + \urx/2 + \disttorod + 3/4/2, \uly/2 + \ury/2 + \disttorod + 3/4/2) {$b$}; \end{tikzpicture} \caption{Rodlike polymer with length $l$, diameter $b$, and center of mass $\mathbf{x}$.} \label{fig:rod} \end{figure} The model of E and Zhang in dimensional form (cf. \cite{e_zhang_2006_kinetic}) coupling a Smoluchowski equation to a Navier-Stokes type equation reads as follows for a given time $T > 0$: \begin{subequations} \label{intro:eq:dimensional} \begin{align} \begin{split} \label{intro:eq:psi:dimensional:srot} &\partial_t \psi + \Div_\xflow(\mathbf{u} \psi) - \frac{1}{ k_B \mathcal{T}} \Div_\xflow\lrcb{ \psi\lrcb{ D_\parallel \mflow\otimes\mflow + D_\perp (\mathbb{I} - \mflow\otimes\mflow) }\nabla_\xflow \overline{\mu}_\psi } \\ &\qquad - \frac{D_r}{ k_B \mathcal{T}} \sRot \cdot \lrcb{ \psi \sRot \overline{\mu}_\psi } = - \sRot \cdot \lrcb{ \psi \mathbf{m} \times (\nabla_\xflow \mathbf{u} \mathbf{m}) } \quad \text{ in } {\Omega\times\Sph}\times(0,T], \end{split}\\ \begin{split} \label{intro:eq:u:dimensional} &\rho \lrcb{ \partial_t \mathbf{u} + (\mathbf{u} \cdot \nabla_\xflow) \mathbf{u} } + \nabla_\xflow p = - \int_{\Sph} \psi \nabla_\xflow \overline{\mu}_\psi \, \text{d}\mathscr{H}^{d-1} + \Div_\xflow(\overline{\mathbb{T}}) \quad \text{ in } \Omega \times (0,T]. \end{split} \end{align} \end{subequations} At this point let us refer to Section \ref{sec:model} for details about this model. As the degrees of freedom of the microscopic equation are quite high, there have been many attempts to derive macroscopic equations from the Doi model (a good overview over the different models from a mathematical point of view can be found in \cite{emmrich2018LC, ball2017LC}). In particular, the interest in the Ericksen-Leslie equations (cf. \cite{ericksen1961convervationLC, ericksen1991orientationLC, leslie1968LC}), the Q-Tensor equations (cf. \cite{degennes1993LC, majumdar2010LC, beris1994thermodynamics}), and the mathematical analysis of these models (cf. \cite{lin1995dissipativeLC, lin1996dynamicLC, lin2000ericksenLeslie, cavaterra2013LC, ball2010LC, paicu2011QTensor, paicu2012QTensor, huang2015LC, abels2014QTensor}) has been growing significantly over the last years. Kuzuu and Doi's (cf. \cite{kuzuu1983LC}) formal derivation of the Ericksen-Leslie equation from the Doi-Onsager equation in the homogeneous case has been extended to the inhomogeneous case from systematic asymptotic analysis of \eqref{intro:eq:dimensional} (cf. E and Zhang \cite{e_zhang_2006_kinetic}). Moreover, Wang et al. (cf. \cite{wang2015deborahLimit}) established a rigorous derivation of the Ericksen-Leslie equation from \eqref{intro:eq:dimensional}. Furthermore, Han et al. (cf. \cite{han2015microToMacro}) derived a new Q-Tensor model from \eqref{intro:eq:dimensional}, which obeys the energy dissipation law, by applying the Bingham-closure (cf. \cite{bingham1974}). Therefore, as the model \eqref{intro:eq:dimensional} is not just a fundamental model itself but a starting point for the derivation of many equations, which find a lot of interest these days, it is important to study it analytically. Chen and Liu (\cite{chen_liu_2013_entropy_solution}) proved the existence of global-in-time weak solutions to \eqref{intro:eq:dimensional} including active stresses induced by active particles (see Section \ref{sec:model} for more details regarding activity) in two and three space dimensions in the case that the friction constant is zero, that is $\xi_r = 0$ (see \eqref{eq:viscous_stress_p}) and that the interaction potential equals zero, that is $\pot[\psi] \equiv 0$ (see \eqref{def:pot}). Zhang and Zhang (cf. \cite{zhang2008existenceNewModel}) considered the model \eqref{intro:eq:dimensional}, periodic domains, and high regularity assumptions on the initial data. They proved the existence of local solutions in two and three space dimensions (cf. \cite[Theorem 1.1]{zhang2008existenceNewModel}). In the case of two space dimensions, they additionally showed the existence of global-in-time weak solutions (in the sense that $0 < T < \infty$ is given) (cf. \cite[Remark 1.2]{zhang2008existenceNewModel}). Moreover, they established the existence of global weak solutions (in the sense that $[0,T) = [0, \infty)$) if the Deborah number and the Reynolds number are sufficiently small for $d \in \{2, 3\}$ (cf. \cite[Theorem 1.2]{zhang2008existenceNewModel}). However, proving the existence of global-in-time weak solutions to \eqref{intro:eq:dimensional} (for passive or active particles in the sense that $0 < T < \infty$ is given) for three space dimensions without assumptions on the Reynolds and Deborah number was stated as an open problem by Emmrich et al. (cf. \cite[p.42]{emmrich2018LC}). The main contribution of this paper is the proof of the latter problem. In Main Theorem \ref{thrm:main}, we establish the existence of global-in-time weak solutions to \eqref{intro:eq:dimensional} for both passive and active particles (in the sense that $0 < T < \infty$ is given) in two and three space dimensions under minimal regularity assumptions on the initial data. Moreover, our result holds for arbitrary values of the Reynolds and Deborah number. To be precise, we consider the model $(\mathcal{P})$, which is introduced in Section \ref{sec:model}. The outline of this paper is as follows: First, we complete Section \ref{sec:intro} by introducing the model $(\mathcal{P})$, which is an extension of \eqref{intro:eq:dimensional} for active particles. Then, we present some notation, function spaces, and frequently used formula in Section \ref{sec:preliminares}. To get started, we derive an entropy estimate \eqref{formal:entropy_est} for the model $(\mathcal{P})$ in Section \ref{sec:formal_entropy_estimate} on a formal level. As we want to make our computations rigorous, we present a discrete-in-time scheme $\lrcb{\mathcal{P}_{\regL}^\tau}$ (see \eqref{def:PLtau}) in Section \ref{sec:discrete_in_time_approx}, where $\tau > 0$ is a small time increment and $\text{L} > 0$ is a cut-off parameter from above. The regularization parameter $\text{L}$ is used to establish the existence of discrete-in-time solutions. Nevertheless, future bounds in energy estimates shall be independent of $\text{L}$.\\ To show the existence of a solution to $\lrcb{\mathcal{P}_{\regL}^\tau}$ in Section \ref{sec:ex_of_sols_to_PLtau}, we introduce a fixed-point scheme in Definition \ref{def:fixed_point_iteration}, prove in Lemma \ref{lmm:fixed_point_iter} that the scheme is well defined, and finally apply Schaefer's fixed-point theorem in Lemma \ref{lmm:existence_fp} to complete the proof.\\ Having established the existence of a solution to $\lrcb{\mathcal{P}_{\regL}^\tau}$, we devote Section \ref{sec:uniform_entropy_estimate} to the derivation of an entropy estimate in Lemma \ref{lmm:time_discrete_entropy} which mimics the formal estimate \eqref{formal:entropy_est}. Unfortunately, the regularity results of the entropy estimate \eqref{est:discrete_entropy} are too weak to pass to the limit in $\lrcb{\mathcal{P}_{\regL}^\tau}$ as $\tau \searrow 0$ and $\text{L} \nearrow \infty$. Moreover, testing the Smoluchowski equation with $\psi$ is fraud with difficulties to gain more regularity. However, we shall circumvent this problem by deriving an equality for the polymer number density \begin{align*} \omega(\mathbf{x}, t) := \int_{\Sph} \psi(\mathbf{x}, \mathbf{m}, t) \, \text{d}\mathscr{H}^{d-1}(\mathbf{m}) \quad \text{ for } (\mathbf{x}, t) \in \Omega \times [0,T] \end{align*} and show regularity results for $\omega$ which turn out to be very useful to improve the regularity of $\psi$ afterwards. Such a method is often applied to microscopic macroscopic models (cf. \cite{barrett_sueli_2011_polymers_I, chen_liu_2013_entropy_solution, gruen_metzger_2015microMacro}). The derivation of regularity results for the macroscopic discrete-in-time polymer number density is realized in Section \ref{sec:particle_density}.\\ Then, we establish time regularity results for $\psi$ and $\mathbf{u}$ in Section \ref{sec:time_regularity}. To pass to the limit in Section \ref{sec:passage_limit} as $\tau \searrow 0$ and $\text{L} \nearrow \infty$, we exploit our regularity results to prove strong convergence for suitable subsequences. Instead of using common results of Aubin-Lions or Simon (cf. \cite{lions1969quelques, simon1986compact}), we apply a compactness result of Dreher and J\"ungel (cf. \cite{dreher2012compact}), which relies on hypothesis on time translation and avoids the construction of linear interpolation functions in time. \subsection{Doi model for active liquid crystals} \label{sec:model} Before we extend the model for active particles, let us describe the system \eqref{intro:eq:dimensional} in more detail. The velocity field is denoted by $\mathbf{u}: \Omega \times [0,T] \to \mathbb{R}^d$, $p: \Omega \times (0,T] \to \mathbb{R}$ is the pressure, $k_B$ is the Boltzmann constant, $\mathcal{T}$ is the absolute temperature, $\ndens > 0$ is the mean number density of polymers, $D_r = \frac{k_B \mathcal{T}}{\xi_r}$ is the rotary diffusivity, $\xi_r > 0$ is the friction coefficient, $\rho > 0$ is the fluid density, $\mathscr{H}^{d-1}$ is the Hausdorff measure, and $D_\parallel > 0$ and $D_\perp > 0$ are the translational diffusion coefficients parallel and normal to the orientation of the rods. Moreover, it is always assumed that $\mathbf{m} \in {\SMat^{d-1}}$. Furthermore, $\nabla_\xflow$ and $\Div_\xflow$ denote the gradient and divergence operator with respect to $\mathbf{x} \in \Omega$. The rotational gradient operator $\sRot$ on the unit sphere is defined by $\sRot = \mathbf{m} \times \nabla_\mflow$, where $\nabla_\mflow$ is the gradient with respect to $\mathbf{m} \in {\SMat^{d-1}}$. Moreover, the chemical potential $\overline{\mu}_\psi$ is given by \begin{align} \label{def:muPsi} \overline{\mu}_\psi := k_B \mathcal{T} \entrop^\prime(\psi) + k_B \mathcal{T} \pot[\psi], \end{align} where $\mathcal{F}: \mathbb{R}_{\geq 0} \ni s \mapsto s (\log(s) - 1) + 1 \in \mathbb{R}_{\geq 0}$ is an entropy functional. The interaction potential $\overline{\pot}[\psi] : {\Omega\times\Sph}\times[0,T] \to \mathbb{R}$ modeling the effects of alignment is defined by \begin{align} \label{def:pot} \pot[\psi](\mathbf{x}, \mathbf{m}, t) := \potStr \Je{ \int_{\Sph} \psi(\cdot, \widetilde{\mflow}, t) K(\mathbf{m}, \widetilde{\mflow}) \, \text{d}\mathscr{H}^{d-1}(\widetilde{\mflow})} (\mathbf{x}) \end{align} for $(\mathbf{x}, \mathbf{m}, t) \in {\Omega\times\Sph} \times [0,T]$, where the dimensionless parameter $\potStr > 0$ denotes the strength of the interaction potential, $\mathcal{J}_{\mollEps}$ is an isotropic mollifier which is defined below, and $K(\mathbf{m}, \widetilde{\mflow})$ is an interaction kernel for $\mathbf{m}, \widetilde{\mflow} \in {\SMat^{d-1}}$ which should have small values for $\mathbf{m}$ and $\widetilde{\mflow}$ being aligned and large values otherwise. In the original Onsager model (cf. \cite{onsager1949colloidal}), the interaction kernel is given by \begin{align*} K(\mathbf{m}, \widetilde{\mflow}) = \abs{\mathbf{m} \times \widetilde{\mflow}} \quad \text{ for } \mathbf{m}, \widetilde{\mflow} \in {\SMat^{d-1}}. \end{align*} Another common choice is the Maier-Saupe kernel (cf. \cite{maier_saupe_1958}) \begin{align} \label{def:interaction_kernel} K(\mathbf{m}, \widetilde{\mflow}) := \abs{\mathbf{m} \times \widetilde{\mflow}}^2 = 1 - (\mathbf{m} \cdot \widetilde{\mflow})^2 \quad \text{ for } \mathbf{m}, \widetilde{\mflow} \in {\SMat^{d-1}}, \end{align} which has also been used by E and Zhang (cf. \cite{e_zhang_2006_kinetic}). In this paper, we restrict ourselves to the Maier-Saupe interaction kernel \eqref{def:interaction_kernel}. Moreover, the isotropic mollifier $\mathcal{J}_{\mollEps}: \L^1(\Omega) \to \mathrm{W}^{1, \infty}(\Omega)$ in \eqref{def:pot} is defined by \begin{align} \label{def:mollifier} \Je{f}(\mathbf{x}) := \int_{\Omega} \zeta_\mollEps(\mathbf{x} - \mathbf{y}) f(\mathbf{y}) \, \text{d}\mathbf{y} \quad \text{ for } f \in \L^1(\Omega), \end{align} where $\zeta_\mollEps (\mathbf{x}) := \mollEps^{-d} \zeta(\mollEps^{-1} \mathbf{x})$ for $\mathbf{x} \in \Omega$ and $\mollEps > 0$. Hereby, the nonnegative, rotationally symmetric, and compactly supported function $\zeta \in \C_0^\infty(\mathbb{R}^d)$ is given by $\zeta(\mathbf{x}) := c \exp(-\frac{1}{1 - \abs{\mathbf{x}}^2})$ if $\abs{\mathbf{x}} < 1$ and $\zeta(\mathbf{x}) = 0$ otherwise. In particular, the constant $c > 0$ is chosen such that $\int_{\mathbb{R}^d} \zeta(\mathbf{x}) \, \text{d}\xflow = 1$. Therefore, on noting a property of the mollifier (see \eqref{mollifier:fg}), we have that $\overline{\mu}_\psi$ is the first variation of the energy functional \begin{align*} \mathcal{E}(\psi)(t) &:= k_B \mathcal{T} \int_{\OmSph}\mathcal{F}(\psi)(\mathbf{x}, \mathbf{m}, t) \, \text{d}\mathscr{H}^{d-1}(\mathbf{m}) \, \text{d}\xflow \\ &\quad + \frac{ k_B \mathcal{T}}{2} \int_{\OmSph} \psi(\mathbf{x}, \mathbf{m}, t) \pot[\psi](\mathbf{x}, \mathbf{m}, t) \, \text{d}\mathscr{H}^{d-1}(\mathbf{m}) \, \text{d}\xflow \end{align*} for $t \in [0,T]$. Now, let us describe the physical interpretation of the terms in \eqref{intro:eq:dimensional} in more detail. The term on the right-hand side of \eqref{intro:eq:psi:dimensional:srot} describes the rotation of particles induced by the macroscopic velocity gradient $\nabla_\xflow \mathbf{u}$ (note \eqref{intro:eq:psi:dimensional:nablag} for the rewritten form of this term). As illustrated in Figure \ref{fig:rotated_rod}, a rod $\mathbf{m} \in {\SMat^{d-1}}$ is rotated by the gradient of a macroscopic flow $\nabla_\xflow \mathbf{u}$. However, as the rod cannot elongate and has to maintain its constant length, the rotated rod $\nabla_\xflow \mathbf{u} \mathbf{m}$ is projected onto the tangential space of the unit sphere. \begin{figure}[!htbp] \centering \begin{tikzpicture}[scale=1.0] \def\ulx{1.374} \def\uly{1.624} \def\urx{\uly} \def\ury{\ulx} \def\llx{-\urx} \def\lly{-\ury} \def\lrx{-\ulx} \def\lry{-\uly} \def\sulx{2.002} \def\suly{0.720} \def\surx{2.094} \def\sury{0.378} \def\sllx{-\surx} \def\slly{-\sury} \def\slrx{-\sulx} \def\slry{-\suly} \def\umx{\ulx/2 + \urx/2} \def\umy{\uly/2 + \ury/2} \def\lmx{\llx/2 + \lrx/2} \def\lmy{\lly/2 + \lry/2} \def\sumx{\sulx/2 + \surx/2} \def\sumy{\suly/2 + \sury/2} \def\slmx{\sllx/2 + \slrx/2} \def\slmy{\slly/2 + \slry/2} \def\mx{\ulx/4 + \urx/4 + \llx/4 + \lrx/4} \def\my{\uly/4 + \ury/4 + \lly/4 + \lry/4} \draw (\sllx, \slly) -- (\sulx, \suly) -- (\surx, \sury) -- (\slrx, \slry) -- cycle; \draw[fill=white] (\llx, \lly) -- (\ulx, \uly) -- (\urx, \ury) -- (\lrx, \lry) -- cycle; \draw[arrows={- angle 90}] (\lmx+0.1, \lmy+0.1) -- (\umx-0.1, \umy-0.1) node[pos=0.85, left=16pt, scale=0.75, rotate=45] {$\mathbf{m}$}; \draw[arrows={- angle 90}, line width=1pt] (\umx, \umy) -- (\sumx, \sumy) node[pos=0.85, below=12pt, scale=0.75, rotate=15] {$\mathbf{(\mathbb{I} - \mathbf{m}\otimes\mathbf{m})} \nabla_{\mathbf{x}}\mathbf{u}\, \mathbf{m}$}; \draw[dashed, rotate around={15:(\sumx, \sumy)}] (\sumx, \sumy) -- (\sumx + 4, \sumy); \draw[arrows={- angle 90}, line width=1pt, rotate around={-10:(\umx, \umy)}] (\umx, \umy) -- (\umx+2.5, \umy) node[pos=1.0, below=7pt, scale=0.75, rotate=15] {$\quad \nabla_{\mathbf{x}} \mathbf{u}\, \mathbf{m}$}; \node[circle,fill=black,inner sep=0pt,minimum size=3pt] at (\mx, \my) {}; \end{tikzpicture} \caption{A rod $\mathbf{m}$ is rotated by a macroscopic velocity gradient $\nabla_\xflow \mathbf{u}$.} \label{fig:rotated_rod} \end{figure} The stress tensor on the right-hand side of \eqref{intro:eq:u:dimensional} \begin{align*} \overline{\mathbb{T}} := \overline{\mathbb{T}}_{\text{visc, s}} + \overline{\mathbb{T}}_{\text{visc, p}} + \overline{\mathbb{T}}_{\text{elast}} \end{align*} is composed of viscous stresses $\overline{\mathbb{T}}_{\text{visc}} := \overline{\mathbb{T}}_{\text{visc, s}} + \overline{\mathbb{T}}_{\text{visc, p}}$ and elastic stresses $\overline{\mathbb{T}}_{\text{elast}}$. Hereby, \begin{align*} \overline{\mathbb{T}}_{\text{visc, s}} := \eta_s \lrcb{\nabla_\xflow \mathbf{u} + (\nabla_\xflow \mathbf{u})^T} \end{align*} models the viscous stresses coming from the solvent, where $\eta_s > 0$ denotes the solvent viscosity. The viscous stresses $\overline{\mathbb{T}}_{\text{visc, p}}$ are due to the friction caused by the motion of rodlike polymers. They are related to the hydrodynamic energy dissipation $W$ (cf. \cite[(8.117)]{doi1986theory}) by \begin{align} \label{intro:eq:dissip} W = \int_0^T \int_{\Omega} \nabla_\xflow\mathbf{u} : \overline{\mathbb{T}}_{\text{visc, p}} \, \text{d}\xflow\,\text{dt}. \end{align} On noting Figure \ref{fig:rotated_rod}, the velocity of a rod relative to the fluid can be computed by \begin{align*} \mathbf{u}_{\text{rod, fluid}} = (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} - \nabla_\xflow \mathbf{u} \mathbf{m} = - (\mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m}. \end{align*} Moreover, the frictional force exerted on a rod is given by \begin{align*} \mathbf{f}_{\text{rod, frict}} = \frac{ \xi_r}{2} \mathbf{u}_{\text{rod, fluid}}, \end{align*} where $\xi_r > 0$ is the friction constant. Therefore, the work done by the frictional force is calculated as \begin{align*} W &= \int_0^T \int_{\Omega} \int_{\Sph} \psi \mathbf{f}_{\text{rod, frict}} \cdot \mathbf{u}_{\text{rod, fluid}} \, \text{d}\mathscr{H}^{d-1} \, \text{d}\xflow \,\text{dt} \\ &= \frac{ \xi_r}{2} \int_0^T\int_{\Omega}\int_{\Sph} \psi \lrcb{ \nabla_\xflow \mathbf{u} : \mflow\otimes\mflow }^2 \, \text{d}\mathscr{H}^{d-1}(\mathbf{m})\, \text{d}\xflow\,\text{dt}. \end{align*} Hence, on noting \eqref{intro:eq:dissip}, we have that \begin{align} \label{eq:viscous_stress_p} \overline{\mathbb{T}}_{\text{visc, p}} = \frac{ \xi_r}{2} \int_{\Sph} \psi (\nabla_\xflow \mathbf{u} : \mflow\otimes\mflow) \mflow\otimes\mflow \, \text{d}\mathscr{H}^{d-1}(\mathbf{m}). \end{align} The body force term (the first term on the right-hand side of \eqref{intro:eq:u:dimensional}) and the elastic stress tensor $\overline{\mathbb{T}}_{\text{elast}}$ are related to the change in energy of $\mathcal{E}(\psi)$. In particular, they are inevitable for thermodynamic consistency and they have been derived by a virtual work principle (cf. \cite[Chapter 8.6]{doi1986theory}, \cite[p. 185f]{e_zhang_2006_kinetic}) resulting in an elastic stress tensor given by \begin{align*} \overline{\mathbb{T}}_{\text{elast}} := - \int_{\Sph} \psi \lrcb{\mathbf{m} \times \sRot \overline{\mu}_\psi} \otimes \mathbf{m} \, \text{d}\mathscr{H}^{d-1}(\mathbf{m}). \end{align*} In our opinion, it is more convenient to work with the surface gradient operator $\nabla_\surfaceLtr$ and the surface divergence operator $\Div_\surfaceLtr$ on ${\SMat^{d-1}}$ instead of $\sRot$. Noting $\sRot = \mathbf{m} \times \nabla_\mflow$ and $\nabla_\surfaceLtr = (\mathbb{I} - \mflow\otimes\mflow) \nabla_\mflow$, we see that \eqref{intro:eq:psi:dimensional:srot} can equivalently be written as \begin{align} \label{intro:eq:psi:dimensional:nablag} \begin{split} &\partial_t \psi + \Div_\xflow(\mathbf{u} \psi) - \frac{1}{ k_B \mathcal{T}} \Div_\xflow\lrcb{ \psi\lrcb{ D_\parallel \mflow\otimes\mflow + D_\perp (\mathbb{I} - \mflow\otimes\mflow) }\nabla_\xflow \overline{\mu}_\psi } \\ &\quad - \frac{D_r}{ k_B \mathcal{T}} \Div_\surfaceLtr\lrcb{ \psi \nabla_\surfaceLtr \overline{\mu}_\psi } = - \Div_\surfaceLtr\lrcb{ \psi (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} } \quad \text{ in } {\Omega\times\Sph}\times(0,T] \end{split} \end{align} and that the elastic stress tensor can be rewritten as \begin{equation} \label{intro:eq:stress_sRot_divg} \begin{aligned} \overline{\mathbb{T}}_{\text{elast}} &= - \int_{\Sph} \psi (\mathbf{m} \times \sRot \overline{\mu}_\psi) \otimes \mathbf{m} \, \text{d}\mathscr{H}^{d-1}(\mathbf{m}) \\ &= \int_{\Sph} \psi \left[ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\surfaceLtr \overline{\mu}_\psi \right] \otimes \mathbf{m} \, \text{d}\mathscr{H}^{d-1}(\mathbf{m}) . \end{aligned} \end{equation} Now, let us come back to active liquid crystals which are systems that are far from equilibrium (cf. \cite{gao2017activeNematics}). The range of active nematic systems includes cytoskeletal filaments (cf. \cite{kierfeld2008active}), bacteria (cf. \cite{darnton2010swarming}), dense suspensions of microswimmers (cf. \cite{wensink2012livingFluids}), and microtubule bundles (cf. \cite{sanchez2012spontaneous}). Instead of modeling passive particles, we now consider active rodlike polymers which induce active stresses described by an additional stress tensor $\overline{\mathbb{T}}_{\text{act}}$. Following the lines in \cite{gao2017analytical}, we model this stress tensor: We assume that each rod induces a symmetric surface flow (see Figure \ref{fig:active_flow}, Figure \ref{fig:rod}) \begin{align*} \mathbf{u}_{\text{act}}(s) := \text{sgn}(s) u_\text{act} \mathbf{m}, \quad - \frac{l}{2} \leq s \leq \frac{l}{2}, \end{align*} where $u_\text{act}$ is the signed surface flow speed, $\mathbf{m}$ is the unit orientation vector of the rod, and $\text{sgn}(\cdot)$ is the sign function. \begin{figure}[!htbp] \centering \begin{tikzpicture}[scale=1.0] \def\mx{0} \def\my{0} \def3/4{3/4} \def6*\b{6*3/4} \def20pt{20pt} \def\eps{2pt} \draw [|-|] (\mx - 6*\b/2, \my) -- (\mx, \my) node[pos=0, below, scale=0.75] {$\mathbf{x} - \frac{l}{2}$} node[pos=1, below=3pt, scale=0.75] {$\mathbf{x}$}; \draw [|-|] (\mx, \my) -- (\mx + 6*\b/2, \my) node[pos=1, below, scale=0.75] {$\mathbf{x} + \frac{l}{2}$}; \draw [->, line width=1pt, red] (\mx - \eps, \my - 20pt) -- (\mx - 6*\b/2, \my - 20pt) node[pos=0.5, below=3pt, scale=0.75] {$- u_\text{act}\, \mathbf{m}$}; \draw [->, line width=1pt, red] (\mx + \eps, \my - 20pt) -- (\mx + 6*\b/2, \my - 20pt) node[pos=0.5, below=3pt, scale=0.75] {$u_\text{act}\, \mathbf{m}$}; \draw[arrows={- triangle 90}, line width=1pt, blue] (\mx - 6*\b/2, \my + 20pt*3/4) -- (\mx + 6*\b/2, \my + 20pt*3/4) node[pos=0.5, above=3pt, scale=0.75] {$\mathbf{m}$}; \end{tikzpicture} \caption{Symmetric surface flow induces by an active rod.} \label{fig:active_flow} \end{figure} Hereby, a rod produces an extensional straining flow along itself for $u_\text{act} > 0$ and a compressive one otherwise. Moreover, let us describe the position of a rod by its centerline $\mathbf{X}(s) := \mathbf{x} + s \mathbf{m}$, $-\frac{l}{2} \leq s \leq \frac{l}{2}$, where $\mathbf{x}$ denotes the center of mass of a rod (see Figure \ref{fig:rod}). Then, the active stress caused by a single rod can be computed as follows on assuming that $\mathbf{x} = 0$ (cf. \cite{gao2017analytical, saintillan2013nonlinear}): \begin{align*} \overline{\mathbb{T}}_{\text{act, rod}} &= - \frac{4 \pi \eta}{\abs{\log(e r^2)}} \int_{-\frac{l}{2}}^{\frac{l}{2}} \mathbf{u}_{\text{act}}(s) \otimes \mathbf{X}(s) \,\text{d}s \\ &= - \frac{\pi \eta u_\text{act} l^2}{\abs{\log(e r^2)}} \mflow\otimes\mflow, \end{align*} where $\eta := \eta_s + \eta_p > 0$ is the total viscosity, $\eta_p := \nu \xi_r$ is the polymer viscosity, $e := \exp(1)$, and $r = \frac{b}{l}$ (see Figure \ref{fig:rod}). Hence, the active stress tensor due to the activity of the rodlike polymers is given by \begin{align} \label{intro:def:Tact_dimensional} \overline{\mathbb{T}}_{\text{act}} = - \frac{\pi \eta u_\text{act} l^2}{\abs{\log(e r^2)}} \int_{\Sph} \psi \lrcb{ \mflow\otimes\mflow - \frac{1}{d}\mathbb{I} } \, \text{d}\mathscr{H}^{d-1}(\mathbf{m}), \end{align} where the subtraction \eqref{intro:def:Tact_dimensional} modifies solely the pressure and has no influence on the flow. In particular, the modification in \eqref{intro:def:Tact_dimensional} is equivalent to subtracting the trace of the tensor to make it traceless.\\ It will turn out, note for example the formal energy estimate \eqref{formal:entropy_est}, that the additional active stresses may be seen as an internal source of energy as the thermodynamic equilibrium does not hold any longer in the sense that the total energy at a time $t_2 > t_1$ equals the total energy at time $t_1$ when there is no work done by external forces. This can be explained by the ability of active liquid crystals to convert energy from the local environment to mechanical work (cf. \cite{gao2017activeNematics}).\\ Next, to derive the model in nondimensionalised form, we follow the lines in \cite{e_zhang_2006_kinetic}: Let $L_0 > 0$ be a typical size of the flow region, $V_0 > 0$ the typical velocity scale, and $T_0 := \frac{L_0}{V_0}$ a typical convective time scale. Moreover, we scale the pseudo probability density $\psi$ by $\frac{1}{\nu}$, where $\nu > 0$ is the mean number density. We introduce the Deborah number, which is defined by the ratio of the orientational diffusion time scale of the rods and the convective time scale of the fluid, given by \begin{align*} \DE := \frac{ \frac{\xi_r}{k_B \mathcal{T}} }{\frac{L_0}{V_0}} = \frac{\xi_r V_0}{k_B \mathcal{T} L_0}. \end{align*} Moreover, we note that $\eta_p = \ndens \xi_r$, $\eta = \eta_s + \eta_p > 0$ and set $\viscFrac := \frac{\eta_s}{\eta} \in (0,1)$. Then, the Reynolds number is defined by \begin{align*} \RE := \frac{\rho V_0 L_0}{\eta}. \end{align*} Furthermore, we set $\mollEps := \frac{l}{L_0} > 0$, where $l>0$ denotes the length of rods (see Figure \ref{fig:rod}). We define the dimensionless translational diffusion parameters by \begin{align*} \hat{D}_\parallel := \frac{\xi_r}{l^2 k_B \mathcal{T}} D_\parallel \ \text{ and } \ \hat{D}_\perp := \frac{\xi_r}{l^2 k_B \mathcal{T}} D_\perp. \end{align*} It usually holds that $\hat{D}_\parallel > \hat{D}_\perp > 0$ (\cite[p. 296f]{doi1986theory}) and in most of the cases one has that $\hat{D}_\parallel = 2 \hat{D}_\perp$ (\cite[p. 296f]{doi1986theory}). From an analytical point of view, it is important that the tensor \begin{align*} \hat{D}_\parallel \mflow\otimes\mflow + \hat{D}_\perp (\mathbb{I} - \mflow\otimes\mflow) = \hat{D}_\perp \mathbb{I} + (\hat{D}_\parallel - \hat{D}_\perp) \mflow\otimes\mflow \end{align*} is symmetric and positive definite, which is true if $\hat{D}_\parallel \geq \hat{D}_\perp > 0$. Hence, we set $\hat{D}_\parallel = \hat{D}_\perp = 1$ for ease of notation in this paper. On noting \eqref{intro:def:Tact_dimensional}, we introduce the dimensionless activity parameter \begin{align*} \activity := - \frac{\pi \eta l^2 u_\text{act}}{\abs{\log(e r^2)} k_B \mathcal{T}}. \end{align*} Thus, the active model in nondimensionalised form (without relabelling $\psi$, $\mathbf{u}$, $p$, $\mathbf{x}$, and $t$ for ease of notation) reads as follows:\\ \hspace*{2ex}Given $T > 0$, find $\mathbf{u}: \Omega \times [0,T] \ni (\mathbf{x}, t) \mapsto \mathbf{u}(\mathbf{x}, t) \in \mathbb{R}^d$,\\ \hspace*{2ex}$p: \Omega \times (0,T] \ni (\mathbf{x}, t) \mapsto p(\mathbf{x}, t) \in \mathbb{R}$,\\ \hspace*{2ex}and $\psi: {\Omega\times\Sph}\times[0,T] \ni (\mathbf{x}, \mathbf{m}, t) \mapsto \psi(\mathbf{x}, \mathbf{m}, t) \in \mathbb{R}$ such that \begin{subequations} \label{eq:active:stokes} \begin{alignat}{3} \partial_t \mathbf{u} + (\mathbf{u} \cdot \nabla_\xflow)\mathbf{u} + \nabla_\xflow p &= - \frac{1 - \viscFrac}{\RE\DE} \int_{\Sph} \psi \nabla_\xflow \muPsi \, \text{d}\mathscr{H}^{d-1} \label{eq:active:u} \\ &\quad + \Div_\xflow(\mathbb{T}) \quad && \text{in } \Omega \times (0,T], \nonumber \\ \Div_\xflow(\mathbf{u}) &= 0 \quad &&\text{in } \Omega \times (0,T], \label{eq:active:divu} \\ \mathbf{u} &= 0 \quad &&\text{on } \partial\Omega \times (0,T], \label{eq:active:bc:u} \\ \mathbf{u}(\mathbf{x}, 0) &= \mathbf{u}_0(\mathbf{x}) \quad &&\forall \mathbf{x} \in \Omega \label{eq:active:init:u} \end{alignat} \end{subequations} and \begin{subequations} \label{eq:active:smoluchowski} \begin{align} & \partial_t \psi + \mathbf{u} \cdot \nabla_\xflow \psi - \frac{\mollEps^2}{\DE} \Div_\xflow (\psi \nabla_\xflow \muPsi) - \frac{1}{\DE} \Div_\surfaceLtr \lrcb{ \psi \nabla_\surfaceLtr \muPsi } \nonumber \\ &\quad = - \Div_\surfaceLtr \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} \psi } \qquad \text{in } \Omega \times {\SMat^{d-1}} \times (0,T], \label{eq:active:psi} \\ &\muPsi := \entrop^\prime(\psi) + \pot[\psi] \qquad\qquad\qquad\qquad\ \ \, \text{in } \Omega \times {\SMat^{d-1}} \times (0,T], \label{eq:active:muPsi}\\ &\psi \nabla_\xflow \muPsi \cdot \nx = 0 \qquad\qquad\qquad\qquad\qquad\ \, \text{on } \partial \Omega \times {\SMat^{d-1}} \times (0,T], \label{eq:active:bc:psi} \\ &\psi(\mathbf{x}, \mathbf{m}, 0) = \psi_0(\mathbf{x}, \mathbf{m}) \qquad\qquad\qquad\quad\ \ \ \forall (\mathbf{x}, \mathbf{m}) \in {\Omega\times\Sph}, \label{eq:active:init:psi} \end{align} \end{subequations} where $\nx : \partial\Omega \to \mathbb{R}^d$ denotes the outward normal to $\partial\Omega$ and the stress tensor in the Navier-Stokes type equation is given by \begin{align*} \mathbb{T} := \mathbb{T}_{\text{visc, s}} + \mathbb{T}_{\text{visc, p}} + \mathbb{T}_{\text{elast}} + \mathbb{T}_{\text{act}} \end{align*} with \begin{align*} \mathbb{T}_{\text{visc, s}} &:= \frac{\viscFrac}{\RE} \lrcb{\nabla_\xflow \mathbf{u} + (\nabla_\xflow \mathbf{u})^T}, \\ \mathbb{T}_{\text{visc, p}} &:= \frac{1 - \viscFrac}{2 \RE} \int_{\Sph} \psi (\nabla_\xflow \mathbf{u} : \mflow\otimes\mflow) \mflow\otimes\mflow \, \text{d}\mathscr{H}^{d-1}(\mathbf{m}), \\ \mathbb{T}_{\text{elast}} &:= \frac{1 - \viscFrac}{\RE\DE} \int_{\Sph} \psi \left[ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\surfaceLtr \muPsi \right] \otimes \mathbf{m} \, \text{d}\mathscr{H}^{d-1}(\mathbf{m}), \\ \mathbb{T}_{\text{act}} &:= \frac{\activity(1 - \viscFrac)}{\RE\DE} \int_{\Sph} \psi \lrcb{\mflow\otimes\mflow - \frac{1}{d}\mathbb{I}} \, \text{d}\mathscr{H}^{d-1}(\mathbf{m}). \end{align*} The initial data $\mathbf{u}_0$ and $\psi_0$ will be specified later. \begin{defi} The coupled problem \eqref{eq:active:stokes} - \eqref{eq:active:smoluchowski} will be referred to as model $(\mathcal{P})$ throughout this paper. We call this model passive if $\alpha = 0$ and active if $\alpha \neq 0$. \end{defi} \begin{rmrk} As $\activity$ has the opposite sign of $u_\text{act}$, contractile stress is modeled by $\activity > 0$ and extensile stress by $\activity < 0$. \end{rmrk} \section{Preliminaries} \label{sec:preliminares} \subsection{Notation} We denote the real numbers by $\mathbb{R}$, the natural numbers by $\mathbb{N} := \{1, 2, \dots \}$ and set $\mathbb{N}_0 := \mathbb{N} \cup \{0\}$. In particular, we define $\mathbb{R}_{\geq 0} := [0, \infty)$ and $\mathbb{R}_{>0} := (0, \infty)$. Moreover, we introduce the following scalar products: For $\mathbf{v}, \mathbf{w} \in \mathbb{R}^d$ and $\mathbb{A}, \mathbb{B} \in \mathbb{R}^{d \times d}$, we define $\mathbf{v} \cdot \mathbf{w} := \sum_{i=1}^d \mathbf{v}_i \mathbf{w}_i$ and $\mathbb{A} : \mathbb{B} := \sum_{i,j=1}^d \mathbb{A}_{ij} \mathbb{B}_{ij}$. The trace of a tensor $\mathbb{A} \in \mathbb{R}^{d \times d}$ is given by $\tr{\mathbb{A}} := \sum_{i=1}^d \mathbb{A}_{ii}$. The notation $\abs{\cdot}$ is used as follows: For a real number $a \in \mathbb{R}$, we set $\abs{a}$ to the absolute value of $a$, whereas $\abs{\mathbf{v}} := (\mathbf{v} \cdot \mathbf{v})^{1/2}$ and $\abs{\mathbb{A}} := (\mathbb{A} : \mathbb{A})^{1/2}$ for $\mathbf{v} \in \mathbb{R}^d$ and $\mathbb{A} \in \mathbb{R}^{d \times d}$. Moreover, we set $\abs{U}$ to the $d$-dimensional Lebesgue measure of a measurable set $U \subset \mathbb{R}^d$. For $\mathbf{v}, \mathbf{w} \in \mathbb{R}^d$, we define $\mathbf{v} \otimes \mathbf{w} := ( \mathbf{v}_i \mathbf{w}_j )_{1 \leq i,j \leq d}$. We introduce the positive part $\pos{a}$ and the negative part $\negat{a}$ of a real number $a \in \mathbb{R}$ by $[a]_{\pm} := \frac{1}{2}(a \pm \abs{a})$. For ease of notation, we write $\dH$ instead of $\text{d}\mathscr{H}^{d-1}$ in integrals for the Hausdorff measure. The isotropic mollifier $\mathcal{J}_{\mollEps}: \L^1(\Omega) \to \mathrm{W}^{1, \infty}(\Omega)$ (cf. \eqref{def:mollifier}) is naturally extended to the tensor valued mollifier $\mathbb{J}_{\mollEps}: \mathbb{L}^1(\Omega) \to \mathbb{W}^{1, \infty}(\Omega)$. The velocity gradient is defined by $(\nabla_\xflow \mathbf{u})_{1 \leq i,j \leq d} = (\partial_{\mathbf{x}_j} \mathbf{u}_i)$ for a differentiable function $\mathbf{u} : \Omega \to \mathbb{R}^d$. Moreover, we introduce the divergence of a differentiable function $\mathbb{A} : \Omega \to \mathbb{R}^{d \times d}$ by \begin{align*} \Div_\xflow(\mathbb{A}) := \lrcb{ \sum_{j=1}^d \partial_{\mathbf{x}_j} \mathbb{A}_{ij}}_{i=1}^d. \end{align*} \subsection{Function spaces} We use the standard notation for Lebesgue and Sobolev spaces and define $\mathbf{L}^p(\Omega) := \L^p(\Omega; \mathbb{R}^d)$, $\mathbf{W}^{k, p}(\Omega) := \mathrm{W}^{k,p}(\Omega; \mathbb{R}^d)$, $\mathbf{H}^k(\Omega) := \mathbf{W}^{k, 2}($ $\Omega)$, $\mathbb{L}^p(\Omega) := \L^p(\Omega; \mathbb{R}^{d \times d})$, $\mathbb{W}^{k,p}(\Omega)$ $:=$ $\mathrm{W}^{k,p}(\Omega;$ $ \mathbb{R}^{d \times d})$, and $\mathbb{H}^k(\Omega) := \mathbb{W}^{k, 2}(\Omega)$ for $1 \leq p \leq \infty$ and $k \in \mathbb{N}$. Moreover, we introduce the spaces \begin{align*} \Hflow_{0,\text{div}}^1(\Omega) &:= \left\{ \mathbf{w} \in \mathbf{H}_0^1(\Omega):\ \Div_\xflow(\mathbf{w}) = 0 \right\}, \\ \Ldivp{2} &:= \left\{ \mathbf{w} \in \mathbf{L}^2(\Omega):\ \int_{\Omega} \mathbf{w} \cdot \nabla_\xflow \varphi \, \text{d}\xflow = 0 \quad \forall \varphi \in \H^1(\Omega) \right\}, \\ \mathscr{V} &:= \left\{ \mathbf{w} \in \mathbf{C}_0^\infty(\Omega):\ \Div_\xflow(\mathbf{w}) = 0 \right\}, \\ \Vk{k} &:= \overline{\mathscr{V}}^{\norm{\cdot}_{\mathbf{H}_0^1(\Omega) \cap \mathbf{H}^k(\Omega)}},\ k \in \mathbb{N}. \end{align*} We note that it holds that $\Vk{1} = \Hflow_{0,\text{div}}^1(\Omega)$ (cf. Temam \cite[Chapter 1, Theorem 1.6]{temam1977navierNumerics}). An introduction to Sobolev spaces $\mathrm{W}^{k,p}({\SMat^{d-1}})$ on the sphere can be found in \cite{kufner1977functionSpaces}. Furthermore, we define the dual spaces of $\mathrm{W}^{k,p}(\Omega \times {\SMat^{d-1}})$ and $\Vk{k}$ by $(\mathrm{W}^{k,p}(\Omega \times {\SMat^{d-1}}))^\prime$ and $(\Vk{k})^\prime$, respectively. It will turn out useful to introduce the space \begin{align*} \Zp{p} := \left\{ \theta \in \LpOS{p}:\ \theta \geq 0 \text{ a.e. in } {\Omega\times\Sph} \right\} \quad \forall 1 \leq p < \infty. \end{align*} \subsection{Frequently used formula} Let us note some results which will be often referred to in future discussions. \begin{lmm} Let the isotropic mollifier $\mathcal{J}_{\mollEps}: \L^1(\Omega) \to \mathrm{W}^{1, \infty}(\Omega)$ be defined by \eqref{def:mollifier}. Then, it holds that \begin{subequations} \begin{alignat}{2} \norm{ \Je{f} }_{\L^2(\Omega)} &\leq \norm{f}_{\L^2(\Omega)} \quad &&\forall f \in \L^2(\Omega), \label{mollifier:L2_stab}\\ \int_{\Omega} \Je{f} g \, \text{d}\xflow &= \int_{\Omega} f \Je{g} \, \text{d}\xflow \quad &&\forall f,g \in \L^2(\Omega), \label{mollifier:fg}\\ \norm{\Je{f}}_{\mathrm{W}^{1,\infty}(\Omega)} &\leq \overline{\C}_\mollEps \norm{f}_{\L^1(\Omega)} \quad &&\forall f \in \L^1(\Omega). \label{mollifier:W_2_infty} \end{alignat} \end{subequations} Moreover, similar results hold for the tensor valued mollifier $\mathbb{J}_{\mollEps}$. \end{lmm} Furthermore, we will exploit the following formula on the unit sphere (cf. \cite[Lemma 2.1, Lemma 1.1]{chen_liu_2013_entropy_solution}): \begin{lmm} Let $\mathbf{v} \in \mathbf{H}^1({\SMat^{d-1}})$ and $f, g \in \H^1({\SMat^{d-1}})$. Then, it holds that \begin{subequations} \begin{align} \int_{\Sph} \Div_\surfaceLtr(\mathbf{v}) f \dH &= - \int_{\Sph} \mathbf{v} \cdot \nabla_\surfaceLtr f \dH + (d - 1) \int_{\Sph} (\mathbf{v} \cdot \mathbf{m}) f \dH(\mflow), \label{eq:pInt:divg} \\ \int_{\Sph} (\Delta_\surfaceLtr f) g \dH &= - \int_{\Sph} \nabla_\surfaceLtr f \cdot \nabla_\surfaceLtr g \dH. \label{eq:pInt:nablag} \end{align} \end{subequations} \end{lmm} \begin{lmm} Let $f \in \mathrm{W}^{1,1}({\SMat^{d-1}})$ and $\mathbb{A} \in \R^{\text{d}\times \text{d}}$ be a constant matrix with $\tr{\mathbb{A}} = 0$. Then, it holds that \begin{align} \label{eq:chen_stress_formula} \int_{\Sph} \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \mathbb{A} \mathbf{m} } \cdot \nabla_\surfaceLtr f \dH(\mflow) = \int_{\Sph} f (d \mflow\otimes\mflow - \mathbb{I}) : \mathbb{A} \dH(\mflow). \end{align} \end{lmm} Moreover, the following lemma is frequently used, which follows directly from $\nabla_\surfaceLtr = (\mathbb{I} - \mflow\otimes\mflow) \nabla_\mflow$, $(\mathbf{m} \cdot \widetilde{\mflow})^2 = (\mflow\otimes\mflow) : (\widetilde{\mflow} \otimes \widetilde{\mflow})$ for $\mathbf{m}, \widetilde{\mflow} \in {\SMat^{d-1}}$, and \eqref{def:pot}. \begin{lmm} \label{lmm:nablag_g_pot_formula} It holds that \begin{align} \label{eq:nabla_g_pot_formula} \nabla_\surfaceLtr \pot[\theta](\mathbf{x}, \mathbf{m}) = - 2 \potStr (\mathbb{I} - \mflow\otimes\mflow) \JeMat{ \int_{\Sph} \theta(\cdot, \widetilde{\mflow}) \widetilde{\mflow} \otimes \widetilde{\mflow} \dH(\widetilde{\mflow}) } (\mathbf{x}) \mathbf{m} \end{align} for all $\theta \in \LpOS{1}$ for $(\mathbf{x}, \mathbf{m}) \in {\Omega\times\Sph}$. \end{lmm} \subsection{Formal entropy estimate} \label{sec:formal_entropy_estimate} Now, let us derive an entropy estimate on a formal level which exploits the energetic and entropic structure of the model $(\mathcal{P})$. First, assuming that $\psi > 0$, multiplying \eqref{eq:active:psi} by $\muPsi$, integrating over ${\Omega\times\Sph}$, integrating by parts in $\Omega$ and on ${\SMat^{d-1}}$ (see \eqref{eq:pInt:divg} and \eqref{eq:pInt:nablag}), and noting \eqref{eq:active:divu}-\eqref{eq:active:bc:u}, \eqref{eq:active:bc:psi}, and \eqref{mollifier:fg}, we have that \begin{align} \label{formal:psi:muPsi} \begin{split} &\frac{\text{d}}{\,\text{dt}} \int_{\OmSph} \left[ \mathcal{F}(\psi) + \frac{1}{2} \psi \pot[\psi] \right] \dH\, \text{d}\xflow \\ &\qquad + \frac{\mollEps^2}{\DE} \int_{\OmSph} \psi \abs{\nabla_\xflow \muPsi}^2 \dH\, \text{d}\xflow + \frac{1}{\DE} \int_{\OmSph} \psi \abs{\nabla_\surfaceLtr \muPsi}^2 \dH\, \text{d}\xflow \\ &\quad = - \int_{\OmSph} \mathbf{u} \cdot \nabla_\xflow \psi \pot[\psi] \dH\, \text{d}\xflow \\ &\qquad + \int_{\OmSph} \psi \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow\mathbf{u} \mathbf{m} } \cdot \nabla_\surfaceLtr \muPsi \dH(\mflow)\, \text{d}\xflow. \end{split} \end{align} Next, multiplying \eqref{eq:active:u} by $\mathbf{u}$, integrating over $\Omega$, noting \eqref{eq:active:divu} and \eqref{eq:active:bc:u} and some integration by parts yield \begin{align*} &\frac{1}{2} \frac{\text{d}}{\,\text{dt}} \int_{\Omega} \abs{\mathbf{u}}^2 \, \text{d}\xflow + \frac{\viscFrac}{\RE} \int_{\Omega} \abs{\nabla_\xflow \mathbf{u}}^2 \, \text{d}\xflow \\ &\qquad + \frac{1 - \viscFrac}{2 \RE} \int_{\OmSph} \psi \lrcb{ \nabla_\xflow \mathbf{u} : \mflow\otimes\mflow }^2 \dH(\mflow)\, \text{d}\xflow \\ &\quad= - \frac{1 - \viscFrac}{\RE\DE} \int_{\OmSph} \psi \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} } \cdot \nabla_\surfaceLtr \muPsi \dH(\mflow)\, \text{d}\xflow \\ &\quad\quad + \frac{1 - \viscFrac}{\RE\DE} \int_{\OmSph} \mathbf{u} \cdot \nabla_\xflow \psi \pot[\psi] \dH\, \text{d}\xflow \numberthis[formal:u:u] \\ &\quad\quad - \frac{\alpha (1 - \viscFrac)}{\RE \DE} \int_{\OmSph} \psi \nabla_\xflow \mathbf{u} : \mflow\otimes\mflow \dH(\mflow)\, \text{d}\xflow, \end{align*} where we used that \begin{align} \label{formal:stress_formula} \begin{split} &\int_{\OmSph} \psi \nabla_\xflow\mathbf{u} : \lrcb{ \left[ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\surfaceLtr \muPsi \right] \otimes \mathbf{m} } \dH(\mflow)\, \text{d}\xflow \\ &\quad = \int_{\OmSph} \psi \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m}} \cdot \nabla_\surfaceLtr \muPsi \dH(\mflow)\, \text{d}\xflow. \end{split} \end{align} Now, we infer from multiplying \eqref{formal:psi:muPsi} by $\frac{1-\viscFrac}{\RE\DE}$, combining \eqref{formal:psi:muPsi} - \eqref{formal:u:u}, and applying Young's inequality that \begin{align*} &\frac{1}{2} \frac{\text{d}}{\,\text{dt}} \int_{\Omega} \abs{\mathbf{u}}^2 \, \text{d}\xflow + \frac{\viscFrac}{\RE} \int_{\Omega} \abs{\nabla_\xflow \mathbf{u}}^2 \, \text{d}\xflow \\ &\qquad + \frac{1 - \viscFrac}{2 \RE} \int_{\OmSph} \psi \lrcb{\nabla_\xflow\mathbf{u} : \mflow\otimes\mflow}^2 \dH(\mflow)\, \text{d}\xflow \\ &\qquad + \frac{1 - \viscFrac}{\RE\DE} \frac{\text{d}}{\,\text{dt}} \int_{\OmSph} \left[ \mathcal{F}(\psi) + \frac{1}{2}\psi\pot[\psi] \right] \dH\, \text{d}\xflow \\ &\qquad + \frac{1 - \viscFrac}{\RE\DE} \lrcb{ \frac{\mollEps^2}{\DE} \int_{\OmSph} \psi \abs{\nabla_\xflow \muPsi}^2 \dH\, \text{d}\xflow + \frac{1}{\DE} \int_{\OmSph} \psi \abs{\nabla_\surfaceLtr \muPsi}^2 \dH\, \text{d}\xflow } \\ &\quad= - \frac{\alpha (1 - \viscFrac)}{\RE \DE} \int_{\OmSph} \psi \nabla_\xflow \mathbf{u} : \mflow\otimes\mflow \dH(\mflow)\, \text{d}\xflow \numberthis[formal:summarize_1] \\ &\quad\leq \frac{1 - \viscFrac}{4\RE} \int_{\OmSph} \psi \lrcb{\nabla_\xflow\mathbf{u} : \mflow\otimes\mflow}^2 \dH(\mflow)\, \text{d}\xflow + \frac{\alpha^2 (1 - \viscFrac)}{\RE \DE^2} \int_{\OmSph} \psi \dH\, \text{d}\xflow. \end{align*} Furthermore, to deal with the last term in \eqref{formal:summarize_1}, we obtain from \eqref{eq:active:divu}-\eqref{eq:active:bc:u}, \eqref{eq:active:bc:psi}, \eqref{eq:pInt:divg}, and integrating \eqref{eq:active:psi} over ${\Omega\times\Sph}$ that \begin{align} \label{formal:mass_conserv} \int_{\OmSph} \psi(\mathbf{x}, \mathbf{m}, t) \dH(\mflow)\, \text{d}\xflow = \int_{\OmSph} \psi_0(\mathbf{x}, \mathbf{m}) \dH(\mflow)\, \text{d}\xflow \end{align} for $t \in (0, T]$. Therefore, we conclude from \eqref{formal:summarize_1} and \eqref{formal:mass_conserv} that \begin{align*} &\frac{\text{d}}{\,\text{dt}} \left[ \frac{1}{2} \int_{\Omega} \abs{\mathbf{u}}^2 \, \text{d}\xflow + \frac{1 - \viscFrac}{\RE\DE} \int_{\OmSph} \left[ \mathcal{F}(\psi) + \frac{1}{2}\psi\pot[\psi] \right] \dH\, \text{d}\xflow \right] \\ &\quad + \frac{\viscFrac}{\RE} \int_{\Omega} \abs{\nabla_\xflow \mathbf{u}}^2 \, \text{d}\xflow + \frac{1 - \viscFrac}{4\RE} \int_{\OmSph} \psi \lrcb{\nabla_\xflow\mathbf{u} : \mflow\otimes\mflow}^2 \dH(\mflow)\, \text{d}\xflow \\ &\quad + \frac{1 - \viscFrac}{\RE\DE} \lrcb{ \frac{\mollEps^2}{\DE} \int_{\OmSph} \psi \abs{\nabla_\xflow \muPsi}^2 \dH\, \text{d}\xflow + \frac{1}{\DE} \int_{\OmSph} \psi \abs{\nabla_\surfaceLtr \muPsi}^2 \dH\, \text{d}\xflow } \\ &\leq \frac{\alpha^2 (1 - \viscFrac)}{\RE \DE^2} \int_{\OmSph} \psi_0 \dH\, \text{d}\xflow. \numberthis[formal:entropy_est] \end{align*} We note that there is no need for an absorption argument in \eqref{formal:summarize_1} in the passive case as the right-hand sides vanishes for $\activity = 0$. \section{Discrete-in-time approximations} \label{sec:discrete_in_time_approx} To make the formal computations in Section \ref{sec:formal_entropy_estimate} rigorous, we introduce the following regularization functions: For any $\text{L} > 1$, we define \begin{subequations} \label{def:regularizations} \begin{align} \begin{split} \label{def:regL} \entrop^\regL(s) &:= \begin{cases} \mathcal{F}(s) \equiv s (\log(s) - 1) + 1 \quad & \text{ for } 0 \leq s \leq \text{L}, \\ \frac{s^2 - \text{L}^2}{2 \text{L}} + s(\log(\text{L}) - 1) + 1 \quad & \text{ for } \text{L}\leq s, \end{cases} \end{split} \\ \begin{split} \label{def:QL} \text{Q}^\regL(s) &:= \begin{cases} s \quad & \text{ for } s \leq \text{L}, \\ \text{L} \quad & \text{ for } \text{L} \leq s, \end{cases} \end{split} \\ \begin{split} \label{def:QZL} \text{Q}_0^\regL(s) &:= \max\{ 0,\ \text{Q}^\regL(s) \} \quad \text{ for } s \in \mathbb{R}. \end{split} \end{align} \end{subequations} Furthermore, we note that the regularization functions satisfy the following properties (cf. Chen and Liu \cite{chen_liu_2013_entropy_solution} and Barrett and S\"uli \cite{barrett_sueli_2011_polymers_I, barrett_sueli_2011_polymers_II}): \begin{subequations} \label{reg:props} \begin{alignat}{2} \text{Q}^\regL \in \C^{0,1}(\mathbb{R}),\quad \entrop^\regL &\in \C^{2,1}(\mathbb{R}_{>0}) \cap \C(\mathbb{R}_{\geq 0}), \\ \entrop^\regL & \text{ is convex on } [0, \infty), \quad && \label{reg:F_cvx} \\ \entrop^\regL(s) & \geq \mathcal{F}(s) \quad && \forall s \geq 0, \label{reg:FL_geq_F} \\ \entrop^\regL\lrcb{\text{Q}^\regL(s) + \delta} & \leq \delta + \frac{\delta^2}{2} + \mathcal{F}(s + \delta) \quad && \forall \delta \in (0,1), \forall s \geq 0, \label{reg:FLQL_leq_FL} \\ \lrcb{\entropL}^{\prime\prime}(s) &= \lrcb{\text{Q}^\regL(s)}^{-1} \geq \frac{1}{s} \quad &&\forall s > 0, \label{reg:ddFL_geq} \\ \entrop^{\prime\prime}(s + \delta) & \leq \frac{1}{\delta} \quad && \forall \delta \in (0,1),\ \forall s \geq 0, \label{reg:ddFL_leq} \\ \entrop^\regL(s) &\geq \frac{s^2}{4\text{L}} - C(\text{L}) \quad && \forall s \geq 0, \label{reg:FL_geq_ss} \\ \abs{\text{Q}_0^\regL(s)} &\leq \abs{\text{Q}^\regL(s)} \leq \abs{s} \quad && \forall s \in \mathbb{R}. \label{reg:QL_leq} \end{alignat} \end{subequations} \textit{\textbf{Assumptions on the initial data and the domain.}} We assume the domain and the initial data to satisfy \begin{subequations} \label{assumptions:domain_init_data} \begin{align} \begin{split} \label{eq:domain} & \Omega \subset \mathbb{R}^d \text{ is an open bounded Lipschitz domain},\quad d \in \{ 2, 3\}, \end{split}\\ \begin{split} \label{init:psi_0} & \psi_0 \in \L^2(\Omega; \L^1({\SMat^{d-1}})), \quad \psi_0 \geq 0 \text{ a.e. in } {\Omega\times\Sph} \\ & \qquad \text{ with } \mathcal{F}(\psi_0) \in \LpOS{1}, \end{split}\\ \begin{split} \label{init:u_0} \mathbf{u}_0 \in \Ldivp{2}. \end{split} \end{align} \end{subequations} Let a time $T > 0$ and a number of time steps $N \in \mathbb{N}$ be given. Then, we define a time increment $\tau > 0$ by $\tau := \frac{T}{N}$ and $t_n := n \tau$ for $n \in \{0, \dots, N\}$. Moreover, we define the initial velocity $\uL{0} \in \Hflow_{0,\text{div}}^1(\Omega)$ for our discrete-in-time scheme as the weak solution of \begin{align} \label{init:def:u_L_0} \int_{\Omega} \left[ \uL{0} \cdot \mathbf{w} + \text{L}^{-1} \nabla_\xflow \uL{0} : \nabla_\xflow \mathbf{w} \right] \, \text{d}\xflow = \int_{\Omega} \mathbf{u}_0 \cdot \mathbf{w} \, \text{d}\xflow \quad \forall \mathbf{w} \in \Hflow_{0,\text{div}}^1(\Omega). \end{align} We deduce from \eqref{init:def:u_L_0} that \begin{align} \label{init:regularity_u_L_0} \int_{\Omega} \left[ \abs{\uL{0}}^2 + \text{L}^{-1} \abs{\nabla_\xflow \uL{0}}^2 \right] \, \text{d}\xflow \leq \int_{\Omega} \abs{\mathbf{u}_0}^2 \, \text{d}\xflow \leq C < \infty, \end{align} where $C > 0$ is independent of $\tau$ and $\text{L}$. Furthermore, we set \begin{align} \label{init:def:psi_L_0} \psiL{0} := \text{Q}^\regL(\psi_0) \in \Zp{2}. \end{align} In particular, we infer from \eqref{init:psi_0}, \eqref{init:def:psi_L_0}, and \eqref{reg:QL_leq} that \begin{align} \label{init:regularity_psi_L_0} \int_{\OmSph} \psiL{0} \dH\, \text{d}\xflow \leq \int_{\OmSph} \psi_0 \dH\, \text{d}\xflow \leq C < \infty, \end{align} where $C>0$ is independent of $\tau$ and $\text{L}$. Moreover, we obtain from the definition of the interaction potential \eqref{def:pot}, the nonnegativity of the Maier-Saupe interaction kernel \eqref{def:interaction_kernel}, \eqref{init:psi_0}, \eqref{init:def:psi_L_0}, \eqref{reg:QL_leq}, \eqref{mollifier:L2_stab}, and H\"older's inequality that \begin{align*} &\int_{\OmSph} \psiL{0} \pot[\psiL{0}] \dH\, \text{d}\xflow \\ &\quad\leq C(\potStr, d) \int_{\Omega} \lrcb{ \int_{\Sph} \psi_0(\mathbf{x}, \mathbf{m}) \dH(\mflow) }^2 \, \text{d}\xflow \leq C < \infty, \numberthis[init:psi_0_pot_0] \end{align*} where $C > 0$ is independent of $\tau$ and $\text{L}$. Our discrete-in-time problem $\lrcb{\mathcal{P}_{\regL}^\tau}$ reads as follows:\\ \hspace*{3ex} $\lrcb{\mathcal{P}_{\regL}^\tau}$ Let $\uL{0} \in \Hflow_{0,\text{div}}^1(\Omega)$ and $\psiL{0} \in \Zp{2}$ be given by \eqref{init:def:u_L_0} and \eqref{init:def:psi_L_0}, respectively. Then, for $n \in \{1, \dots, N\}$, given $(\uL{n-1}, \psiL{n-1})$ $\in$ $\Hflow_{0,\text{div}}^1(\Omega) \times \Zp{2}$, find $(\uL{n}, \psiL{n})$ $\in$ $\Hflow_{0,\text{div}}^1(\Omega) \times (\HkOS{1} \cap \Zp{2})$ such that, for all $\mathbf{w} \in \Hflow_{0,\text{div}}^1(\Omega)$ and $\theta \in \H^1(\Omega \times {\SMat^{d-1}})$, \begin{subequations} \label{def:PLtau} \begin{align} \begin{split} \label{eq:PLtau:u} & \RE \DE \int_{\Omega} \frac{\uL{n} - \uL{n-1}}{\tau} \cdot \mathbf{w} \, \text{d}\xflow + \RE \DE \int_{\Omega} \lrcb{ (\uL{n-1} \cdot \nabla_\xflow) \uL{n} } \cdot \mathbf{w} \, \text{d}\xflow \\ &\qquad + \viscFrac \DE \int_{\Omega} \nabla_\xflow \uL{n} : \nabla_\xflow \mathbf{w} \, \text{d}\xflow \\ &\qquad + \frac{(1 - \viscFrac) \DE}{2} \int_{\OmSph} \text{Q}_0^\regL(\psiL{n}) (\nabla_\xflow \uL{n} : \mflow\otimes\mflow) (\nabla_\xflow \mathbf{w} : \mflow\otimes\mflow) \dH(\mflow) \, \text{d}\xflow \\ &\quad = - (1 - \viscFrac) \int_{\OmSph} \psiL{n} \nabla_\xflow \potL{n} \cdot \mathbf{w} \dH\, \text{d}\xflow \\ &\quad \quad - (1 - \viscFrac) \int_{\OmSph} \text{Q}_0^\regL(\psiL{n}) \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{w} \mathbf{m} } \cdot \nabla_\surfaceLtr \potL{n} \dH(\mflow)\, \text{d}\xflow \\ &\quad \quad - (1 - \viscFrac) \int_{\OmSph} \psiL{n} (d\mflow\otimes\mflow - \mathbb{I}) : \nabla_\xflow \mathbf{w} \dH(\mflow)\, \text{d}\xflow \\ &\quad \quad - \activity(1 - \viscFrac) \int_{\OmSph} \text{Q}_0^\regL(\psiL{n}) \mflow\otimes\mflow : \nabla_\xflow \mathbf{w} \dH(\mflow)\, \text{d}\xflow, \end{split} \\ \begin{split} \label{eq:PLtau:psi} &\int_{\OmSph} \frac{\psiL{n} - \psiL{n-1}}{\tau} \theta \dH\, \text{d}\xflow - \int_{\OmSph} \psiL{n} \uL{n} \cdot \nabla_\xflow \theta \dH\, \text{d}\xflow \\ &\quad + \frac{1}{\DE} \int_{\OmSph} \left[ \mollEps^2 \nabla_\xflow \psiL{n} \cdot \nabla_\xflow \theta + \nabla_\surfaceLtr \psiL{n} \cdot \nabla_\surfaceLtr \theta \right] \dH\, \text{d}\xflow \\ &\quad + \frac{1}{\DE} \int_{\OmSph} \left[ \mollEps^2 \text{Q}_0^\regL(\psiL{n}) \nabla_\xflow \potL{n} \cdot \nabla_\xflow \theta + \text{Q}_0^\regL(\psiL{n}) \nabla_\surfaceLtr \potL{n} \cdot \nabla_\surfaceLtr \theta \right] \dH\, \text{d}\xflow \\ &\quad - \int_{\OmSph} \text{Q}_0^\regL(\psiL{n}) \lrcb{(\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \uL{n} \mathbf{m}} \cdot \nabla_\surfaceLtr \theta \dH(\mflow)\, \text{d}\xflow = 0. \end{split} \end{align} \end{subequations} \begin{rmrk} \begin{enumerate} \item[i)] On noting \eqref{formal:stress_formula} and \eqref{eq:chen_stress_formula}, the elastic stress tensor in the Navier-Stokes equation can be rewritten as \begin{align*} & \int_{\OmSph} \Div_\xflow \lrcb{ \psi \left[ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\surfaceLtr \muPsi \right] \otimes \mathbf{m} } \cdot \mathbf{w} \dH(\mflow)\, \text{d}\xflow \\ &\quad = - \int_{\OmSph} \psi \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{w} \mathbf{m} } \cdot \nabla_\surfaceLtr \muPsi \dH(\mflow)\, \text{d}\xflow \\ &\quad = - \int_{\OmSph} \psi (d \mflow\otimes\mflow - \mathbb{I}) : \nabla_\xflow \mathbf{w} \dH(\mflow)\, \text{d}\xflow \numberthis[rmrk:stress_tensor] \\ &\quad \qquad - \int_{\OmSph} \psi \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{w} \mathbf{m} } \cdot \nabla_\surfaceLtr \pot[\psi] \dH(\mflow)\, \text{d}\xflow \end{align*} for all $\mathbf{w} \in \Hflow_{0,\text{div}}^1(\Omega)$. \item[ii)] For reasons of readability, we use the abbreviation \begin{align} \label{def:potL} \potL{n} := \frac{1}{2} \pot\left[ \psiL{n} + \psiL{n-1} \right] \qquad \text{ for } n \in \{1, \dots, N\}. \end{align} \end{enumerate} \end{rmrk} \subsection{Existence of solutions to \texorpdfstring{$\lrcb{\mathcal{P}_{\regL}^\tau}$}{}} \label{sec:ex_of_sols_to_PLtau} In this section, our goal is to prove the existence of a solution $(\uL{n}, \psiL{n})$ $\in$ $\Hflow_{0,\text{div}}^1(\Omega) \times (\HkOS{1} \cap \Zp{2})$ to $\lrcb{\mathcal{P}_{\regL}^\tau}$ by applying Schaefer's fixed-point theorem (cf. Evans \cite{evans2010pdes}). First of all, we prove a lemma which will be used very frequently. \begin{lmm} Let $\theta \in \L^1({\Omega\times\Sph})$. Then, it holds that \begin{align} \label{est:nabla_pot_Linfty} \norm{\pot[\theta]}_{\mathrm{W}^{1, \infty}({\Omega\times\Sph})} \leq C(\overline{\C}_\mollEps, \potStr, d) \norm{\theta}_{\L^1({\Omega\times\Sph})}, \end{align} where $\overline{\C}_\mollEps > 0$ is the constant in \eqref{mollifier:W_2_infty}. \end{lmm} \begin{proof} On noting the definition of the interaction potential \eqref{def:pot} and $(\mathbf{m} \cdot \widetilde{\mflow})^2 = \mflow\otimes\mflow : \widetilde{\mflow} \otimes \widetilde{\mflow}$ for $\mathbf{m}, \widetilde{\mflow} \in {\SMat^{d-1}}$, we have that \begin{align*} \pot[\theta](\mathbf{x}, \mathbf{m}) &= \potStr \int_{\Sph} \Je{\theta(\cdot, \widetilde{\mflow})}(\mathbf{x}) \lrcb{1 - (\mathbf{m} \cdot \widetilde{\mflow})^2} \dH(\widetilde{\mflow}) \\ &= \potStr \Je{ \int_{\Sph} \theta(\cdot, \widetilde{\mflow}) \dH(\widetilde{\mflow}) }(\mathbf{x}) \\ &\quad - \potStr \JeMat{ \int_{\Sph} \theta(\cdot, \widetilde{\mflow}) \widetilde{\mflow} \otimes \widetilde{\mflow} \dH(\widetilde{\mflow}) }(\mathbf{x}) : (\mflow\otimes\mflow) \end{align*} for $(\mathbf{x}, \mathbf{m}) \in {\Omega\times\Sph}$. Hence, we infer from \eqref{mollifier:W_2_infty} that \begin{align*} &\norm{\pot[\theta]}_{\LpOS{\infty}} + \norm{\nabla_\xflow \pot[\theta]}_{\L^\infty({\Omega\times\Sph})} \\ &\quad\leq C(\overline{\C}_\mollEps, \potStr) \norm{\theta}_{\LpOS{1}} + C(\overline{\C}_\mollEps, \potStr, d) \int_{\OmSph} \abs{\theta(\mathbf{x}, \widetilde{\mflow})} \abs{\widetilde{\mflow} \otimes \widetilde{\mflow}} \dH(\widetilde{\mflow})\, \text{d}\xflow \\ &\quad\leq C(\overline{\C}_\mollEps, \potStr, d) \norm{\theta}_{\LpOS{1}}. \end{align*} Furthermore, we infer from \eqref{mollifier:W_2_infty} and \eqref{eq:nabla_g_pot_formula} that \begin{align*} \norm{ \nabla_\surfaceLtr \pot[\theta] }_{\L^\infty({\Omega\times\Sph})} &\quad\leq C(d) \potStr \esssup_{\mathbf{x} \in \Omega} \abs{ \JeMat{ \int_{\Sph} \theta(\cdot, \widetilde{\mflow}) \widetilde{\mflow} \otimes \widetilde{\mflow} \dH(\widetilde{\mflow}) } (\mathbf{x}) } \\ &\quad\leq C(\overline{\C}_\mollEps, \potStr, d) \norm{\theta}_{\L^1({\Omega\times\Sph})}. \end{align*} \end{proof} \textit{\textbf{Fixed-point iteration.}} To introduce our fixed-point scheme, we rewrite \eqref{eq:PLtau:u} as \begin{align} \label{fp:eq:a} a(\psiL{n})(\uL{n}, \mathbf{w}) = k(\psiL{n})(\mathbf{w}) \quad \forall \mathbf{w} \in \Hflow_{0,\text{div}}^1(\Omega), \end{align} where \begin{align} \label{fp:def:a} \begin{split} &a(\overline{\psi})(\mathbf{u}, \mathbf{w})\\ &\quad:= \RE \DE \int_{\Omega} \mathbf{u} \cdot \mathbf{w} \, \text{d}\xflow + \tau \RE \DE \int_{\Omega} \lrcb{ (\uL{n-1} \cdot \nabla_\xflow) \mathbf{u} } \cdot \mathbf{w} \, \text{d}\xflow \\ &\quad\quad + \tau \viscFrac \DE \int_{\Omega} \nabla_\xflow \mathbf{u} : \nabla_\xflow \mathbf{w} \, \text{d}\xflow \\ &\quad\quad + \tau \frac{(1-\viscFrac) \DE}{2} \int_{\OmSph} \text{Q}_0^\regL(\overline{\psi}) (\nabla_\xflow \mathbf{u} : \mflow\otimes\mflow) (\nabla_\xflow \mathbf{w} : \mflow\otimes\mflow) \dH(\mflow) \, \text{d}\xflow \end{split} \end{align} and \begin{align} \label{fp:def:k} \begin{split} &k(\overline{\psi})(\mathbf{w})\\ &\quad:= \RE \DE \int_{\Omega} \uL{n-1} \cdot \mathbf{w} \, \text{d}\xflow - \tau \frac{1 - \viscFrac}{2} \int_{\OmSph} \overline{\psi} \nabla_\xflow \pot\left[\overline{\psi} + \psiL{n-1}\right] \cdot \mathbf{w} \dH\, \text{d}\xflow \\ &\quad\quad - \tau \frac{1 - \viscFrac}{2} \int_{\OmSph} \text{Q}_0^\regL(\overline{\psi}) \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{w} \mathbf{m} } \cdot \nabla_\surfaceLtr \pot\left[\overline{\psi} + \psiL{n-1}\right] \dH(\mflow)\, \text{d}\xflow \\ &\quad\quad - \tau (1 - \viscFrac) \int_{\OmSph} \overline{\psi} (d\mflow\otimes\mflow - \mathbb{I}) : \nabla_\xflow \mathbf{w} \dH(\mflow)\, \text{d}\xflow \\ &\quad\quad - \tau \activity (1 - \viscFrac) \int_{\OmSph} \text{Q}_0^\regL(\overline{\psi}) \mflow\otimes\mflow : \nabla_\xflow \mathbf{w} \dH(\mflow)\, \text{d}\xflow \end{split} \end{align} for all $\mathbf{u}, \mathbf{w} \in \Hflow_{0,\text{div}}^1(\Omega)$ and for all $\overline{\psi} \in \L^2({\Omega\times\Sph})$. Moreover, we rewrite \eqref{eq:PLtau:psi} as \begin{align} \label{fp:eq:b} \begin{split} b(\uL{n})(\psiL{n}, \theta) = l(\uL{n}, \psiL{n})(\theta) \qquad \forall \theta \in \HkOS{1}, \end{split} \end{align} where \begin{align} \label{fp:def:b} \begin{split} b(\mathbf{u})(\psi, \theta) &:= \int_{\OmSph} \psi \theta \dH\, \text{d}\xflow - \tau \int_{\OmSph} \psi \mathbf{u} \cdot \nabla_\xflow \theta \dH\, \text{d}\xflow \\ &\quad + \frac{\tau}{\DE} \int_{\OmSph} \left[ \mollEps^2 \nabla_\xflow \psi \cdot \nabla_\xflow \theta + \nabla_\surfaceLtr \psi \cdot \nabla_\surfaceLtr \theta \right] \dH\, \text{d}\xflow \end{split} \end{align} and \begin{align} \label{fp:def:l} \begin{split} l(\mathbf{u}, \overline{\psi})(\theta) &:= \int_{\OmSph} \psiL{n-1} \theta \dH\, \text{d}\xflow \\ &\quad - \frac{\tau}{2 \DE} \int_{\OmSph} \mollEps^2 \text{Q}_0^\regL(\overline{\psi}) \nabla_\xflow \pot\left[\overline{\psi} + \psiL{n-1}\right] \cdot \nabla_\xflow \theta \dH\, \text{d}\xflow \\ &\quad - \frac{\tau}{2 \DE} \int_{\OmSph} \text{Q}_0^\regL(\overline{\psi}) \nabla_\surfaceLtr \pot\left[\overline{\psi} + \psiL{n-1}\right] \cdot \nabla_\surfaceLtr \theta \dH\, \text{d}\xflow \\ &\quad + \tau \int_{\OmSph} \text{Q}_0^\regL(\overline{\psi}) \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} } \cdot \nabla_\surfaceLtr \theta \dH(\mflow)\, \text{d}\xflow \end{split} \end{align} for all $\psi, \theta \in \HkOS{1}$ and for all $\overline{\psi} \in \LpOS{2}$, $\mathbf{u} \in \Hflow_{0,\text{div}}^1(\Omega)$. \begin{lmm} \label{lmm:fixed_point_iter} Suppose that the assumptions \eqref{assumptions:domain_init_data} hold and let $\overline{\psi} \in \L^2({\Omega\times\Sph})$. \begin{enumerate} \item[i)] There exists a unique $\mathbf{u} \in \Hflow_{0,\text{div}}^1(\Omega)$ such that \begin{align} \label{fp:iteration:i} a(\overline{\psi})(\mathbf{u}, \mathbf{w}) = k(\overline{\psi})(\mathbf{w}) \quad \forall \mathbf{w} \in \Hflow_{0,\text{div}}^1(\Omega). \end{align} \item[ii)] Now, let $\mathbf{u} \in \Hflow_{0,\text{div}}^1(\Omega)$ be the unique solution to \eqref{fp:iteration:i}. Then, there exists a unique $\psi$ $\in$ $\HkOS{1}$ such that \begin{align} \label{fp:iteration:ii} b(\mathbf{u})(\psi, \theta) = l(\mathbf{u}, \overline{\psi})(\theta) \quad \forall \theta \in \HkOS{1}. \end{align} \item[iii)] Moreover, solutions to \eqref{fp:iteration:i} and \eqref{fp:iteration:ii} satisfy \begin{align} \label{fp:iteration:iii:u} \begin{split} &\DE\, \min\{ \RE, \tau\viscFrac \} \norm{\mathbf{u}}_{\H^1(\Omega)} \\ &\quad \leq C \lrcb{ 1 + \tau \text{L} + \tau \text{L} \norm{\overline{\psi}}_{\LpOS{2}} + \tau \norm{\overline{\psi}}_{\LpOS{2}}^2 }, \end{split} \end{align} where $C = C(\RE, \DE, \uL{n-1}, \overline{\C}_\mollEps, \potStr, d, \viscFrac, \activity, \psiL{n-1}) > 0$ and \begin{align} \label{fp:iteration:iii:psi} \begin{split} &\min\left\{ 1, \frac{\tau}{\DE}, \frac{\tau \mollEps^2}{\DE} \right\} \norm{\psi}_{\HkOS{1}} \\ &\quad \leq C \lrcb{ 1 + \tau \text{L} + \tau \text{L} \norm{\overline{\psi}}_{\LpOS{1}} + \tau \text{L} \norm{\nabla_\xflow \mathbf{u}}_{\L^2(\Omega)} }, \end{split} \end{align} where $C = C(\psiL{n-1}, \overline{\C}_\mollEps, \potStr, d, \mollEps, \DE^{-1}) > 0$. \end{enumerate} \end{lmm} \begin{defi}[Fixed-point iteration] \label{def:fixed_point_iteration} We define the operator $\Xi: \LpOS{2} \to \LpOS{2}$ as follows: For given $\overline{\psi} \in \LpOS{2}$, we introduce $\Xi[\overline{\psi}] \in \H^1(\Omega \times {\SMat^{d-1}})$ as the solution of the variational problem \eqref{fp:iteration:ii}, where $\mathbf{u} \in \Hflow_{0,\text{div}}^1(\Omega)$ is the solution of the variational problem \eqref{fp:iteration:i}. \end{defi} \begin{rmrk} We infer from Lemma \ref{lmm:fixed_point_iter} that the operator $\Xi$ defined in Definition \ref{def:fixed_point_iteration} is well defined. Clearly, if $\psi \in \HkOS{1}$ is a fixed-point of $\Xi$, then the tuple $(\uL{n}, \psiL{n})$ $:=$ $(\mathbf{u}, \psi)$ is a solution to \eqref{def:PLtau}. Hence, proving the existence of a fixed-point of $\Xi$ is equivalent to proving the existence of a solution to \eqref{def:PLtau}. \end{rmrk} \begin{proof}[Proof of Lemma \ref{lmm:fixed_point_iter}] Let $\overline{\psi} \in \L^2({\Omega\times\Sph})$.\\ \textit{Proof of i).} For all $\mathbf{u} \in \Hflow_{0,\text{div}}^1(\Omega)$, on noting \begin{align*} \int_{\Omega} \lrcb{ (\uL{n-1} \cdot \nabla_\xflow) \mathbf{u} } \cdot \mathbf{u} \, \text{d}\xflow = 0, \end{align*} we have that \begin{align} \label{fp:a_coercive} \begin{split} a(\overline{\psi})(\mathbf{u}, \mathbf{u}) \geq \DE \, \min\{ \RE, \tau \viscFrac \} \norm{\mathbf{u}}_{\H^1(\Omega)}^2. \end{split} \end{align} Moreover, we infer from $\H^1(\Omega) \hookrightarrow \mathbf{L}^6(\Omega)$ that, for all $\mathbf{u}, \mathbf{w} \in \Hflow_{0,\text{div}}^1(\Omega)$, \begin{align} \label{fp:a_bounded} \begin{split} \abs{a(\overline{\psi})(\mathbf{u}, \mathbf{w})} \leq C\lrcb{ \tau, \RE, \DE, \gamma, d, \uL{n-1}, \text{L} } \norm{\mathbf{u}}_{\H^1(\Omega)} \norm{\mathbf{w}}_{\H^1(\Omega)}. \end{split} \end{align} Furthermore, we obtain from \eqref{reg:QL_leq} and \eqref{est:nabla_pot_Linfty} that \begin{align} \label{fp:k_bounded} \begin{split} \abs{k(\overline{\psi})(\mathbf{w})} \leq C \lrcb{1 + \tau \text{L} + \tau \norm{\overline{\psi}}_{\LpOS{2}}^2 + \tau\text{L} \norm{\overline{\psi}}_{\LpOS{2}}} \norm{\mathbf{w}}_{\H^1(\Omega)}, \end{split} \end{align} where $C = C \lrcb{ \RE, \DE, \uL{n-1}, \overline{\C}_\mollEps, \potStr, d, \viscFrac, \activity, \psiL{n-1} } > 0$ and $\overline{\C}_\mollEps > 0$ is the constant in \eqref{mollifier:W_2_infty}. We conclude from \eqref{fp:a_coercive}-\eqref{fp:a_bounded} that $a(\overline{\psi})(\cdot, \cdot)$ is a bounded, coercive bilinear form on $\Hflow_{0,\text{div}}^1(\Omega) \times \Hflow_{0,\text{div}}^1(\Omega)$ and from \eqref{fp:k_bounded} that $k(\overline{\psi})(\cdot) \in (\Hflow_{0,\text{div}}^1(\Omega))^\prime$. Hence, we obtain from Lax-Milgram's theorem the existence of a unique solution $\mathbf{u} \in \Hflow_{0,\text{div}}^1(\Omega)$ to \eqref{fp:iteration:i}. \textit{Proof of ii).} Let $\mathbf{u} \in \Hflow_{0,\text{div}}^1(\Omega)$ be the unique solution to \eqref{fp:iteration:i}. For all $\psi \in \H^1(\Omega \times {\SMat^{d-1}})$, on noting \begin{align*} \int_{\OmSph} \psi \mathbf{u} \cdot \nabla_\xflow \psi \dH\, \text{d}\xflow = \int_{\OmSph} \frac{1}{2} \mathbf{u} \cdot \nabla_\xflow (\psi^2) \dH\, \text{d}\xflow = 0, \end{align*} we have that \begin{align} \label{fp:b_coercive} \begin{split} b(\mathbf{u})(\psi, \psi) \geq \min \left\{ 1, \frac{\tau}{\DE}, \frac{\tau}{\DE}\mollEps^2 \right\} \norm{\psi}_{\HkOS{1}}^2. \end{split} \end{align} Furthermore, we infer from $\HkOS{1} \hookrightarrow \LpOS{3}$ that \begin{align} \label{fp:b_bounded} \begin{split} \abs{b(\mathbf{u})(\psi, \theta)} \leq \lrcb{ 1 + \frac{\tau}{\DE} + \frac{\tau}{\DE}\mollEps^2 + C(d) \tau \norm{\mathbf{u}}_{\L^6(\Omega)} } \norm{\psi}_{\HkOS{1}} \norm{\theta}_{\HkOS{1}} \end{split} \end{align} for all $\psi, \theta \in$ $\H^1(\Omega$ $\times{\SMat^{d-1}})$. Moreover, we obtain from \eqref{est:nabla_pot_Linfty} that \begin{align} \label{fp:l_bounded} \begin{split} \abs{l(\mathbf{u}, \overline{\psi})(\theta)} \leq C \Big( 1 + \tau \text{L} + \tau \text{L} \norm{\overline{\psi}}_{\LpOS{1}} + \tau \text{L} \norm{\nabla_\xflow \mathbf{u}}_{\L^2(\Omega)} \Big) \norm{\theta}_{\HkOS{1}}, \end{split} \end{align} where $C = C(\psiL{n-1}, \overline{\C}_\mollEps, \potStr, d, \mollEps, \DE^{-1}) > 0$. Consequently, on noting \eqref{fp:b_coercive}-\eqref{fp:l_bounded}, it follows that $b(\mathbf{u})(\cdot, \cdot)$ is a bounded, coercive bilinear form on $\H^1(\Omega \times {\SMat^{d-1}})$ $\times$ $\HkOS{1}$ and that $l(\mathbf{u}, \overline{\psi})(\cdot)$ $\in$ $\lrcb{\HkOS{1}}^\prime$. Hence, applying Lax-Milgram's theorem completes the proof of \textit{ii)}. \textit{Proof of iii).} On noting \eqref{fp:a_coercive}, \eqref{fp:k_bounded}, \eqref{fp:b_coercive}, and \eqref{fp:l_bounded}, it follows immediately that \eqref{fp:iteration:iii:u} and \eqref{fp:iteration:iii:psi} hold. \end{proof} As proving the existence of a fixed-point of $\Xi$ is equivalent to proving the existence of a solution to \eqref{def:PLtau}, let us show the following lemma: \begin{lmm}[Existence of a fixed-point] \label{lmm:existence_fp} Suppose that the assumptions \eqref{assumptions:domain_init_data} hold. Then, the operator $\Xi: \LpOS{2} \to \LpOS{2}$ has a fixed-point. \end{lmm} \begin{proof} The idea to prove this lemma is applying Schaefer's fixed-point theorem (cf. Evans \cite{evans2010pdes}). Before doing so however we need to verify the following three conditions: \begin{enumerate} \item[i)] $\Xi: \LpOS{2} \to \LpOS{2}$ is continuous. \item[ii)] $\Xi: \LpOS{2} \to \LpOS{2}$ is compact. \item[iii)] The set \begin{align*} \left\{ \psi \in \LpOS{2}:\ \psi = \lambda \Xi(\psi) \text{ for some } 0 < \lambda \leq 1 \right\} \end{align*} is bounded in $\LpOS{2}$. \end{enumerate} \textit{Proof of i).} Let $\psi, \psi_k \in \LpOS{2}$, $k \in \mathbb{N}$, such that \begin{subequations} \begin{align} \begin{split} \label{fp:ex:i:cvg:psiov_k} \psi_k \to \psi \quad \text{ in } \LpOS{2} \text{ as } k \to \infty. \end{split} \end{align} \end{subequations} Our goal is to show that \begin{align} \label{fp:ex:i:goal} \Xi[\psi_k] \to \Xi[\psi] \quad \text{ in } \LpOS{2} \text{ as } k \to \infty. \end{align} First, we infer from Lemma \ref{lmm:fixed_point_iter} and the definition of $\Xi$ that there exist unique $\mathbf{u}, \mathbf{u}_k$ $\in$ $\Hflow_{0,\text{div}}^1(\Omega)$, $k \in \mathbb{N}$, such that \begin{subequations} \begin{alignat}{2} a(\psi)(\mathbf{u}, \mathbf{w}) &= k(\psi)(\mathbf{w}) \quad && \forall \mathbf{w} \in \Hflow_{0,\text{div}}^1(\Omega), \label{fp:ex:i:a_u}\\ a(\psi_k)(\mathbf{u}_k, \mathbf{w}) &= k(\psi_k)(\mathbf{w}) \quad && \forall \mathbf{w} \in \Hflow_{0,\text{div}}^1(\Omega),\ \forall k \in \mathbb{N}, \label{fp:ex:i:a_uk}\\ b(\mathbf{u})(\Xi[\psi], \theta) &= l(\mathbf{u}, \psi)(\theta) \quad && \forall \theta \in \HkOS{1}, \label{fp:ex:i:b_psi}\\ b(\mathbf{u}_k)(\Xi[\psi_k], \theta) &= l(\mathbf{u}_k, \psi_k)(\theta) \quad && \forall \theta \in \HkOS{1},\ \forall k \in \mathbb{N}. \label{fp:ex:i:b_psi_k} \end{alignat} \end{subequations} Now, let us derive uniform bounds on $\{\Xi[\psi_k]\}_{k \in \mathbb{N}}$ in $\HkOS{1}$ and on $\{ \mathbf{u}_k \}_{k \in \mathbb{N}}$ in $\Hflow_{0,\text{div}}^1(\Omega)$ to extract converging subsequences in appropriate spaces. Taking $\theta := \Xi[\psi_k]$ $\in$ $\HkOS{1}$ as a test function in \eqref{fp:ex:i:b_psi_k} and applying \eqref{fp:iteration:iii:psi}, we have that \begin{align} \label{fp:ex:i:psi_k_bound_2} \norm{\Xi[\psi_k]}_{\HkOS{1}} \leq C \lrcb{ 1 + \norm{\psi_k}_{\LpOS{1}} + \norm{\nabla_\xflow \mathbf{u}_k}_{\L^2(\Omega)} }, \end{align} where $C = C\lrcb{ \psiL{n-1}, \overline{\C}_\mollEps, \potStr, d, \text{L}, \tau, \tau^{-1}, \DE, \DE^{-1}, \mollEps, \mollEps^{-1} } > 0$. So far, we do not control the right-hand side of \eqref{fp:ex:i:psi_k_bound_2}. Consequently, it remains to derive uniform bounds on $\{ \mathbf{u}_k \}_{k \in \mathbb{N}}$ in $\Hflow_{0,\text{div}}^1(\Omega)$. Taking $\mathbf{w} := \mathbf{u}_k$ $\in$ $\Hflow_{0,\text{div}}^1(\Omega)$ as a test function in \eqref{fp:ex:i:a_uk}, we deduce from \eqref{fp:iteration:iii:u} that \begin{align} \label{fp:ex:i:uk_bound_1} \begin{split} &\DE \, \min \left\{ \RE, \tau \viscFrac \right\} \norm{\mathbf{u}_k}_{\H^1(\Omega)}^2 \\ &\quad \leq C \lrcb{1 + \norm{\psi_k}_{\LpOS{2}} + \norm{\psi_k}_{\LpOS{2}}^2} \norm{\mathbf{u}_k}_{\H^1(\Omega)}, \end{split} \end{align} where $C = C(\RE, \DE, \uL{n-1}, \overline{\C}_\mollEps, \potStr, d, \tau, \viscFrac, \text{L}, \activity, \psiL{n-1}) > 0$. Moreover, we obtain from \eqref{fp:ex:i:cvg:psiov_k} that there exists a constant $C > 0$ independent of $k$ such that \begin{align} \label{fp:ex:i:psiovk_bound} \norm{\psi_k}_{\LpOS{2}} \leq C \quad \forall k \in \mathbb{N}. \end{align} Therefore, we deduce from \eqref{fp:ex:i:uk_bound_1} and \eqref{fp:ex:i:psiovk_bound} that \begin{align} \label{fp:ex:i:uk_bound_2} \norm{\mathbf{u}_k}_{\H^1(\Omega)} \leq C, \end{align} where $C = C\lrcb{ \RE, \RE^{-1}, \DE, \DE^{-1}, \viscFrac, \viscFrac^{-1}, \tau, \tau^{-1}, \uL{n-1}, \overline{\C}_\mollEps, \potStr, d, \text{L}, \activity, \psiL{n-1} } > 0$ is independent of $k$. Hence, inserting \eqref{fp:ex:i:psiovk_bound} and \eqref{fp:ex:i:uk_bound_2} in \eqref{fp:ex:i:psi_k_bound_2} yields \begin{align} \label{fp:ex:i:psi_k_bound_3} \norm{\Xi[\psi_k]}_{\HkOS{1}} \leq C, \end{align} where $C = C\lrcb{ \uL{n-1}, \psiL{n-1}, \RE, \RE^{-1}, \DE, \DE^{-1}, \tau, \tau^{-1}, \viscFrac, \viscFrac^{-1}, \mollEps, \mollEps^{-1}, \overline{\C}_\mollEps, \text{L}, \activity, \potStr, d } > 0$ is independent of $k$. Therefore, on noting \eqref{fp:ex:i:uk_bound_2}, \eqref{fp:ex:i:psi_k_bound_3}, the Lipschitz continuity of $\text{Q}_0^\regL$, and the compact embeddings \begin{align*} \HkOS{1} \hookrightarrow \hookrightarrow \LpOS{2} \quad \text{ and } \quad \Hflow_{0,\text{div}}^1(\Omega) \hookrightarrow \hookrightarrow \mathbf{L}^2(\Omega), \end{align*} we deduce that there exists a subsequence $\{ \mathbf{u}_{k_i}, \Xi[\psi_{k_i}] \}_{i \in \mathbb{N}}$ of $\{ \mathbf{u}_k, \Xi[\psi_k] \}_{k \in \mathbb{N}}$ and functions $\hat{\uflow} \in \Hflow_{0,\text{div}}^1(\Omega)$ and $\hat{\psi} \in \HkOS{1}$ such that \begin{subequations} \begin{alignat}{2} \Xi[\psi_{k_i}] &\to \hat{\psi} \quad &&\text{ strongly in } \LpOS{2}, \label{fp:ex:i:cvg:psi_ki_strong} \\ \Xi[\psi_{k_i}] &\rightharpoonup \hat{\psi} \quad &&\text{ weakly in } \HkOS{1}, \label{fp:ex:i:cvg:psi_ki_weak}\\ \text{Q}_0^\regL(\psi_{k_i}) &\to \text{Q}_0^\regL(\psi) \quad &&\text{ strongly in } \LpOS{2}, \label{fp:ex:i:cvg:QZL_psiov_ki}\\ \mathbf{u}_{k_i} & \to \hat{\uflow} \quad &&\text{ strongly in } \mathbf{L}^2(\Omega), \label{fp:ex:i:cvg:u_ki_strong}\\ \mathbf{u}_{k_i} & \rightharpoonup \hat{\uflow} \quad &&\text{ weakly in } \Hflow_{0,\text{div}}^1(\Omega) \label{fp:ex:i:cvg:u_ki_weak} \end{alignat} \end{subequations} as $i \to \infty$. In particular, we infer from \eqref{est:nabla_pot_Linfty} and $\psi_{k_i} \to \psi$ strongly in $\LpOS{2}$ that \begin{align} \label{fp:ex:i:cvg:pot_psiov_ki} \pot[\psi_{k_i}] \to \pot[\psi] \quad \text{ strongly in } \mathrm{W}^{1, \infty}({\Omega\times\Sph}) \text{ as } i \to \infty. \end{align} Moreover, we obtain from \eqref{fp:ex:i:a_uk} that \begin{align} \label{fp:ex:i:a_uki} a(\psi_{k_i})(\mathbf{u}_{k_i}, \mathbf{w}) = k(\psi_{k_i})(\mathbf{w}) \quad \forall \mathbf{w} \in \Hflow_{0,\text{div}}^1(\Omega),\ \forall i \in \mathbb{N}. \end{align} On noting \eqref{fp:ex:i:cvg:psi_ki_weak}, \eqref{fp:ex:i:cvg:QZL_psiov_ki}, \eqref{fp:ex:i:cvg:u_ki_strong}, \eqref{fp:ex:i:cvg:u_ki_weak}, and \eqref{fp:ex:i:cvg:pot_psiov_ki}, we pass to the limit in \eqref{fp:ex:i:a_uki} as $i \to \infty$ to deduce that \begin{align} \label{fp:ex:i:a_uhat} a(\psi)(\hat{\uflow}, \mathbf{w}) = k(\psi)(\mathbf{w}) \quad \forall \mathbf{w} \in \Hflow_{0,\text{div}}^1(\Omega). \end{align} Furthermore, it follows from \eqref{fp:ex:i:b_psi_k} that \begin{align} \label{fp:ex:i:b_psi_ki} b(\mathbf{u}_{k_i})(\Xi[\psi_{k_i}], \theta) = l(\mathbf{u}_{k_i}, \psi_{k_i})(\theta) \quad \forall \theta \in \HkOS{1},\ \forall i \in \mathbb{N}. \end{align} On noting \eqref{fp:ex:i:cvg:psi_ki_weak}, \eqref{fp:ex:i:cvg:QZL_psiov_ki}, \eqref{fp:ex:i:cvg:u_ki_strong}, \eqref{fp:ex:i:cvg:u_ki_weak}, and \eqref{fp:ex:i:cvg:pot_psiov_ki}, we pass to the limit in \eqref{fp:ex:i:b_psi_ki} as $i \to \infty$ to deduce that \begin{align} \label{fp:ex:i:b_psihat} b(\hat{\uflow})(\hat{\psi}, \theta) = l(\hat{\uflow}, \psi)(\theta) \quad \forall \theta \in \HkOS{1}. \end{align} Now, we infer from the uniqueness of solutions to \eqref{fp:iteration:i} and \eqref{fp:iteration:ii} and from the comparison of \eqref{fp:ex:i:a_u} and \eqref{fp:ex:i:a_uhat} and of \eqref{fp:ex:i:b_psi} and \eqref{fp:ex:i:b_psihat} that \begin{align} \label{fp:ex:i:limit_id} \mathbf{u} = \hat{\uflow} \quad \text{ and } \quad \Xi[\psi] = \hat{\psi}. \end{align} Consequently, on noting \eqref{fp:ex:i:cvg:psi_ki_strong} and \eqref{fp:ex:i:limit_id}, we have that \begin{align} \label{fp:ex:i:psi_ki_limit} \Xi[\psi_{k_i}] \to \hat{\psi} = \Xi[\psi] \quad \text{ in } \LpOS{2} \text{ as } i \to \infty. \end{align} Therefore, we infer from the uniqueness of solutions to \eqref{fp:iteration:i} and \eqref{fp:iteration:ii} that we can find for any subsequence $\{ \Xi[\psi_{k_j}] \}_{j \in \mathbb{N}}$ of $\{ \Xi[\psi_k] \}_{k \in \mathbb{N}}$ another subsequence $\{ \Xi[\psi_{k_{j_i}}] \}_{i \in \mathbb{N}}$ of $\{ \Xi[\psi_{k_j]} \}_{j \in \mathbb{N}}$ such that \begin{align} \label{fp:ex:i:cvg:psi_kji} \Xi[\psi_{k_{j_i}}] \to \Xi[\psi] \quad \text{ in } \LpOS{2} \text{ as } i \to \infty. \end{align} Hence, we can return to the original series $\{ \Xi[\psi_k] \}_{k \in \mathbb{N}}$ in \eqref{fp:ex:i:cvg:psi_kji}, which proves \eqref{fp:ex:i:goal}. \textit{Proof of ii).} It follows directly from \eqref{fp:iteration:iii:u}, \eqref{fp:iteration:iii:psi}, and the compact embedding $\H^1(\Omega \times {\SMat^{d-1}})$ $\hookrightarrow\hookrightarrow$ $\L^2(\Omega \times {\SMat^{d-1}})$ that \textit{ii)} holds. \textit{Proof of iii).} Let $\lambda \in (0,1]$ and $\psi \in \L^2({\Omega\times\Sph})$ such that \begin{align} \label{fp:ex:iii:def_fp} \psi = \lambda \Xi(\psi). \end{align} We infer from Lemma \ref{lmm:fixed_point_iter} and the definition of $\Xi$ that there exists a unique $\mathbf{u} \in \Hflow_{0,\text{div}}^1(\Omega)$ such that \begin{subequations} \begin{alignat}{2} a(\psi)(\mathbf{u}, \mathbf{w}) &= k(\psi)(\mathbf{w}) \quad && \forall \mathbf{w} \in \Hflow_{0,\text{div}}^1(\Omega), \label{fp:ex:iii:eq:a} \\ b(\mathbf{u})(\psi, \theta) &= \lambda l(\mathbf{u}, \psi)(\theta) \quad && \forall \theta \in \HkOS{1}. \label{fp:ex:iii:eq:b} \end{alignat} \end{subequations} In particular, it holds that $\psi \in \HkOS{1}$. Moreover, on choosing $\theta := \negat{\psi} \in \HkOS{1}$ as a test function in \eqref{fp:ex:iii:eq:b}, we obtain from $\negat{\psiL{n-1}} = 0$, $\negat{\text{Q}_0^\regL(\psi)}$ $= 0$, $\mathbf{u}$ being divergence-free in $\Omega$ and having zero trace on $\partial \Omega$ that \begin{align} \label{fp:ex:iii:nonneg} \begin{split} &\int_{\OmSph} \negat{\psi}^2 \dH\, \text{d}\xflow + \frac{\tau}{\DE} \int_{\OmSph} \left[ \mollEps^2 \abs{\nabla_\xflow \negat{\psi}}^2 + \abs{\nabla_\surfaceLtr \negat{\psi}}^2 \right] \dH\, \text{d}\xflow \\ &\quad = \lambda \int_{\OmSph} \psiL{n-1} \negat{\psi} \dH\, \text{d}\xflow \leq 0. \end{split} \end{align} Hence, we have that $\psi \geq 0$ a.e. in ${\Omega\times\Sph}$, that is $\psi \in \Zp{2}$. Moreover, taking $\theta \equiv 1$ in \eqref{fp:ex:iii:eq:b} yields \begin{align} \label{fp:ex:iii:mass_consv} \int_{\OmSph} \psi \dH\, \text{d}\xflow = \lambda \int_{\OmSph} \psiL{n-1} \dH\, \text{d}\xflow. \end{align} Hence, we infer from \eqref{fp:ex:iii:mass_consv}, \eqref{est:nabla_pot_Linfty}, and $0 < \lambda \leq 1$ that \begin{align} \label{fp:ex:iii:est_pot_infty} \norm{ \pot[\psi + \psiL{n-1}] }_{\mathrm{W}^{1, \infty}({\Omega\times\Sph})} \leq C(\overline{\C}_\mollEps, \potStr, d) \norm{\psiL{n-1}}_{\LpOS{1}}. \end{align} The goal is to prove the existence of a constant $C^\star > 0$, which is independent of $\lambda$ and $\psi$, such that \begin{align} \label{fp:ex:iii:goal} \norm{\psi}_{\LpOS{2}} \leq C^\star. \end{align} One common ansatz to prove \eqref{fp:ex:iii:goal} would be taking $\mathbf{w} := \mathbf{u} \in \Hflow_{0,\text{div}}^1(\Omega)$ in \eqref{fp:ex:iii:eq:a} and $\theta := \psi \in \HkOS{1}$ in \eqref{fp:ex:iii:eq:b} as test functions to derive the desired bound. Then, combining \eqref{fp:iteration:iii:u} and \eqref{fp:iteration:iii:psi} yields \begin{align} \label{fp:ex:iii:fail} \norm{\psi}_{\LpOS{2}} \leq C(\tau, \text{L}) + C(\tau, \text{L}) \norm{\psi}_{\LpOS{2}} + C(\tau, \text{L}) \norm{\psi}_{\LpOS{2}}^2. \end{align} By choosing $\tau$ and $\text{L}$ in a clever way, we could absorb the second term on the right-hand side of \eqref{fp:ex:iii:fail} into the left-hand side. However, we could not control or absorb the last term on the right-hand side of \eqref{fp:ex:iii:fail}. This is the reason why we change the ansatz to mimicking the entropy estimate in Section \ref{sec:formal_entropy_estimate}. If we assume to control the $\text{L}$-regularized entropy of $\psi$ analogously to the formal estimate \eqref{formal:entropy_est}, we infer from \eqref{reg:FL_geq_ss} that \begin{align*} \frac{1}{4 \text{L}} \int_{\OmSph} \abs{\psi}^2 \dH\, \text{d}\xflow - C(\text{L}) \leq \int_{\OmSph} \entrop^\regL(\psi) \dH\, \text{d}\xflow \leq C, \end{align*} which then yields the desired bound \eqref{fp:ex:iii:goal}. Hence, our goal is to control the $\text{L}$-regularized entropy of $\psi$. As $\psi$ is nonnegative and there is no reason why $\psi$ should be strictly positive, we cannot apply $\lrcb{\entropL}^\prime(\cdot)$ to $\psi$ to define our test function as $\mu_{\psi, \text{L}} = \lrcb{\entropL}^\prime(\psi) + \pot[\psi]$. Hence, for $0 < \delta \ll 1$ let us define the $\delta$-regularized chemical potential by \begin{align} \label{fp:ex:iii:def:muPsidLl} \mu_{\psi, \regDelta, \regL, \lambda} := \lrcb{\entropL}^\prime(\psi + \delta) + \frac{\lambda}{2} \pot\left[ \psi + \psiL{n-1} \right] \in \HkOS{1}. \end{align} In particular, the following representation of the diffusive terms motivates the multiplication of the interaction potential in \eqref{fp:ex:iii:def:muPsidLl} by $\lambda$. First, we rewrite the diffusive terms in \eqref{fp:ex:iii:eq:b}. It holds that, for all $\theta \in \HkOS{1}$, \begin{align} \label{fp:ex:iii:diff_x_rewritten} \begin{split} & \int_{\OmSph} \left[ \nabla_\xflow \psi \cdot \nabla_\xflow \theta + \frac{\lambda}{2} \text{Q}^\regL(\psi) \nabla_\xflow \pot[\psi + \psiL{n-1}] \cdot \nabla_\xflow \theta \right] \dH\, \text{d}\xflow \\ &\quad= \int_{\OmSph} \text{Q}^\regL(\psi + \delta) \nabla_\xflow \mu_{\psi, \regDelta, \regL, \lambda} \cdot \nabla_\xflow \theta \dH\, \text{d}\xflow \\ &\quad\quad + \int_{\OmSph} \frac{\lambda}{2} \lrcb{ \text{Q}^\regL(\psi) - \text{Q}^\regL(\psi + \delta) } \nabla_\xflow \pot[\psi + \psiL{n-1}] \cdot \nabla_\xflow \theta \dH\, \text{d}\xflow. \end{split} \end{align} Similarly, we can rewrite the analogue term with respect to the surface gradient. Now, let us start deriving the entropy estimate. First, multiplying \eqref{fp:ex:iii:eq:a} by $\lambda$, taking $\mathbf{w} := \mathbf{u} \in \Hflow_{0,\text{div}}^1(\Omega)$ as a test function in \eqref{fp:ex:iii:eq:a}, and noting the formula \begin{align} \label{eq:aab} a(a-b) = \frac{1}{2} \lrcb{ a^2 + (a-b)^2 - b^2 } \qquad \text{ for all } a,b \in \mathbb{R}, \end{align} it follows that \begin{align} \label{fp:ex:iii:u_tested_u} \begin{split} &\frac{\lambda \RE \DE}{2 \tau} \int_{\Omega} \left[ \abs{\mathbf{u}}^2 + \abs{\mathbf{u} - \uL{n-1}}^2 - \abs{\uL{n-1}}^2 \right] \, \text{d}\xflow + \lambda \viscFrac \DE \int_{\Omega} \abs{\nabla_\xflow \mathbf{u}}^2 \, \text{d}\xflow \\ &\quad + \frac{\lambda (1 - \viscFrac) \DE}{2} \int_{\OmSph} \text{Q}^\regL(\psi) \lrcb{\nabla_\xflow\mathbf{u} : \mflow\otimes\mflow}^2 \dH(\mflow)\, \text{d}\xflow \\ &= - \frac{\lambda(1-\viscFrac)}{2} \int_{\OmSph} \psi \nabla_\xflow \pot[\psi + \psiL{n-1}] \cdot \mathbf{u} \dH\, \text{d}\xflow \\ &\quad - \frac{\lambda (1- \viscFrac)}{2} \int_{\OmSph} \text{Q}^\regL(\psi) \lrcb{ (\mathbb{I} - \mflow\otimes\mflow)\nabla_\xflow\mathbf{u}\mathbf{m} } \cdot \nabla_\surfaceLtr \pot[\psi + \psiL{n-1}] \dH(\mflow)\, \text{d}\xflow \\ &\quad - \lambda(1 - \viscFrac) \int_{\OmSph} \psi (d\mflow\otimes\mflow - \mathbb{I}):\nabla_\xflow\mathbf{u} \dH(\mflow)\, \text{d}\xflow \\ &\quad - \lambda\activity (1 - \viscFrac) \int_{\OmSph} \text{Q}^\regL(\psi) \mflow\otimes\mflow : \nabla_\xflow \mathbf{u} \dH(\mflow)\, \text{d}\xflow. \end{split} \end{align} Next, noting \eqref{fp:ex:iii:diff_x_rewritten}, the convexity of $\entrop^\regL$, and taking $\theta := \mu_{\psi, \regDelta, \regL, \lambda} \in \HkOS{1}$ as a test function in \eqref{fp:ex:iii:eq:b}, we have that \begin{align*} &\frac{1}{\tau} \int_{\OmSph} \left[ \entrop^\regL(\psi + \delta) - \entrop^\regL(\lambda \psiL{n-1} + \delta) \right] \dH\, \text{d}\xflow \\ &\quad\quad + \frac{\lambda}{2 \tau} \int_{\OmSph} \lrcb{\psi - \lambda \psiL{n-1}} \lrcb{ \pot[\psi] + \pot[\psiL{n-1}] } \dH\, \text{d}\xflow \\ &\quad\quad + \frac{\lambda \mollEps^2}{\DE} \int_{\OmSph} \text{Q}^\regL(\psi + \delta) \abs{\nabla_\xflow \mu_{\psi, \regDelta, \regL, \lambda}}^2 \dH\, \text{d}\xflow \\ &\quad\quad + \frac{\lambda}{\DE} \int_{\OmSph} \text{Q}^\regL(\psi + \delta) \abs{\nabla_\surfaceLtr \mu_{\psi, \regDelta, \regL, \lambda}}^2 \dH\, \text{d}\xflow \\ &\quad\leq \frac{\lambda}{2} \int_{\OmSph} \psi \nabla_\xflow \pot[\psi + \psiL{n-1}] \cdot \mathbf{u} \dH\, \text{d}\xflow \numberthis[fp:ex:iii:psi_tested_muPsidLl] \\ &\quad\quad\quad + \lambda \int_{\OmSph} \text{Q}^\regL(\psi) \lrcb{(\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m}} \cdot \nabla_\surfaceLtr \mu_{\psi, \regDelta, \regL, \lambda} \dH(\mflow)\, \text{d}\xflow \\ &\quad\quad\quad - \frac{\lambda \mollEps^2}{2 \DE} \int_{\OmSph} \lrcb{ \text{Q}^\regL(\psi) - \text{Q}^\regL(\psi + \delta) } \nabla_\xflow \pot[\psi + \psiL{n-1}] \cdot \nabla_\xflow \mu_{\psi, \regDelta, \regL, \lambda} \dH\, \text{d}\xflow \\ &\quad\quad\quad - \frac{\lambda}{2 \DE} \int_{\OmSph} \lrcb{\text{Q}^\regL(\psi) - \text{Q}^\regL(\psi + \delta)} \nabla_\surfaceLtr \pot[\psi + \psiL{n-1}] \cdot \nabla_\surfaceLtr \mu_{\psi, \regDelta, \regL, \lambda} \dH\, \text{d}\xflow. \end{align*} Before we care about the error terms in \eqref{fp:ex:iii:psi_tested_muPsidLl}, we exploit the natural structure of \eqref{fp:ex:iii:u_tested_u} and \eqref{fp:ex:iii:psi_tested_muPsidLl} as good as possible to see which terms cancel out. We infer from \eqref{eq:chen_stress_formula} that the second term on the right-hand side of \eqref{fp:ex:iii:psi_tested_muPsidLl} can be rewritten as \begin{align*} &\lambda \int_{\OmSph} \text{Q}^\regL(\psi) \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} } \cdot \nabla_\surfaceLtr \mu_{\psi, \regDelta, \regL, \lambda} \dH(\mflow)\, \text{d}\xflow\\ &\quad= \frac{\lambda^2}{2} \int_{\OmSph} \text{Q}^\regL(\psi) \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} } \cdot \nabla_\surfaceLtr \pot[\psi + \psiL{n-1}] \dH(\mflow)\, \text{d}\xflow \\ &\quad\quad + \lambda \int_{\OmSph} \text{Q}^\regL(\psi) \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} } \cdot \lrcb{ \frac{1}{\text{Q}^\regL(\psi + \delta)} \nabla_\surfaceLtr \psi } \dH(\mflow)\, \text{d}\xflow \\ &\quad= \frac{\lambda^2}{2} \int_{\OmSph} \text{Q}^\regL(\psi) \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} } \cdot \nabla_\surfaceLtr \pot[\psi + \psiL{n-1}] \dH(\mflow)\, \text{d}\xflow \\ &\quad\quad + \lambda \int_{\OmSph} \psi (d\mflow\otimes\mflow - \mathbb{I}) : \nabla_\xflow \mathbf{u} \dH(\mflow)\, \text{d}\xflow \numberthis[fp:ex:iii:chen_stress_rewritten] \\ &\quad\quad + \lambda \int_{\OmSph} \frac{\text{Q}^\regL(\psi) - \text{Q}^\regL(\psi + \delta)}{\text{Q}^\regL(\psi + \delta)} \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} } \cdot \nabla_\surfaceLtr \psi \dH(\mflow)\, \text{d}\xflow. \end{align*} We note that the second term on the right-hand side of \eqref{fp:ex:iii:chen_stress_rewritten} cancels out with the third term on the right-hand side of \eqref{fp:ex:iii:u_tested_u}. Furthermore, we deduce from \eqref{mollifier:fg}, $0 < \lambda \leq 1$, and the nonnegativity of the Maier-Saupe interaction kernel \eqref{def:interaction_kernel} and of $\psi$ and $\psiL{n-1}$ a.e. in ${\Omega\times\Sph}$ that \begin{align} \label{fp:ex:iii:eq:pot_energy} \begin{split} &\frac{\lambda}{2\tau} \int_{\OmSph} \lrcb{\psi - \lambda \psiL{n-1}} \lrcb{ \pot[\psi] + \pot[\psiL{n-1}] } \dH\, \text{d}\xflow \\ &\quad= \frac{\lambda}{2\tau} \int_{\OmSph} \left[ \psi\pot[\psi] - \lambda\psiL{n-1}\pot[\psiL{n-1}] \right] \dH\, \text{d}\xflow \\ &\quad\quad + \frac{\lambda(1-\lambda)}{2 \tau} \int_{\OmSph} \psi \pot[\psiL{n-1}] \dH\, \text{d}\xflow \\ &\quad\geq \frac{\lambda}{2\tau} \int_{\OmSph} \left[ \psi\pot[\psi] - \lambda\psiL{n-1}\pot[\psiL{n-1}] \right] \dH\, \text{d}\xflow. \end{split} \end{align} Now, we obtain from multiplying \eqref{fp:ex:iii:psi_tested_muPsidLl} by $(1 - \viscFrac)$ and from combining \eqref{fp:ex:iii:u_tested_u} and \eqref{fp:ex:iii:psi_tested_muPsidLl} - \eqref{fp:ex:iii:eq:pot_energy} that \begin{align*} &\frac{\lambda\RE\DE}{2 \tau} \int_{\Omega} \left[ \abs{\mathbf{u}}^2 + \abs{\mathbf{u} - \uL{n-1}}^2 - \abs{\uL{n-1}}^2 \right] \, \text{d}\xflow + \lambda \viscFrac \DE \int_{\Omega} \abs{\nabla_\xflow \mathbf{u}}^2 \, \text{d}\xflow \\ &\quad + \frac{\lambda (1 - \viscFrac) \DE}{2} \int_{\OmSph} \text{Q}^\regL(\psi) \lrcb{\nabla_\xflow\mathbf{u} : \mflow\otimes\mflow}^2 \dH(\mflow)\, \text{d}\xflow \\ &\quad + \frac{1 - \viscFrac}{\tau} \int_{\OmSph} \left[ \entrop^\regL(\psi + \delta) - \entrop^\regL(\lambda \psiL{n-1} + \delta) \right] \dH\, \text{d}\xflow \\ &\quad + \frac{\lambda (1 - \viscFrac)}{2 \tau} \int_{\OmSph} \left[ \psi \pot[\psi] - \lambda \psiL{n-1} \pot[\psiL{n-1}] \right] \dH\, \text{d}\xflow \\ &\quad + \frac{\lambda (1 - \viscFrac) \mollEps^2}{\DE} \int_{\OmSph} \text{Q}^\regL(\psi + \delta) \abs{\nabla_\xflow \mu_{\psi, \regDelta, \regL, \lambda}}^2 \dH\, \text{d}\xflow \\ &\quad + \frac{\lambda (1 - \viscFrac)}{\DE} \int_{\OmSph} \text{Q}^\regL(\psi + \delta) \abs{\nabla_\surfaceLtr \mu_{\psi, \regDelta, \regL, \lambda}}^2 \dH\, \text{d}\xflow \\ &\leq - \lambda \alpha (1 - \viscFrac) \int_{\OmSph} \text{Q}^\regL(\psi) \mflow\otimes\mflow : \nabla_\xflow \mathbf{u} \dH(\mflow)\, \text{d}\xflow \numberthis[fp:ex:iii:u_psi_combined] \\ &\quad + \frac{\lambda(\lambda-1)(1-\viscFrac)}{2} \int_{\OmSph} \text{Q}^\regL(\psi) \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} } \cdot \\ &\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \cdot \nabla_\surfaceLtr \pot[\psi + \psiL{n-1}] \dH(\mflow)\, \text{d}\xflow \\ &\quad + \lambda(1 - \viscFrac) \int_{\OmSph} \frac{\text{Q}^\regL(\psi) - \text{Q}^\regL(\psi + \delta)}{\text{Q}^\regL(\psi + \delta)} \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} } \cdot \\ &\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \cdot \nabla_\surfaceLtr \psi \dH(\mflow)\, \text{d}\xflow \\ &\quad - \frac{\lambda \mollEps^2 (1 - \viscFrac)}{2 \DE} \int_{\OmSph} \lrcb{ \text{Q}^\regL(\psi) - \text{Q}^\regL(\psi + \delta) } \nabla_\xflow \pot[\psi + \psiL{n-1}] \cdot \\ &\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \cdot \nabla_\xflow \mu_{\psi, \regDelta, \regL, \lambda} \dH\, \text{d}\xflow \\ &\quad - \frac{\lambda (1 - \viscFrac)}{2 \DE} \int_{\OmSph} \lrcb{\text{Q}^\regL(\psi) - \text{Q}^\regL(\psi + \delta)} \nabla_\surfaceLtr \pot[\psi + \psiL{n-1}] \cdot \\ &\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \cdot \nabla_\surfaceLtr \mu_{\psi, \regDelta, \regL, \lambda} \dH\, \text{d}\xflow \\ &=: I + II + III + IV + V. \end{align*} We note that the active term $I$ appears in the same form as in the formal estimate \eqref{formal:summarize_1}. Moreover, it is worth mentioning that in the case of the usual entropy estimate, that is $\lambda = 1$, we would have that $II = 0$. The error terms $III-V$ are caused by the approximate scheme and the $\delta$-regularized test function $\mu_{\psi, \regDelta, \regL, \lambda}$.\\ Let us now continue estimating the terms $I - V$. We infer from $0 < \lambda \leq 1$, \eqref{reg:QL_leq}, \eqref{fp:ex:iii:mass_consv}, and Young's inequality that \begin{align*} \abs{I} &\leq \frac{\lambda (1 - \viscFrac) \DE}{4} \int_{\OmSph} \text{Q}^\regL(\psi) \lrcb{\nabla_\xflow\mathbf{u} : \mflow\otimes\mflow}^2 \dH(\mflow)\, \text{d}\xflow \\ &\quad + \frac{(1-\viscFrac) \activity^2}{\DE} \norm{\psiL{n-1}}_{\LpOS{1}}. \numberthis[fp:ex:iii:I] \end{align*} The first term on the right-hand side of \eqref{fp:ex:iii:I} can be absorbed into the left-hand side of \eqref{fp:ex:iii:u_psi_combined}. Furthermore, we deduce from $\abs{\mathbb{I} - \mflow\otimes\mflow} \leq 2d$, $\abs{\lambda(\lambda-1)} \leq \lambda$, \eqref{reg:QL_leq}, \eqref{fp:ex:iii:mass_consv}, \eqref{fp:ex:iii:est_pot_infty}, Jensen's inequality, and Young's inequality that \begin{align} \label{fp:ex:iii:II} \begin{split} \abs{II} &\leq \frac{\lambda (1-\viscFrac) 2d }{2} \int_{\OmSph} \abs{\text{Q}^\regL(\psi)} \abs{\nabla_\xflow \mathbf{u}} \abs{\nabla_\surfaceLtr \pot[\psi + \psiL{n-1}]} \dH\, \text{d}\xflow \\ &\leq \frac{\lambda \gamma \DE}{2} \int_{\Omega} \abs{\nabla_\xflow \mathbf{u}}^2 \, \text{d}\xflow + C_1 \text{L} \norm{\psiL{n-1}}_{\LpOS{1}}^3, \end{split} \end{align} where $C_1 = C_1(\viscFrac, \viscFrac^{-1}, \DE^{-1}, d, {\Omega\times\Sph}, \overline{\C}_\mollEps, \potStr) > 0$ is independent of $\delta, \tau$, $\lambda$, $\text{L}$, and $\psi$. Again, we can absorb the first term on the right-hand side of \eqref{fp:ex:iii:II} into the left-hand side of \eqref{fp:ex:iii:u_psi_combined}. Moreover, on noting the Lipschitz continuity of $\text{Q}^\regL$, the nonnegativity of $\psi$, \eqref{reg:QL_leq}, \eqref{fp:ex:iii:mass_consv}, \eqref{fp:ex:iii:est_pot_infty}, $0 < \lambda \leq 1$, and on adapting a computation of Chen and Liu (cf. \cite[(3.32)]{chen_liu_2013_entropy_solution}), we infer from Jensen's inequality and Young's inequality that \begin{align*} \abs{III} &\leq \lambda (1 - \viscFrac) 2d \sqrt{\delta} \int_{\OmSph} \abs{\nabla_\xflow\mathbf{u}} \abs{\nabla_\surfaceLtr \psi} \frac{1}{\sqrt{\text{Q}^\regL(\psi + \delta)}} \dH\, \text{d}\xflow \\ &\leq \frac{\lambda (1 - \viscFrac)}{8 \DE} \int_{\OmSph} \text{Q}^\regL(\psi + \delta) \abs{\nabla_\surfaceLtr \lrcb{\entropL}^\prime(\psi + \delta)}^2 \dH\, \text{d}\xflow \\ &\quad + C_2(\DE, \viscFrac, d) \delta \int_{\Omega} \abs{\nabla_\xflow \mathbf{u}}^2 \, \text{d}\xflow \\ &\leq \frac{\lambda (1 - \viscFrac)}{4 \DE} \int_{\OmSph} \text{Q}^\regL(\psi + \delta) \abs{\nabla_\surfaceLtr \mu_{\psi, \regDelta, \regL, \lambda}}^2 \dH\, \text{d}\xflow \numberthis[fp:ex:iii:III] \\ &\quad + C_3\lrcb{\DE^{-1}, \viscFrac, \overline{\C}_\mollEps, \potStr, d, \Omega} \norm{\psiL{n-1}}_{\LpOS{1}}^2 \lrcb{\norm{\psiL{n-1}}_{\LpOS{1}} + 1} \\ &\quad + C_2(\DE, \viscFrac, d) \delta \int_{\Omega} \abs{\nabla_\xflow \mathbf{u}}^2 \, \text{d}\xflow, \end{align*} where $C_2 = C_2(\DE, \viscFrac, d) > 0$ and $C_3 =C_3\lrcb{\DE^{-1}, \viscFrac, \overline{\C}_\mollEps, \potStr, d, \Omega} > 0$ are independent of $\delta, \tau$, $\lambda$, $\text{L}$, and $\psi$. We note that the first term on the right-hand side of \eqref{fp:ex:iii:III} can be absorbed into the left-hand side of \eqref{fp:ex:iii:u_psi_combined}. Moreover, the last term on the right-hand side of \eqref{fp:ex:iii:III} can be absorbed as well if we choose $\delta > 0$ sufficiently small. The exact range of $\delta$ will be specified later. Next, we infer from $\text{Q}^\regL(s) \leq \text{Q}^\regL(s + \delta)$ for all $s \geq 0$, the Lipschitz continuity of $\text{Q}^\regL$, \eqref{reg:QL_leq}, \eqref{fp:ex:iii:mass_consv}, \eqref{fp:ex:iii:est_pot_infty}, $0 < \lambda \leq 1$, Jensen's inequality, and Young's inequality that \begin{align*} \abs{IV} &\leq \frac{\lambda \mollEps^2 (1 - \viscFrac)}{2 \DE} \int_{\OmSph} \text{Q}^\regL(\psi + \delta) \abs{\nabla_\xflow \mu_{\psi, \regDelta, \regL, \lambda}}^2 \dH\, \text{d}\xflow \numberthis[fp:ex:iii:IV] \\ &\quad + C_4 \lrcb{\mollEps, \DE^{-1}, \viscFrac, \Omega, \overline{\C}_\mollEps, \potStr, d} \delta \norm{\psiL{n-1}}_{\LpOS{1}}^2 \end{align*} and \begin{align*} \abs{V} &\leq \frac{\lambda (1 - \viscFrac)}{4 \DE} \int_{\OmSph} \text{Q}^\regL(\psi + \delta) \abs{\nabla_\surfaceLtr \mu_{\psi, \regDelta, \regL, \lambda}}^2 \dH\, \text{d}\xflow \numberthis[fp:ex:iii:V] \\ &\quad + C_5\lrcb{\DE^{-1}, \viscFrac, \Omega, \overline{\C}_\mollEps, \potStr, d} \delta \norm{\psiL{n-1}}_{\LpOS{1}}^2, \end{align*} where $C_4 = C_4 \lrcb{\mollEps, \DE^{-1}, \viscFrac, \Omega, \overline{\C}_\mollEps, \potStr, d} > 0$ and $C_5 = C_5\lrcb{\DE^{-1}, \viscFrac, \Omega, \overline{\C}_\mollEps, \potStr, d} > 0$ are independent of $\delta, \tau$, $\lambda$, $\text{L}$, and $\psi$. Now, we obtain from combining \eqref{fp:ex:iii:u_psi_combined} - \eqref{fp:ex:iii:V} that \begin{align*} &\frac{\lambda \RE \DE}{2 \tau} \int_{\Omega} \left[ \abs{\mathbf{u}}^2 + \abs{\mathbf{u} - \uL{n-1}}^2 - \abs{\uL{n-1}}^2 \right] \, \text{d}\xflow + \lrcb{\frac{\lambda\viscFrac\DE}{2} - C_2 \delta} \int_{\Omega} \abs{\nabla_\xflow \mathbf{u}}^2 \, \text{d}\xflow \\ &\quad\quad + \frac{\lambda (1 - \viscFrac) \DE}{4} \int_{\OmSph} \text{Q}^\regL(\psi) \lrcb{\nabla_\xflow\mathbf{u} : \mflow\otimes\mflow}^2 \dH(\mflow)\, \text{d}\xflow \\ &\quad\quad + \frac{1 - \viscFrac}{\tau} \int_{\OmSph} \left[ \entrop^\regL(\psi + \delta) - \entrop^\regL(\lambda\psiL{n-1} + \delta) \right] \dH\, \text{d}\xflow \\ &\quad\quad + \frac{\lambda (1 - \viscFrac)}{2 \tau} \int_{\OmSph} \left[ \psi\pot[\psi] - \lambda\psiL{n-1}\pot[\psiL{n-1}] \right] \dH\, \text{d}\xflow \\ &\quad\quad + \frac{\lambda (1 - \viscFrac) \mollEps^2}{2 \DE} \int_{\OmSph} \text{Q}^\regL(\psi + \delta) \abs{\nabla_\xflow \mu_{\psi, \regDelta, \regL, \lambda}}^2 \dH\, \text{d}\xflow \\ &\quad\quad + \frac{\lambda (1 - \viscFrac)}{2 \DE} \int_{\OmSph} \text{Q}^\regL(\psi + \delta) \abs{\nabla_\surfaceLtr \mu_{\psi, \regDelta, \regL, \lambda}}^2 \dH\, \text{d}\xflow \\ &\quad\leq \frac{(1-\viscFrac) \activity^2}{\DE} \norm{\psiL{n-1}}_{\LpOS{1}} + C_1 \text{L} \norm{\psiL{n-1}}_{\LpOS{1}}^3 \numberthis[fp:ex:iii:u_psi_I_to_V] \\ &\quad\quad + C_3 \lrcb{\norm{\psiL{n-1}}_{\LpOS{1}} + 1}\norm{\psiL{n-1}}_{\LpOS{1}}^2 \\ &\quad\quad + \lrcb{C_4 + C_5 }\delta \norm{\psiL{n-1}}_{\LpOS{1}}^2. \end{align*} Now, we deduce from \eqref{fp:ex:iii:u_psi_I_to_V}, $0 < \lambda \leq 1$, \eqref{reg:FL_geq_ss}, the nonnegativity of $\psi$, omitting some nonnegative terms, and the Dominated Convergence Theorem that \begin{align} \label{fp:ex:iii:bound_psi_psi_1} \begin{split} \frac{1}{4 \text{L}} \int_{\OmSph} \abs{\psi}^2 \dH\, \text{d}\xflow \leq C, \end{split} \end{align} where $C = C\lrcb{C_1, C_3, \potStr, d, \Omega, \RE, \DE, \DE^{-1}, \activity, \viscFrac, \tau, \text{L}, \uL{n-1}, \psiL{n-1}} > 0$ is independent of $\lambda$ and $\psi$. Hence, it finally follows that \eqref{fp:ex:iii:goal} holds. The proof of Lemma \ref{lmm:existence_fp} is thereby complete. \end{proof} \begin{crllr} \label{crllr:nonnegativity} Suppose that the assumptions \eqref{assumptions:domain_init_data} hold. Then, there exist solutions $\{ ( \uL{k}, \psiL{k} ) \}_{k=1}^N$ $\subset$ $\Hflow_{0,\text{div}}^1(\Omega) \times \HkOS{1}$ to \eqref{def:PLtau}. In particular, it holds that $\psiL{k} \in \Zp{2}$ for $k \in \{1, \dots, N\}$. Hence, $\{ ( \uL{k}, \psiL{k} ) \}_{k=1}^N$ $\subset$ $\Hflow_{0,\text{div}}^1(\Omega) \times (\HkOS{1} \cap \Zp{2})$ is a solution to $\lrcb{\mathcal{P}_{\regL}^\tau}$. \end{crllr} \begin{proof} As a fixed-point of $\Xi$ is equivalent to a solution to \eqref{def:PLtau}, applying Lemma \ref{lmm:existence_fp} iteratively yields the existence of solutions $\{ ( \uL{k}, \psiL{k} ) \}_{k=1}^N$ $\subset$ $\Hflow_{0,\text{div}}^1(\Omega) \times \H^1(\Omega \times {\SMat^{d-1}})$ to \eqref{def:PLtau}. It therefore remains to show that $\{\psiL{k}\}_{k=1}^N \subset \Zp{2}$. As $\psiL{0} \in \Zp{2}$ (see \eqref{init:def:psi_L_0}), let $k \in \{1, \dots, N\}$ and $\psiL{k-1} \in \Zp{2}$. Applying the same arguments as in \eqref{fp:ex:iii:nonneg} yields $\psiL{k} \in \Zp{2}$. \end{proof} \subsection{A uniform entropy estimate} \label{sec:uniform_entropy_estimate} This section is devoted to the derivation of a uniform entropy estimate with respect to $N$ and $\text{L}$, which mimics the formal entropy estimate \eqref{formal:entropy_est}. First, we infer from taking $\psi \equiv 1$ as a test function in \eqref{eq:PLtau:psi} that the mass of $\psiL{n}$ is conserved, that is \begin{align} \label{eq:mass_consv_psiLn} \int_{\OmSph} \psiL{n} \dH\, \text{d}\xflow = \int_{\OmSph} \psiL{n-1} \dH\, \text{d}\xflow = \int_{\OmSph} \psiL{0} \dH\, \text{d}\xflow \end{align} for all $n \in \{1, \dots, N\}$. Moreover, for future references, we deduce from \eqref{est:nabla_pot_Linfty}, \eqref{eq:mass_consv_psiLn}, and \eqref{init:regularity_psi_L_0} that, for all $k \in \{1, \dots, N\}$, \begin{align} \label{eq:nabla_potLk_bound} \begin{split} \norm{\potL{k}}_{\mathrm{W}^{1, \infty}({\Omega\times\Sph})} \leq C(\overline{\C}_\mollEps, \potStr, d) \norm{\psi_0}_{\LpOS{1}} < \infty, \end{split} \end{align} where $C = C(\overline{\C}_\mollEps, \potStr, d) > 0$ is independent of $\delta, \tau$, and $\text{L}$. The following lemma holds: \begin{lmm}[Discrete-in-time entropy estimate] \label{lmm:time_discrete_entropy} Suppose that the assumptions \eqref{assumptions:domain_init_data} hold. Then, solutions $\{ ( \uL{k}, \psiL{k} ) \}_{k=1}^N$ $\subset$ $\Hflow_{0,\text{div}}^1(\Omega) \times (\HkOS{1} \cap \Zp{2})$ to \eqref{def:PLtau} satisfy \begin{align*} & \frac{\RE \DE}{2} \int_{\Omega} \abs{ \uL{n} }^2 \, \text{d}\xflow + \frac{\RE\DE}{2} \sum_{k=1}^{n} \int_{\Omega} \abs{\uL{k} - \uL{k-1}}^2 \, \text{d}\xflow + \frac{\viscFrac \DE}{2} \sum_{k=1}^{n} \tau \int_{\Omega} \abs{\nabla_\xflow \uL{k}}^2 \, \text{d}\xflow \\ & \quad + \frac{(1 - \viscFrac) \DE}{4} \sum_{k=1}^{n} \tau \int_{\OmSph} \text{Q}^\regL(\psiL{k}) \lrcb{ \nabla_\xflow \uL{k} : \mflow\otimes\mflow }^2 \dH(\mflow) \, \text{d}\xflow \\ & \quad + (1 - \viscFrac) \int_{\OmSph} \mathcal{F}(\psiL{n}) \dH\, \text{d}\xflow + \frac{1 - \viscFrac}{2} \int_{\OmSph} \psiL{n} \pot[\psiL{n}] \dH \, \text{d}\xflow \\ & \quad + \frac{1 - \viscFrac}{2 \text{L}} \sum_{k=1}^n \int_{\OmSph} \abs{ \psiL{k} - \psiL{k-1} }^2 \dH\, \text{d}\xflow \\ & \quad + \frac{1 - \viscFrac}{\DE} \sum_{k=1}^{n} \tau \int_{\OmSph} \Big[ \mollEps^2 | \nabla_\xflow \sqrt{\psiL{k}} |^2 + | \nabla_\surfaceLtr \sqrt{\psiL{k}} |^2 \Big] \dH\, \text{d}\xflow \\ &\leq \frac{\RE \DE}{2} \int_{\Omega} \abs{\mathbf{u}_0}^2 \, \text{d}\xflow + (1 - \viscFrac) \int_{\OmSph} \mathcal{F}(\psi_0) \dH\, \text{d}\xflow \numberthis[est:discrete_entropy] \\ &\quad + \frac{1 - \viscFrac}{2} \int_{\OmSph} \psi_0 \pot[\psi_0] \dH\, \text{d}\xflow + \frac{\activity^2 (1 - \viscFrac) T}{\DE} \norm{\psi_0}_{\LpOS{1}} + C_{*} \\ &\leq C\lrcb{ \RE, \DE, \DE^{-1}, \viscFrac, \activity, T, \overline{\C}_\mollEps, \potStr, d, \Omega, \mollEps, \mathbf{u}_0, \psi_0 } < \infty \qquad \text{ for all } n \in \{ 1, \dots, N \}, \end{align*} where $C_{*} > 0$ depends solely on $T, \psi_0, \DE^{-1}, \viscFrac, \overline{\C}_\mollEps, \potStr, d, \Omega$, and $\mollEps$. \end{lmm} \begin{proof}[Proof of Lemma \ref{lmm:time_discrete_entropy}] Let a regularization parameter $0 < \delta \ll 1$ be given. Then, we rewrite the diffusive terms in \eqref{eq:PLtau:psi} for all $\theta \in \HkOS{1}$ analogously to \eqref{fp:ex:iii:diff_x_rewritten} as follows: \begin{align} \label{discr_entr:diff_rewritten} \begin{split} & \frac{\mollEps^2}{\DE} \int_{\OmSph} \lrcb{\nabla_\xflow \psiL{n} + \text{Q}^\regL(\psiL{n}) \nabla_\xflow \potL{n}} \cdot \nabla_\xflow \theta \dH\, \text{d}\xflow \\ &\quad = \frac{\mollEps^2}{\DE} \int_{\OmSph} \text{Q}^\regL(\psiL{n} + \delta) \nabla_\xflow \muPsidL{n} \cdot \nabla_\xflow \theta \dH\, \text{d}\xflow \\ &\quad \quad + \frac{\mollEps^2}{\DE} \int_{\OmSph} \lrcb{\text{Q}^\regL(\psiL{n}) - \text{Q}^\regL(\psiL{n} + \delta)} \nabla_\xflow \potL{n} \cdot \nabla_\xflow \theta \dH\, \text{d}\xflow, \end{split} \end{align} where we introduced the $\delta$-regularized chemical potential \begin{align*} \muPsidL{n} := \lrcb{\entropL}^\prime(\psiL{n} + \delta) + \potL{n} \quad \in \HkOS{1}. \end{align*} Moreover, we recall the following estimate, which has been derived by Barrett and S\"uli by Taylor's series expansion (cf. \cite[p. 1238]{barrett_sueli_2011_polymers_I}): \begin{align} \label{discr_entr:taylor_est} \begin{split} &\int_{\OmSph} \frac{\psiL{n} - \psiL{n-1}}{\tau} \lrcb{\entropL}^\prime(\psiL{n} + \delta) \dH\, \text{d}\xflow \\ &\quad\geq \frac{1}{\tau} \int_{\OmSph} \left[ \entrop^\regL(\psiL{n} + \delta) - \entrop^\regL(\psiL{n-1} + \delta) \right] \dH\, \text{d}\xflow \\ &\quad\quad + \frac{1}{2 \tau \text{L}}\int_{\OmSph} \abs{ \psiL{n} - \psiL{n-1} } \dH\, \text{d}\xflow. \end{split} \end{align} Now, on noting \eqref{discr_entr:diff_rewritten} and \eqref{discr_entr:taylor_est}, we infer from taking $\mathbf{w} := \uL{n} \in \Hflow_{0,\text{div}}^1(\Omega)$ and $\theta := \muPsidL{n} \in \H^1(\Omega \times {\SMat^{d-1}})$ as test functions in \eqref{eq:PLtau:u} and \eqref{eq:PLtau:psi}, respectively, and from the analogue estimate \eqref{fp:ex:iii:u_psi_combined} with $\lambda = 1$ that the following estimate holds: \begin{align*} &\frac{\RE\DE}{2 \tau} \int_{\Omega} \left[ \abs{\uL{n}}^2 + \abs{\uL{n} - \uL{n-1}}^2 - \abs{\uL{n-1}}^2 \right] \, \text{d}\xflow + \viscFrac\DE \int_{\Omega} \abs{\nabla_\xflow \uL{n}}^2 \, \text{d}\xflow \\ &\qquad + \frac{(1-\viscFrac) \DE}{2} \int_{\OmSph} \text{Q}^\regL(\psiL{n}) \lrcb{\nabla_\xflow \uL{n} : \mflow\otimes\mflow}^2 \dH(\mflow)\, \text{d}\xflow \\ &\qquad + \frac{1-\viscFrac}{\tau} \int_{\OmSph} \left[ \entrop^\regL(\psiL{n} + \delta) - \entrop^\regL(\psiL{n-1} + \delta) \right] \dH\, \text{d}\xflow \\ &\qquad + \frac{1-\viscFrac}{2 \tau} \int_{\OmSph} \left[ \psiL{n} \pot[\psiL{n}] - \psiL{n-1} \pot[\psiL{n-1}] \right]\dH\, \text{d}\xflow \\ &\qquad + \frac{1-\viscFrac}{2 \tau \text{L}} \int_{\OmSph} \abs{ \psiL{n} - \psiL{n-1} }^2 \dH\, \text{d}\xflow \\ &\qquad + \frac{(1-\viscFrac) \mollEps^2}{\DE} \int_{\OmSph} \text{Q}^\regL(\psiL{n} + \delta) \abs{\nabla_\xflow \muPsidL{n}}^2 \dH\, \text{d}\xflow \\ &\qquad + \frac{1-\viscFrac}{\DE} \int_{\OmSph} \text{Q}^\regL(\psiL{n} + \delta) \abs{\nabla_\surfaceLtr \muPsidL{n}}^2 \dH\, \text{d}\xflow \\ &\quad\leq - \activity (1 - \viscFrac) \int_{\OmSph} \text{Q}^\regL(\psiL{n}) \mflow\otimes\mflow : \nabla_\xflow \uL{n} \dH(\mflow)\, \text{d}\xflow \numberthis[discr_entr:u_psi_combined] \\ &\quad\quad + (1-\viscFrac) \int_{\OmSph} \frac{\text{Q}^\regL(\psiL{n}) - \text{Q}^\regL(\psiL{n} + \delta)}{\text{Q}^\regL(\psiL{n} + \delta)} \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \uL{n} \mathbf{m} } \cdot \\ &\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \cdot \nabla_\surfaceLtr \psiL{n} \dH(\mflow)\, \text{d}\xflow \\ &\quad\quad - \frac{(1-\viscFrac)\mollEps^2}{\DE} \int_{\OmSph} \lrcb{ \text{Q}^\regL(\psiL{n}) - \text{Q}^\regL(\psiL{n} + \delta) } \nabla_\xflow \potL{n} \cdot \nabla_\xflow \muPsidL{n} \dH\, \text{d}\xflow \\ &\quad\quad - \frac{1-\viscFrac}{\DE} \int_{\OmSph} \lrcb{ \text{Q}^\regL(\psiL{n}) - \text{Q}^\regL(\psiL{n} + \delta) } \nabla_\surfaceLtr \potL{n} \cdot \nabla_\surfaceLtr \muPsidL{n} \dH\, \text{d}\xflow \\ &\quad=: I + II + III + IV. \end{align*} We infer from \eqref{reg:QL_leq}, the nonnegativity of $\psiL{n}$, and \eqref{eq:mass_consv_psiLn} that \begin{align} \label{discr_entr:I} \begin{split} \abs{I} &\leq \frac{(1-\viscFrac)\DE}{4} \int_{\OmSph} \text{Q}^\regL(\psiL{n}) \lrcb{\nabla_\xflow\uL{n} : \mflow\otimes\mflow}^2 \dH(\mflow)\, \text{d}\xflow \\ &\quad + \frac{\activity^2 (1 - \viscFrac)}{\DE} \int_{\OmSph} \psiL{0} \dH\, \text{d}\xflow. \end{split} \end{align} The first term on the right-hand side of \eqref{discr_entr:I} can be absorbed into the left-hand side of \eqref{discr_entr:u_psi_combined}. Next, similarly to \eqref{fp:ex:iii:III}, we deduce from the Lipschitz continuity of $\text{Q}^\regL$, the nonnegativity of $\psiL{n}$, \eqref{eq:nabla_potLk_bound}, \eqref{reg:QL_leq}, \eqref{eq:mass_consv_psiLn}, $0 < \delta < 1$, and Young's inequality that \begin{align} \label{discr_entr:II} \begin{split} \abs{II} &\leq \frac{1-\viscFrac}{4 \DE} \int_{\OmSph} \text{Q}^\regL(\psiL{n} + \delta) \abs{\nabla_\surfaceLtr \muPsidL{n}}^2 \dH\, \text{d}\xflow \\ &\quad + C_2\lrcb{\DE^{-1}, \viscFrac, \overline{\C}_\mollEps, \potStr, d, \Omega} \norm{\psiL{0}}_{\LpOS{1}}^2 \lrcb{ 1 + \norm{\psiL{0}}_{\LpOS{1}} } \\ &\quad + C_1(\DE, \viscFrac, d) \delta \int_{\Omega} \abs{\nabla_\xflow \uL{n}}^2 \, \text{d}\xflow, \end{split} \end{align} where $C_1 = C_1(\DE, \viscFrac, d) > 0$ and $C_2 = C_2\lrcb{\DE^{-1}, \viscFrac, \overline{\C}_\mollEps, \potStr, d, \Omega} > 0$ are independent of $\delta$, $\tau$, and $\text{L}$. Furthermore, on noting $\text{Q}^\regL(s) \leq \text{Q}^\regL(s + \delta)$ for all $s \geq 0$, the Lipschitz continuity of $\text{Q}^\regL$, the nonnegativity of $\psiL{n}$, \eqref{eq:nabla_potLk_bound}, and Young's inequality, we have that \begin{align} \label{discr_entr:III} \begin{split} \abs{III} &\leq \frac{\mollEps^2 (1-\viscFrac)}{2 \DE} \int_{\OmSph} \text{Q}^\regL(\psiL{n} + \delta) \abs{\nabla_\xflow \muPsidL{n}}^2 \dH\, \text{d}\xflow \\ &\quad + C_3\lrcb{ \DE^{-1}, \mollEps, \viscFrac, \Omega, \overline{\C}_\mollEps, \potStr, d } \delta \norm{\psiL{0}}_{\LpOS{1}}^2, \end{split} \end{align} where $C_3 = C_3\lrcb{ \DE^{-1}, \mollEps, \viscFrac, \Omega, \overline{\C}_\mollEps, \potStr, d } > 0$ is independent of $\delta$, $\tau$, and $\text{L}$. Analogously to \eqref{discr_entr:III}, it follows that \begin{align*} \abs{IV} &\leq \frac{1-\viscFrac}{4 \DE} \int_{\OmSph} \text{Q}^\regL(\psiL{n} + \delta) \abs{\nabla_\surfaceLtr \muPsidL{n}}^2 \dH\, \text{d}\xflow \\ &\quad + C_4\lrcb{\DE^{-1}, \viscFrac, \Omega, \overline{\C}_\mollEps, \potStr, d} \delta \norm{\psiL{0}}_{\LpOS{1}}^2, \numberthis[discr_entr:IV] \end{align*} where $C_4 = C_4\lrcb{\DE^{-1}, \viscFrac, \Omega, \overline{\C}_\mollEps, \potStr, d} > 0$ is independent of $\delta$, $\tau$, and $\text{L}$. Now, on combining \eqref{discr_entr:u_psi_combined}-\eqref{discr_entr:IV}, restricting the range of $\delta$ to \begin{align*} 0 < \delta < \frac{\viscFrac \DE}{2 C_1}, \end{align*} and applying a discrete integration in time, we have that \begin{align*} &\frac{\RE \DE}{2} \int_{\Omega} \abs{\uL{n}}^2 \, \text{d}\xflow + \frac{\RE \DE}{2} \sum_{k=1}^{n} \int_{\Omega} \abs{\uL{k} - \uL{k-1}}^2 \, \text{d}\xflow + \frac{\viscFrac \DE}{2} \sum_{k=1}^{n} \tau \int_{\Omega} \abs{\nabla_\xflow \uL{k}}^2 \, \text{d}\xflow \\ & \qquad + \frac{(1-\viscFrac) \DE}{4} \sum_{k=1}^{n} \tau \int_{\OmSph} \text{Q}^\regL(\psiL{k}) \lrcb{ \nabla_\xflow \uL{k} : \mflow\otimes\mflow }^2 \dH(\mflow)\, \text{d}\xflow \\ & \qquad + (1-\viscFrac) \int_{\OmSph} \entrop^\regL(\psiL{n} + \delta) \dH\, \text{d}\xflow + \frac{1-\viscFrac}{2} \int_{\OmSph} \psiL{n} \pot[\psiL{n}] \dH\, \text{d}\xflow \\ &\qquad + \frac{1-\viscFrac}{2 \text{L}} \sum_{k=1}^n \int_{\OmSph} \abs{ \psiL{k} - \psiL{k-1} }^2 \dH\, \text{d}\xflow \\ & \qquad + \frac{(1-\viscFrac) \mollEps^2}{2 \DE} \sum_{k=1}^{n} \tau \int_{\OmSph} \text{Q}^\regL(\psiL{k} + \delta) \abs{ \nabla_\xflow \muPsidL{k} }^2 \dH\, \text{d}\xflow \\ & \qquad + \frac{1-\viscFrac}{2 \DE} \sum_{k=1}^{n} \tau \int_{\OmSph} \text{Q}^\regL(\psiL{k} + \delta) \abs{ \nabla_\surfaceLtr \muPsidL{k} }^2 \dH\, \text{d}\xflow \\ &\quad\leq \frac{\RE \DE}{2} \int_{\Omega} \abs{\uL{0}}^2 \, \text{d}\xflow + (1-\viscFrac) \int_{\OmSph} \entrop^\regL(\psiL{0} + \delta) \dH\, \text{d}\xflow \numberthis[discr_entr:u_psi_I_IV_combined] \\ &\quad\quad + \frac{1-\viscFrac}{2} \int_{\OmSph} \psiL{0} \pot[\psiL{0}] \dH\, \text{d}\xflow + \frac{\activity^2 (1 - \viscFrac) T}{\DE} \norm{\psiL{0}}_{\LpOS{1}} \\ & \quad\quad + C_2 T \norm{\psiL{0}}_{\LpOS{1}}^2 \lrcb{ 1 + \norm{\psiL{0}}_{\LpOS{1}} } \\ & \quad\quad + (C_3 + C_4) T \delta \norm{\psiL{0}}_{\LpOS{1}}^2 \qquad \qquad \qquad \text{ for all } n \in \{ 1, \dots, N \}. \end{align*} Next, we infer from \eqref{eq:nabla_potLk_bound}, \eqref{reg:FLQL_leq_FL}, \eqref{eq:mass_consv_psiLn}, \eqref{init:regularity_psi_L_0}, and applying Lemma of Fatou (cf. \cite[p. 24]{chen_liu_2013_entropy_solution}, \cite[p. 1244f]{barrett_sueli_2011_polymers_I}) that \begin{align} \label{discr_entr:limit:diffusive_x} \begin{split} & \frac{(1-\viscFrac)\mollEps^2}{2 \DE} \lim_{\delta \searrow 0} \int_{\OmSph} \text{Q}^\regL(\psiL{k} + \delta) \abs{ \nabla_\xflow \muPsidL{k} }^2 \dH\, \text{d}\xflow \\ &\quad\geq \frac{(1-\viscFrac)\mollEps^2}{4 \DE} \lim_{\delta \searrow 0} \int_{\OmSph} \frac{\abs{\nabla_\xflow \psiL{k}}^2}{\psiL{k} + \delta} \dH\, \text{d}\xflow - C(\overline{\C}_\mollEps, \potStr, d, \Omega, \viscFrac, \mollEps, \DE^{-1}, \psi_0) \\ &\quad\geq \frac{(1-\viscFrac)\mollEps^2}{\DE} \int_{\OmSph} \abs{\nabla_\xflow \sqrt{\psiL{k}}}^2 \dH\, \text{d}\xflow - C(\overline{\C}_\mollEps, \potStr, d, \Omega, \viscFrac, \mollEps, \DE^{-1}, \psi_0). \end{split} \end{align} We apply similar computations for the term $\text{Q}^\regL(\psiL{k} + \delta) \abs{\nabla_\surfaceLtr \muPsidL{k}}^2$ (cf. \cite[p. 24]{chen_liu_2013_entropy_solution}). Finally, on noting \eqref{discr_entr:limit:diffusive_x}, the regularities of the initial data \eqref{init:regularity_u_L_0}, \eqref{init:regularity_psi_L_0}, \eqref{init:psi_0_pot_0}, and \eqref{reg:FLQL_leq_FL}, applying Lemma of Fatou and the Dominated Convergence Theorem in \eqref{discr_entr:u_psi_I_IV_combined} yields the entropy estimate \eqref{est:discrete_entropy} when passing to the limit as $\delta \searrow 0$. \end{proof} \subsection{Regularity of the polymer number density} \label{sec:particle_density} The discrete-in-time entropy estimate \eqref{est:discrete_entropy} is a good starting point to establish regularity results for $\uL{n}$ and $\psiL{n}$. However, the bounds in \eqref{est:discrete_entropy} are too weak to extract strongly converging subsequences. Unfortunately, testing \eqref{eq:PLtau:psi} with $\theta := \psiL{n}$ is fraud with difficulties to improve the regularity of $\psiL{n}$. Instead, we shall establish bounds on the discrete-in-time polymer number density \begin{align} \label{def:omegaL} \omegaL{n}(\mathbf{x}) := \int_{\Sph} \psiL{n}(\mathbf{x}, \mathbf{m}) \dH(\mflow) \quad \text{ for } \mathbf{x} \in \Omega,\ n \in \{0, \dots, N\}. \end{align} \begin{lmm} \label{lmm:regularity_omegaL} Suppose that the assumptions \eqref{assumptions:domain_init_data} hold. Moreover, let the time increment satisfy \begin{align*} 0 < \tau < \frac{1}{4 \widetilde{C} \norm{\psi_0}_{\LpOS{1}}^2}, \end{align*} where $\widetilde{C} > 0$ depends only on $\DE^{-1}, \mollEps, \overline{\C}_\mollEps, \potStr$, and $d$. Then, the following estimate holds for $n \in \{1, \dots, N\}$ \begin{align} \label{eq:regularity_omegaL} \begin{split} &\frac{1}{4} \int_{\Omega} \abs{\omegaL{n}}^2 \, \text{d}\xflow + \frac{1}{2} \sum_{k=1}^{n} \int_{\Omega} \abs{\omegaL{k} - \omegaL{k-1}}^2 \, \text{d}\xflow + \frac{\mollEps^2}{2 \DE} \sum_{k=1}^{n} \tau \int_{\Omega} \abs{ \nabla_\xflow \omegaL{k} }^2 \, \text{d}\xflow \\ &\quad\leq \lrcb{ 1 + \widetilde{C} \norm{\psi_0}_{\LpOS{1}}^2 T \exp\lrcb{ \widetilde{C} \norm{\psi_0}_{\LpOS{1}}^2 T } } \norm{\psi_0}_{\L^2(\Omega; \L^1({\SMat^{d-1}}))}^2 \\ &\quad< \infty. \end{split} \end{align} \end{lmm} \begin{proof} We deduce from choosing $\theta := \omegaL{n} \in \H^1(\Omega)$ in \eqref{eq:PLtau:psi}, \eqref{eq:nabla_potLk_bound}, \eqref{reg:QL_leq}, \eqref{eq:mass_consv_psiLn}, \eqref{def:omegaL}, \begin{align*} \int_{\Omega} \omegaL{n} \nabla_\xflow \omegaL{n} \cdot \uL{n} \, \text{d}\xflow = \int_{\Omega} \frac{1}{2} \nabla_\xflow (\omegaL{n})^2 \cdot \uL{n} \, \text{d}\xflow = 0, \end{align*} and Young's inequality that \begin{align*} &\frac{1}{2 \tau} \int_{\Omega} \left[ \abs{\omegaL{n}}^2 + \abs{\omegaL{n} - \omegaL{n-1}}^2 - \abs{\omegaL{n-1}}^2 \right] \, \text{d}\xflow + \frac{\mollEps^2}{\DE} \int_{\Omega} \abs{ \nabla_\xflow \omegaL{n} }^2 \, \text{d}\xflow \\ &\quad= -\frac{\mollEps^2}{\DE} \int_{\OmSph} \text{Q}^\regL(\psiL{n}) \nabla_\xflow \potL{n} \cdot \nabla_\xflow \omegaL{n} \dH\, \text{d}\xflow \\ &\quad\leq \frac{\mollEps^2}{2 \DE} \int_{\Omega} \abs{\nabla_\xflow \omegaL{n}}^2 \, \text{d}\xflow + C\lrcb{\DE^{-1}, \mollEps, \overline{\C}_\mollEps, \potStr, d} \norm{\psi_0}_{\LpOS{1}}^2 \int_{\Omega} \abs{\omegaL{n}}^2 \, \text{d}\xflow. \end{align*} Thus, a discrete integration in time and \eqref{init:psi_0} yield \begin{align} \label{eq:omegaL_combined} \begin{split} &\frac{1}{2} \int_{\Omega} \abs{\omegaL{n}}^2 \, \text{d}\xflow + \frac{1}{2} \sum_{k=1}^{n} \int_{\Omega} \abs{\omegaL{k} - \omegaL{k-1}}^2 \, \text{d}\xflow + \frac{\mollEps^2}{2 \DE} \sum_{k=1}^{n} \tau \int_{\Omega} \abs{\nabla_\xflow \omegaL{k}}^2 \, \text{d}\xflow \\ &\quad\leq \frac{1}{2} \norm{\psi_0}_{\L^2(\Omega; \L^1({\SMat^{d-1}}))}^2 + C_1\lrcb{\DE^{-1}, \mollEps, \overline{\C}_\mollEps, \potStr, d} \norm{\psi_0}_{\LpOS{1}}^2 \sum_{k=1}^n \tau \int_{\Omega} \abs{\omegaL{k}}^2 \, \text{d}\xflow \end{split} \end{align} for $n \in \{1, \dots, N\}$, where $C_1 = C_1\lrcb{\DE^{-1}, \mollEps, \overline{\C}_\mollEps, \potStr, d} > 0$ is independent of $\tau$ and $\text{L}$. We complete the proof by restricting the range of the time increment to \begin{align*} 0 < \tau < \frac{1}{4 C_1 \norm{ \psi_0 }_{\LpOS{1}}^2}, \end{align*} and by applying a discrete version of Gronwall's inequality (cf. \cite[Lemma 4.3.2]{werner1986ode}). \end{proof} \subsection{Time regularity} \label{sec:time_regularity} In this section, we derive bounds on the discrete time derivatives of $\uL{n}$ and $\psiL{n}$ in appropriate spaces to apply compactness results to be able to extract strongly converging subsequences. \begin{lmm}[Time regularity of $\mathbf{u}$] \label{lmm:time_reg:uL} Suppose that the assumptions \eqref{assumptions:domain_init_data} hold and that $\tau > 0$ satisfies the condition of Lemma \ref{lmm:regularity_omegaL}. Then, we have that \begin{align} \label{eq:time_reg:uL} \sum_{k=1}^N \tau \norm{ \frac{\uL{k} - \uL{k-1}}{\tau} }_{ (\Vk{2})^\prime}^2 \leq C, \end{align} where $C>0$ depends solely on $\RE, \RE^{-1}, \DE, \DE^{-1}, \viscFrac, \viscFrac^{-1}, \activity, T$, $\overline{\C}_\mollEps, \mollEps, \potStr, d, \Omega, \mathbf{u}_0,$ and $\psi_0$. \end{lmm} \begin{proof} Let $\mathbf{w} \in \Vk{2} \hookrightarrow \L^\infty(\Omega)$. Then, we infer from \eqref{eq:PLtau:u} and \eqref{reg:QL_leq} that, for $n \in \{1, \dots, N\}$, \begin{align*} &\RE\DE \abs{ \int_{\Omega} \frac{\uL{n} - \uL{n-1}}{\tau} \cdot \mathbf{w} \, \text{d}\xflow } \\ &\quad \leq \RE\DE \int_{\Omega} \abs{\uL{n-1}} \abs{\nabla_\xflow \uL{n}} \abs{\mathbf{w}} \, \text{d}\xflow + \viscFrac\DE \norm{\nabla_\xflow \uL{n}}_{\L^2(\Omega)} \norm{\nabla_\xflow \mathbf{w}}_{\L^2(\Omega)} \\ &\qquad + \frac{(1-\viscFrac) \DE}{2} \int_{\OmSph} \text{Q}^\regL(\psiL{n}) \abs{\nabla_\xflow \uL{n} : \mflow\otimes\mflow} \abs{\nabla_\xflow \mathbf{w} : \mflow\otimes\mflow} \dH(\mflow) \, \text{d}\xflow \\ &\qquad + (1-\viscFrac) \int_{\OmSph} \abs{\psiL{n}} \abs{\nabla_\xflow \potL{n}} \abs{\mathbf{w}} \dH\, \text{d}\xflow \\ &\qquad + (1-\viscFrac) C(d) \int_{\OmSph} \abs{\psiL{n}} \abs{\nabla_\surfaceLtr \potL{n}} \abs{\nabla_\xflow \mathbf{w}} \dH\, \text{d}\xflow \numberthis[eq:tr:uL:tested] \\ &\qquad + (1-\viscFrac) \lrcb{ C(d) + \activity } \int_{\OmSph} \abs{\psiL{n}} \abs{\nabla_\xflow \mathbf{w}} \dH\, \text{d}\xflow \\ &\quad =: I + II + III + IV + V + VI. \end{align*} First, on noting \eqref{eq:mass_consv_psiLn}, \eqref{reg:QL_leq}, \eqref{init:regularity_psi_L_0}, and \eqref{eq:regularity_omegaL}, applying H\"older's inequality yields \begin{align*} III &\leq C(\viscFrac, \DE, d) \lrcb{ \int_{\OmSph} \text{Q}^\regL(\psiL{n}) \lrcb{ \nabla_\xflow \uL{n} : \mflow\otimes\mflow }^2 \dH(\mflow) \, \text{d}\xflow }^\frac{1}{2} \cdot \\ &\qquad\qquad\qquad \cdot \norm{\nabla_\xflow \mathbf{w}}_{\L^4(\Omega)} \norm{\omegaL{n}}_{\L^2(\Omega)}^{\frac{1}{2}} \\ &\leq C \lrcb{ \int_{\OmSph} \text{Q}^\regL(\psiL{n}) \lrcb{ \nabla_\xflow \uL{n} : \mflow\otimes\mflow }^2 \dH(\mflow) \, \text{d}\xflow }^\frac{1}{2} \norm{\mathbf{w}}_{\Vk{2}}, \numberthis[eq:tr:uL:III] \end{align*} where $C = C(\viscFrac, \DE, d, \DE^{-1}, \mollEps, \overline{\C}_\mollEps, \potStr, \psi_0) >0$. Furthermore, we deduce from \eqref{eq:nabla_potLk_bound}, \eqref{def:omegaL}, and \eqref{eq:regularity_omegaL} that \begin{align} \label{eq:tr:uL:IV_V} \begin{split} IV + V &\leq C\lrcb{ \viscFrac, d, \overline{\C}_\mollEps, \potStr } \norm{\psi_0}_{\LpOS{1}} \lrcb{ \max_{k \in \{1, \dots, N\}} \norm{\omegaL{k}}_{\L^2(\Omega)} } \norm{\mathbf{w}}_{\Vk{2}} \\ &\leq C\lrcb{\viscFrac, d, \overline{\C}_\mollEps, \potStr, \DE^{-1}, \mollEps, T, \psi_0} \norm{\mathbf{w}}_{\Vk{2}}. \end{split} \end{align} The other terms in \eqref{eq:tr:uL:tested} are handled easily such that combining \eqref{eq:tr:uL:tested} - \eqref{eq:tr:uL:IV_V} yields \begin{align} \label{eq:tr:uL:combined} \begin{split} &\abs{ \int_{\Omega} \frac{\uL{n} - \uL{n-1}}{\tau} \cdot \mathbf{w} \, \text{d}\xflow } \\ &\quad\leq C \bigg( 1 + \norm{\nabla_\xflow \uL{n}}_{\L^2(\Omega)} \\ &\qquad\qquad + \lrcb{ \int_{\OmSph} \text{Q}^\regL(\psiL{n}) \lrcb{ \nabla_\xflow \uL{n} : \mflow\otimes\mflow }^2 \dH(\mflow)\, \text{d}\xflow }^\frac{1}{2} \bigg) \norm{\mathbf{w}}_{\Vk{2}}, \end{split} \end{align} where $C = C\lrcb{ \RE, \RE^{-1}, \DE, \DE^{-1}, \viscFrac, \activity, T, \overline{\C}_\mollEps, \mollEps, \potStr, d, \Omega, \mathbf{u}_0, \psi_0 } > 0$. Hence, on noting \eqref{est:discrete_entropy}, multiplying \eqref{eq:tr:uL:combined} by $\tau$ and summing up from $n = 1 \to N$, we complete the proof. \end{proof} \begin{lmm}[Time regularity of $\psi$] \label{lmm:time_reg:psiL} Suppose that the assumptions \eqref{assumptions:domain_init_data} hold and that $\tau > 0$ satisfies the condition of Lemma \ref{lmm:regularity_omegaL}. Then, we have that \begin{align} \label{eq:time_reg:psiL} \sum_{k=1}^N \tau \norm{\frac{\psiL{k} - \psiL{k-1}}{\tau}}_{ \lrcb{\HkOS{4}}^\prime }^2 \leq C, \end{align} where $C>0$ depends solely on $\Omega, \RE, \RE^{-1}, \DE, \DE^{-1}, \viscFrac, \viscFrac^{-1}, \activity, T, \overline{\C}_\mollEps, \mollEps, \mollEps^{-1}, \potStr, d, \mathbf{u}_0$, and $\psi_0$. \end{lmm} \begin{proof} Let $n \in \{1, \dots, N\}$ and $\theta \in \H^4({\Omega\times\Sph}) \hookrightarrow \mathrm{W}^{1, \infty}({\Omega\times\Sph})$. Then, we infer from \eqref{eq:PLtau:psi} that \begin{align*} &\abs{ \int_{\OmSph} \frac{\psiL{n} - \psiL{n-1}}{\tau} \theta \dH\, \text{d}\xflow } \\ &\quad\leq \int_{\OmSph} \abs{\psiL{n}} \abs{\uL{n}} \abs{\nabla_\xflow \theta} \dH\, \text{d}\xflow \\ &\quad\quad + \frac{\mollEps^2}{\DE} \int_{\OmSph} \abs{\nabla_\xflow \psiL{n}} \abs{\nabla_\xflow \theta} \dH\, \text{d}\xflow + \frac{1}{\DE} \int_{\OmSph} \abs{\nabla_\surfaceLtr \psiL{n}} \abs{\nabla_\surfaceLtr \theta} \dH\, \text{d}\xflow \\ &\quad\quad + \frac{\mollEps^2}{\DE} \int_{\OmSph} \text{Q}^\regL(\psiL{n}) \abs{\nabla_\xflow \potL{n}} \abs{\nabla_\xflow \theta} \dH\, \text{d}\xflow \\ &\quad\quad+ \frac{1}{\DE} \int_{\OmSph} \text{Q}^\regL(\psiL{n}) \abs{\nabla_\surfaceLtr \potL{n}} \abs{\nabla_\surfaceLtr \theta} \dH\, \text{d}\xflow \\ &\quad\quad + C(d) \int_{\OmSph} \text{Q}^\regL(\psiL{n}) \abs{\nabla_\xflow \uL{n}} \abs{\nabla_\surfaceLtr \theta} \dH\, \text{d}\xflow \\ &\quad=: I + II + III + IV + V + VI. \numberthis[eq:tr:psiL:tested] \end{align*} First, we obtain from \eqref{reg:QL_leq}, \eqref{eq:mass_consv_psiLn}, \eqref{init:regularity_psi_L_0}, and \eqref{eq:nabla_potLk_bound} that \begin{align} \label{eq:tr:psiL:IV_V} \begin{split} IV + V &\leq C(\mollEps, \DE^{-1}) \Big( \norm{\nabla_\xflow \potL{n}}_{\LpOS{\infty}} \\ &\qquad\qquad + \norm{\nabla_\surfaceLtr \potL{n}}_{\LpOS{\infty}} \Big) \norm{\psiL{n}}_{\LpOS{1}} \norm{\theta}_{\mathrm{W}^{1, \infty}({\Omega\times\Sph})} \\ &\leq C(\mollEps, \DE^{-1}, \Omega, d) \norm{\psi_0}_{\LpOS{1}}^2 \norm{\theta}_{\HkOS{4}}. \end{split} \end{align} The estimates of the other terms in \eqref{eq:tr:psiL:tested} can be found in \cite[p.25]{chen2017activeLC}. Thus, we conclude that \begin{align} \label{eq:tr:psiL:combined} \begin{split} &\abs{ \int_{\OmSph} \frac{\psiL{n} - \psiL{n-1}}{\tau} \theta \dH\, \text{d}\xflow } \\ &\quad\leq C \Big( 1 + \norm{ \nabla_\xflow \sqrt{\psiL{n}} }_{\LpOS{2}} \\ &\qquad\qquad + \norm{ \nabla_\surfaceLtr \sqrt{\psiL{n}} }_{\LpOS{2}} + \norm{\nabla_\xflow \uL{n}}_{\L^2(\Omega)} \Big) \norm{\theta}_{\HkOS{4}}, \end{split} \end{align} where $C = C\lrcb{ \Omega, \RE, \RE^{-1}, \DE, \DE^{-1}, \viscFrac, \activity, T, \overline{\C}_\mollEps, \mollEps, \potStr, d, \mathbf{u}_0, \psi_0 } > 0$. Now, to complete the proof, we multiply \eqref{eq:tr:psiL:combined} by $\tau$, sum up from $n = 1 \to N$, and apply \eqref{est:discrete_entropy}. \end{proof} \section{Passage to the limit: Existence of weak solutions} \label{sec:passage_limit} In this section, our goal is to pass to the limit in \eqref{def:PLtau} as $\text{L} \nearrow \infty$ and $\tau \searrow 0$. Before doing so however we reformulate \eqref{def:PLtau} continuously in time. For this task, let us define the following continuous-in-time functions: \begin{equation} \label{def:time_cont_fcts} \begin{alignedat}{2} \uL{{\tau,+}}(\cdot, t) &:= \uL{n}(\cdot), \qquad \uL{{\tau,-}}(\cdot, t) := \uL{n-1}(\cdot),\quad && t \in (t_{n-1}, t_n] , \quad n \in \{1, \dots, N\}, \\ \uL{{\tau,-}}(\cdot, 0) &:= \uL{0}(\cdot) \in \Hflow_{0,\text{div}}^1(\Omega). \end{alignedat} \end{equation} Moreover, we define similarly to Chen and Liu (cf. \cite[p. 26]{chen_liu_2013_entropy_solution}) the difference quotient with respect to time by \begin{align} \label{def:time_deriv} \partial_{t}^{\tau} \uL{{\tau,+}}(\cdot, t) := \frac{\uL{n}(\cdot) - \uL{n-1}(\cdot)}{\tau}, \quad t \in (t_{n-1}, t_n], \quad n \in \{1, \dots, N\}. \end{align} We introduce the same notation for $\psiL{\tau, \pm}$ and $\partial_{t}^{\tau} \psiL{{\tau,+}}$ with $\psiL{{\tau,-}}(\cdot, \tilde{\cdot}, 0) = \psiL{0}(\cdot, \tilde{\cdot})$. From now on, let \begin{align} \label{tc:cond:tau} \tau \in o(\text{L}^{-1}) \text{ satisfy the condition in Lemma } \ref{lmm:regularity_omegaL}. \end{align} On noting the time continuous notation \eqref{def:time_cont_fcts}, we can rewrite the weak formulation \eqref{def:PLtau} after a discrete integration with respect to time as follows:\\ Find $\uL{\tau, \pm}(\cdot, t) \in \Hflow_{0,\text{div}}^1(\Omega)$, $t \in (0,T]$, such that \begin{align*} &\RE \DE \int_0^T\int_{\Omega} \partial_{t}^{\tau} \uL{{\tau,+}} \cdot \mathbf{w} \, \text{d}\xflow\,\text{dt} + \RE \DE \int_0^T\int_{\Omega} \lrcb{ (\uL{{\tau,-}} \cdot \nabla_\xflow) \uL{{\tau,+}} } \cdot \mathbf{w} \, \text{d}\xflow\,\text{dt} \\ &\quad\quad + \viscFrac \DE \int_0^T\int_{\Omega} \nabla_\xflow \uL{{\tau,+}} : \nabla_\xflow \mathbf{w} \, \text{d}\xflow\,\text{dt} \\ &\quad\quad + \frac{(1-\viscFrac) \DE}{2} \int_0^T\int_{\OmSph} \text{Q}^\regL(\psiL{{\tau,+}}) \lrcb{ \nabla_\xflow \uL{{\tau,+}} : \mflow\otimes\mflow } \cdot \\ &\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \cdot \lrcb{\nabla_\xflow \mathbf{w} : \mflow\otimes\mflow} \dH(\mflow)\, \text{d}\xflow\,\text{dt} \\ &\quad= - \frac{(1-\viscFrac)}{2} \int_0^T\int_{\OmSph} \psiL{{\tau,+}} \nabla_\xflow \pot[\psiL{{\tau,+}} + \psiL{{\tau,-}}] \cdot \mathbf{w} \dH\, \text{d}\xflow\,\text{dt} \numberthis[tc:eq:u] \\ &\quad\quad - \frac{1-\viscFrac}{2} \int_0^T\int_{\OmSph} \text{Q}^\regL(\psiL{{\tau,+}}) \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{w} \mathbf{m} } \cdot \\ &\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad \cdot \nabla_\surfaceLtr \pot[\psiL{{\tau,+}} + \psiL{{\tau,-}}] \dH(\mflow)\, \text{d}\xflow\,\text{dt} \\ &\quad\quad - (1-\viscFrac) \int_0^T\int_{\OmSph} \psiL{{\tau,+}} \lrcb{d\mflow\otimes\mflow - \mathbb{I}} : \nabla_\xflow \mathbf{w} \dH(\mflow)\, \text{d}\xflow\,\text{dt} \\ &\quad\quad - \activity (1 - \viscFrac) \int_0^T\int_{\OmSph} \text{Q}^\regL(\psiL{{\tau,+}}) \lrcb{ \mflow\otimes\mflow : \nabla_\xflow \mathbf{w} } \dH(\mflow)\, \text{d}\xflow\,\text{dt} \end{align*} for all $\mathbf{w} \in \L^1(0,T; \Hflow_{0,\text{div}}^1(\Omega))$. Moreover, find $\psiL{\tau, \pm}(\cdot, \tilde{\cdot}, t) \in \HkOS{1} \cap \Zp{2}$, $t \in (0,T]$, such that \begin{align*} &\int_0^T\int_{\OmSph} \partial_{t}^{\tau} \psiL{{\tau,+}} \theta \dH\, \text{d}\xflow\,\text{dt} - \int_0^T\int_{\OmSph} \psiL{{\tau,+}} \uL{{\tau,+}} \cdot \nabla_\xflow \theta \dH\, \text{d}\xflow\,\text{dt} \\ &\qquad + \frac{1}{\DE} \int_0^T\int_{\OmSph} \left[ \mollEps^2 \nabla_\xflow \psiL{{\tau,+}} \cdot \nabla_\xflow \theta + \nabla_\surfaceLtr \psiL{{\tau,+}} \cdot \nabla_\surfaceLtr \theta \right] \dH\, \text{d}\xflow\,\text{dt} \\ &\qquad + \frac{\mollEps^2}{2 \DE} \int_0^T\int_{\OmSph} \text{Q}^\regL(\psiL{{\tau,+}}) \nabla_\xflow \pot[\psiL{{\tau,+}} + \psiL{{\tau,-}}] \cdot \nabla_\xflow \theta \dH\, \text{d}\xflow\,\text{dt} \numberthis[tc:eq:psi] \\ &\qquad + \frac{1}{2 \DE} \int_0^T\int_{\OmSph} \text{Q}^\regL(\psiL{{\tau,+}}) \nabla_\surfaceLtr \pot[\psiL{{\tau,+}} + \psiL{{\tau,-}}] \cdot \nabla_\surfaceLtr \theta \dH\, \text{d}\xflow\,\text{dt} \\ &\qquad - \int_0^T\int_{\OmSph} \text{Q}^\regL(\psiL{{\tau,+}}) \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \uL{{\tau,+}} \mathbf{m} } \cdot \nabla_\surfaceLtr \theta \dH(\mflow)\, \text{d}\xflow\,\text{dt} = 0 \end{align*} for all $\theta \in \L^1(0,T; \HkOS{1})$. We note that the problem \eqref{tc:eq:u}-\eqref{tc:eq:psi} is equivalent to \eqref{eq:PLtau:u}-\eqref{eq:PLtau:psi}, to which existence of solutions has been proved (cf. Lemma \ref{lmm:existence_fp}). Furthermore, let us define for future purposes \begin{subequations} \begin{align} \omegaL{\tau, \pm}(\mathbf{x}, t) &:= \int_{\Sph} \psiL{\tau, \pm}(\mathbf{x}, \mathbf{m}, t) \dH(\mflow) \in \mathbb{R}_{\geq 0}, \label{tc:def:omegaL} \\ \StressL{\tau, \pm}(\mathbf{x}, t) &:= \int_{\Sph} \psiL{\tau, \pm}(\mathbf{x}, \mathbf{m}, t) \mflow\otimes\mflow \dH(\mflow) \in \mathbb{R}^{d \times d} \label{tc:def:StressL} \end{align} \end{subequations} for a.e. $(\mathbf{x}, t) \in \Omega \times (0, T]$. Thus, we can rewrite the interaction potential as follows: \begin{align} \label{tc:pot_repres} \pot[\psiL{\tau, \pm}](\mathbf{x}, \mathbf{m}, t) = \potStr \Je{\omegaL{\tau, \pm}(\cdot, t)}(\mathbf{x}) - \potStr \JeMat{\StressL{\tau, \pm}(\cdot, t)}(\mathbf{x}) : \mflow\otimes\mflow \end{align} for $(\mathbf{x}, \mathbf{m}, t) \in {\Omega\times\Sph} \times (0, T]$. Moreover, we obtain from \eqref{init:regularity_u_L_0}, $\tau \in o(\text{L}^{-1})$, \eqref{def:time_cont_fcts}, \eqref{est:discrete_entropy}, and \eqref{eq:regularity_omegaL} that \begin{align*} &\esssup_{t \in [0,T]} \int_{\Omega} \abs{\uL{\tau, \pm}(\mathbf{x}, t)}^2 \, \text{d}\xflow + \frac{1}{\tau} \int_0^T\int_{\Omega} \abs{ \uL{{\tau,+}} - \uL{{\tau,-}} }^2 \, \text{d}\xflow\,\text{dt} \\ &\quad\quad+ \int_0^T\int_{\Omega} \abs{\nabla_\xflow \uL{\tau, \pm}}^2 \, \text{d}\xflow\,\text{dt} \\ &\quad\quad + \esssup_{t \in [0,T]} \int_{\OmSph} \mathcal{F}(\psiL{{\tau,+}}(\mathbf{x}, \mathbf{m}, t)) \dH(\mflow)\, \text{d}\xflow \\ &\quad\quad + \frac{1}{\tau \text{L}} \int_0^T\int_{\OmSph} \abs{ \psiL{{\tau,+}} - \psiL{{\tau,-}} }^2 \dH\, \text{d}\xflow\,\text{dt} \numberthis[tc:regularity_past] \\ &\quad\quad + \int_0^T\int_{\OmSph} \Big[ | \nabla_\xflow \sqrt{\psiL{{\tau,+}}} |^2 + | \nabla_\surfaceLtr \sqrt{\psiL{{\tau,+}}} |^2 \Big] \dH\, \text{d}\xflow\,\text{dt} \\ &\quad\quad + \esssup_{t \in [0,T]} \int_{\Omega} \abs{\omegaL{{\tau,+}}(\mathbf{x}, t)}^2 \, \text{d}\xflow + \int_0^T\int_{\Omega} \abs{\nabla_\xflow \omegaL{{\tau,+}}}^2 \, \text{d}\xflow\,\text{dt} \\ &\quad\quad + \frac{1}{\tau} \int_0^T\int_{\Omega} \abs{ \omegaL{{\tau,+}} - \omegaL{{\tau,-}} }^2 \, \text{d}\xflow\,\text{dt} \\ &\quad\leq C_\star < \infty, \end{align*} where $C_\star = C_\star \lrcb{ \RE, \RE^{-1}, \DE, \DE^{-1}, \viscFrac, \viscFrac^{-1}, \activity, T, \overline{\C}_\mollEps, \mollEps, \mollEps^{-1}, \potStr, d, \Omega, \mathbf{u}_0, \psi_0 } > 0$ is independent of $\tau$ and $\text{L}$. \begin{thrm}[Main Theorem: Existence of weak solutions] \label{thrm:main} Suppose that the assumptions \eqref{assumptions:domain_init_data} and the condition \eqref{tc:cond:tau}, which relates $\tau$ to $\text{L}$, hold. Then, there exists a subsequence of $\{ (\uL{\tau, \pm}, \psiL{\tau, \pm}) \}_{\text{L} > 1}$ (not relabelled) and a pair of functions $(\mathbf{u}, \psi)$ such that \begin{subequations} \begin{gather} \mathbf{u} \in \L^\infty(0, T; \mathbf{L}^2(\Omega)) \cap \L^2(0, T; \Hflow_{0,\text{div}}^1(\Omega)), \label{tc:limit:u} \\ \partial_t \mathbf{u} \in \L^2\lrcb{ 0,T; ( \Vk{2} )^\prime }, \label{tc:limit:dt_u} \end{gather} \end{subequations} and \begin{subequations} \begin{gather} \psi \in \L^\infty(0,T; \L^2(\Omega; \L^1({\SMat^{d-1}}))), \quad \sqrt{\psi} \in \L^2(0,T; \HkOS{1}), \label{tc:limit:psi} \\ \partial_t \psi \in \L^2( 0,T; (\HkOS{4})^\prime ), \label{tc:limit:dt_psi} \end{gather} \end{subequations} with $\psi \geq 0$ a.e. in ${\Omega\times\Sph} \times [0,T]$ and \begin{align} \label{tc:limit:finite_entropy} \mathcal{F}(\psi) \in \L^\infty(0, T; \LpOS{1}). \end{align} Moreover, it holds that, as $\text{L} \nearrow \infty$ (and thereby $\tau \searrow 0$), \begin{subequations} \begin{alignat}{3} \uL{\tau, \pm} &\overset{*}{\rightharpoonup} \mathbf{u} \quad &&\text{ weak}^* &&\text{ in } \L^\infty(0, T; \mathbf{L}^2(\Omega)) \label{tc:limit:u:weakstar} \\ \uL{\tau, \pm} &\rightharpoonup \mathbf{u} \quad &&\text{ weakly} &&\text{ in } \L^2(0,T; \Hflow_{0,\text{div}}^1(\Omega)), \label{tc:limit:u:weak} \\ \uL{\tau, \pm} &\to \mathbf{u} \quad &&\text{ strongly} &&\text{ in } \L^2(0,T; \mathbf{L}^r(\Omega)), \label{tc:limit:u:strong}\\ \partial_{t}^{\tau} \uL{{\tau,+}} &\rightharpoonup \partial_t \mathbf{u} \quad &&\text{ weakly} &&\text{ in } \L^2( 0,T; (\Vk{2})^\prime ), \label{tc:limit:u:dt} \end{alignat} \end{subequations} where $r \in [1, \infty)$ if $d = 2$ and $r \in [1, 6)$ if $d = 3$, and \begin{subequations} \begin{alignat}{3} \nabla_\xflow \sqrt{\psiL{{\tau,+}}} &\rightharpoonup \nabla_\xflow \sqrt{\psi} \quad &&\text{ weakly} &&\text{ in } \L^2(0,T; \mathbf{L}^2({\Omega\times\Sph})), \label{tc:limit:psi:nablax_sqrt} \\ \nabla_\surfaceLtr \sqrt{\psiL{{\tau,+}}} &\rightharpoonup \nabla_\surfaceLtr \sqrt{\psi} \quad &&\text{ weakly} &&\text{ in } \L^2(0,T; \mathbf{L}^2({\Omega\times\Sph})), \label{tc:limit:psi:nablag_sqrt} \\ \sqrt{\psiL{{\tau,+}}} &\to \sqrt{\psi} \quad&&\text{ strongly} &&\text{ in } \L^4(0,T; \L^4(\Omega; \L^2({\SMat^{d-1}}))), \label{tc:limit:psi:sqrt_strong} \\ \psiL{\tau, \pm} &\to \psi \quad&&\text{ strongly} &&\text{ in } \L^2(0,T; \L^2(\Omega; \L^1({\SMat^{d-1}}))), \label{tc:limit:psi:strong} \\ \text{Q}^\regL(\psiL{{\tau,+}}) &\to \psi \quad&&\text{ strongly} &&\text{ in } \L^2(0,T; \L^2(\Omega; \L^1({\SMat^{d-1}}))), \label{tc:limit:psi:QL_strong} \\ \partial_{t}^{\tau} \psiL{{\tau,+}} &\rightharpoonup \partial_t \psi \quad&&\text{ weakly} &&\text{ in } \L^2( 0,T; (\HkOS{4})^\prime ). \label{tc:limit:psi:dt} \end{alignat} \end{subequations} Furthermore, we introduce \begin{subequations} \label{tc:def:omega_Stress} \begin{align} \omega(\mathbf{x}, t) &:= \int_{\Sph} \psi(\mathbf{x}, \mathbf{m}, t) \dH(\mflow) \in \mathbb{R}_{\geq 0} \ \text{ and } \label{tc:def:omega}\\ \Stress(\mathbf{x}, t) &:= \int_{\Sph} \psi(\mathbf{x}, \mathbf{m}, t) \mflow\otimes\mflow \dH(\mflow) \in \mathbb{R}^{d \times d} \label{tc:def:Stress} \end{align} \end{subequations} for a.e. $(\mathbf{x}, t) \in \Omega \times (0,T]$. It holds that \begin{subequations} \begin{align} \omega &\in \L^\infty(0, T; \L^2(\Omega)) \cap \L^2(0, T; \H^1(\Omega)), \label{tc:limit:omega} \\ \Stress &\in \L^\infty(0, T; \mathbb{L}^2(\Omega)), \label{tc:limit:Stress} \end{align} \end{subequations} and that \begin{subequations} \begin{alignat}{3} \omegaL{\tau, \pm} &\to \omega \quad&&\text{ strongly} &&\text{ in } \L^2(0,T; \L^2(\Omega)), \label{tc:limit:omega:strong} \\ \StressL{\tau, \pm} &\to \Stress \quad&&\text{ strongly} &&\text{ in } \L^2(0,T; \mathbb{L}^2(\Omega)), \label{tc:limit:Stress:strong} \\ \pot[\psiL{\tau, \pm}] &\to \pot[\psi] \quad&&\text{ strongly} &&\text{ in } \L^2(0, T; \mathrm{W}^{1, \infty}({\Omega\times\Sph})). \label{tc:limit:pot:strong} \end{alignat} \end{subequations} Moreover, the tuple $(\mathbf{u}, \psi)$ is a global weak solution of $(\mathcal{P})$, in the sense that \begin{align} \label{P:weak:u} \begin{split} &-\RE\DE \int_0^T\int_{\Omega} \mathbf{u} \cdot \partial_t \mathbf{w} \, \text{d}\xflow\,\text{dt} + \RE\DE \int_0^T\int_{\Omega} \lrcb{ (\mathbf{u} \cdot \nabla_\xflow) \mathbf{u} } \cdot \mathbf{w} \, \text{d}\xflow\,\text{dt} \\ &\qquad + \viscFrac \DE \int_0^T\int_{\Omega} \nabla_\xflow \mathbf{u} : \nabla_\xflow \mathbf{w} \, \text{d}\xflow\,\text{dt} \\ &\qquad + \frac{(1-\viscFrac) \DE}{2} \int_0^T\int_{\OmSph} \psi (\nabla_\xflow \mathbf{u} : \mflow\otimes\mflow) (\nabla_\xflow \mathbf{w} : \mflow\otimes\mflow) \dH(\mflow)\, \text{d}\xflow\,\text{dt} \\ &\quad = \RE\DE \int_{\Omega} \mathbf{u}_0(\mathbf{x}) \cdot \mathbf{w}(\mathbf{x}, 0) \, \text{d}\xflow - (1 - \viscFrac) \int_0^T\int_{\OmSph} \psi \nabla_\xflow \pot[\psi] \cdot \mathbf{w} \dH\, \text{d}\xflow\,\text{dt} \\ &\quad\qquad - (1 - \viscFrac) \int_0^T\int_{\OmSph} \psi \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{w} \mathbf{m} } \cdot \nabla_\surfaceLtr \pot[\psi] \dH(\mflow)\, \text{d}\xflow\,\text{dt} \\ &\quad\qquad - (1 - \viscFrac) \int_0^T\int_{\OmSph} \psi (d \mflow\otimes\mflow - \mathbb{I}) : \nabla_\xflow \mathbf{w} \dH(\mflow)\, \text{d}\xflow\,\text{dt} \\ &\quad\qquad - \alpha (1 - \viscFrac) \int_0^T\int_{\OmSph} \psi (\mflow\otimes\mflow : \nabla_\xflow \mathbf{w}) \dH(\mflow)\, \text{d}\xflow\,\text{dt} \\ &\qquad\qquad\qquad \forall \mathbf{w} \in \mathrm{W}^{1,1}(0,T; \Vk{2}) \text{ such that } \mathbf{w}(\cdot, T) = 0, \end{split} \end{align} and \begin{align*} &-\int_0^T\int_{\OmSph} \psi \partial_t \theta \dH\, \text{d}\xflow\,\text{dt} - \int_0^T\int_{\OmSph} \psi \mathbf{u} \cdot \nabla_\xflow \theta \dH\, \text{d}\xflow\,\text{dt} \\ &\qquad + \frac{1}{\DE} \int_0^T\int_{\OmSph} \left[ \mollEps^2 \nabla_\xflow \psi \cdot \nabla_\xflow \theta + \nabla_\surfaceLtr \psi \cdot \nabla_\surfaceLtr \theta \right] \dH\, \text{d}\xflow\,\text{dt} \\ &\qquad + \frac{1}{\DE} \int_0^T\int_{\OmSph} \psi \left[ \mollEps^2 \nabla_\xflow \pot[\psi] \cdot \nabla_\xflow \theta + \nabla_\surfaceLtr \pot[\psi] \cdot \nabla_\surfaceLtr \theta \right] \dH\, \text{d}\xflow\,\text{dt} \\ &\qquad - \int_0^T\int_{\OmSph} \psi \lrcb{ (\mathbb{I} - \mflow\otimes\mflow) \nabla_\xflow \mathbf{u} \mathbf{m} } \cdot \nabla_\surfaceLtr \theta \dH(\mflow)\, \text{d}\xflow\,\text{dt} \\ &\quad = \int_{\OmSph} \psi_0(\mathbf{x}, \mathbf{m}) \theta(\mathbf{x}, \mathbf{m}, 0) \dH(\mflow)\, \text{d}\xflow \numberthis[P:weak:psi] \\ &\qquad\qquad\qquad \forall \theta \in \mathrm{W}^{1,1}(0,T; \HkOS{4}) \text{ such that } \theta(\cdot, \tilde{\cdot}, T) = 0. \end{align*} In particular, the following energy inequality is satisfied for a.e. $s \in [0,T]$: \begin{align*} &\frac{\RE\DE}{2} \int_{\Omega} \abs{ \mathbf{u}(\mathbf{x}, s) }^2 \, \text{d}\xflow + \frac{\viscFrac\DE}{2} \int_0^s \abs{ \nabla_\xflow \mathbf{u} }^2 \, \text{d}\xflow\,\text{dt} \\ &\qquad + (1 - \viscFrac) \int_{\OmSph} \mathcal{F}(\psi(\mathbf{x}, \mathbf{m}, s)) \dH(\mflow)\, \text{d}\xflow \\ &\qquad + \frac{1-\viscFrac}{2} \int_{\OmSph} \psi(\mathbf{x}, \mathbf{m}, s) \pot[\psi(\mathbf{x}, \mathbf{m}, s)] \dH(\mflow)\, \text{d}\xflow \\ &\qquad + \frac{1 - \viscFrac}{\DE} \int_0^s \int_{\OmSph} \left[ \mollEps^2 \abs{ \nabla_\xflow \sqrt{\psi} }^2 + \abs{\nabla_\surfaceLtr \sqrt{\psi}}^2 \right] \dH\, \text{d}\xflow\,\text{dt} \\ &\quad \leq \frac{\RE\DE}{2} \int_{\Omega} \abs{\mathbf{u}_0}^2 \, \text{d}\xflow + (1 - \viscFrac) \int_{\OmSph} \mathcal{F}(\psi_0) \dH\, \text{d}\xflow \numberthis[eq:main:energy_ineq] \\ &\quad\quad + \frac{1-\viscFrac}{2} \int_{\OmSph} \psi_0 \pot[\psi_0] \dH\, \text{d}\xflow + C_{\star\star}, \end{align*} where $C_{\star\star} > 0$ depends solely on $\psi_0, \alpha, \RE, \DE, \DE^{-1}, \viscFrac, \overline{\C}_\mollEps, \potStr, \Omega, d,$ and $T$. \end{thrm} \begin{proof} For ease of notation, we note that all generic constants $0 < C < \infty$ are independent of $\text{L}$ and $\tau$ in this proof.\\ \textit{Convergence properties of $\mathbf{u}$.} First, we prove the convergence properties of the velocity field. We infer from the first bound in \eqref{tc:regularity_past} that there exist subsequences $\{ \uL{\tau, \pm} \}_{\text{L} > 1}$ (not relabelled) and functions $\mathbf{u}^{\pm} \in \L^\infty(0,T; \mathbf{L}^2(\Omega))$ such that \begin{align} \label{tc:limit:proof:u:weakstar} \uL{\tau, \pm} \overset{*}{\rightharpoonup} \mathbf{u}^{\pm} \quad \text{ weak}^* \text{ in } \L^\infty(0,T; \mathbf{L}^2(\Omega)). \end{align} Moreover, on noting \eqref{tc:limit:proof:u:weakstar} and $\tau \in o(\text{L}^{-1})$, the second bound in \eqref{tc:regularity_past} yields \begin{align*} \int_0^T\int_{\Omega} \lrcb{ \mathbf{u}^+ - \mathbf{u}^- } \cdot \mathbf{w} \, \text{d}\xflow\,\text{dt} \gets \int_0^T\int_{\Omega} \lrcb{ \uL{{\tau,+}} - \uL{{\tau,-}} } \cdot \mathbf{w} \, \text{d}\xflow\,\text{dt} \to 0 \end{align*} for all $\mathbf{w} \in \L^2(0,T; \mathbf{L}^2(\Omega)) \subset \L^1(0,T; \mathbf{L}^2(\Omega))$. Hence, we have that $\mathbf{u}^+ = \mathbf{u}^-$ and we denote this limit by $\mathbf{u} := \mathbf{u}^+ = \mathbf{u}^- \in \L^\infty(0,T; \mathbf{L}^2(\Omega))$, which yields \eqref{tc:limit:u:weakstar}. Furthermore, we obtain from the uniqueness of limits of sequences in the weak topology of $\L^2(0,T; \Hflow_{0,\text{div}}^1(\Omega))$, the third bound in \eqref{tc:regularity_past}, and a further extraction of a subsequence that $\mathbf{u} \in \L^2(0,T; \Hflow_{0,\text{div}}^1(\Omega))$ and that \eqref{tc:limit:u} and \eqref{tc:limit:u:weak} hold. On noting \eqref{eq:time_reg:uL}, we have that \begin{align} \label{tc:limit:proof:u:timereg} \begin{split} \int_0^{T - \tau} \norm{ \uL{{\tau,+}}(\cdot, t + \tau) - \uL{{\tau,+}}(\cdot, t) }_{( \Vk{2} )^\prime}^2 dt = \sum_{k=1}^{N-1} \tau \norm{ \uL{k} - \uL{k-1} }_{( \Vk{2} )^\prime}^2 \leq C \tau^2. \end{split} \end{align} On noting \eqref{tc:limit:proof:u:timereg}, $\norm{\uL{{\tau,+}}}_{\L^2(0,T; \Hflow_{0,\text{div}}^1(\Omega))} \leq C$, the compact embedding \begin{align*} \Hflow_{0,\text{div}}^1(\Omega) \hookrightarrow\hookrightarrow \mathbf{L}^r(\Omega)\cap\Ldivp{2} \end{align*} with $r \in [2, \infty)$ if $d=2$ and $r \in [2, 6)$ if $d=3$, and the continuous embedding \begin{align} \label{tc:limit:proof:cont_emb:u} \mathbf{L}^r(\Omega) \cap \Ldivp{2} \hookrightarrow (\Vk{2})^\prime, \end{align} it follows by Theorem 1 of Dreher and J\"ungel \cite{dreher2012compact} (for a further subsequence) that $\uL{{\tau,+}} \to \mathbf{u}$ strongly in $\L^2(0,T; \mathbf{L}^r(\Omega))$. As $\{ \uL{{\tau,+}} \}_{\text{L} > 1}$ is uniformly bounded in $\L^2(0,T;$ $\Hflow_{0,\text{div}}^1(\Omega))$, we deduce from the second bound in \eqref{tc:regularity_past} and the continuous embedding \eqref{tc:limit:proof:cont_emb:u} that $\uL{{\tau,-}} \to \mathbf{u}$ strongly in $\L^2(0,T; \mathbf{L}^r(\Omega))$, which yields \eqref{tc:limit:u:strong}. The convergence result \eqref{tc:limit:u:dt} with respect to the time derivative follows similarly to \cite[p. 29ff]{chen_liu_2013_entropy_solution}.\\ \textit{Convergence properties of $\psi$.} We obtain from \eqref{eq:time_reg:psiL} that \begin{align} \label{tc:limit:proof:psi:timereg} \begin{split} &\int_0^{T - \tau} \norm{ \psiL{{\tau,+}}(\cdot, \tilde{\cdot}, t + \tau) - \psiL{{\tau,+}}(\cdot, \tilde{\cdot}, t) }_{(\HkOS{4})^\prime}^2 \,\text{dt} \\ &\qquad\qquad\qquad\quad = \sum_{k=1}^{N-1} \tau \norm{ \psiL{k} - \psiL{k-1} }_{(\HkOS{4})^\prime}^2 \leq C \tau^2. \end{split} \end{align} Now, on noting \eqref{tc:limit:proof:psi:timereg}, \eqref{tc:regularity_past}, and the embeddings \begin{align*} \mathrm{W}^{1,1}({\Omega\times\Sph}) \hookrightarrow\hookrightarrow \L^s({\Omega\times\Sph}) \hookrightarrow \lrcb{\HkOS{4}}^\prime \quad \forall 1 < s < \frac{2d - 1}{2d -2}, \end{align*} following the lines pp. 27-30 in \cite{chen_liu_2013_entropy_solution} yields the convergence results \eqref{tc:limit:psi:nablax_sqrt} - \eqref{tc:limit:psi:dt} with respect to $\{ \psiL{{\tau,+}} \}_{\text{L}> 1}$. Furthermore, we deduce from the fifth bound in \eqref{tc:regularity_past} and $\tau \in o(\text{L}^{-1})$ that \eqref{tc:limit:psi:strong} holds for $\{ \psiL{{\tau,-}} \}_{\text{L} > 1}$ as well. The nonnegativity of $\psi$ follows from the nonnegativity of $\psiL{{\tau,+}}$. Moreover, on noting \eqref{tc:def:omegaL}, the seventh bound in \eqref{tc:regularity_past}, and \eqref{tc:limit:psi:strong}, we have that $\psi$ $\in$ $\L^\infty(0, T; \L^2(\Omega; \L^1({\SMat^{d-1}})))$. This completes the proof of \eqref{tc:limit:psi}. Moreover, on noting \eqref{tc:limit:psi:strong}, it follows that $\eqref{tc:limit:finite_entropy}$ holds by subtracting one more subsequence.\\ \textit{Convergence properties of $\omega$, $\Stress$, and $\pot[\psi]$.} On noting \eqref{tc:regularity_past}, \eqref{tc:def:omegaL}, \eqref{tc:def:omega}, \eqref{tc:def:StressL}, \eqref{tc:def:Stress}, \eqref{tc:pot_repres}, \eqref{mollifier:W_2_infty}, we infer from \eqref{tc:limit:psi:strong} that \eqref{tc:limit:omega} - \eqref{tc:limit:pot:strong} hold.\\ \textit{Existence of weak solutions.} By applying the established convergence results in Theorem \ref{thrm:main}, it follows immediately that $\mathbf{u}$ and $\psi$ satisfy the weak formulations \eqref{P:weak:u} and \eqref{P:weak:psi}.\\ \textit{Energy inequality.} On noting the convergence properties \eqref{tc:limit:u:weakstar}, \eqref{tc:limit:u:weak}, \eqref{tc:limit:u:strong}, \eqref{tc:limit:psi:nablax_sqrt}, \eqref{tc:limit:psi:nablag_sqrt}, and \eqref{tc:limit:psi:strong}, we infer from the (weak) lower-semicontinuity of the terms on the left-hand side of \eqref{est:discrete_entropy} that the energy inequality \eqref{eq:main:energy_ineq} holds by subtracting one more subsequence. \end{proof} \textbf{Acknowledgments.} This work has been supported by the Research Training Group (Graduiertenkolleg) 2339 “Interfaces, Complex Structures, and Singular Limits in Continuum Mechanics” of the German Science Foundation (DFG). The author is grateful to G\"unther Gr\"un and Stefan Metzger for many valuable discussions. \bibliographystyle{acm}
\section{Introduction} When a species or pathogen invades a novel environment, determining when and where it was first introduced is of interest to scientists, policymakers, and the public. Knowing the location and date of introduction would further our understanding of the ecology of the process, increase our capacity to build predictive models, and could inform policies that aim to prevent new introductions. Although the location and time of introduction is known in some cases, such as the introduction of myxomytosis to control rabbits in Australia (\citealt{ratcliffe1952myxomatosis}), there are many examples where the location and time of introduction are unknown and must be inferred from indirect data. The general problem of modeling the spatio-temporal dynamics of invasion is well-represented in the literature (e.g., \citealt{mollison1986modelling,gibson1996fitting,wikle2003invasion}); however, when the introduction is not directly observed there is a small number of limited methods that might be used to determine the location and time of introduction from indirect data. For example, a method known as geographic profiling has been introduced to estimate the position of sources of invasive species and diseases using occurrence records (\citealt{le2011geographic,stevenson2012geographic,verity2014spatial}), but this approach ignores the temporal dynamics and therefore cannot estimate the initial source (however see \citealt{mohler2012geographic}). Similarly, Bayesian models have been developed to estimate the spatio-temporal dynamics of colonization (e.g., \citealt{cook2007bayesian,catterall2012accounting,broms2016dynamic}), but these methods are limited. For example, the \citet{cook2007bayesian} approach requires that the colonization time be known. \citet{catterall2012accounting} demonstrate how to infer the time of colonization; however, this method was developed to understand the dynamics after the initial introduction and not to obtain estimates of the time and location of the first introduction. Lastly, \citet{caley2015inferring} developed a Bayesian spatio-temporal model to infer the time of introduction and geographic distribution of an invasive species from occurrence records; however, this approach does not provide a framework for inferring the location of introduction. If the time and location of introductions were known, then tools commonly used to map the distribution of species and diseases could be used to build predictive models and infer the factors that influence the occurrence of novel introductions. Novel introductions, however, are rarely directly observed. Instead, the outcome of a successful introduction is observed by the collection of indirect data such as species or disease occurrence records. In principal, indirect spatio-temporal data and models can be used infer historical events such as infection histories (\citealt{salje2018reconstruction}), changes in climate (\citealt{tingley2012piecing,tipton2016reconstruction}), and, as we demonstrate, introductions of pests and pathogens. Our objective is to show how point process models, a commonly used statistical approach for modeling the distribution of species and diseases, can be placed within a hierarchical modeling framework to obtain statistically principled estimates of the date and location of introduction. Although we provide a general framework, our work is motivated by the need to understand when and where $\textit{Pseudogymnoascus destructans}$, the pathogen that causes white-nose syndrome (WNS), was first introduced into the United States. White-nose syndrome was first detected in 2006 using photographic evidence of a bat from Howes Cave, near Albany, New York (Fig. 1; \citealt{blehert2009bat,frick2010emerging}). The pathogen, $\textit{P. destructans}$, has since spread throughout the eastern and midwestern United States resulting in high mortality rates among several species of cave-hibernating bats. Statistical methods capable of estimating the date and location where $\textit{P. destructans}$ was first introduced into the United States could further our understanding of the etiology of the disease and provide critical information on the process of introduction. For example, WNS was recently detected on a western subspecies of little brown bat (\textit{Myotis lucifugus}) occurring in the state of Washington that is likely the result of a novel introduction originating from the eastern United States (\citealt{lorch2016first}). Our modeling approach could eventually be used to test the hypothesis that the Washington WNS case is the result of a novel introduction and, if confirmed, identify areas at high risk for future introductions. \begin{figure}[H] \begin{centering} \includegraphics[scale=0.7]{Fig_1} \par\end{centering} \noindent \textbf{Fig. 1.} Location and infection status of individual bat samples from four species tested for white-nose syndrome. The first detection in 2006 was based on photographic evidence only. The locations of individual samples were jittered so that cases from the same location did not overlap. The four species of bats tested include: little brown bat (\textit{Myotis lucifugus}), big brown bat (\textit{Eptesicus fuscus}), northern long-eared bat (\textit{Myotis septentrionalis}), and tri-colored bat (\textit{Perimyotis subflavus}). \end{figure} \section{Dynamic Spatio-temporal Statistical Models} Dynamic spatio-temporal statistical models are used in fields such as ecology (\citealt{wikle2003invasion,hooten2008doves,williams2017integrated,hefley2017mechanism}), epidemiology (\citealt{smith2002predicting}), and meteorology (\citealt{wikle1998hierarchical,wikle2001spatiotemporal}). The defining property of a dynamic statistical model is an explicit description of how future observations (spatial data) evolve from past observations (\citealt{wikle2010general,mohler2012geographic,cressie2011statistics,wikle2018stwr}). For example, statistical implementations of dynamic agent-based models are constructed using a set of deterministic or stochastic rules governing the actions of individual agents at each time step (\citealt{hooten2010agent,hooten2010statistical,keith2013agent,heard2015agent,mcdermott2017hierarchical}). Consider the classic example of a dynamic agent-based model where an individual performs a random walk. At each time step, the individual moves a random distance in a random direction. An inherent characteristic of dynamic models is that the initial conditions must be specified. For example, when performing a random walk, the location and time the individual begins walking must be specified. Although a Eulerian (individual-based) frame of reference can be used to understand dynamic processes, a Lagrangian (population-level) perspective is also common (\citealt{hooten2017animal}). In ecology, for example, dynamic models of populations are expressed as partial differential equations (PDEs), which are used to describe the global behavior of a large number of individuals (\citealt{holmes1994partial,hooten2017animal}). In data-driven modeling applications, hierarchical (conditional) model specifications can be used to estimate unknown parameters by connecting data to the underlying dynamic process (\citealt{cressie2011statistics,wikle2018stwr}). Many applications of dynamic statistical models have focused on estimating parameters that govern the process (e.g., rate of spread), but rarely has formal statistical inference about the initial conditions been of interest (but see \citealt{hefley2017spatial}). Instead, the initial conditions are modeled phenomenologically and treated as nuisance parameters (\citealt{wikle2003hierarchical,hooten2008doves,williams2017integrated,hefley2017mechanism}). We demonstrate how incorporating scientific knowledge about the initial conditions of a dynamic process provides novel insight into the outbreak of an infectious disease or invasion of a pest. By justifiably assuming that the pathogen or pest was introduced at points occurring at unknown locations and times, we specify a point process to model the initial conditions. Point process models are commonly used for species distribution and disease mapping (\citealt{renner2015point}), but can also be incorporated into hierarchical Bayesian models to learn about latent (unobserved) processes (e.g., \citealt{BB2L}). In the following sections, we provide a specific example using a PDE of ecological diffusion; however, our approach is applicable to commonly used dynamic models that require the specification of initial conditions such as agent-based models, contact process models, rule-based approaches (e.g., cellular automaton), integral equations, and integro-difference equations. \subsection{Ecological Diffusion} Diffusion is a dynamic process that can be used to describe the movement of particles, animals, pathogens, or other objects from a Lagrangian perspective (\citealt{hooten2017animal}). A specific type of diffusion, called ecological diffusion (\citealt{hooten2017animal}), has been used to explain the spread of disease (\citealt{garlick2011homogenization,garlick2014homogenization,hefley2017spatial,hefley2017mechanism}), the outbreak of pests (\citealt{powell2014phenology,hooten2013computationally,powell2017differential}), the invasions of species (\citealt{neupane2015invasion}), and the reintroduction of extirpated species (\citealt{williams2017integrated}). Ecological diffusion is expressed by the PDE \begin{equation} \frac{\partial}{\partial t}u(\mathbf{s},t)=\left(\frac{\partial^{2}}{\partial s_{1}^{2}}+\frac{\partial^{2}}{\partial s_{2}^{2}}\right)[\mu(\mathbf{s},t)u(\mathbf{s},t)] \end{equation} \noindent where $u(\mathbf{s},t)$ is the intensity of the dispersing pathogen (or population), $s_{1}$ and $s_{2}$ are the spatial coordinates contained in the vector $\mathbf{s}$, and $t$ is the time. The intensity, $u(\mathbf{s},t)$, can be linked to the expected pathogen abundance by integrating $u(\mathbf{s},t)$ over a spatial domain of interest (i.e., $\int_{\mathcal{A}}u(\mathbf{s},t)d\mathbf{s}$). The diffusion coefficient, $\mu(\mathbf{s},t)$ could depend on location-specific covariates that control the rate of spread and vary over time. Although equation (1) only describes ecological diffusion, PDEs can be modified to capture other important components such a population growth or long-range dispersal (\citealt{holmes1994partial}). For example, in our WNS data example we modify equation (1) to include an exponential growth component to enable the pathogen $\textit{P. destructans}$ to increase in abundance. Ecological diffusion describes how the spatial distribution of a pathogen or population evolves over time. To initiate this dynamic process, the conditions at the time of introduction, $t_{0}$, must be known or estimated. In situations of disease outbreak neither $t_{0}$ or $u(\mathbf{s},t_{0})$ are known. A realistic assumption is to presume that the pathogen was introduced at points, which can be formulated mathematically as \begin{equation} u(\mathbf{s},t_{0})=\begin{cases} \theta_{j} & \text{if}\;\mathbf{s}=\boldsymbol{\omega}_{j}\\ 0 & \text{if}\;\mathbf{s}\neq\boldsymbol{\omega}_{j} \end{cases}\:, \end{equation} \noindent where $\theta_{j}$ is the unknown initial number of pathogen particles (or animals) and $\boldsymbol{\omega}_{j}$ is the unknown coordinate of the $j^{\text{th}}$ location of introduction ($j=1,2,\ldots,J$). In data-driven applications, the time, location, initial number of particles, and potentially the number of points are unknown, thus the parameters $t_{0}$, $\boldsymbol{\omega}_{j}$, $\theta_{j}$, and $J$ must be estimated. Estimation of the initial conditions can be understood heuristically as follows. By observing data generated from a diffusion process at multiple time points (Fig. 2), it is feasible to estimate the rate at which the process is diffusing (spreading). Once the diffusion rate is estimated, equation (1) can predict the future (forecast) or past (backcast) spread of the pathogen. Unlike forecasting, backcasting ultimately results in a highly constrained state with a functional form that we have knowledge about. Specifically, if the diffusion processes started at points, then backcasting has a known endpoint that constrains the functional form of $u(\mathbf{s},t_{0})$ to equation (2). This constraint, formulated as a prior or process-level distribution when using a hierarchical Bayesian statistical model, enables the posterior distribution of the time, location, and number of points to be calculated from data. Next we introduce the data set that motivates our work. Understanding the specifics of the data is required to specify an appropriate hierarchical Bayesian model that links the ecological diffusion PDE to observed data and enables us to estimate the date and location of introduction. \begin{figure}[H] \begin{centering} \includegraphics[scale=0.6]{Fig_2} \par\end{centering} \noindent \textbf{Fig. 2.} Illustration showing an initial introduction of $\theta=100$ particles and how the one-dimensional spatial distribution of pathogen or population intensity ($u(s,t)$) evolves over time according to the ecological diffusion partial differential equation. Greater values of the diffusion rate $\mu(s)$, shown in the inset plot, result in faster spread whereas spread is inhibited when $\mu(s)=0$. The diffusion rate depends on the environmental variables at the location ($s$), which results in the spatial variability (roughness) visible in $u(s,t)$. The pathogen intensity, $u(s,t)$, can be linked to the expected pathogen abundance by integrating $u(s,t)$ over an interval of interest (i.e., $\int_{a}^{b}u(s,t)ds$). In this example, $\int_{-0.5}^{0.5}u(s,t)ds=100$ for all time points. \end{figure} \section{White-nose Syndrome Data Example} Surveillance for WNS in the United States began in 2007 using a combination of passive and active surveillance methods. During 2007\textendash 2012, samples were obtained from individual bats associated with morbidity or mortality investigations occurring year-round at underground hibernacula or on the above-ground landscape, and consisted of bat carcasses, biopsies of wing skin, or tape lifts of fungal growth on muzzles. A small number of samples were also obtained from target species (including $\textit{Myotis}$ spp., $\textit{Perimyotis subflavus}$, $\textit{Eptesicus fuscus}$) admitted to rehabilitation facilities or state diagnostic laboratories for rabies testing from approximately December to May. A positive or negative diagnosis of WNS in individual bats was determined by observing characteristic histopathologic lesions in skin tissues using light microscopy (\citealt{meteyer2009histopathologic}). A diagnosis of suspect WNS was assigned to individuals with clinical signs suggestive of the disease that either had ambiguous skin histopathology or were not evaluated in this manner but for which the causative agent, $\textit{P. destructans}$, was detected by fungal culture or polymerase chain reaction (\citealt{lorch2010rapid}). We illustrate our modeling approach using a subset of the WNS surveillance data collected during 2008\textendash 2011 that includes individual samples of little brown bats (\textit{Myotis lucifugus}), big brown bats (\textit{Eptesicus fuscus}), northern long-eared bats (\textit{Myotis septentrionalis}), and tri-colored bats (\textit{Perimyotis subflavus}). This resulted in $\geq50$ individual samples for each species and a total of 397 samples with 184 positive or suspected positive cases of WNS (Fig. 1). We limited our illustration to the four most common species sampled because the remaining species were uncommon and included less than 20 individuals and no more than five positive cases for each species. In our analysis, we chose to exclude the first case detected in 2006 because it was based on photographic evidence as well as samples from 2007 because diagnostic case criteria for WNS were not established until 2008. Finally, we used data collected from 2012 for the same four species to test the ability of our model to forecast future spread of $\textit{P. destructans}$ and prevalence of WNS. This resulted in $\geq3$ individuals for each species and a total of 54 individuals with 37 positive or suspected positive cases. \subsection{Hierarchical Bayesian Statistical Model} We take a hierarchical Bayesian approach and specify a statistical model that facilitates simultaneous parameter estimation of the location and date of introduction as well as the diffusion and growth rate (\citealt{hooten2013computationally}). Our model is tailored to the WNS data (Fig. 1), but the hierarchical Bayesian approach is flexible and can be adapted to a wide range of studies (e.g., \citealt{Hobbs2015,williams2017integrated}). For the WNS data, we specify the hierarchical model:\begin{eqnarray} y_{i} & \sim & \text{Bernoulli}\left(p_{i}\right)\\ p_{i} & = & g^{-1}(u(\mathbf{s}_{i},t_{i})e^{\mathbf{x}^{\prime}_{i}\boldsymbol{\beta}})\\ \frac{\partial}{\partial t}u(\mathbf{s},t) & = & \left(\frac{\partial^{2}}{\partial s_{1}^{2}}+\frac{\partial^{2}}{\partial s_{2}^{2}}\right)[\mu(\mathbf{s})u(\mathbf{s},t)]+\lambda(\mathbf{s})u(\mathbf{s},t)\\ \text{log}\left(\mu(\mathbf{s})\right) & = & \alpha_{0}+\mathbf{z}(\mathbf{s})^{\prime}\mathbf{\boldsymbol{\alpha}}\\ \lambda(\mathbf{s}) & = & \gamma_{0}+\mathbf{w}(\mathbf{s})^{\prime}\mathbf{\boldsymbol{\gamma}}, \end{eqnarray}where $y_{i}$ is equal to $1$ if the $i^{\text{th}}$ tested bat is WNS-positive or suspected positive and $0$ if negative. The probability that $y_{i}=1$, $p_{i}$, depends on the pathogen intensity $u(\mathbf{s}_{i},t_{i})$ defined by the PDE in equation (5) and species susceptibility $e^{\mathbf{x}_{i}^{\prime}\boldsymbol{\beta}}$, where $\mathbf{x}_{i}$ is a vector that contains a binary indicator variable identifying the species of the $i^{\text{th}}$ tested bat and $\boldsymbol{\beta}\equiv(\beta_{1},\ldots,\beta_{p_{\beta}})^{'}$ is a vector of species-specific susceptibility coefficients. Differences among species susceptibility to WNS has been reported although the mechanism(s) for these differences remain unclear (\citealt{langwig2012sociality,johnson2015antibodies,langwig2015invasion}). Regardless of the mechanism(s), our model accounts for heterogeneity among species susceptibility by inclusions of $e^{\mathbf{x}_{i}^{\prime}\boldsymbol{\beta}}$. For the ecological diffusion PDE, the product of the pathogen intensity ($u(\mathbf{s}_{i},t_{i})$) and species susceptibility ($e^{\mathbf{x}_{i}^{\prime}\boldsymbol{\beta}}$) in equation (4) is greater than zero and therefore the inverse link function $g^{-1}(\cdot)$ maps the positive real line $[0,\infty)$ to a probability between 0 and 1. For an inverse link function, we used the cumulative distribution function of a standard log-normal distribution (i.e., $g^{-1}(x)=\frac{1}{x\sqrt{2\pi}}\int_{0}^{x}e^{-\frac{1}{2}\text{log}(x)^{2}}dx$). Although any appropriate link function could be used, our choice enables efficient implementation because the full-conditional distribution for $\boldsymbol{\beta}$ are available in closed-form (see Appendix S1 for details; \citealt{BB2L}). The diffusion rate ($\mu(\mathbf{s}$)) in equation (5) depends on the regression-type equation in (6) that has an intercept term ($\alpha_{0}$), coefficients ($\boldsymbol{\alpha}$$\equiv(\alpha_{1},\ldots,\alpha_{p_{\alpha}})^{'}$), and location-specific covariates $\mathbf{z}(\mathbf{s})$. For spreading diseases, the diffusion rate is always positive, thus $\mu(\mathbf{s})>0$ for all $\mathbf{s}$, which motivates the log link function in (6). In addition to ecological diffusion, we add an exponential growth component to the PDE to account for increasing (or decreasing) pathogen intensity. This addition results in a growth rate ($\lambda(\mathbf{s})$) that depends on a similar regression-type equation (7) that has an intercept term ($\gamma_{0}$), coefficients ($\boldsymbol{\gamma}\equiv(\gamma_{1},\ldots,\gamma_{p_{\gamma}})^{\prime}$), and location-specific covariates $\mathbf{w}(\mathbf{s})$, which can be the same as or different from $\mathbf{z}(\mathbf{s})$. To allow the growth rate to be positive or negative, we used the identity link function so that the support of $\lambda(\mathbf{s})$ is unconstrained and can take on values from $-\infty$ to $\infty$. We assume Dirichlet boundary conditions and set $u(\mathbf{s},t)=0$ at the boundary of the United States. Similar to initial conditions, boundary conditions could be an important component and future studies may need to estimate the boundary conditions. For computational efficiency, we prefer Dirichlet boundary conditions because existing techniques for estimation would require estimating a large number of parameters (\citealt{wikle2003hierarchical}). To fully specify a hierarchical Bayesian model, prior distributions must be carefully chosen for all parameters. We describe and justify our choice of prior distributions in Appendix S2, with the exception of the prior distribution for the location of introduction, which we describe below. We specify the initial conditions as described in equation (2). The natural choice for the prior of the latent (unobserved) locations of introduction is a point process, which is a probability distribution that generates locations in geographic space as random variables (\citealt{cressie2011statistics}). For the WNS data, we assume a single point source introduction (i.e., $J=1$), which results in a conditional point process (i.e., a point process with a known number of points, in this case just one; \citealt{cressie1993statistics} p. 651). For an introduction that occurs at a single location, the intensity function of the point process must be specified as a hyperparameter; we specify the intensity function of the point process to be constant across the United States which is equivalent to assuming that $\textit{P. destructans}$ was equally likely to have been introduced at any location within the United States. If multiple introductions occur, it may be feasible to estimate the intensity function of the point process (Appendix S1). For example, the intensity function may be modeled using a regression-type equation to estimate how location-specific risk factors influence the likelihood of novel introductions. This approach could then be used to predict the geographic areas and identify the environmental conditions where new introductions are likely to occur. Finally, our approach can be modified to handle an unknown number of point sources that are introduced on different dates by using a spatio-temporal Poisson point process (Appendix S1). This modification may eventually be used to explain the recent positive cases of WNS in the state of Washington (\citealt{lorch2016first}). \subsection{Model Implementation} The covariates $\mathbf{z}(\mathbf{s})$ and $\mathbf{w}(\mathbf{s})$, which influence the diffusion and growth rate in equations (6) and (7), respectively, can include any location-specific environmental factor (e.g., temperature). We used karst terrain and deciduous forest cover calculated from digitized maps (\citealt{tobin2004digital}) and the 2011 National Land Cover Database (\citealt{NLCD2011}), respectively (Fig. 3). We expect that the spatial availability of caves and deciduous forest habitat will influence the diffusion of the pathogen due to the ability of bats to disperse; however, we acknowledge many other factors could be included depending on the goals of the study. \begin{figure}[H] \begin{centering} \includegraphics{Fig_3} \par\end{centering} \noindent \textbf{Fig. 3.} The Environmental covariates proportion of deciduous forest (top panel) and karst terrain (bottom panel). \end{figure} For model implementation, we first use an analytical technique called homogenization that results in a computationally efficient approximation to the solution of the ecological diffusion PDE (\citealt{garlick2011homogenization,hooten2013computationally}). To solve the homogenized PDE, we use a standard finite-difference scheme and chose 30 time steps per month, broad-scale grid cells of 100 km by 100 km, and the fine-scale grid cells of 10 km by 10 km (\citealt{Farlow1993PDE,garlick2011homogenization,hooten2013computationally}). Finer spatial discretization may be implemented, but the resolution we chose is a reasonable trade-off between the location accuracy of our data (mostly reported at the county-level) and what is computationally feasible using accessible high-performance computing. For implementation of our Bayesian model, we used a Markov chain Monte Carlo (MCMC) algorithm with three chains. For each chain, we obtained 320,000 samples from the posterior distribution and discarded the first 20,000 samples to ensure that the MCMC algorithm was sampling from the target (stationary) distribution. All computations were conducted using a program in R (Appendix S1 and S2) with optimized basic linear algebra subprograms and subroutines written in C++ and called from R (\citealt{TeamR}). \subsection{Model and Software Validation} As noted by \citet{cook2006validation}, implementing non-standard models such as ours often requires developing the necessary software \textquotedblleft from scratch,\textquotedblright{} which may increase the chance of making errors when programming. Furthermore, when using a complex statistical model it is important to check that the parameters are identifiable (\citealt{lele2010model}). One way to check our software for errors and our proposed model for identifiability of parameters is to use a simulated data set that mimics the WNS surveillance data, but where the parameter values are known. If our software and model are able to recover the known values of the parameters from the simulated data that mimics the WNS surveillance data, then there is evidence that the software is error free and that the parameters in our model are identifiable. Appendix S1 contains a simulated data example to demonstrate that our model is capable of recovering known values of the parameters (see Figs. S1 \& S2). In addition to a single simulated data set that mimics the WNS surveillance data, we conducted a simulation experiment that involved simulating several thousand data sets under different settings and fitting our proposed model to each data set. A simulation experiment can be used to evaluate frequentist properties of the estimated parameters, such as bias and coverage probability, which ensures statistical inference from our model is valid (\citealt{little2006calibrated}). We conducted a simulation experiment employing a simplified version of the model we used for WNS surveillance data, but included a setting for multiple introductions (see Table S3 and Figs. S6\textendash S7 for simulation settings in Appendix S3). For each setting, we evaluated bias of the estimated time and location as well as the coverage probability of the 90\% credible intervals (or regions) for each parameter. We expect, unless something is pathologically wrong with our model (e.g., unidentifiable parameters; \citealt{gustafson2015bayesian}), that point estimates will be unbiased and the 90\% credible intervals will cover the true value of the parameters with a probability of 0.90. For all settings, our simulation experiment shows that point estimates of the time and location of introduction are apparently unbiased (Figs S8\textendash S9 in Appendix S3) and the 90\% credible intervals cover the true location and time with a probability of $\geq0.86$. Appendix S3 contains details of our simulation experiment, full results, and computer code needed to reproduce our experiment. \subsection{Forecast Comparison} Accurate forecasts during the early stages of disease outbreak or invasion of a novel species may be useful to inform management recommendations and surveillance sampling. In addition to estimating the location and date of introduction, an auxiliary benefit of Bayesian implementations of dynamic models is that probabilistic predictions and forecasts can be obtained as a derived quantity (\citealt{Hobbs2015,hefley2017mechanism}). To demonstrate the accuracy of forecasts from our model, we used the samples collected from 2012 that were reserved for this single purpose (see WNS data description for more detail). To facilitate comparison of our model with other non-Bayesian approaches, we calculated the zero-one score using the posterior mean of the probability of infection (i.e., $\text{E}(p_{i}|\mathbf{y})$) and forecasted that an individual sample would be WNS ``positive'' if $\text{E}(p_{i}|\mathbf{y})\geq0.5$ and ``negative'' if $\text{E}(p_{i}|\mathbf{y})<0.5$ (\citealt{gneiting2007strictly,gneiting2011making}). Although any local and proper scoring rule could be used, we chose the zero-one score because it can be used to calculate the misclassification rate, which is easy to interpret and communicate to practitioners. The misclassification rate is calculated using the 2012 data by summing the total number of samples incorrectly classified and dividing by the total number of samples. As a standard of comparison, we followed \citet{hefley2017mechanism} and compared the forecasting ability of our model to phenomenological regression-type models developed for classification of binary events (e.g., positive/negative) from the statistics and machine learning literature (\citealt{james2013introduction}). Specifically, we compared forecasts from our model to three approaches, which include: (1) a generalized linear model (GLM) that included deciduous forest cover and karst terrain at the sample location and bat species as predictor variables; (2) a generalized additive model (GAM) that included a linear effect of the same predictor variables as the GLM, but that accounted for spatial autocorrelation by using two-dimensional splines on a sphere (\citealt{wood2017generalized}); and (3) the same GAM specification as in 2, but with an additional smooth effect of time to account for increasing prevalence and temporal autocorrelation. Details associated with the exact model specifications and computations are reported in Appendix S2. For each approach, we used the samples collected from 2012 and calculated the zero-one score using the maximum (or restricted maximum) likelihood estimate of the predicted probability of infection ($\hat{p}_{i}$) and forecasted that an individual sample would be WNS ``positive'' if $\hat{p}_{i}\geq0.5$ and ``negative'' if $\hat{p}_{i}<0.5$. To compare forecasts with our model, we report the misclassification rate for each approach. Although comparing forecasts among different models is useful for quantifying forecast accuracy, this comparison is does not explicitly evaluate the reliability of the inferred time and location of introduction. \section{Results} The year with the highest probability of introduction was 2002 (1992\textendash 2005; 90\% credible interval), which is 4 years before the first photographic evidence documented the presence of $\textit{P. destructans}$ in the United States (Fig. 4). When compared to the location of first detection based on photographic evidence from 2006, the posterior distribution shows an area covering $123,798$ km$^{2}$ that has an equal or higher probability of containing the point where $\textit{P. destructans}$ was introduced (Fig. 4). This $123,798$ km$^{2}$ area represents a 74\% credible region and intersects the location of first detection, but indicates that location of introduction that are equally or more probable could be up to 510 km east of the first detection. For comparison, the 90\% posterior credible region covers an area of $182,493$ km$^{2}$. This $182,493$ km$^{2}$ regions represents 2.3\% of the area covered by the 90\% prior credible region, which demonstrates a large reduction in uncertainty due to the WNS surveillance data. \begin{figure}[H] \begin{centering} \includegraphics[scale=0.65]{Fig_4} \par\end{centering} \noindent \textbf{Fig. 4.} Posterior distributions of the location and date of introduction obtained from fitting our model to the data shown in Fig. 1. The top panel shows the joint posterior distribution of the location of introduction with red indicating a higher probability than yellow. The beige polygon outlines an area that is equally or more likely to contain the point of introduction when compared to the location where white-nose syndrome was first detected in 2006 (blue dot). The gray areas are karst formations with caves, which is likely winter bat habitat. The bottom panel shows the marginal posterior distribution of the date of introduction. The blue vertical line represents the earliest known photographic evidence of white-nose syndrome on bats in the United States. Years with low probability are not shown (i.e., before 1980). \end{figure} In addition to estimating the location and date of introduction, our approach simultaneously estimates species-specific susceptibility (Fig. 5), diffusion and growth rates of the pathogen (Fig. 6), and can be used to forecast the spread of $\textit{P. destructans}$ (Fig. 7 and animation in Appendix S4). As it relates to species-specific susceptibility, our results show that the northern long-eared bat was the most susceptible to $\textit{P. destructans}$ whereas the big brown bat was the least susceptible (Fig. 5). The diffusion and growth rates are positive in many regions and show spatial variability that is attributable to deciduous forest cover and karst terrain that contains caves (cf., Fig. 3 and Fig. 6, Fig. S3). As a result of positive growth and diffusion rates, forecasts show that $\textit{P. destructans}$ spread rapidly across the contiguous United States (Fig. 7), causing an overall increase in the probability of infection for all four species of bats over time (see animations in Appendix S4). Our forecast comparison revealed a misclassification rate of 26\% for our hierarchical Bayesian model. For comparisons, the three alternative approaches we used resulted in misclassification rate of 43\% for method one (GLM), 28\% for method 2 (GAM that included karst, forest and species as predictors and that accounted for spatial autocorrelation) and 30\% for method three (same as method 2, but accounted for temporal dynamics and autocorrelation). A visual comparison of the forecasts for all methods is given in Appendix S2 (Fig. S5). \begin{figure}[H] \begin{centering} \includegraphics[scale=0.55]{Fig_5} \par\end{centering} \noindent \textbf{Fig. 5.} The estimated species-specific susceptibility depends on the intensity of $\textit{P. destructans}$ ($u(\mathbf{s},t)$). Shown is the expected value of the posterior distribution (black lines) and 95\% credible intervals (gray shading). \end{figure} \begin{figure}[H] \begin{centering} \includegraphics[scale=0.9]{Fig_6} \par\end{centering} \noindent \textbf{Fig. 6.} The estimated diffusion rate (top panel) determines how fast the pathogen $\textit{P. destructans}$ will spread, whereas the growth rate (bottom panel) determines how quickly the intensity of $\textit{P. destructans}$ will increase. Deciduous forest and karst terrain (Fig. 3) influence the posterior distributions of the diffusion and growth rate leading to the spatial variability appearing in the maps. \end{figure} \begin{figure}[H] \begin{centering} \includegraphics[scale=0.7]{Fig_7} \par\end{centering} \noindent \textbf{Fig. 7.} Estimated intensity of $\textit{P. destructans}$ ($u(\mathbf{s},t)$) for January 2002\textendash 2012. See Appendix S4 for animations showing the contiguous United States for all months over the period 2000\textendash 2012 as well as forecasts of the probability of infection for all four species of bats. Note that the pathogen intensity, $u(\mathbf{s},t)$, can be linked to the expected pathogen abundance by integrating $u(\mathbf{s},t)$ over a spatial domain of interest (i.e., $\int_{\mathcal{A}}u(\mathbf{s},t)d\mathbf{s}$). \end{figure} \section{Discussion} Our results reveal that it is possible to estimate the date and location of introduction shortly after the release of a pathogen using indirect data from 397 samples collected over 4 years. Our results also demonstrate the need for statistical thinking because the estimated date shows that the introduction likely occurred several years before the first detected case. Conversely our results show that the location of first detection is a plausible location of introduction, but there is a moderate level of uncertainty surrounding the exact location. For WNS, the estimated location and date of introduction, along with the associated uncertainty, constitutes knowledge generated by harnessing the information within disease surveillance data using statistically valid techniques. Similar surveillance data is routinely collected for diseases of wildlife, plants, livestock, and humans, but filling knowledge gaps using these data requires statistical methods that capture dynamic processes and quantify uncertainty. The introduction of $\textit{P. destructans}$ is suspected to have originated from a single point source due to the clonal nature of the fungal pathogen in North America (\citealt{drees2017phylogenetics}). For other pathogens or pests, introductions may occur at multiple locations. When multiple introductions occur, we explain in Appendix S1 how our approach can be modified accordingly and potential issues that may arise when fitting the model to data. When multiple introduction occur, our approach could identify areas and environmental conditions where new pathogens or pest introductions are likely to occur\textendash effectively providing a map that is similar to Fig. 4, but showing areas at high risk for new introductions rather than a single past introduction. With this information, new introductions could be anticipated and perhaps avoided or optimal monitoring and control programs could be established (\citealt{williams2017monitoring}; \citealt{laber2018optimal}). Although our study system was epidemiological, dynamic statistical models have been used to explain the outbreak of pests (\citealt{powell2014phenology,hooten2013computationally,powell2017differential}), the invasions of a species (\citealt{neupane2015invasion}), the reintroduction of an extirpated species (\citealt{williams2017integrated}), and to determine optimal monitoring of ecological processes (\citealt{williams2017monitoring}). Such a range of applications indicate that dynamic statistical models can be used for a variety of situations including to determine the location of remnant populations that enable outbreaks of pests, estimate the date, location, and propagule size where invasive species were introduced, or determine the habitat characteristics where an extirpated species can re-establish. \section*{\vspace{-0.5cm} Acknowledgements} We thank all state, federal and other partners for submitting samples and the U.S. Geological Survey National Wildlife Health Center for processing the samples. At the time of publication data were not available for release because of the sensitivity related to the locations of the bat species sampled. Data can be requested from the following agencies that submitted samples. Agencies that submitted samples include Acadia National Park, Aerospace Testing Alliance Conservation, Alabama Department of Conservation and Natural Resources, Alabama Division of Wildlife and Freshwater Fisheries, Alaska Department of Fish and Game, U.S. Fish and Wildlife Service (USFWS) Alligator River National Wildlife Refuge, Arizona Game and Fish Department, Arkansas Department of Health, Arkansas Game and Fish Commission, U.S. Air Force, Avon Park Air Force Range, Bat Conservation International, Bat World Sanctuary, U.S. Department of Agriculture (USDA) Forest Service, Black Hills National Forest, Bureau of Land Management, Boston University, Buffalo National River (National Park Service), California Department of Fish and Game, Canadian Cooperative Wildlife Health Centre, Channel Islands National Park, Clinton Wildlife Management Area, Colorado Department of Natural Resources, USDA Forest Service Colville National Forest, Connecticut Department of Environmental Protection, Delaware Department of Natural Resources and Environmental Control, Department of the Army, Mississippi Department of Wildlife, Fisheries and Parks, Devils Tower National Monument, East Stroudsburg University, Ecological Sciences, Inc., Florida Fish and Wildlife Conservation Commission, Frenso Chaffee Zoo, Furman University, Georgia Department of Natural Resources, USDA Forest Service Gifford Pinchot National Forest, Great Smoky Mountains National Park, USDA Forest Service Hoosier National Forest, Humboldt State University, Idaho Department of Fish and Game, Illinois Department of Natural Resources, Illinois Natural History Survey, Indiana State University, Iowa Department of Natural Resources, U.S. Air Force, Langley, Kansas Department of Parks, Wildlife, and Tourism, Lake of the Ozarks State Park, Lake Vermilion-Soudan Underground Mine State Park, Lava Beds National Monument, USDA Forest Service, Lincoln National Forest, Louisiana Department Baton Rouge, Maine Department of Inland Fisheries and Wildlife, Maryland Department of Agriculture, Maryland Department of Natural Resources, Massachusetts Division of Fish and Wildlife, Michigan Department of Natural Resources, Ministere des Ressources naturelles et de la Faune, Minnesota Department of Natural Resources, Missouri Department of Conservation, Missouri State University, Montana Department of Fish, Wildlife and Parks, Nature Conservancy, Nebraska Game and Parks Commission, Nevada Department of Wildlife, New Hampshire Fish and Game Commission, New York Department of Environmental Conservation, North Carolina Wildlife Resources Commission, North Dakota Game and Fish, North Mississippi Refuges Complex, USFWS Noxubee National Wildlife Refuge, EL Malpais National Monument, Ohio Department of Natural Resources, Ohio Wildlife Center, Oklahoma State University, Oklahoma Department of Wildlife Conservation, Olentangy Wildlife Research Station, Oregon Caves National Monument, Oregon Department of Fish and Wildlife, Oregon Parks and Recreation Department, Ozark National Scenic Riverway, Ozark Plateau National Wildlife Refuge, Pennsylvania Game Commission, Pennsylvania State Animal Diagnostics Laboratory, Pima County Natural Resources, Parks, and Recreation, Rhode Island Department of Environmental Management, Rhode Island Division of Fish and Wildlife, USFWS San Bernardino/Leslie Canyon National Wildlife Refuge, South Dakota Department of Game, Fish and Parks, Session Woods Wildlife Management Area, USDA Forest Service, Shawnee National Forest, Sleeping Bear Dunes National Lakeshore, South Carolina Department of Natural Resources, South Mountain Wildlife Rehabilitation Center, Tennessee Wildlife Resources Agency, Texas Parakeet Raisers, Texas Parks and Wildlife, University of Central Oklahoma, University of Montreal, University of Nebraska, USFWS Upper Mississippi River National Wildlife and Fish Refuge, USDA Forest Service National Forests and Grasslands in Texas, USDA Forest Service Hot Springs Arkansas, USDA Animal and Plant Health Inspection Service Wildlife Services, USDA Forest Service North Central Research Station, USDA Forest Service Pacific Southwest Research Station, USFWS Arkansas Field Office, USFWS Ecological Services, USFWS Environmental Contaminants, Utah Division of Wildlife Resources, Vermont Fish and Wildlife, Virginia Department of Conservation and Recreation, Virginia Division of Natural Heritage, Virginia Game and Inland Fisheries, Washington Department of Fish and Wildlife, West Virginia Department of Natural Resources, USFWS Wheeler National Wildlife Refuge, USDA Forest Service White River National Forest, Wisconsin Dept of Natural Resources, Wisconsin State Lab of Hygiene, Wyoming Fish and Game. We thank Cydney Alexis, Nora Bello, Hannah Birg$\acute{\text{e}}$, Jeffrey Lorch, Bob O'Hara, Daniel Walsh, and Perry Williams for insightful discussions and comments that improved this manuscript. The authors acknowledge support for this research from USGS G16AC00413. Any use of trade, firm, or product names is for descriptive purposes only and does not imply endorsement by the U.S. Government.\vspace{-0.5cm} \section*{Supplementary Material} \noindent \textbf{Appendix S1} \noindent Tutorial with R code to simulated data and fit the Bayesian ecological diffusion model. \noindent \textbf{Appendix S2} \noindent Tutorial and R code to reproduce the white-nose syndrome data analysis. \noindent \textbf{Appendix S3} \noindent Simulation experiment description, results, and R code. \noindent \textbf{Appendix S4} \noindent Supplementary animations of Fig. 7. \vspace{-0.5cm} \begin{singlespace} \noindent \bibliographystyle{apa}
\section{Introduction} The outbreak of COVID-19 is disrupting the personal lives of people around the world in a variety of ways and has made profound impacts on the world socially and economically. As the number of confirmed COVID-19 cases in the U.S. continues to rise in early 2020, many states declared states of emergency and shutdown orders or stay-at-home orders were issued to slow the spread of COVID-19. Many schools, workplaces, and public gathering spaces across the U.S. were closed for an extended time. In June 2020, as states gradually reopen the economy, the number of COVID-19 cases starts to increase again in many states. In June 2020, Arizona emerged as one of the country's newest COVID-19 hot spots with an alarming resurgence of COVID-19 after the stay-at-home order was lifted in the middle of May. The number of people hospitalized is also climbing. On June 15, Arizona reported 2,497 new COVID-19 cases, a new all-time high record, up from the previous highest number of cases of 2,140 cases in a single day on June 12. Previously, Arizona experienced the first rapid rise in the number of confirmed cases of COVID-19 infection on March 16 with a total of 1,157 confirmed cases including 20 deaths, according to the Arizona Department of Health Services (\cite{ADHS2020}). The spike of the new COVID-19 case is believed to result from the fact that Arizona took a more aggressive approach to reopen the state in the middle of May. In addition, there is also no state-level requirement for everyone to wear face masks. Many Arizonans have different views on practice social distancing which is the only way to prevent infections in the absence of a vaccine. Although under Arizona's reopening plan, businesses are only advised to follow federal guidance on social distancing, the trade-offs between health and the economy have forced many businesses to choose not fully implementing the social distancing requirements during the COVID-19 pandemic. Therefore, quantifying the impact of social distancing on minimizing the epidemic impact can make governments and convince more people to better understand the significance of social distancing and personal precautions. In the present paper, we examine the COVID-19 situation in the state of Arizona in the United States and predict the number of cases in Arizona after the reopening of the economy. There have been plenty of mathematical models to describe the spread of infectious diseases. To reply to the current COVID-19 pandemic, many modeling studies using ordinary differential equations (ODE) have proposed for predicting the COVID-19 cases (e. g. \cite{He2020MBE,Li2020MBE,Wang2020MBE}). The classical susceptible infectious recovered model (SIR) (\cite{Huang2020BullWHO}) and susceptible exposed infectious recovered model (SEIR) (\cite{Lai2020Nature, Omori2020MedRxiv, Yang2020JTD}) are the most widely adopted ones for characterizing the outbreak of COVID-19. The extension of the classical SEIR model with age-stratified model (\cite{Prem2020LancetPH}) and meta-population model (\cite{Pujari2020medRxiv}) were also introduced. In this paper, we present a spatio-temporal model, specifically, a partial differential equation (PDE) model, of COVID-19 based on county-level clusters. The proposed model describes the combined effects of transboundary spread among county clusters in Arizona and human activities on the transmission of COVID-19. This is, in particular, important for Arizona as well as the other states in the U.S. because new COVID-19 cases in the U.S. are still continuing to head upward after the lockdown ended while most countries had peaked their new cases after lockdowns. One of the factors contributing to the continued spike of the U.S. cases is that personal precautions are not consistent across the U.S. once the lockdown ends. In Arizona, the face mask requirement is implemented at the local government level. A number of counties in Arizona do not require face masks. We divided the counties in Arizona into three regions. The three regions represent different geographical and social characteristics in terms of the spread of COVID-19. These disparities, which reflect differing regional levels of risk, can be better modeled by a spatio-temporal model. As a result, the characteristics of the PDE model make it suitable for COVID-19 prediction. The localized results of the spatio-temporal model provide more useful information for the local governments to closely monitor new COVID-19 clusters and quickly reinstating lockdowns at the local level when epidemic spikes. Many spatio-temporal models characterize infectious diseases by PDEs, describing the dynamics of susceptible, infected, and recovered populations (e.g. \cite{Brauer2019book, holmes1994ecology, Wang2020mdpi, Zhu2017MBE}). Our previous work (\cite{Haiyan2019book,wang2016regional}, \cite{Wang2020mdpi}) applies PDE models to make a regional level of influenza with geo-tagged data. The PDE model we develop in the present work focuses on the spread of COVID-19 and incorporating social distancing factors. While there is a rich literature on the application of PDE to modeling the spatial spread of infectious diseases, to the best of our knowledge, this work is the first attempt to apply PDE models on COVID-19 prediction with real-data validation. In addition, our model is different from the existing models in that we include the data from the Google Community Mobility Report (\cite{Google2020Mobility}) which reflects the effects of human activities. To help to combat the spread of COVID-19, Google releases the COVID-19 Community Mobility Reports which provide daily, county-level aggregated data on time spent at different categories of activities, compared with a baseline period before the epidemic. These activities include retail and recreation, groceries and pharmacies, parks, transit stations, workplaces, and residential areas. Mobility trends obtained from location history are dynamic in time and reflect real-time changes in social behavior, making them a crucial factor in analyzing COVID-19 spread and its countermeasure. There are several ODE and statistical models which utilize the COVID-19 Community Mobility data~(\cite{picchiotti2020arxiv,abouk2020arxiv,voko2020geroscience}). To the best of our knowledge, this is the first PDE model incorporating COVID-19 Community Mobility data to predict the number of COVID-19 cases. \section{Data Description} \label{data} \begin{figure}[!h] \centering \includegraphics[width=0.5\textwidth]{AZplot.png} \caption{Three regions in Arizona } \label{regions} \end{figure} There are 15 counties in the U.S. state of Arizona. In general, Arizona is divided into Northern, Central, and Southern Arizona. Although the boundaries of the regions are not well-defined, as we aim to predict COVID-19 cases in Arizona, we group the counties of Arizona into the three regions in Fig. \ref{regions}. The three regions have better balanced COVID-19 cases because Maricopa County, where the city of Phoenix is located, has about 60\% of the population in Arizona. More importantly, they represent different geographical and social characteristics in terms of the spread of COVID-19. Much of the Northern region is National Forest Service land, parkland, and includes part of Navajo reservations. For the per-capita COVID-19 infection rate in the US, the Navajo Nation, which spans parts of Arizona, New Mexico, and Utah, is greater than that of New York City in May 2020. The Southern Arizona includes the city of Tucson and several other small cities close to the border of the U.S. and Mexico. In the following, we will use NAZ (Region 1), CAZ (Region 2), and SAZ (Region 3) to denote the clusters of the Arizona counties. \begin{itemize} \item NAZ (Region 1)=[Mohave County, Coconino County, Yavapai County, La Paz County, Gila County, Navajo County, Apache County]. \item CAZ (Region 2)=[Maricopa County]. \item SAZ (Region 3)=[Yuma County, Pima County, Pinal County, Graham County, Santa Cruz County, Greenlee County, Cochise County]. \end{itemize} We compute the daily new cases of each region by adding the new COVID-19 cases of all counties belonging to a region. We use the COVID-19 data from the New York Times at the state and the county level over time. The New York Times is compiling the time series data from state and local governments and health departments in an attempt to provide a complete record of the ongoing outbreak. The data can be downloaded from https://github.com/nytimes/covid-19-data and https://www.nytimes.com/article/coronavirus-county-data-us.html. In addition, we incorporate the Google Community Mobility Report into our model. These Community Mobility Reports provide insights into how people's social behaviors have been changing in response to policies aimed at combating COVID-19. The reports provide the changes in movement trends compared to baselines overtime at the U.S. county level, across different categories of activities. These activities include retail and recreation, groceries and pharmacies, parks, transit stations, workplaces, and residential. The relevant data can be downloaded from https://www.google.com/covid19/mobility/. Then we compute the daily changes of each region by adding the changes of all counties belonging to a region. We create two time series from the Google Community Mobility Report. We accumulate the data for retail \& recreation, groceries \& pharmacies, parks, transit stations, workplaces, which are believed to increase the number of COVID-19 cases. On the other hand, the data from Google mobility for residential activities describes stay-at-home activities that are believed to prevent COVID-19 epidemics. In some cases, the increase of residential activities may result from events (such as parties) that could promote COVID-19 cases. However, the Google data only indicates residential activities compared to baselines. In our model, we use a Michaelis–Menten function to limit the effect of residential activities. Because it may take about two weeks for the effect of the activities to take place, we subtract the time $t$ in our PDE model by 14 to reflect the incubation period of COVID-19 in most cases. \section{PDE Model} \label{models} In this section, we introduce a specific PDE model to characterize the spatio-temporal dynamics of COVID-19 cases. To apply a PDE model to the interaction of the dynamics of COVID-19 cases, one must embed the three regions NAZ, CAZ, SAZ into Euclidean space and arrange them in a meaningful order. In this paper, the three regions are mapped onto a line where the locations of NAZ, CAZ, SAZ are 1, 2, 3 respectively. The arrangement will make the three regions stay as close as possible for ensuring that the continuous model can capture the spread of COVID-19 cases between the three regions. Projecting the three regions, geographically located in the north-south direction of Arizona, onto the x-axis of the Cartesian coordinates, as shown in Fig. \ref{embed}. We project the three regions as the order of geographical north-south direction instead of other orders mainly due to the following fact: Maricopa county has much more population than any other county in Arizona. It is more likely that COVID-19 spreads from the metro Phoenix area to both northern and southern counties, at least at the beginning of 2020. \begin{figure}[!h] \centering \includegraphics[page=1,scale=0.7, trim=7cm 7cm 7cm 7cm, clip=true ]{Diffusioncluster.pdf} \caption{Embedding of three regions into the $x$-axis and two spreading processes} \label{embed} \end{figure} Having embedded the three regions to the Euclidean space, we will develop the spatio-temporal model for the spread of COVID-19 cases according to the balance law: the rate at which a given quantity changes in a given domain must equal the rate at which it flows across its boundary plus the rate at which it is created, or destroyed, within the domain. The PDE model can be conceptually divided into two processes: an internal process within each region and an external process among regions. Similar derivation for the PDE model has been used in our previous work for PDE models for information diffusion in online social networks in \cite{Haiyan2019book}. Let $C(x,t)$ represent the COVID-19 cases in Arizona region $x$ at a given time $t$. The changing rate of $C(x,t)$ depends on two processes as in Fig.~\ref{embed}: \begin{itemize} \item Global process: the social interactions of people between regions, such as traveling and commuting between regions, that contribute to the spread of COVID-19; \item Local process: in each Arizona region, people become newly infected through social interactions with infected people within a region; and people may take personal precautions to reduce and mitigate COVID-19 spread. \end{itemize} Combining the two processes, the dynamics of COVID-19 cases can be captured by Eq.~(\ref{new_model}). \begin{eqnarray} \label{new_model} \left\{\begin{array}{ll} &\frac{\partial C(x,t)}{\partial t}=\frac{\partial }{\partial x}\big(d(x)\frac{\partial C(x,t)}{\partial x}\big)+r(t)l(x)a(x,t-14)C(x,t)-c\frac{h(x,t-14)C(x,t)}{k+C(x,t)}, \\ &C(x,1)=\psi(x),1<x<3, \\ &\frac{\partial C}{\partial x}(1,t)=\frac{\partial C}{\partial x}(3,t)=0,t>1, \end{array} \right. \end{eqnarray} where \begin{itemize} \item The term $\frac{\partial}{\partial x} \left(d(x)\frac{\partial C(x,t)}{\partial x}\right)$ denotes the spread of COVID-19 cases between different Arizona regions, where $d(x)$ measures how fast COVID-19 spreads across different Arizona regions. In epidemiology~(\cite{Brauer2019book} and \cite{natr2002murray}), the term $\frac{\partial}{\partial x} \left(d(x)\frac{\partial C(x,t)}{\partial x}\right)$ has been widely used for describing the spatial spread of infectious diseases. Here we assume $d(x)$ to be constant, i.e., $d(x)\equiv d>0$. \item $r(t)l(x)C(x,t)l(x)a(x,t-14)$ represents the new COVID-19 cases from a local Arizona region at location $x$ and time $t$. This type of function is widely used to describe the growth of bacteria, tumors, or social information over time~(\cite{natr2002murray}). \begin{itemize} \item[$\ast$] The function $r(t)>0$ represents the growth rate of COVID-19 cases at time $t$ for all Arizona regions. For simplicity, we assume that $r(t)$ increases with time $t$ as the COVID-19 cases increase. Therefore, we choose $r(t)=g(b_1+b_2 t)$ and $g(u)=1/(1+exp(-u))$ to describe the pattern with parameters $b_1>0, b_2>0$ to be determined by the collected COVID-19 data. \item[$\ast$]The location function $l(x)$ describes the spatial heterogeneity of COVID-19, which depicts different infection rates in the three Arizona regions. The function $l(x)$ is built through a cubic spline interpolation, which satisfies $l(x_i)\equiv l_i, i=1,2,3,$ where $x_i$ represents the location of Arizona region $i$. $l(x)$ is determined by the collected COVID-19 data. \item[$\ast$] $a(x,t-14)$ is accumulated data from Google mobility for retail \& recreation, groceries \& pharmacies, parks, transit stations, workplaces, which are believed to increase the COVID-19 cases. $t-14$ again reflects the incubation period of COVID-19 in most cases. \end{itemize} \item The function $c \frac{h(x,t-14)C(x,t)}{k+C(x,t)}$ is the rate of decrease of COVID-19 cases due to human efforts. During the period of the epidemic, Arizona people are advised to take COVID-19 precaution actions, such as wearing masks, staying six feet apart, or staying at home to reduce the contact rate. $c\frac{h(x,t-14)C(x,t)}{k+C(x,t)}$ to describe the potential reduction in COVID-19. \begin{itemize} \item[$\ast$] In most cases, the data from Google mobility for residential activities are believed to prevent the spread of COVID-19. In some cases, they may result from events (such as home parties) that could promote COVID-19 cases. Here we use Michaelis–Menten function to limit the effect of home activities in the spread of COVID-19. \item[$\ast$] $c>0$ represents the maximum reduction rate of COVID-19 cases due to government measures and personal precautions to maintain social distancing including wearing masks, staying six feet apart. $k$ is the number of COVID-19 cases at which the reduction rate is $\frac{1}{2} c $. By adjusting the parameters, this model allows us to examine the effect of social distancing to prevent COVID-19 cases. \item[$\ast$] $h(x,t-14)$ describes home activities which are believed to prevent COVID-19 epidemics. $h(x,t-14)$ is accumulated data from Google mobility for home activities. $t-14$ is because it takes two weeks for the effect of the activity to take place. \end{itemize} \item $a(x,t-14), h(x,t-14)$ are determined by Google Mobility data with the interpolation function of Matlab. \item $d,k,c$ and parameters of $r(t), l(x),$ are determined by the known historical data of the COVID-19 cases with the best fitting function of Matlab. \item Neumann boundary condition $\frac{\partial C}{\partial x}(1,t)=\frac{\partial C}{\partial x}(3,t)=0, \quad t>1$ is applied in~ (\cite{natr2002murray}). For simplicity, we count the cases imported from neighbor states as local Arizona cases and assume that no COVID-19 spreads across the boundaries at $ x=1, 3$. \item Initial function $C(x,1)=\psi(x)$ describes the initial states of COVID-19 in every Arizona region, which can be constructed from the historical data of COVID-19 cases by cubic spline interpolation. \end{itemize} \section{Model Prediction} \label{prediction} \begin{figure}[!h] \centering \subfigure[]{\includegraphics[width=3.2in, trim=3cm 8cm 3cm 8cm, clip=true]{./Region1.pdf}}\ \subfigure[]{\includegraphics[width=3.2in, trim=3cm 8cm 3cm 8cm, clip=true]{./Region2.pdf}}\ \subfigure[]{\includegraphics[width=3.2in, trim=3cm 8cm 3cm 8cm, clip=true]{./Region3.pdf}}\ \caption{Predictions of COVID-19 cases in Arizona from April 24, 2020, to June 19, 2020, for three regions. The blue lines represent the predicted COVID-19 cases and red lines represent the actual COVID-19 cases.}\label{Predictions} \end{figure} \begin{figure}[!h] \centering \subfigure[]{\includegraphics[width=3.1in, trim=3cm 8cm 1cm 6cm, clip=true]{./RegionSp1.pdf}}\ \subfigure[]{\includegraphics[width=3.1in, trim=3cm 8cm 1cm 6cm, clip=true]{./RegionSp2.pdf}}\ \subfigure[]{\includegraphics[width=3.1in, trim=3cm 8cm 1cm 6cm, clip=true]{./RegionSp3.pdf}}\ \caption{The relative accuracy in each region: NAZ (Region 1), CAZ (Region 2), and SAZ (Region 3) from April 24, 2020 to June 19, 2020.}\label{RA} \end{figure} The basic mathematical properties of the proposed PDE model in Eq.~(\ref{new_model}) such as existence and uniqueness can be established from the standard theorems for parabolic PDEs in~\cite{friedman2008partial}. Below, we evaluate the robustness of our PDE-based predictive model and validate if the model has acceptable prediction performance with the COVID-19 case report in Arizona. The procedure of predictive modeling for the COVID-19 case in Arizona is summarized as follows: \begin{itemize} \item \textbf{Prediction Procedure:} In the prediction process of the research time period, the model parameters are to be determined by the historical aggregated data of COVID-19 cases in the three regions under the same structured PDE. In the current experiment, we predict the COVID-19 cases three days ahead. In order to forecast the COVID-19 of a given day, we first train the parameters of the PDE model and then solve the PDE model for prediction. For example, days 1--7, 2--8, \ldots, are used as the training data, and we predict the number of COVID-19 cases for the following days 10, 11, \ldots, respectively. The process of performing the prediction can be divided into two major processes. We first use an optimization method to fit parameters in the PDE model with historical data of COVID-19 cases. In essence, this is a multi-parameter inverse problem of parabolic equations. We integrate the local and global methods to search for the best fitting parameters. In the present work for COVID-19 modeling problems, we take a hybrid approach: first, a tensor train global optimization (\cite{oseledets2011tensor}) is used to explore the parameter space thus to locate the starting points and then Nelder-Mead simplex local optimization method (\cite{lagarias1998convergence}) is used to search the local optimization of COVID-19 modeling problem. The Nelder-Mead simplex method is implemented in the fminsearch function in Matlab. Once the model parameters are determined, we use the fourth-order Runge-Kutta method to solve the PDE for one-step forward prediction numerically. \item \textbf{Accuracy Measurement:} We need to quantify the accuracy of model prediction of the COVID-19 cases by comparing the predicted COVID-19 cases with the observed aggregated COVID-19 cases for three regions, which are the ground truth. The mean absolute percentage error $$1-\left|\frac{x_{real}-x_{predict}}{x_{real}}\right|$$ is applied to measure the prediction accuracy, $x_{real}$ is the observed COVID-19 cases at every data collection time point and $x_{predict}$ is the predicted cases. \end{itemize} Fig.~\ref{Predictions} illustrates predictions of COVID-19 cases in Arizona from April 24, 2020, to June 19, 2020, for three regions. The period covers the period of the end of stay-home order when the COVID-19 case started to increase quickly. The blue lines represent the predicted COVID-19 cases and red lines represent the actual COVID-19 cases. Note that we normalize the data to be between $[0,1]$. Parameters in each prediction step are different, here we just provide the parameters in the last prediction for June 19. The parameters for prediction on June 19 are: $d=0.013556543719$, $k=4.655312010389$, $b_1=0.503402937243188$, $b_2=0.236417906835504$, $c=0.821575737918722$ and $l_1=0.0826411111659247$, $l_2=0.347970638795282$ and $l_3=0.28107732159028$. Fig.~\ref{RA} illustrates the prediction accuracy in NAZ, CAZ, and SAZ every day from April 24, 2020, to June 19, 2020. The Arizona stay-home order started on March 31, 2020, and ended on May 15, 2020. The average relative accuracy of three regions with three days prediction are 94\%, 97\%, and 95\% respectively. Clearly, the PDE-based prediction model has a good short-term prediction ability during active COVID-19 epidemics. \section{Effects of Social Distancing and Face Covering} \begin{figure}[!h] \centering \subfigure[]{\includegraphics[width=3.2in, trim=3cm 8cm 3cm 8cm, clip=true]{./RedRegion1.pdf}}\ \subfigure[]{\includegraphics[width=3.2in, trim=3cm 8cm 3cm 8cm, clip=true]{./RedRegion2.pdf}}\ \subfigure[]{\includegraphics[width=3.2in, trim=3cm 8cm 3cm 8cm, clip=true]{./RedRegion3.pdf}}\ \caption{Effects of preventive measures on the growth of COVID-19 cases in Arizona from April 24, 2020, to June 19, 2020. The red lines represent the actual COVID-19 cases. (a), (b), and (c) capture the predicted COVID-19 cases (blue lines) under additional social distancing and face covering to reduce COVID-19 for Region 1, 2 and 3. }\label{PolicyWhole} \end{figure} \begin{figure}[!h] \centering \includegraphics[width=0.5\textwidth]{Mask_plot.png} \caption{Arizona counties with face covering order} \label{mask} \end{figure} To demonstrate the effectiveness of intervention measures such as face masks and social distancing on decreasing COVID-19 cases, we predict the COVID-19 cases with an increased value of $c$ which measures the effect of the stay-at-home-order and social distancing. We do not have specific data from Google Community Mobility to incorporate our model for the effectiveness of social distancing and face mask. In general, it is believed that face masks and proper social distancing could significantly reduce COVID-19 cases. Specifically, based on each group of model parameters obtained in the above prediction process, we retain them unchanged in Eq.~(\ref{new_model}) except doubling the value of $c$ (the rate of effectiveness of social distancing). The doubled value of $c$ suggests that, to reduce COVID-19 cases, people in Arizona take the extra effort of practicing social distancing and wearing face covering even after the lift of the stay-at-home-order. Fig.~\ref{PolicyWhole} illustrates the COVID-19 cases with possible interventions, where the blue lines represent the predicted COVID-19 cases from April 24, 2020, to June 19, 2020, and the red lines represent the actual COVID-19 cases. Fig.~\ref{Predictions} can serve as baseline references. Fig.~\ref{PolicyWhole} (a), (b), (c) captures the predicted COVID-19 cases (blue lines) under double measurements to reduce COVID-19 for Region 1, 2 and 3 respectively. Fig.~\ref{PolicyWhole} shows that if stricter precaution measures are taken, the COVID-19 cases will be controlled to some extent. As a result, our analysis confirms the positive short-term effects of precaution measures on the spread of COVID-19. Unfortunately, there is no mandatory requirement of face-covering at the state level. About one month after the stay-at-home-order expired on May 15, local governments established their own health and safety measures such as face mask mandates in an effort to slow the spread of COVID-19. As a result, the state keeps breaking a record of daily cases and hospitalizations suspected to be related to COVID-19. CAZ (Maricopa county) continues to have the highest number of cases in Arizona. On June 22, multiple officials from cities across the state began implementing requirements for face coverings in public. There have been five counties including Maricopa County that have a mask requirement in place as shown in Fig.~\ref{mask} as of June 29, 2020. Many cities and towns across metro Phoenix already had enacted their own face-covering-mandates in public earlier but Maricopa County (CAZ) took the lead in sending a clear message to every resident in the county to wear a mask. We hope the COVID-19 cases will begin to go downward in the near future. \section{Discussion} \label{discussions} In this paper, the proposed PDE model is built on three regions in Arizona for the prediction of COVID-19 cases. The PDE model is capable of capturing the effects of various geographical and social factors. To ensure high accuracy predictions of COVID-19 cases, daily cases of COVID-19, and the effects of social distancing are included in the prediction model. In addition, Google Community Mobility data is incorporated to reflect the effects of human activities. As a result, the PDE model can be useful in making localized policies for reducing the spread of COVID-19. We regroup 15 counties in Arizona into three regions: Northern Arizona, Central Arizona, and Southern Arizona. One may be able to use ordinary differential equations on multiple patches for the prediction of COVID-19 cases in Arizona. Here we choose partial differential equations instead of ordinary differential equations mainly because of the geographical and social characteristics in Arizona in terms of the spread of COVID-19. The three regions are geographically located in the north-south direction of Arizona and can be naturally projected onto the x-axis of the Cartesian coordinates. In addition, Central Arizona, home to the metro Phoenix area, has about 60\% of the population in Arizona. As a result, the spread of COVID-19 between Central Arizona and other two regions are more likely predominant in terms of transboundary spread. These geographical characteristics, along with the disparities of social distancing and face mask requirements among the Arizona counties, fit squarely into the framework of reaction-diffusion equations for the spread of COVID-19. While capturing the trend of the spread of COVID-19, we were able to avoid large scale computation by regrouping the counties, which allowed us to use a computational-heavy PDE model. Thus, the diffusion process of COVID-19 between county-regions as well as the increase of COVID-19 cases within a region are incorporated into the PDE model. The present paper aims to develop, for the first time in the literature, a specific PDE model between county-regions for forecasting daily COVID-19 cases and further quantifying the influences of the mobility of the community on the changing the number of COVID-19 cases in the state of Arizona. In addition, In the present study, we study the effectiveness of human precautions such as face masks and social distancing on decreasing COVID-19 cases and hope to provide analytical results to help slow the spread of COVID-19 in Arizona. In this paper, we choose three regions of counties in Arizona for the spatial model because of the availability of both COVID-19 data and Google Community Mobility data. To gain more meaningful predictions with finer granularity, one may use zip codes or cities for the construction of regions or clusters. We could choose clustering algorithms to determine appropriate regions to ensure the connected zip codes stay as much as possible. However, the Google Community Mobility data is not available at the zip code level. Therefore, our model for prediction for regional COVID-19 is based on three regions of counties which is the most cost-effective method for prediction of COVID-19 in Arizona. Arizona has emerged as a COVID-19 hot spot since the stay-home orders were lifted in mid-May. It is important to study how to slow the virus’ spread. This study first presents a PDE model to describe COVID-19 cases from community transmission, transboundary transmission between regions, and human activities. We apply this model for the prediction of COVID-19 cases to see the effect of social distancing on COVID-19 cases. The numerical results show that our new method of predicting COVID-19 cases is of acceptable high accuracy and can predict the effects of social distancing. To conclude, the prediction accuracy and the policy simulation suggest that a combining PDE model with real data can provide substantial information on COVID-19 spatio-temporal dynamics. \section*{Acknowledgments} The first author was supported by NSF grant \#1737861. \section*{Conflict of interest} The authors declare that they have no conflict of interest.
\section{Introduction} Designing compounds with some desired chemical properties is the central challenge in the drug discovery process~\citep{sliwoski2014,elton2019}. De novo drug design is one of the most successful computational approach that involves generating new potential ligands \emph{from scratch}, which avoids enumerating explicitly the vast space of possible structures. Recently, deep learning has unlocked new progress in drug design. Promising results using deep generative models have been shown in generating soluble~\citep{gvae}, bioactive~\citep{segler_rnn}, and drug-like~\citep{jtvae} molecules. A key challenge in the field of drug design is the lack of realistic benchmarks~\citep{elton2019}. Ideally, the generated molecule by a de novo method should be tested in the wet lab for the desired property. In practice, typically, a proxy is used. For example, the octanol-water partition coefficient or bioactivity is predicted using a computational model~\citep{segler_rnn,gvae}. However, these models are often too simplistic~\citep{elton2019}. This is aptly summarized in \citet{coley2019} as ``The current evaluations for generative models do not reflect the complexity of real discovery problems.''. In contrast to drug design, more realistic benchmarks have been used in the design of photovoltaics~\citep{pyzer2015} or in the design oof molecules with certain excitation energies~\citep{Sumita2018}, where a physical calculation was carried out to both train models, and to evaluate generated compounds. Our main contribution is a realistic benchmark for de novo drug design. We base our benchmark on docking, a popular computational method for predicting molecule binding to a protein. Concretely, the goal is to generate molecules that are scored highly by SMINA~\citep{smina}. We picked \citet{smina} due to its popularity and being available under a free license. While we focus on de novo drug design, our methodology can be extended to evaluate retrospectively other approaches to designing molecules. Code to reproduce results and evaluate new models is available online at \href{https://github.com/cieplinski-tobiasz/smina-docking-benchmark}{https://github.com/cieplinski-tobiasz/smina-docking-benchmark}. Our second contribution is exposing limitation of currently popular de novo drug design methods for generating bioactive molecules. When trained using a few thousands compounds, a typical training set size, the tested methods fail to generate highly active structures according to the docking software. The highest scoring molecules in most cases did not outperform top 10\% molecules found in either the ZINC database or the training set. This suggest we should exercise caution when applying them in drug discovery pipelines, where we seldom have larger number of known ligands. We hope our benchmark will serve as a stepping stone to further improve these promising models. The paper is organised as follows. We first discuss prior work and introduce our benchmark. Next, we use our benchmark to evaluate two popular models for de novo drug design. Finally, we analyse why the tested models fail on the most difficult version of the benchmark. \section{Docking-based benchmark} \begin{figure} \centering \includegraphics[width=\textwidth]{figures/fig1_horizontal.pdf} \caption{Visualization of the proposed docking-based benchmark for de-novo drug design methods. First, the proposed molecule (leftmost) is docked to the target's binding site using SMINA, a popular docking software. In the most difficult version of the benchmark, the final score is computed based on the ligand pose using the default SMINA docking score. } \label{fig:benchmark_visualization} \end{figure} We begin by briefly discussing prior work and motivation. Next, we introduce our benchmark. \subsection{Why do we need yet another benchmark?} Standardized benchmarks are critical to measure progress in any field. Development of large-scale benchmarks such as the ImageNet was critical for the recent developments in artificial intelligence~\citep{imagenet_cvpr09,wang2018}. Many new methods for de novo drug design are conceived every year, which motivates the need for a systematic and efficient way to compare them~\citep{Schneider2019}. De novo drug design methods are typically evaluated using \emph{proxy tasks} that circumvent the need to test the generated compounds experimentally~\citep{jin2018junction, you2018, maziarka2020,kusner2017grammar,bombarelli2016}. Optimizing the octanol-water partition coefficient (logP) is a common example. The logP coefficient is commonly computed using an atom-based method that involves summing contribution of individual atoms~\citep{wildman1999,jin2018junction}, which is available in the RDKit package~\citep{rdkit}. Due to the fact that it is easy to optimize the atom-based method by producing unrealistic molecules~\citep{guacamol}, a version that heuristically penalizes hard to synthesize compounds is used in practice~\citep{jin2018junction}. This example illustrates the need to develop more realistic ways to benchmark these methods. Another example is QED score~\citep{bickerton2012} which is designed to capture \emph{druglikeliness} of a compound. Finally, some approacches use a model (e.g. a neural network) to predict bioactivity of the generated compounds~\cite{segler_rnn}. Similarly to logP, these two tasks are also possible to optimize while producing unrealistic molecules. This is aptly summarized in \citet{coley2019} as \begin{quote} ``The current evaluations for generative models do not reflect the complexity of real discovery problems.'' \end{quote} Interestingly, besides the aforementioned proxy tasks, more realistic proxy tasks are rarely used in the context of evaluating de novo drug design methods. This is in contrast to evaluation of generative models for generating photovoltaics~\citep{pyzer2015} or molecules with certain excitation energies~\citep{Sumita2018}. One notable exception is \citet{armstrong2018} who try to generate compounds that are active according to the DrugScore~\citep{gerd2011}, and then evaluate the generated compounds using rDock~\citep{RuizCarmona2014}. This lack of the overall diversity and realism in the typically used evaluation methods motivates us to propose our benchmark. \subsection{Docking-based benchmark} Our docking-based benchmark is defined by: (1) docking software that computes for a generated compound its pose in the binding site, (2) a function that scores the pose, (3) a training set of compounds with an already computed docking score. The goal is to generate a given number of molecules that achieve the maximum possible docking score. For the sake of simplicity, we do not impose limits on the distance of the proposed compounds to training set. Thus a simple baseline is to return the training set. Finding similar compounds that have a higher docking score is already prohibitively challenging for current state-of-the-art methods. As the field progresses, our benchmark can be easily extended to account for the similarity between the generated compounds and the training set. Finally, we would like to stress that the benchmark is not limited to de novo methods. The benchmark is applicable to any other approaches such as virtual screening. The only limitation required for a fair comparison is that docking is performed only on the supplied training set. \subsection{Instantiation} \label{sec:instatiation} As a concrete instantiation of our docking-based benchmark, we use SMINA~\citep{smina} due to its wide-spread use and being offered under a free license. To create the training set, we download from the ChEMBL~\citep{chembl2016} database molecules tested against popular drug-targets: 5-HT1B, 5-HT2B, ACM2, and CYP2D6. For 5-HT1B the final dataset consists in $1891$ molecules, out of which $1148$ are active (Ki < 100nm) and $743$ are inactive molecules (Ki > 1000nm). We list sizes of the datasets in Table~\ref{tab:dataset_sizes}. We dock each molecule using default settings in SMINA to a manually selected binding site coordinate. Protein structures were downloaded from the Protein Database Bank, cleaned and prepared for docking using Schrödinger modeling package. The resulting protein structures are provided in our code repository. We describe further details on the preparation of the datasets in Appendix~\ref{app:dataset_details}. \begin{table}[] \centering \begin{tabular}{ |c|c|c|c|c| } \hline & 5HT1B & 5HT2B & ACM2 & CYP2D6 \\ \hline Dataset size & 1891 & 1194 & 2341 & 4200 \\ \hline \# Actives & 1148 & 657 & 1304 & 343 \\ \hline \# Inactives & 743 & 537 & 1037 & 3857 \\ \hline \end{tabular} \caption{Sizes of the dataset used in the benchmark. The corresponding test dataset comprises of $10\%$ of the whole dataset, and the rest of it is used in training.} \label{tab:dataset_sizes} \end{table} Starting from the above, we define the following three variants of the benchmark. In the first variant, the goal is to propose molecules that achieve the smallest SMINA docking score used in score only mode, defined as follows: \begin{equation*} \label{eq:docking_score} \begin{split} \textnormal{Docking score} =& -0.035579 \cdot \textnormal{gauss}(o=0, w=0.5) \\ & -0.005156 \cdot \textnormal{gauss}(o=3, w=2) \\ & +0.840245 \cdot \textnormal{repulsion} \\ & -0.035069 \cdot \textnormal{hydrophobic} \\ & -0.587439 \cdot \textnormal{non\_dir\_h\_bond} \end{split}, \end{equation*} where all terms are computed based on the final docking pose. The first three terms measure the steric interaction between ligand and the protein. The fourth and the fifth term look for hydrophobic and hydrogen bonds between the ligand and the protein. We include in Appendix~\ref{app:smina_scoring_function} a detailed description of all the terms. Next, we propose two simpler variants of the benchmark based on individual terms in the SMINA scoring function. In the \emph{Repulsion} task, the goal is to only minimize the repulsion component, which is defined as: $$ \text{repulsion}(a_1, a_2) = \begin{cases} d_\text{diff}(a_1, a_2)^2, & d_\text{diff}(a_1, a_2) < 0 \\ 0, & \text{otherwise} \end{cases} $$ where $d_\text{diff}(a_1, a_2)$ is the distance between the atoms minus the sum of their van der Waals radii. Distance unit is Angstrom ($10^{-10}\text{m}$). The third task, \emph{Hydrogen Bond Task}, is to maximize the non\_dir\_h\_bond term: $$ \text{non\_dir\_h\_bond}(a_1, a_2) = \begin{cases} 0, & (a_1, a_2) \,\text{do not form hydrogen bond} \\ 1, & d_\text{diff}(a_1, a_2) < -0.7 \\ 0, & d_\text{diff}(a_1, a_2) \geq 0 \\ \frac{d_\text{diff}(a_1, a_2)}{-0.7} & \text{otherwise}. \end{cases} $$ To make the results more stable, we average the score over the top 5 best-scoring binding poses. Finally, to make the benchmark more realistic, we filter the generated compounds using the Lipinski rule, and discard molecules with molecular weight lower than 100. \subsection{Novelty criterion} To avoid trivial solutions, we filter out generated compounds that are similar to the training set. To set the similarity threshold, we downloaded $10^6$ compounds from the ZINC~\citep{irwin2005zinc} database and calculated their similarity to each of the training sets used in our benchmark. To evaluate similarity we used the ECFP~\citep{rogers2010extended} representation with the radius set to $2$ and the number of bits of $1024$. Based on the results, we simply set the similarity threshold to $0.2$, which is approximately the $5$th percentile of the similarity of ZINC molecules to each of the training sets. \subsection{ZINC baseline} The premise behind de novo drug discovery is that it enables access to structurally novel and potent molecules. To contextualize results in the benchmark, we included as the baseline sampling from the subset of ZINC database containing 9,204,719 molecules\footnote{Downloaded from \href{http://zinc15.docking.org}{http://zinc15.docking.org}.}. We selected molecules having following properties: 3D representation, standard reactivity, in-stock purchasability, ref pH, charges from -2 to 2 inclusive and used drug-like preferred subset. For each protein we have sampled a set of molecules from aforementioned ZINC subset of protein's training set size. In each task we compare to the mean score, the top 10\%, and the top 1\% of scores. \subsection{Diversity} To better understand the performance of each model, besides the mean score, we also evaluate the diversity of the proposed molecules. Concretely, we compute the mean Tanimoto distance between all pairs of molecules in the generated sample. We use the 1024-bit ECFP representation~\citep{rogers2010extended} with radius 2. The score is reported in the benchmark along with the docking score results. \subsection{When is a task solved?} In the experiments, we compare to two baselines: (i) random compounds from ZiNC as the baseline, and (ii) compounds from the training set. In each case we report the mean score, the top 10\% of scores, and the top 1\% of scores. We also report diversity of the results. Roughly speaking, \textit{we consider a given task solved if the generated molecules exceed the top 1\% score found in the ZINC database, while achieving at least the same diversity as observed in the training set.} This criterion is necessarily arbitrary. It is inspired by a natural baseline -- sampling several thousands of compounds from the ZiNC database. \section{Results and discussion} In this section, we evaluate three popular models for de novo drug design on our docking-based benchmark. \subsection{Models} We compare three popular models for de novo drug design. Chemical Variational Autoencoder (CVAE)~\citep{cvae} applies Variational Autoencoder~\citep{vae} by representing molecules as strings of characters (using SMILES encoding). This approach was later extended by Grammar Variational Autoencoder (GVAE)~\citep{gvae}, which ensures that generated compounds are grammatically correct. The third model, REINVENT~\citep{olivecrona2017molecular}, is a recurrent neural network trained using reinforcement learning for molecular optimization. \subsection{Experimental details} To generate active compounds, we follow a similar approach to one in~\citet{jtvae}, disregarding the penalty for insufficient similarity. Analogous methods using sparse Gaussian Process instead of multilayer perceptron are also employed in \citet{cvae} and \citet{gvae}. First, we fine-tune a given generative model for $5$ epochs on the training set ligands, starting from weights made available by the authors\footnote{Available at \href{https://github.com/aspuru-guzik-group/chemical_vae/tree/master/models/zinc}{https://github.com/aspuru-guzik-group/chemical\_vae/tree/master/models/zinc} and at \href{https://github.com/mkusner/grammarVAE/tree/master/pretrained}{https://github.com/mkusner/grammarVAE/tree/master/pretrained}.}. All hyperparameters are set to default values used in \citet{cvae} and \citet{gvae}. Additionally, we use the provided scores to train a multilayer perceptron (MLP) to predict the target (e.g. the SMINA scoring function) based on the latent space representation of the molecule. For CVAE and GVAE, to generate compounds, we first take a random sample from the latent space by sampling from a Gaussian distribution with the standard deviation of $1$ and the mean of $0$. Starting from this point in the latent space, we take 50 gradient steps to optimize the output of the MLP. Based on this approach we generate 250 compounds from the model. For the REINVENT model, we use pretrained weights on the ChEMBL database provided by \citet{olivecrona2017molecular}. As there is no latent space in this model, we train a random forest model to predict the target directly from the molecule structure. We use the ECFP fingerprint to encode the molecule~\citep{Rogers2010ECFP}. The reward is computed based on the random forest prediction multiplied by the QED score calculated using RDKit. All other experimental details, including hyperparameter values used in the experiments, can be found in Appendix~\ref{app:hyperparameters}. \begin{table}[H] \begin{subtable}[h]{0.95\textwidth} \centering \begin{tabular}{ |p{2.0cm}|p{1.1cm}p{1.1cm}|p{1.1cm}p{1.1cm}|p{1.1cm}p{1.1cm}|p{1.1cm}p{1.1cm}|} \hline & \multicolumn{2}{|l|}{5HT1B} & \multicolumn{2}{|l|}{5HT2B} & \multicolumn{2}{|l|}{ACM2} & \multicolumn{2}{|l|}{CYP2D6} \\ \hline CVAE & -4.647 & (0.907) & -4.188 & (0.913) & -4.836 & (0.905) & - & - \\ GVAE & -4.955 & (0.901) & -4.641 & (0.887) & -5.422 & (0.898) & -7.672 & (0.714) \\ REINVENT & \textbf{-9.774} & (0.506) & \textbf{-8.657} & (0.455) & \textbf{-9.775} & (0.467) & \textbf{-8.759} & (0.626) \\ \hline Train (50\%) & -8.541 & (0.850) & -7.709 & (0.878) & -6.983 & (0.868) & -6.492 & (0.897) \\ Train (10\%) & -10.837 & (0.749) & -9.769 & (0.831) & -8.976 & (0.812) & -9.256 & (0.869) \\ Train (1\%) & -11.493 & (0.859) & -10.023 & (0.746) & -10.003 & (0.773) & -10.131 & (0.763) \\ \hline ZiNC (50\%) & -7.886 & (0.884) & -7.350 & (0.879) & -6.793 & (0.873) & -6.240 & (0.883) \\ ZiNC (10\%) & -9.894 & (0.862) & -9.228 & (0.851) & -8.282 & (0.860) & -8.787 & (0.853) \\ ZiNC (1\%) & -10.496 & (0.861) & -9.833 & (0.838) & -8.802 & (0.840) & -9.291 & (0.894) \\ \hline \end{tabular} \caption{\textsc{Docking Score Function} ($\downarrow$)} \label{tab:real_docking_benchmark_results} \end{subtable} \begin{subtable}[h]{0.95\textwidth} \centering \begin{tabular}{ |p{2.0cm}|p{1.1cm}p{1.1cm}|p{1.1cm}p{1.1cm}|p{1.1cm}p{1.1cm}|p{1.1cm}p{1.1cm}|} \hline & \multicolumn{2}{|l|}{5HT1B} & \multicolumn{2}{|l|}{5HT2B} & \multicolumn{2}{|l|}{ACM2} & \multicolumn{2}{|l|}{CYP2D6} \\ \hline CVAE & \textbf{1.148} & (0.919) & \textbf{1.001} & (0.914) & \textbf{1.132} & (0.908) & \textbf{2.234} & (0.914) \\ GVAE & 1.361 & (0.910) & 1.159 & (0.942) & 1.383 & (0.917) & - & - \\ REINVENT & 1.544 & (0.811) & 1.874 & (0.859) & 2.262 & (0.845) & 2.993 & (0.858) \\ \hline Train (50\%) & 2.099 & (0.845) & 1.792 & (0.881) & 1.434 & (0.863) & 6.508 & (0.895) \\ Train (10\%) & 0.835 & (0.863) & 0.902 & (0.893) & 0.779 & (0.888) & 2.823 & (0.904) \\ Train (1\%) & 0.550 & (0.858) & 0.621 & (0.963) & 0.553 & (0.921) & 1.284 & (0.956) \\ \hline ZiNC (50\%) & 1.803 & (0.878) & 1.677 & (0.882) & 1.665 & (0.879) & 5.786 & (0.880) \\ ZiNC (10\%) & 0.840 & (0.880) & 0.865 & (0.896) & 0.792 & (0.881) & 2.348 & (0.887) \\ ZiNC (1\%) & 0.613 & (0.941) & 0.625 & (0.922) & 0.612 & (0.938) & 1.821 & (0.880) \\ \hline \end{tabular} \caption{\textsc{Repulsion} ($\downarrow$)} \end{subtable} \begin{subtable}[h]{0.95\textwidth} \centering \begin{tabular}{ |p{2.0cm}|p{1.1cm}p{1.1cm}|p{1.1cm}p{1.1cm}|p{1.1cm}p{1.1cm}|p{1.1cm}p{1.1cm}|} \hline & \multicolumn{2}{|l|}{5HT1B} & \multicolumn{2}{|l|}{5HT2B} & \multicolumn{2}{|l|}{ACM2} & \multicolumn{2}{|l|}{CYP2D6} \\ \hline CVAE & 1.089 & (0.915) & 1.168 & (0.909) & 0.881 & (0.907) & 0.539 & (0.908) \\ GVAE & \textbf{4.152} & (0.921) & \textbf{2.954} & (0.912) & 2.567 & (0.927) & \textbf{2.732} & (0.902) \\ REINVENT & 3.795 & (0.626) & 2.451 & (0.580) & \textbf{3.520} & (0.480) & 1.304 & (0.574) \\ \hline Train (50\%) & 1.069 & (0.843) & 0.668 & (0.882) & 0.296 & (0.871) & 0.684 & (0.892) \\ Train (10\%) & 2.934 & (0.751) & 2.327 & (0.816) & 1.444 & (0.896) & 2.061 & (0.884) \\ Train (1\%) & 3.351 & (0.825) & 3.586 & (0.575) & 2.519 & (0.852) & 2.700 & (0.917) \\ \hline ZiNC (50\%) & 1.114 & (0.879) & 0.871 & (0.882) & 0.512 & (0.877) & 0.660 & (0.877) \\ ZiNC (10\%) & 3.623 & (0.873) & 2.674 & (0.887) & 2.449 & (0.874) & 1.831 & (0.878) \\ ZiNC (1\%) & 5.743 & (0.928) & 3.545 & (0.935) & 3.253 & (0.940) & 2.115 & (0.861) \\ \hline \end{tabular} \caption{\textsc{Hydrogen Bonding} ($\uparrow$)} \end{subtable} \caption{Results on the three molecule generation tasks, each rerun for four different proteins, composing our docking-based benchmark. The key task is \textsc{Docking Score Function} in which the goal is to optimize docking score against a given protein target. Each cell reports the mean score for $250$ generated molecules in each task. In the parenthesis, the internal diversity of generated molecules is reported (see text for details). The tested models tend to improve upon the mean score in the ZiNC database (ZiNC). However, they generally do not improve upon the top molecules from ZiNC; ZiNC ($10\%$) and ZiNC ($1\%$) show the top $10\%$ of scores and the top $1\%$ of scores. Missing results ("-") indicate that the model failed to generate $250$ molecules that satisfy drug-like filters (see text for details).} \label{tab:docking_benchmark_results} \end{table} \subsection{Results} \label{sec:results} Table~\ref{tab:docking_benchmark_results} summarizes the results on all three tasks. Recall that we generally consider a given task solved if the generated molecules exceed the top 1\% score found in the ZINC database, while achieving at least the same diversity as in the training set. Below we make several observations. \paragraph{Docking Score Function task} The key task in the benchmark is \textsc{Docking Score Function}. We observe that CVAE and GVAE models fail to generate compounds that achieve higher docking score compared to the mean docking score in the ZiNC dataset ($-8.785$ for 5-HT1B compared to $-4.647$ and $-4.955$ achieved by CVAE and GVAE, respectively). The REINVENT model achieves much better performance ($-9.774$ for 5-HT1B). However, while docking scores attained by the molecules generated by REINVENT generally outperform the mean docking in the ZiNC dataset and the training set, they fall short of outperforming the top 10\% molecules found in ZiNC ($-9.894$ for 5-HT1B, with the exception of ACM2). We also draw attention to the fact that the generated molecules by REINVENT are markedly less diverse than the diversity of the training set ($0.506$ mean Tanimoto distance compared to $0.787$ in the training set). These results suggest that generative models applied to de novo drug discovery might require substantial more data to generate well-binding compounds than is typically available for training. In the key \textsc{Docking Score Function} task, models generally fail to outperform the top $10\%$ from the ZiNC database. It should worry us that optimizing for docking score, which seems to be a simpler target than true biological binding affinity, is already challenging given realistically sized training sets (between $1074$ and $3780$ molecules). \paragraph{Repulsion task} Interestingly, REINVENT performs significantly worse than GVAE and CVAE on the \textsc{Repulsion} task. All models fail to outpeform top $10\%$ found in the ZiNC dataset. We observe markedly lower diversity of molecules generated by REINVENT compared to the training set. \paragraph{Hydrogen Bonding task} The \textsc{Hydrogen Bonding} task is the simplest, and both GVAE and REINVENT generate molecules that almost match the top $1\%$ molecules found in the ZINC database and the training set. We again observe relatively low diversity of molecules generated by REINVENT. \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/reinvent_mols.pdf} \caption{Best scoring molecules generated by REINVENT in each of the three tasks composing the benchmark. } \label{fig:benchmark_visualization} \end{figure} \paragraph{Generated molecules} Figure~\ref{fig:benchmark_visualization} shows the best scoring molecules generated by REINVENT. We observe that optimizing each objective promotes different structural motifs. For example, the best scoring molecules in the \textsc{Repulsion} task are small, which intuitively enables them to easily fit into the binding pocket, achieving lower repulsion values than the top 1\% molecules in the training set. \section{Conclusion} As concluded by \citet{coley2019}, ``the current evaluations for generative models do not reflect the complexity of real discovery problems''. Motivated by this, we proposed a new, more realistic, benchmark tailored to de novo drug design, using docking score as the target to optimize. Code to evaluate new models is available at \href{https://github.com/cieplinski-tobiasz/smina-docking-benchmark}{https://github.com/cieplinski-tobiasz/smina-docking-benchmark}. Our results suggest that generative models applied to de novo drug discovery pipelines might require substantial more data to generate realistic compounds than is typically available for training. Despite using over $1000$ compounds for training (between $1074$ and $3780$), the best docking scores generally do not outperform top 10\% docking scores in the ZiNC dataset. Docking score is only a simple proxy of the actual binding affinity, and as such it should worry us that it is already challenging to optimize. On a more optimistic note, the tested models achieved much better performance on the simplest task in the benchmark, which is to optimize a single term in the SMINA scoring function involving the number of hydrogen bonds to the binding site. This suggests that producing compounds that optimize docking score based on the provided dataset is an attainable, albeit challenging, task. We hope our benchmark better reflects the complexity of real discovery problems and will serve as a stepping stone towards developing better de novo models for drug discovery.
\section{\@startsection {section}{1}{\z@}{-5.5ex plus -.5ex minus -.2ex}{1ex plus .2ex}{\large \bf}} \pagestyle{fancy} \renewcommand{\sectionmark}[1]{\markboth{ #1}{ #1}} \renewcommand{\subsectionmark}[1]{\markright{ #1}} \fancyhf{} \fancyhead[LE,RO]{\slshape\thepage} \fancyhead[LO]{\slshape\rightmark} \fancyhead[RE]{\slshape\leftmark} \addtolength{\headheight}{0.5pt} \renewcommand{\headrulewidth}{0pt} \newtheorem{thm}{Theorem}[section] \newtheorem{mainthm}[thm]{Main Theorem} \newtheorem*{T}{Theorem 1'} \newcommand{\ZZ}{{\mathbb Z}} \newcommand{\GG}{{\mathbb G}} \newcommand{\Z}{{\mathbb Z}} \newcommand{\RR}{{\mathbb R}} \newcommand{\NN}{{\mathbb N}} \newcommand{\GF}{{\rm GF}} \newcommand{\QQ}{{\mathbb Q}} \newcommand{\CC}{{\mathbb C}} \newcommand{\FF}{{\mathbb F}} \newtheorem{lem}[thm]{Lemma} \newtheorem{cor}[thm]{Corollary} \newtheorem{pro}[thm]{Proposition} \newtheorem*{proposi}{Proposition \ref{pro:pro63}} \newtheorem*{thm_notag}{Theorem} \newtheorem{problem}{Problem} \newtheorem*{Cassels}{Cassels' question} \newtheorem{proprieta}[thm]{Property} \newcommand{\pf}{\noindent \textbf{Proof.} \ } \newcommand{\eop}{${\Box}$ \relax} \newtheorem{num}{equation}{} \theoremstyle{definition} \newtheorem{rem}[thm]{Remark} \newtheorem{rems}[thm]{Remarks} \newtheorem{D}[thm]{Definition} \newtheorem{Not}{Notation} \newtheorem{Def}{Definition} \newcommand{\nsplit}{\cdot} \newcommand{\GGG}{{\mathfrak g}} \newcommand{\GL}{{\rm GL}} \newcommand{\SL}{{\rm SL}} \newcommand{\SP}{{\rm Sp}} \newcommand{\LL}{{\rm L}} \newcommand{\Ker}{{\rm Ker}} \newcommand{\la}{\langle} \newcommand{\ra}{\rangle} \newcommand{\PSp}{{\rm PSp}} \newcommand{\Uni}{{\rm U}} \newcommand{\GU}{{\rm GU}} \newcommand{\GO}{{\rm GO}} \newcommand{\Aut}{{\rm Aut}} \newcommand{\Alt}{{\rm Alt}} \newcommand{\Sym}{{\rm Sym}} \newcommand{\isom}{{\cong}} \newcommand{\z}{{\zeta}} \newcommand{\Gal}{{\rm Gal}} \newcommand{\SO}{{\rm SO}} \newcommand{\SU}{{\rm SU}} \newcommand{\PGL}{{\rm PGL}} \newcommand{\PSL}{{\rm PSL}} \newcommand{\loc}{{\rm loc}} \newcommand{\Sp}{{\rm Sp}} \renewcommand{\O}{{\rm O}} \newcommand{\PUni}{{\rm PU}} \newcommand{\Id}{{\rm Id}} \newcommand{\I}{{\rm I}} \newcommand{\Ind}{{\rm Ind}} \newcommand{\s}{{\sigma}} \newcommand{\F}{{\mathbb F}} \newcommand{\Q}{{\mathbb Q}} \newcommand{\R}{{\mathbb R}} \newcommand{\N}{{\mathbb N}} \newcommand{\E}{{\mathcal{E}}} \newcommand{\G}{{\mathcal{G}}} \newcommand{\A}{{\mathcal{A}}} \newcommand{\C}{{\mathcal{C}}} \newcommand{\modn}{{\rm \hspace{0.1cm} (mod \hspace{0.1cm} }} \newcommand{\bmu}{{\textbf \mu}} \newcommand{\hloc}{{\rm loc}} \newcommand{\f}{{\mathfrak f}} \newcommand{\g}{{\mathfrak g}} \newcommand{\h}{{\mathfrak h}} \newcommand{\cost}{{\mathfrak c}} \newcommand\ddfrac[2]{\frac{\displaystyle #1}{\displaystyle #2}} \vskip 0.5cm \title{Cohomology of groups acting on \\ vector spaces over finite fields} \author{Laura Paladino} \date{ } \maketitle \vskip 1.5cm \begin{abstract} Let $p$ be a prime and $m,n$ be positive integers. Let $G$ be a group acting faithfully on a vector space of dimension $n$ over the finite field $\FF_q$ with $q=p^m$ elements. A famous theorem proved by Nori in 1987 states that if $m=1$ and $G$ acts semisimply on $\FF_p^n$, then there exists a constant $c(n)$ depending only on $n$, such that if $p>c(n)$ then $H^1(G,\FF_p^n)=0$. We give an explicit constant $c(n)=(2n+1)^2$ and prove a more general version of Nori's theorem, by showing that if $G$ acts semisimply on $\FF_q^n$ and $p>(2n+1)^2$, then $H^1(G,\FF_q^n)$ is trivial, for all $q$. As a consequence, we give sufficient conditions to have an affirmative answer to a classical question posed by Cassels in the case of abelian varieties over number fields. \end{abstract} \textbf{MSC}: 20J06, 11G10 \section{Introduction} \label{sec0} Let $p$ be a prime and $m,n$ positive integers. Let $G$ be a group acting on a vector space of dimension $n$ over the finite field $\FF_q$ with $q=p^m$ elements. There is a great interest on the cohomology $H^1(G,\FF_q^n)$. Many mathematicians have given sufficient conditions to have the triviality of $H^1(G,M)$ in some particular cases, as for instance when $G$ is a group of Lie type and $M$ is a minimal irreducible $G$-module \cite{CPS} \cite{CPS2} or when $G$ is a group of Lie type and $M=L(\lambda)$ is a simple $G$-module of highest weight $\lambda$ \cite{Georgia} or when $q=p$ and $G$ acts semisimply on $M=\FF_p^n$ \cite{Nori}. Anyway there is no general criterium for the triviality of $H^1(G,\FF_q^n)$. From the mentioned papers it seems that the irreducibility of $\FF_q^n$ as a $G$-module could play a fundamental r\^ole to get the triviality of $H^1(G,\FF_q^n)$. Here we prove that this is indeed true by showing that if $G$ acts faithfully and irreducibly over $\FF_q^n$, then $H^1(G,\FF_q^n)$ is trivial for all but finitely many primes $p$. A deep theorem of Nori \cite[Theorem E, page 271]{Nori} gives the following sufficient conditions to the triviality of $H^1(G,\FF_q^n)$, when $p=q$. \begin{thm}[Nori, 1972] There exists a constant $c(n)$ depending only on $n$ such that if $p>c(n)$ and $G\leq \GL_n(\FF_p)$ acts faithfully and semisimply on $\FF_p^n$, then $$H^1(G,\FF_p^n)=0.$$ \end{thm} \noindent According to our knowledge, there are no results in the literature showing an explicit $c(n)$. Here we show that it suffices to take $c(n)=(2n+1)^2$, for all $n$. In addition we prove a more general statement concerning the cohomology of groups acting faithfully and semisimply on $\FF_q^n$. \begin{thm} \label{P1_bis} Let $p$ be a prime number and let $m, n$ be positive integers. Let $\FF_q$ be the field with $q=p^m$ elements and let $G$ be a group acting faithfully and semisimply on $\FF_q^n$. If $p>(2n+1)^2$, then $H^1(G,\FF_q^n)=0$. \end{thm} \noindent In particular, Theorem \ref{P1_bis} holds if $G$ acts faithfully and irreducibly (or simply) on $\FF_q^n$. The techniques of proof of Theorem \ref{P1_bis} are different from the ones used by Nori. Here we take into account Aschbacher's Theorem on the classification of subgroups of $\GL_n(p^m)$ and consider the cohomology of each class of subgroups acting irreducibly on $\FF_q^n$. A consequence of the proof of Theorem \ref{P1_bis} is the next statement on the cohomology of non-cyclic simple groups. \begin{cor} \label{simple} Let $p$ be a prime number and let $m,n$ be positive integers. Let $\FF_q$ be the field with $q=p^m$ elements and let $S$ be a non cyclic simple group acting faithfully and semisimply on $\FF_q^n$. If $p>(2n+1)^2$, then $H^1(S,\FF_q^n)=0$. \end{cor} \noindent Corollary \ref{simple} gives a generalization of the results in \cite{CPS} and \cite{CPS2}. \par In next section we briefly resume Aschbacher's classification and some other well-established results in group theory. Then we will proceed with the proof of Theorem \ref{P1_bis}, which is divided into various lemmas and cases. At the end of the paper we show an application of Theorem \ref{P1_bis} to the following question, posed by Cassels in 1962, in the third paper of his remarkable series on the arithmetic of curves of genus one \cite{Cas}. \begin{Cassels} Let $k$ be a number field, with algebraic closure $\overline{k}$, and $\E$ an abelian variety of dimension 1 defined over $k$. Let $G_k$ be the absolute Galois group $\Gal(\overline{k}/k)$ and $\Sha(k,\E)$ the Tate-Shafarevic group of $\E$ over $k$. Are the elements of $\Sha(k,\E)$ infinitely divisible by a prime $p$ when considered as elements of the Weil-Ch\^{a}telet group $H^1(G_k,\E)$ of all classes of homogeneous spaces for $\E$ defined over $k$? \end{Cassels} \noindent This question remained open for decades. Only in 2012, we got an affirmative answer over $k$ for all $p\geq ( 3^{[k:\Q] /2} + 1 )^2$, implied by the results in \cite{PRV}. In addition, the results in \cite{PRV2} imply an affirmative answer over $\QQ$ for all $p\geq 5$. Since 1972 Cassels' question has been considered in the more general setting of an abelian variety $\A$ defined over $k$, instead of an elliptic curve $\E$ \cite{Bas}, \cite{CS}, \cite{Cre2}, \cite{GR}. In \cite{Cre2} Creutz shows the existence of counterexamples in infinitely many nonisomorphic abelian varieties defined over $\QQ$, for every $p$. Let $\A[p^m]$ denote the $p^m$-torsion subgroup of $\A$ and $\A[p^m]^{\vee}$ its Cartier dual. Both the results of Creutz \cite[Theorem 3]{Cre2} and of Ciperiani and Stix \cite[Proposition 13]{CS} show that the triviality of $\Sha(k,\A[p^m]^{\vee})$, for every $m$, is a sufficient condition to have an affirmative answer to Cassels' question for $p$ in $\A$. In addition \c{C}iperiani and Stix produce a criterium \cite[Theorem D]{CS} to have the triviality of $\Sha(k,\A[p^m])$, for all $m$. Then in particular they give sufficient conditions to have an affirmative answer to Cassels' question in the case of principally polarized abelian varieties. As a consequence of Theorem \ref{P1_bis} we are able to give a criterium to have the triviality of both $\Sha(k,\A[p^m])$ and $\Sha(k,\A[p^m]^{\vee})$ at the same time, for every $m$. As a consequence, we will prove the following statement giving sufficient conditions to have an affirmative answer to Cassels' question in every $\A$ over $k$. \begin{thm} \label{cor_cass} Let $\A$ be an abelian variety of dimension $g$ defined over a number field $k$. For every $p>(4g+1)^2$, if $\A[p]$ is an irreducible $G_k$-module, then Cassels' question has an affirmative answer for $p$ in $\A$. \end{thm} \noindent In particular Theorem \ref{cor_cass} shows that, given an abelian variety $\A$ over $k$, then for all but finitely many primes $p$, the reducibility of $\A[p]$ as a $G_k$-module is the only obstruction to the $p^m$-divisibility of the elements of $\Sha(k,\A)$ in the Weil-Ch\^{a}telet group $H^1(G_k,\A)$, for every $m$. As we will see in Section \ref{last}, the hypotheses of Theorem \ref{cor_cass} are also sufficient to assure the validity of a local-global principle for the divisibility by $p^m$ of elements in $H^1(G_k,\A)$, for all $m$. \section{Subgroups of $\GL_n(q)$} \label{sec1} From now on let $V=\FF_q^n$. We recall some standard notations in group theory, that we will keep in the rest of the paper. \begin{Not} \label{not_1} Let $n,m$ be positive integers, let $p$ be a prime number and let $q=p^m$. We use the standard notations for the projective general linear group $\PGL_n(q)$, the special linear group $\SL_n(q)$, the projective special linear group $\PSL_n(q)$, the unitary group $\Uni_n(q)$ (defined over the extension $\FF_{q^2}/\FF_q$ \cite[Definition 1.5.30]{BHR}), the projective unitary group $\PUni_n(q)$, the symplectic group $\Sp_n(q)$, the projective symplectic group $\PSp_n(q)$, the symmetric group $S_n$ and the alternating group $A_n$. By $C_n$ we denote a cyclic group of order $n$ and by $p^{1+2n}$ an extraspecial group of order $p^{1+2n}$. Furthermore, if $n$ is odd or both $n$ and $q$ are even, then we denote by $\textrm{O}_n(q)$ the orthogonal group and by $\textrm{SO}_n(q)$ the special orthogonal group. Let $\omega_q$ be a primitive element of $\F_q^*$. If $n$ is even and $q$ is odd we denote by (see \cite{BHR}) \begin{description} \item[ ] $\O_n^+(q)$ the stabilizer of the non-degenerate symmetric bilinear antidiagonal form \par $\textrm{antidiag}(\underbrace{1,...,1}_{n})$; \item[ ] $\SO_n^+(q)$ the subgroup of $\O_n^+(q)$ formed by the matrices with determinant 1; \item[ ] $\O_n^-(q)$ the stabilizer of the non-degenerate symmetric bilinear form $\I_n$, when $n\equiv 2 \textrm{ (mod 4})$ and $q\equiv 3 \textrm{ (mod 4})$ and the stabilizer of the non-degenerate symmetric bilinear diagonal form $\textrm{diag}(\underbrace{\omega_q,1,...,1}_{n})$, when $n\not\equiv 2 \textrm{ (mod 4})$ and $q\not\equiv 3 \textrm{ (mod 4})$; \item[ ] $\SO_n^-(q)$ the subgroup of $\O_n^-(q)$ formed by the matrices with determinant 1. \end{description} \noindent For $n$ even and $\epsilon\in\{+,-\}$, we denote by $\Omega_n^{\epsilon}(q)$ the unique subgroup of index 2 of $\O_n^{\epsilon}(q)$, which is obtained as the kernel of the spinor norm on $\SO_n^{\epsilon}(q)$ (see \cite[Equation (2.5.9), Proposition 2.5.7, pag. 29]{KL}, \cite[Definition 1.6.13, pag. 29]{BHR}) and by $\textrm{P}\Omega_n^{\epsilon}(q)$ we denote the image of $\Omega_n^{\epsilon}(q)$ in $\PGL_n(q)$. Similarly for $n$ odd, we denote by $\Omega_n(q)$ the unique subgroup of index 2 of $\O_n$, which is obtained as the kernel of the spinor norm on $\SO_n(q)$ and by $\textrm{P}\Omega_n(q)$ the image of $\Omega_n(q)$ in $\PGL_n(q)$. \end{Not} \bigskip \begin{Not} Let $H, K$ be two groups. By the standard notations in group theory, we denote by \begin{description} \item[ ] $H\rtimes K$, the semidirect product of $H$ with $K$; \item[ ] $H\circ K$, the central product of $H$ and $K$; \item[ ] $H\wr K$, the wreath product of $H$ and $K$; \item[ ] $H.K$, a group that is an extension of its normal subgroup $H$ with the group $K$, in the case when we do not know if it is a split extension or not; \item[ ] $H^{.}K$, a group that is a non-split extension of its normal subgroup $H$ with the group $K$. \end{description} \end{Not} \noindent In 1984, Aschbacher proved that the maximal subgroups of $\GL_n(q)$ could be divided into 9 classes \cite{Asc}, that we denote by $\C_i$, $1\leq i\leq 9$ (by $\C_9$ we denote the class that was originally called $\mathcal{S}$ by Aschbacher). The geometric properties and the general group structures of the maximal subgroups of $\GL_n(q)$ of class $\C_i$, with $1\leq i\leq 8$, have been described for every $n$ (see \cite{KL}). On the contrary, we do not know explicitly neither a geometric property, nor the general group structure of the maximal subgroups of type $\C_9$. It is a hard problem to find explicitly these groups when $n$ is big. We have a complete list of such groups only for $n\leq 12$ (see \cite{BHR}). Anyway, Aschbacher's Theorem gives a characterization of the maximal subgroup of class $\C_9$, that we recall in the following, together with the classification of the maximal subgroups of geometric type: \begin{description} \item[maximal subgroups of class $\C_1:$] stabilizers of totally singular or non-singular subspaces, i.e. maximal parabolic groups; \item[maximal subgroups of class $\C_2:$] stabilizers of direct sum decompositions $V =\bigoplus_{i=1}^{r} V_i$, with each $V_i$ of dimension $t$, i.e. wreath products $\GL_t(q)\wr S_r$, with $ n=rt$; \item[maximal subgroups of class $\C_3:$] stabilizers of extension fields of $\FF_q$ of prime index $r$, i.e. group extensions $\GL_t(q^r).C_r,$ with $n=rt, r$ prime; \item[maximal subgroups of class $\C_4:$] stabilizers of tensor product decompositions $V=V_1\otimes V_2$, i.e. central products $\GL_t(q)\circ \GL_r(q)$ with $n=rt$; \item[maximal subgroups of class $\C_5:$] stabilizers of tensor product decompositions $V=V_1\otimes V_2$, i.e. groups $\GL_n(q_0)$, where $q=q_0^r$, with $r$ prime; \item[maximal subgroups of class $\C_6:$] normalizers of symplectic-type $r$-groups in absolutely irreducible representations, i.e. group extensions $(C_{q-1}\circ r^{1+2t}).\Sp_{2t}(r)$, with $r\neq p$ a prime and $n=r^{t}$; \item[maximal subgroups of class $\C_7:$] stabilizers of tensor product decompositions $V=\bigotimes_{i=1}^t V_i, \textrm{dim}(V_i)=r$, i.e. group extensions $\underbrace{ (\GL_r(q)\circ ... \circ \GL_r(q)) }_{t} .S_t$, with $n=r^t $; \item[maximal subgroups of class $\C_8:$] classical groups, i.e. symplectic groups, ortogonal groups, unitary groups; \item[maximal subgroups of class $\C_9:$] if $G$ is a maximal subgroup of $\GL_n(q)$ of class $\C_9$ and $Z(G)$ denotes its center, then $G/ Z(G)$ is almost simple, its socle $T$ is a nonabelian simple group and its normal subgroup $ Z(G) T$ acts absolutely irreducibly, preserves no nondegenerate classical form, is not a subfield group, and does not contain $\SL_n(q)$. \end{description} \begin{Not} From now on we will say that a subgroup $G$ of $\GL_n(q)$ (respectively of $\SL_n(q)$) is of class $\C_i$ or of type $\C_i$, with $1\leq i\leq 9$, if $G$ is contained in a maximal subgroup of $\GL_n(q)$ (respectively of $\SL_n(q)$) of class $\C_i$. \end{Not} \bigskip\noindent In the proof of Theorem \ref{P1_bis}, we will use the description of the properties of the maximal subgroups of class $\C_i$, with $1\leq i\leq 9$, stated above. In the part concerning the groups of class $\C_9$, at a certain point we will deal with finite simple groups, whose classification is well-known, as well as the list of their automorphisms groups. One of the most complete references in the literature is Wilson's book on finite simple groups \cite{Wil}. Following that textbook, we will divide the simple groups in four classes: alternating groups, sporadic groups, classical groups and exceptional groups. We will also call groups of Lie type the classical and the exceptional groups. \begin{Not} We keep the standard notations used in \cite{KL}, \cite{Wil} and in \cite{GLS} for the exceptional groups of Lie type associated to the exceptional non twisted Lie algebras $G_2(q)$ ($q\geq 3$), $F_4(q)$, $E_6(q)$, $E_7(q)$, $E_8(q)$; for the exceptional groups of Lie type associated to the exceptional twisted Lie algebras $^2E_6(q)$ and $^3D_4(q)$; for the Suzuki groups $\textrm{Suz}(q)$, $q=2^{2h+1}$ with $h$ a positive integer, and for the Ree groups $^2F_4(q)$, $q=2^{2h+1}$ and $^2G_2(q)$, $q=3^{2h+1}$. \end{Not} \noindent In the literature the groups of Lie type are also divided into two classes, with respect to the characteristic of their field of definition. A group of Lie type $S\leq \GL_n(p^m)$ is in cross characteristic (or coprime characteristic), when the characteristic of its field of definition is different from $p$. The group $S$ is in defining characteristic, when the characteristic of its field of definition is equal to $p$. Assume that we are in the cross characteristic case and the field of definition of $S$ is ${\mathfrak{p}}\neq p$ and let $w={\mathfrak{p}}^{\alpha}$, where $\alpha$ is a positive integer. The minimal degree $n$ of a representation of $S$ in $\GL_n(q)$ is well-known. By \cite[Table 5.3.A, pag. 188]{KL}, when ${\mathfrak{p}}>3$, the minimal degrees for the representation of $S$ in $\GL_n(p^m)$ (and in $\SL_n(p^m)$) are the following (see also \cite{Land} and \cite{Hoff}). \begin{center} {\small \begin{tabular}{ll} \hline \hline Group & Minimal Degree \\ \hline \hline $\PSL_2(w)$ & $\ddfrac{w-1}{\gcd(2,w-1)}$\\ \hline $\PSL_t(w)$, $t\geq 3$ & $w^{t-1}-1$ \\ \hline $\PSp_{2t}(w)$, $t\geq 2$ & $\ddfrac{1}{2}(w^{t}-1)$ \\ \hline $\Uni_{t}(w)$, $t\geq 3$ & $w\ddfrac{w^{t-1}-1}{w+1}$, $t$ odd \\ & $\ddfrac{w^{ t}-1}{w+1}$, $t$ even \\ \hline $\textrm{P}\Omega_{2t}^{+}(w)$, $t\geq 4$ & $(w^{t-1}-1)(w^{t-2}+1)$, $w\neq 5$ \\ & $w^{t-2}(w^{t-1}-1)$, $w= 5$\\ \hline $\textrm{P}\Omega_{2t}^{-}(w)$, $t\geq 4$ & $(w^{t-1}+1)(w^{t-2}-1)$ \\ \hline $\Omega_{2t+1}(w)$, $t\geq 3$, $r$ odd \hspace{0.1cm} & $w^{2(t-1)}-1$, $w\neq 5$\\ & $w^{ t-1}(w^{t-1}-1)$, $w=5$\\ \hline $E_6(w)$ & $w^{9} (w^{2}-1)$\\ \hline $E_7(w)$ & $w^{15} (w^{2}-1)$\\ \hline $E_8(w)$ & $w^{27} (w^{2}-1)$\\ \hline $F_4(w)$ & $w^{6} (w^{2}-1)$\\ \hline $^2E_6(w)$ & $w^{9} (w^{2}-1)$\\ \hline $G_2(w)$ & $w (w^{2}-1)$\\ \hline $^3D_4(w)$ & $w^{3} (w^{2}-1)$\\ \hline $^2F_4(w)$ & $w^{4} \sqrt{\ddfrac{w}{2}}(w-1)$\\ \hline $\textrm{Suz}(w)$ & $\sqrt{\ddfrac{w}{2}}(w-1)$\\ \hline $^2G_2(w)$ & $w (w-1)$\\ \hline \hline \multicolumn{2}{c}{ }\\ \multicolumn{2}{c}{Table 1: \begin{minipage}[t]{8cm} Lower bounds for the degrees of the representations of \par the finite simple groups in cross characteristic ${\mathfrak{p}}>3$ \end{minipage}} \end{tabular} } \end{center} \bigskip\noindent For instance, if $S=\PSL_t(w)\leq \GL_n(q)$, then $n\geq w^{t-1}-1$. \bigskip\par All through the paper, we will denote by $G_p$ a $p$-Sylow subgroup of $G$. With abuse of notation we will often refer to the $p$-Sylow subgroup of $G$ instead of a $p$-Sylow subgroup of $G$, by considering $G_p$ up to isomorphism. In various parts of the proof of Theorem \ref{P1_bis}, we will consider the cohomology of the $p$-Sylow subgroup $G_p$ of $G$ with values in $V$. In fact we have the following lemma assuring the vanishing of $H^1(G, V)$, when $H^1(G_p, V)$ vanishes. \begin{lem} \label{Sylow} Let $G_p$ be a $p$-Sylow subgroup of $G$. If $H^1(G_p, \FF_q^n)=0$, then $H^1(G, \FF_q^n)=0$. \end{lem} \begin{proof} The restriction map $res: H^1(G, M) \rightarrow H^1(G_p, M)$ is injective on the $p$-primary part of $H^1(G, M)$. When $V=\F_{p^m}^n$, the $p$-primary part of $H^1(G, V)$ is the whole group and $res: H^1(G, V) \rightarrow H^1(G_p, V)$ is injective. \end{proof} \section{The proof} The proof of Theorem \ref{P1_bis} is divided into various steps. The first step is to investigate the cohomology of a normal subgroup $H\unlhd G$ with values in $V$ in relation to the cohomology of $G$ itself. Then we will consider the cases when $V$ has a tensor product decomposition and we apply those results to the case when $G$ is isomorphic to a proper subgroup of $\GL(V)$ equal to a classical group. In Subsection \ref{subsec2} we prove Theorem \ref{P1_bis} for $n\leq 3$. In the last subsection we produce the proof of Theorem \ref{P1_bis} for all $n\geq 4$, by dividing it into two parts concerning the subgroups of $\GL_n(\FF_q)$ of geometric type and respectively the subgroups of type $\C_9$. This last step in particular considers the cohomology of a simple group $S$ with values in $\FF_q^n$ and gives a proof of Corollary \ref{simple}. The techniques of proof are similar to those used in \cite{Pal19}, where the investigation is about the triviality of a subgroup of $H^1(G,\FF_q)$, under stronger hypotheses. Anyway here there is an important improvement in the results of every step and there are also additional steps that are fundamental to get the new conclusion. The proofs of some of the lemmas in the next subsection can be deduced from the results in \cite{Pal19}, but we prefer to state all of them explicitly here, in order to have a more self-contained paper for the reader's convenience. \subsection{Normal subgroups} Let $G$ be isomorphic to a subgroup of $\GL_n(p^m)$, which acts faithfully and irreducibly on $V$. Next lemma and its corollaries deal with the case when $G$ has a nontrivial normal subgroup $S$ with trivial cohomology. \begin{lem} \label{extension} Assume that a group $G$ acts faithfully and irreducibly on $V=\FF_q^n$ as a subgroup of $\GL_{n}(q)$ which is an extension $H.K$, where $H$ is a nontrivial normal subgroup of $G$. If $H^1(H,V)=0$, then $H^1(G,V)=0$. \end{lem} \begin{proof} Consider the inflation-restriction exact sequence \begin{equation} \label{infres} 0\rightarrow H^1(K,V^H)\rightarrow H^1(G,V)\rightarrow H^1(H,V)^{K}. \end{equation} \noindent Since $H^1(H,V)=0$, then $H^1(G,V)\simeq H^1(K,V^H)$. We are going to show that $V^H$ is a $G$-submodule of $V$. Let $w\in V^H$ and $\sigma\in G$. We have $\sigma(w)\in V^H$ if and only if $\tau \sigma(w) =\sigma(w)$, for all $\tau\in H$, if and only if $\sigma^{-1}\tau\sigma(w)=w$, for all $\tau\in H$. Since $H$ is a normal subgroup of $G$, then $\sigma^{-1}\tau\sigma\in H$, for all $\tau\in H$ and $\sigma\in G$. Thus $V^H$ is a $G$-submodule of $V$. Owing to $V$ being an irreducible $G$-module, we have that $V^H$ is trivial or that $V^H=G$. If $V^H$ is trivial, then $H^1(K,V^H)=0$, implying $H^1(G,V)=0$. If $V^H=G$, then $H$ is trivial and we have a contraddiction with our assumptions. Then $H^1(G,V)=0$. \end{proof} \noindent Being $H^1(G,.)$ an additive functor, for every fixed group $G$, we deduce the following corollary. \begin{cor} \label{extension_sem} Assume that $G$ acts faithfully and semisimply on $V=\FF_q^n$ as a subgroup of $\GL_{n}(q)$, which is an extension $H.K$, where $H$ is a nontrivial normal subgroup of $G$. If $H^1(H,V)=0$, then $H^1(G,V)=0$. \end{cor} \noindent The hypothesis that $V$ is an irreducible $G$-module in the statement of Lemma \ref{extension} can be replaced by the hypothesis that $V$ is an irreducible $H$-module, as showed in the next statement. \begin{cor} \label{extension_sn} Assume that $G$ acts faithfully on $V$ as a subgroup of $\GL_{n}(\FF_q)$ that is an extension $H.K$, where $H$ is a nontrivial normal subgroup of $G$, acting irreducibly on $V$. If $H^1(H,V)=0$, then $H^1(G,V)=0$. \end{cor} \begin{proof} Suppose that $V$ is a reducible $G$-module. Then $V$ has a nontrivial submodule $W$ that is stable under the action of $G$. In particular $W$ is stable under the action of $H$ and this is a contradiction with $V$ being an irreducible $H$-module. Then $V$ is an irreducible $G$-module and the conclusion follows by Lemma \ref{extension}. \end{proof} \bigskip\noindent With the next corollary we observe that the hypothesis about the irreducibility of $V$ as a $H$-module in Corollary \ref{extension_sn} can be replaced by the hyphotesis of the existence of $\tau\in H$, such that $\tau-1$ is invertible. \begin{cor} \label{extension_sn_cor} Assume that $G$ is isomorphic to a subgroup of $\GL_{n}(\FF_q)$ that is an extension $H.K$, with $H$ nontrivial. If $H^1(H,V)=0$ and there exist $\tau\in H$ such that $\tau-1$ is invertible, then $H^1(G,V)=0$. \end{cor} \begin{proof} Obviously $V^H$ is a $H$-module. Since $\tau-1$ is invertible, then it fixes no element in $V^H$. Therefore $V^H=\{0\}$ and $H^1=(K,V^H)=0$. The conclusion follows by the triviality of $H^1(H,V)$ and by using the inflation-restriction exact sequence \eqref{infres}. \end{proof} \noindent Both Corollary \ref{extension_sn} and Corollary \ref{extension_sn_cor} hold as well when $V$ is a semisimple $H$-module, owing to $H^1(H,.)$ being an additive functor. We recall the following important statement \cite[Proposition 24]{Ser4}. \begin{pro} \label{S_rep} Let $H$ be a normal subgroup of a group $G$, and let $\rho: G\rightarrow \GL(V)$ be an irreducible representation of $G$. Then: \begin{description} \item[a)] either there exists a subgroup $J$ of $G$, unequal to $G$ and containing $H$, and an irreducible representation $\theta$ of $J$ such that $\rho$ is induced by $\theta$; \item[b)] or else the restriction of $\rho$ to $H$ is a direct sum of isomorphic irreducible representations. \end{description} \end{pro} \noindent In view of Proposition \ref{S_rep} and Corollary \ref{extension_sn}, we will be able to prove the next fundamental statement. \noindent \begin{lem} \label{normal} Assume that $G$ acts faithfully and irreducibly on $V$. Let $H$ be a nontrivial normal subgroup of $G$. Then there exists a submodule $\widetilde{W}$ of $V$ such that $H$ acts irreducibly on $\widetilde{W}$ and such that if $H^1(H,\widetilde{W})=0$, then $H^1(G,V)=0$. \end{lem} \begin{proof} Let $\rho$ be the representation of $G$ in $\GL(V)$. We are under the hypotheses of Proposition \ref{S_rep}. Since $H^1(H,.)$ is an additive functor, if we are in case \textbf{b)}, then the conclusion follows by Corollary \ref{extension_sn}. If we are in case \textbf{a)} then there exist a subgroup $J$ of $G$, a $J$-invariant subspace $W$ of $V$ and an irreducible representation $\theta: J\rightarrow \GL(W)$, such that $H\unlhd J\lneq G$, $\rho=\Ind_{J}^G \theta$ and $V=\bigoplus_{i=1}^{r} \sigma_i W$, where $\sigma_1W, ..., \sigma_rW$ is a full system of representatives of the left cosets of $J$ in $G$ and $\sigma_i W$ is an isomorphic copy of $W$, for all $1\leq i\leq r$. Then $H^1(G,V)=H^1(G,\bigoplus_{i=1}^{r} \sigma_i W)$. Being $H^1(G,.)$ an additive functor, it suffices that $H^1(J,W)=0$ to get $H^1(G,V)=0$. Since $W$ is an irreducible $J$-module and $H\unlhd J$, we may apply Proposition \ref{S_rep} to $J$, $W$, $\theta$ and $H$. If we are in case \textbf{b)}, then we immediately get the conclusion as above. If we are in case \textbf{a)}, then there exists a subgroup $J'\lneq J$ containing $H$, a $J'$-invariant subspace $W'$ of $W$ and an irreducible representation $\theta': J'\rightarrow \GL(W')$, such that $\theta=\Ind_{J'}^{J} \theta'$ and $W=\bigoplus_{i=1}^{r'} \sigma'_i W'$, where $\sigma'_1W', ..., \sigma'_rW'$ is a full system of representatives of the left cosets of $J'$ in $J$ and $\sigma'_i W'$ is an isomorphic copy of $W'$, for all $1\leq i\leq r'$. Since $G$ is a finite group, by proceeding in this way, at a certain point either we will be in case \textbf{b)}, or we will be in case \textbf{a)} with $J=H$ and $W=\widetilde{W}$. The conclusion then follows by the additivity of $H^1(H,.)$ as a functor and by Corollary \ref{extension_sn}. \end{proof} \noindent Owing to Lemma \ref{normal}, we can study the cohomology of normal subgroups of $G$ instead of the cohomology of $G$ itself. \begin{rem} \label{rem_normal} Assume that $G$ acts faithfully and irreducibly on $V$ and $H\unlhd G$. By the arguments used in the proof of Lemma \ref{normal}, from now on we may assume without loss of generality that $V$ is a faithful and irreducible $H$-module. \end{rem} \noindent This is very important especially in view of the next remark. \begin{rem} \label{SL_n} \hspace{0.3cm} \begin{description} \item[i)] Let $G$ be a subgroup of $\GL_{n}(p^m)$ and let $\widetilde{G}:=G\cap \SL_n(p^m)$. The special linear group $\SL_n(p^m)$ is a normal subgroup of $\GL_n(p^m)$ which is an extension of $\SL_n(p^m)$ by a cyclic group. Then by Lemma \ref{extension}, Lemma \ref{normal} and Remark \ref{rem_normal}, it suffices to prove Theorem \ref{P1_bis}, for every subgroup $G$ of $\SL_n(p^m)$. \item[ii)] Moreover, observe that, owing to $|\GL_n(p^m)|=(p^m-1)|\SL_n(p^m)|$, the $p$-Sylow subgroup of $\GL_n(p^m)$ coincides with the $p$-Sylow subgroup of $\SL_n(p^m)$. So if the $p$-Sylow subgroup of $\widetilde{G}$ is trivial, then the $p$-Sylow subgroup of $G$ is trivial, implying $H^1(G,V)=0$, by Lemma \ref{Sylow}. \end{description} \end{rem} \noindent Because of Remark \ref{SL_n}, in the proof of Theorem \ref{P1_bis}, we will often assume, without loss of generality, that $G$ is a proper subgroup of $\SL_n(p^m)$. Since Lemma \ref{normal} allows us to deal with normal subgroups of $G$ instead of $G$ itself, then one can think to reduce the study to the cohomology of simple groups acting on $V$. Anyway this is not sufficient, since the cohomology of a cyclic group of prime order acting on $V$ is not always trivial. Thus, we will more generally investigate the cohomology of all possible subgroups of $\SL_n(p^m)$ acting faithfully and irreducibly on $V$. In the last part of the proof of Theorem \ref{P1_bis}, by considering the groups of class $\C_9$, we will deal with the cohomology of simple groups that are not cyclic (and prove Corollary \ref{simple}, as mentioned above). \subsection{Tensor products and classical groups} \noindent We are going to investigate the cohomology of $G$ with values in $V$, when $V$ has a tensor product decomposition. Next lemma considers the case when $V\simeq (\FF_q)^n=V_1 \bigotimes V_2$, where $V_1$, $V_2$ are vector spaces over $\F_{p^m}$, with dimension respectively $t$ and $r$, such that $rt=n$. This case does not occur when $n$ is a prime. Let $\GL(V_i)$ be the group of the linear transformations of $V_i$, for $i\in \{1,2\}$. Let $x\in V_1$ and $y\in V_2$. As in \cite[\S 4.4]{KL}, for every $\sigma\in \GL(V_1)$ and $\tau\in \GL(V_2)$ we denote by $\sigma\otimes \tau$ the map acting on elements $x\otimes y\in V$ as $(\sigma\otimes \tau)(x\otimes y)= \sigma(x)\otimes \tau(y)$ and then acting on the whole $V$, with the action extended by linearity. The group $\GL(V_1)\otimes \GL(V_2)$ is formed by the maps $\sigma\otimes\tau$, with $\sigma\in \GL(V_1)$ and $\tau\in \GL(V_2)$. We recall that $\GL_t(p^m)\circ \GL_r(p^m)\simeq \GL(V_1)\otimes \GL(V_2)\leq \GL(V)$ by \cite[\S 4.4]{KL}. Every subgroup of $\GL_t(p^m)\circ \GL_r(p^m)$ is itself a central product of two groups (where one of the two groups or both can be trivial). In particular, if $G=G_t\circ G_r\leq \GL_t(p^m)\circ \GL_r(p^m)$, then $G_t$ is a subgroup of $\GL_t(p^m)$ acting on $V_1$ and $G_r$ is a subgroup of $\GL_t(p^m)$ acting on $V_2$ (see also \cite[\S 4.4]{KL}). We denote by $\overline{G_t}$ and $\overline{G_r}$ the images of $G_t$ and respectively $G_r$ in the quotient $G=G_t\circ G_r$. Observe that in particular $\overline{G_t}$ and $\overline{G_r}$ are quotients of $G_t$ and respectively $G_r$ (by subgroups of their centers). \bigskip \begin{lem} \label{tensor} Let $V=V_1 \bigotimes V_2$, where $V_1$, $V_2$ are vector spaces over $\F_{p^m}$, with dimension respectively $t$ and $r$. Assume that $G=G_t\circ G_r$ acts faithfully and semisimply on $V$ as a subgroup of $\GL_t(p^m)\circ \GL_r(p^m)$. Assume that $H^1(G_t,V_1)=0$ and $H^1(G_r,V_2)=0$. Then $H^1(G,V)=0$. \end{lem} \begin{proof} As before, owing to $H^1(G,.)$ being an additive functor, we may assume without loss of generality that $G$ acts irreducibly on $V$. Since $\overline{G_t}$ is a quotient of $G_t$, then by the inflation-restriction exact sequence, the triviality of $H^1(G_t,V_1)$ implies $H^1(\overline{G_t},V_1)=0$. In the same way the triviality of $H^1(G_r,V_2)$ implies $H^1(\overline{G_r},V_2)=0$. On the other hand the groups $\overline{G_t}$ and $\overline{G_r}$ are isomorphic to normal subgroups of $G$. Thus we also have the following inflation-restriction exact sequence \begin{equation} \label{infres3} 0\rightarrow H^1(\overline{G_t},V^{\overline{G_r}})\rightarrow H^1(G,V)\rightarrow H^1(\overline{G_r},V)^{\overline{G_t}} \rightarrow H^2(\overline{G_t},V^{\overline{G_r}}). \end{equation} \noindent Since $V$ is an irreducible $G$-module and ${\overline{G_r}}$ is isomorphic to a normal subgroup of $G$, we can use Lemma \ref{normal}. To ease notation, instead of introducing a submodule $\widetilde{W}$ of $V$, which is an irreducible ${\overline{G_r}}$-module, and rewrite the exact sequence \eqref{infres3} with $\widetilde{W}$ instead of $V$, we use Remark \ref{rem_normal} and assume without loss of generality that $V$ is an irreducible ${\overline{G_r}}$-module. Therefore $V^{\overline{G_r}}$ is the whole $V$ or it is trivial. If $V^{\overline{G_r}}=V$, then $\overline{G_r}$ is trivial. By the exact sequence \ref{infres3}, then $H^1(\overline{G_t},V)\simeq H^1(G,V)$. We may identify $G$ with $\overline{G_t}\otimes \langle \I_r\rangle \simeq \overline{G_t}$. Let $\sigma\in \overline{G_t}$, such that $$\sigma = \left( \begin{array}{ccc} \alpha_{1,1} & \hdots & \alpha_{1,t} \\ \vdots & & \vdots \\ \alpha_{t,1} & \hdots &\alpha_{t,t} \\ \end{array} \right),$$ \medskip\noindent then $$\sigma\otimes \I_r= \left( \begin{array}{c|c|c} \alpha_{1,1} \I_r & \hdots & \alpha_{1,t}\I_r \\ \hline \vdots & & \vdots \\ \hline \alpha_{t,1} \I_r & \hdots &\alpha_{t,t} \I_r \\ \end{array} \right).$$ \medskip\noindent By abuse of notation, we will denote a class in $H^1(G,V)$ with one of its representative. Let $Z\in H^1(G,V)$, such that $$Z_{\sigma\otimes \I_{r}}=\left( \begin{array}{c} x_{\sigma,1} \\ x_{\sigma,2} \\ \vdots \\ x_{\sigma,tr} \\ \end{array} \right).$$ \medskip\noindent with $x_{\sigma,h}\in \FF_q$, for all $1\leq h\leq tr$. For $1\leq j\leq r$, we define $$Z_{\sigma}^j:=\left( \begin{array}{c} x_{\sigma,j} \\ x_{\sigma,r+j} \\ x_{\sigma,2r+j} \\ \vdots \\ x_{\sigma,(t-1)r+j} \\ \end{array} \right).$$ \medskip\noindent If $$\tau = \left( \begin{array}{ccc} \beta_{1,1} & \hdots & \beta_{1,t} \\ \vdots & & \vdots \\ \beta_{t,1} & \hdots &\beta_{t,t} \\ \end{array} \right).$$ \medskip\noindent then $$\sigma\tau = \left( \begin{array}{ccc} \alpha_{1,1} \beta_{1,1} +...+ \alpha_{1,t} \beta_{t,1} & \hdots & \alpha_{1,1} \beta_{1,t} + ... +\alpha_{1,t} \beta_{t,r} \\ \vdots & & \vdots \\ \alpha_{t,1} \beta_{1,1} + ... + \alpha_{t,t} \beta_{t,1} & \hdots & \alpha_{t,1} \beta_{1,t} + ... + \alpha_{t,t} \beta_{t,r} \\ \end{array} \right)$$ \noindent and $$\sigma\tau\otimes \I_r = \left( \begin{array}{c|cc|c} (\alpha_{1,1} \beta_{1,1} +...+ \alpha_{1,t} \beta_{t,1})\I_r & \hdots & \hdots & (\alpha_{1,1} \beta_{1,t} + ... +\alpha_{1,t} \beta_{t,r})\I_r \\ \hline \vdots & & & \vdots \\ \hline (\alpha_{t,1} \beta_{1,1} + ... + \alpha_{t,t} \beta_{t,1})\I_r & \hdots & \hdots & (\alpha_{t,1} \beta_{1,t} + ... + \alpha_{t,t} \beta_{t,r})\I_r \\ \end{array} \right)$$ \medskip\noindent Let $$Z_{\sigma\tau\otimes \I_r}= \left( \begin{array}{c} x_{\sigma\tau,1} \\ x_{\sigma\tau,2} \\ \vdots \\ x_{\sigma\tau,tr}\\ \end{array} \right) \hspace{0.5cm} \textrm{and} \hspace{0.5cm} Z_{\tau\otimes \I_{r}}=\left( \begin{array}{c} x_{\tau,1} \\ x_{\tau,2} \\ \vdots \\ x_{\tau,tr} \\ \end{array} \right),$$ \medskip\noindent with $x_{\sigma\tau,h}\in \FF_q$ and $x_{\tau,h}\in \FF_q$, for all $1\leq h\leq tr$. Since $Z\in H^1(G, V)$, then $Z_{\sigma\tau\otimes \I_r}=Z_{(\sigma\otimes \I_r)(\tau\otimes \I_r)}= Z_{(\sigma\otimes \I_r)}+(\sigma\otimes \I_r)Z_{(\tau\otimes \I_r)},$ i.e. $$ \left( \begin{array}{c} x_{\sigma\tau,1} \\ x_{\sigma\tau,2} \\ \vdots \\ x_{\sigma\tau,tr}\\ \end{array} \right)=\left( \begin{array}{c} x_{\sigma,1} \\ x_{\sigma,2} \\ \vdots \\ x_{\sigma,tr}\\ \end{array} \right)+ \left(\begin{array}{c} \alpha_{1,1}x_{\tau,1} + \alpha_{1,2}x_{\tau,r+1} +... + \alpha_{1,t}x_{\tau,(t-1)r+1}\\ \alpha_{1,1}x_{\tau,2} + \alpha_{1,2}x_{\tau,r+2}+... + \alpha_{1,t}x_{\tau,(t-1)r+2} \\ \vdots\\ \alpha_{t,1}x_{\tau,t} + \alpha_{t,2}x_{\tau,r+t}+... + \alpha_{t,t}x_{\tau,tr}\hspace{0.8cm}\\ \end{array} \right). $$ \medskip\noindent In particular we deduce $Z_{\sigma\tau}^j= Z_{\sigma}^j+\sigma(Z_{\tau}^j)$, for all $1\leq j\leq r$. Therefore $Z^j\in H^1(\overline{G_t},V_1)$, for all $1\leq j\leq r$. Being $H^1(\overline{G_t},V_1)=0$, then there exist $y_1,y_2,...,y_{tr}\in \FF_q$ such that $$Z_{\sigma}^j=(\sigma-\I_r)\left( \begin{array}{c} y_{j} \\ y_{r+j} \\ \vdots \\ y_{(t-1)r+j} \\ \end{array} \right).$$ \medskip\noindent Thus $$ Z_{\sigma\otimes \I_r}=(\sigma\otimes \I_r-\I_t\otimes \I_r)\left( \begin{array}{c} y_{1} \\ y_{2} \\ \vdots\\ y_{tr}\\ \end{array} \right), $$ \medskip\noindent implying $H^1(G,V)=0$. \par If $V^{\overline{G_r}}=0$, then $H^1(\overline{G_t},V^{\overline{G_r}})$ and $H^2(\overline{G_t},V^{\overline{G_r}})$ are both trivial. From the inflation-restriction exact sequence \eqref{infres3}, we have $H^1(G,V)\simeq H^1(\overline{G_r},V)^{\overline{G_t}}$. In particular $H^1(G,V)$ is isomorphic to a subgroup of $H^1(\overline{G_r},V)$. By identifying an element $\tau\in\overline{G_r}$ with $\I_t\otimes \tau$, we can proceed as above, when $G\simeq \overline{G_t}\otimes \langle \I_r\rangle$, to get $H^1(G,V)=0$, by using $H^1(\overline{G_r},V_2)=0$. \end{proof} \bigskip \noindent With a very similar proof, we have the following result about the first cohomology group of a group acting on a tensor product in the way described by Steinberg's Tensor Product Theorem (see \cite{Ste}), with the only difference that here the representation of $G$ is not projective. \begin{lem} \label{tensor3} Let $t$, $r$ be positive integers. Let $V=\bigotimes_{i=1}^t V_i$, where, for every $1\leq i\leq t$, $V_i$ is a vector space over $\F_{p^m}$ of dimension $r$. Let $\f: x\mapsto x^p$ be the Frobenius map of $\F_{p^m}$. For every $\sigma_i\in \GL( V_i)$ and every integer $0\leq j\leq m$, let $\f^j(\sigma_i)$ denote the matrix obtained by raising the entries of $\sigma_i$ to their $p^j$-th powers. In particular $\f^0(\sigma)=\sigma$. Let $\tau$ be a permutation in $S_t$. Assume that $G$ is a subgroup of $\GL(V)$ formed by elements $\f^{j_1}(\sigma_1)\otimes ... \otimes \f^{j_t}(\sigma_t)$ acting on $v_1 \otimes v_2\otimes ... \otimes v_t\in V$ in the following way $(\f^{j_1}(\sigma_1)\otimes ... \otimes \f^{j_t}(\sigma_t))(v_1 \otimes v_2\otimes ... \otimes v_t)= \f^{j_1}(\sigma_1)(v_{\tau(1)}) \otimes ...\otimes \f^{j_t}(\sigma_t)(v_{\tau(t)})$, where $0\leq j_i\leq m$, for every $1\leq i\leq t$. Consider the action of $G$ extended by linearity to the whole $V$. For a fixed $i$, let $G_i$ be the subgroup of $\GL(V_i)$ formed by the maps $\sigma_i$ (appearing in the $i$-th position) as above. Assume that $V$ is a faithful and irreducible $G$-module. If $H^1(G_i, V_i)=0$, for all $1\leq i\leq t$, then $H^1(G,V)=0$. \end{lem} \begin{proof} The same arguments used in the proof of Lemma \ref{tensor} work as well in this case with the only differences that here the entries $\alpha_{i,j}$ in $\sigma$ are now raised to their $p^j$-th powers, for some $0\leq j\leq m$ and the $x_{\sigma,i}$, with $1\leq i\leq n$, are permuted. \end{proof} \noindent Observe that Lemma \ref{tensor3} holds when $\tau=\Id$ too. We state explicitly the particular case when $\tau=\Id$ and $j_i=0$, for all $1\leq i\leq t$, since we will use it in the proof of Theorem \ref{P1_bis}. \begin{cor} \label{tensor_2} Let $V=\bigotimes_{i=1}^t V_i$, where $V_i$ is a vector space over $\F_{p^m}$ of dimension $d_i$, for every $1\leq i\leq t$. Assume that $G$ is a subgroup of $\GL(V)$ formed by elements $\sigma_1\otimes ... \otimes \sigma_t$ acting on $v_1 \otimes v_2\otimes ... \otimes v_t\in V$ in the following way $(\sigma_1\otimes ... \otimes\sigma_t)(v_1 \otimes v_2\otimes ... \otimes v_t)= \sigma_1(v_1) \otimes ...\otimes \sigma_t(v_t)$. Consider the action of $G$ extended by linearity to the whole $V$. For a fixed $i$, let $G_i$ be the subgroup of $\GL(V_i)$ formed by the maps $\sigma_i$ (appearing in the $i$-th position) as above. Assume that $V$ is a faithful and irreducible $G$-module. If $H^1(G_i, V_i)=0$, for all $1\leq i\leq t$, then $H^1(G,V)=0$. \end{cor} \begin{rem} \label{tensor4} Note that Lemma \ref{tensor3} and Corollary \ref{tensor_2} hold as well when $G\leq \PGL(V)$, instead of $G\leq \GL(V)$. As mentioned above, when $G$ has a projective representation we are exactly in the situation described by Steinberg's Tensor Product Theorem for tensor products (see \cite{Ste}). \end{rem} \bigskip Another important step is to investigate the triviality of $H^1(G,V)$ when $G$ is one of the whole classical groups $\SL_t(p^m)$, $\Sp_{2t}(p^m)$, $\O_{2t+1}(p^m)$, $\O_{2t}^{\epsilon}(p^m)$, with $\epsilon \in \{+,-\}$ or $\Uni_t(p^m)$, for some positive integer $t$. \bigskip \begin{lem} \label{whole} Assume that $G$ is one of the groups $\SL_t(p^m)$, $\Uni_t(p^m)$, $\O_{2t}^{\epsilon}(p^m)$, with $\epsilon \in \{+,-\}$, $\O_{2t+1}(p^m)$, or $\Sp_{2t}(p^m)$, for some positive integer $t\leq n$. If $V$ is a faithful and irreducible $G$-module, then $H^1(G,V)=0$, for all $p> t+1$. \end{lem} \begin{proof} Let $p>t+1$. In particular $p\neq 2$. Observe that since $\Omega_{2t+1}(q)$ has index 2 in $\O_{2t+1}(q)$, then $$0\rightarrow H^1(C_2,V^{\Omega_{2t+1}(q)})\rightarrow H^1(\O_{2t+1},V)\rightarrow H^1(\Omega_{2t+1}(q),V)^{C_2},$$ \noindent and it suffices to prove $H^1(\Omega_{2t+1}(q),V)=0$ to deduce $H^1(\O_{2t+1},V)=0$. The same argument works for $\Omega_{2t}^{\epsilon}(q)$, that has index 2 in $\O_{2t}^{\epsilon}(q)$. So we will consider the group $\Omega_{2t+1}(q)$ (resp. $\Omega_{2t}^{\epsilon}(q)$) in the place of $\O_{2t+1}$ (resp. $\O_{2t}^{\epsilon}(q)$). Let $S$ be the quotient by scalar matrices of the classical matrix group $G$. We have $S=G/Z(G)$, where $Z(G)$ is the center of $G$. Since no scalar matrix has order dividing $p$, for every $p>2$, then the $p$-Sylow subgroup of $Z(G)$ is trivial and $H^1(Z(G),V)=0$, by Lemma \ref{Sylow}. If $Z(G)$ is nontrivial, then we are in the situation described in Corollary \ref{extension_sn_cor} and $H^1(G,V)=0$. If $Z(G)$ is trivial, then $G=S$. We will prove $H^1(S,V)=0$. It is well-known that the group $S$ is a simple group (see for instance \cite{Wil}), in particular it is a group of Lie type. We recall that in the setting of the groups of Lie type the common notations are $A_{t-1}(p^m)$ for the projective special linear group $\PSL_{t}(p^m)$, $^2A_{t-1}(p^m)$ for the projective unitary group $\PUni_{t}(p^{m})$, $C_{t}$ for the projective symplectic group $\PSp_{2t}(p^m)$, $B_t$, $D_t$ and $^2D_t$ respectively for the projective orthogonal groups $\textrm{P}\Omega_{2t+1}(q)$, $\textrm{P}\Omega_{2t}^+(q)$ and $\textrm{P}\Omega_{2t}^-(q)$ \cite[Remark 1.3.18]{Smi}, \cite[Part 1, Chap. I, \S 1]{GLS}. Then, by \cite{CPS} (see in particular Table (4.5) at page 186) and \cite{CPS2} (see in particular Table (4.3) at page 193), the cohomology group $H^1(S,V)$ is trivial, for all $p>t+1$, when $n$ is the minimal degree of the representation of $S$ in $\GL_n(q)$ and when $n$ is the dimension of the Lie algebra with automorphism group $S$ (in this case $S$ has a natural representation in dimension $n$ and this often coincides with the representation of $S$ with minimal degree). If the representation of $S$ is neither the minimal nor the natural one, then we can proceed as follows. Assume first that $S$ is not a projective symplectic group $\PSp_{2t}(p^m)$. Let $L(\lambda)$ denote the irreducible $S$-module of highest weight $\lambda$. In \cite[Theorem 1.2.3]{Georgia} the authors prove that for all $p>3$ the first cohomology group $H^1(S,L(\lambda))$ is trivial, when $\lambda$ is a fundamental dominant weight (or it is less than a fundamental dominant weight). In particular, we have $H^1(S,L(\lambda))=0$. In 1950 Chevalley proved that if $S$ acts irreducibly on the $S$-module $V$, then $V=L(\lambda)$, for some dominant weight $\lambda$ (see \cite{His} and \cite{Che}). In addition, every dominant weight is a positive integer linear combination of fundamental dominant weights, and it is well-known in the theory of Lie groups that this implies a decomposition $L(\lambda)=\otimes_{i=1}^s L(\omega_i)$, where $s$ is a positive integer ($s\leq n$) and $\omega_i$ is a fundamental weight, for every $1\leq i\leq s$. Thus $H^1(S,V)\simeq H^1(S, \otimes_{i=1}^s L(\omega_i))$, for certain fundamental weights $\omega_i$. If $S$ preserves the tensor product decomposition $\otimes_{i=1}^s L(\omega_i)$, as in the case of a group of class $\C_4$ (see \cite[\S 4.4]{KL}), then $S$ acts on $V$ as described in Lemma \ref{tensor}. More generally the group $S$ can act on $V$ as prescribed by Steingberg's Tensor Product Theorem \cite{Ste}, i.e. in the way described in Lemma \ref{tensor3} (see also Remark \ref{tensor4}). In all those cases, since Theorem 1.2.3 in \cite{Georgia} assures the triviality of $H^1(S,L(\omega_i))$, for all $1\leq i\leq s$, then $H^1(S,V)=0$ follows by the mentioned Lemma \ref{tensor3}. If $S$ is a projective symplectic group $\PSp_{2t}(p^m)$ and the representation of $S$ is neither the minimal nor the natural one, then it is not true in general that the cohomology $H^1(S,L(\lambda))$ vanishes. As above, let $L(\lambda)$ denote the irreducible $S$-module of highest weight $\lambda$ and assume $L(\lambda)=\otimes_{i=1}^s L(\omega_i)$, where $s$ is a positive integer and $\omega_i$ is a fundamental weight, for every $1\leq i\leq s$. Observe that since $L(\omega_i)$ is a vector subspace of $L(\lambda)$ over $\FF_q$, in particular $s\leq 2t$ and $i\leq 2t$. Let $t+1=b_0+b_1p+b_2p^2+ ... +b_jp^j$, where $j$ is a positive integer and $b_h\in \FF_q$, for $0\leq h\leq j$. Then \cite[Theorem 1.2.3]{Georgia} implies $H^1(S,L(\omega_i))=0$, for every $i\neq 2b_hp^h$. On the other hand, when $i= 2b_hp^h$, then $H^1(S,L(\omega_i))\neq 0$. Observe that if $p> t+1$, then $t+1=b_0$ and $2b_0=2(t+1)=2t+2>2t$. Thus $H^1(S,L(\omega_i))=0$, for every $i$, when $p>t+1$, and we may repeat the arguments used above for projective special linear groups, projective orthogonal groups and projective unitary groups to get $H^1(S,V)=0$. \end{proof} \noindent Observe that the conclusion of Lemma \ref{whole} holds in particular for $p>(2n+1)^2$. \subsection{Proof for $n\leq 3$} \label{subsec2} Since $\GL(\FF_q)=\FF_q^*$, when $n=1$ the cardinality of $G$ is not divided by $p$, then the conclusion of Theorem \ref{P1_bis} follows immediately from Lemma \ref{Sylow}. We are going to prove Theorem \ref{P1_bis} when $G$ is isomorphic to a subgroup of $\GL_n(\FF_{p^m})$, for $n\in \{2,3\}$. As above, since $H^1(G,.)$ is an additive functor, it suffices to prove the statement when $V$ is an irreducible $G$-module, to get an answer even in the case when $V$ is a direct sum of irreducible $G$-modules. Moreover, by Lemma \ref{normal} and Remark \ref{SL_n} we may assume without loss of generality that $G$ is a subgroup of $\SL_n(q)$, for $n\in \{2,3\}$. We will use the classification of the maximal subgroups of $\SL_2(q)$ and $\SL_3(q)$ appearing in \cite{BHR}. \begin{rem} \label{sharp} By the proofs of Theorem \ref{P1_bis} for $n\in \{2,3\}$ below, one can notice that the bound $p>(2n+1)^2$ is quite large for $n\leq 3$ and it suffices to take $p>2n+1$ to get the conclusion of Theorem \ref{P1_bis} in these cases. Anyway, for a general $n$, the bound $p>2n+1$ is not sufficient, in particular when $G$ is a projective unitary group in cross characteristic (see Subsection \ref{gen_case} for further details), and we need to take $p>(2n+1)^2$. In order to give a unique (and more elegant) version of Theorem \ref{P1_bis}, for all $n$, we put $c(n)=(2n+1)^2$, for every $n$. For this reason, we will consider $p>(2n+1)^2$ even for $n\leq 3$. \end{rem} Assume first that $n=2$. From \cite[Table 8.1 and Table 8.2, pag. 377]{BHR}, we deduce the following lemma. \begin{lem} \label{n=2lem} Let $q=p^m$, where $p$ is a prime number and $m$ is a positive integer. The maximal subgroups of $\SL_2(q)$ of type $\C_i$, with $2\leq i\leq 9$ are \begin{description} \item[(a)] a subgroup of type $\C_2$, the generalized quaternion group $Q_{2(q-1)}$ of order $2(q-1)$, with $q$ odd, $q\neq 5$; \item[(b)] a subgroup of type $\C_2$, the dihedral group $D_{2(q-1)}$ of order $2(q-1)$, with $q$ even; \item[(c)] a subgroup of type $\C_3$, the generalized quaternion group $Q_{2(q+1)}$, of order $2(q+1)$, for $q$ odd; \item[(d)] a subgroup of type $\C_3$, the dihedral group $D_{2(q+1)}$ of order $2(q+1)$, for $q$ even; \item[(e)] a subgroup of type $\C_5$, the group $\SL_2(q_0).C_2$, with $q=q_0^2$; \item[(f)] subgroup of type $\C_5$, the group $\SL_2(q_0)$, with $q=q_0^r$, for $q$ odd, $r$ an odd prime; \item[(g)] subgroup of type $\C_5$, the group $\SL_2(q_0)$, with $q=q_0^r$, for $q$ even, $q_0\neq 2$, $r$ prime; \item[(h)] a group of type $\C_6$, the group $2^{1+2}.S_3$, for $q=p\equiv \pm 1 \modn 8)$; \item[(i)] a group of type $\C_6$, the group $2^{1+2}\rtimes C_3$, for $q=p\equiv \pm 3, 5, \pm 11, \pm 13, \pm 19 \modn 40)$; \item[(j)] a group of type $\C_9$, the group $C_2^{\cdot}A_5$, $q=p\equiv \pm 1 \modn 10)$ or $q=p^2$, with $p\equiv \pm 3 \modn 10)$. \end{description} \end{lem} \noindent \textbf{Proof of Theorem \ref{P1_bis} for $n=2$.} Since we are assuming that $G$ acts irreducibly on $V$, then $G$ is not of class $\C_1$ and it is isomorphic to one of the subgroups of $\SL_2(p^m)$ listed in Lemma \ref{n=2lem}. Suppose that $G$ is not of class $\C_5$. Then we are not in one of the cases \textbf{(e)}, \textbf{(f)} and \textbf{(g)}. In all the other cases the $p$-Sylow subgroup of $G$ is trivial, for all $p> c(2)=25$. By Lemma \ref{Sylow}, we have $H^1(G,V)=0$. As we have stated in Remark \ref{sharp}, in this case it suffices to take $p>2n+1=5$ to get the conclusion, but we assume $p>25$ in accordance with the general statement of Theorem \ref{P1_bis}. Case \textbf{(g)} never occurs for $p\neq 2$. Suppose that we are in case \textbf{(f)}. Then $G$ is a subgroup of $\SL_2(q_0)$, where $q=q_0^2$. If $G=\SL_2(q_0)$, then $H^1(G,V)=0$, by Lemma \ref{whole}. Assume that $G$ is a proper subgroup of $\SL_2(q_0)$. If $G$ is of type $\C_i$, with $i\neq 5$, because of our assumption that $V$ is an irreducible $G$-module, then $G$ is isomorphic to one of the subgroups of the groups listed in cases \textbf{(a)}, \textbf{(b)}, \textbf{(c)}, \textbf{(d)}, \textbf{(h)}, \textbf{(i)} and \textbf{(j)}. Thus $H^1(G,V)=0$. If $G$ is still of type $C_5$, then $G$ is isomorphic to a subgroup of $\SL_2(q_1)$, where $q_0=q_1^2$. Again, if $G=\SL_2(q_1)$, then by Lemma \ref{whole}, we have $H^1(G,V)=0$. We may assume that $G$ is a proper subgroup of $\SL_2(q_1)$ and so on. Since $m$ is finite, at a certain point we will find that either $G=\SL_2(q_i)$, for some power $q_i$ of $p$, or $G$ is of type $\C_i$, with $i\neq 5$, or $G$ is trivial. In each of these cases, we have $H^1(G,V)=0$. Suppose that we are in case \textbf{(e)}. For every $p> 2$, the $p$-Sylow subgroup $G_p$ of $G$ is a subgroup of $\SL_2(q_0)$, where $q=q_0^2$. Since $G\cap \SL_2(q_0)$ is a normal subgroup of $G$, by Remark \ref{rem_normal} we may assume that $G$ is a subgroup of $\SL_2(q_0)$ and proceed as in case \textbf{(f)}. \eop \bigskip Let $n=3$. We recall the classification of the maximal subgroups of $\SL_3(q)$ and the classification of the maximal subgroups of $\SU_3(q)$ appearing in \cite[Tables 8.3-8.6, pages 378-379]{BHR}, for groups of type $\C_i$, with $i\neq 1$. \begin{lem} \label{M+B+L-cor} Let $q=p^m$, where $p$ is a prime number and $m$ is a positive integer. Let $d:=\gcd(q-1,3)$. The maximal subgroups of $\SL_3(q)$ of type $\C_i$, with $2\leq i\leq 9$ are \begin{description} \item[(a)] a group of type $\C_2$, the group $C_{q-1}^2\rtimes S_3$, for $q\geq 5$; \item[(b)] a group of type $\C_3$, the group $C_h\rtimes C_3$, where $h=q^2+q+1$; \item[(c)] a group of type $\C_5$, the group $\SL_3(q_0).C_s$, where $s:=\gcd\left(\frac{q-1}{p-1},3\right)$ and $q=q_0^r$, $r$ prime; \item[(d)] a group of type $\C_6$, the group $3_{+}^{1+2}\rtimes Q_8.C_s$, where $s=\frac{\gcd(q-1,9)}{3}$, $q=p\equiv 1 \modn 3)$ and the extraspecial group $3_{+}^{1+2}$ is the $p$-Sylow subgroup of $\GL_3(p)$; \item[(e)] a group of type $\C_8$, the group $ \SO_3(q)\times C_d$, with $q$ odd; \item[(f)] a group of type $\C_8$, the group $\SU_3(q_0)\times C_t$, where $t:=\gcd(p-1,3)$ and $q=q_0^2$; \item[(g)] a group of type $\C_9$, the group $\PSL_2(7)\times C_d$, for $q=p\equiv 1,2,4 \modn 7), q\neq 2$; \item[(h)] a group of type $\C_9$, the group $C_3^{\hspace{0.1cm} .}A_6$, of order $9\cdot 5!$, for $q=p\equiv 1,4 \modn 15)$ or $q=p^2$, with $p\equiv 2,3 \modn 5), p\neq 3$. \end{description} \end{lem} \bigskip \begin{lem} \label{SU_3} Let $q=p^m$, where $p$ is a prime number and $m$ is a positive integer. Let $d:=\gcd(q-1,3)$. The maximal subgroups of $\SU_3(q)$ of type $\C_i$, with $2\leq i\leq 9$ are \begin{description} \item[(e.1)] a group of type $\C_2$, the group $C_{q-1}^2\rtimes S_3$, for $q\geq 5$; \item[(e.2)] a group of type $\C_3$, the group $C_h\rtimes C_3$, where $h=q^2+q+1$, $q\neq 3$; \item[(e.3)] a group of type $\C_5$, the group $\SU_3(q_0).C_s$, where $s:=\gcd\left(\frac{q+1}{q+1},3\right)$ and $q=q_0^r$, $r$ prime; \item[(e.4)] a group of type $\C_8$, the group $\SO_3(q)\times C_d$, $q$ odd and $q\geq 7$; \item[(e.5)] a group of type $\C_6$, the group $3_{+}^{1+2}\rtimes Q_8.C_s$, where $s=\frac{\gcd(q+1,9)}{3}$ and the extraspecial group $3_{+}^{1+2}$ is the $p$-Sylow subgroup of $\GL_3(p)$, for $q=5$ or $q=p\equiv 2 \modn 3)$ and $q\geq 11$; \item[(e.6)] a group of type $\C_9$, the group $\PSL_2(7)\times C_d$, $q=p\equiv 3,5,6 \modn 7)$; \item[(e.7)] a group of type $\C_9$, the group $C_3^{\hspace{0.1cm} .}A_6$, for $q=p\equiv 11, 14 \modn 15)$; \item[(e.8)] a group of type $\C_9$, the group $C_3^{\hspace{0.1cm} .}A_6^{\cdot}C_2$, (where here $C_2$ is a known specific quotient of $A_6$), for $q=p=5$; \item[(e.9)] a group of type $\C_9$, the group $C_3^{\hspace{0.1cm} .}A_7$, of order $9\cdot 7\cdot 5!$, for $q=p=5$. \end{description} \end{lem} \bigskip\noindent \textbf{Proof of Theorem \ref{P1_bis} for $n=3$}. As in the case when $n=2$, we assume that $G\leq \SL_n(q)$ acts irreducibly on $V$. Then $G$ is not of class $\C_1$ and it is a subgroup of the groups listed in Lemma \ref{M+B+L-cor}. We are going to show that $H^1(G,V)=0$, for all $p> c(3)= 49$. In this case also it suffices to take $p>7$ to get the conclusion, but we consider $p>49$ in accordance with the statement of Theorem \ref{P1_bis}, holding for all $n$ (see Remark \ref{sharp}). In cases \textbf{(a)}, \textbf{(b)}, \textbf{(d)}, \textbf{(g)} and \textbf{(h)} the $p$-Sylow subgroup of $G$ is trivial, for all $p> 49$. Thus $H^1(G, V)=0$, by Lemma \ref{Sylow}. Assume that we are in case \textbf{(c)}. For every $p> c(3)$, the group $G_p$ is a subgroup of $\SL_3(q_0)$. Since $\SL_3(q_0)$ is a normal subgroup of $G$ and $V$ is an irreducible $G$-module, by Remark \ref{rem_normal}, we assume again that $G\subseteq \SL_3(q_0)$. If $G=\SL_3(q_0)$, then $H^1(G, V)=0$, by Lemma \ref{whole}. If $G$ is trivial, then $H^1(G, V)=0$ too. So, suppose that $G$ is a non-trivial proper subgroup of $\SL_3(q_0)$. If $G$ is still of type $\C_5$ in $\SL_3(q_0)$, then $G$ is contained in $\SL_3(q_1).C_{s_1}$, where $q_0=q_1^2$ and $s_1=\frac{\gcd(q_0-1,9)}{3}$. Again, we may assume that $G$ is strictly contained in $\SL_3(q_1)$ and so on. Since $q$ is finite, after a finite number of steps we find that either $G$ is of type $\C_i$, with $i\neq 5$, or $G=\SL_3(q_i)$, for a certain power $q_i$ of $p$, or $G$ is trivial. We have $H^1(G, V)=0$ in all those cases, by the arguments used for the subgroups of classes $\C_i$, with $i\neq 5$, and Lemma \ref{whole}. Assume that we are in case \textbf{(e)}. Again, for all $p$, the $p$-Sylow subgroup $G_p$ of $G$ is contained in $\SO_3(q)$. Since $V$ is an irreducible $G$-module, by Lemma \ref{normal} we may assume without loss of generality that $G$ is contained in $\SO_3(q)$. If $G=\SO_3(q)$, then $H^1(G,V)=0$, by Lemma \ref{whole}. Assume that $G$ is strictly contained in $\SO_3(q)$. The group $\SO_3(q)$ is isomorphic to $\SL_2(q)$ (see \cite[Proposition 1.10.1]{BHR}). Having proved the statement for $n=2$, then $H^1(G,V)$ vanishes. Suppose that we are in case \textbf{(f)}. As above, we assume without loss of generality that $G\leq \SU_3(q)$. If $G=\SU_3(q)$, then we get the triviality of $H^1(G,V)$, by Lemma \ref{whole}. Assume that $G$ is strictly contained in $\SU_3(q)$. Thus we use Lemma \ref{SU_3}. There are only four cases in which the subgroups of $\SU_3$ are different from the ones listed in Lemma \ref{M+B+L-cor}, i.e. cases \textbf{(e.3)}, \textbf{(e.5)}, \textbf{(e.8)} and \textbf{(e.9)}. For all $p> c(3)$, in cases \textbf{(e.5)}, \textbf{(e.8)} and \textbf{(e.9)}, the group $G_p$ is trivial. Therefore $H^1(G,V)=0$ by Lemma \ref{Sylow}. We can treat case \textbf{(e.3)} in the same way as case \textbf{(c)}. \eop \bigskip \subsection{Proof for $n\geq 4$} \label{gen_case} \bigskip To prove Theorem \ref{P1_bis} for every $n$, we use the description of the subgroups of $\GL_n(q)$ of geometric type listed in Section \ref{sec1}. For some classes of groups we also use induction, having already proved the statement for $ n\leq 3$. Moreover we use the description of the subgroups of $\GL_n(q)$ of class $\C_9$ appearing in Aschbacher's Theorem and recalled in Section \ref{sec1}. When $G_p$ is isomorphic to $C_p$, we have $H^1(G,V)\neq 0$. For this reason in various parts of the proof we need to show that $G_p$ is trivial. \bigskip\noindent\textbf{Proof of Theorem \ref{P1_bis} for $n\geq 4$.} As for $n\leq 3$, since $H^1(G,.)$ is an additive functor, then we may assume without loss of generality that $V$ is an irreducible $G$-module. In particular $G$ is not of class $\C_1$. Assume $n\geq 4$. We suppose that for every integer $n' <n$, we have $H^1(G,\FF_q^{n'})=0$, whenever $\FF_q^{n'}$ is an irreducible $G$-module and $p>(2n'+1)^2$. \vskip 0.5cm \noindent 1) \emph{The case when $G$ is of class $\C_i$, with $2\leq i\leq 8$} \bigskip Assume that $G$ is of class $\C_2$. In this case $V =\bigoplus_{i=1}^{r} V_i$, with each $V_i$ of dimension $t$ and $G=(G_1\times ... \times G_r)\wr S_r$, where $G_i$ is a subgroup of $\GL_t(q)$ acting on $V_i$ and $tr=n$. If $p>(2n+1)^2$, then in particular $p>r$ and $G_p$ is contained in $G_1\times ... \times G_r$. Let $\widetilde{G}=G\cap (G_1\times ... \times G_r)$. By Lemma \ref{extension}, it suffices that $H^1(\widetilde{G},V)=0$ to have $H^1(G,V)=0$. For $1\leq i\leq r$, the group $\widetilde{G}\cap G_i$ is a normal subgroup of $G$ acting on $V_i$. By Remark \ref{rem_normal} and the additiveness of $H^1(G,.)$ as a functor (for every fixed group $G$), we assume both that $V$ is an irreducible $\widetilde{G}$-module and that $V_i$ is an irreducible $\widetilde{G}\cap G_i$-module, for all $1\leq i\leq r$. Being $1<r< n$ (otherwise we do not have a direct sum decomposition of $V$), then $1<t<n$ too. By induction, for all $p>(2t+1)^2$, we have $H^1(\widetilde{G}\cap G_i, V_i)=0$, for every $1\leq i\leq r$. Then $H^1(\widetilde{G}, V_i)=0$, for every $1\leq i\leq r$ and, again by using the additiveness of $H^1(\widetilde{G}, .)$ as a functor, the cohomology group $H^1(\widetilde{G}, V)$ is trivial too, for every $p> \max\left\{r,(2t+1)^2\right\}$. We get $H^1(G, V)=0$, for all $p>\max\left\{r,(2t+1)^2\right\}$. In particular $H^1(G, V)=0$, for all $p>(2n+1)^2$. \par Suppose that $G$ is of type $\C_3$. In this situation the $G$-module $V$ is considered as a vector space over a field extension $\tilde{F}$ of $\FF_{q}$ with degree a prime number $r$ dividing $n$. The dimension of $V$ as a vector space over $\tilde{F}$ is $t:=n/r$ \cite[\S 5.3 and Table 2.1.A]{KL} and $G$ is isomorphic to a subgroup of $\GL_t(p^{mr}).C_r$. If $p>(2n+1)^2$, then in particular $p>r$ and $G_p$ is contained in $\GL_t(p^{mr})$. Let $\widetilde{G}=G\cap \GL_t(p^{mr})$. By Lemma \ref{extension}, if $H^1(\widetilde{G},V)=0$, then $H^1(G,V)=0$. Since $r$ is a prime number, then $t<n$ and we may use induction (recall that here $V$ is considered as a vector space of dimension $t<n$ over $\tilde{F}$ and that we may assume that $V$ is an irreducible $\widetilde{G}$-module by Lemma \ref{normal} and Remark \ref{rem_normal}) to have $H^1(\widetilde{G},V)=0$, for all $p>(2t+1)^2$. Therefore $H^1(G,V)=0$, for every $p> (2n+1)^2$. \par Suppose that $G$ is of type $\C_4$. Then $G$ is isomorphic to a subgroup of a central product $\GL_t(p^m)\circ \GL_r(p^m)$ acting on a tensor product $V_1\otimes V_2=V$, where $rt=n$ and $V_1$, $V_2$ are vector spaces over $\F_{q}$, with dimension respectively $t$ and $r$. We are in the situation described in Lemma \ref{tensor}. Thus let $G=G_t\circ G_r$, with $G_t$ acting on $V_1$ and $G_r$ acting on $V_2$ (see also \cite[\S 4.4]{KL}). Since $r<n$, by Lemma \ref{normal}, Remark \ref{rem_normal} and by induction we have $H^{1}(G_r,V_1)=0$, for every $p\geq (2r+1)^2$. In the same way, since $t<n$, then by induction, for all $p>(2t+1)^2$, we have $H^1(G_t,V_2)=0$. Thus $H^1(G_1,V_1)=0$ and $H^1(G_2,V_2)=0$, for every $p> \max\{(2r+1)^2,(2t+1)^2\}$. Therefore $H^1(G,V)=0$ for every $p>(2n+1)^2$, by Lemma \ref{tensor}. \par If $G$ is of class $\C_5$, then $G$ is isomorphic to a subgroup of $\GL_n(p^t)$, where $m=tr$, with $t$ a positive integer and $r$ a prime. If $G$ is the whole group $\GL_n(p^t)$, then by Remark \ref{SL_n} and by Lemma \ref{whole}, we have $H^1(G,V)=0$. If $G$ is trivial, then $H^1(G,V)$ is trivial too. Suppose that $G$ is a proper non-trivial subgroup of $\GL_n(p^t)$. If $G$ is still contained in a maximal subgroup of $\GL_n(p^t)$ of class $\C_5$, then $G$ is isomorphic to a subgroup of $\GL_n(p^{t_2})$, for some positive integer $t_2$, such that $t=r_2t_2$, with $r_2$ prime. If $G=\GL_n(p^{t_2})$, we have again $H^1(G,V)=0$, by Remark \ref{SL_n} and Lemma \ref{whole}. Then we may assume that $G$ is a proper subgroup of $\GL_n(p^{t_2})$ and so on. Since $m$ is finite and we are assuming that $G$ is not trivial, then for some positive integer $t_j$ dividing $m$, either $G=\GL_n(p^{t_j})$ or $G$ is isomorphic to a subgroup of $\GL_n(p^{t_j})$ of class $\C_i$, with $i\neq 5$. We may then repeat the arguments used (or that we will use) for other classes $\C_i$, with $i\notin \{1, 5\}$, to get $H^{1}(G,V)=0$. \par Suppose that $G$ is of class $\C_6$, i.e. $G$ lies in the normalizer of an extraspecial group. This may happen only when $n=r^t$, with $r$ a prime different from $p$ and $t$ a positive integer. We have that $G$ is a subgroup of $(C_{q-1}\circ r^{1+2t}).\Sp_{2t}(r)$ \cite[\S 3.5]{KL}. Let $H=C_{q-1}\circ r^{1+2t}$ and $\widetilde{G}:=G\cap H$. Owing to $p\neq r$, the $p$-Sylow subgroup of $\widetilde{G}$ is trivial. Then $G_p$ is isomorphic to the $p$-Sylow subgroup of $G/\widetilde{G}$ that is isomorphic to a subgroup of $\Sp_{2t}(r)$. Since $p\neq r$, then $p$ divides the cardinality $|\Sp_{2t}(r)|$ if and only if $p$ divides $\prod_{i=1}^{t}(r^{2i}-1)=(r-1)(r+1)...(r^{t-1}-1)(r^{t-1}+1)(r^{t}-1)(r^{t}+1)$. If $p>(2n+1)^2$, then $p$ divides no factor in this product. Consequently $G_p$ is trivial and $H^1(G, V)=0$. \par Suppose that $G$ is of class $\C_7$. This case occur only when $n=r^t$, where $r$ is a prime and $t>1$. The group $G$ is the stabilizer of a tensor product decomposition $\bigotimes_{i=1}^{t}V_i$, with $n=r^t$, $t\geq 2$ and $\textrm{dim}(V_i)=r$, for every $1\leq i\leq t$. Thus $G$ is a subgroup of $\underbrace{ (\GL_r(q)\circ ... \circ \GL_r(q)) }_{t}.S_t $. The situation is similar to the one described in Lemma \ref{tensor3}, but here we can have more than one permutation of the $V_i's$. Obviously $r<n$ and $t<n$, being $t=\log_r(n)$. Then if we take $p>(2n+1)^2$, we in particular have that $p>t$ and $G_p$ is contained in $\widetilde{G}=G\cap \underbrace{ (\GL_r(q)\circ ... \circ \GL_r(q)) }_{t}$. Observe that $\widetilde{G}=G_1\circ ... \circ G_t$, where $G_i\leq \GL_r(t)$ is a normal subgroup of $G$, acting on $V_i$, for every $1\leq i\leq t$. Thus $\widetilde{G}$ acts on $V$ as described in Corollary \ref{tensor_2}. Since $G_i$ acts on $V_i$, then we use Remark \ref{rem_normal} and induction on $r$ to get $H^1(G_i,V)=0$, for all $p>(2r+1)^2$, for every $1\leq i\leq t$. By Corollary \ref{tensor_2}, the group $H^1(\widetilde{G},V)$ is trivial, for all $p> \max\{t,(2r+1)^2\}$. Then $H^1(G,V)=0$, for every $p>(2n+1)^2$. \par Suppose that $G$ is of class $\C_8$. If $n$ is even, then $G$ is contained either in the group $\Sp_n(p^m)$, or in a group $\textrm{O}_n^{\epsilon}(p^m)$, for some $\epsilon\in\{+,-\}$, or in the group $\Uni_n(p^{\frac{m}{2}})$, with $m$ even too. If $n$ is odd, then $G$ is contained either in $\textrm{O}_n(p^m)$, or in $\Uni_n(p^{\frac{m}{2}})$ (with $m$ even). Observe that for symplectic groups $\Sp_n(p^m)$, we have $n=2t$, for some positive integer $t$ and then $(2n+1)^2=(4t+1)^2$. If $G$ is one of the whole mentioned classical groups, then we may apply Lemma \ref{whole} to get $H^1(G,V)=0$. Assume that $G$ is strictly contained in one of those classical groups. Aschbacher's theorem holds for unitary, symplectic and orthogonal groups too and the maximal subgroups of those classical groups are still divided in the same 9 classes (see \cite{KL}). From the classification of the maximal subgroups of $\Sp_n(p^m)$, $\textrm{O}_n(p^m)$, $\textrm{O}_n^{\epsilon}(p^m)$ and $U_n(p^{\frac{m}{2}})$ of class $\C_i$, with $i\neq 9$, appearing in \cite[Table 3.5B, Table 3.5C, Table 3.5D and Table 3.5E]{KL}, we have that $\textrm{O}_n(p^m)$, $\textrm{O}_n^{\epsilon}(p^m)$ and $U_n(p^{\frac{m}{2}})$ do not contain groups of class $\C_8$ and that the maximal subgroups of $\Sp_n(p^m)$ of class $\C_8$ are $\textrm{O}_n^{\epsilon}(p^m)$ themselves. Since we are assuming that $G$ is strictly contained in one of those three groups, then it is a subgroup of class $\C_i$, for some $i\neq 8$. By repeating the arguments used for the maximal subgroups of $\SL_n(q)$ of class $\C_i$, with $i\neq 8$, for the maximal subgroups of symplectic, orthogonal and unitary groups, we get the conclusion (see below the part of the proof concerning the subgroups of class $\C_9$). \bigskip \noindent 2) \emph{The case when $G$ is of class $\C_9$ and the case of simple groups} \bigskip \par Suppose that $G$ is of class $\C_9$ and let $Z(G)$ be its center. By the description of the subgroups of class $C_9$, recalled in Section \ref{sec1}, the group $G/Z(G)$ is almost simple. Assume that the $p$-Sylow subgroup $Z(G)_p$ of $Z(G)$ is nontrivial. One of the $p$-Sylow subgroups of $\GL_n(p^m)$ is the subgroup ${\mathfrak{U}}$ of the upper triangular matrices, with all the entries in the principal diagonal equal to 1. Let $\tau_1\in Z(G)_p$. Since all the $p$-Sylow subgroups are conjugate, then there exists $\omega\in \GL_n(p^m)$ and $\tau_2\in {\mathfrak{U}}$ such that $\omega\tau_2\omega^{-1}=\tau_1$. Therefore $\omega^{-1}\tau_1\omega=\tau_2$, implying $\tau_1=\tau_2$, owing to $\tau_1\in Z(G)$. Then $\tau_1$ is in upper triangular form too, with all the entries in the principal diagonal equal to 1. The only eigenvalue of $\tau_1$ is 1. Let $V_1$ be the eigenspace of $M_1$ for the eigenvalue 1. For every $v\in V_1$, we have $\tau_1(v)=v$. Furthermore, for all $\sigma\in G$, since $\tau_1$ commutes with $\sigma$, we have $\tau_1 \sigma(v)=\sigma \tau_1(v)=\sigma(v)$. Then $\sigma(v)\in V_1$, for all $v\in V_1$, $\sigma\in G$. The subspace $V_1$ of $V$ is stable under the action of $G$. Since $V$ is an irreducible $G$-module and $V_1\neq \{0\}$, then $V_1=V$ and $\tau_1=\I_n$. This implies that $Z(G)_p=\langle \I_n\rangle$ and then $H^1(Z(G),V)=0$. From the inflaction-restriction exact sequence $$0\rightarrow H^1(G/Z(G),V)\rightarrow H^1(G,V)\rightarrow H^1(Z(G),V)^{G/Z(G)},$$ \noindent we deduce that $H^1(G/Z(G),V)\simeq H^1(G,V)$. Then, without loss of generality, we may assume that $Z(G)$ is trivial and $G$ is almost simple. Thus $G$ contains a normal simple group $S$ and it is contained in the automorphism group of $S$ (see \cite[\S 1.1]{KL}) \begin{equation} \label{almost_simple} S\unlhd G\leq \Aut(S). \end{equation} Being $G$ a subgroup of $\GL_n(p^m)$, then $S$ is a subgroup of $\GL_n(p^m)$ too. So we will consider the possible simple groups $S$ contained in $\GL_n(p^m)$. Since $S\unlhd G$, by Lemma \ref{normal} and Remark \ref{rem_normal} we may assume that $V$ is an irreducible $S$-module and by Lemma \ref{extension_sn} it suffices to prove $H^1(S,V)=0$. In many cases the conclusion will follow also by Lemma \ref{Sylow}, since the $p$-Sylow subgroup of $G$ coincides with the $p$-Sylow subgroup of $S$, as for instance when $S$ is an alternating group or a sporadic group and $p>2$. Observe that $S$ is not a cyclic group by \eqref{almost_simple}. \par Assume that $S$ is an alternating group $A_N$, for some positive integer $N$. If $N\leq 4$, then $p\nmid |A_N|$, for all $p\geq c(n)$, for every $n$. In this case $G_p$ is trivial, implying $H^1(G,V)=0$. By \cite[Proposition 5.3.7 (i)]{KL}, we have that the minimal degree for a representation of $A_N$ in $\GL_n(p^m)$, for $N\geq 9$, is $N-2$, i.e. $n\geq N-2$. For $5\leq N\leq 8$, the minimal degree for a representation of $A_N$ in $\GL_n(p^m)$ is instead $N-4$, i.e. $n\geq N-4$. In particular the bound $n\geq N-4$ works for all $N\geq 5$. Then $N\leq n+4$. Since $|A_{n+4}|=\ddfrac{(n+4)!}{2}$, if $p>(2n+1)^2$, then $p\nmid |A_{n+4}|$, for all $n\geq 2$. Therefore $p$ does not divide the cardinality of every possible subgroup of $\GL_n(p^m)$ of type $C_9$ isomorphic to $A_N$, for every positive integer $N$. We have $H^1(S,V)=0$ and $H^1(G,V)=0$, for all $p>(2n+1)^2$. \par Assume that $S$ is a sporadic group. Then $p=71$ is the greatest prime number such that $p$ could eventually divide its cardinality (this is the case of the Monster group). If $n\geq 4$, then $c(n)\geq 81$. Consequently $H^1(S,V)=0$, for all $p> c(n)$, and $H^1(G,V)=0$. \par Now assume that $S$ is neither alternating, nor sporadic. Then $S$ is a group of Lie type. \par \vskip 1cm \noindent 2.1) \emph{Groups of Lie type in cross characteristic} \bigskip \par Assume that $S$ is a group of Lie type in characteristic ${\mathfrak{p}}\neq p$ and let $w={\mathfrak{p}}^{\alpha}$, where $\alpha$ is a positive integer. \par Suppose first that $S=\PUni_t(w)$, for some $2\leq t\leq n$ and $r\neq p$. By Table 1 in Section \ref{sec1}, the minimal degree for the representation of $S$ in $\SL_n(q)$ is $w\ddfrac{w^{t-1}-1}{w+1}$, when $n$ is odd and $\ddfrac{w^{t}-1}{w+1}$, when $n$ is even. Suppose that $n$ is odd. Then $n\geq \ddfrac{w^{t}-w}{w+1}$. We have $n(w+1)\geq w^t-w$, i.e. $(n+1)w+n\geq w^t$, implying $w^t\leq nw+w+n<(2n+1)w$ (recall that $w\geq 2$). Therefore $w^{t-1}< 2n+1$ and $w< (2n+1)^{\frac{1}{t-1}}$. If a prime $p\neq {\mathfrak{p}}$ does not divide $\prod_{i=2}^{t}(w^i-(-1)^i)$, then it does not divides the cardinality of $S=\PUni_t(w)$ (see for instance \cite[Theorem 1.6.22]{BHR}). If $w< (2n+1)^{\frac{1}{t-1}}$, then $w^t+1< (2n+1)^{\frac{t}{t-1}}+1$. Observe that for all $t\geq 2$, we have $\ddfrac{t}{t-1}\leq 2$. Thus $w^t+1< (2n+1)^{\frac{t}{t-1}}+1\leq (2n+1)^2+1$. If $p>(2n+1)^2$, then $p\geq (2n+1)^2+1>w^t+1$ and $p$ does not divide the cardinality of $\PUni_t(w)$. We have that the $p$-Sylow subgroup of $G$ is trivial for all $p>(2n+1)^2$, implying $H^1(G,V)=0$ by Lemma \ref{Sylow}. The situation is very similar when $n$ is even and $n\geq \ddfrac{w^{t}-1}{w+1}$. We get $w^t\leq n(w+1)+1< (2n+1)w$, implying $w^{t-1}< 2n+1$ and $w< (2n+1)^{\frac{1}{t-1}}$. Then $w^t+1< (2n+1)^{\frac{t}{t-1}}+1\leq (2n+1)^2+1$. Again, if $p> (2n+1)^2$, then $p>w^t+1$ and $p$ does not divide the cardinality of $\PUni_t(w)$. Therefore $G_p$ is trivial for all $p>(2n+1)^2$, implying $H^1(G,V)=0$. \par If $S$ is isomorphic to $\PSL_2(w)$, by Table 1 in Section \ref{sec1}, the minimal degree for the representation of $S$ in $\SL_n(q)$ is $\ddfrac{w-1}{2}$. Then $n\geq \ddfrac{w-1}{2}$. Being $r\neq p$, if a prime $p$ does not divide $(w+1)(w-1)$, then $p$ does not divide the cardinality of $\PSL_2(w)$. By $n\geq \ddfrac{w-1}{2}$, we have $p>(2n+1)^2\geq w^{2}> w+1$. Then the $p$-Sylow subgroup of $S$ is trivial for all $p>(2n+1)^2$, implying $H^1(S,V)=0$ and $H^1(G,V)=0$. \par Suppose $S=\PSL_t(w)$, for some integer $3\leq t\leq n$. According to Table 1, in this case the bound for $n$ is $n\geq w^{t-1}-1$. As above, since $p\neq r$, if $p\nmid \prod_{i=2}^{t}(w^i-1)$, then $p$ does not divide the cardinality of $\PSL_t(w)$. Let $p>(2n+1)^2$. By $n\geq w^{t-1}-1$, we have $p>(2n+1)^2\geq (2(w^{t-1}-1)+1)^2= (2w^{t-1}-1)^2>w^t-1$. Therefore $p$ does not divide the cardinality of $ \PSL_t(w)$ and the $p$-Sylow subgroup of $S$ is trivial, implying $H^1(S,V)=0$ and $H^1(G,V)=0$. \par Suppose $S=\PSp_{2t}(w)$. The minimal degree for the representation of $S$ in a special linear group $\SL_n(q)$ is $\ddfrac{1}{2}(w^{t}-1)$. Then $n\geq \ddfrac{1}{2}(w^{ t}-1)$ and $(2n+1)^2=w^{2t}$. If $p$ does not divide $\prod_{i=1}^t (w^{2 i}-1)=\prod_{i=1}^t (w^{i}-1)(w^i+1)$, then $p$ does not divide the cardinality of $\PSp_{2t}(w)$ and $H^1(G,V)=0$. If $p>(2n+1)^2$, then $p>w^{2t}>w^t+1$. Then the $p$-Sylow subgroup of $S$ is trivial, for all $p>(2n+1)^2$, implying $H^1(S,V)=0$ and $H^1(G,V)=0$. \par Suppose $S=\textrm{P}\Omega_{2t}^{+}(w)$. From the formula of the cardinality of $S$ (see \cite[Theorem 1.6.22]{BHR} and Notation \ref{not_1} in Section \ref{sec1}), in this case it suffices that $p>w^{\frac{t}{2}}-1$ to have that the $p$-Sylow subgroup of $S$ (and consequently the one of $G$) is trivial. If $w\neq 5$, then $n\geq (w^{t-1}-1)(w^{t-2}+1)$ and $p>(2n+1)^2\geq (2(w^{t-1}-1)(w^{t-2}+1)+1)^2>w^{\frac{t}{2}}-1$. If $w=5$, then $n\geq 5^{t-2}(5^{t-1}-1)$. We have $p>(2n+1)^2\geq (2\cdot 5^{t-2}(5^{t-1}-1)+1)^2> 5^{\frac{t}{2}}-1$. Then $H^1(G,V)=0$ for all $w$, when $p>(2n+1)^2$. \par Suppose $S=\textrm{P}\Omega_{2t}^{-}(w)$. Similarly to the previous case, it suffices that $p>w^{\frac{t}{2}}+1$ to have that the $p$-Sylow subgroup of $S$ (and consequently the one of $G$) is trivial. According to Table 1 the minimal $n$ for a representation of $S$ in $\SL_n(q)$ is $(w^{t-1}+1)(w^{t-2}-1)$. Since $p>(2n+1)^2\geq (2(w^{t-1}+1)(w^{t-2}-1)+1)^2>w^{\frac{t}{2}}+1$, then $H^1(G,V)=0$, for all $p>(2n+1)^2$. \par Let $S=\Omega_{2t+1}(w)$. In this case it suffices that $p>w^{t-1}-1$ to have that the $p$-Sylow subgroup of $G$ is trivial. If $w\neq 5$, then the minimal degree for the representation of $S$ in $\GL_n(q)$ is $n\geq w^{2(t-1)}-1$. Therefore $p>(2n+1)^2\geq 4w^{4(t-1)}>w^{t-1}-1$. If $w=5$, then $p>(2n+1)^2\geq (2\cdot 5^{t-1}(5^{t-1}-1)+1)^2\geq 5^{t-1}-1$. As above the conclusion follows by Lemma \ref{Sylow}. \par We are left with the exceptional groups of Lie type in cross characteristic. As already stated in Section \ref{sec1}, for a reference about the description of the structures and the cardinalities of those groups the reader can see \cite{Wil} (see also \cite{Hum}). Assume that $S$ is the exceptional group $E_8(w)$. In this case the lower bound for the dimension of the representation is $n\geq w^{27}(w^2-1)$. A prime $p\neq r$ divides the cardinality of $E_8(w)$ if and only if it divides the product $\prod_{i=0}^{3}(w^{6i+2}-1)\prod_{i=2}^{5}(w^{6i}-1)$ \cite[Equation 4.146, pag. 176]{Wil}. The greatest factor in this product is $w^{30}-1$. Let $p>(2n+1)^2$. Then $p> (2w^{27}(w^2-1)+1)^2$. We consider the function $f(w):=(2w^{27}(w^2-1)+1)^2-(w^{30}-1)=4w^{54}-w^{30}+ 4w^{27}+ 2$. Obviously $f(w)> 0$, for all $w$. Therefore $p\nmid |E_8(w)|$, for all $p>(2n+1)^2$. Again the $p$-Sylow subgroups of $S$ is trivial, for every $p>(2n+1)^2$ and $H^1(S,V)=0$. Thus $H^1(G,V)=0$ too. \par Assume that $S$ is the exceptional group $E_7(w)$. Then \begin{equation} \label{E7} |E_7(w)|=\ddfrac{1}{2}w^{63}(w^{18}-1)(w^{14}-1)(w^{12}-1)(w^{10}-1)(w^{8}-1)(w^{6}-1)(w^{2}-1) \end{equation} \noindent for $w$ odd and the double of the cardinality in equation \eqref{E7} for $w$ even \cite[\S 4.12.3, pag. 177]{Wil}. The lower bound for the dimension of the representation is $n\geq w^{15}(w^2-1)$. In this case if $p> w^{18}-1$, then $p$ does not divide the cardinality of $E_7(q)$ and this holds for all $p>(2n+1)^2\geq (2w^{15}(w^2-1)+1)^2$. \par Let $S$ be one of the groups $E_6(w)$ or $^2E_6(w)$. The lower bound for the dimension of the representation is $n\geq w^{9}(w^2-1)$. Similarly to the previous cases, if $p> w^{12}-1$, then $p$ does not divide the cardinality of $S$ and this holds for all $p>(2n+1)^2\geq (2w^{9}(w^2-1)+1)^2> w^{12}+1$. \par Let $S=F_4(w)$. In this case the lower bound for the dimension of the representation is $n\geq w^6(w^2-1)$. Since $|F_4(w)|=w^{24}(w^{12}-1)(q^8-1)(q^6-1)(q^2-1)$, then the $p$-Sylow subgroup of $S$ is trivial, for all $p>(2n+1)^2\geq (2w^6(w^2-1)+1)^2$. Therefore $H^1(S,V)=0$ and $H^1(G,V)=0$. \par Let $S=$$^2F_4(w)$. Thus $n\geq w^{4} \sqrt{\ddfrac{w}{2}}(w-1)$, in accordance to Table 1. Being $|^2F_4(w)|=w^{12}(w^{6}+1)(q^4-1)(q^3+1)(q^2-1)$, then the $p$-Sylow subgroup of $S$ is trivial, for all $p>(2n+1)^2\geq \left(2w^{4} \sqrt{\ddfrac{w}{2}}(w-1)+1\right)^2>w^6+1$. In this case too we have $H^1(G,V)=0$. \par Assume $S=G_2(w)$. The lower bound for the dimension of the representation is $n\geq w(w^2-1)$. Since $|G_2(w)|=w^6(w^6-1)(w^2-1)$, then the $p$-Sylow subgroup of $S$ is trivial, for all $p>(2n+1)^2\geq (2w(w^2-1)+1)^2>w^6-1$. Therefore $H^1(G,V)=0$. \par Assume $S=$$^2G_2(w)$. This case is similar to the one of $G_2(q)$. The lower bound for the dimension of the representation is $n\geq w(w-1)$ and $|G_2(w)|=w^3(w^3+1)(w-1)$. If $p>(2n+1)^2\geq (2w(w-1)+1)^2>w^3+1$, then $H^1(G,V)=0$ as above. \par Suppose $S=$$^3D_4(w)$. Therefore $|^3D_4(w)|=w^{12}(w^8+w^4+1)(w^6-1)(w^2-1)$ and $n\geq w^3(w^2-1)$. We deduce $H^1(G,V)=0$, for all $p>(2n+1)^2\geq (2w^3(w^2-1)+1)^2>w^8+w^4+1$. \par The last possibility is $S=\textrm{Suz}(w)$. The Suzuki group over $\FF_w$ has order $w^{2}(w^2+1)(w^2-1)$ and the minimal $n$ to have a representation of its in $\SL_n(q)$ is $\sqrt{\ddfrac{w}{2}}(w-1)$. Then $H^1(G,V)=0$, for all $p>(2n+1)^2\geq \left(2\sqrt{\ddfrac{w}{2}}(w-1)+1\right)^2>w^2+1$. \par \bigskip \noindent 2.2) \emph{Groups of Lie type in defining characteristic} \bigskip \noindent Assume that the characteristic of the field of definition of $S$ is $p$. We have that $S$ is a classical group of Lie type (i.e. $S$ is a projective classic matrix group), with dimension $t< n$ (where $t=2h$, for some positive integer $h$, when $S=\PSp_t(q)$ is a projective symplectic group or $S$ is a projective orthogonal group of type $+$ or $-$), or $S$ is an exceptional group of Lie type (see \cite[Table 5.4.C, pag. 200]{KL}). If $S$ is a classical group of Lie type of dimension $t< n$, we have already showed in the proof of Lemma \ref{whole} that $H^1(S,V)=0$, for all $p>(2n+1)^2$. Assume that $S$ is an exceptional group of Lie type. By \cite{CPS} (see in particular Table (4.5) at page 186) and \cite{CPS2} (see in particular Table (4.3) at page 193), the cohomology group $H^1(S,V)$ is trivial, for all $p>3$, when $n$ is the possible minimal degree of the representation of $S$ and when $n$ is the dimension of the Lie algebra with automorphism group $S$ (in this case $S$ has a natural representation in dimension $n$ and this often coincides with the representation of $S$ with minimal degree). If the representation of $S$ is neither the minimal nor the natural one, then we can proceed as in the proof of Lemma \ref{whole}. We first consider the groups $S$ that are not twisted. Let $L(\lambda)$ denote the irreducible $G$-module of highest weight $\lambda$. In \cite[Theorem 1.2.3]{Georgia} the authors prove that the first cohomology group $H^1(S,L(\lambda))$ is trivial, for all $p>3$, when $S$ is one of the groups $E_6(q)$, $^2E_6(q)$, $^3D_4(q)$, $G_2(q)$, $^2G_2(q)$, $^2F_4(q)$, $\textrm{Suz}(q)$ and $\lambda$ is a fundamental dominant weight (or it is less than a fundamental dominant weight). In \cite[Theorem 1.2.3]{Georgia} the authors also prove that $H^1(S,L(\lambda))$ is trivial, for all $p\neq 31$, when $S=E_8(q)$ and $\lambda$ is a fundamental dominant weight (or it is less than a fundamental dominant weight). If $p>(2n+1)^2$ with $p= 31$, then $n\leq (\sqrt{p}-1)/2< 3$. Since the minimal degree for the representation of $E_8(q)$ is $248$ (see \cite[Table 5.4.C, pag. 200]{KL}), then $H^1(S,L(\lambda))$ is trivial, for all $p>(2n+1)^2$. If $S$ is the group $E_7(q)$, then $H^1(S,L(\lambda))=0$, for all $p\neq 19$ \cite[Theorem 1.2.3]{Georgia}. By (see \cite[Table 5.4.C, pag. 200]{KL}), the minimal degree for the representation of $E_7(q)$ is $56$. If $p>(2n+1)^2$ with $p= 19$, then $n\leq (\sqrt{p}-1)/2<2<56$ and $H^1(S,L(\lambda))$ is trivial. In a similar way the same theorem assures $H^1(S,L(\lambda))=0$, for $S=F_4(q)$ and $p>13$. If $p>(2n+1)^2$ with $p\leq 13$, then $n\leq (\sqrt{p}-1)/2<2$. In this case too the minimal degree for the representation greater than 2 and then $H^1(S,L(\lambda))$ is trivial. As mentioned above since we are assuming that $V$ is irreducible, then $V=L(\lambda)$, for some dominant weight $\lambda$ (see \cite{His} and \cite{Che}). Again we have a decomposition $L(\lambda)=\otimes_{i=1}^s L(\omega_i)$, where $s$ is a positive integer and $\omega_i$ is a fundamental weight, for every $1\leq i\leq s$. Thus $H^1(S,V)\simeq H^1(S, \otimes_{i=1}^s L(\omega_i))$, for certain fundamental weights $\omega_i$ and the group $S$ acts on a tensor product decomposition. In particular $S$ acts on $V$ in the same way as the subgroups of class $\C_4$ (see \cite[\S 4.4]{KL}) or more generally the group $S$ acts on $V$ as prescribed by Steingberg's Tensor Product Theorem (see \cite{Ste}). The same situation happened in a part of the proof of Lemma \ref{whole}. Since the mentioned Theorem 1.2.3 in \cite{Georgia} shows the triviality of $H^1(S,L(\omega_i))$, for all $1\leq i\leq s$, by applying Lemma \ref{tensor3} (and Remark \ref{tensor4}), one deduces the triviality of $H^1(S,V)$. We have to prove the same conclusion for twisted groups of Lie type. If we assume that $p>3$, then we have neither Suzuki groups nor Ree groups in the defining characteristic (see \cite{Wil} for further details). We are left with groups $^2E_6(q)$ and $^3D_4(q)$. The group $^2E_6(q)$ is a subgroup of $E_6(q^2)$ modulo scalars (see \cite[4.11]{Wil}). We may apply Shapiro's Lemma (see for instance \cite[Theorem 4.19]{Neu} or \cite[Lemma 6.3.2 and Lemma 6.3.4]{Wei}) to get $$H^1\left(E_6(q^2),\textrm{Ind}_{^2E_6(q)}^{E_6(q^2)}V\right)\simeq H^1(^2E_6(q), V),$$ \noindent with $\textrm{Ind}_{^2E_6(q)}^{E_6(q^2)}$ denoting the induced $G$-module $\bigoplus_{i=1}^s \sigma_i(V)$, where $s:=[E_6(q^2):^2E_6(q)]$ is the index of $^2E_6(q)$ in $E_6(q^2)$ (see \cite[Definition 4.18]{Neu}), $\sigma_i$ varies in a system of left coset representatives of $H$ in $G$ and $\sigma_i(V)$ is isomorphic to $V$, for every $1\leq i\leq s$. Being $H^1(G,-)$ and additive functor for every group $G$, we get $$\bigoplus_{i=1}^s H^1(E_6(q^2) , \sigma_i(V))\simeq H^1(^2E_6(q), V).$$ \noindent We have already proved that $H^1(E_6(q^2), V)=0$, under the assumption that $V$ is irreducible. Therefore $H^1(E_6(q^2) , \sigma_i(V))=0$, for all $1\leq i\leq s$, and $H^1(^2E_6(q), V)=0$. The group $^3D_4(q)$ is a subgroup of $\Omega_8^+(q^3)$. The cited results in \cite{CPS} and in \cite{Georgia} hold for $\Omega_8^+(q^3)$. Then we may apply all the arguments as above to get $H^1( \Omega_8^+(q^3), V)=0$. \par We can conclude, that for all $n\geq 2$, when $p>(2n+1)^2$ the first cohomology group $H^1(G,\FF_q^n)$ is trivial. \eop \section{An application to a question posed by Cassels} \label{last} We keep the notation adopted in Section \ref{sec0}, with $\A$ being an abelian variety defined over a number field $k$ and $\A^{\vee}$ its dual abelian variety. We denote by $\A[p^m]$ the $p^m$-torsion subgroup of $\A$ and by $\A[p^m]^{\vee}$ its Cartier dual. Then $\A[p^m]^{\vee}=\textrm{Hom}(\A[p^m],k_s^*)$, where $k_s$ is the separable closure of $k$ (see for instance \cite[Definition 3.3]{CHR}). An element $\sigma\in \Sha(k,\A)$ is infinitely divisible by a prime $p$, when it is divisible by $p^m$, for all positive integers $m$. In this case, for every $m$, there exists $\tau_m\in H^1(G_k,\A)$ such that $\sigma=p^m \tau_m$. In \cite[Theorem 3]{Cre2} Creutz shows that $\Sha(k,\A)\subseteq p^mH^1(G_k,\A)$ if and only if the image of the natural map $\Sha(k,\A[p^m]^{\vee})\rightarrow \Sha(k,\A^{\vee})$ is contained in the maximal divisible subgroup of $\Sha(k,\A^{\vee})$. In particular the triviality of $\Sha(k,\A[p^m]^{\vee})$, for all $m\geq 1$, is a sufficient condition to have an affirmative answer to Cassels' question for $p$ in $\A$ over $k$. This is also directly proved in \cite[Proposition 13]{CS}. If $\A$ has a principal polarization, then $\A[p^m]$ and $\A[p^m]^{\vee}$ are isomorphic. Therefore the triviality of $\Sha(k,\A[p^m])$, for all $m\geq 1$, implies an affirmative answer to Cassels' question in principally polarized abelian varieties. Let $k(\A[p])$ denote the $p$-th division field of $\A$, i.e. the number field generated over $k$ by the coordinates of the points in $\A[p]$. In \cite{CS} \c{C}iperiani and Stix prove the following statement. \begin{thm}[\c{C}iperiani, Stix, 2015] \label{CS} Assume that \begin{description} \item[1)] $H^1(\Gal(k(\A[p])/k),\A[p])=0$ and \item[2)] the $G_k$-modules $\A[p]$ and $\textrm{End}(\A[p])$ have no common irreducible subquotient. \end{description} \noindent Then $$\hspace{0.5cm} \Sha(k,\A[p^m])=0, \textrm{ for every } m\geq 1.$$ \end{thm} \noindent In particular \textbf{1)} and \textbf{2)} in Theorem \ref{CS} are sufficient conditions to have an affirmative answer to Cassels' question in principally polarized abelian varieties. By Theorem \ref{P1_bis} we can give the following criterium. \begin{thm} \label{thm_cass} Let $\A$ be an abelian variety of dimension $g$ defined over a number field $k$. For all $p>(4g+1)^2$, if $\A[p]$ is an irreducible $G_k$-module, then $$\hspace{0.5cm} \Sha(k,\A[p^m])=0, \textrm{ for every } m\geq 1.$$ \end{thm} \begin{proof} It is well-known that if $\A$ has dimension $g$, then $\A[p]\simeq (\ZZ/p\ZZ)^{2g}\simeq \FF_p^{2g}$ (see for instance \cite[Chap. II, pag. 61]{Mum}). Then the group $G_k$ has a natural representation in $\GL_{2g}(p)$, whose image is isomorphic to $\Gal(k(\A[p])/k)$. Observe that the action of $\Gal(k(\A[p])/k)$ over $\A[p]$ is faithful. Then by Theorem \ref{P1_bis}, if $\A[p]$ is an irreducible $G_k$-module and $p>(4g+1)^2$, then $H^1(\Gal(k(\A[p])/k,\A[p])=0$, and \textbf{1)} in Theorem \ref{CS} is satisfied. In addition, if $\A[p]$ is an irreducible $G_k$-module, then it has no nontrivial $G_k$-submodules as well as no nontrivial $G_k$-subquotients. In particular $\A[p]$ and $\textrm{End}(\A[p])$ have no common irreducible subquotient and \textbf{2)} is satisfied too. Thus, by Theorem \ref{P1_bis} and Theorem \ref{CS}, if $\A[p]$ is an irreducible $G_k$-module and $p>(4g+1)^2$, then $\Sha(k,\A[p^m])=0$, for all $m\geq 1.$ \end{proof} \noindent From Theorem \ref{thm_cass} we can deduce Theorem \ref{thm_cass}, which gives sufficient conditions to have an affirmative answer to Cassels question in all abelian varieties $\A$ over $k$. \bigskip \noindent \textbf{Proof of Theorem \ref{cor_cass}} The conclusion follows from Theorem \ref{thm_cass} and the fact that the group scheme $\A[p]$ is an irreducible $G_k$-module if and only if $\A[p]^{\vee}$ is an irreducible $G_k$-module. Actually assume that $\A[p]^{\vee}$ is an irreducible $G_k$-module and that $\A[p]$ has a nontrivial proper $G_k$-submodule $W$ which is stable under the action of $G_k$. Then the dual $W^{\vee}$ of $W$ is either $\A[p]^{\vee}$ or it is trivial. Consequently $W$ is trivial or it is the whole $\A[p]$. Therefore $\A[p]$ is an irreducible $G_k$-module. In the same way the irreducibility of $\A[p]\simeq (\A[p]^{\vee})^{\vee}$ implies the irreducibility of $\A[p]^{\vee}$. Then we may apply Theorem \ref{thm_cass} to $\A^{\vee}$ and $\A[p]^{\vee}$ and we have $\Sha(k,\A[p^m]^{\vee})=0$, for all $m\geq 1.$ By \cite[Proposition 13]{CS} (or equivalently by \cite[Theorem 3]{Cre2}), this is a sufficient condition to have an affirmative answer to Cassels' question for $p$ in $\A$. \eop \bigskip\noindent In \cite{CS} and \cite{Cre} the authors also question whether a local-global principle for divisibility by $p^m$ holds in $H^1(G_k,\A)$. Let $v$ denote a place of $k$ and let $k_v$ be the completion of $k$ at $v$. An element $\sigma\in H^1(G_k,\A)$ is locally divisible by $p^m$ over $k_v$ if there exists $\tau_v\in H^1(G_{k_v},\A)$ such that $res_v(\sigma)=p^m \tau_v$, where $res_v(\sigma)$ is the image of $\sigma$ under the restriction map $res_v: H^1(G_k,\A)\rightarrow H^1(G_{k_v},\A)$. It is natural to ask if an element locally divisible by $p^m$ over all $k_v$ is divisible by $p^m$ in $H^1(G_k,\A)$, i.e. if the local-global principle for divisibility by $p^m$ holds in $H^1(G_k,\A)$. By \cite[Theorem 2.1]{Cre}, for every positive integer $n$, the triviality of $\Sha(k,\A[n])^{\vee}$ is a sufficient condition to the validity of the local-global principle for the divisibility by $n$ in $H^1(G_k, \A)$ (see also \cite[Theorem C]{CS}). Then, as a consequence of Theorem \ref{thm_cass}, we get the following statement too. \begin{cor} Let $\A$ be an abelian variety of dimension $g$ defined over a number field $k$. For all $p>(4g+1)^2$, if $\A[p]$ is an irreducible $G_k$-module, then the local-global principle for divisibility by $p^m$ holds in $H^1(G_k,\A)$, for every $m\geq 1$. \end{cor} \bigskip\noindent \emph{Acknowledgments}. I would like to thank Davide Lombardo, Florence Gillibert and Gabriele Ranieri for useful discussions.
\section{Introduction} Partially connected hybrid structures for millimeter wave (mmW) massive MIMO systems are drawing considerable attention from researchers due to the benefits of spatial multiplexing coupled with low complexity, low power consumption and high energy efficiency \cite{ref_01}, \cite{ref_02}. However, such systems can only accommodate a limited number of users due to restrictions on the number of RF chains \cite{ref_03}. In the environments where the number of users is large compared to the number of RF chains, user selection is essential. In the existing literature, many model driven approaches are proposed for user or antenna selection. The performance of optimization and model driven methods for user selection is evaluated in terms of either bit-error-rate (BER) or achievable data rate. Evolutionary algorithms for user selection are employed in \cite{ref_04} to find a suboptimal solution with a reduced computational complexity compared to user selection based on exhaustive search. A greedy algorithm for user selection with downlink beamforming is applied in \cite{ref_05} to further reduce the computational complexity, but at the cost of a reduction in achievable rate. User selection based on matching theory is proposed in \cite{ref_06}. A method based on an Adaptive Markov Chain Monte Carlo (AMCMC) algorithm for multi-cell multi-user massive MIMO down-link systems is proposed in \cite{ref_07}. The authors in \cite{ref_08} utilized a generalized power iteration precoding (GPIP) algorithm to generate a joint solution for user selection, power allocation, and downlink precoding. However, all these algorithms are sub optimal in nature. The optimal solution to the user selection problem can be obtained by employing an exhaustive search (ES) algorithm which enumerates all possible combinations of active users, but leads to an exponential growth of the complexity with the increase of the number of active users. Thus, the ES algorithm is not suitable for massive MIMO systems due to high computational complexity. Recently, data driven deep learning (DL) methods have shown great potential in dealing with the problems of channel estimation \cite{ref_09}, \cite{ref_10} and RF precoder design \cite{ref_11}. Similarly, data driven methods were applied to the transmit antenna selection problem, to obtain the best antenna subset \cite{ref_11}, \cite{ref_12}. Based on the availability of appropriate datasets, classifiers such as k-nearest neighbors (KNN) and support vector machine (SVM) can be trained to map the available channel dataset into the selected antenna subset. The author in \cite{ref_12} has proved that the performance of KNN and SVM based classifiers exceeds that of conventional optimization driven methods. Compared to optimization driven methods, data driven models are computationally efficient as well, which makes them convenient to be implemented in real-life applications. Note that, even though data driven methods have been widely applied to address multiple problems \cite{ref_09}-\cite{ref_12}, no work has been done so far on their application to user selection. Therefore, inspired by the efficiency and great potential of data driven techniques, in this letter we apply DL based convolutional neural networks (CNN) to the user selection problem in a massive MIMO wireless communication system. Our motivation can be explained as follows: \begin{itemize} \item For the user selection problem, it is well known that the computational complexity of the ES algorithm grows exponentially with the number of active users. Hence, this algorithm is not appropriate for implementation in a real time environment. \item Traditional user selection algorithms require many serial iterations which generally result in a high complexity. However, in a neural network (NN), the training phase is generally performed offline, and therefore the online deployment has very low complexity and is limited to a few matrix multiplications and additions. \item The availability of a large dataset and the use of a huge number of iterations in the training phase enable CNNs to understand the complicated features of wireless channels. \end{itemize} \subsection{Novelty and Contribution} In this letter, we propose a DL-based user selection design approach and develop a CNN which is trained using the channel realizations as the dataset and learns how to optimize the user selection to maximize the sum rate. The contributions can be summarized as follows: \begin{itemize} \item \textit{New Design Approach}: A CNN based technique is proposed to directly perform the user selection without the involvement of any iterative algorithm after the CNN has been trained. The dataset is obtained after performing exhaustive search on each channel realization to select a subset of the active users which maximizes the sum rate. It is pertinent to mention that both training and dataset generation are performed offline. \item \textit{Robustness to imperfect CSI}: The proposed algorithm ensures robustness to imperfect channel state information (CSI). Firstly, during offline training, the CNN learns how to optimize the user selection to approach the ideal sum rate using practical channel estimates. Secondly, during the online deployment, the CNN can itself adapt to imperfect CSI and achieve robust performance in the presence of channel estimation errors. \end{itemize} \section{System Model} \begin{figure}[tbph] \centering \includegraphics[height=1.8in,width=3.4in]{sys.eps} \caption{System Model for User Selection} \label{fig:sysmod} \end{figure} We consider a massive MU-MIMO downlink system with a transmitter equipped with $N_{T}$ transmit antennas, $N_{s}$ data streams and $N_{RF}$ RF chains serving $N_{R}$ single antenna users. We assume a multi-user precoding case where the transmitter communicates with each user via only one stream. Hence, the number of data streams is equal to the number of users. Further, we assume that the maximum number of users that can be simultaneously served by the transmitter equals the number of RF chains. We assume that $N_{R}$ $>$ $N_{RF}$. Hence, we have to choose a subset of $N_{r}$ users so that $N_{RF}$ = $N_{r}$. Our proposed CNN method will select $N_{r}$ users out of the available $N_{R}$ users and afterwards we will perform hybrid precoding for the selected users. For the sake of simplicity, let $N_{s}$ = $N_{RF}$ = $N_{r}$ = $N$. On the downlink, the transmitter applies an $N \times N$ baseband precoder $\mathbf{F}_{BB} = [\mathbf{f}^{BB}_{1}, \mathbf{f}^{BB}_{2}, ..., \mathbf{f}^{BB}_{N}]$ followed by an $N_{T} \times N$ RF precoder $\mathbf{F}_{RF} = [\mathbf{f}^{RF}_{1}, \mathbf{f}^{RF}_{2}, ..., \mathbf{f}^{RF}_{N}]$. The transmitted signal is represented as \begin{equation} \mathbf{x} = \mathbf{F}_{RF} \mathbf{F}_{BB} \mathbf{s} \end{equation} where $\mathbf{s} = [s_{1}, s_{2}, ..., s_{N}]^{T}$ is the $N \times 1$ transmitted signal vector. Furthermore, $\mathbf{F}_{RF}$ and $\mathbf{F}_{BB}$ are evaluated using the algorithm proposed in \cite{ref_03}. We have adopted a narrowband block fading channel \cite{ref_13}, where the \textit{n}th user observes the received signal as \begin{equation} \mathbf{r}_{n} = \mathbf{h}_{n} \sum_{u = 1}^{N} \mathbf{F}_{RF} \mathbf{f}_{u}^{BB} \mathbf{s}_{u} + \mathbf{n}_{u} \end{equation} where $\mathbf{h}_{n}$ denotes the channel between the transmitter and the \textit{n}th user. Since the mmW propagation environment has a limited number of scatterers, in this paper we follow the geometric Saleh-Valenzuela model to represent the low rank mmW channel \cite{ref_13}: \begin{equation}\label{eq:chan} \mathbf{h}_{n} = \sqrt{\left(\dfrac{N_{T} N_{R}}{\epsilon L_{n}}\right)} \sum_{l=0}^{L_{n}}\eta_{n,l}\textbf{a}_{n,R}(\phi_{n,R},\theta_{n,R})\textbf{a}^{H}_{T}(\phi_{n,T},\theta_{n,T}) \end{equation} $L_{n}$ represents the number of effective channel paths linked to the limited number of scatterers for each user, $\epsilon$ is the path-loss, $\eta_{n,l}$ is the complex gain associated with the \textit{l}th path, $\textbf{a}_{n,R}$ and $\textbf{a}_{n,T}$ are the spatial signatures of the receiver and the transmitter, respectively, $\phi_{R}$ and $\theta_{R}$ represent the elevation and azimuth angle of arrival (AoA) and $\phi_{n,T}$ and $\theta_{n,T}$ represent the elevation and azimuth angle of departure (AoD) of the \textit{l}th path at the receiver and at the transmitter, respectively. For uniform planar arrays (UPAs), the spatial signatures are estimated as given in \cite{ref_01}. The aim is to select $N_{r}$ users from a total of $N_{R}$ single antenna users so that the sum rate is maximized. The received signal to interference plus noise ratio (SINR) for the \textit{k}th user after precoding is given as \begin{equation} \gamma_{k} = \frac{\left| \mathbf{b}_{k}\mathbf{F}_{RF} \mathbf{f}_{k}^{BB} \right|^2} {\sum_{\acute{k}\neq k} \mathbf{b}_{k}\mathbf{F}_{RF} \mathbf{f}_{\acute{k}}^{BB} + \sigma^2} \end{equation} where $\sigma$ is the noise power and $\mathbf{b}_{k}$ is the channel between the transmitter and the \textit{k}th selected user. Furthermore, let $b_{k}$ represent the \textit{k}th row of $\mathbf{B}$ $\in C^{N_{r} \times N_{T}}$ which consists of rows of channel matrix $\mathbf{H}$ that correspond to the channel of selected users obtained using our proposed CNN architecture. The sum rate of the system after user selection is expressed as \begin{equation} R = \log \bigg(\mathbf{I}_{N_{r}} + \sum_{k=1}^{N_{r}} \gamma_{k}\bigg) \end{equation} \begin{figure*}[htbp] \centering \includegraphics[height=1.6in,width=6.0in]{cnn.eps} \caption{Deep CNN Architecture} \label{fig:DL} \end{figure*} \section{CNN Based User Selection} In this section, we first introduce the dataset and the label generation which will serve as the input to the CNN model for training. Then, we will describe the CNN architecture in detail. \subsection{Data Normalization} A channel matrix realization is a data sample. Since we have assumed single antenna users, each row of $\mathbf{H}$ represents the channel for the respective user. Since the CNNs do not accept complex entries as input, complex entries ($h_{ij}$) of channel matrix $\mathbf{H}$ are divided into real and imaginary parts and concatenated into a single matrix. \subsection{Label Generation} In order to select $N_{r}$ users from the $N_{R}$ available users, we have $W$ = $N_{R} \choose N_{r}$ combinations. Every combination is represented as a class pattern, so we have a total of $W$ class labels. We have a one to one correspondence between each set of a selected users and a class label. For example, the first pattern of combinations of selected users is given label 1, the second pattern of combinations of selected users is given label 2, and so on. In order to generate a dataset for the training of our CNN, an exhaustive search is performed on each channel realization. The search algorithm examines all possible $W$ combinations generated and selects the combination of $N_{r}$ users that maximizes the sum rate. Hence, each channel realization is labeled with a class and given as input for the training of the CNN. \subsection{Deep CNN Architecture} \label{cnn} We have adopted a LeNet architecture for our CNN as shown in Fig \ref{fig:DL}. There are 2 convolutional layers, 2 pooling layers, 1 fully connected layer and 1 soft-max output layer. The input of the CNN is the normalized channel matrix. The first convolutional layer filters the normalized input channel matrix with 16 kernels of size $3 \times 3$. Then the first pooling layer normalizes and pools the input into a $3 \times 3 \times 16$ output response. The max-pooling kernels have a size of $2 \times 2$ and a stride of 2. The second convolutional layer filters the response with 32 kernels of size $3 \times 3$. The second pooling layer converts the input response to a $2 \times 2 \times 32$ output response. The fifth layer is a dense fully-connected layer with 1024 fully-connected kernels of size $1 \times 1$, which is a dense layer accelerating the convergence. Then a dropout layer, which randomly resets the output of each hidden neuron to zero, is added behind the fully-connected layer in order to avoid overfitting. The output of our CNN is the soft-max layer, which produces a class label. There is a one-to-one correspondence between a class label and a user selection. For the convolutional and fully-connected layers the rectified linear unit (ReLU) is used as the nonlinear activation function. The cross entropy is employed as the loss function with gradient descent optimizer. \section{Simulations and Results} Python 3.6 with tensor flow is used for CNN training and prediction, whereas the comparison with model driven algorithms is performed in MATLAB. The dataset for the simulations is generated for 100,000 independent channel realizations. The number of transmit antennas $N_{T}$ is set to 144. An exhaustive search method is used to generate the class label for each channel realization. The number of epochs for the training of CNN is kept as 200. Batch size is kept as 100. Fig \ref{fig:res3} shows the result obtained by selecting 6 out of 10 active users and Fig \ref{fig:res4} shows the result obtained by selecting 3 out of 10 active users. \begin{figure}[tbph] \centering \includegraphics[height=1.6in,width=2.4in]{3.eps} \caption{Spectral Efficiency vs SNR for $N_{R}=10, N_{r}=6$} \label{fig:res3} \end{figure} \begin{figure}[tbph] \centering \includegraphics[height=1.6in,width=2.4in]{5.eps} \caption{Spectral Efficiency vs SNR for $N_{R}=10, N_{r}=3$} \label{fig:res4} \end{figure} The results verify the performance of our CNN based algorithm over conventional iterative algorithms. It can be seen that the CNN based algorithm outperforms the sum rate achieved by the iterative binary particle swarm optimization (BPSO) and greedy algorithms. The greedy algorithm has the worst performance due the fact that it cannot select the “best” set of users from the available users. Although our proposed CNN approach only marginally outperforms the BPSO algorithm in terms of sum rate, it achieves a large gain in terms of reduction in computational complexity, as discussed in Section \ref{ca}. Even though the proposed CNN algorithm has a performance gap with respect to the exhaustive search algorithm, the latter is not suitable due to high computational complexity. \subsubsection{Performance Analysis with Imperfect CSI} Next we evaluate the case of uncertainties affecting the channel model. The estimated channel matrix with imperfect CSI $\mathbf{\widehat{H}}$ can be modeled as \cite{ref_02} \begin{equation} \mathbf{\widehat{H}} = \xi\textbf{H} + \sqrt{1-\xi^2}\textbf{E} \end{equation} where $\textbf{H}$ is the actual channel matrix, $\xi \in$ [0,1] is the CSI accuracy parameter and $\textbf{E}$ is an error matrix with entries following an i.i.d. $\mathbb{CN}$ (0,1). Fig. \ref{fig:resd} shows the effect of imperfect CSI on selecting 6 out of 10 active users with $\xi$ = 0.9 and 0.7. It is evident that the proposed system is not overly sensitive to CSI accuracy. It can also be seen that the achievable rate of the proposed system is quite close to that of the perfect CSI scenario even when $\xi = 0.7$. \begin{figure}[tbph] \centering \includegraphics[height=1.6in,width=2.4in]{1.eps} \caption{Impact of imperfect CSI on the proposed system} \label{fig:resd} \end{figure} \subsection{Complexity Analysis}\label{ca} In this section, we perform a complexity analysis of the proposed CNN method and compare it with that of conventional model driven methods. We consider $N_{T}$ = 144 transmit antennas and $N_{R}$ = 10 total available users. For our proposed CNN, the complexity in the offline training stage is normally not counted \cite{ref_14}, and only that in the online deployment stage is counted. With the parameters mentioned in Section \ref{cnn}, the total number of operations for CNN is around 6 million. The exhaustive search algorithm needs to compute $N_{R} \choose N_{r}$ complex determinants to evaluate the sum rate and each determinant requires O($N_{T}^{2}N_{r}^{2}$) complex operations to compute the hybrid beamforming matrices ($\mathbf{F}_{RF}$ and $\mathbf{F}_{BB}$) \cite{ref_14}. So for $N_{T}$=144, $N_{R}$=10 and $N_{r}$=6, the total number of operations is around 156 million. The BPSO based algorithm requires $N_{pop} \times N_{iter}$ determinants, where $N_{pop}$ is the population size and $N_{iter}$ is the total number of iterations for the BPSO algorithm. Both variables are set to 10 during the simulations. So, the total number of operations is around 74 million for the BPSO algorithm. The greedy algorithm needs to compute O($N_{T}^{2}N_{r}^{2}$) complex operations for a total number of $N_{R}$ users. So, the total number of operations is around 7.5 million for the greedy algorithm. It can be seen that the proposed CNN has competitive computational complexity when compared with traditional model-based algorithms. In addition, the main operation of any CNN based algorithms only involves large-scale matrix multiplications and additions, which can be effectively accelerated by using graphics processing units. Conversely, most traditional model-based algorithms involve serial iterations where the optimization of the next iteration depends on the result of the previous iteration, which is not suitable for parallel computing. \section{Conclusions} We have proposed a CNN based design approach for user selection involving large antenna arrays. It is shown that the proposed CNN based approach is more efficient in terms of sum rate than model driven methods and performs close to the optimal exhaustive search based user selection. In addition, the computational complexity of data driven methods is acceptable and calculations only involve matrix multiplications and additions in the online phase.
\section{Introduction} \label{sec:introduction} Parity-time ($\mathcal{PT}$) symmetry \cite{Bender1998} was first introduced as a fundamentally non-Hermitian extension of quantum mechanics \cite{Bender2002} and is now often used to model open systems \cite{El-Ganainy2007, Guo2009, Ruter2010} with symmetrically balanced loss and gain. The primary feature of $\mathcal{PT}$-symmetric systems is that up to a critical strength of gain and loss, the non-Hermitian system Hamiltonian has all real eigenvalues, and it shares its eigenstates with the $\mathcal{PT}$ operator. Above this threshold, pairs of complex conjugate eigenvalues form, breaking the $\mathcal{PT}$ symmetry. Static systems with $\mathcal{PT}$ symmetry have been studied for the past several decades \cite{Feng2017, El-Ganainy2018, Ozdemir2019}, and have proven to be experimentally achievable in a wide variety of settings including waveguides \cite{Guo2009, Ruter2010, Zeuner2015, Kremer2019}, optical resonators \cite{Hodaei2014, Hodaei2016}, electrical circuits \cite{Schindler2011}, mechanical systems \cite{Bender2013}, and atomic systems \cite{Zhang2016}. While these static systems provide ample grounds to explore many of the basic properties of $\mathcal{PT}$-symmetric systems, they have several drawbacks. Chiefly, for extended systems, gain is difficult to implement in a way which exactly balances the loss, which often has its origins in the natural coupling of the system to its environment. For this reason, it is often convenient to transform a $\mathcal{PT}$-symmetric system to a loss-only one, which can be more easily implemented. Experimentally, large arrays of optical waveguides have proven to be useful in the study of these ``lossy'' $\mathcal{PT}$-symmetric systems \cite{Zeuner2015, Kremer2019}. Building on this theory, a lattice model was proposed by Rudner and Levitov \cite{Rudner2009} to study topology in a $\mathcal{PT}$-symmetric system. This model is a natural extension of the Hermitian Su-Schrieffer-Heeger (SSH) model \cite{Su1979}, a simple one-dimensional dimer lattice which exhibits a well-known topological transition and topologically protected mid-gap edge states \cite{Asboth2016}. The model of Rudner and Levitov also exhibits many of these qualities; however, the associated energies of the localized edge states are pure imaginary, so that they are dynamically unstable \cite{Hu2011}. Despite this, the topological transition in this model is well-defined \cite{Liang2013, Harter2018, Lieu2018} and has been experimentally observed \cite{Zeuner2015}. In the present paper, we study a time-periodic (Floquet) system \cite{Shirley1965} which is fashioned after that of Rudner and Levitov \cite{Rudner2009}, but with a modulated gain and loss rate \cite{Joglekar2014, Lee2015, Li2019, Leon-Montiel2018}. A similar system has previously been shown to exhibit an entirely real spectrum in the high-driving-frequency regime \cite{Yuce2015}. According to the Floquet theory, the long-time dynamics of such a time-dependent system cannot be determined by examining a single static system; rather, we may introduce an effective static system, which is determined by the evolution over one period of the modulation \cite{Shirley1965, Kitagawa2010}. The introduction of the periodic time dependence allows states which are dynamically unstable in the static case to be stabilized by the periodic modulation while introducing a novel topology unique to Floquet systems \cite{Rechtsman2013, Rudner2013}. We begin, in Sec.~\ref{sec:static}, with a quick overview of the topologically relevant, Hermitian SSH model in Sec.~\ref{sec:ssh}, after which we discuss, in Sec.~\ref{sec:pt-ssh}, the static model proposed by Rudner and Levitov \cite{Rudner2009} which is its extension. We also provide a quick discussion of the analysis of this model in momentum space in Sec.~\ref{sec:momentum-space}. In Sec.~\ref{sec:floquet-pt}, we introduce the Floquet driving of the $\mathcal{PT}$-SSH model. We begin with a discussion of the Floquet theory in Sec.~\ref{sec:floquet}, followed by an analytical treatment in Sec.~\ref{sec:analytical-floquet}, and an analysis of the edge states in Sec.~\ref{sec:edge-states}. Finally, in Sec.~\ref{sec:conclusion}, we conclude with a brief discussion of the merits of our model. \section{The Static \texorpdfstring{$\PT$}{PT}-SSH Model} \label{sec:static} We first briefly review the relevant results of the static $\mathcal{PT}$-SSH model. To understand this non-Hermitian model, we begin with the Hermitian SSH model \cite{Su1979} in Sec.~\ref{sec:ssh}, which is a simple dimer lattice with alternating couplings. Then, in Sec.~\ref{sec:pt-ssh}, we add to this a $\mathcal{PT}$-symmetric extension \cite{Rudner2009, Zeuner2015} which attempts to respect the lattice symmetry. \subsection{The SSH Model} \label{sec:ssh} The starting point for our study is the Su-Schrieffer-Hegger (SSH) model \cite{Su1979}, a one-dimensional dimer chain, the bulk of which is described by the Hermitian tight-binding Hamiltonian \begin{equation}\label{eqn:bulk-ssh} H_{SSH} = \sum_m\left(v\ket{m,A}\bra{m,B} + w\ket{m,B}\bra{m+1,A}\right) + \mathrm{h.c.} \end{equation} with intra-dimer coupling $v$ and inter-dimer coupling $w$, both real-valued quantities. Each dimer cell is labeled $m$ with sub-lattice labels $A$ and $B$. We further impose open boundary conditions with $m$ ranging from $1$ to $M$ and the summation of Eqn.~(\ref{eqn:bulk-ssh}) cut off appropriately so that there are exactly $M$ complete dimers. \begin{figure} \centering \includegraphics[width=0.9\columnwidth]{ssh-bands} \caption{We show, for reference, the energy bands of the static SSH model plotted against the changing lattice parameter $v/v_T$. In the smaller inset, we show the wavefunction amplitudes of the two edge states with the eigenvalues $E = 0$ and a bulk state with $E = -J$ (plotted against each spatial site on the horizontal axis) for the parameterization corresponding to $v/v_t = 0.25$ (which is indicated by the vertical dashed red line in the larger plot). The edge states are highly localized to the left and right of the graph (red and blue), while the amplitude profile for a bulk state is highly delocalized (dark-gray).} \label{fig:ssh-bands} \end{figure} We explore parameterizations of this model in terms of its intra-dimer coupling $v$ by defining the scale of relevant coupling frequencies $v_T \equiv v + w$. Specifically, along the parameter range $v/v_T \in [0, 1]$, the couplings range between two fully dimerized limits $(v, w) = (0, v_T)$ and $(v, w) = (v_T, 0)$. In Fig.~\ref{fig:ssh-bands}, we see that the bulk energy bands are gapped by $\Delta E = 2|v - w|$, so that at exactly $v = w$, namely the uniform lattice, the gap closes. Due to the topological nature of the lattice, when $v < w$, or equivalently $v/v_T < 0.5$, the boundary condition of the lattice introduces a pair of protected edge states (see the inset of Fig.~\ref{fig:ssh-bands}), and the lattice exhibits a topologically nontrivial phase, as can be seen by the presence of the mid-gap zero-energy eigenvalue. However, when $v > w$, or equivalently, $v/v_T > 0.5$, these states are absorbed into the bulk. At the dimerization limits $v/v_T \rightarrow 0$ and $v/v_T \rightarrow 1$, we can easily inspect the topological nature of the real-space Hamiltonian. In the case of $v = 0$, both edges of the system are completely decoupled from the bulk of the system, resulting in two zero-energy eigenvalues given by the states $\ket{1,A}$ and $\ket{M,B}$, which are exactly localized on either edge of the system. In general, moving away from this limit, the edge states remain localized, as is demonstrated in the inset of Fig.~\ref{fig:ssh-bands}, until the gap closes at exactly $v/v_T = 0.5$. In the other limit, when $v/v_T = 1$ ($w = 0$), the unit cells are completely decoupled from each other. Its eigenstates are given by the direct products of independent dimers, and hence, no zero-energy edge states exist. Away from this limit, the dimers couple with each other, but the edge states remain nonexistent until the gap closes at $v/v_T = 0.5$. \subsection{The \texorpdfstring{$\PT$}{PT}-Extended SSH Model} \label{sec:pt-ssh} \begin{figure} \centering \includegraphics[width=0.9\columnwidth]{pt-ssh-lattice} \caption{Depiction of the $\mathcal{PT}$-SSH lattice with intra-dimer coupling $v$ and inter-dimer coupling $w$. The gain site ($+i\gamma$) is indicated by the red color, and the loss site ($-i\gamma$) is indicated by the blue color. Each pair of sites A and B (red and blue) comprises a full unit cell (labeled by $m$). Inside the cell, the sites are coupled by $v$, and the cells themselves are coupled by the alternate parameter $w$. We define the coupling scale by $v_T = v + w$.} \label{fig:pt-ssh-lattice} \end{figure} A non-Hermitian extension of this model was proposed by Rudner and Levitov \cite{Rudner2009}. In this model, an additional $\mathcal{PT}$-symmetric component which is local to each dimer is added to the original SSH model, \begin{equation}\label{eqn:pt-ssh} H_{\mathcal{PT}} = H_{SSH} + i\gamma\sum_m \left( \ket{m,A}\bra{m,A} - \ket{m,B}\bra{m,B} \right) \,, \end{equation} as depicted in Fig.~\ref{fig:pt-ssh-lattice}, where $\gamma$ is a real parameter that controls the gain and loss rate in the system. \begin{figure*} \centering \includegraphics[width=0.9\textwidth]{pt-ssh-bands} \caption{Depiction of the complex energy spectrum of the $\mathcal{PT}$-extended SSH model with fixed gain/loss rate $\gamma/v_T = 0.25$. In (a) and (e), we show the real and imaginary parts, respectively, of the energy spectrum as a function of the configuration parameter $v/v_T$. The vertical dashed lines correspond to the six values of $v/v_T$ highlighted by (b)-(d) and (f)-(h). In panels (b)-(d), we show the complex energy spectrum of the Hamiltonian for configurations having $v/v_T < 0.5$; each complex energy corresponds to a complex coordinate which is colored according to its IPR (from blue at zero to red at one). Specifically $v/v_T = 0.25$ in (b), $v/v_T = 0.35$ in (c), and $v/v_T = 0.45$ in (d). In panels (f)-(h), we show the complex energy spectrum for configurations having $v/v_T > 0.5$, with $v/v_T = 0.55$ in (f), $v/v_T = 0.65$ in (g), and $v/v_T = 0.75$ in (h).} \label{fig:pt-ssh-bands} \end{figure*} In this case, the Hamiltonian is no longer Hermitian, and the energy eigenvalues may take on imaginary components. In Fig.~\ref{fig:pt-ssh-bands}, we show the energies in the complex plane as a function of $v/v_T$ \cite{Lieu2018}. In Fig.~\ref{fig:pt-ssh-bands} (b)-(d), we observe the presence of non-bulk states (red), although they are pure imaginary. Between (c) and (d), the bulk states pick up imaginary components and begin to extend towards the isolated states on the imaginary axis. In Fig.~\ref{fig:pt-ssh-bands} (f)-(h), we observe the recession of the imaginary bulk states from (f) to (g); in (g), a gap begins to open between the purely real bulk bands, but the edge states are removed. In order to see whether the states are localized or extended, we can also calculate the inverse participation ratio (IPR) for each state; the IPR, defined by \begin{equation} \mathrm{IPR}(\psi) = \sum_m |\psi_m|^4 \,, \end{equation} is a measure of the extent to which a given state is localized. For the states indicated by blue dots in Fig.~\ref{fig:pt-ssh-bands} (f)-(h), the IPR is small $\leq 0.02$, whereas for the states with dark gray dots in (d), the IPR is $\approx 0.20$, and for the edge states indicated by red/yellow states in (b) and (c), the IPR is large $\approx 0.55$ (yellow) in (c) and $\approx 0.80$ (red) in (b). It is immediately clear that the localized modes are the ones which lie in the imaginary plane and they are complex conjugates. Moving away from these limits, to the full domain of $v$ and $w$, this model was found (under the appropriate imaginary guage transformation) to admit a topological invariant which is quantized to $1$ for $v/v_T < 0.5$, and $0$ for $v/v_T > 0.5$ \cite{Rudner2009, Liang2013}. This invariant consists of a global integration over space and time, and is not associated to the upper or lower bands as is the case in the Hermitian SSH model \cite{Rudner2009, Lieu2018}. While there has been much discussion \cite{Rudner2009, Liang2013, Lieu2018, Kowabata2019} as to the nature of the topology of this and other non-Hermitian models, we focus our effort on the presence (or absence) of dynamically stable edge states. In light of this, the $\mathcal{PT}$-extended SSH model does not have a topological phase with dynamically stable edge states \cite{Hu2011}; when $v/v_T < 0.5$, the edge states are inherently robust against perturbations in $v$, and separately, when $\gamma < |v - w|$, where the energy spectrum is entirely real (possessing unbroken $\mathcal{PT}$ symmetry), the system is dynamically stable; however, these two features do not coexist in this extended model. In the case where there are localized edges states, we can see that the system always has a pair of imaginary eigenvalues which correspond to the topological states; and thus the topological states are inherently dynamically unstable. \subsection{Momentum Space Analysis} \label{sec:momentum-space} Considering just the bulk of the system, let us neglect the boundaries for the moment. For a given intra-dimer coupling $v$ and gain/loss strength $\gamma$, the bulk Hamiltonian is block-diagonal in momentum space, with each block corresponding to a value $k \in [-\pi, \pi)$ having the form \begin{equation} \label{eqn:hptk} H_\mathcal{PT}(k) = (v + w\cos k)\sigma_x + \left(w\sin k\right)\sigma_y + i\gamma\sigma_z \,, \end{equation} where $\sigma_i$ are the Pauli matrices. Therefore, each block in momentum space effectively represents a two-site system with a complex, $k$-dependent coupling. Furthermore, in a rotated frame which changes with $k$, we may write \begin{equation} \label{eqn:hptkrot} H'_\mathcal{PT}(k) = r(k)\sigma_x + i\gamma\sigma_z \,, \end{equation} where \begin{equation}\label{eqn:rk} r(k) = \sqrt{v^2 + w^2 + 2vw\cos k} \, \end{equation} is real and takes values between $|v-w|$ and $v + w$ over the range of $k$. The rotation of the frame is given by \begin{equation} \label{eqn:krotation} H_\mathcal{PT}(k) = e^{-i\sigma_z\phi(k)/2}H'_\mathcal{PT}(k) e^{i\sigma_z\phi(k)/2} \,, \end{equation} where we have defined the angle \begin{equation} \phi(k) = \tan^{-1} \frac{w\sin k}{v + w\cos k} \,. \end{equation} The eigenvalues of the matrix of Eq.~(\ref{eqn:hptkrot}) are $E(k) = \sqrt{r^2(k) - \gamma^2}$, which indicates that when $\gamma \leq |v - w|$, $E(k)$ is real over the entire range of $k$. Thus, we may determine the time development under the real-space matrix $H_\mathcal{PT}$ in terms of the time development of $H'_\mathcal{PT}(k)$ and we focus our attention to the $k$-space evolution. The time-evolution operator for the $k$th rotated block reduces to \begin{align} \nonumber G_\mathcal{PT}(k,t) &= e^{-iH'_\mathcal{PT}(k)t} \\ &= \cos[E(k)t]\,I - i\sin[E(k)t]\frac{H'_\mathcal{PT}(k)}{E(k)} \,, \end{align} where $I$ is the $2 \times 2$ identity matrix. It is important to note that the quantities $\cos[E(k)t]$ and $\sin[E(k)t] / E(k)$ are always real even when $\gamma > r(k)$ because $E(k)^2$ is real. \section{The Floquet-Driven \texorpdfstring{$\PT$}{PT}-SSH model} \label{sec:floquet-pt} It has previously been discovered by Yuce \cite{Yuce2015} that periodic temporal (Floquet) modulation can provide a means to completely restore stability to the topologically nontrivial phase in the high-driving frequency regime. In this paper, we propose a concrete, exactly-solvable, two-step modulation which will allow us to gain insights into this process of stabilization and explore regions of stability below the high-driving frequency. Furthermore, utilizing the simplicity of the model, we seek to identify the underlying symmetry. This setup has also proved to be experimentally beneficial as it only requires control of the gain or loss in pulsed fashion \cite{Li2019}. Consider the following two-step time sequence for $0 \leq t < T$, where $T$ is the period of modulation, \begin{equation} \label{eqn:pt-pt-driving} H(t) = \begin{cases} H_\mathcal{PT} & \quad 0 \leq t < T/2 \,, \\ \tilde{H}_\mathcal{PT} & \quad T/2 \leq t < T \,, \end{cases} \end{equation} with $H_\mathcal{PT}$ being the Hamiltonian (see Eq.~(\ref{eqn:pt-ssh})) of the static $\mathcal{PT}$-extended SSH lattice described in Sec.~\ref{sec:pt-ssh}, while $\tilde{H}_\mathcal{PT}$ is the Hamiltonian of $H_\mathcal{PT}$ with the sign of $\gamma$ inverted to $-\gamma$. This corresponds to a periodic modulation of the gain/loss strength which instantaneously interchanges the location of gain and loss, $\gamma$, at each step. In fact, we can say that $\tilde{H}_\mathcal{PT}$ is the time-reversed version of $H_\mathcal{PT}$, as in $\tilde{H}_\mathcal{PT} = \mathcal{T}H_\mathcal{PT}\mathcal{T} = H_\mathcal{PT}^*$. \subsection{Floquet Analysis} \label{sec:floquet} According to the Floquet Theorem, the time evolution operator of a periodically driven system can be written \begin{equation} G(t) = P(t)e^{-iH_Ft} \,, \end{equation} where the matrix $P(t)$ is periodic with the same frequency as the driving, while $H_F$ is a constant matrix known as the effective Floquet Hamiltonian. Thus the long-term dynamics of the evolution are determined completely by $H_F$; further, at stroboscopic times $nT$, for any integer $n$, $P(nT)$ is the identity because $G(0) = P(0) = I$. Consequently, the system is dynamically unstable when at least one eigenvalue of $H_F(k)$ has an imaginary component, which results in exponential growth or decay in the long-term evolution of the system. \begin{figure*} \centering \includegraphics[width=0.9\textwidth]{pt-phases} \caption{The $\mathcal{PT}$ phase diagrams for the Floquet $\mathcal{PT}$-symmetric systems discussed in Sec.~\ref{sec:floquet-pt}. In each figure, the magnitude of the maximum imaginary eigenvalue is plotted over a plane in parameter space, where the color indicates increasing magnitude (thus, the black regions indicate $\mathcal{PT}$-symmetric phases). As a visual aid, a solid line has been added which outlines the border between the $\mathcal{PT}$-symmetric and $\mathcal{PT}$-broken phases. (a) The phase diagram for the two-site system of Eq.~(\ref{eqn:hpt2}), over a range of gain/loss parameters $\gamma$ and driving frequencies $\omega$. (b) The phase diagram for the 40-site Floquet $\mathcal{PT}$-extended SSH driven between $\gamma/v_T = 0.5$ and $\gamma = 0$ over a range of driving frequencies and couplings $v/v_T$. (c) The phase diagram over the $\omega$-$\gamma$ plane as in (a), but for the 40-site Floquet $\mathcal{PT}$-extended SSH model driven by swapping the gain ($+i\gamma$) and loss ($-i\gamma$) sites and with fixed coupling $v/v_T = 0.2$. (d) The phase diagram for the same system of (c), but in the $v$-$\omega$ plane with gain/loss magnitudes fixed at $\gamma/v_T = 0.2$. The dashed red lines in (c) and (d) indicate a portion of the $\mathcal{PT}$-phase with equivalent parameter values. In each panel, the dashed white lines indicate locations of the first three resonances $\omega/v_T = 2/n$ ($\omega/J = 2/n$ in the two-site case) with $n = 1, 3, 5$. Note that there are additional resonances between these in the asymmetrically driven case of panel (b).} \label{fig:pt-phases} \end{figure*} For a two-site Hamiltonian \begin{equation} \label{eqn:hpt2} H_2 = J\sigma_x + i\gamma\sigma_z \,, \end{equation} where $J$ is a real coupling parameter, similar Floquet $\mathcal{PT}$-symetric models have previously been studied \cite{Joglekar2014, Lee2015} and found to exhibit a rich $\mathcal{PT}$-phase diagram featuring re-entrant $\mathcal{PT}$-symmetry breaking depending on the driving frequency $\omega \equiv 2\pi/T$. As is shown in Fig.~\ref{fig:pt-phases}(a), at specific driving frequencies, i.e. $\omega/J = 2, 2/3, 2/5, \ldots$, the $\mathcal{PT}$ symmetry of the system is broken for any nonzero value of $\gamma$ (i.e. the $\mathcal{PT}$-threshold is zero at these locations). The periodic modulation at these driving frequencies is in resonance with the natural coupling frequency of the two-site system, namely $2J$. Utilizing the similarity between Eq.~(\ref{eqn:hptkrot}) and Eq.~(\ref{eqn:hpt2}), we can explore the $\mathcal{PT}$-phase diagram of the Floquet $\mathcal{PT}$-SSH model. In this case, as seen in Fig.~\ref{fig:pt-phases}(c), the resonance points occur for each value of $k$ at, i.e. $\omega/r(k) = 2, 2/3, 2/5, \ldots$, with $r(k)$ as defined in Eq.~(\ref{eqn:rk}), and there is an apparent broadening of the zero-$\mathcal{PT}$-threshold regime. In this case, the $\mathcal{PT}$-phase diagram can be thought of as the composition of the two-site case of Fig.~\ref{fig:pt-phases}(a) for multiple scaling values $r(k)$ determined by the allowed momenta $k$ replacing $J$ in Eq.~(\ref{eqn:hpt2}). The vertical dashed lines are placed at the resonance frequencies of the two-site case, demonstrating that they correspond to the two-site scaled system with the choice of $r(k=0) = v_T$. We can also analyze this model over a range of coupling parameters $v$ with a fixed value of gain/loss parameter $\gamma$, as is done in both Fig.~\ref{fig:pt-phases}(b), (d), where we show the $\mathcal{PT}$ phase in a sweep along the lattice parameter $v$ with driving frequencies $\omega$ increasing from bottom to top. For comparison to the previous two-site experimental studies \cite{Li2019, Leon-Montiel2018}, in Fig.~\ref{fig:pt-phases}(b), we modulate the system between a $\mathcal{PT}$-symmetric one ($\gamma > 0$) and a Hermitian one ($\gamma = 0$), instead of the modulation of Eq.~(\ref{eqn:pt-pt-driving}). In this case, when $v/v_T < 0.5$, we see that the $\mathcal{PT}$ symmetry is always broken, as is expected by the presence of edge states with pure imaginary eigenvalues. Similarly in Fig.~\ref{fig:pt-phases}(d), we modulate the Hamiltonian between opposing $\mathcal{PT}$-symmetric systems as in Eq.~(\ref{eqn:pt-pt-driving}). Note that since Fig.~\ref{fig:pt-phases}(c) and (d) have the same driving type, there is correspondence between the two graphs, which we have demonstrated by the vertical dashed line in (d) and the horizontal dashed line in (c). We observe that in this case, when $v/v_T < 0.5$, regions of unbroken $\mathcal{PT}$ symmetry may arise (corresponding to the black areas of the plot). Above the high driving-frequency threshold, we see that the spectrum is completely real for all coupling choices, and thus resembles the Hermitian SSH model, in accordance with the previous study \cite{Yuce2015}. We reveal that, even below this threshold, there are other regions of $\mathcal{PT}$-symmetry with $v/v_T < 0.5$, which arise just above the corresponding driving-frequency resonance points and which still retain localized edge states. These resonance points are highlighted by the dashed white lines. \subsection{Analytical Result} \label{sec:analytical-floquet} To better understand the topology and stability, we wish to analytically explore the effective Floquet Hamiltonian. Because the time dependence is a simple two-step function, the time evolution of the system over one period of driving is the product of the propagators for the static Hamiltonians associated with each step: \begin{equation}\label{eqn:monodromy} G(T) = e^{-i\tilde{H}_\mathcal{PT}\tau}e^{-iH_\mathcal{PT}\tau} \,, \end{equation} where we introduced the shorthand $\tau \equiv T/2$. Thus, we move to the momentum space, where each 2$\times$2 block, as in Eq.~(\ref{eqn:hptk}), of the Hamiltonian associated with momentum $k$ is independent. Therefore we may define a rotation which rotates each corresponding subspace around the $z$-axis such that we can identify the $k$-dependent rotated Hamiltonian, \begin{equation} H_\pm(k) = r(k)\sigma_x \pm i\gamma\sigma_z = \vec{\lambda}_\pm(k) \cdot \vec{\sigma} \,, \end{equation} where $H_\mathcal{PT}(k) = H_+(k)$ and $\tilde{H}_\mathcal{PT}(k) = H_-(k)$ correspond to the two steps of the Floquet sequence, while $\vec{\lambda}_\pm$ are the vectors $[r(k), 0, \pm i\gamma]^T$ respectively (with $^T$ the vectorial transposition operation) and $\vec{\sigma} = [\sigma_x, \sigma_y, \sigma_z]^T$ is the Pauli vector such that $H_\pm = \vec{\lambda}_\pm(k)\cdot\vec{\sigma}$. We may write $\vec{\lambda}(k)_\pm = E(k)\hat{\lambda}_\pm(k)$, where $E(k) = \sqrt{r(k)^2 - \gamma^2}$ is a (possibly complex) energy eigenvalue of both $H_\pm(k)$, whereas $\hat{\lambda}_\pm(k)$ is a (possibly complex-valued) unit vector. Dropping the argument $k$ from $E(k)$ and $\vec{\lambda}_\pm(k)$ for convenience, we may then obtain the time evolution operator for evolution of a rotated, $k$-space block, up to one driving period $T = 2\tau \equiv 2\pi/\omega$ (with driving frequency $\omega$) Eq.~(\ref{eqn:monodromy}): \begin{align} \nonumber G(T) &= (\cos{E\tau} - i \sin{E\tau} \hat{\lambda}_+\cdot\vec{\sigma})(\cos{E\tau} - i \sin{E\tau} \hat{\lambda}_-\cdot\vec{\sigma}) \\ &= \left(\cos^2{E\tau} - \sin^2{E\tau} \frac{r^2 + \gamma^2}{E^2}\right)I \nonumber \\ &+ 2\frac{r}{E}\sin{E\tau} \left(\cos{E\tau} \hat{x} - i \frac{\gamma}{E}\sin{E\tau} \hat{y}\right)\cdot\vec{\sigma} \,, \end{align} where $\hat{x} = [1, 0, 0]^T$, $\hat{y} = [0, 1, 0]^T$ are unit vectors and we used the formula $(\vec{a}\cdot\vec{\sigma})(\vec{b}\cdot\vec{\sigma}) = (\vec{a}\cdot\vec{b})I + i(\vec{a}\times\vec{b})\cdot\vec{\sigma}$. From this form, we can easily identify the Floquet Hamiltonian $H_F$ and its eigenvalues (up to arbitrary terms $n\omega$ for integer $n$) $\pm\mathcal{E}$ in the form $\mathcal{E}\hat{H}_F\cdot\vec{\sigma}$, where $\mathcal{E}$ is found by solving: \begin{equation}\label{eqn:floqeig} \cos(2\mathcal{E}\tau) = 1 - 2\sin^2(\mathcal{E}\tau) = 1 - 2\frac{r^2}{E^2}\sin^2{E\tau} \,, \end{equation} and $\hat{H}_F$ is found from \begin{equation}\label{eqn:floqvec} \sin(2\mathcal{E}\tau)\hat{H}_F = 2\frac{r}{E}\sin{E\tau} \left(\cos{E\tau} \hat{x} - i \frac{\gamma}{E}\sin{E\tau} \hat{y}\right) \,, \end{equation} by utilizing the value of $\mathcal{E}$ found in Eq.~(\ref{eqn:floqeig}). Then the effective Floquet Hamiltonian is fully described by $H_F = \mathcal{E}\hat{H}_F$. By the form of Eq.~(\ref{eqn:floqvec}), we see that $H_F$ can be written \begin{equation} \label{eqn:hf} H_F = c\left(\cos{E\tau}\sigma_x - i\frac{\gamma}{E}\sin{E\tau}\sigma_y\right)\,, \end{equation} with $c \equiv (2\mathcal{E}/\sin{2\mathcal{E}\tau})(\sin{E\tau}/E)$. Restricting the real part of $\mathcal{E}$ to $[-\omega/2, \omega/2)$, we see that there are only two cases to handle: either $\mathcal{E}$ is real, or, when $|(r/E)\sin{E\tau}| > 1$, $\mathcal{E} = \omega/2 + i\eta$ where $\eta$ is real. We see that when $\mathcal{E}$ is real, $c$ is real, and $H_F$ has the symmetries \begin{align} \sigma_z H_F \sigma_z &= -H_F \,, \label{eqn:sublattice}\\ \sigma_x H_F \sigma_x &= H_F^\dagger\,, \label{eqn:pseudohermitian}\\ \sigma_y H_F \sigma_y &= -H_F^\dagger\, \label{eqn:chiral}, \end{align} which correspond to sublattice symmetry for Eq.~(\ref{eqn:sublattice}), pseudo-Hermitian symmetry for Eq.~(\ref{eqn:pseudohermitian}), and chiral symmetry respectively for Eq.~(\ref{eqn:chiral}); and consequently, the Hamiltonian belongs to the non-Hermitian symmetry class AIII according to Ref.~\cite{Kowabata2019}. When $\mathcal{E}$ is complex, so is $c$, and the latter two symmetries of Eqs.~(\ref{eqn:pseudohermitian}) and (\ref{eqn:chiral}) are removed. However, as previously mentioned, the solutions to Eq.~(\ref{eqn:floqeig}) also admit the solutions $\mathcal{E} + n\omega$ for any integer $n$. Rather than considering the eigenvalue pair $\pm\mathcal{E}$ which correspond to $\omega/2 + i\eta$ and $-\omega/2 - i\eta$, we may consider a solution which, for example, gives the complex conjugate pair $\omega/2 + i\eta$ and $\omega/2 - i\eta$. An alternate form of $H_F$ which takes into account this situation is \begin{equation} H_{F,s} \equiv V\left[\mathcal{E}_s\sigma_z + \frac{\omega}{2} I\right]V^{-1} \,, \end{equation} where $\mathcal{E}_s = \mathcal{E} - \omega/2$ is the shifted eigenvalue and $V$ is the matrix of eigenvalues such that $H_F = \mathcal{E}V\sigma_zV^{-1}$. Importantly, when $\mathcal{E}$ is complex, $\mathcal{E}_s$ is pure imaginary. While this Hamiltonian is not traceless, as in Eq.~(\ref{eqn:hf}), it admits the pseudo-Hermitian symmetry of Eq.~(\ref{eqn:pseudohermitian}) even when the eigenvalues are complex. Thus, for all parameterizations of the model, the effective Hamiltonian can be seen to have this symmetry. Starting with a Floquet-modulated $\mathcal{PT}$-symmetric Hamiltonian, we have obtained (in the Floquet picture) a non-Hermitian Hamiltonian with pseudo-Hermitian symmetry \cite{Mostafazadeh2002}. \subsection{Analysis of the Edge States} \label{sec:edge-states} We also may analyze the fate of the edge states in the Floquet-driven $\mathcal{PT}$-SSH lattice. \begin{figure*} \centering \includegraphics[width=0.9\textwidth]{floq-pt-ssh-bands} \caption{The complex energy spectrum of the Floquet $\mathcal{PT}$-symmetric system of Sec.~\ref{sec:floquet-pt} as a function of $v/v_T$, with driving frequency $\omega/v_T = 0.7$ and gain/loss rate $\gamma/v_T = 0.2$. The complex energies are plotted in the complex plane, with each marker colored by its IPR (blue at zero to red at one). In panels (b)-(d), the spectrum of the Hamiltonian is shown on the complex plane for specific configurations below the topological transition $v/v_T < 0.5$, (b) $v/v_T = 0.1$, (c) $v/v_T = 0.2$ and (d) $v/v_T = 0.4$. (f)-(h) the complex energy spectrum above the topological transition $v/v_T > 0.5$, (f) $v/v_T = 0.6$, (g) $v/v_T = 0.8$, and (h) $v/v_T = 0.9$. (a) and (e) the real and imaginary parts, respectively, of the energy bands as a function the configuration parameter $v/v_T$. The vertical dashed lines correspond to the six values of $v/v_T$ highlighted by (b)-(d) and (f)-(h).} \label{fig:floq-pt-ssh-bands} \end{figure*} For modulation between a $\mathcal{PT}$-symmetric Hamiltonian and a Hermitian one, as in Fig.~\ref{fig:pt-phases}(b), we find that the energy eigenvalues corresponding to the edge states lie in the complex plane, and the system never has localized edge states in the $\mathcal{PT}$-symmetric phase. This is a result of the inability for the imaginary parts of the associated energies to balance one another during a single oscillation. Just as in the static $\mathcal{PT}$-SSH case, the edge states which correspond to the resulting imaginary eigenvalues occur when $v/v_T < 0.5$ and are highly localized. In fact, the result of the static $\mathcal{PT}$-SSH model with gain/loss parameter $\gamma$ is recovered identically in the high-frequency regime when the Floquet driving is between $\gamma_1=2\gamma$ and $\gamma_2=0$, i.e. the average $(\gamma_1 + \gamma_2)/2$ is equal to $\gamma$. In Fig.~\ref{fig:pt-phases}(d), we can see that in the case of $\mathcal{PT}$-symmetric to $\mathcal{PT}$-symmetric driving, the same $\mathcal{PT}$ phase diagram produces regions of dramatic stability within the topologically nontrivial phase. In this case, the alternation of the source and drain allows for cancellation in a single driving oscillation, i.e. the average of the gain/loss parameter over one period is zero, thus protecting the system from breaking the $\mathcal{PT}$ symmetry in the presence of the edge modes. In this case, in Fig.~\ref{fig:floq-pt-ssh-bands}, we see that the result of the static SSH model can be recovered, where the edge state corresponds to a real, zero-energy eigenvalue, and the system is simultaneously $\mathcal{PT}$-symmetric and has $v/v_T < 0.5$. In Fig.~\ref{fig:floq-pt-ssh-bands}(b)-(d), we observe the presence of real, mid-gap states (red/yellow). Between (b) and (c), the gap closes, but remains real, and the edge states remain localized inside the bulk spectrum. Between (d) and (f), the bulk states enter the imaginary portion of the complex plane, but again the edge states remain real. In Fig.~\ref{fig:floq-pt-ssh-bands}(f)-(h) we observe the reversal of the changes from (b)-(d), except that the edge state is removed; from (f) to (g), the bulk spectrum becomes real again, and from (g) to (h), a gap opens between the real bulk bands. Specifically, for the complex energies depicted in Fig.~\ref{fig:floq-pt-ssh-bands}(b)-(d), the localization (IPR) of the corresponding states is indicated by the color of each marker, with the zero-energy edge states depicted with IPR $\approx 0.98$ (red) in (b), $\approx 0.88$ (red) in (c), and $\approx 0.38$ (yellow) in (d). In Fig.~\ref{fig:floq-pt-ssh-bands}(f)-(h), the highest corresponding IPR is below $0.01$. It is important to remember that the energy spectrum shown here is restricted to values which are between $\pm\omega/2$, and that this spectrum pattern can be repeated infinitely along the real axis in both directions. We also observe that the localized, zero-energy mode is present even after the bulk gap has closed in the complex plane and exists within the bulk. \begin{figure} \centering \includegraphics[width=\columnwidth]{floq-pt-ssh-states} \caption{State amplitudes (by magnitude) of the Floquet $\mathcal{PT}$ SSH model. In (a), we show an example with $v/v_T = 0.2$, for which it is clear that there exist localized edge states (shown in blue and red) along with the typical bulk states (dark gray). In (b), we show an example with $v/v_T = 0.8$; we have plotted the state with the highest IPR, to demonstrate that it is not localized to either edge. In both cases, the driving frequency is $\omega/v_T = 0.7$ and the gain/loss rate is $\gamma/v_T = 0.2$} \label{fig:floq-pt-ssh-states} \end{figure} In Fig.~\ref{fig:floq-pt-ssh-states}, we provide a specific example to demonstrate the localization of the edge states in this model. In (a), we show the site amplitudes (by magnitude) of the edge states as well as a bulk state for a realization with $v/v_T < 0.5$. Here, the localization of the left (blue) and right (red) edge states is clear, while the bulk (dark gray) remains highly delocalized. Similarly in (b), for a realization with $v/v_T > 0.5$, we show the site amplitudes for the state with the highest IPR; we specifically note the clear absence of localized edge states in this case. \section{Conclusion} \label{sec:conclusion} In conclusion, we have confirmed that Floquet modulation is able to provide a stabilizing effect to the static $\mathcal{PT}$-SSH model by stabilizing the the edge modes. The choice of modulation has nontrivial effects on the presence of the $\mathcal{PT}$-symmetric phase. When the modulation is kept $\mathcal{PT}$ symmetric for half a period and then Hermitian for the other half, in the Floquet picture, we see that, at high enough frequencies, the effective Hamiltonian has an eigenspectrum reminiscent of the static $\mathcal{PT}$-SSH lattice with complex edge modes. However, when we drive between a pair of time-reversed $\mathcal{PT}$-symmetric lattices, the high-frequency spectrum of the effective Hamiltonian resembles that of the static Hermitian SSH lattice with real and stable edge modes. Above this high-driving frequency, the Floquet effective Hamiltonian has all real eigenvalues for all choices of lattice parameter up to a critical gain/loss rate (the $\mathcal{PT}$-symmetry breaking threshold). Importantly, below this high frequency regime, we find many other regions of stability. Specifically, below the first resonance frequency ($\omega/v_T = 2$) but above the second ($\omega/v_T = 2/3$), there can exist a broad portion of the $\mathcal{PT}$-phase diagram which is still in the $\mathcal{PT}$-unbroken phase and which has real, zero-energy, localized edge states. Finally, we stress that this model is amenable to experimental implementation. Because of the simple, temporally-periodic switching used as the driving pattern, the burden of matching the gain/loss rates to a smooth, continuous function is lifted. Possibilities include purely loss-only systems where the location of the loss is alternated; after a simple imaginary gauge transformation, such systems map directly onto the one we have discussed here. \begin{acknowledgments} The authors would like to acknowledge the financial support of Japan Society for the Promotion of Science (JSPS) Grants-in-Aid for Scientific Research (KAKENHI) JP19F19321 (A. H.) and JP19H00658 (N. H.). A. H. also acknowledges support as an International Research Fellow of JSPS (Postdoctoral Fellowships for Research in Japan (Standard)). Both authors would also like to thank Kohei Kowabata and Yogesh N. Joglekar for their helpful and insightful discussions and comments. \end{acknowledgments}
\section{Introduction} Face recognition technology has become ubiquitous these days, thanks to the advance in deep learning based methods \cite{jain2011handbook}. However, the reliability of face recognition systems (FRS) in the presence of attacks is poor in practical situations, mainly due to the vulnerability against presentation attacks (a.k.a spoofing attacks) \cite{handbook2}, \cite{ISO}. Presenting artifacts like a photograph or video in front of the camera could be enough to fool unprotected FR systems. The artifact used for this attack is known as a presentation attack instrument (PAI). Presentation attack detection (PAD) tries to protect the FR systems against such attacks. Majority of the PAD methods proposed in the literature focuses on the detection of 2D attacks. Most of these methods use either feature-based methods or CNN based approaches using visible spectrum images. However, they do not emulate a realistic scenario of encountering realistic 3D attacks. Recently, there has been a lot of works focusing on the detection of a wide variety of attacks, including 2D, 3D, and partial attacks. Multi-channel methods have been proposed as a possible alternative to deal with real-world scenarios with a wide variety of attacks \cite{george_mccnn_tifs2019, nikisins2019domain}. Usage of multiple channels makes it harder to fool the PAD systems. \begin{figure}[t] \centering \includegraphics[width=0.99\linewidth]{figures/Framework.png} \caption{Schematic of the proposed framework. The camera captures images in color, depth and infrared channels (all channel coming from a single commercially available device) and the RetinaNet based multi channel face detector performs simultaneous face detection and presentation attack detection using the composite image from these channels. The framework can be adapted to work with RGB-D combination just by stacking RGB and Depth channels at the input side (to make it work with OpenCV AI Kit (OAK-D) \cite{oak_d} and Kinect \cite{zhang2012microsoft}).} \label{fig:framework} \end{figure} For reliable usage of face recognition systems, they must be equipped with a presentation attack detection module. The PAD module can act before, after, or together with the face recognition module. Typically face recognition frameworks consists of a preprocessing stage including face detection and alignment, followed by the actual face recognition task. In the proposed PAD framework, we propose to use a multi-channel face detector \textit{as} the PAD system. In this way, the preprocessing stage for the face recognition system itself can perform PAD, thanks to the multi-channel information. Furthermore, the face detectors used typically are also CNN based, so if we can replace this face detector with the proposed module, it should not increase the overall complexity while adding PAD capabilities, simplifying the overall face recognition pipeline by removing the redundancy. Presentation attack detection is achieved by changing the task of the face detector from \textit{detecting faces} to \textit{detecting bonafide faces}. This is a hard challenge when only RGB channels are used and can result in a lot of detection errors. However, the proposed face detection based PAD framework (Fig. \ref{fig:framework}) leverage the multi-channel information to discriminate between \textit{bonafide} and presentation attacks. Another advantage of the proposed face detection-based framework is the efficient use of the background. Most of the common PAD frameworks utilize only the facial region and completely ignores the information from the background. Notably, in a multi-channel framework, background could give beneficial negative samples to make the system robust. The proposed framework can be configured based on the availability of data in different ways. It can be trained as a purely one class model when no negative samples are available, i.e, when only \textit{bonafide} samples are available. The \textit{bonafide} face location can be used as positive samples, and the entire background can be used as negative samples. When attacks are available, the face detector can be trained to classify between \textit{bonafide} and the attack classes. It is also possible to train the face detector as a multi-class classifier when we have the labels for different kinds of attack classes. While training the face detector, a lot of negative samples contribute to the loss function. To avoid this, we use the focal loss formulation, which focuses on the hard examples. If the face detection network is trained only on \textit{bonafide} samples, most of the negative samples (patches) would be easy to classify. The attack class images can be used as hard negative samples. This introduces greater flexibility as the face detector can be trained with different configurations, for instance, as a one-class classifier, either with only \textit{bonafide} class, or with the addition of attack classes too in training providing the CNN based face detector with harder examples, or as multi class classifier. This could be useful in the cases where only a limited amount of attacks are available in training. To the best knowledge of the authors, this is the first work using a multi-channel face detector for the task of face presentation attack detection. The main contributions of this work are listed below. \begin{itemize} \item Proposes a novel framework for PAD, using a multi-channel face detector, performing simultaneous face localization and presentation attack detection. \item The channels used in this work comes from an affordable consumer-grade camera, which makes it easy to deploy this system in real-world conditions. \item The proposed algorithm can be used as a preprocessing stage in face recognition systems, thus reducing the redundancy of an additional PAD system in the face recognition pipeline. \end{itemize} \section{Related work} Most of the prevailing literature in face presentation attack detection deals with the detection of 2D attacks using visible spectrum images. Majority of them depend on the quality degradation of the recaptured samples for PAD. Methods such as motion patterns \cite{anjos2011counter}, Local Binary Patterns (LBP) \cite{boulkenafet2015face}, image quality features \cite{galbally2014image}, and image distortion analysis \cite{wen2015face} are examples of feature based PAD methods. Also, there are several CNN based methods achieving state of the art performance \cite{liu2018learning,george-icb-2019, atoum2017face}. While there has been a lot of work in the detection of 2D presentation attacks, the assumptions of quality degradation during recapture does not hold for attacks such as realistic silicone masks and partial attacks. Here we limit the discussion to recent and representative methods that handle a wide variety of 2D and 3D attacks. With the ever-improving quality of attacks, visible spectrum images alone may not suffice for detecting presentation attacks. This problem becomes more severe when there is a wide variety of possible 2D and 3D presentation attacks possible. Multi-channel and multi-spectral methods have been proposed as a solution for this problem \cite{raghavendra2017extended}, \cite{steiner2016reliable}. Raghavendra \textit{et al}. \cite{raghavendra2017extended} presented an approach to use complementary information from different channels using a multi-spectral PAD framework. Their method used a fusion of wavelet-based features. Score level fusion achieved better performance as compared to feature fusion in detecting attacks prepared using different kinds of printers. Erdogmus and Marcel \cite{erdogmus2014spoofing} showed that 3D masks could fool the PAD systems easily. By combining the LBP features from color and depth channels, they could achieve good performance in the 3DMAD dataset. Steiner \textit{et al}. \cite{steiner2016reliable} introduced multi-spectral SWIR image-based PAD method, capturing four different wavelengths - 935\textit{nm}, 1060\textit{nm}, 1300\textit{nm} and 1550\textit{nm}. Their method essentially consisted of a skin level classifier in a predefined Region Of Interest (ROI) where the skin was expected to be present. They trained a pixel-level SVM to classify each pixel as skin or not. The percentage of skin detections in the ROI was used as the PAD score. Their method achieved 99.28\% accuracy in pixel-level skin classification. In \cite{dhamecha2013disguise}, the authors combined visible and thermal image patches for PAD. The patches used for the subsequent face recognition stage were selected by first classifying the patches as either \textit{bonafide} or attacks. Bhattacharjee \textit{et al}. \cite{Bhattacharjee:256262} showed the vulnerability of CNN based face recognition systems against 3D masks. They also proposed simple thermal-based features for PAD. Further, in \cite{bhattacharjee2017you}, they presented preliminary experiments on the use of additional channels for PAD. In \cite{george_mccnn_tifs2019}, George \textit{et al}. presented a multi-channel face presentation attack detection framework. Their approach consisted of extending a pretrained face recognition network to accept multiple channels and to adapt a minimal number of layers to prevent overfitting. The proposed method achieved an error rate of 0.3 \% in the challenging \textit{WMCA} dataset using color, depth, infrared and thermal channels. Further several other works have reported improved performance with the use of multi-channel methods \cite{heusch2020deep,george-tifs-2020}. Many multi-channel datasets have been made available for PAD recently. However, the variety of attacks is rather limited in most of the available databases. Typical PAD frameworks perform a preprocessing stage involving face detection with RGB channel, followed by alignment and binary classification for PAD. The PAD classifier, for most of them, has the form of a binary classifier acting on the detected face regions which might result in poor performance in unseen attack scenarios. Such frameworks ignores the useful information coming from the background regions completely. Moreover, the PAD module adds additional complexity to the face recognition pipeline. \section{Proposed approach} In the proposed approach, we use an object detection framework for localizing face and classifying between \textit{bonafide} and \textit{non-face} (attacks) labels. Specifically, we formulate the problem of multi-channel presentation attack detection as a two-class object detection problem. We leverage a single-stage object detection framework for this purpose. The task for the proposed object detector is to detect the presence of `\textit{bonafide}' or `\textit{non-face}' classes. While training, face locations detected by the RGB face detector \cite{zhang2016joint} is used as the ground truth bounding box locations. The class labels of the bounding boxes is considered as `\textit{bonafide}' class for real samples and all other attack classes are grouped as `\textit{non-face}' class. In the evaluation phase, the confidence of the \textit{bonafide} class is used for the scoring. If no object classes (`\textit{bonafide}' or `\textit{non-face}') are detected, then the sample is considered as an attack which was not seen in training. We use the RetinaNet \cite{lin2017focal} as the base architecture for the proposed multi-channel face detector, which obtained state of the art performance in object detection tasks. \subsection{Preprocessing} The data used in the network comprises of color, depth, and infrared channels. The color channel is converted to gray-scale. The raw depth and infrared channels available from the hardware are in 16-bit format. We first normalize these channels with Median Absolute Deviation (MAD) based normalization to convert them to 8 bit \cite{nikisins2019domain}. This stage is detailed as follows, let $\mathbf{I}$ be the image; first, a vector $\mathbf{v}$ containing non-zero elements of $\mathbf{I}$ is obtained to reduce the effect of background holes and dead pixels. The MAD value is computed as follows, \begin{equation} \mathbb{MAD} = median(|\mathbf{v}-median(\mathbf{v})|) \end{equation} Once the $\mathbb{MAD}$ is computed, the image can be normalized to 8 bit as: \begin{equation} \hat{\mathbf{I}}_{i,j} = \frac{(\mathbf{I}_{i,j} - median(\mathbf{v}) + \sigma \cdot \mathbb{MAD})}{2\cdot\sigma\cdot\mathbb{MAD}} \cdot (2^8-1), \end{equation} Values $i$ and $j$ denote the coordinates of the pixels in the image. The $\sigma$ value used in our experiments was four. Once all the channels are available in 8-bit format, they are concatenated to form the grayscale-depth-infrared composite image, which is used as the input in the subsequent CNN pipeline. An example of the composite \textit{bonafide} image is shown in Fig. \ref{fig:composite} \begin{figure}[t] \centering \includegraphics[width=0.99\linewidth]{figures/Composite.jpg} \caption{The composite image is formed from gray-scale, depth and infrared channels by stacking the normalized images.} \label{fig:composite} \end{figure} \subsection{Network architecture and loss function} The objective is to treat PAD problem as an object detection problem. In literature, there are several two-stage detectors that can do object detection by first generating the candidate locations and then classifying the candidate locations to get object labels. However, one stage object detectors are advantageous due to their simple design and faster inference. The RetinaNet \cite{lin2017focal} architecture is a one-stage object detection architecture, which is simpler and quicker at the inference stage. One of the main issues with one stage detectors is the poor performance due to heavy class imbalance. Out of a large number of candidate locations, only a few of them contain objects. This could result in poor models as the loss includes a lot of contributions from the background. In RetinaNet \cite{lin2017focal}, this issue is handled by introducing a new loss function called focal loss. This is done by down-weighting easy examples so that their contribution is less in the loss function. In summary, focal loss naturally favors the training on hard instances. \subsubsection{Architecture} We use the standard RetinaNet architecture built from a backbone network as the object detector. In our implementation, we used Feature Pyramid Network \cite{lin2017feature} with ResNet-18 \cite{he2016deep} backbone. There are two subnetworks; one is tasked with regressing the bounding box and the other one is performing the classification. In our case, the classifier needs to classify the presence of `\textit{bonafide}' or `\textit{non-face}' categories. The task of the regression network is to predict the `\textit{bonafide}' (or `\textit{non-face}' ) bounding box. Instead of RGB images, we use the composite image created in the preprocessing stage as the input to the network. \subsubsection{Loss function} As shown earlier, the RetinaNet architecture consists of two subnetworks, one for landmark regression and one for classification. For the object classification, the typically used cross entropy loss (CE) has the following form: \begin{equation} {\textrm{CE}(p,y) = \begin{cases} -\log(p) &\text{if $y = 1$}\\ -\log (1 - p) &\text{otherwise.}\end{cases}} \end{equation} In the above equation, $y \in \{\pm1\}$ specifies the label, $p \in [0,1]$ is probability computed by the network for the class with label $y=1$. We define $p_\textrm{t}$ as: \eqnnm{pt}{p_\textrm{t}=\begin{cases} p &\text{if $y = 1$}\\ 1 - p &\text{otherwise,}\end{cases}} so that we can rewrite the loss as $\textrm{CE}(p,y) = \textrm{CE}(p_\textrm{t}) = - \log (p_\textrm{t})$. After adding the modulation factor {\small $(1 - p_\textrm{t})^\gamma$}, and $\alpha$-balancing the expression for focal loss (FL) becomes \cite{lin2017focal}: \eqnnm{flalpha}{\textrm{FL}(p_\textrm{t}) = - \alpha_\textrm{t} (1 - p_\textrm{t})^\gamma \log (p_\textrm{t}).} The classification head of the network is trained with this loss function which reduces the effect of easily classifiable background patches in the loss function. \subsubsection{Scoring method} The network described above is trained as an object detector to localize and classify face. Here the notation `\textit{face}' denotes the location of face irrespective of the class label. The possible classes are `\textit{bonafide}' and `\textit{non-face}'. The `\textit{non-face}' category might contain a wide variety of attacks, and its possible that in some cases, no objects are detected. However, for the PAD system, we need to get a score, which is defined as the probability of a \textit{bonafide} class. The network outputs a classification label and class probability for the detected class, above a detection threshold. Once this information is available, the scoring is performed as follows. If the object class predicted is `\textit{bonafide}' then PAD score is computed as $score=P_{bonafide}$ where $P_{bonafide}$ is the probability of `\textit{bonafide}' class. If the object class returned is `\textit{non-face}' then $score=1-P_{non-face}$ where $P_{non-face}$ is the probability of the `\textit{non-face}' class. In the case where no objects are detected, as the case when an unseen attack is present, the sample is considered as an attack and given a predefined low score (i.e., considered as an attack). \subsubsection{Implementation details} We used a standard RetinaNet architecture with ResNet-18 \cite{he2016deep} backbone for our experiments. Pretrained weights of a model trained on ImageNet \cite{deng2009imagenet} was used to initialize the ResNet blocks. To train the face detector, $train$ set of the PAD database was used for training, and the $dev$ set was used for validation. The model was trained as a standard object detector with two classes (`\textit{bonafide}' and `\textit{non-face}' classes). The face bounding box used in the training was obtained from MTCNN algorithm \cite{zhang2016joint} on color channel images. Adam Optimizer \cite{kingma2014adam} with a learning rate of $2\times10^{-5}$ was used in the training. The model was trained for 50 epochs with ten frames from each video on a GPU grid. All the layers were adapted during the network training. The model corresponding to minimum validation loss was selected for the evaluation. The implementation was done with PyTorch \cite{paszke2017automatic}. \section{Experiments and Results} \subsection{Databases used} The key requirement of the proposed framework is the use of `multi-channel' information. We have conducted experiments in the publicly available \textit{Wide Multi-Channel presentation Attack} (\textit{WMCA}) \cite{george_mccnn_tifs2019} database, which contains a wide variety of 2D and 3D presentation attacks. To the best of our knowledge, there are no other publically available PAD datasets that contain synchronized multi-channel data in a usable format for our task. One other notable multi-channel PAD dataset is CASIA-SURF \cite{zhang2020casia}. However, they only provide cropped and preprocessed images in the public distribution which cannot be used in an object detector framework. The \textit{WMCA} dataset contains a total of \textit{1679} video samples from \textit{72} individuals. Mainly, the database contains four different channels of information recorded simultaneously, namely, color, depth, infrared, and thermal channels, collected using two consumer-grade devices, Intel\textsuperscript{\textregistered} RealSense\texttrademark SR300 (for color, depth and infrared), and Seek Thermal CompactPRO (for the thermal channel). The database contains different types of 2D and 3D attacks, such as print, replay, funny eyeglasses, fake head, rigid mask, flexible silicone mask, and paper masks. The statistics of attack types is shown in Table \ref{tab:BATL-data}. More details of the database can be found in \cite{george_mccnn_tifs2019}. Even though four different channels are available in the database, we use only three channels coming from the consumer-grade Intel RealSense camera (color, depth, and infrared). This makes the practical deployment more feasible as compared to the method in \cite{george_mccnn_tifs2019}. The samples of RGB images for the attack categories are shown in Fig. \ref{fig:pa_wmca} \begin{figure}[t] \centering \includegraphics[width=1\linewidth]{figures/face_pais.png} \caption{Attack categories in \textit{WMCA}, (image taken from \cite{george_mccnn_tifs2019}) dataset (Color channel), (a): glasses (paper glasses), (b): glasses (funny eyes), (c): print (2D), (d): replay (2D), (e): fake head, (f): rigid mask (Obama mask), (g): rigid mask (transparent plastic mask), (h): rigid mask (custom made), (i): flexible mask (custom made), and (j): paper mask.} \label{fig:pa_wmca} \end{figure} \begin{table}[ht] \centering \caption{Number of samples in each presentation attack category in \textit{WMCA} database.} \label{tab:BATL-data} \begin{tabular}{lcr} \toprule Attack Type & Category & \#Videos \\ \midrule \textit{Bonafide} & - & 347 \\ Print & 2D & 200 \\ Replay & 2D & 348 \\ Fake head & 3D & 122 \\ Rigid mask & 3D & 137 \\ Flexible mask & 3D & 379 \\ Paper mask & 3D & 71 \\ Glasses & 3D (Partial) & 75 \\ \hline \textbf{TOTAL} & & \textbf{1679} \\ \bottomrule \end{tabular} \end{table} \subsection{Protocols} We use the same \textit{grandtest} protocol defined in \cite{george_mccnn_tifs2019} for our experiments. However, it is to be noted that we only use three channels out of the four channels available from the database. All the channels we used are coming from the same consumer grade device making it suitable for deployment. \subsection{Metrics} For the evaluation of the algorithms, we have used the ISO/IEC 30107-3 metrics \cite{ISO}, Attack Presentation Classification Error Rate (APCER), and Bonafide Presentation Classification Error Rate (BPCER) along with the Average Classification Error Rate (ACER) in the $eval$ set. We compute the threshold in the $dev$ set for a BPCER value of 0.2\%. EPC curves and APCER and BPCER are also calculated. Additionally, the APCER of individual attack types and the ACER-AP which is defined as the average of BPCER and the maximum APCER of the attack types are also reported. \subsection{Baseline methods} We have implemented feature-based and CNN based baselines to compare with the proposed method. We used the same channels, i.e., gray-scale, depth, and infrared channels in most of the baselines for a fair comparison (except for the use of color channel in some baselines). We compared the proposed approach with competing multi-channel baselines using the same channels. The description of the baseline methods is given below. \begin{itemize} \item \textit{Haralick Fusion}: Here we use an extension of RDWT-Haralick-SVM method in \cite{agarwal2017face}. First, we perform a preprocessing stage, which consists of face detection. After that, the face region in all channels are normalized to the size of $128\times128$ pixels and rotated to make the eye-line horizontal. For each channel, Haralick \cite{haralick1979statistical} features computed from $4 \times 4$ grid are concatenated to form the feature vector. This feature vector was used with logistic regression (LR) for individual channels for the PAD task. A score fusion of all the channels was performed to get the final PAD score. \item \textit{IQM-LBP fusion}: In this baseline, we followed a similar preprocessing as the previous baseline. After the preprocessing stage, features are extracted from different channels, for example, Image Quality Measures (IQM)~\cite{galbally2014image} were extracted for the RGB channel, and variants of Local Binary Patterns (LBP) features for non-RGB channels. For each channel, a logistic regression model is trained, and score level fusion is performed to obtain the PAD scores. \item \textit{FASNet (Color)}: This is an RGB only CNN \cite{lucena2017transfer} baseline for the PAD task. Similar to the other baselines, this network also utilizes aligned images from the preprocessing stage. \item \textit{MCCNN-GDI}: Here we implemented \cite{george_mccnn_tifs2019}, which achieved state of the art performance in the \textit{grandtest} protocol in \textit{WMCA} dataset, when used with gray-scale, depth, infrared and thermal channels. Here, to make it comparable with that of the proposed system, we retrained the system with the channels used in this work, i.e., gray-scale, depth, and infrared channels. \end{itemize} Additionally, for the feature-based methods, the best performing method from each channel is also added in the evaluations. \subsection{Experiments} \subsubsection{Baseline results} The results of different baselines systems with color, depth, and infrared channels, as well as the fusion methods, are shown in Table \ref{tab:baseline_results}. For the individual channels, only the result from the best one is reported. Of all the channels present, the infrared channel performs the best with an ACER of 11.0\%. Though fusion improves the overall ROC, the performance in low BPCER regions becomes slightly worse. Out of the baselines, the MCCNN-GDI method is clearly superior, achieving an ACER of 3\%. \begin{table*}[t] \centering \caption{Performance of the baseline systems and the components in \textbf{grandtest} protocol of \textit{WMCA} dataset. The values reported are obtained with a threshold computed for BPCER 0.2\% in $dev$ set.} \label{tab:baseline_results} \begin{tabular}{@{}lcc|ccc@{}} \toprule \multirow{2}{*}{Method} & \multicolumn{2}{c|}{dev (\%)} & \multicolumn{3}{c}{test (\%)} \\ \cmidrule(l){2-6} & \multicolumn{1}{c|}{APCER} & ACER & \multicolumn{1}{c|}{APCER} & \multicolumn{1}{c|}{BPCER} & ACER \\ \midrule Color (Haralick-LR) &41.1 &20.6 &42.0 &1.0 &21.5 \\ Depth (Haralick-LR) &42.2 &21.2 &50.6 &0.2 &25.4 \\ Infrared (Haralick-LR) &24.9 &12.5 &21.9 &0.0 &11.0 \\ \hline Haralick Fusion &29.0 &14.6 &27.0 &0.3 &13.6 \\ IQM-LBP fusion &41.9 &21.0 & 47.7 & 0.3 &24.0 \\\hline FASNet (Color) &29.3 &14.7 &24.9 &3.8 &14.3 \\ MCCNN-GDI &2.3 & 1.2 & 6.1 & 0.0 & 3.0 \\ \hline \textbf{Proposed} &1.2 & 0.7 & 1.9 & 1.0 & \textbf{1.5} \\ \bottomrule \end{tabular} \end{table*} \subsubsection{Results with the proposed framework} From Table \ref{tab:baseline_results}, it can be seen that the proposed face detection based PAD framework achieves an ACER of 1.5\% outperforming the state of the art baselines. Some of the successful detections are shown in Fig. \ref{fig:successful}. To identify the limitations of the framework, some of the false detections are also shown in Fig. \ref{fig:failure}. The instances of \textit{bonafide} getting classified as the attack could be due to the missing values in the depth channel. Depth data from the device contains holes where depth is not estimated correctly. This can probably be avoided with a preprocessing stage with hole filling and smoothing of the depth channel. The same could explain the misclassification of the transparent mask as \textit{bonafide}. Some of the attacks with paper glasses are misclassified since it looks identical to \textit{bonafide} with corrective glasses. \begin{figure}[h] \centering \includegraphics[width=1\linewidth]{figures/successful.jpg} \caption{ Image showing the successful detections, green boxes indicate the \textit{bonafide} detections and red boxes denote attack detections. First row shows the successful \textit{bonafide} detections and second row shows the successful presentation attack detections.} \label{fig:successful} \end{figure} \begin{figure}[h] \centering \includegraphics[width=0.8\linewidth]{figures/failures.jpg} \caption{ Image showing the failure case in detections, green boxes indicate the \textit{bonafide} detections and red boxes denote attack detections. The first row shows the failure cases where \textit{bonafide} are classified as attacks and the second row shows the failure cases where attacks are misclassified as \textit{bonafide}.} \label{fig:failure} \end{figure} \subsubsection{Detailed analysis of the scores} In this section, we perform a detailed analysis of the scores to get insights into the misdetections and failure cases. For this analysis, we compute the decision threshold in the development set with BPCER 0.2\% criterion, and we apply this threshold on the evaluation set. After that, we aggregate the APCER for individual attack categories. The results for different attack categories are tabulated in Table \ref{tab:detailed_pa}. \begin{table}[h] \centering \caption{Detailed analysis of the performance for different PA's, at threshold computed for BPCER 0.2\% in $dev$ set.} \label{tab:detailed_pa} \begin{tabular}{@{}lccc@{}} \toprule Attack Type & Category & Dev Set & Eval Set \\ \midrule Prints &2D& 0.0\% & 0.0\% \\ Replay &2D& 0.0\% & 0.0\% \\ Flexible mask &3D & 2.0\% & 0.8\% \\ Rigid mask &3D& 3.7\% & 3.2\% \\ Fake head &3D& 0.0\% & 0.4\% \\ Glasses &3D (Partial)& 2.5\% & 11.9\% \\ \hline APCER-AP & & 3.7\% & 11.9\% \\ BPCER & & 0.2\% & 1.0\% \\\hline \textbf{ACER-AP} & &1.9\% &6.5\% \\\bottomrule \end{tabular} \end{table} From the Table \ref{tab:detailed_pa}, it can be seen that the proposed method achieves perfect performance in 2D attack classification. This is expected since the information from the depth channel alone might suffice for this task. The performance in 3D masks are also satisfactory, considering the very low BPCER values. The glasses attacks are the most challenging ones, and they contribute to most of the misclassifications. The glasses category consists of `Paper glass` (Fig. \ref{fig:pa_wmca} (a)) and `Funny eyes` (Fig. \ref{fig:pa_wmca} (b)) sub categories. Moreover, these are the only partial attacks present in the database. Especially in the channels considered, the funny eyes and the paper glass appear very similar to \textit{bonafide} samples with medical glass. This results in misclassification of these attacks. The ROC plots provide information about the performance in the evaluation set only. However, in realistic conditions, the decision threshold has to be set a priori. Expected performance curves (EPC) \cite{bengio2005expected} provide an unbiased estimate of the performance of (two-class) classifiers. As opposed to the ROC curve, where the evaluation is done only on the test set, EPC combines both development and test group to obtain the expected performance. The EPC curve shows the performance changes as a trade-off between False Matching Rate (FMR) and False Non Matching Rate (FNMR). This trade-off is controlled by the parameter \mbox{$0 \leq \alpha \leq1$} as follows: \begin{equation} \label{eqn:weighted_error} WER = \alpha\times(FMR) + (1 - \alpha)\times(FNMR) \end{equation} where $WER$ (weighted error rate) is computed as a weighted combination of FMR and FNMR. For each value of $\alpha$, the score-threshold which minimize the WER is selected based on the development group. The threshold chosen is used to compute the Half Total Error Rate (HTER) in the evaluation set. Fig. \ref{fig:epc_WMCA} shows the EPC plots of the proposed approach and the baseline methods. From the EPC curves, it can be seen that, in the lower BPCER regions (\mbox{$\alpha \leq0.5$}), the proposed approach outperforms the state of the art methods, indicating the robustness of the approach. \begin{figure}[ht] \centering \includegraphics[width=0.8\linewidth,page=5]{figures/grandtefacedet_evaluate.pdf} \caption{EPC plots for the reproducible baselines and proposed method in the \textit{eval} set of \textit{grandtest} protocol in \textit{WMCA} dataset } \label{fig:epc_WMCA} \end{figure} \subsection{Discussions} From the experimental results, it can be seen that the proposed framework for PAD with multi-channel data works better than binary classifier based approaches in the low BPCER range. This framework is ideal for typical usage settings since face detection is a part of the face recognition pipeline. Instead of using conventional face detection methods which detect and pass both \textit{bonafide} and attacks to the subsequent stages, the proposed method uses a multi-channel face detector, specifically trained to localize and distinguish \textit{bonafide} and \textit{attack} ('\textit{non-face}') classes simultaneously. Also, it is worth noting that the hardware used in the proposed pipeline is a single off-the-shelf Intel RealSense SR300 camera. To sum it up, the proposed approach provides face PAD as a face detector itself. Currently, the multi channel presentation attack databases available are collected in controlled conditions. Availability of data collected `in the wild' conditions could make it possible to train the face detector using just the \textit{bonafide} samples. The harder negatives from the background might improve the performance of the detector greatly. \section{Conclusions} The proposed method shows a simple yet efficient method for PAD using multi-channel information. The method does not add additional complexity to a face recognition pipeline since it can be a drop-in replacement for the face detector in the preprocessing stage. Even though the method is multichannel, the channels used are readily available from cheap consumer devices which makes it feasible for deployment. The Intel RealSense family of devices, Kinect and the upcoming OpenCV AI Kit (OAK-D) \cite{oak_d} are suitable candidates for such system as this model can be replaced with RGB-D channels as well. Addition of a PAD module is essential to secure face recognition systems against spoofing attempts. Typical PAD modules adds another layer of computational complexity to the face recognition pipeline. In this work, we propose a simple yet effective solution to add PAD capabilities to a face recognition system without adding any additional computational complexity. This is done by swapping the face detector in typical FR pipelines with the proposed multichannel face detector. The (multi-channel) face detector is used \textit{as} a presentation attack detector, thereby reducing the redundancy in the face recognition pipeline. To our best knowledge, this is the first method to use multi-channel face detection \textit{as} a PAD system. Specifically, a multi-channel face detector is trained to localize and classify \textit{bonafide} faces and presentation attacks. The proposed method utilizes color, depth, and infrared channels available from a commercially available sensors for PAD. The proposed method was compared with feature-based methods and state of the art CNN based methods for comparison in the \textit{WMCA} dataset and was found to outperform the state of the art method while obviating the requirement of additional face detection stage. \section*{Acknowledgment} Part of this research is based upon work supported by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA), via IARPA R\&D Contract No. 2017-17020200005. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the ODNI, IARPA, or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright annotation thereon. {\small \bibliographystyle{IEEEtran}
\section{Introduction} Coulomb branches of $4d$ $\mathcal{N}=2$ gauge theories and superconformal field theories (SCFTs) are well studied objects. Their geometrical properties were first studied in \cite{Seiberg:1994rs,Seiberg:1994aj}. Amongst the $4d$ $\mathcal{N}=2$ theories, SCFTs hold a special place. A crude estimate of their complexity is provided by the complex dimension of the Coulomb branch, called the \emph{rank} of the SCFT. The classification of all $4d$ $\mathcal{N}=2$ SCFTs based on all possible Coulomb branch geometries is a long standing problem. It has been addressed systematically for rank 1 theories in \cite{Argyres:2015ffa,Argyres:2015gha,Argyres:2016xua,Argyres:2016xmc}. A nice feature of some of these SCFTs is the existence of an \emph{enhanced} Coulomb branch. In this case the pure Coulomb branch of the theory is contained as a subvariety in a mixed branch, which is called the enhanced Coulomb branch. This implies that there is a partial Higgsing from a rank 1 SCFT with an enhanced Coulomb branch, to a rank 1 SCFT where the Coulomb branch is not enhanced \cite{Apruzzi:2020pmv}. (Classical) Higgs branches of Lagrangian $4d$ $\mathcal{N}=2$ theories are constructed through the hyper-K\"ahler quotient \cite{Hitchin:1986ea,Argyres:1996eh,Antoniadis:1996ra}. However, when the theory is non-Lagrangian, different methods are needed. A $3d$ $\mathcal{N}=4$ theory may have a 3d mirror theory \cite{Intriligator:1996ex}. In this case computing the Higgs branch of one theory corresponds to computing the Coulomb branch of the other theory and vice versa. A powerful tool to compute the Higgs branch of a theory with 8 supercharges in any dimension\footnote{Note that dimensional reduction to 3 dimensions is not necessary to obtain a magnetic quiver \cite{Ferlito:2017xdq}. Furthermore some 3d theories do not have a 3d mirror, but they have several magnetic quivers \cite{Ferlito:2016grh,Bourget:2019rtl}.}, is through the use of \emph{magnetic quivers} \cite{Hanany:1996ie,DelZotto:2014kka,Cremonesi:2015lsa,Ferlito:2017xdq,Hanany:2018vph,Cabrera:2018jxt,Cabrera:2019izd,Cabrera:2019dob,Bourget:2020gzi}. A crucial ingredient in deriving such quivers is the usage of non-simply laced quivers, whose Coulomb branches were first computed in \cite{Cremonesi:2014xha}. This note is dedicated to the study of magnetic quivers for rank 1 4d theories, and some sequences they naturally fall into. In this case the non-simply laced magnetic quivers can be obtained from the folding of simply laced magnetic quivers \cite{Dey:2014tka,Dey:2016qqp,Kimura:2017hez,Nakajima:2019olw,Bourget:2020bxh}, which arise in the context of five dimensional theories. This can be deduced from a brane web picture. The Higgs branches of some of the theories were previously studied through different methods in \cite{Xie:2014pua,Zafrir:2016wkk,Ohmori:2018ona}. Any proposed magnetic quiver is constrained by conditions on global symmetry, rank of gauge groups, scaling dimension of the operators in the Coulomb branch, as well as the identification of the $\mathbb{Z}_k$ S-folds with $k$-folded non-simply laced edges. It turns out, these conditions are restrictive enough to determine a candidate magnetic quiver. The Coulomb branch Hilbert series and Hasse diagrams of the magnetic quivers are consistent with previous computations. We also provide the Hasse diagrams for the full moduli space of these theories in 3 dimensions. Hasse diagrams for the full moduli space of $4d$ $\mathcal{N}=2$ theories are discussed in \cite{Mario,MarioPhilip} and for $4d$ $\mathcal{N}=3$ theories in \cite{Argyres:2019yyb}. \section{Rank 1 \texorpdfstring{$\mathcal{N}=2$}{Nis2} SCFTs} \label{Nis2} We begin with a brief review of the classification of these theories \cite{Argyres:2015ffa,Argyres:2015gha,Argyres:2016xua,Argyres:2016xmc,Argyres:2020nrr}. It is a geometric classification, based on the geometry of the Coulomb branch $\mathcal{C}$, which by definition is a complex singular space of dimension 1. In the case where there is no enhanced Coulomb branch, at a generic point on $\mathcal{C}$ the theory is a free $U(1)$ gauge theory, and interesting physics emerges at singular points. Scale invariance indicates that the singular locus is reduced to a single point, which we take to be the origin $O$ of the Coulomb branch. On the non simply connected regular locus $\mathcal{C}-\{O\}$, the locally trivial physics undergoes non-trivial topological effects, incarnated by a non-trivial monodromy in the electromagnetic duality group $\mathrm{SL}(2,\mathbb{Z})$. Scale invariance constrains the geometry of the Coulomb branch to be one of those listed in the left part of Table \ref{rank1table}. These geometries can be characterized by their Kodaira type \cite{Dasgupta:1996ij} \begin{equation} K \in \{II^\ast ,III^\ast ,IV^\ast , I_0^\ast , IV, III, II\} \, . \end{equation} When there is an enhanced Coulomb branch, on a generic point of the Coulomb branch there are also $d>0$ hypermultiplets which can take vacuum expectation values, parametrizing a geometry which can be globally non-trivial (in the rank 1 case, studied in this paper, these take the form of orbifolds $h_{d,k}$, see Appendix \ref{orbifoldappendix}). The geometry of the scale-invariant geometry $\mathcal{C}$ is not sufficient to fully characterize the SCFT: one also needs to understand possible $\mathcal{N}=2$ preserving mass deformations. These deformations break conformal invariance, so the geometry after deformation does not need to contain a single singular point. Rather, it contains a finite number of singularities which can be characterized by a finite set of Kodaira classes. The deformation parameters are invariant under (the Weyl group of) a flavor symmetry $F$. There can also be chiral deformation parameters. Barring the issue of discrete gauging \cite{Argyres:2016yzz}, a pair $[K , F]$ entirely identifies a 4d $\mathcal{N}=2$ rank-1 SCFT. For instance, the $\mathfrak{su}(2)$ gauge theory with $N_f=4$ has $K = I_0^\ast$ (which can be deformed to $\{I_1^6\}$), $F=D_4$ and has an exactly marginal deformation parameter. The classification gives a list of 17 rank 1 $\mathcal{N}=2$ SCFTs (not counting IR-free theories). It turns out they can be uniquely identified by the flavor symmetry $F$, and in the following we use this flavor symmetry to label the theories. The list of 17 SCFTs is presented in the right part of Table \ref{rank1table}. Alternatively, the theories can be obtained from $\mathbb{Z}_k$ $\mathcal{N}=2$ S-fold constructions \cite{Apruzzi:2020pmv}, from the compactification of $(1,0)$ $6d$ SCFTs with non-trivial global symmetry background \cite{Ohmori:2018ona}, or from $\mathbb{Z}_k$ twisted compactification from 5d $\mathcal{N}=1$ SCFTs, as detailed in Section \ref{generalfamily}. This is the reason for the organization into rows and columns: the row gives the geometry of the Coulomb branch in the singular limit, and the column gives the $\mathbb{Z}_k$ group. \begin{table}[t] \centering \begin{tabular}{cc||ccccc} \toprule Geometry $K$ & $[u]$ & $\mathbb{Z}_1$ & $\mathbb{Z}_2$ & $\mathbb{Z}_3$ & $\mathbb{Z}_4$ & $\mathbb{Z}_6$ \\ \midrule $II^\ast$ & $6$ & $E_8$ & $C_5$ & $A_3 \rtimes \mathbb{Z}_2$ & $A_2 \rtimes \mathbb{Z}_2$ & \\ $III^\ast$& $4$ & $E_7$ & $C_3A_1$ & $A_1U_1 \rtimes \mathbb{Z}_2$ & \textcolor{green}{$U_1 \rtimes \mathbb{Z}_2$} & \\ $IV^\ast$ & $3$ & $E_6$ & $C_2U_1$ & \textcolor{green}{$U_1$} & $\emptyset$ & \\ $I_0^\ast$ & $2$ & $D_4 \chi_0$ & \textcolor{blue}{$C_1\chi_0$} & & & \\ $IV$ & $\frac{3}{2}$ & $A_2\chi_{\frac{1}{2}}$ & & & & \\ $III$ & $\frac{4}{3}$ & $A_1\chi_{\frac{2}{3}}$ & & & & \\ $II$ & $\frac{6}{5}$ & $\chi_{\frac{4}{5}}$ & & & & \\ \bottomrule \end{tabular} \caption{\texttt{Left:} List of the seven singular Coulomb branch geometries at rank 1. These are freely generated, and $[u]$ is the scaling dimension of the generator. \texttt{Right:} List of 4d $\mathcal{N}=2$ rank 1 SCFTs (IR-free theories are omitted). Each entry represents one theory, labeled by its flavor symmetry. In the rest of the paper, for conciseness we ignore the discrete $\mathbb{Z}_2$ in the naming of the theories. The symbol $\chi_\delta$ signals the existence of a chiral deformation parameter of scaling dimension $\delta$. The magnetic quivers for the theories of the $\mathbb{Z}_k$ column involve $k$-laced edges. The theory in blue is $\mathcal{N}=4$ SYM with gauge group $SU(2)$. Theories in green are $\mathcal{N}=3$ S-fold theories \cite{Aharony:2016kai}. } \label{rank1table} \end{table} \section{Magnetic quivers}\label{magnetic quiver} In this section, the magnetic quivers $\mathsf{Q}$ of the $4d$ $\mathcal{N}=2$ rank 1 SCFTs are presented. The $3d$ $\mathcal{N}=4$ Coulomb branches of the magnetic quivers are equal to the Higgs branches of the rank 1 SCFTs. As given in Table \ref{resulttable}, the magnetic quivers are non-simply laced. Hence the framing, called \emph{ungauging scheme} in \cite{Hanany:2020jzl}, has to be prescribed. It is indicated by a \emph{squircle} (gauge node with a box around it). When the non-simply laced quiver is ungauged on a long node in the sense of a long root in a Dynkin diagram, it does not matter which of the long nodes is chosen. This is a remnant of the `Crawley-Boevey trick' \cite{Crawley-Boevey2001} for simply laced quivers, i.e.\ the freedom to change between framed and unframed simply laced quivers. In the case of simply laced quivers there is no need to denote an ungauged node. \begin{table}[t] \small \centering \begin{adjustbox}{center} \begin{tabular}{cc} \toprule Rank 1 SCFT & Magnetic quiver \\ \midrule $C_5$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {4}; \node [style=gauge3] (12) at (-2, 0) {}; \node [style=none] (15) at (-2, -0.5) {3}; \node [style=gauge3] (24) at (0.2, 0) {}; \node [style=none] (29) at (0.2, -0.5) {5}; \node [style=none] (30) at (-0.85, 0.075) {}; \node [style=none] (31) at (0.2, 0.075) {}; \node [style=none] (32) at (-0.85, -0.075) {}; \node [style=none] (33) at (0.2, -0.075) {}; \node [style=none] (34) at (-0.55, 0) {}; \node [style=none] (35) at (-0.175, 0.375) {}; \node [style=none] (36) at (-0.175, -0.375) {}; \node [style=gauge3] (37) at (0.95, 0) {}; \node [style=none] (38) at (0.95, -0.5) {2}; \node [style=gauge3] (39) at (-3, 0) {}; \node [style=gauge3] (40) at (-4, 0) {}; \node [style=none] (41) at (-4, -0.5) {1}; \node [style=none] (42) at (-3, -0.5) {2}; \node [style=blankflavor] (43) at (0.2, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (24); \draw (12) to (2); \draw (40) to (39); \draw (39) to (12); \end{pgfonlayer} \end{tikzpicture}} \end{tabular} \\ $C_3 \times A_1$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {2}; \node [style=gauge3] (12) at (-2, 0) {}; \node [style=none] (15) at (-2, -0.5) {1}; \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {3}; \node [style=none] (30) at (-1, 0.075) {}; \node [style=none] (31) at (0.25, 0.075) {}; \node [style=none] (32) at (-1, -0.075) {}; \node [style=none] (33) at (0.25, -0.075) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (-0.125, 0.375) {}; \node [style=none] (36) at (-0.125, -0.375) {}; \node [style=gauge3] (37) at (1, 0) {}; \node [style=none] (38) at (1, -0.5) {2}; \node [style=gauge3] (39) at (2.25, 0) {}; \node [style=none] (40) at (1, 0.075) {}; \node [style=none] (41) at (2.25, 0.075) {}; \node [style=none] (42) at (1, -0.075) {}; \node [style=none] (43) at (2.25, -0.075) {}; \node [style=none] (44) at (1.75, 0) {}; \node [style=none] (45) at (1.375, 0.375) {}; \node [style=none] (46) at (1.375, -0.375) {}; \node [style=none] (49) at (2.25, -0.5) {1}; \node [style=blankflavor] (50) at (0.25, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (24); \draw (40.center) to (41.center); \draw (43.center) to (42.center); \draw (45.center) to (44.center); \draw (44.center) to (46.center); \draw (12) to (2); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} \\ $C_2 \times U_1$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {1}; \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {2}; \node [style=none] (30) at (-1, 0.075) {}; \node [style=none] (31) at (0.25, 0.075) {}; \node [style=none] (32) at (-1, -0.075) {}; \node [style=none] (33) at (0.25, -0.075) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (-0.125, 0.375) {}; \node [style=none] (36) at (-0.125, -0.375) {}; \node [style=gauge3] (37) at (1.25, 0.5) {}; \node [style=gauge3] (38) at (1.25, -0.5) {}; \node [style=none] (39) at (1.75, 0.5) {1}; \node [style=none] (40) at (1.75, -0.5) {1}; \node [style=blankflavor] (41) at (0.25, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (33.center); \draw (38) to (31.center); \draw (37) to (38); \end{pgfonlayer} \end{tikzpicture}} \end{tabular} \\ $A_3$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {3}; \node [style=gauge3] (24) at (0.5, 0) {}; \node [style=none] (29) at (0.5, -0.5) {4}; \node [style=none] (30) at (-1, 0.15) {}; \node [style=none] (31) at (0.5, 0.15) {}; \node [style=none] (32) at (-1, -0.15) {}; \node [style=none] (33) at (0.5, -0.15) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (0, 0.5) {}; \node [style=none] (36) at (0, -0.5) {}; \node [style=gauge3] (37) at (-2, 0) {}; \node [style=gauge3] (38) at (-3, 0) {}; \node [style=none] (39) at (-2, -0.5) {2}; \node [style=none] (40) at (-3, -0.5) {1}; \node [style=blankflavor] (41) at (0.5, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (2) to (24); \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (2); \draw (38) to (37); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} \\ $A_1 \times U_1$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {1}; \node [style=gauge3] (24) at (0.5, 0) {}; \node [style=none] (29) at (0.5, -0.5) {2}; \node [style=none] (30) at (-1, 0.15) {}; \node [style=none] (31) at (0.5, 0.15) {}; \node [style=none] (32) at (-1, -0.15) {}; \node [style=none] (33) at (0.5, -0.15) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (0, 0.5) {}; \node [style=none] (36) at (0, -0.5) {}; \node [style=gauge3] (37) at (1.5, 0) {}; \node [style=none] (38) at (0.5, 0.075) {}; \node [style=none] (39) at (0.5, -0.1) {}; \node [style=none] (40) at (1.5, 0.075) {}; \node [style=none] (41) at (1.5, -0.1) {}; \node [style=none] (42) at (1.5, -0.5) {1}; \node [style=blankflavor] (43) at (0.5, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (2) to (24); \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (40.center) to (38.center); \draw (39.center) to (41.center); \end{pgfonlayer} \end{tikzpicture}} \end{tabular} \\ $A_2$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {2}; \node [style=gauge3] (24) at (0.5, 0) {}; \node [style=none] (29) at (0.5, -0.5) {3}; \node [style=none] (30) at (-1, 0.05) {}; \node [style=none] (31) at (0.5, 0.05) {}; \node [style=none] (32) at (-1, -0.075) {}; \node [style=none] (33) at (0.5, -0.075) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (0, 0.5) {}; \node [style=none] (36) at (0, -0.5) {}; \node [style=none] (37) at (-1, 0.15) {}; \node [style=none] (38) at (0.5, 0.15) {}; \node [style=none] (39) at (-1, -0.175) {}; \node [style=none] (40) at (0.5, -0.175) {}; \node [style=gauge3] (41) at (-2, 0) {}; \node [style=none] (42) at (-2, -0.5) {1}; \node [style=blankflavor] (43) at (0.5, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37.center) to (38.center); \draw (39.center) to (40.center); \draw (41) to (2); \end{pgfonlayer} \end{tikzpicture}} \end{tabular} \\ \bottomrule \end{tabular} \end{adjustbox} \caption{The magnetic quivers of $4d$ $\mathcal{N}=2$ rank 1 theories with enhanced Coulomb branches (labeled by their global symmetry).} \label{resulttable} \end{table} \begin{table}[t] \small \centering \scalebox{0.7}{ \begin{adjustbox}{center} \begin{tabular}{c|c|l} \toprule \begin{tabular}{c} Rank 1\\SCFT \end{tabular} &Hilbert series &Refined PL[HS] \\ \midrule $C_5$ & $\dfrac {\scriptsize \left(\begin{array}{c}1 + 2 t + 40 t^2 + 194 t^3 + 1007 t^4 + 4704 t^5 + 18683 t^6 + 67030 t^7 + 220700 t^8 + 657352 t^9 + 1796735 t^{10}\\ + 4540442 t^{11} + 10610604 t^{12} + 23011366 t^{13} + 46535540 t^{14} + 87887734 t^{15} + 155277056 t^{16}\\ + 257288236 t^{17} + 400453203 t^{18} + 585971786 t^{19} + 807195575 t^{20} + 1047954388 t^{21}\\ + 1282842123 t^{22} + 1481462886 t^{23} + 1615002952 t^{24} + 1662191888 t^{25} + \cdots\text{palindrome}\cdots+ t^{50}\end{array}\right)} {(-1 + t)^{32} (1 + t)^{18} (1 + t + t^2)^{16}} $ & \begin{tabular}{c} \parbox{6cm}{$t^2: [20000]\\ t^3:[00001]\\ t^4: -[01000]\\ t^5: -[10010] \\ t^6: -[00200]-[20000]+[01000]$ } \end{tabular}\\ \midrule $C_3 \times A_1$ & $\dfrac {\scriptsize \left(\begin{array}{c}1 + 2 t + 17 t^2 + 66 t^3 + 205 t^4 + 572 t^5 + 1415 t^6 + 2914 t^7 + 5368 t^8 + 8874 t^9 + 12992 t^{10}\\ + 16856 t^{11} + 19865 t^{12} + 21032 t^{13} + 19865 t^{14} + 16856 t^{15} + 12992 t^{16} + 8874 t^{17} + 5368 t^{18}\\ + 2914 t^{19} + 1415 t^{20} + 572 t^{21} + 205 t^{22} + 66 t^{23} + 17 t^{24} + 2 t^{25} + t^{26} \end{array}\right)} {(-1 + t)^{16} (1 + t)^{10}(1 + t + t^2)^8} $ & \begin{tabular}{c} \parbox{6cm}{$t^2: [000;2] + [200;0]\\ t^3: [001;2] \\ t^4: -[000;0]-[010;0] \\ t^5: -[001;2]-[001;0] -[110;2] \\ t^6: -[000;2]-[002;0]-[020;2]\\-[200;4]-[200;0]+[010;0]$} \end{tabular}\\ \midrule $C_2 \times U_1$ & $\dfrac {\scriptsize \left(\begin{array}{c}1 + 2 t + 8 t^2 + 20 t^3 + 41 t^4 + 62 t^5 + 87 t^6 + 96 t^7 + 87 t^8 + 62 t^9 + 41 t^{10} + 20 t^{11} + 8 t^{12} + 2 t^{13} + t^{14} \end{array}\right)} {(-1 + t)^8 (1 + t)^6 (1 + t + t^2)^4} $ & \begin{tabular}{c} \parbox{6cm}{$t^2: [00] + [20]\\ t^3: (1/q + q ) [01]\\ t^4: -[00] -[01]\\ t^5: -(q+1/q)([01]+[20])\\ t^6: -(1+q^2+1/q^2)[00] + [01]\\ - [02] - [20]$} \end{tabular}\\ \midrule $A_3$ & $\dfrac {\scriptsize \left(\begin{array}{c}1 - t + 10 t^2 + 23 t^3 + 67 t^4 + 190 t^5 + 525 t^6 + 1053 t^7 + 2292 t^8 + 4167 t^9 + 7299 t^{10}\\ + 11494 t^{11} + 17114 t^{12} + 23080 t^{13} + 29925 t^{14} + 35107 t^{15}\\ + 39221 t^{16} + 40320 t^{17} +\cdots\text{palindrome}+\cdots+ t^{34}\end{array}\right)} {(-1 + t)^{18} (1 + t)^{10} (1 + t^2)^5 (1 + t + t^2)^7} $ & \begin{tabular}{c} \parbox{6cm}{$t^2:[101]\\ t^3:[003]+[300]\\ t^4:[030] \\t^5:-[011]-[110]\\t^6:-[000]-[022]-[101]-[111]-[202]\\-[220]\\t^7: [001]-[003]+[100]-[112]-[122]\\-[211]-[221]-[300] \\t^8:-[000]+[002]+[012]-[020]+[022]\\-[040]+2[101]+[103]+2[111]+[200]\\+[210]+[220]-[222]+[301]$} \end{tabular}\\ \midrule $A_1 \times U_1$ & $\dfrac {\scriptsize \begin{array}{c}(1 - t + t^2) (1 + 2 t^2 + 4 t^3 + 4 t^4 + 4 t^5 + 2 t^6 + t^8) \end{array}} {(-1 + t)^6 (1 + t)^2 (1 + t^2) (1 + t + t^2)^3} $ & \begin{tabular}{c} \parbox{6cm}{$t^2: [2] + [0]\\ t^3: (q + 1/q) [3]\\ t^4: (q^2 + 1/q^2)[0]\\ t^5: - (q + 1/q)[1]\\ t^6: - [0] - (1 + 1/q + q) [2] - [4]\\ t^7: -(q+\frac{1}{q})[3]\\ t^8: -[0]+(2+q^2+\frac{1}{q^2})[2]+[4]$ } \end{tabular}\\ \midrule $A_2$ & $\dfrac {\scriptsize \left(\begin{array}{c}1 + 3 t^2 + 31 t^4 + 55 t^6 + 156 t^8 + 132 t^{10} + 156 t^{12} + 55 t^{14} + 31 t^{16} + 3 t^{18} + t^{20}\end{array}\right)} {(-1 + t)^{10} (1 + t)^{10} (1 + t^2)^5} $ & \begin{tabular}{c} \parbox{6cm}{$t^2:[11]\\t^4:[04]+[40]\\t^6: -[12]-[21]\\t^8: -[00]+[01]-[04]+[10]-[11]\\-[22]-[24]-[33]-[40]-[42]$} \end{tabular}\\ \bottomrule \end{tabular} \end{adjustbox}} \caption{Higgs branch Hilbert series of the $4d$ $\mathcal{N}=2$ SCFTs (labeled by their global symmetry) as well as the refined plethystic logarithm (PL).} \label{resultHS} \end{table} The magnetic quivers of the $4d$ $\mathcal{N}=2$ theories in question can be obtained from magnetic quivers of $5d$ $\mathcal{N}=1$ theories compactified with a $\mathbb{Z}_k$ twist. In this case one starts with the magnetic quiver $\mathsf{Q}'$ of the 5d theory, which contains $k$ identical simply-laced legs, and obtains the magnetic quiver $\mathsf{Q}$ of the $4d$ $\mathcal{N}=2$ theory by folding the $k$ legs of $\mathsf{Q}'$: \begin{equation} \mathcal{F}_k: Q' \mapsto Q \end{equation} where $\mathcal{F}_k$ is the action of folding $k$ identical legs. Remarkably, most of the $5d$ theories in question are all well known, simple theories. \paragraph{Hilbert series and chiral ring.} The Coulomb branch Hilbert series and refined plethystic logarithm (PL) of $\mathsf{Q}$ are given in Table \ref{resultHS}. The refined PL encodes information on the generators of the chiral ring and their relations \cite{Benvenuti:2006qr}. The first few positive terms are representations of the generators whereas the first few negative terms are the representations of the relations. Higher order terms are often higher syzygies. The terms at order $t^2$ transform in the adjoint representations of the global symmetry group \cite{1992math......4227B}. The $C_5$, $C_3 \times A_1$, and $C_2\times U_1$ magnetic quivers can be derived from $5d$ $\mathcal{N}=1$ SQCD magnetic quivers $\mathsf{Q}'$ through folding \cite{Ferlito:2017xdq}, as detailed in Section \ref{generalfamily} below. Therefore, one can expect that the highest order relations exist at order $t^{4\Delta_B}$ where $\Delta_B=3/2$ is the conformal dimension of the baryonic/instanton generators, see for example \cite[Sec.\ 2.2]{Ferlito:2017xdq}. As a result, there should be no relations beyond $t^6$. This is consistent with the fact that there are no negative terms in the PL at order $t^7$ and $t^8$. At higher orders, negative terms reemerge in the form of higher syzygies, i.e.\ relations between relations \cite{Benvenuti:2006qr}. As a result, for these three families, all the generators and relations can be seen in Table \ref{resultHS}. In contrast, the $A_3$, $A_1 \times U_1,$ and $A_2$ rank 1 SCFTs originate from folding more complicated magnetic quivers. For example, the $A_3$ magnetic quiver comes from the folding of the $T_4$ theory which has a diverse set of chiral ring relations \cite{Maruyoshi:2013hja}. Therefore, only some of the relations (up to $t^8$) are listed in Table \ref{resultHS}. \paragraph{Hasse diagrams.} The Higgs branch Hasse diagrams \cite{Bourget:2019aer} for the $4d$ $\mathcal{N}=2$ rank 1 theories with enhanced Coulomb branch are provided in \crefrange{tab:Hasse_C5}{tab:Hasse_A2}. The Higgs branches are symplectic singularities and, therefore, their geometric structure can be encoded in a Hasse diagram which details the symplectic leaves and transverse slices. To explore the Higgs branch of the rank 1 theories, one can study the $3d$ $\mathcal{N}=4$ Coulomb branch of their magnetic quivers. For the Hasse diagrams presented below, the quivers to the right are magnetic quivers whose Coulomb branch are closures of the symplectic leaves labeled by the symbol $\bullet$. The transverse slice between neighboring leaves is called an elementary slice and is labeled by a line segment. The elementary slices are also symplectic singularities and can be identified with the Coulomb branch of a quiver listed on the left of the line segment. The Hasse diagrams for the Higgs branches of the theories in the $\mathbb{Z}_1$ column of Table \ref{rank1table} are simple, as the Higgs branches are closures of minimal nilpotent orbits, and are not discussed below. In \cite{Cabrera:2016vvv,Cabrera:2017njm,Bourget:2019aer}, the elementary slices are taken to be either closures of minimal nilpotent orbits or Kleinian singularities. Quivers that are weighted affine Dynkin diagrams have Coulomb branches that are closures of minimal nilpotent orbits, see for example \cite[Tab.\ (12)]{Bourget:2019aer} for a list. In Table \ref{nilpotent} several new non-simply laced quivers, whose Coulomb branches are also closures of minimal nilpotent orbits, are presented. These quivers are necessary in performing quiver subtraction on the rank 1 magnetic quivers and their families as in Section \ref{generalfamily}. These new quivers arise as the $n=1$ members of the families presented in Section \ref{generalfamily}. Furthermore, new conjectured elementary slices, denoted as $h_{d,k}$, of the form of $\mathbb{H}^d/\mathbb{Z}_k$ orbifolds with $U(d)$ global symmetry (or $\mathrm{Sp}(d)$ for $k=2$), are presented in Appendix \ref{orbifoldappendix}. The Hasse diagram is constructed by taking the magnetic quiver of the rank 1 theory, at the top of the diagram, and \emph{subtracting} the quiver of the elementary slice. The resulting quiver has a Coulomb branch that is the closure of the \emph{minimal degeneration}, i.e.\ the leaf below. The prescription for \emph{quiver subtraction} is detailed in \cite{Cabrera:2016vvv,Cabrera:2017njm,Bourget:2019aer}. This process is repeated until one reaches the bottom/trivial leaf. When performing quiver subtraction on non-simply laced quivers it is important to align the squircles of the magnetic quiver and the slice to be subtracted. For example, one cannot subtract a quiver where the squircle is on a short node from a quiver where the squircle is on a long node and vice-versa. \cite[Eq.\ (36), Eq.\ (86)]{Apruzzi:2020pmv} makes a prediction of the dimension $d$ of the lower slice in the Hasse diagram. This is in full agreement with the results of this section. Also, \cite{Apruzzi:2020pmv} correctly identifies that away from the origin the moduli space looks flat, which is consistent with the fact that all lower slices are orbifolds of $\mathbb{H}^d$. Applying \cite[Eq.\ (86)]{Apruzzi:2020pmv} to the green and blue parts of Table \ref{rank1table} gives $d=1$. This is consistent with the observed property that these cases have accidentally enhanced supersymmetry, and that these spaces have Hasse diagrams with only 2 leaves as opposed to 3 for the other cases. Naturally, all these cases fit into infinite families on their own merit and are presented in Table \ref{orbifolds}. Following \cite{JuliusGrimminger} we conjecture the Hasse diagram of the full moduli space of the rank 1 theories, in 3 dimensions. We now turn to the analysis of each individual case. \subsection{\texorpdfstring{$C_5$}{C5} rank 1 SCFT} The global symmetry for this theory is $C_5$, the dimension of the Higgs branch is 16, and there is a generator of the chiral ring at $[00001]_{C_5}$ and scaling dimension $3/2$. These facts lead to a guess for a magnetic quiver among the minimally unbalanced quivers of \cite{Cabrera:2018uvz}, where the unbalanced node is attached to the last node. Luckily, the dimension of this moduli space is indeed 16 and the imbalance indeed leads to a scaling dimension $3/2$. The Hilbert series for the $C_5$ theory, see Table \ref{resultHS}, is consistent with the prediction in \cite[Sec.\ 2.1]{Ohmori:2018ona} obtained by compactifying on a torus with a non-trivial flavour background of the $6d$ $\mathcal{N}=(1,0)$ SCFT, which is the UV completion of an $\mathrm{SU}(2)$ gauge theory with 10 flavours. The Hasse diagram is given in Table \ref{tab:Hasse_C5} for the Higgs branch of the $4d$ $\mathcal{N}=2$ rank 1 theory as well as the full moduli space of the $3d$ $\mathcal{N}=4$ theory. Notice that the pure Coulomb branch is the leftmost point in the right diagram, which is the geometry $\mathbb{H}/E_6$ (Klein singularity of type $E_6$). This is included as a subvariety in the enhanced Coulomb branch, with transverse slice $c_5=h_{5,2}=\mathbb{H}^5/\mathbb{Z}_2$. This inclusion is the geometric translation of the fact that, in the notation of Section \ref{Nis2}, the 4d Coulomb branch which is of Kodaira type $II^{\ast}$ (with symmetry $E_8$) admits deformations to $\{I_1^6 , I_4\}$ and not $\{I_1^{10}\}$ as would be the case for the $E_8$ theory in Table \ref{rank1table}. \begin{table}[t] \centering \begin{tabular}{c||c} \toprule Hasse diagram for the & Hasse diagram for the full \\ Higgs branch of the 4d theory & moduli space of the 3d theory \\ \midrule \raisebox{-.5\height}{ \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=none] (41) at (-5, 0.25) {}; \node [style=none] (42) at (-5, -2.75) {}; \node [style=none] (43) at (-5, -6) {}; \node [style=bd] (44) at (-5, 0.25) {}; \node [style=bd] (45) at (-5, -2.75) {}; \node [style=bd] (46) at (-5, -6) {}; \node [style=none] (60) at (-11, -1) {$e_6$}; \node [style=none] (97) at (-11, -4) {$c_5$}; \node [style=gauge3] (171) at (0, 0.25) {}; \node [style=none] (172) at (0, -0.25) {4}; \node [style=gauge3] (173) at (-1, 0.25) {}; \node [style=none] (174) at (-1, -0.25) {3}; \node [style=gauge3] (175) at (1.15, 0.25) {}; \node [style=none] (176) at (1.15, -0.25) {5}; \node [style=none] (177) at (0.15, 0.325) {}; \node [style=none] (178) at (1.15, 0.325) {}; \node [style=none] (179) at (0.15, 0.175) {}; \node [style=none] (180) at (1.15, 0.175) {}; \node [style=none] (181) at (0.4, 0.25) {}; \node [style=none] (182) at (0.775, 0.625) {}; \node [style=none] (183) at (0.775, -0.125) {}; \node [style=gauge3] (184) at (1.9, 0.25) {}; \node [style=none] (185) at (1.9, -0.25) {2}; \node [style=gauge3] (186) at (-2, 0.25) {}; \node [style=gauge3] (187) at (-3, 0.25) {}; \node [style=none] (188) at (-3, -0.25) {1}; \node [style=none] (189) at (-2, -0.25) {2}; \node [style=gauge3] (190) at (-7.75, -1) {}; \node [style=none] (191) at (-7.75, -1.5) {3}; \node [style=gauge3] (192) at (-8.75, -1) {}; \node [style=none] (193) at (-8.75, -1.5) {2}; \node [style=gauge3] (194) at (-6.575, -1) {}; \node [style=none] (195) at (-6.575, -1.5) {4}; \node [style=none] (196) at (-7.575, -0.925) {}; \node [style=none] (197) at (-6.575, -0.925) {}; \node [style=none] (198) at (-7.575, -1.075) {}; \node [style=none] (199) at (-6.575, -1.075) {}; \node [style=none] (200) at (-7.325, -1) {}; \node [style=none] (201) at (-6.95, -0.625) {}; \node [style=none] (202) at (-6.95, -1.375) {}; \node [style=gauge3] (203) at (-5.825, -1) {}; \node [style=none] (204) at (-5.825, -1.5) {2}; \node [style=gauge3] (205) at (-9.75, -1) {}; \node [style=none] (208) at (-9.75, -1.5) {1}; \node [style=gauge3] (209) at (0, -3.25) {}; \node [style=none] (210) at (0, -3.75) {1}; \node [style=gauge3] (211) at (-1, -3.25) {}; \node [style=none] (212) at (-1, -3.75) {1}; \node [style=gauge3] (213) at (1.175, -3.25) {}; \node [style=none] (214) at (1.175, -3.75) {1}; \node [style=none] (215) at (0.175, -3.175) {}; \node [style=none] (216) at (1.175, -3.175) {}; \node [style=none] (217) at (0.175, -3.325) {}; \node [style=none] (218) at (1.175, -3.325) {}; \node [style=none] (219) at (0.425, -3.25) {}; \node [style=none] (220) at (0.8, -2.875) {}; \node [style=none] (221) at (0.8, -3.625) {}; \node [style=gauge3] (224) at (-2, -3.25) {}; \node [style=gauge3] (225) at (-3, -3.25) {}; \node [style=none] (226) at (-3, -3.75) {1}; \node [style=none] (227) at (-2, -3.75) {1}; \node [style=flavour2] (228) at (-3, -2.25) {}; \node [style=none] (229) at (-3, -1.75) {1}; \node [style=gauge3] (230) at (-7, -4.5) {}; \node [style=none] (231) at (-7, -5) {1}; \node [style=gauge3] (232) at (-8, -4.5) {}; \node [style=none] (233) at (-8, -5) {1}; \node [style=gauge3] (234) at (-5.825, -4.5) {}; \node [style=none] (235) at (-5.825, -5) {1}; \node [style=none] (236) at (-6.825, -4.425) {}; \node [style=none] (237) at (-5.825, -4.425) {}; \node [style=none] (238) at (-6.825, -4.575) {}; \node [style=none] (239) at (-5.825, -4.575) {}; \node [style=none] (240) at (-6.575, -4.5) {}; \node [style=none] (241) at (-6.2, -4.125) {}; \node [style=none] (242) at (-6.2, -4.875) {}; \node [style=gauge3] (243) at (-9, -4.5) {}; \node [style=gauge3] (244) at (-10, -4.5) {}; \node [style=none] (245) at (-10, -5) {1}; \node [style=none] (246) at (-9, -5) {1}; \node [style=flavour2] (247) at (-10, -3.5) {}; \node [style=none] (248) at (-10, -3) {1}; \node [style=blankflavor] (249) at (1.9, 0.25) {}; \node [style=blankflavor] (250) at (-5.825, -1) {}; \node [style=gauge3] (251) at (-1.5, -6) {}; \node [style=none] (252) at (-1.5, -6.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (44) to (45); \draw (45) to (46); \draw (177.center) to (178.center); \draw (180.center) to (179.center); \draw (182.center) to (181.center); \draw (181.center) to (183.center); \draw (184) to (175); \draw (173) to (171); \draw (187) to (186); \draw (186) to (173); \draw (196.center) to (197.center); \draw (199.center) to (198.center); \draw (201.center) to (200.center); \draw (200.center) to (202.center); \draw (203) to (194); \draw (192) to (190); \draw (205) to (192); \draw (215.center) to (216.center); \draw (218.center) to (217.center); \draw (220.center) to (219.center); \draw (219.center) to (221.center); \draw (211) to (209); \draw (225) to (224); \draw (224) to (211); \draw (228) to (225); \draw (236.center) to (237.center); \draw (239.center) to (238.center); \draw (241.center) to (240.center); \draw (240.center) to (242.center); \draw (232) to (230); \draw (244) to (243); \draw (243) to (232); \draw (247) to (244); \end{pgfonlayer} \end{tikzpicture}} } & \raisebox{-.5\height}{\scalebox{.7}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=bd] (0) at (-1.5, 2) {}; \node [style=bd] (1) at (1.5, 2) {}; \node [style=bd] (2) at (0, 0) {}; \node [style=none] (3) at (1.25, 1) {$c_5$}; \node [style=none] (4) at (-1.25, 0.75) {$E_6$}; \node [style=bd] (5) at (0, 4) {}; \node [style=bd] (6) at (3, 4) {}; \node [style=none] (7) at (2.75, 2.75) {$e_6$}; \node [style=none] (8) at (1.25, 3.25) {$E_6$}; \node [style=none] (9) at (-1.45, 3.25) {$h_{5,2}=c_5$}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw [style=blue] (2) to (1); \draw [style=red] (2) to (0); \draw [style=blue] (0) to (5); \draw [style=red] (1) to (5); \draw [style=blue] (1) to (6); \end{pgfonlayer} \end{tikzpicture}}} \\ \bottomrule \end{tabular} \caption{$C_5$ theory. \texttt{Left:} Hasse diagram for the Higgs branch of the $4d$ $\mathcal{N}=2$ rank 1 theory. To the right of the Hasse diagram are the magnetic quivers for the closures of the leaves and to the left are magnetic quivers for the slices. This Hasse diagram is already explored in \cite{Bourget:2019aer,JuliusGrimminger}. \texttt{Right:} Hasse diagram for the full moduli space of the theory in $3d$ $\mathcal{N}=4$. } \label{tab:Hasse_C5} \end{table} \subsection{\texorpdfstring{$C_3 \times A_1$}{C3 x A1} rank 1 SCFT} The computation in Table \ref{resultHS} agrees with the Hilbert series computation in \cite[Eq.\ (40)]{Zafrir:2016wkk}. The approach is as follows: The Higgs branches of the $5d$ $\mathcal{N}=1$ theories $T_2$ and $T_3$ have a $\mathbb{Z}_2$ symmetry that we can twist by. Both of the resulting Higgs branches, $T_{2}^{\mathbb{Z}_2 \mathrm{twisted}}$ and $T_{3}^{\mathbb{Z}_2 \mathrm{twisted}}$, have an $SU(2)$ isometry subgroup. Hence, the diagonal $SU(2)$ can be gauged such that the resulting Higgs branch, $T_{2}^{\mathbb{Z}_2 \mathrm{twisted}} \times_{SU(2)} T_{3}^{\mathbb{Z}_2 \mathrm{twisted}}$, becomes the Higgs branch of the $C_3 \times A_1$ rank 1 SCFT. Consequently, the Higgs branch is given by the hyper-K\"ahler quotient \begin{align} \mathcal{H}\left(C_3 \times A_1 \text{ SCFT}\right) = \left( \mathcal{H}\left(T_{2}^{\mathbb{Z}_2 \mathrm{twisted}}\right) \times \mathcal{H}\left( T_{3}^{\mathbb{Z}_2 \mathrm{twisted}}\right) \right) /// SU(2) \,. \end{align} One can equivalently perform this gauging process from the point of view of magnetic quivers. The $\mathcal{F}_2$ folding of the magnetic quivers for the $5d$ $\mathcal{N}=1$ theories $T_2$ and $T_3$ proceeds as follows: \begin{equation} \raisebox{-.5\height}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=none] (0) at (0.75, 5) {$T_3$}; \node [style=gauge3] (1) at (4, 3) {}; \node [style=gauge3] (2) at (4, 4) {}; \node [style=gauge3] (3) at (4, 5) {}; \node [style=gauge3] (4) at (5, 3) {}; \node [style=gauge3] (5) at (6, 3) {}; \node [style=gauge3] (6) at (3, 3) {}; \node [style=gauge3] (7) at (2, 3) {}; \node [style=none] (8) at (2, 2.5) {1}; \node [style=none] (9) at (3, 2.5) {2}; \node [style=none] (10) at (4, 2.5) {3}; \node [style=none] (11) at (5, 2.5) {2}; \node [style=none] (12) at (6, 2.5) {1}; \node [style=none] (13) at (4.5, 4) {2}; \node [style=none] (14) at (4.5, 5) {1}; \node [style=none] (15) at (-4.75, 5) {$T_2$}; \node [style=gauge3] (16) at (-2.75, 3) {}; \node [style=gauge3] (17) at (-2.75, 4) {}; \node [style=gauge3] (19) at (-1.75, 3) {}; \node [style=gauge3] (21) at (-3.75, 3) {}; \node [style=none] (24) at (-3.75, 2.5) {1}; \node [style=none] (25) at (-2.75, 2.5) {2}; \node [style=none] (26) at (-1.75, 2.5) {1}; \node [style=none] (28) at (-2.25, 4) {1}; \node [style=none] (29) at (-2.75, 1.5) {}; \node [style=none] (30) at (-2.75, 0) {}; \node [style=none] (31) at (4, 1.5) {}; \node [style=none] (32) at (4, 0) {}; \node [style=none] (33) at (-2.25, 0.75) {$\mathcal{F}_2$}; \node [style=none] (34) at (4.5, 0.75) {$\mathcal{F}_2$}; \node [style=gauge3] (38) at (-3.75, -1) {}; \node [style=none] (39) at (-3.75, -1.5) {1}; \node [style=gauge3] (52) at (1.85, -1) {}; \node [style=none] (53) at (1.85, -1.5) {1}; \node [style=gauge3] (98) at (-1.85, -1) {}; \node [style=none] (99) at (-1.85, -1.5) {1}; \node [style=none] (100) at (-2.85, -0.925) {}; \node [style=none] (101) at (-1.85, -0.925) {}; \node [style=none] (102) at (-2.85, -1.075) {}; \node [style=none] (103) at (-1.85, -1.075) {}; \node [style=none] (104) at (-2.175, -1) {}; \node [style=none] (105) at (-2.55, -0.625) {}; \node [style=none] (106) at (-2.55, -1.375) {}; \node [style=gauge3] (107) at (-2.75, -1) {}; \node [style=none] (108) at (-2.75, -1.5) {2}; \node [style=gauge3] (109) at (3, -1) {}; \node [style=none] (110) at (3, -1.5) {2}; \node [style=gauge3] (111) at (4.9, -1) {}; \node [style=none] (112) at (4.9, -1.5) {2}; \node [style=none] (113) at (3.9, -0.925) {}; \node [style=none] (114) at (4.9, -0.925) {}; \node [style=none] (115) at (3.9, -1.075) {}; \node [style=none] (116) at (4.9, -1.075) {}; \node [style=none] (117) at (4.575, -1) {}; \node [style=none] (118) at (4.2, -0.625) {}; \node [style=none] (119) at (4.2, -1.375) {}; \node [style=gauge3] (120) at (4, -1) {}; \node [style=none] (121) at (4, -1.5) {3}; \node [style=gauge3] (122) at (5.85, -1) {}; \node [style=none] (123) at (5.85, -1.5) {1}; \node [style=none] (124) at (-4.75, -1) {$\mathcal{C}$}; \node [style=none] (125) at (-4, 0) {}; \node [style=none] (126) at (-4, -2) {}; \node [style=none] (127) at (1.5, 0) {}; \node [style=none] (128) at (1.5, -2) {}; \node [style=none] (129) at (6.25, 0) {}; \node [style=none] (130) at (6.25, -2) {}; \node [style=none] (131) at (-1.75, 0) {}; \node [style=none] (132) at (-1.75, -2) {}; \node [style=none] (133) at (0.75, -1) {$\mathcal{C}$}; \node [style=none] (134) at (-0.75, 3.25) {=\;$\mathbb{H}^4$}; \node [style=none] (135) at (7.5, -1) {=\;$\overline{\mathcal{O}}^{\mathfrak{f}_4}_{\text{min}}$}; \node [style=blankflavor] (136) at (-2.75, -1) {}; \node [style=blankflavor] (137) at (4, -1) {}; \node [style=none] (138) at (-4.75, 3.25) {$\mathcal{C}$}; \node [style=none] (139) at (-4, 4.25) {}; \node [style=none] (140) at (-4, 2.25) {}; \node [style=none] (141) at (-1.75, 4.25) {}; \node [style=none] (142) at (-1.75, 2.25) {}; \node [style=none] (143) at (1.5, 4.25) {}; \node [style=none] (144) at (1.5, 2.25) {}; \node [style=none] (145) at (6.25, 4.25) {}; \node [style=none] (146) at (6.25, 2.25) {}; \node [style=none] (147) at (0.75, 3.25) {$\mathcal{C}$}; \node [style=none] (148) at (-0.75, -1) {=\;$\mathbb{H}^3$}; \node [style=none] (149) at (7.5, 3.25) {=\;$\overline{\mathcal{O}}^{\mathfrak{e}_6}_{\text{min}}$}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (3) to (2); \draw (2) to (1); \draw (1) to (4); \draw (4) to (5); \draw (6) to (1); \draw (7) to (6); \draw (17) to (16); \draw (16) to (19); \draw (21) to (16); \draw [style=->] (29.center) to (30.center); \draw [style=->] (31.center) to (32.center); \draw (100.center) to (101.center); \draw (103.center) to (102.center); \draw (105.center) to (104.center); \draw (104.center) to (106.center); \draw (38) to (107); \draw (113.center) to (114.center); \draw (116.center) to (115.center); \draw (118.center) to (117.center); \draw (117.center) to (119.center); \draw (109) to (120); \draw (109) to (52); \draw (122) to (111); \draw [bend right=45] (125.center) to (126.center); \draw [bend right=45] (127.center) to (128.center); \draw [bend left=60] (129.center) to (130.center); \draw [bend left=60] (131.center) to (132.center); \draw [bend right=45] (139.center) to (140.center); \draw [bend left=60] (141.center) to (142.center); \draw [bend right=45] (143.center) to (144.center); \draw [bend left=60] (145.center) to (146.center); \end{pgfonlayer} \end{tikzpicture} } \end{equation} The folded theories, with the $U(1)$ ungauged on a long node, have Coulomb branches $\mathbb{H}^3$ with $Sp(3)$ global symmetry and the closure of the minimal nilpotent orbit of $F_4$ respectively. Following the prescription in \cite{Hanany:2018vph}, the gauging of an $SU(2)$ subgroup of the Coulomb branch global symmetry of the two magnetic quivers is performed as follows: \begin{equation} \raisebox{-.5\height}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (38) at (-1.75, -1.25) {}; \node [style=none] (39) at (-1.75, -1.75) {1}; \node [style=gauge3] (52) at (1.85, -1.25) {}; \node [style=none] (53) at (1.85, -1.75) {1}; \node [style=gauge3] (98) at (-4.1, -1.25) {}; \node [style=none] (99) at (-4.1, -1.75) {1}; \node [style=none] (100) at (-3.1, -1.175) {}; \node [style=none] (101) at (-4.1, -1.175) {}; \node [style=none] (102) at (-3.1, -1.325) {}; \node [style=none] (103) at (-4.1, -1.325) {}; \node [style=none] (104) at (-3.675, -1.25) {}; \node [style=none] (105) at (-3.3, -0.875) {}; \node [style=none] (106) at (-3.3, -1.625) {}; \node [style=gauge3] (107) at (-3, -1.25) {}; \node [style=none] (108) at (-3, -1.75) {2}; \node [style=gauge3] (109) at (3, -1.25) {}; \node [style=none] (110) at (3, -1.75) {2}; \node [style=gauge3] (111) at (4.9, -1.25) {}; \node [style=none] (112) at (4.9, -1.75) {2}; \node [style=none] (113) at (3.9, -1.175) {}; \node [style=none] (114) at (4.9, -1.175) {}; \node [style=none] (115) at (3.9, -1.325) {}; \node [style=none] (116) at (4.9, -1.325) {}; \node [style=none] (117) at (4.575, -1.25) {}; \node [style=none] (118) at (4.2, -0.875) {}; \node [style=none] (119) at (4.2, -1.625) {}; \node [style=gauge3] (120) at (4, -1.25) {}; \node [style=none] (121) at (4, -1.75) {3}; \node [style=gauge3] (122) at (5.85, -1.25) {}; \node [style=none] (123) at (5.85, -1.75) {1}; \node [style=none] (124) at (-2.35, -0.5) {}; \node [style=none] (125) at (-2.35, -2) {}; \node [style=none] (126) at (-1.1, -2) {}; \node [style=none] (127) at (-1.1, -0.5) {}; \node [style=none] (128) at (-1.75, -0.25) {\color{red}{ $\mathrm{SU}(2)$}}; \node [style=none] (129) at (1.85, -0.25) {\color{red}{ $\mathrm{SU}(2)$}}; \node [style=none] (130) at (1.25, -0.5) {}; \node [style=none] (131) at (1.25, -2) {}; \node [style=none] (132) at (2.5, -2) {}; \node [style=none] (133) at (2.5, -0.5) {}; \node [style=none] (134) at (-1.75, -2.25) {}; \node [style=none] (135) at (2, -2.25) {}; \node [style=none] (136) at (1.3, -3.5) {Gauge $SU(2)$}; \node [style=none] (137) at (0.125, -2.8) {}; \node [style=none] (138) at (0.125, -4.25) {}; \node [style=gauge3] (143) at (2.15, -5.25) {}; \node [style=none] (144) at (2.15, -5.75) {2}; \node [style=none] (145) at (1.15, -5.175) {}; \node [style=none] (146) at (2.15, -5.175) {}; \node [style=none] (147) at (1.15, -5.325) {}; \node [style=none] (148) at (2.15, -5.325) {}; \node [style=none] (149) at (1.825, -5.25) {}; \node [style=none] (150) at (1.45, -4.875) {}; \node [style=none] (151) at (1.45, -5.625) {}; \node [style=gauge3] (152) at (1.25, -5.25) {}; \node [style=none] (153) at (1.25, -5.75) {3}; \node [style=gauge3] (154) at (3.1, -5.25) {}; \node [style=none] (155) at (3.1, -5.75) {1}; \node [style=gauge3] (156) at (-1, -5.25) {}; \node [style=none] (157) at (-1, -5.75) {1}; \node [style=none] (158) at (0, -5.175) {}; \node [style=none] (159) at (-1, -5.175) {}; \node [style=none] (160) at (0, -5.325) {}; \node [style=none] (161) at (-1, -5.325) {}; \node [style=none] (162) at (-0.575, -5.25) {}; \node [style=none] (163) at (-0.2, -4.875) {}; \node [style=none] (164) at (-0.2, -5.625) {}; \node [style=gauge3] (165) at (0.1, -5.25) {}; \node [style=none] (166) at (0.1, -5.75) {2}; \node [style=none] (168) at (-1.3, -4.25) {}; \node [style=none] (169) at (-1.3, -6.25) {}; \node [style=none] (170) at (-2.05, -5.25) {$\mathcal{C}$}; \node [style=none] (171) at (3.45, -4.25) {}; \node [style=none] (172) at (3.45, -6.25) {}; \node [style=none] (174) at (6.35, -5.25) {$=\mathcal{H}(C_3\times A_1 \;\mathrm{SCFT} )$}; \node [style=blankflavor] (175) at (1.25, -5.25) {}; \node [style=blankflavor] (176) at (4, -1.25) {}; \node [style=blankflavor] (177) at (-3, -1.25) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (100.center) to (101.center); \draw (103.center) to (102.center); \draw (105.center) to (104.center); \draw (104.center) to (106.center); \draw (38) to (107); \draw (113.center) to (114.center); \draw (116.center) to (115.center); \draw (118.center) to (117.center); \draw (117.center) to (119.center); \draw (109) to (120); \draw (109) to (52); \draw (122) to (111); \draw [style=dotted, red] (124.center) to (127.center); \draw [style=dotted, draw=red] (127.center) to (126.center); \draw [style=dotted, red] (126.center) to (125.center); \draw [style=dotted, red] (125.center) to (124.center); \draw [style=dotted, red] (130.center) to (133.center); \draw [style=dotted, red] (133.center) to (132.center); \draw [style=dotted, red] (132.center) to (131.center); \draw [style=dotted, red] (131.center) to (130.center); \draw [style=<->, bend right] (134.center) to (135.center); \draw [style=->] (137.center) to (138.center); \draw (145.center) to (146.center); \draw (148.center) to (147.center); \draw (150.center) to (149.center); \draw (149.center) to (151.center); \draw (154) to (143); \draw (158.center) to (159.center); \draw (161.center) to (160.center); \draw (163.center) to (162.center); \draw (162.center) to (164.center); \draw (165) to (152); \draw [bend right=45] (168.center) to (169.center); \draw [bend left=45] (171.center) to (172.center); \end{pgfonlayer} \end{tikzpicture} } \label{gluing} \end{equation} which provides the magnetic quiver of the $C_3\times A_1$ theory. \begin{table}[t] \centering \begin{tabular}{c||c} \toprule Hasse diagram for the & Hasse diagram for the full \\ Higgs branch of the 4d theory & moduli space of the 3d theory \\ \midrule \raisebox{-.5\height}{ \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=none] (41) at (-5, 0.25) {}; \node [style=none] (42) at (-5, -2.75) {}; \node [style=none] (43) at (-5, -6) {}; \node [style=bd] (44) at (-5, 0.25) {}; \node [style=bd] (45) at (-5, -2.75) {}; \node [style=bd] (46) at (-5, -6) {}; \node [style=none] (60) at (-11, -1) {$d_4$}; \node [style=none] (97) at (-10.925, -4.5) {$c_3$}; \node [style=gauge3] (308) at (-2.35, 0.25) {}; \node [style=none] (309) at (-2.35, -0.25) {2}; \node [style=gauge3] (310) at (-3.35, 0.25) {}; \node [style=none] (311) at (-3.35, -0.25) {1}; \node [style=gauge3] (312) at (-1.175, 0.25) {}; \node [style=none] (313) at (-1.175, -0.25) {3}; \node [style=none] (314) at (-2.175, 0.325) {}; \node [style=none] (315) at (-1.175, 0.325) {}; \node [style=none] (316) at (-2.175, 0.175) {}; \node [style=none] (317) at (-1.175, 0.175) {}; \node [style=none] (318) at (-1.925, 0.25) {}; \node [style=none] (319) at (-1.55, 0.625) {}; \node [style=none] (320) at (-1.55, -0.125) {}; \node [style=gauge3] (321) at (-0.425, 0.25) {}; \node [style=none] (322) at (-0.425, -0.25) {2}; \node [style=gauge3] (323) at (0.775, 0.25) {}; \node [style=none] (324) at (-0.425, 0.325) {}; \node [style=none] (325) at (0.775, 0.325) {}; \node [style=none] (326) at (-0.425, 0.175) {}; \node [style=none] (327) at (0.775, 0.175) {}; \node [style=none] (328) at (0.325, 0.25) {}; \node [style=none] (329) at (-0.05, 0.625) {}; \node [style=none] (330) at (-0.05, -0.125) {}; \node [style=none] (331) at (0.775, -0.25) {1}; \node [style=gauge3] (386) at (-8.975, -1) {}; \node [style=none] (387) at (-8.975, -1.5) {1}; \node [style=gauge3] (390) at (-7.8, -1) {}; \node [style=none] (391) at (-7.8, -1.5) {2}; \node [style=none] (392) at (-8.8, -0.925) {}; \node [style=none] (393) at (-7.8, -0.925) {}; \node [style=none] (394) at (-8.8, -1.075) {}; \node [style=none] (395) at (-7.8, -1.075) {}; \node [style=none] (396) at (-8.55, -1) {}; \node [style=none] (397) at (-8.175, -0.625) {}; \node [style=none] (398) at (-8.175, -1.375) {}; \node [style=gauge3] (399) at (-7.05, -1) {}; \node [style=none] (400) at (-7.05, -1.5) {2}; \node [style=gauge3] (401) at (-5.85, -1) {}; \node [style=none] (402) at (-7.05, -0.925) {}; \node [style=none] (403) at (-5.85, -0.925) {}; \node [style=none] (404) at (-7.05, -1.075) {}; \node [style=none] (405) at (-5.85, -1.075) {}; \node [style=none] (406) at (-6.3, -1) {}; \node [style=none] (407) at (-6.675, -0.625) {}; \node [style=none] (408) at (-6.675, -1.375) {}; \node [style=none] (409) at (-5.85, -1.5) {1}; \node [style=gauge3] (410) at (-1.35, -2.775) {}; \node [style=none] (411) at (-1.35, -3.275) {1}; \node [style=gauge3] (412) at (-0.175, -2.775) {}; \node [style=none] (413) at (-0.175, -3.275) {1}; \node [style=none] (414) at (-1.175, -2.7) {}; \node [style=none] (415) at (-0.175, -2.7) {}; \node [style=none] (416) at (-1.175, -2.85) {}; \node [style=none] (417) at (-0.175, -2.85) {}; \node [style=none] (418) at (-0.925, -2.775) {}; \node [style=none] (419) at (-0.55, -2.4) {}; \node [style=none] (420) at (-0.55, -3.15) {}; \node [style=blankflavor] (434) at (-1.175, 0.25) {}; \node [style=blankflavor] (435) at (-7.8, -1) {}; \node [style=gauge3] (454) at (-2.5, -2.775) {}; \node [style=none] (455) at (-2.5, -3.275) {1}; \node [style=flavour2] (456) at (-2.5, -1.775) {}; \node [style=none] (457) at (-2.5, -1.25) {1}; \node [style=gauge3] (458) at (-7.075, -4.775) {}; \node [style=none] (459) at (-7.075, -5.275) {1}; \node [style=gauge3] (460) at (-5.9, -4.775) {}; \node [style=none] (461) at (-5.9, -5.275) {1}; \node [style=none] (462) at (-6.9, -4.7) {}; \node [style=none] (463) at (-5.9, -4.7) {}; \node [style=none] (464) at (-6.9, -4.85) {}; \node [style=none] (465) at (-5.9, -4.85) {}; \node [style=none] (466) at (-6.65, -4.775) {}; \node [style=none] (467) at (-6.275, -4.4) {}; \node [style=none] (468) at (-6.275, -5.15) {}; \node [style=gauge3] (469) at (-8.225, -4.775) {}; \node [style=none] (470) at (-8.225, -5.275) {1}; \node [style=flavour2] (471) at (-8.225, -3.775) {}; \node [style=none] (472) at (-8.225, -3.25) {1}; \node [style=gauge3] (473) at (-1.75, -6) {}; \node [style=none] (474) at (-1.75, -6.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (44) to (45); \draw (45) to (46); \draw (314.center) to (315.center); \draw (317.center) to (316.center); \draw (319.center) to (318.center); \draw (318.center) to (320.center); \draw (321) to (312); \draw (324.center) to (325.center); \draw (327.center) to (326.center); \draw (329.center) to (328.center); \draw (328.center) to (330.center); \draw (310) to (308); \draw (392.center) to (393.center); \draw (395.center) to (394.center); \draw (397.center) to (396.center); \draw (396.center) to (398.center); \draw (399) to (390); \draw (402.center) to (403.center); \draw (405.center) to (404.center); \draw (407.center) to (406.center); \draw (406.center) to (408.center); \draw (414.center) to (415.center); \draw (417.center) to (416.center); \draw (419.center) to (418.center); \draw (418.center) to (420.center); \draw (456) to (454); \draw (454) to (410); \draw (462.center) to (463.center); \draw (465.center) to (464.center); \draw (467.center) to (466.center); \draw (466.center) to (468.center); \draw (471) to (469); \draw (469) to (458); \end{pgfonlayer} \end{tikzpicture}} } & \raisebox{-.37\height}{\scalebox{.7}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=bd] (0) at (-1.5, 2) {}; \node [style=bd] (1) at (1.5, 2) {}; \node [style=bd] (2) at (0, 0) {}; \node [style=none] (3) at (1.25, 1) {$c_3$}; \node [style=none] (4) at (-1.25, 0.75) {$D_4$}; \node [style=bd] (5) at (0, 4) {}; \node [style=bd] (6) at (3, 4) {}; \node [style=none] (7) at (2.75, 2.75) {$d_4$}; \node [style=none] (9) at (-1.45, 3.25) {$h_{3,2}=c_3$}; \node [style=none] (10) at (1.25, 3.25) {$D_4$}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw [style=blue] (2) to (1); \draw [style=red] (2) to (0); \draw [style=blue] (0) to (5); \draw [style=red] (1) to (5); \draw [style=blue] (1) to (6); \end{pgfonlayer} \end{tikzpicture}}} \\ \bottomrule \end{tabular} \caption{$C_3\times A_1$ theory. \texttt{Left:} Hasse diagram for the Higgs branch of the $4d$ $\mathcal{N}=2$ rank 1 theory. To the right of the Hasse diagram are the magnetic quivers for the closures of the leaves and to the left are magnetic quivers for the slices. \texttt{Right:} Hasse diagram for the full moduli space of the theory in $3d$ $\mathcal{N}=4$. } \label{tab:Hasse_C3xA1} \end{table} The Hasse diagram for the Higgs branch of this $4d$ $\mathcal{N}=2$ rank 1 theory is given in Table \ref{tab:Hasse_C3xA1}. As detailed in \cite{Bourget:2019aer}, the non-abelian part of the global symmetry of a magnetic quiver can be identified by taking the product of the global symmetry of the slices connected to the trivial leaf $\{1\}$. In this case, however, there is only one such slice which is the minimal nilpotent orbit $c_3$. The absence of an $A_1$ slice connecting to the trivial leaf may indicate additional rules required for quiver subtraction of non-simply laced quivers or that only a subgroup of the global symmetry can be read off from the Hasse diagram. The full moduli space of the $3d$ $\mathcal{N}=4$ theory is also tabulated in Table \ref{tab:Hasse_C3xA1}. \subsection{\texorpdfstring{$C_2 \times U_1$}{C2 x U1} rank 1 SCFT} For this case we note that the global symmetry is $C_2 \times U_1$ and there is a simple way of getting the magnetic quiver by attaching 2 nodes of 1 to the $C_2$ quiver as in Table \ref{resulttable}. Nicely enough this guess verifies that the dimension is 4 and the two generators in the chiral ring are in $[01]_{C_2}$ with scaling dimension $3/2$ and $U(1)$ charges $\pm1$, respectively. The Hilbert series results of Table \ref{resultHS} agree with \cite[Sec.\ 3.3]{Chacaltana:2014nya} which obtain the rank 1 theory as the class $\mathcal{S}$ theory of a sphere with a minimal untwisted $A_2$ puncture and two maximal twisted $A_2$ punctures connected with a cylinder with a $\mathbb{Z}_2$ twist line. \begin{table}[t] \centering \begin{tabular}{c||c} \toprule Hasse diagram for the & Hasse diagram for the full \\ Higgs branch of the 4d theory & moduli space of the 3d theory \\ \midrule \raisebox{-.5\height}{ \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=none] (41) at (-5, 0.25) {}; \node [style=none] (42) at (-5, -2.75) {}; \node [style=none] (43) at (-5, -6) {}; \node [style=bd] (44) at (-5, 0.25) {}; \node [style=bd] (45) at (-5, -2.75) {}; \node [style=bd] (46) at (-5, -6) {}; \node [style=none] (60) at (-11, -1) {$a_2$}; \node [style=none] (97) at (-11, -4) {$c_2$}; \node [style=gauge3] (251) at (-3.35, 0.25) {}; \node [style=none] (252) at (-3.35, -0.25) {1}; \node [style=gauge3] (253) at (-2.1, 0.25) {}; \node [style=none] (254) at (-2.1, -0.25) {2}; \node [style=none] (255) at (-3.35, 0.325) {}; \node [style=none] (256) at (-2.1, 0.325) {}; \node [style=none] (257) at (-3.35, 0.175) {}; \node [style=none] (258) at (-2.1, 0.175) {}; \node [style=none] (259) at (-2.85, 0.25) {}; \node [style=none] (260) at (-2.475, 0.625) {}; \node [style=none] (261) at (-2.475, -0.125) {}; \node [style=gauge3] (262) at (-1.1, 0.75) {}; \node [style=gauge3] (263) at (-1.1, -0.25) {}; \node [style=none] (264) at (-0.6, 0.75) {1}; \node [style=none] (265) at (-0.6, -0.25) {1}; \node [style=blankflavor] (266) at (-2.1, 0.25) {}; \node [style=gauge3] (269) at (-8.075, -1) {}; \node [style=none] (270) at (-8.075, -1.5) {1}; \node [style=none] (272) at (-8.075, -0.925) {}; \node [style=none] (274) at (-8.075, -1.075) {}; \node [style=gauge3] (278) at (-7.075, -0.5) {}; \node [style=gauge3] (279) at (-7.075, -1.5) {}; \node [style=none] (280) at (-6.575, -0.5) {1}; \node [style=none] (281) at (-6.575, -1.5) {1}; \node [style=gauge3] (282) at (-3.35, -3.25) {}; \node [style=none] (283) at (-3.35, -3.75) {1}; \node [style=gauge3] (284) at (-2.1, -3.25) {}; \node [style=none] (285) at (-2.1, -3.75) {1}; \node [style=none] (286) at (-3.35, -3.175) {}; \node [style=none] (287) at (-2.1, -3.175) {}; \node [style=none] (288) at (-3.35, -3.325) {}; \node [style=none] (289) at (-2.1, -3.325) {}; \node [style=none] (290) at (-2.85, -3.25) {}; \node [style=none] (291) at (-2.475, -2.875) {}; \node [style=none] (292) at (-2.475, -3.625) {}; \node [style=flavour2] (293) at (-3.35, -2.25) {}; \node [style=none] (294) at (-3.35, -1.75) {1}; \node [style=gauge3] (295) at (-8.1, -4.75) {}; \node [style=none] (296) at (-8.1, -5.25) {1}; \node [style=gauge3] (297) at (-6.85, -4.75) {}; \node [style=none] (298) at (-6.85, -5.25) {1}; \node [style=none] (299) at (-8.1, -4.675) {}; \node [style=none] (300) at (-6.85, -4.675) {}; \node [style=none] (301) at (-8.1, -4.825) {}; \node [style=none] (302) at (-6.85, -4.825) {}; \node [style=none] (303) at (-7.6, -4.75) {}; \node [style=none] (304) at (-7.225, -4.375) {}; \node [style=none] (305) at (-7.225, -5.125) {}; \node [style=flavour2] (306) at (-8.1, -3.75) {}; \node [style=none] (307) at (-8.1, -3.25) {1}; \node [style=gauge3] (308) at (-3, -6) {}; \node [style=none] (309) at (-3, -6.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (44) to (45); \draw (45) to (46); \draw (255.center) to (256.center); \draw (258.center) to (257.center); \draw (260.center) to (259.center); \draw (259.center) to (261.center); \draw (262) to (258.center); \draw (263) to (256.center); \draw (262) to (263); \draw (278) to (274.center); \draw (279) to (272.center); \draw (278) to (279); \draw (286.center) to (287.center); \draw (289.center) to (288.center); \draw (291.center) to (290.center); \draw (290.center) to (292.center); \draw (293) to (288.center); \draw (299.center) to (300.center); \draw (302.center) to (301.center); \draw (304.center) to (303.center); \draw (303.center) to (305.center); \draw (306) to (301.center); \end{pgfonlayer} \end{tikzpicture}} } & \raisebox{-.5\height}{\scalebox{.7}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=bd] (0) at (-1.5, 2) {}; \node [style=bd] (1) at (1.5, 2) {}; \node [style=bd] (2) at (0, 0) {}; \node [style=none] (3) at (1.25, 1) {$c_2$}; \node [style=none] (4) at (-1.25, 0.75) {$A_2$}; \node [style=bd] (5) at (0, 4) {}; \node [style=bd] (6) at (3, 4) {}; \node [style=none] (7) at (2.75, 2.75) {$a_2$}; \node [style=none] (9) at (-1.45, 3.25) {$h_{2,2}=c_2$}; \node [style=none] (10) at (1.25, 3.25) {$A_2$}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw [style=blue] (2) to (1); \draw [style=red] (2) to (0); \draw [style=blue] (0) to (5); \draw [style=red] (1) to (5); \draw [style=blue] (1) to (6); \end{pgfonlayer} \end{tikzpicture}}} \\ \bottomrule \end{tabular} \caption{$C_2\times U_1$ theory. \texttt{Left:} Hasse diagram for the Higgs branch of the $4d$ $\mathcal{N}=2$ rank 1 theory. To the right of the Hasse diagram are the magnetic quivers for the closures of the leaves and to the left are magnetic quivers for the slices. \texttt{Right:} Hasse diagram for the full moduli space of the theory in $3d$ $\mathcal{N}=4$. } \label{tab:Hasse_C2xU1} \end{table} The Hasse diagram is given in Table \ref{tab:Hasse_C2xU1} for the Higgs branch of the $4d$ $\mathcal{N}=2$ rank 1 theory as well as the full moduli space of the $3d$ $\mathcal{N}=4$ theory. \subsection{\texorpdfstring{$A_3$}{A3} rank 1 SCFT} For this case, the global symmetry and the $Z_3$ twist lead to a very natural guess of folding a theory that has an $SU(4)^3$ global symmetry. There is a very natural candidate for such a theory. The so called $T_4$ theory. This leads to the guess as in Table \ref{resulttable}. This guess is verified by a set of consistency checks like the dimension of the Higgs branch, the generators in the chiral ring, etc. The Hilbert series in Table \ref{resultHS} is consistent with the prediction of \cite[Eq.\ 5.7]{Chacaltana:2016shw} obtained by a class $\mathcal{S}$ construction of compactifying a $\mathbb{Z}_3$ twisted $D_4$ theory. Moreover, the result also agrees with the prediction in \cite[Sec.\ 2.2]{Ohmori:2018ona} obtained by compactifying on a torus with a non-trivial flavour background of the $6d$ $\mathcal{N}=(1,0)$ SCFT, which is the UV completion of an $\mathrm{SU}(3)$ gauge theory with 12 flavours. The Hasse diagram is given in Table \ref{tab:Hasse_A3} for the Higgs branch of the $4d$ $\mathcal{N}=2$ rank 1 theory as well as the full moduli space of the $3d$ $\mathcal{N}=4$ theory. \begin{table}[t] \centering \begin{tabular}{c||c} \toprule Hasse diagram for the & Hasse diagram for the full \\ Higgs branch of the 4d theory & moduli space of the 3d theory \\ \midrule \raisebox{-.5\height}{ \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0.25) {}; \node [style=none] (6) at (-1, -0.25) {3}; \node [style=gauge3] (24) at (0.5, 0.25) {}; \node [style=none] (29) at (0.5, -0.25) {4}; \node [style=none] (30) at (-1, 0.4) {}; \node [style=none] (31) at (0.5, 0.4) {}; \node [style=none] (32) at (-1, 0.1) {}; \node [style=none] (33) at (0.5, 0.1) {}; \node [style=none] (34) at (-0.5, 0.25) {}; \node [style=none] (35) at (0, 0.75) {}; \node [style=none] (36) at (0, -0.25) {}; \node [style=gauge3] (37) at (-2, 0.25) {}; \node [style=gauge3] (38) at (-3, 0.25) {}; \node [style=none] (39) at (-2, -0.25) {2}; \node [style=none] (40) at (-3, -0.25) {1}; \node [style=none] (41) at (-5, 0.25) {}; \node [style=none] (42) at (-5, -2.75) {}; \node [style=none] (43) at (-5, -6) {}; \node [style=bd] (44) at (-5, 0.25) {}; \node [style=bd] (45) at (-5, -2.75) {}; \node [style=bd] (46) at (-5, -6) {}; \node [style=gauge3] (47) at (-7.25, -1.25) {}; \node [style=none] (48) at (-7.25, -1.75) {2}; \node [style=gauge3] (49) at (-5.75, -1.25) {}; \node [style=none] (50) at (-5.75, -1.75) {3}; \node [style=none] (51) at (-7.25, -1.1) {}; \node [style=none] (52) at (-5.75, -1.1) {}; \node [style=none] (53) at (-7.25, -1.4) {}; \node [style=none] (54) at (-5.75, -1.4) {}; \node [style=none] (55) at (-6.75, -1.25) {}; \node [style=none] (56) at (-6.25, -0.75) {}; \node [style=none] (57) at (-6.25, -1.75) {}; \node [style=gauge3] (58) at (-8.25, -1.25) {}; \node [style=none] (59) at (-8.25, -1.75) {1}; \node [style=none] (60) at (-10.25, -1.25) {$d_4$}; \node [style=gauge3] (61) at (-1, -3.25) {}; \node [style=none] (62) at (-1, -3.75) {1}; \node [style=gauge3] (63) at (0.5, -3.25) {}; \node [style=none] (64) at (0.5, -3.75) {1}; \node [style=none] (65) at (-1, -3.1) {}; \node [style=none] (66) at (0.5, -3.1) {}; \node [style=none] (67) at (-1, -3.4) {}; \node [style=none] (68) at (0.5, -3.4) {}; \node [style=none] (69) at (-0.5, -3.25) {}; \node [style=none] (70) at (0, -2.75) {}; \node [style=none] (71) at (0, -3.75) {}; \node [style=gauge3] (72) at (-2, -3.25) {}; \node [style=gauge3] (73) at (-3, -3.25) {}; \node [style=none] (74) at (-2, -3.75) {1}; \node [style=none] (75) at (-3, -3.75) {1}; \node [style=blankflavor] (76) at (0.5, 0.25) {}; \node [style=blankflavor] (77) at (-5.75, -1.25) {}; \node [style=flavour2] (78) at (-3, -2.25) {}; \node [style=none] (79) at (-3, -1.75) {1}; \node [style=gauge3] (80) at (-7.25, -4.75) {}; \node [style=none] (81) at (-7.25, -5.25) {1}; \node [style=gauge3] (82) at (-5.75, -4.75) {}; \node [style=none] (83) at (-5.75, -5.25) {1}; \node [style=none] (84) at (-7.25, -4.6) {}; \node [style=none] (85) at (-5.75, -4.6) {}; \node [style=none] (86) at (-7.25, -4.9) {}; \node [style=none] (87) at (-5.75, -4.9) {}; \node [style=none] (88) at (-6.75, -4.75) {}; \node [style=none] (89) at (-6.25, -4.25) {}; \node [style=none] (90) at (-6.25, -5.25) {}; \node [style=gauge3] (91) at (-8.25, -4.75) {}; \node [style=gauge3] (92) at (-9.25, -4.75) {}; \node [style=none] (93) at (-8.25, -5.25) {1}; \node [style=none] (94) at (-9.25, -5.25) {1}; \node [style=flavour2] (95) at (-9.25, -3.75) {}; \node [style=none] (96) at (-9.25, -3.25) {1}; \node [style=none] (97) at (-10.75, -4.75) {$h_{4,3}$}; \node [style=gauge3] (98) at (-1.25, -6) {}; \node [style=none] (99) at (-1.25, -6.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (2) to (24); \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (2); \draw (38) to (37); \draw (41.center) to (42.center); \draw (42.center) to (43.center); \draw (47) to (49); \draw (51.center) to (52.center); \draw (54.center) to (53.center); \draw (56.center) to (55.center); \draw (55.center) to (57.center); \draw (58) to (47); \draw (61) to (63); \draw (65.center) to (66.center); \draw (68.center) to (67.center); \draw (70.center) to (69.center); \draw (69.center) to (71.center); \draw (72) to (61); \draw (73) to (72); \draw (78) to (73); \draw (80) to (82); \draw (84.center) to (85.center); \draw (87.center) to (86.center); \draw (89.center) to (88.center); \draw (88.center) to (90.center); \draw (91) to (80); \draw (92) to (91); \draw (95) to (92); \end{pgfonlayer} \end{tikzpicture}} } & \raisebox{-.37\height}{\scalebox{.8}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=bd] (0) at (-1.5, 2) {}; \node [style=bd] (1) at (1.5, 2) {}; \node [style=bd] (2) at (0, 0) {}; \node [style=none] (3) at (1.25, 1) {$h_{4,3}$}; \node [style=none] (4) at (-1.25, 0.75) {$D_4$}; \node [style=bd] (5) at (0, 4) {}; \node [style=bd] (6) at (3, 4) {}; \node [style=none] (7) at (2.75, 2.75) {$d_4$}; \node [style=none] (9) at (-1.25, 3.25) {$h_{4,3}$}; \node [style=none] (10) at (1.25, 3.25) {$D_4$}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw [style=blue] (2) to (1); \draw [style=red] (2) to (0); \draw [style=blue] (0) to (5); \draw [style=red] (1) to (5); \draw [style=blue] (1) to (6); \end{pgfonlayer} \end{tikzpicture}}} \\ \bottomrule \end{tabular} \caption{$A_3$ theory. \texttt{Left:} Hasse diagram for the Higgs branch of the $4d$ $\mathcal{N}=2$ rank 1 theory. To the right of the Hasse diagram are the magnetic quivers for the closures of the leaves and to the left are magnetic quivers for the slices. \texttt{Right:} Hasse diagram for the full moduli space of the theory in $3d$ $\mathcal{N}=4$. } \label{tab:Hasse_A3} \end{table} \subsection{\texorpdfstring{$A_1\times U_1$}{A1 x U1} rank 1 SCFT} The global symmetry of the Coulomb branch of a quiver can be read from the balance of its nodes. The low rank of the global symmetry for this SCFT places a very strong restriction on the form of the quiver. The twist is $\mathbb{Z}_3$, implying that there should be a triply-laced edge. These conditions make the magnetic quiver in Table \ref{resulttable} a very natural guess. In addition, we also conjecture an explicit construction of the Higgs branch using a hyper-K\"ahler quotient. We check that these two independent descriptions of the Higgs branch are consistent, by computing the Hilbert series in both cases and find perfect agreement. The Higgs branch of the $A_1 \times U_1$ SCFT is conjectured to be given by the hyper-K\"ahler quotient: \begin{align} \mathcal{H}\left(A_1 \times U_1 \text{ SCFT}\right) = \left( \overline{\mathcal{O}}^{\text{min}}_{G_2} \times\mathbb{H}^2 \times \mathbb{C}^2/\mathbb{Z}_2 \right) /// SU(2) \,. \end{align} Explicitly, we first take the refined Hilbert series $\mathrm{HS}_{\overline{\mathcal{O}}^{\text{min}}_{G_2} }(x_1,x_2,t)$, where $x_1,x_2$ are the fundamental weight fugacities of $G_2$ and decompose it with respect to the branching $G_2 \rightarrow SU(2)\times SU(2) $. The resulting Hilbert series is $\mathrm{HS}_{\overline{\mathcal{O}}^{\text{min}}_{G_2} }(y,z,t)$ where $y$ and $z$ are the weight fugacities of $SU(2)\times SU(2)$ and is given in \cite[Tab.\ 10]{Hanany:2015hxa}. The $\mathbb{H}^2$ theory can be described by the Higgs branch of $[SU(2)]-[O2]$ with Hilbert series $ \mathrm{HS}_{\mathbb{H}^2 }(z,q,t) $, where $z$ is the fugacity for $SU(2)$ and $q$ is the fugacity for $O(2)$. The hyper-K\"ahler quotient then takes the form: \begin{align} \begin{aligned} \mathrm{HS}_{A_1\times U_1}(y,q,t) = \oint_{\mathrm{SU}(2)} d\mu_{\mathrm{SU}(2)} &\mathrm{HS}_{\overline{\mathcal{O}}^{\text{min}}_{G_2} }(y,z,t) \mathrm{HS}_{\mathbb{H}^2 }(z,q,t) \mathrm{HS}_{\mathbb{C}^2/\mathbb{Z}_2}(z,t) \\ & \qquad \cdot (1-z^2t^2)\left(1-\frac{1}{z^2}t^2 \right)(1-t^2) \end{aligned} \end{align} which is consistent with the result in Table \ref{resultHS}. Following an analagous gluing process in \eqref{gluing}, one would expect: \begin{equation} \raisebox{-.5\height}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=none] (13) at (1, 1) {$\mathbb{H}^2$}; \node [style=gauge3] (15) at (2.25, -4.25) {}; \node [style=none] (16) at (1, -4.125) {}; \node [style=none] (17) at (2.25, -4.125) {}; \node [style=none] (18) at (1, -4.375) {}; \node [style=none] (19) at (2.25, -4.375) {}; \node [style=none] (20) at (4.75, 1) {$\mathbb{C}^2/\mathbb{Z}_2$}; \node [style=none] (21) at (-2.5, -1.5) {}; \node [style=none] (22) at (4.75, -1.5) {}; \node [style=none] (23) at (1, -3.5) {}; \node [style=none] (24) at (1, -2.1) {}; \node [style=none] (45) at (2.25, -4.75) {1}; \node [style=none] (47) at (2.5, -2.75) {Gauge $SU(2)$}; \node [style=none] (59) at (-4.5, -1) {1}; \node [style=none] (60) at (-3, -1) {2}; \node [style=none] (61) at (-3.5, 1) {$\overline{\mathcal{O}}^{\text{min}}_{G_2}$}; \node [style=none] (63) at (-1.75, -1) {1}; \node [style=gauge3] (64) at (-4.5, -0.5) {}; \node [style=gauge3] (66) at (-3, -0.5) {}; \node [style=none] (68) at (-4.5, -0.35) {}; \node [style=none] (69) at (-3, -0.35) {}; \node [style=none] (70) at (-4.5, -0.65) {}; \node [style=none] (71) at (-3, -0.65) {}; \node [style=none] (72) at (-4, -0.5) {}; \node [style=none] (73) at (-3.5, 0) {}; \node [style=none] (74) at (-3.5, -1) {}; \node [style=blankflavor] (75) at (-3, -0.5) {}; \node [style=gauge3] (76) at (-1.75, -0.5) {}; \node [style=none] (77) at (0.25, -1) {1}; \node [style=none] (78) at (1.75, -1) {2}; \node [style=gauge3] (80) at (0.25, -0.5) {}; \node [style=gauge3] (81) at (1.75, -0.5) {}; \node [style=none] (82) at (0.25, -0.35) {}; \node [style=none] (83) at (1.75, -0.35) {}; \node [style=none] (84) at (0.25, -0.65) {}; \node [style=none] (85) at (1.75, -0.65) {}; \node [style=none] (86) at (0.75, -0.5) {}; \node [style=none] (87) at (1.25, 0) {}; \node [style=none] (88) at (1.25, -1) {}; \node [style=blankflavor] (89) at (1.75, -0.5) {}; \node [style=none] (90) at (-0.5, -4.75) {1}; \node [style=none] (91) at (1, -4.75) {2}; \node [style=gauge3] (92) at (-0.5, -4.25) {}; \node [style=gauge3] (93) at (1, -4.25) {}; \node [style=none] (94) at (-0.5, -4.1) {}; \node [style=none] (95) at (1, -4.1) {}; \node [style=none] (96) at (-0.5, -4.4) {}; \node [style=none] (97) at (1, -4.4) {}; \node [style=none] (98) at (0, -4.25) {}; \node [style=none] (99) at (0.5, -3.75) {}; \node [style=none] (100) at (0.5, -4.75) {}; \node [style=blankflavor] (101) at (1, -4.25) {}; \node [style=gauge3] (102) at (5.75, -0.5) {}; \node [style=none] (103) at (4.5, -0.375) {}; \node [style=none] (104) at (5.75, -0.375) {}; \node [style=none] (105) at (4.5, -0.625) {}; \node [style=none] (106) at (5.75, -0.625) {}; \node [style=none] (107) at (5.75, -1) {1}; \node [style=none] (108) at (4.5, -1) {1}; \node [style=gauge3] (109) at (4.5, -0.5) {}; \node [style=none] (110) at (4.5, -0.35) {}; \node [style=none] (111) at (4.5, -0.65) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (17.center) to (16.center); \draw (18.center) to (19.center); \draw [bend right=15] (21.center) to (22.center); \draw [style=->] (24.center) to (23.center); \draw (64) to (66); \draw (68.center) to (69.center); \draw (71.center) to (70.center); \draw (73.center) to (72.center); \draw (72.center) to (74.center); \draw (76) to (75); \draw (80) to (81); \draw (82.center) to (83.center); \draw (85.center) to (84.center); \draw (87.center) to (86.center); \draw (86.center) to (88.center); \draw (92) to (93); \draw (94.center) to (95.center); \draw (97.center) to (96.center); \draw (99.center) to (98.center); \draw (98.center) to (100.center); \draw (104.center) to (103.center); \draw (105.center) to (106.center); \end{pgfonlayer} \end{tikzpicture} } \end{equation} Although exactly how to do this gluing process as an action on magnetic quivers is unclear. The Hasse diagram is given in Table \ref{tab:Hasse_A1xU1} for the Higgs branch of the $4d$ $\mathcal{N}=2$ rank 1 theory as well as the full moduli space of the $3d$ $\mathcal{N}=4$ theory. \begin{table}[t] \centering \begin{tabular}{c||c} \toprule Hasse diagram for the & Hasse diagram for the full \\ Higgs branch of the 4d theory & moduli space of the 3d theory \\ \midrule \raisebox{-.5\height}{ \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=none] (41) at (-5, 0.25) {}; \node [style=none] (42) at (-5, -2.75) {}; \node [style=none] (43) at (-5, -6) {}; \node [style=bd] (44) at (-5, 0.25) {}; \node [style=bd] (45) at (-5, -2.75) {}; \node [style=bd] (46) at (-5, -6) {}; \node [style=none] (60) at (-11, -1) {$A_1$}; \node [style=none] (97) at (-10.925, -4.5) {$h_{2,3}$}; \node [style=gauge3] (436) at (-3.325, 0.25) {}; \node [style=none] (437) at (-3.325, -0.25) {1}; \node [style=gauge3] (438) at (-1.825, 0.25) {}; \node [style=none] (439) at (-1.825, -0.25) {2}; \node [style=none] (440) at (-3.325, 0.4) {}; \node [style=none] (441) at (-1.825, 0.4) {}; \node [style=none] (442) at (-3.325, 0.1) {}; \node [style=none] (443) at (-1.825, 0.1) {}; \node [style=none] (444) at (-2.825, 0.25) {}; \node [style=none] (445) at (-2.325, 0.75) {}; \node [style=none] (446) at (-2.325, -0.25) {}; \node [style=gauge3] (447) at (-0.825, 0.25) {}; \node [style=none] (448) at (-1.825, 0.325) {}; \node [style=none] (449) at (-1.825, 0.15) {}; \node [style=none] (450) at (-0.825, 0.325) {}; \node [style=none] (451) at (-0.825, 0.15) {}; \node [style=none] (452) at (-0.825, -0.25) {1}; \node [style=blankflavor] (453) at (-1.8, 0.25) {}; \node [style=gauge3] (454) at (-3.25, -3) {}; \node [style=none] (455) at (-3.25, -3.5) {1}; \node [style=gauge3] (456) at (-1.75, -3) {}; \node [style=none] (457) at (-1.75, -3.5) {1}; \node [style=none] (458) at (-3.25, -2.85) {}; \node [style=none] (459) at (-1.75, -2.85) {}; \node [style=none] (460) at (-3.25, -3.15) {}; \node [style=none] (461) at (-1.75, -3.15) {}; \node [style=none] (462) at (-2.75, -3) {}; \node [style=none] (463) at (-2.25, -2.5) {}; \node [style=none] (464) at (-2.25, -3.5) {}; \node [style=none] (466) at (-1.75, -2.925) {}; \node [style=none] (467) at (-1.75, -3.1) {}; \node [style=flavour2] (468) at (-3.275, -2) {}; \node [style=none] (469) at (-3.275, -1.5) {1}; \node [style=gauge3] (470) at (-8.325, -1.025) {}; \node [style=none] (471) at (-8.325, -1.525) {1}; \node [style=gauge3] (472) at (-6.9, -1.025) {}; \node [style=none] (473) at (-6.9, -1.525) {1}; \node [style=none] (474) at (-8.15, -0.95) {}; \node [style=none] (475) at (-6.9, -0.95) {}; \node [style=none] (476) at (-8.15, -1.1) {}; \node [style=none] (477) at (-6.9, -1.1) {}; \node [style=none] (478) at (-7.9, -1.025) {}; \node [style=gauge3] (479) at (-8.3, -4.5) {}; \node [style=none] (480) at (-8.3, -5) {1}; \node [style=gauge3] (481) at (-6.8, -4.5) {}; \node [style=none] (482) at (-6.8, -5) {1}; \node [style=none] (483) at (-8.3, -4.35) {}; \node [style=none] (484) at (-6.8, -4.35) {}; \node [style=none] (485) at (-8.3, -4.65) {}; \node [style=none] (486) at (-6.8, -4.65) {}; \node [style=none] (487) at (-7.8, -4.5) {}; \node [style=none] (488) at (-7.3, -4) {}; \node [style=none] (489) at (-7.3, -5) {}; \node [style=none] (490) at (-6.8, -4.425) {}; \node [style=none] (491) at (-6.8, -4.6) {}; \node [style=flavour2] (492) at (-8.325, -3.5) {}; \node [style=none] (493) at (-8.325, -3) {1}; \node [style=gauge3] (494) at (-2.5, -6) {}; \node [style=none] (495) at (-2.5, -6.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (44) to (45); \draw (45) to (46); \draw (436) to (438); \draw (440.center) to (441.center); \draw (443.center) to (442.center); \draw (445.center) to (444.center); \draw (444.center) to (446.center); \draw (450.center) to (448.center); \draw (449.center) to (451.center); \draw (454) to (456); \draw (458.center) to (459.center); \draw (461.center) to (460.center); \draw (463.center) to (462.center); \draw (462.center) to (464.center); \draw (468) to (458.center); \draw (474.center) to (475.center); \draw (477.center) to (476.center); \draw (479) to (481); \draw (483.center) to (484.center); \draw (486.center) to (485.center); \draw (488.center) to (487.center); \draw (487.center) to (489.center); \draw (492) to (483.center); \end{pgfonlayer} \end{tikzpicture}} } & \raisebox{-0.4\height}{\scalebox{.7}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=bd] (0) at (-1.5, 2) {}; \node [style=bd] (1) at (1.5, 2) {}; \node [style=bd] (2) at (0, 0) {}; \node [style=none] (3) at (1.25, 1) {$h_{2,3}$}; \node [style=none] (4) at (-1.25, 0.75) {$a_1$}; \node [style=bd] (5) at (0, 4) {}; \node [style=bd] (6) at (3, 4) {}; \node [style=none] (7) at (2.75, 2.75) {$A_1$}; \node [style=none] (9) at (-1.25, 3.25) {$h_{2,3}$}; \node [style=none] (10) at (1.25, 3.25) {$a_1$}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw [style=blue] (2) to (1); \draw [style=red] (2) to (0); \draw [style=blue] (0) to (5); \draw [style=red] (1) to (5); \draw [style=blue] (1) to (6); \end{pgfonlayer} \end{tikzpicture}}} \\ \bottomrule \end{tabular} \caption{$A_1\times U_1$ theory. \texttt{Left:} Hasse diagram for the Higgs branch of the $4d$ $\mathcal{N}=2$ rank 1 theory. To the right of the Hasse diagram are the magnetic quivers for the closures of the leaves and to the left are magnetic quivers for the slices. \texttt{Right:} Hasse diagram for the full moduli space of the theory in $3d$ $\mathcal{N}=4$. } \label{tab:Hasse_A1xU1} \end{table} This Hasse diagram is given in Table \ref{tab:Hasse_A2} for the Higgs branch of the $4d$ $\mathcal{N}=2$ rank 1 theory as well as the full moduli space of the $3d$ $\mathcal{N}=4$ theory. \subsection{\texorpdfstring{$A_2$}{A2} rank 1 SCFT} For this case we repeat the guess which is made for the $A_3$ theory, with adaptation of the details. The twist is $\mathbb{Z}_4$, implying that there should be 4 identical legs, each with an $SU(3)$ global symmetry. Folding this quiver leads to the magnetic quiver in Table \ref{resulttable}. The Hilbert series results of Table \ref{resultHS} are consistent with the prediction in \cite[Sec.\ 2.3]{Ohmori:2018ona} obtained by compactifying on a torus with a non-trivial flavor background of the $6d$ $\mathcal{N}=(1,0)$ SCFT, which is the UV completion of an $\mathrm{SU}(4)$ gauge theory with 12 flavours in the fundamental representation and one flavour in the antisymmetric representation. \begin{table}[t] \centering \begin{tabular}{c||c} \toprule Hasse diagram for the & Hasse diagram for the full \\ Higgs branch of the 4d theory & moduli space of the 3d theory \\ \midrule \raisebox{-.5\height}{ \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=none] (41) at (-5, 0.25) {}; \node [style=none] (42) at (-5, -2.75) {}; \node [style=none] (43) at (-5, -6) {}; \node [style=bd] (44) at (-5, 0.25) {}; \node [style=bd] (45) at (-5, -2.75) {}; \node [style=bd] (46) at (-5, -6) {}; \node [style=none] (60) at (-10, -1) {$a_2$}; \node [style=blankflavor] (76) at (-0.5, 0.25) {}; \node [style=none] (97) at (-10.75, -4.75) {$h_{3,4}$}; \node [style=gauge3] (98) at (-2, 0.25) {}; \node [style=none] (99) at (-2, -0.25) {2}; \node [style=gauge3] (100) at (-0.5, 0.25) {}; \node [style=none] (101) at (-0.5, -0.25) {3}; \node [style=none] (102) at (-2, 0.3) {}; \node [style=none] (103) at (-0.5, 0.3) {}; \node [style=none] (104) at (-2, 0.175) {}; \node [style=none] (105) at (-0.5, 0.175) {}; \node [style=none] (106) at (-1.5, 0.25) {}; \node [style=none] (107) at (-1, 0.75) {}; \node [style=none] (108) at (-1, -0.25) {}; \node [style=none] (109) at (-2, 0.425) {}; \node [style=none] (110) at (-0.5, 0.425) {}; \node [style=none] (111) at (-2, 0.05) {}; \node [style=none] (112) at (-0.5, 0.05) {}; \node [style=gauge3] (113) at (-3, 0.25) {}; \node [style=none] (114) at (-3, -0.25) {1}; \node [style=blankflavor] (115) at (-6, -1) {}; \node [style=gauge3] (116) at (-7.5, -1) {}; \node [style=none] (117) at (-7.5, -1.5) {1}; \node [style=gauge3] (118) at (-6, -1) {}; \node [style=none] (119) at (-6, -1.5) {2}; \node [style=none] (120) at (-7.5, -0.95) {}; \node [style=none] (121) at (-6, -0.95) {}; \node [style=none] (122) at (-7.5, -1.075) {}; \node [style=none] (123) at (-6, -1.075) {}; \node [style=none] (124) at (-7, -1) {}; \node [style=none] (125) at (-6.5, -0.5) {}; \node [style=none] (126) at (-6.5, -1.5) {}; \node [style=none] (127) at (-7.5, -0.825) {}; \node [style=none] (128) at (-6, -0.825) {}; \node [style=none] (129) at (-7.5, -1.2) {}; \node [style=none] (130) at (-6, -1.2) {}; \node [style=gauge3] (132) at (-2, -3.25) {}; \node [style=none] (133) at (-2, -3.75) {1}; \node [style=gauge3] (134) at (-0.5, -3.25) {}; \node [style=none] (135) at (-0.5, -3.75) {1}; \node [style=none] (136) at (-2, -3.2) {}; \node [style=none] (137) at (-0.5, -3.2) {}; \node [style=none] (138) at (-2, -3.325) {}; \node [style=none] (139) at (-0.5, -3.325) {}; \node [style=none] (140) at (-1.5, -3.25) {}; \node [style=none] (141) at (-1, -2.75) {}; \node [style=none] (142) at (-1, -3.75) {}; \node [style=none] (143) at (-2, -3.075) {}; \node [style=none] (144) at (-0.5, -3.075) {}; \node [style=none] (145) at (-2, -3.45) {}; \node [style=none] (146) at (-0.5, -3.45) {}; \node [style=gauge3] (147) at (-3, -3.25) {}; \node [style=none] (148) at (-3, -3.75) {1}; \node [style=flavour2] (149) at (-3, -2.25) {}; \node [style=none] (150) at (-3, -1.75) {1}; \node [style=gauge3] (152) at (-7.5, -4.5) {}; \node [style=none] (153) at (-7.5, -5) {1}; \node [style=gauge3] (154) at (-6, -4.5) {}; \node [style=none] (155) at (-6, -5) {1}; \node [style=none] (156) at (-7.5, -4.45) {}; \node [style=none] (157) at (-6, -4.45) {}; \node [style=none] (158) at (-7.5, -4.575) {}; \node [style=none] (159) at (-6, -4.575) {}; \node [style=none] (160) at (-7, -4.5) {}; \node [style=none] (161) at (-6.5, -4) {}; \node [style=none] (162) at (-6.5, -5) {}; \node [style=none] (163) at (-7.5, -4.325) {}; \node [style=none] (164) at (-6, -4.325) {}; \node [style=none] (165) at (-7.5, -4.7) {}; \node [style=none] (166) at (-6, -4.7) {}; \node [style=gauge3] (167) at (-8.5, -4.5) {}; \node [style=none] (168) at (-8.5, -5) {1}; \node [style=flavour2] (169) at (-8.5, -3.5) {}; \node [style=none] (170) at (-8.5, -3) {1}; \node [style=gauge3] (171) at (-1.75, -6) {}; \node [style=none] (172) at (-1.75, -6.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (102.center) to (103.center); \draw (105.center) to (104.center); \draw (107.center) to (106.center); \draw (106.center) to (108.center); \draw (109.center) to (110.center); \draw (111.center) to (112.center); \draw (113) to (98); \draw (44) to (45); \draw (45) to (46); \draw (120.center) to (121.center); \draw (123.center) to (122.center); \draw (125.center) to (124.center); \draw (124.center) to (126.center); \draw (127.center) to (128.center); \draw (129.center) to (130.center); \draw (136.center) to (137.center); \draw (139.center) to (138.center); \draw (141.center) to (140.center); \draw (140.center) to (142.center); \draw (143.center) to (144.center); \draw (145.center) to (146.center); \draw (147) to (132); \draw (149) to (147); \draw (156.center) to (157.center); \draw (159.center) to (158.center); \draw (161.center) to (160.center); \draw (160.center) to (162.center); \draw (163.center) to (164.center); \draw (165.center) to (166.center); \draw (167) to (152); \draw (169) to (167); \end{pgfonlayer} \end{tikzpicture}} } & \raisebox{-.5\height}{\scalebox{.7}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=bd] (0) at (-1.5, 2) {}; \node [style=bd] (1) at (1.5, 2) {}; \node [style=bd] (2) at (0, 0) {}; \node [style=none] (3) at (1.25, 1) {$h_{3,4}$}; \node [style=none] (4) at (-1.25, 0.75) {$A_2$}; \node [style=bd] (5) at (0, 4) {}; \node [style=bd] (6) at (3, 4) {}; \node [style=none] (7) at (2.75, 2.75) {$a_2$}; \node [style=none] (9) at (-1.25, 3.25) {$h_{3,4}$}; \node [style=none] (10) at (1.25, 3.25) {$A_2$}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw [style=blue] (2) to (1); \draw [style=red] (2) to (0); \draw [style=blue] (0) to (5); \draw [style=red] (1) to (5); \draw [style=blue] (1) to (6); \end{pgfonlayer} \end{tikzpicture}}} \\ \bottomrule \end{tabular} \caption{$A_2$ theory. \texttt{Left:} Hasse diagram for the Higgs branch of the $4d$ $\mathcal{N}=2$ rank 1 theory. To the right of the Hasse diagram are the magnetic quivers for the closures of the leaves and to the left are magnetic quivers for the slices. \texttt{Right:} Hasse diagram for the full moduli space of the theory in $3d$ $\mathcal{N}=4$. } \label{tab:Hasse_A2} \end{table} \subsection{\texorpdfstring{$\mathbb{H}/\mathbb{Z}_k$}{H mod Zk} rank 1 SCFTs} For completeness, consider four more rank 1 theories whose Higgs branches are $\mathbb{H}/{\mathbb{Z}_k}$ orbifolds with $k=2,3,4,6$. The magnetic quivers take the unified form: \begin{equation} \raisebox{-.5\height}{\scalebox{.8}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (0) at (-1, 0) {}; \node [style=gauge3] (1) at (0, 0) {}; \node [style=none] (2) at (-0.5, 0.25) {$k$}; \node [style=none] (3) at (-1, -0.5) {1}; \node [style=none] (4) at (0, -0.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (1) to (0); \end{pgfonlayer} \end{tikzpicture}} } \label{orbifold} \end{equation} where $k$ denotes the multiplicity of hypermultiplets. The Hilbert series is well known, see for instance \cite{Cremonesi:2013lqa}: \begin{equation} \mathrm{HS}\eqref{orbifold}=\frac{1-t^{2k}}{(1-t^2)(1-t^kq)(1-t^k/q)} \;. \end{equation} The Coulomb branch global symmetry is $\mathrm{SU(2)}$ for $k=2$ where the generators are all at order $t^2$ transforming as $[2]_{A_1}$ and a singlet relation at order $t^4$. The Coulomb branch global symmetry is $U(1)$ for $k > 2$, with a singlet generator at order $t^2$, and $q+\frac{1}{q}$ generators at order $t^k$ satisfying a singlet relation at order $t^{2k}$. These are consistent with the results in Table \ref{rank1table}. The $U(1)$ global symmetry is a remnant of the accidental enhanced supersymmetry. The moduli space consists of 3 complex scalars, with a starting $SO(6)$ global symmetry. These are the 6 transverse scalars to a D3 brane probe. Complexification breaks the symmetry to $U(3)$, out of which $SU(3)$ is an R symmetry. We are left with a $U(1)$ which is the symmetry that is observed for the orbifold cases $k=3, 4, 6.$ The extra enhancement of symmetry for the case of $k=2$ is a signal of the additional enhancement of supersymmetry to $16$ supercharges. \section{Higher rank magnetic quivers from 5d \texorpdfstring{$\mathcal{N}=1$}{N=1} theories}\label{generalfamily} The magnetic quivers for rank 1 theories can be derived by taking magnetic quivers of $5d$ $\mathcal{N}=1$ theories and folding them. The relevant $5d$ theories are summarised in Table \ref{beforefold} with each of them extended to a general family. The folding of $k$ legs of the magnetic quivers of the $5d$ theories is directly related to the compatification of these $5d$ theories with a $\mathbb{Z}_k$ twist discussed in \cite{Zafrir:2016wkk,Ohmori:2018ona}. The folded theories are listed in Table \ref{afterfold}. We also provide the Higgs branch dimension of the magnetic quivers and, where possible, the refined Hilbert series expressed as a highest weight generating function (HWG)\footnote{The HWG here are expressed as a plethystic logarithm (PL) which allows one to express the rational function in an elegant polynomial form. This PL of the HWG is not to be confused with the PL of the Hilbert series where the positive and negative terms encode the generators and relations in the chiral ring.}\cite{Hanany:2016djz}. For a given family the parametrisation is chosen such that \emph{after folding}: \begin{itemize} \item[--] $n=0$ one obtains a magnetic quiver for flat space $\mathbb{H}^l$ for some $l$. The folded quivers are given in Table \ref{nilpotent}. \item[--] $n=1$ one obtains a magnetic quiver for a rank 1 theory without enhanced Coulomb branch, they are closures of minimal nilpotent orbits of some algebra. The folded quivers are given in Table \ref{nilpotent}. \item[--] $n=2$ one obtains a magnetic quiver for a rank 1 theory with enhanced Coulomb branch, which partially Higgses to the theory with the $n=1$ magnetic quiver. These are the quivers of main interest in this paper and are given in Table \ref{resulttable}. \item[--] $n>2$ one obtains a magnetic quiver for a higher rank theory, which can be Higgsed to the $n=2$ and $n=1$ case, and possibly other theories. These are tabulated in Table \ref{afterfold}. \end{itemize} Before folding, all but one family of magnetic quivers are either star shaped quivers, such as $T_N$, or those found in \cite{Cabrera:2018jxt}. These are given in Table \ref{beforefold} and summarised as: \begin{itemize} \item The $C_{n+3}$ family ($n=2$ case gives the $C_5$ rank 1 SCFT) comes from folding the $E_7$ family, which are the magnetic quiver of $5d$ $\mathcal{N}=1$ $SU(n+1)_0$ SQCD with $2n+4$ flavours. The magnetic quivers here describe the Higgs branch of the $4d$ SCFTs generated by compactifying the $5d$ SCFT lifts of these $\mathcal{N}=1$ SQCD theories to $4d$ with a $\mathbb{Z}_2$ twist. An alternative construction is as the compactification of the $6d$ $\mathcal{N}=(1,0)$ SCFT completion of the $\mathrm{USp}(2n-2)$ gauge theory with $2n+6$ flavours on a torus with a non-trivial flavour background. For $n$ odd, these can be identified as class $\mathcal{S}$ theories associated with the compactification of the $D_{\frac{n+5}{2}}$ $(2,0)$ theory on a sphere with two twisted maximal punctures and one untwisted minimal puncture \cite{Ohmori:2018ona}. For $n$ even, these can also be identified with class $\mathcal{S}$ theories, though the identification is slightly more involved, see \cite[Sec.\ 3.1.2]{Ohmori:2018ona}. \item The $C_{n+1}\times A_1$ family ($n=2$ case gives the $C_3\times A_1$ rank 1 SCFT) comes from folding the two long tails and two short tails of the magnetic quiver for $5d$ $\mathcal{N}=1$ $SU(n+1)_0$ SQCD with $2n+2$ flavours. The magnetic quivers here describe the Higgs branch of the $4d$ SCFTs generated by compactifying the $5d$ SCFT lifts of these $\mathcal{N}=1$ SQCD theories to $4d$ with a $\mathbb{Z}_2$ twist. For $n$ odd, these can be identified as class $\mathcal{S}$ theories associated with the compactification of the $D_{\frac{n+3}{2}}$ $(2,0)$ theory on a sphere with two twisted maximal punctures and one untwisted puncture of type $[n,1^3]$ \cite{Zafrir:2016wkk}. For $n=4$ the theory seems to match \cite[p.\ 53, \#15]{Chacaltana:2013oka} up to free hypermultiplets. \item The $C_{n}\times U_1$ family ($n=2$ case gives the $C_2 \times U_1$ rank 1 SCFT) comes from folding (the two long tails) of the magnetic quiver of one of the two cones of the $5d$ $\mathcal{N}=1$ $SU(n+1)_0$ SQCD theory with $2n$ flavours. The magnetic quivers here describe the Higgs branch of the $4d$ SCFTs generated by compactifying the $5d$ SCFT lifts of these $\mathcal{N}=1$ SQCD theories to $4d$ with a $\mathbb{Z}_2$ twist. For $n$ even, these can be identified as class $\mathcal{S}$ theories named $R_{2,n}$ that were introduced in \cite{Chacaltana:2014nya}. These can be constructed by the compactification of the $A_{n}$ $(2,0)$ theory on a sphere with two twisted maximal punctures and one untwisted minimal puncture. Alternatively, they can also be constructed by the compactification of the $A_{2n}$ $(2,0)$ theory on a sphere with one twisted maximal puncture and one twisted irregular puncture \cite{Tachikawa:2018rgw,Wang:2018gvb}. \item The $A_{n+1}$ family ($n=2$ case gives the $A_3$ rank 1 SCFT) comes from folding the three legs of a $T_{n+2}$ theory. The magnetic quivers here describe the Higgs branch of the $4d$ SCFTs generated by compactifying the $5d$ $T_{n+2}$ theories to $4d$ with a $\mathbb{Z}_3$ twist. There is also an alternative construction involving the compactification of a family of $6d$ $\mathcal{N}=(1,0)$ SCFTs on a torus with a non-trivial flavour background. The exact description of these SCFTs, in terms of, for instance, the low-energy gauge theory on the tensor branch, is quite involved and can be found in \cite[Sec.\ 3.2.2]{Ohmori:2018ona}. \item The $A_{n-1}\times U_1$ family ($n=2$ case gives the $A_1\times U_1$ rank 1 SCFT) comes from taking the extension of the magnetic quiver of the $T_n$ theory with a $U(1)$ connected by a multiplicity 2 edge to the central $U(n)$ node and folding the three long legs. The magnetic quivers here describe the Higgs branch of the $4d$ SCFTs generated by compactifying particular $5d$ SCFTs to $4d$ with a $\mathbb{Z}_3$ twist. The $5d$ SCFTs in question can be conveniently described as the result of a $\mathbb{Z}_3$ symmetric mass deformation of the $5d$ $T_{n+2}$ SCFTs. \item The $A_{n}{}'$ family ($n=2$ case gives the $A_2$ rank 1 SCFT) comes from folding all four legs of the magnetic quiver for the Higgs branch of a class $\mathcal{S}$ theory defined by a sphere with four maximal punctures. The magnetic quivers here describe the Higgs branch of the $4d$ SCFTs generated by compactifying particular $5d$ SCFTs to $4d$ with a $\mathbb{Z}_4$ twist. The $5d$ SCFTs in question are the UV completions of the $5d$ gauge theories made from a linear quiver of $n$ $SU(n+1)$ groups, connected via bifundamental hypers, without Chern-Simons terms and with $n+1$ fundamental hypers for both edge groups. These $5d$ SCFTs can be engineered in string theory through the intersection of $n+1$ D$5$-branes and $n+1$ NS$5$-branes. In order to read the magnetic quiver associated to this brane web, one should impose the $\mathbb{Z}_4$ invariance when decomposing the web into subwebs. \end{itemize} The Higgs branch dimension of the magnetic quivers $\text{dim}_{\mathbb{H}}(\mathcal{H}(\mathsf{Q}'))$ listed in Table \ref{beforefold} gives indication of the complexity of the moduli space. For dimensions linear in $n$, the HWG of the Coulomb branch has a simple expression. For those quadratic in $n$, the HWG is complicated. This is also reflected in the simplicity of the Hasse diagrams as demonstrated in Section \ref{generalfamily}. \begin{table}[t] \small \centering \begin{adjustbox}{center} \begin{tabular}{ccccc} \toprule Family & Unfolded Magnetic quiver $\mathsf{Q}'$ & $\text{dim}_{\mathbb{H}}(\mathcal{H}(\mathsf{Q}'))$ & $\text{dim}_{\mathbb{H}}(\mathcal{C}(\mathsf{Q}'))$ &$\text{PL}(\mathrm{HWG}(\mathcal{C}(\mathsf{Q}')))$ \\ \midrule $C_{n+3}$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (0) at (0, 0) {}; \node [style=gauge3] (1) at (1, 0) {}; \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (4) at (0, -0.5) {$n{+}3$}; \node [style=none] (5) at (1, -0.5) {$n{+}2$}; \node [style=none] (6) at (-1, -0.5) {$n{+}2$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=none] (10) at (1.75, 0) {\ldots}; \node [style=gauge3] (11) at (2.5, 0) {}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (14) at (2.5, -0.5) {1}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=none] (24) at (1.375, 0) {}; \node [style=none] (25) at (2.15, 0) {}; \node [style=gauge3] (28) at (0, 1) {}; \node [style=none] (33) at (0, 1.5) {2}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (0) to (1); \draw (0) to (2); \draw (24.center) to (1); \draw (25.center) to (11); \draw (23.center) to (2); \draw (22.center) to (12); \draw (28) to (0); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $n$ & $n^2 + 6n +10$& \begin{tabular}{c} \parbox{4cm}{$\sum\limits_{i=1}^{n+2}\mu_i\mu_{2n+6-i}t^{2i}+t^4\\+\mu_{2n+6}(t^{n+1}+t^{n+3})$} \end{tabular}\\ \midrule $C_{n+1} \times A_1$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (0) at (0, 0) {}; \node [style=gauge3] (1) at (1, 0) {}; \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (4) at (0, -0.5) {$n{+}1$}; \node [style=none] (5) at (1, -0.5) {$n$}; \node [style=none] (6) at (-1, -0.5) {$n$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=none] (10) at (1.75, 0) {\ldots}; \node [style=gauge3] (11) at (2.5, 0) {}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (14) at (2.5, -0.5) {1}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=none] (24) at (1.375, 0) {}; \node [style=none] (25) at (2.15, 0) {}; \node [style=gauge3] (26) at (0, 1) {}; \node [style=gauge3] (27) at (1, 1) {}; \node [style=gauge3] (28) at (-1, 1) {}; \node [style=none] (29) at (-1, 1.5) {1}; \node [style=none] (30) at (0, 1.5) {2}; \node [style=none] (31) at (1, 1.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (0) to (1); \draw (0) to (2); \draw (24.center) to (1); \draw (25.center) to (11); \draw (23.center) to (2); \draw (22.center) to (12); \draw (26) to (0); \draw (26) to (27); \draw (26) to (28); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $n $ & $n(n+2)+4$ & \begin{tabular}{c} \parbox{5cm}{ $\sum\limits_{i=1}^{n+1}\mu_i\mu_{2n+2-i}t^{2i}+(\nu_1^2+\nu_2^2)t^2\\+t^4+\nu_1\nu_2\mu_{2n+2}(t^{n+1}+t^{n+3})\\-\nu_1^2\nu_2^2\mu_{n+1}^2t^{2n+6}$} \end{tabular}\\ \midrule $C_n \times U_1$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (0) at (0, 0) {}; \node [style=gauge3] (1) at (1, 0) {}; \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (4) at (0, -0.5) {$n$}; \node [style=none] (5) at (1, -0.5) {$n{-}1$}; \node [style=none] (6) at (-1, -0.5) {$n{-}1$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=none] (10) at (1.75, 0) {\ldots}; \node [style=gauge3] (11) at (2.5, 0) {}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (14) at (2.5, -0.5) {1}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=none] (24) at (1.375, 0) {}; \node [style=none] (25) at (2.15, 0) {}; \node [style=gauge3] (26) at (-0.75, 1) {}; \node [style=gauge3] (27) at (0.75, 1) {}; \node [style=none] (28) at (-0.75, 1.5) {1}; \node [style=none] (29) at (0.75, 1.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (0) to (1); \draw (0) to (2); \draw (24.center) to (1); \draw (25.center) to (11); \draw (23.center) to (2); \draw (22.center) to (12); \draw (26) to (0); \draw (0) to (27); \draw (27) to (26); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $n$ & $n^2+1$& \begin{tabular}{c} \parbox{4.5cm}{ $\sum\limits_{i=1}^n\mu_i\mu_{2n-i}t^{2i} + t^2 + \mu_n (q\\+\frac{1}{q}) t^{n+1}-\mu_n^2t^{2(n+1)}$} \end{tabular}\\ \midrule $A_{n+1}$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (0) at (0, 0) {}; \node [style=gauge3] (1) at (1, 0) {}; \node [style=gauge3] (2) at (-1, 0) {}; \node [style=gauge3] (3) at (0, 1) {}; \node [style=none] (4) at (0, -0.5) {$n{+}2$}; \node [style=none] (5) at (1, -0.5) {$n{+}1$}; \node [style=none] (6) at (-1, -0.5) {$n{+}1$}; \node [style=none] (7) at (0.75, 1) {$n{+}1$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=none] (9) at (0, 1.75) {\vdots}; \node [style=none] (10) at (1.75, 0) {\ldots}; \node [style=gauge3] (11) at (2.5, 0) {}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=gauge3] (13) at (0, 2.45) {}; \node [style=none] (14) at (2.5, -0.5) {1}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (16) at (0.5, 2.45) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=none] (24) at (1.375, 0) {}; \node [style=none] (25) at (2.15, 0) {}; \node [style=none] (28) at (0, 2.025) {}; \node [style=none] (29) at (0, 1.4) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (3) to (0); \draw (0) to (1); \draw (0) to (2); \draw (28.center) to (13); \draw (28.center) to (13); \draw (29.center) to (3); \draw (24.center) to (1); \draw (25.center) to (11); \draw (23.center) to (2); \draw (22.center) to (12); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $\frac{n(n+1)}{2}$ & $\frac{1}{2} (1 + n) (8 + 3 n)$& \begin{tabular}{c} \parbox{4cm}{ Complicated} \end{tabular}\\ \midrule $A_{n-1} \times U_1$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (0) at (0, 0) {}; \node [style=gauge3] (1) at (1, 0) {}; \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (4) at (-0.25, -0.425) {$n$}; \node [style=none] (5) at (1, -0.5) {$n{-}1$}; \node [style=none] (6) at (-1, -0.5) {$n{-}1$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=none] (10) at (1.75, 0) {\ldots}; \node [style=gauge3] (11) at (2.5, 0) {}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (14) at (2.5, -0.5) {1}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=gauge3] (17) at (0, -1) {}; \node [style=none] (18) at (0, -1.65) {\vdots}; \node [style=gauge3] (19) at (0, -2.4) {}; \node [style=none] (20) at (0.5, -2.4) {1}; \node [style=none] (21) at (0.75, -1) {$n{-}1$}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=none] (24) at (1.375, 0) {}; \node [style=none] (25) at (2.15, 0) {}; \node [style=none] (26) at (0, -1.375) {}; \node [style=none] (27) at (0, -2.05) {}; \node [style=gauge3] (28) at (0, 1) {}; \node [style=none] (29) at (-0.125, 1) {}; \node [style=none] (30) at (0.125, 1) {}; \node [style=none] (31) at (-0.125, 0) {}; \node [style=none] (32) at (0.125, 0) {}; \node [style=none] (33) at (0.5, 1) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (0) to (1); \draw (0) to (2); \draw (0) to (17); \draw (24.center) to (1); \draw (25.center) to (11); \draw (26.center) to (17); \draw (23.center) to (2); \draw (22.center) to (12); \draw (27.center) to (19); \draw (29.center) to (31.center); \draw (30.center) to (32.center); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $\frac{n(n+1)}{2}$ & $\frac{n(3n-1)}{2}$& \begin{tabular}{c} \parbox{4cm}{Complicated} \end{tabular}\\ \midrule $A_{n}{}'$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (0) at (0, 0) {}; \node [style=gauge3] (1) at (1, 0) {}; \node [style=gauge3] (2) at (-1, 0) {}; \node [style=gauge3] (3) at (0, 1) {}; \node [style=none] (4) at (-0.375, 0.325) {$n{+}1$}; \node [style=none] (5) at (1, -0.5) {$n$}; \node [style=none] (6) at (-1, -0.5) {$n$}; \node [style=none] (7) at (0.75, 1) {$n$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=none] (9) at (0, 1.75) {\vdots}; \node [style=none] (10) at (1.75, 0) {\ldots}; \node [style=gauge3] (11) at (2.5, 0) {}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=gauge3] (13) at (0, 2.45) {}; \node [style=none] (14) at (2.5, -0.5) {1}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (16) at (0.5, 2.45) {1}; \node [style=gauge3] (17) at (0, -1) {}; \node [style=none] (18) at (0, -1.65) {\vdots}; \node [style=gauge3] (19) at (0, -2.4) {}; \node [style=none] (20) at (0.5, -2.4) {1}; \node [style=none] (21) at (0.75, -1) {$n$}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=none] (24) at (1.375, 0) {}; \node [style=none] (25) at (2.15, 0) {}; \node [style=none] (26) at (0, -1.375) {}; \node [style=none] (27) at (0, -2.05) {}; \node [style=none] (28) at (0, 2.025) {}; \node [style=none] (29) at (0, 1.4) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (3) to (0); \draw (0) to (1); \draw (0) to (2); \draw (0) to (17); \draw (28.center) to (13); \draw (28.center) to (13); \draw (29.center) to (3); \draw (24.center) to (1); \draw (25.center) to (11); \draw (26.center) to (17); \draw (23.center) to (2); \draw (22.center) to (12); \draw (27.center) to (19); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $n^2$& $n(2n+3)$ & \begin{tabular}{c} \parbox{4cm}{Complicated} \end{tabular}\\ \bottomrule \end{tabular} \end{adjustbox} \caption{Magnetic quivers of $5d$ $\mathcal{N}=1$ theories. In the case of $n=2$, folding these theories reproduces the magnetic quivers of $4d$ $\mathcal{N}=2$ theories of Table \ref{resulttable}. We provide the dimension of both the Higgs branch $\mathcal{H}(\mathsf{Q}')$ and the Coulomb branch $\mathcal{C}(\mathsf{Q}')$ of the unfolded magnetic quivers. The HWGs are given in \cite{Ferlito:2017xdq,TropicalHWG}. The prime in the label of the last family is to distinguish it from the fourth family. } \label{beforefold} \end{table} \begin{table}[t] \small \centering \begin{adjustbox}{center} \begin{tabular}{ccccc} \toprule Family & Magnetic quiver $\mathsf{Q}$ & $\mathrm{dim}_{\mathbb{H}}(\mathcal{C}(\mathsf{Q}))$ &$\text{PL}(\mathrm{HWG}(\mathcal{C}(\mathsf{Q})))$ \\ \midrule $C_{n+3}$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {$n{+}2$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {$n{+}3$}; \node [style=none] (30) at (-1, 0.075) {}; \node [style=none] (31) at (0.25, 0.075) {}; \node [style=none] (32) at (-1, -0.075) {}; \node [style=none] (33) at (0.25, -0.075) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (-0.125, 0.375) {}; \node [style=none] (36) at (-0.125, -0.375) {}; \node [style=gauge3] (37) at (1, 0) {}; \node [style=none] (38) at (1, -0.5) {2}; \node [style=blankflavor] (39) at (0.25, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (23.center) to (2); \draw (22.center) to (12); \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (24); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $\frac{(n+3)(n+4)}{2}+1$& \begin{tabular}{c} $\sum\limits_{i=1}^{n+2}\mu_i^2t^{2i}+t^4+\mu_{n+3}(t^{n+1}+t^{n+3})$ \end{tabular}\\ \midrule $C_{n+1} \times A_1$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {$n$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {$n{+}1$}; \node [style=none] (30) at (-1, 0.075) {}; \node [style=none] (31) at (0.25, 0.075) {}; \node [style=none] (32) at (-1, -0.075) {}; \node [style=none] (33) at (0.25, -0.075) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (-0.125, 0.375) {}; \node [style=none] (36) at (-0.125, -0.375) {}; \node [style=gauge3] (37) at (1, 0) {}; \node [style=none] (38) at (1, -0.5) {2}; \node [style=gauge3] (39) at (2.25, 0) {}; \node [style=none] (40) at (1, 0.075) {}; \node [style=none] (41) at (2.25, 0.075) {}; \node [style=none] (42) at (1, -0.075) {}; \node [style=none] (43) at (2.25, -0.075) {}; \node [style=none] (44) at (1.75, 0) {}; \node [style=none] (45) at (1.375, 0.375) {}; \node [style=none] (46) at (1.375, -0.375) {}; \node [style=none] (47) at (2.25, -0.5) {1}; \node [style=blankflavor] (48) at (0.25, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (23.center) to (2); \draw (22.center) to (12); \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (24); \draw (40.center) to (41.center); \draw (43.center) to (42.center); \draw (45.center) to (44.center); \draw (44.center) to (46.center); \end{pgfonlayer} \end{tikzpicture} } \end{tabular}& $\frac{(n+1)(n+2)}{2}+2$ & \begin{tabular}{c} \parbox{5.5cm}{ $\sum\limits_{i=1}^{n+1}\mu_i^2t^{2i}+\nu^2t^2+t^4+\nu^2\mu_{n+1}(t^{n+1}\\+t^{n+3})-\nu^4\mu_{n+1}^2t^{2n+6}$} \end{tabular}\\ \midrule $C_n \times U_1$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {$n{-}1$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {$n$}; \node [style=none] (30) at (-1, 0.075) {}; \node [style=none] (31) at (0.25, 0.075) {}; \node [style=none] (32) at (-1, -0.075) {}; \node [style=none] (33) at (0.25, -0.075) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (-0.125, 0.375) {}; \node [style=none] (36) at (-0.125, -0.375) {}; \node [style=gauge3] (37) at (1.25, 0.5) {}; \node [style=gauge3] (38) at (1.25, -0.5) {}; \node [style=none] (39) at (1.75, 0.5) {1}; \node [style=none] (40) at (1.75, -0.5) {1}; \node [style=blankflavor] (41) at (0.25, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (23.center) to (2); \draw (22.center) to (12); \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (33.center); \draw (38) to (31.center); \draw (37) to (38); \end{pgfonlayer} \end{tikzpicture} } \end{tabular}& $\frac{n(n+1)}{2}+1$ & \begin{tabular}{c} \parbox{5cm}{ $\sum\limits_{i=1}^n\mu_i^2t^{2i} + t^2 + \mu_n (q+\frac{1}{q}) t^{n+1}\\-\mu_n^2t^{2(n+1)}$} \end{tabular}\\ \midrule $A_{n+1}$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {$n{+}1$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=gauge3] (24) at (0.5, 0) {}; \node [style=none] (29) at (0.5, -0.5) {$n{+}2$}; \node [style=none] (30) at (-1, 0.15) {}; \node [style=none] (31) at (0.5, 0.15) {}; \node [style=none] (32) at (-1, -0.15) {}; \node [style=none] (33) at (0.5, -0.15) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (0, 0.5) {}; \node [style=none] (36) at (0, -0.5) {}; \node [style=blankflavor] (37) at (0.5, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (23.center) to (2); \draw (22.center) to (12); \draw (2) to (24); \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \end{pgfonlayer} \end{tikzpicture} } \end{tabular}& $\frac{(n+2)(n+3)}{2}-1$ & \begin{tabular}{c} \parbox{4cm}{ Complicated} \end{tabular}\\ \midrule $A_{n-1} \times U_1$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {$n{-}1$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=gauge3] (24) at (0.5, 0) {}; \node [style=none] (29) at (0.5, -0.5) {$n$}; \node [style=none] (30) at (-1, 0.15) {}; \node [style=none] (31) at (0.5, 0.15) {}; \node [style=none] (32) at (-1, -0.15) {}; \node [style=none] (33) at (0.5, -0.15) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (0, 0.5) {}; \node [style=none] (36) at (0, -0.5) {}; \node [style=gauge3] (37) at (1.5, 0) {}; \node [style=none] (38) at (0.5, 0.075) {}; \node [style=none] (39) at (0.5, -0.1) {}; \node [style=none] (40) at (1.5, 0.075) {}; \node [style=none] (41) at (1.5, -0.1) {}; \node [style=none] (42) at (1.5, -0.5) {1}; \node [style=blankflavor] (43) at (0.5, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (23.center) to (2); \draw (22.center) to (12); \draw (2) to (24); \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (40.center) to (38.center); \draw (39.center) to (41.center); \end{pgfonlayer} \end{tikzpicture} } \end{tabular}& $\frac{n(n+1)}{2}$ & \begin{tabular}{c} \parbox{4cm}{ Complicated} \end{tabular}\\ \midrule $A_{n}{}'$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {$n$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=gauge3] (24) at (0.5, 0) {}; \node [style=none] (29) at (0.5, -0.5) {$n{+}1$}; \node [style=none] (30) at (-1, 0.05) {}; \node [style=none] (31) at (0.5, 0.05) {}; \node [style=none] (32) at (-1, -0.075) {}; \node [style=none] (33) at (0.5, -0.075) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (0, 0.5) {}; \node [style=none] (36) at (0, -0.5) {}; \node [style=none] (37) at (-1, 0.15) {}; \node [style=none] (38) at (0.5, 0.15) {}; \node [style=none] (39) at (-1, -0.175) {}; \node [style=none] (40) at (0.5, -0.175) {}; \node [style=blankflavor] (41) at (0.5, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (23.center) to (2); \draw (22.center) to (12); \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37.center) to (38.center); \draw (39.center) to (40.center); \end{pgfonlayer} \end{tikzpicture} } \end{tabular}& $\frac{(n+1)(n+2)}{2}-1$ & \begin{tabular}{c} \parbox{4cm}{Complicated} \end{tabular}\\ \bottomrule \end{tabular} \end{adjustbox} \caption{General quiver families obtained by folding the legs in the magnetic quivers $\mathsf{Q}'$ in Table \ref{beforefold}. In the case of $n=2$ these families correspond to the magnetic quivers of $4d$ $\mathcal{N}=2$ rank 1 theories with enhanced Coulomb branch. For $n>1$ the families are labelled by their global symmetry. For $n=1$ the magnetic quivers describe rank 1 theories without enhanced Coulomb branch, and for $n=0$ each of the moduli spaces is some $\mathbb{H}^l$ for a suitable $l$. The dimensions and the HWGs of the Coulomb branches of the magnetic quivers $\mathcal{C}(\mathsf{Q})$ are provided.} \label{afterfold} \end{table} \begin{table}[t] \small \centering \begin{adjustbox}{center} \begin{tabular}{c|cc|cc} \toprule \multirow{2}{*}{Family} & \multicolumn{2}{c|}{Case $n=1$} & \multicolumn{2}{c}{Case $n=0$} \\ & Magnetic quiver&Moduli space & Magnetic quiver&Moduli space \\ \midrule $C_{n+3}$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-0.925, 0) {}; \node [style=none] (6) at (-0.925, -0.5) {3}; \node [style=gauge3] (12) at (-1.925, 0) {}; \node [style=none] (15) at (-1.925, -0.5) {2}; \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {4}; \node [style=none] (30) at (-0.75, 0.075) {}; \node [style=none] (31) at (0.25, 0.075) {}; \node [style=none] (32) at (-0.75, -0.075) {}; \node [style=none] (33) at (0.25, -0.075) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (-0.125, 0.375) {}; \node [style=none] (36) at (-0.125, -0.375) {}; \node [style=gauge3] (37) at (1, 0) {}; \node [style=none] (38) at (1, -0.5) {2}; \node [style=gauge3] (39) at (-2.925, 0) {}; \node [style=none] (42) at (-2.925, -0.5) {1}; \node [style=blankflavor] (43) at (0.25, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (24); \draw (12) to (2); \draw (39) to (12); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $\overline{\mathcal{O}}^{\text{min}}_{E_6}$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-0.925, 0) {}; \node [style=none] (6) at (-0.925, -0.5) {2}; \node [style=gauge3] (12) at (-1.925, 0) {}; \node [style=none] (15) at (-1.925, -0.5) {1}; \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {3}; \node [style=none] (30) at (-0.75, 0.075) {}; \node [style=none] (31) at (0.25, 0.075) {}; \node [style=none] (32) at (-0.75, -0.075) {}; \node [style=none] (33) at (0.25, -0.075) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (-0.125, 0.375) {}; \node [style=none] (36) at (-0.125, -0.375) {}; \node [style=gauge3] (37) at (1, 0) {}; \node [style=none] (38) at (1, -0.5) {2}; \node [style=blankflavor] (39) at (0.25, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (24); \draw (12) to (2); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} &$\mathbb{H}^7$ \\ \midrule $C_{n+1} \times A_1$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {1}; \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {2}; \node [style=none] (30) at (-0.75, 0.075) {}; \node [style=none] (31) at (0.25, 0.075) {}; \node [style=none] (32) at (-0.75, -0.075) {}; \node [style=none] (33) at (0.25, -0.075) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (-0.125, 0.375) {}; \node [style=none] (36) at (-0.125, -0.375) {}; \node [style=gauge3] (37) at (1, 0) {}; \node [style=none] (38) at (1, -0.5) {2}; \node [style=gauge3] (39) at (2.25, 0) {}; \node [style=none] (40) at (1, 0.075) {}; \node [style=none] (41) at (2.25, 0.075) {}; \node [style=none] (42) at (1, -0.075) {}; \node [style=none] (43) at (2.25, -0.075) {}; \node [style=none] (44) at (1.75, 0) {}; \node [style=none] (45) at (1.375, 0.375) {}; \node [style=none] (46) at (1.375, -0.375) {}; \node [style=none] (49) at (2.25, -0.5) {1}; \node [style=blankflavor] (50) at (0.25, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (24); \draw (40.center) to (41.center); \draw (43.center) to (42.center); \draw (45.center) to (44.center); \draw (44.center) to (46.center); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $\overline{\mathcal{O}}^{\text{min}}_{D_4}$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {1}; \node [style=none] (31) at (0.25, 0.075) {}; \node [style=none] (33) at (0.25, -0.075) {}; \node [style=gauge3] (37) at (1, 0) {}; \node [style=none] (38) at (1, -0.5) {2}; \node [style=gauge3] (39) at (2.25, 0) {}; \node [style=none] (40) at (1, 0.075) {}; \node [style=none] (41) at (2.25, 0.075) {}; \node [style=none] (42) at (1, -0.075) {}; \node [style=none] (43) at (2.25, -0.075) {}; \node [style=none] (44) at (1.75, 0) {}; \node [style=none] (45) at (1.375, 0.375) {}; \node [style=none] (46) at (1.375, -0.375) {}; \node [style=none] (49) at (2.25, -0.5) {1}; \node [style=blankflavor] (50) at (1, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (37) to (24); \draw (40.center) to (41.center); \draw (43.center) to (42.center); \draw (45.center) to (44.center); \draw (44.center) to (46.center); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} &$\mathbb{H}^3$ \\ \midrule $C_n \times U_1$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {1}; \node [style=none] (31) at (0.25, 0.075) {}; \node [style=none] (33) at (0.25, -0.075) {}; \node [style=gauge3] (37) at (1.25, 0.5) {}; \node [style=gauge3] (38) at (1.25, -0.5) {}; \node [style=none] (39) at (1.75, 0.5) {1}; \node [style=none] (40) at (1.75, -0.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (37) to (33.center); \draw (38) to (31.center); \draw (37) to (38); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $\overline{\mathcal{O}}^{\text{min}}_{A_2}$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (37) at (1.25, 0.5) {}; \node [style=gauge3] (38) at (1.25, -0.5) {}; \node [style=none] (39) at (1.75, 0.5) {1}; \node [style=none] (40) at (1.75, -0.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (37) to (38); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $\mathbb{H}$\\ \midrule $A_{n+1}$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {2}; \node [style=gauge3] (24) at (0.5, 0) {}; \node [style=none] (29) at (0.5, -0.5) {3}; \node [style=none] (30) at (-1, 0.15) {}; \node [style=none] (31) at (0.5, 0.15) {}; \node [style=none] (32) at (-1, -0.15) {}; \node [style=none] (33) at (0.5, -0.15) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (0, 0.5) {}; \node [style=none] (36) at (0, -0.5) {}; \node [style=gauge3] (37) at (-2, 0) {}; \node [style=none] (39) at (-2, -0.5) {1}; \node [style=blankflavor] (40) at (0.5, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (2) to (24); \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (2); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $\overline{\mathcal{O}}^{\text{min}}_{D_4}$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {1}; \node [style=gauge3] (24) at (0.5, 0) {}; \node [style=none] (29) at (0.5, -0.5) {2}; \node [style=none] (30) at (-1, 0.15) {}; \node [style=none] (31) at (0.5, 0.15) {}; \node [style=none] (32) at (-1, -0.15) {}; \node [style=none] (33) at (0.5, -0.15) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (0, 0.5) {}; \node [style=none] (36) at (0, -0.5) {}; \node [style=blankflavor] (37) at (0.5, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (2) to (24); \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $\mathbb{H}^2$\\ \midrule $A_{n-1} \times U_1$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (24) at (0.5, 0) {}; \node [style=none] (29) at (0.5, -0.5) {1}; \node [style=none] (31) at (0.5, 0.15) {}; \node [style=none] (33) at (0.5, -0.15) {}; \node [style=none] (35) at (0, 0.5) {}; \node [style=none] (36) at (0, -0.5) {}; \node [style=gauge3] (37) at (1.5, 0) {}; \node [style=none] (38) at (0.5, 0.075) {}; \node [style=none] (39) at (0.5, -0.1) {}; \node [style=none] (40) at (1.5, 0.075) {}; \node [style=none] (41) at (1.5, -0.1) {}; \node [style=none] (42) at (1.5, -0.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (40.center) to (38.center); \draw (39.center) to (41.center); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $\overline{\mathcal{O}}^{\text{min}}_{A_1}$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (37) at (1.5, 0) {}; \node [style=none] (40) at (1.5, 0.075) {}; \node [style=none] (41) at (1.5, -0.1) {}; \node [style=none] (42) at (1.5, -0.5) {1}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \end{pgfonlayer} \end{tikzpicture} } \end{tabular} &Trivial\\ \midrule $A_n{}'$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {1}; \node [style=gauge3] (24) at (0.5, 0) {}; \node [style=none] (29) at (0.5, -0.5) {2}; \node [style=none] (30) at (-1, 0.05) {}; \node [style=none] (31) at (0.5, 0.05) {}; \node [style=none] (32) at (-1, -0.075) {}; \node [style=none] (33) at (0.5, -0.075) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (0, 0.5) {}; \node [style=none] (36) at (0, -0.5) {}; \node [style=none] (37) at (-1, 0.15) {}; \node [style=none] (38) at (0.5, 0.15) {}; \node [style=none] (39) at (-1, -0.175) {}; \node [style=none] (40) at (0.5, -0.175) {}; \node [style=blankflavor] (41) at (0.5, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37.center) to (38.center); \draw (39.center) to (40.center); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} &$\overline{\mathcal{O}}^{\text{min}}_{A_2}$ & \begin{tabular}{c} \scalebox{0.70}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (24) at (0.5, 0) {}; \node [style=none] (29) at (0.5, -0.5) {1}; \node [style=none] (31) at (0.5, 0.05) {}; \node [style=none] (33) at (0.5, -0.075) {}; \node [style=none] (38) at (0.5, 0.175) {}; \node [style=none] (40) at (0.5, -0.2) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \end{pgfonlayer} \end{tikzpicture} } \end{tabular} &Trivial\\ \bottomrule \end{tabular} \end{adjustbox} \caption{The $n=1$ and $n=0$ members of the general Families of Table \ref{afterfold}, where the Coulomb branches are closures of minimal nilpotent orbits and freely generated theories respectively. The $n=1$ cases correspond to rank 1 theories without enhanced Coulomb branch. Notice that the global symmetry here does not match the labelling of the family.} \label{nilpotent} \end{table} \paragraph{Orbifolds $\mathbb{H}/\mathbb{Z}_k$ for $k=2,3,4,6$.} Another pattern that emerges is the relation between magnetic quivers before folding and $5d$ $\mathcal{N}=1$ SQCD theories of $SU(n+1)_{0}$ with $N_f$ flavours. In the $\mathbb{Z}_2$ column in Table \ref{resulttable}, we start with the $C_5$ theory with $N_f=2n+4$ and the flavor reduces by 2 when we go to the next row for $C_3\times A_1$ and another 2 for $C_2 \times U_1$. Following this, the $C_1\times \chi_0$ (which is the $\mathbb{H}/\mathbb{Z}_2$ orbifold) family should come as the magnetic quiver of the $n=1$ member of the family $SU(n+1)_0$ with $2n-2$ flavours. The magnetic quiver of the $5d$ $\mathcal{N}=1$ theory takes the form: \begin{equation}\scalebox{.8}{ \raisebox{-.5\height}{ \begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (0) at (0, 0) {}; \node [style=gauge3] (1) at (1, 0) {}; \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (4) at (0, -0.5) {$n{-}1$}; \node [style=none] (5) at (1, -0.5) {$n{-}2$}; \node [style=none] (6) at (-1, -0.5) {$n{-}2$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=none] (10) at (1.75, 0) {\ldots}; \node [style=gauge3] (11) at (2.5, 0) {}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (14) at (2.5, -0.5) {1}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=none] (24) at (1.375, 0) {}; \node [style=none] (25) at (2.15, 0) {}; \node [style=gauge3] (26) at (-0.75, 1) {}; \node [style=gauge3] (27) at (0.75, 1) {}; \node [style=none] (28) at (-0.75, 1.5) {1}; \node [style=none] (29) at (0.75, 1.5) {1}; \node [style=none] (30) at (-0.7, 1.1) {}; \node [style=none] (31) at (-0.7, 0.925) {}; \node [style=none] (32) at (0.8, 1.1) {}; \node [style=none] (33) at (0.8, 0.925) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (0) to (1); \draw (0) to (2); \draw (24.center) to (1); \draw (25.center) to (11); \draw (23.center) to (2); \draw (22.center) to (12); \draw (26) to (0); \draw (0) to (27); \draw (30.center) to (32.center); \draw (33.center) to (31.center); \end{pgfonlayer} \end{tikzpicture} }} \label{orbifoldfamily} \end{equation} The HWG reads \begin{equation} \mathrm{HWG}(\mu_i,t)=\mathrm{PE}\left[\sum\limits_{i=1}^{n+1}\mu_i\mu_{2n-2-i}t^{2i} + t^2 + \mu_{n-1} \left(q+\frac{1}{q}\right) t^{n+1}-\mu_{n-1}^2t^{2n+2} \right] \end{equation} and \begin{equation} \mathrm{dim}_{\mathbb{H}}\mathcal{H}\eqref{orbifoldfamily}=n-1 \,. \end{equation} Folding the quiver \eqref{orbifoldfamily} yields the general family of the $\mathbb{H}/\mathbb{Z}_2$ rank 1 theories is tabulated in Table \ref{orbifolds}. Since the orbifold itself is a minimal nilpotent orbit, the $n=1$ case gives our desired $\mathbb{H}/\mathbb{Z}_2$ theory. For the remaining orbifolds $\mathbb{H}/\mathbb{Z}_k$ with $k=2,3,4,6$, the general family of quiver before folding will be \eqref{orbifoldfamily} but with $k$ multiplicity of hypermultiplets between the two $U(1)$ nodes and $k$ long legs from 1 to $n-1$. The folded quivers are listed in Table \ref{orbifolds}. The $n=1$ cases reduces to the $\mathbb{H}\slash \mathbb{Z}_k$ orbifolds. % \begin{table}[t] \small \centering \begin{adjustbox}{center} \begin{tabular}{cccc} \toprule Family & Magnetic quiver&$G_{\mathrm{global}}$ &$\text{PL}(\mathrm{HWG})$ \\ \midrule $\mathbb{H}/\mathbb{Z}_2$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {$n{-}2$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {$n{-}1$}; \node [style=none] (30) at (-1, 0.075) {}; \node [style=none] (31) at (0.25, 0.075) {}; \node [style=none] (32) at (-1, -0.075) {}; \node [style=none] (33) at (0.25, -0.075) {}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (-0.125, 0.375) {}; \node [style=none] (36) at (-0.125, -0.375) {}; \node [style=gauge3] (37) at (1.25, 0.5) {}; \node [style=gauge3] (38) at (1.25, -0.5) {}; \node [style=none] (39) at (1.75, 0.5) {1}; \node [style=none] (40) at (1.75, -0.5) {1}; \node [style=none] (41) at (1.15, 0.425) {}; \node [style=none] (42) at (1.35, 0.425) {}; \node [style=none] (43) at (1.15, -0.5) {}; \node [style=none] (44) at (1.35, -0.5) {}; \node [style=blankflavor] (45) at (0.25, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (23.center) to (2); \draw (22.center) to (12); \draw (30.center) to (31.center); \draw (33.center) to (32.center); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (37) to (33.center); \draw (38) to (31.center); \draw (41.center) to (43.center); \draw (42.center) to (44.center); \end{pgfonlayer} \end{tikzpicture} } \end{tabular} & $C_{n-1}\times U_1$ & \begin{tabular}{c} \parbox{4.3cm}{\footnotesize $\sum\limits_{i=1}^{n-1}\mu_i^2t^{2i} + t^2 + \mu_{n-1} (q+\frac{1}{q}) t^{n+1}\\-\mu_{n-1}^2t^{2n+2}$} \end{tabular}\\ $\mathbb{H}/\mathbb{Z}_3$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {$n{-}2$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {$n{-}1$}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (-0.125, 0.375) {}; \node [style=none] (36) at (-0.125, -0.375) {}; \node [style=gauge3] (37) at (1.25, 0.5) {}; \node [style=gauge3] (38) at (1.25, -0.5) {}; \node [style=none] (39) at (1.75, 0.5) {1}; \node [style=none] (40) at (1.75, -0.5) {1}; \node [style=none] (41) at (-1, 0.125) {}; \node [style=none] (42) at (-1, 0) {}; \node [style=none] (43) at (-1, -0.125) {}; \node [style=none] (44) at (0.25, 0.125) {}; \node [style=none] (45) at (0.25, 0) {}; \node [style=none] (46) at (0.25, -0.125) {}; \node [style=none] (47) at (1.1, -0.6) {}; \node [style=none] (48) at (1.4, -0.6) {}; \node [style=none] (49) at (1.25, -0.625) {}; \node [style=none] (50) at (1.1, 0.4) {}; \node [style=none] (51) at (1.4, 0.4) {}; \node [style=none] (52) at (1.25, 0.375) {}; \node [style=blankflavor] (53) at (0.25, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (23.center) to (2); \draw (22.center) to (12); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (44.center) to (41.center); \draw (42.center) to (45.center); \draw (46.center) to (43.center); \draw (50.center) to (47.center); \draw (48.center) to (51.center); \draw (52.center) to (49.center); \draw (24) to (37); \draw (38) to (24); \end{pgfonlayer} \end{tikzpicture}} \end{tabular} & $A_{n-2}\times U_1$ & \begin{tabular}{c} Complicated \end{tabular}\\ $\mathbb{H}/\mathbb{Z}_4$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {$n{-}2$}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {$n{-}1$}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (-0.125, 0.375) {}; \node [style=none] (36) at (-0.125, -0.375) {}; \node [style=gauge3] (37) at (1.25, 0.5) {}; \node [style=gauge3] (38) at (1.275, -0.5) {}; \node [style=none] (39) at (1.75, 0.5) {1}; \node [style=none] (40) at (1.75, -0.5) {1}; \node [style=none] (41) at (-1, 0.075) {}; \node [style=none] (42) at (-1, -0.05) {}; \node [style=none] (43) at (-1, -0.15) {}; \node [style=none] (44) at (0.25, 0.075) {}; \node [style=none] (45) at (0.25, -0.05) {}; \node [style=none] (46) at (0.25, -0.15) {}; \node [style=none] (47) at (1.075, -0.45) {}; \node [style=none] (48) at (1.45, -0.45) {}; \node [style=none] (49) at (1.2, -0.475) {}; \node [style=none] (50) at (1.075, 0.4) {}; \node [style=none] (51) at (1.45, 0.4) {}; \node [style=none] (52) at (1.2, 0.375) {}; \node [style=none] (53) at (-1, 0.175) {}; \node [style=none] (54) at (0.25, 0.175) {}; \node [style=none] (55) at (1.325, -0.45) {}; \node [style=none] (56) at (1.325, 0.4) {}; \node [style=blankflavor] (57) at (0.25, 0) {}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (23.center) to (2); \draw (22.center) to (12); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (44.center) to (41.center); \draw (42.center) to (45.center); \draw (46.center) to (43.center); \draw (50.center) to (47.center); \draw (48.center) to (51.center); \draw (52.center) to (49.center); \draw (24) to (37); \draw (38) to (24); \draw (54.center) to (53.center); \draw (55.center) to (56.center); \end{pgfonlayer} \end{tikzpicture}} \end{tabular} & $A_{n-2}\times U_1$ & \begin{tabular}{c} Complicated \end{tabular}\\ $\mathbb{H}/\mathbb{Z}_6$ & \begin{tabular}{c} \scalebox{0.70}{\begin{tikzpicture} \begin{pgfonlayer}{nodelayer} \node [style=gauge3] (2) at (-1, 0) {}; \node [style=none] (6) at (-1, -0.5) {$n{-}2$}; \node [style=gauge3] (12) at (-2.5, 0) {}; \node [style=none] (15) at (-2.5, -0.5) {1}; \node [style=none] (22) at (-2.125, 0) {}; \node [style=none] (23) at (-1.35, 0) {}; \node [style=gauge3] (24) at (0.25, 0) {}; \node [style=none] (29) at (0.25, -0.5) {$n{-}1$}; \node [style=none] (34) at (-0.5, 0) {}; \node [style=none] (35) at (-0.125, 0.375) {}; \node [style=none] (36) at (-0.125, -0.375) {}; \node [style=blankflavor] (57) at (0.25, 0) {}; \node [style=gauge3] (37) at (1.25, 0.5) {}; \node [style=gauge3] (38) at (1.25, -0.5) {}; \node [style=none] (39) at (1.75, 0.5) {1}; \node [style=none] (40) at (1.75, -0.5) {1}; \node [style=none] (41) at (-1, 0.075) {}; \node [style=none] (42) at (-1, -0.05) {}; \node [style=none] (43) at (-1, -0.15) {}; \node [style=none] (44) at (0.25, 0.075) {}; \node [style=none] (45) at (0.25, -0.05) {}; \node [style=none] (46) at (0.25, -0.15) {}; \node [style=none] (47) at (1.075, -0.35) {}; \node [style=none] (48) at (1.325, -0.35) {}; \node [style=none] (49) at (1.175, -0.375) {}; \node [style=none] (50) at (1.075, 0.4) {}; \node [style=none] (51) at (1.325, 0.4) {}; \node [style=none] (52) at (1.175, 0.375) {}; \node [style=none] (53) at (-1, 0.175) {}; \node [style=none] (54) at (0.25, 0.175) {}; \node [style=none] (55) at (1.425, -0.35) {}; \node [style=none] (56) at (1.425, 0.4) {}; \node [style=none] (8) at (-1.75, 0) {\ldots}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (23.center) to (2); \draw (22.center) to (12); \draw (35.center) to (34.center); \draw (34.center) to (36.center); \draw (24) to (37); \draw (38) to (24); \draw (-1,.03) to (.25,.03); \draw (-1,.09) to (.25,.09); \draw (-1,.15) to (.25,.15); \draw (-1,-.03) to (.25,-.03); \draw (-1,-.09) to (.25,-.09); \draw (-1,-.15) to (.25,-.15); \draw (1.10,-.5) to (1.10,.5); \draw (1.16,-.5) to (1.16,.5); \draw (1.22,-.5) to (1.22,.5); \draw (1.28,-.5) to (1.28,.5); \draw (1.34,-.5) to (1.34,.5); \draw (1.40,-.5) to (1.40,.5); \end{pgfonlayer} \end{tikzpicture}} \end{tabular} & $A_{n-2}\times U_1$ & \begin{tabular}{c} Complicated \end{tabular}\\ \bottomrule \end{tabular} \end{adjustbox} \caption{The $n=1$ case of these families correspond to the magnetic quivers of $4d$ $\mathcal{N}=2$ rank 1 theories whose Higgs branch are $\mathbb{H}/\mathbb{Z}_k$ orbifolds for $k=2,3,4,6$. } \label{orbifolds} \end{table} \paragraph{Hasse diagram for general families.} Some of the generalised families have simple and linear Hasse diagrams, which are presented in Table \ref{tabHasse}. For the remaining three families $A_3$, $A_1 \times U_1$, and $A_2$ (which do not come from folding a magnetic quiver of infinite coupling SQCD in 5d) the Hasse diagrams are elaborate and are not detailed here. It can be noted, that these are also the theories with complicated HWGs. \begin{table}[t] \centering \begin{tabular}{ccc||c} \toprule $C_{n+3}$ & $C_{n+1}\times A_1$ & $C_n \times U_1$ & $\mathbb{H}/\mathbb{Z}_2$ \\ \midrule \raisebox{-.5\height}{\begin{tikzpicture}[scale=0.7] \begin{pgfonlayer}{nodelayer} \node at (-1, 7) {};\node at (1, -6) {}; \node [style=bd] (0) at (0, 6) {}; \node [style=bd] (1) at (0, 4) {}; \node [style=bd] (2) at (0, 2) {}; \node [style=bd] (3) at (0, 0) {}; \node [style=none] (4) at (0.5, 5) { $e_6$}; \node [style=none] (5) at (0.5, 3) {$c_5$}; \node [style=none] (6) at (0.5, 1) {$c_6$}; \node [style=none] (7) at (0, -0.75) {}; \node [style=none] (8) at (0, -2.25) {}; \node [style=bd] (9) at (0, -3) {}; \node [style=none] (10) at (0, -1.5) {\vdots}; \node [style=bd] (11) at (0, -5) {}; \node [style=none] (12) at (0.8, -4) {$c_{n+3}$ }; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (0) to (1); \draw (1) to (2); \draw (2) to (3); \draw (3) to (7.center); \draw (8.center) to (9); \draw (9) to (11); \end{pgfonlayer} \end{tikzpicture}} & \raisebox{-.5\height}{\begin{tikzpicture}[scale=0.7] \begin{pgfonlayer}{nodelayer} \node at (-1, 7) {}; \node at (2.5, -8) {}; \node [style=bd] (0) at (0, 6) {}; \node [style=bd] (1) at (1.25, 4) {}; \node [style=bd] (2) at (1.25, 2) {}; \node [style=bd] (3) at (1.25, 0) {}; \node [style=none] (4) at (1, 5.25) {$d_4$}; \node [style=none] (5) at (1.75, 3) {$c_3$}; \node [style=none] (6) at (1.75, 1) {$c_4$}; \node [style=none] (7) at (1.25, -2.75) {}; \node [style=none] (8) at (1.25, -4.5) {}; \node [style=bd] (9) at (1.25, -5.5) {}; \node [style=none] (10) at (1.25, -3.75) {\vdots}; \node [style=bd] (11) at (1.25, -7.5) {}; \node [style=none] (12) at (2.05, -6.5) {$c_{n+1}$}; \node [style=bd] (13) at (0, 1.5) {}; \node [style=bd] (14) at (0, -0.5) {}; \node [style=none] (15) at (0, -1.25) {}; \node [style=none] (16) at (0, -3.25) {}; \node [style=none] (17) at (0, -2.5) {\vdots}; \node [style=bd] (18) at (0, -4) {}; \node [style=bd] (19) at (0, -6) {}; \node [style=none] (20) at (-0.5, 3.5) {$e_6$}; \node [style=none] (22) at (0.775, 1.1) {$A_1$}; \node [style=bd] (23) at (1.25, -2) {}; \node [style=none] (24) at (0.75, -0.8) {$A_1$}; \node [style=none] (25) at (1.8, -1) {$c_5$}; \node [style=none] (26) at (-0.45, 0.5) {$c_5$}; \node [style=none] (27) at (0.775, -4.3) {$A_1$}; \node [style=none] (28) at (0.8, -6.325) {$A_1$}; \node [style=none] (29) at (-0.65, -5) {$c_{n+1}$}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (0) to (1); \draw (1) to (2); \draw (2) to (3); \draw (3) to (7.center); \draw (8.center) to (9); \draw (9) to (11); \draw (0) to (13); \draw (13) to (14); \draw (14) to (15.center); \draw (16.center) to (18); \draw (18) to (19); \draw (19) to (11); \draw (13) to (3); \draw (14) to (23); \draw (18) to (9); \end{pgfonlayer} \end{tikzpicture}} & \raisebox{-.5\height}{\begin{tikzpicture}[scale=0.7] \begin{pgfonlayer}{nodelayer} \node at (-1, 7) {};\node at (1, -6) {}; \node [style=bd] (0) at (0, 6) {}; \node [style=bd] (1) at (0, 4) {}; \node [style=bd] (2) at (0, 2) {}; \node [style=bd] (3) at (0, 0) {}; \node [style=none] (4) at (0.5, 5) {$a_2$}; \node [style=none] (5) at (0.5, 3) {$c_2$}; \node [style=none] (6) at (0.5, 1) { $c_3$}; \node [style=none] (7) at (0, -0.75) {}; \node [style=none] (8) at (0, -2.25) {}; \node [style=bd] (9) at (0, -3) {}; \node [style=none] (10) at (0, -1.5) {\vdots}; \node [style=bd] (11) at (0, -5) {}; \node [style=none] (12) at (0.6, -4) {$c_n$}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (0) to (1); \draw (1) to (2); \draw (2) to (3); \draw (3) to (7.center); \draw (8.center) to (9); \draw (9) to (11); \end{pgfonlayer} \end{tikzpicture}} & \raisebox{-.5\height}{\begin{tikzpicture}[scale=0.7] \begin{pgfonlayer}{nodelayer} \node at (-1, 7) {}; \node at (1, -6) {}; \node [style=bd] (0) at (0, 6) {}; \node [style=bd] (1) at (0, 4) {}; \node [style=bd] (2) at (0, 2) {}; \node [style=bd] (3) at (0, 0) {}; \node [style=none] (4) at (0.5, 5) {$A_1$}; \node [style=none] (5) at (0.5, 3) {$A_1$}; \node [style=none] (6) at (0.5, 1) {$c_2$}; \node [style=none] (7) at (0, -0.75) {}; \node [style=none] (8) at (0, -2.25) {}; \node [style=bd] (9) at (0, -3) {}; \node [style=none] (10) at (0, -1.5) {\vdots}; \node [style=bd] (11) at (0, -5) {}; \node [style=none] (12) at (0.7, -4) {$c_{n-1}$}; \end{pgfonlayer} \begin{pgfonlayer}{edgelayer} \draw (0) to (1); \draw (1) to (2); \draw (2) to (3); \draw (3) to (7.center); \draw (8.center) to (9); \draw (9) to (11); \end{pgfonlayer} \end{tikzpicture}} \\ \bottomrule \end{tabular} \caption{Hasse diagrams for the first three families of quivers in Table \ref{afterfold}, and for the generalised $\mathbb{H}/\mathbb{Z}_2$ family of quivers in Table \ref{orbifolds}.} \label{tabHasse} \end{table} Similarly, we provide the Hasse diagram for the generalised family of $\mathbb{H}/\mathbb{Z}_2$ in Table \ref{tabHasse} as the other orbifold families have elaborate Hasse diagrams. \section{Outlook} In this note we study Higgs branches of $4d$ $\mathcal{N}=2$ SCFTs through the use of magnetic quivers. Due to recent work on understanding $3d$ $\mathcal{N}=4$ Coulomb branches, in all cases these magnetic quivers can be guessed based on little information, such as global symmetry, dimension, etc.\ of the Higgs branch of the SCFT. It is possible to compare these results with previous work on compactifying higher dimensional theories to obtain said SCFTs. Through quiver subtraction the Hasse diagrams of the Higgs branches are obtained. A goal for the future would be a systematic study of magnetic quivers for higher rank theories other than the families discussed here. Current work on classifying these theories may provide a Cockaigne for the dedicated magnetic quiverist. \section*{Acknowledgements} We are grateful to Philip Argyres, Simone Giacomelli, Rudolph Kalveks, Mario Martone, Noppadol Mekareeya, Dominik Miketa, Travis Schedler, Alex Weekes and Anton Zajac for helpful discussions. The work of AB, JFG, AH and ZZ is supported by the STFC Consolidated Grant ST/P000762/1. The work of MS is supported by the National Thousand-Young-Talents Program of China, the National Natural Science Foundation of China (grant no.\ 11950410497), and the China Postdoctoral Science Foundation (grant no.\ 2019M650616). The work of GZ is supported in part by World Premier International Research Center Initiative (WPI), MEXT, Japan, by the ERC-STG grant 637844-HBQFTNCER and by the INFN.
\section{Introduction} The logical analysis of Ramsey-theoretic statements is a long-standing program in recursion theory, going back to Specker's example of a recursive graph on the natural numbers with no infinite recursive homogeneous set~\cite{Specker}. In this tradition, we analyze the result of Rival and Sands stated in Theorem~\ref{thm-RSg} below, which we refer to as an \emph{inside/outside Ramsey theorem}. Our title is an homage to Jockusch's classic and ever-inspiring work \emph{Ramsey's theorem and recursion theory}~\cite{JockuschRamsey}. \begin{Theorem}[Rival and Sands~\cite{RivalSands}]\label{thm-RSg} Every infinite graph $G$ contains an infinite subset $H$ such that every vertex of $G$ is adjacent to precisely none, one, or infinitely many vertices of $H$. \end{Theorem} In Theorem~\ref{thm-RSg} and throughout this work, a \emph{graph} is a simple graph, that is, an undirected graph without loops or multiple edges. Furthermore, we consider only countable graphs whose vertices are sets of natural numbers. Compare Theorem~\ref{thm-RSg} to Ramsey's theorem for pairs and two colors, which in terms of graphs is phrased as follows. \begin{Theorem} Every countably infinite graph $G$ contains an infinite subset $H$ that is \emph{homogeneous} for $G$, i.e., is either a \emph{clique} (every pair of distinct vertices from $H$ is adjacent) or an independent set (no pair of distinct vertices from $H$ is adjacent). \end{Theorem} The \emph{Rival--Sands theorem} is thus an analog of Ramsey's theorem for pairs which prescribes the relation between \emph{every} vertex of the graph and the distinguished set $H$. In other words, the Rival--Sands theorem provides information about vertices both \emph{inside} and \emph{outside} $H$. This is why we describe the Rival--Sands theorem as an inside/outside Ramsey theorem. In the words of Rival and Sands: \begin{quote} While Ramsey's result completely describes the adjacency structure of the distinguished subgraph, it provides no information about those edges which join vertices inside the subgraph to vertices external to it. Our main result is, in a sense, a trade-off: it provides information about the adjacency structure of an arbitrary vertex, with respect to the vertices of a distinguished infinite subgraph; on the other hand, the information that it provides about the adjacency structure of vertices internal to the subgraph is incomplete.~\cite{RivalSands} \end{quote} The trade-off is necessary. In~\cite{RivalSands}*{Section~3}, Rival and Sands give an example of a graph in which no infinite homogeneous set satisfies the conclusion of their theorem. We analyze the axiomatic and computational strength of the Rival--Sands theorem from the perspective of \emph{reverse mathematics} and the \emph{Weihrauch degrees}. Ramsey's theorem for pairs is studied extensively in both of these contexts, which we introduce further in Sections~\ref{sec-RMPrelim} and~\ref{sec-WPrelim}. The Rival--Sands theorem was inspired by Ramsey's theorem for pairs, and the two statements look very similar, so it is natural to ask how their strengths compare. In Section~\ref{sec-RMRS}, we analyze the axiomatic strength of the Rival--Sands theorem from the perspective of reverse mathematics. \emph{Reverse mathematics} is a foundational program initiated by H.\ Friedman~\cite{Friedman} designed to answer questions of the sort \emph{What axioms of second-order arithmetic are required to prove a given classical theorem of countable mathematics?} Reasoning takes place over a base theory called $\mathsf{RCA}_0$, which corresponds to recursive mathematics. Theorems are classified according to what extra axioms must be added to $\mathsf{RCA}_0$ in order to prove them. See Section~\ref{sec-RMPrelim} for further introduction. Theorem~\ref{thm-ACA_RS_eq} shows that the Rival--Sands theorem is equivalent to the axiom system $\mathsf{ACA}_0$ over $\mathsf{RCA}_0$. On the other hand, Ramsey's theorem for pairs is strictly weaker than $\mathsf{ACA}_0$ by a classic result of Seetapun and Slaman~\cite{SeetapunSlaman}. Therefore the axiomatic strength of the Rival--Sands theorem is strictly greater than that of Ramsey's theorem for pairs. With input from Jeffry Hirst and Steffen Lempp, we also consider a weakened \emph{inside only} form of the Rival--Sands theorem, in which the conclusion need only hold for the vertices of $H$, not all vertices of $G$: every infinite graph $G$ contains an infinite subset $H$ such that every vertex of $H$ is adjacent to precisely none, one, or infinitely many vertices of $H$. This so-called \emph{weak Rival--Sands theorem} is a trivial consequence of Ramsey's theorem for pairs because homogeneous sets satisfy the conclusion of the weak Rival--Sands theorem. Degree-theoretically, the weak Rival--Sands theorem is weaker than Ramsey's theorem for pairs. The Turing jump of an infinite graph $G$ suffices to produce an $H$ as in the conclusion of the weak Rival--Sands theorem (see Proposition~\ref{prop-wRSgCompLoc}), but it does not necessarily suffice to produce a homogeneous set as in the conclusion of Ramsey's theorem for pairs. Axiomatically, however, Theorem~\ref{thm-RT_WRSG_eq} shows that the weak Rival--Sands theorem and Ramsey's theorem for pairs are equivalent over $\mathsf{RCA}_0$. We may therefore think of the weak Rival--Sands theorem as being a weaker formalization of Ramsey's theorem for pairs. We hope that this equivalence will prove useful to future studies of Ramsey's theorem for pairs. Rival and Sands's proof of their theorem consists of intricate yet elementary reasoning that can be formalized in $\mathsf{ACA}_0$ with a little engineering. Instead of proceeding along these lines, we give a short, satisfying proof using cohesive sets. The reversal of the Rival--Sands theorem is, however, unsatisfying because $\mathsf{ACA}_0$ is too coarse to see the difference between the computational strength used to implement the proof and the computational strength extracted by the reversal. To produce the set $H$, our proof of the Rival--Sands theorem uses (after some refinement) a function of $\mathrm{PA}$ degree relative to the double Turing jump of $G$, whereas the reversal need only code a single Turing jump of $G$ into $H$. Moreover, the reversal can be implemented using only \emph{locally finite} graphs, that is, graphs in which each vertex has only finitely many neighbors. In Section~\ref{sec-WRS}, we turn to the \emph{Weihrauch degrees} to give a precise characterization of the Rival--Sands theorem's computational strength. What has come to be known as \emph{Weihrauch reducibility} was introduced by Weihrauch in~\cites{WeihrauchDegrees, WeihrauchTTE} and is used to compare mathematical theorems according to their uniform computational strength. In this setting we think of theorems in terms of \emph{inputs and outputs} or \emph{instances and solutions}. For example, for the Rival--Sands theorem, an input or instance is any countable graph $G$, and an output or solution to $G$ is any $H$ as in the conclusion of the theorem. Theorems that can be phrased in terms of instances and solutions in this way are sometimes referred to as \emph{problems}. Roughly, problem $\pb{P}$ \emph{Weihrauch reduces} to problem $\pb{Q}$ if there are uniform computational procedures converting instances of $\pb{P}$ into instances of $\pb{Q}$ and then converting solutions of the converted $\pb{Q}$-instance back into solutions to the original $\pb{P}$-instance. Two problems are \emph{Weihrauch equivalent} if they Weihrauch reduce to each other. Weihrauch equivalent problems are also said to have the same \emph{Weihrauch degree}. Precise definitions and background are given in Section~\ref{sec-WPrelim}. Section~\ref{sec-WPrelim} also addresses a few apparent gaps in the literature concerning the ascending/descending sequence principle in the Weihrauch degrees. Theorem~\ref{thm-RSGequivWKLjj} shows that the Rival--Sands theorem is Weihrauch equivalent to the double jump of weak K\"{o}nig's lemma, which is the problem of finding an infinite path through an infinite binary tree described via a $\mbf{\Delta}^0_3$-approximation. To our knowledge, the Rival--Sands theorem is the first ordinary mathematical theorem shown to exhibit exactly this strength. Furthermore, by~\cite{BrattkaRakotoniaina}*{Corollary~4.18}, the double jump of weak K\"{o}nig's lemma is also equivalent to the parallelization of Ramsey's theorem for pairs, which is the problem of solving a countable sequence of Ramsey's theorem instances. Thus, in terms of uniform computational strength, solving one instance of the Rival--Sands theorem exactly corresponds to solving countably many instances of Ramsey's theorem for pairs simultaneously in parallel. In Section~\ref{sec-wRSgWeihrauch}, we position the weak Rival--Sands theorem in the Weihrauch degrees. We find that the uniform computational strength of the weak Rival--Sands theorem is much less than that of Ramsey's theorem for pairs, despite the two theorems being equivalent over $\mathsf{RCA}_0$. For example, the ascending/descending sequence principle, and even the weaker stable ascending/descending chain principle studied in~\cite{AstorDzhafarovSolomonSuggs}, does not Weihrauch reduce to the weak Rival--Sands theorem. The diagonally non-recursive principle does not Weihrauch reduce to the weak Rival--Sands theorem either. This gives a further sense in which the weak Rival--Sands theorem is a weaker formalization of Ramsey's theorem for pairs. Nonetheless, the weak Rival--Sands theorem does exhibit non-trivial uniform computational strength. The infinite pigeonhole principle (i.e., Ramsey's theorem for singletons) for any finite number of partitions and the cohesiveness principle both Weihrauch reduce to the weak Rival--Sands theorem. Theorem~\ref{thm-wRSgWeiLoc} summarizes the location of the weak Rival--Sands theorem in the Weihrauch degrees. The main results of this work are the following. \begin{itemize} \item The Rival--Sands theorem is equivalent to $\mathsf{ACA}_0$ over $\mathsf{RCA}_0$ (Theorem~\ref{thm-ACA_RS_eq}). The forward direction of this result gives a new proof of the Rival--Sands theorem for countable graphs. \medskip \item The weak Rival--Sands theorem is equivalent to Ramsey's theorem for pairs over $\mathsf{RCA}_0$ (Theorem~\ref{thm-RT_WRSG_eq}, with Hirst and Lempp). \medskip \item The Rival--Sands theorem is Weihrauch equivalent to the double jump of weak K\"{o}nig's lemma (Theorem~\ref{thm-RSGequivWKLjj}) and is therefore also Weihrauch equivalent to the parallelization of Ramsey's theorem for pairs. To our knowledge, the Rival--Sands theorem is the first example of a natural theorem being equivalent to the double jump of weak K\"{o}nig's lemma. \medskip \item The diagonally non-recursive principle and the stable ascending/descending chain principle do not Weihrauch reduce to the weak Rival--Sands theorem, but the infinite pigeonhole principle and the cohesiveness principle do (Theorem~\ref{thm-wRSgWeiLoc}). The weak Rival--Sands theorem may therefore be thought of as a weaker formalization of Ramsey's theorem for pairs. \end{itemize} We make a few final remarks concerning the Rival--Sands theorem. First, Rival and Sands's proof proves their theorem as stated above for graphs of all infinite cardinalities. However, their proof produces a countable $H$ regardless of the cardinality of $G$. Gavalec and Vojt\'{a}\v{s}~\cite{GavalecVojtas} examine possible generalizations of the Rival--Sands theorem to uncountable graphs $G$, where $|H| = |G|$ is also required in the conclusion. Second, Rival and Sands observe that by restricting the class of graphs under consideration, it is possible to improve the conclusion of their theorem and obtain statements of the following form. Every infinite graph $G$ in a certain class contains an infinite subset $H$ such that every vertex of $G$ is adjacent to none, or infinitely many, vertices of $H$. The class they consider is the class of comparability graphs of partial orders of finite width, and the theorem they obtain is the following. \begin{Theorem}[Rival and Sands~\cite{RivalSands}]\label{thm-RSpo} Every infinite partially ordered set $P$ of finite width contains an infinite chain $C$ such that every element of $P$ is comparable with none, or infinitely many, of the elements of $C$. \end{Theorem} In work with Alberto Marcone~\cite{Fiori-CaronesMarconeShaferSolda}, we analyze the reverse mathematics of this Rival--Sands theorem for partial orders. \section{Reverse mathematics preliminaries}\label{sec-RMPrelim} We remind the reader of the essential details of mathematics in second-order arithmetic, the systems $\mathsf{RCA}_0$ and $\mathsf{ACA}_0$, and combinatorial principles related to Ramsey's theorem for pairs. For further information, the standard reference for reverse mathematics is Simpson's~\cite{SimpsonSOSOA}. A robust account of the reverse mathematics of Ramsey's theorem for pairs can be found in~\cite{HirschfeldtBook}. The language of second-order arithmetic is two-sorted. Objects of the first sort are thought of as natural numbers, and objects of the second sort are thought of as sets of natural numbers. Lower-case letters $a$, $b$, $c$, $x$, $y$, $z$, etc.\ usually denote first-order variables ranging over the first sort, and capital letters $A$, $B$, $C$, $X$, $Y$, $Z$, etc.\ usually denote second-order variables ranging over the second sort. The constant, function, and relation symbols are $0$, $1$, $<$, $+$, $\times$, and $\in$. As is customary, we use $\mathbb{N}$ as an abbreviation to denote the first-order part of whatever structure is under consideration. The axioms of $\mathsf{RCA}_0$ (for \emph{recursive comprehension axiom}) are \begin{itemize} \item a first-order sentence expressing that the numbers form a discretely ordered commutative semi-ring with identity; \medskip \item the \emph{$\Sigma^0_1$ induction scheme} (denoted $\mathsf{I}\Sigma^0_1$), which consists of the universal closures (by both first- and second-order quantifiers) of all formulas of the form \begin{align*} [\varphi(0) \wedge \forall n(\varphi(n) \rightarrow \varphi(n+1))] \rightarrow \forall n \varphi(n), \end{align*} where $\varphi$ is $\Sigma^0_1$; and \medskip \item the \emph{$\Delta^0_1$ comprehension scheme}, which consists of the universal closures (by both first- and second-order quantifiers) of all formulas of the form \begin{align*} \forall n (\varphi(n) \leftrightarrow \psi(n)) \rightarrow \exists X \forall n(n \in X \leftrightarrow \varphi(n)), \end{align*} where $\varphi$ is $\Sigma^0_1$, $\psi$ is $\Pi^0_1$, and $X$ is not free in $\varphi$. \end{itemize} The `$0$' in `$\mathsf{RCA}_0$' refers to the restriction of the induction scheme to $\Sigma^0_1$ formulas. $\mathsf{RCA}_0$ is able to implement the typical codings of finite sets and sequences of natural numbers as single natural numbers. See~\cite{SimpsonSOSOA}*{Section~II.2} for details on how this is done. The axioms of $\mathsf{ACA}_0$ (for \emph{arithmetical comprehension axiom}) are obtained by adding the \emph{arithmetical comprehension scheme} to $\mathsf{RCA}_0$. The arithmetical comprehension scheme consists of the universal closures of all formulas of the form \begin{align*} \exists X \forall n(n \in X \leftrightarrow \varphi(n)), \end{align*} where $\varphi$ is an arithmetical formula in which $X$ is not free. When proving that some statement implies $\mathsf{ACA}_0$ over $\mathsf{RCA}_0$, a common strategy is to show that the range of an arbitrary injection exists and then invoke the following well-known lemma. \begin{Lemma}[{\cite{SimpsonSOSOA}*{Lemma~III.1.3}}]\label{lem-ACAinjection} The following are equivalent over $\mathsf{RCA}_0$. \begin{enumerate} \item $\mathsf{ACA}_0$. \smallskip \item If $f \colon \mathbb{N} \rightarrow \mathbb{N}$ is an injection, then there is a set $X$ such that $\forall n(n \in X \leftrightarrow \exists s(f(s) = n))$. \end{enumerate} \end{Lemma} For a set $X \subseteq \mathbb{N}$, $[X]^2$ denotes the set of two-element subsets of $X$. It is often convenient to think of $[X]^2$ as $\{(x,y) : x,y \in X \wedge x < y\}$. A function $c \colon [\mathbb{N}]^2 \rightarrow \{0,1\}$ is called a \emph{$2$-coloring of pairs}. \emph{Ramsey's theorem for pairs and two colors} states that for every $2$-coloring of pairs, there is an infinite set $H$ such that all pairs made from the members $H$ have the same color. Such an $H$ is called \emph{homogeneous} for $c$. Ramsey's theorem for pairs and two colors famously decomposes into the conjunction of its \emph{stable version} and the \emph{cohesive principle}. \begin{Definition}{\ } \begin{itemize} \item \emph{Ramsey's theorem for pairs and two colors} $(\mathsf{RT}^2_2)$ is the following statement. For every $c \colon [\mathbb{N}]^2 \rightarrow \{0,1\}$, there is an infinite $H \subseteq \mathbb{N}$ and an $i \in \{0,1\}$ such that for all $(x,y) \in [H]^2$, $c(x,y) = i$. \medskip \item A coloring $c \colon [\mathbb{N}]^2 \rightarrow \{0,1\}$ is \emph{stable} if for every $n \in \mathbb{N}$, $\lim_s c(n,s)$ exists. \medskip \item \emph{Stable Ramsey's theorem for pairs and two colors} $(\mathsf{SRT}^2_2)$ is $\mathsf{RT}^2_2$ restricted to stable colorings. \end{itemize} \end{Definition} \begin{Definition}{\ } \begin{itemize} \item For sets $A, C \subseteq \mathbb{N}$, $C \subseteq^* A$ denotes that $C \setminus A$ is finite, and $A =^* C$ denotes that both $C \subseteq^* A$ and $A \subseteq^* C$. \medskip \item Let $\vec{A} = (A_i : i \in \mathbb{N})$ be a sequence of subsets of $\mathbb{N}$. A set $C \subseteq \mathbb{N}$ is called \emph{cohesive for $\vec{A}$} (or simply \emph{$\vec{A}$-cohesive}) if $C$ is infinite and for each $i \in \mathbb{N}$, either $C \subseteq^* A_i$ or $C \subseteq^* \ol{A_i}$. \medskip \item $\mathsf{COH}$ is the following statement. For every sequence $\vec{A}$ of subsets of $\mathbb{N}$, there is a set $C \subseteq \mathbb{N}$ that is cohesive for $\vec{A}$. \end{itemize} \end{Definition} \begin{Proposition}[\cite{CholakJockuschSlaman}*{Lemma~7.11}]\label{prop-rt22decomp} $\mathsf{RCA}_0 \vdash \mathsf{RT}^2_2 \leftrightarrow (\mathsf{SRT}^2_2 \wedge \mathsf{COH})$. \end{Proposition} For our purposes, it is helpful to notice that in $\mathsf{COH}$, the cohesive set $C$ can be taken to be a subset of any given infinite set $Z$. \begin{Lemma}\label{lem-COH_helper} $\mathsf{RCA}_0 + \mathsf{COH}$ proves the following statement. For every sequence $\vec{A}$ of subsets of $\mathbb{N}$ and every infinite $Z \subseteq \mathbb{N}$, there is a set $C \subseteq Z$ that is cohesive for $\vec{A}$. \end{Lemma} \begin{proof} Let $Z \subseteq \mathbb{N}$ be infinite, and let $f \colon \mathbb{N} \rightarrow Z$ be an increasing bijection. Let $\vec{A} = (A_i : i \in \mathbb{N})$ be a sequence of subsets of $\mathbb{N}$, and define another sequence of sets $\vec{B} = (B_i : i \in \mathbb{N})$ by $B_i = f^{-1}(A_i)$ for each $i$. By $\mathsf{COH}$, let $C$ be cohesive for $\vec{B}$. Then $D = f(C)$ is cohesive for $\vec{A}$, and in this case $f(C) = \{n : (\exists m \leq n)(m \in C \wedge f(m) = n)\}$ exists by $\Delta^0_1$ comprehension because $f$ is increasing. \end{proof} A useful consequence of $\mathsf{RT}^2_2$ is the \emph{ascending/descending sequence principle}, which states that in every infinite linear order there is either an ascending sequence or a descending sequence. The principle $\mathsf{ADS}$ in turn proves both $\mathsf{COH}$ and the \emph{$\Sigma^0_2$ bounding scheme} $(\mathsf{B}\Sigma^0_2)$. \begin{Definition}\label{def-ADS} Let $(L, <_L)$ be a linear order. \begin{itemize} \item A set $S \subseteq L$ is an \emph{ascending sequence} in $L$ if $(\forall x, y \in S)(x < y \rightarrow x <_L y)$. \smallskip \item A set $S \subseteq L$ is a \emph{descending sequence} in $L$ if $(\forall x, y \in S)(x < y \rightarrow y <_L x)$. \smallskip \item The \emph{ascending/descending sequence principle} ($\mathsf{ADS}$) is the following statement. For every infinite linear order $(L, <_L)$, there is an infinite $S \subseteq L$ that is either an ascending sequence or a descending sequence. \end{itemize} \end{Definition} In the above definition, $\mathsf{ADS}$ is stated as it is in~\cite{HirschfeldtShore}. In practice, $\mathsf{RCA}_0$ proves that any sequence $x_0, x_1, x_2, \dots$ of distinct numbers can be thinned to an increasing subsequence $x_{i_0} < x_{i_1} < x_{i_2} < \cdots$, in which case $\{x_{i_n} : n \in \mathbb{N}\}$ exists as a set. Therefore, $\mathsf{ADS}$ is equivalent to the following statement over $\mathsf{RCA}_0$. For every infinite linear order $(L, <_L)$, there is a sequence $x_0, x_1, x_2 \dots$ of elements of $L$ such that either $x_0 <_L x_1 <_L x_2 <_L \cdots$ or $x_0 >_L x_1 >_L x_2 >_L \cdots$. \begin{Definition} The \emph{$\Sigma^0_2$ bounding scheme} $(\mathsf{B}\Sigma^0_2)$ consists of the universal closures of all formulas of the form \begin{align*} \forall a[(\forall n < a)(\exists m)\varphi(n,m) \rightarrow \exists b(\forall n < a)(\exists m < b)\varphi(n,m)], \end{align*} where $\varphi$ is $\Sigma^0_2$ and $a$ and $b$ are not free in $\varphi$. \end{Definition} Over $\mathsf{RCA}_0$, $\mathsf{B}\Sigma^0_2$ is equivalent to the \emph{$\Pi^0_1$ bounding scheme} $(\mathsf{B}\Pi^0_1)$, which is the analogous scheme in which $\varphi$ is required to be $\Pi^0_1$ instead of $\Sigma^0_2$ (see~\cite{HajekPudlak}*{Section~I.2}). \begin{Proposition}[{\cite{HirschfeldtShore}*{Proposition~2.10 and Proposition~4.5}}]\label{prop-rt22andADS} {\ } \begin{enumerate} \item $\mathsf{RCA}_0 + \mathsf{RT}^2_2 \vdash \mathsf{ADS}$. \smallskip \item\label{it-ADSimpCOH} $\mathsf{RCA}_0 + \mathsf{ADS} \vdash \mathsf{COH}$. \smallskip \item\label{it-ADSimpBST} $\mathsf{RCA}_0 + \mathsf{ADS} \vdash \mathsf{B}\Sigma^0_2$. \end{enumerate} \end{Proposition} \noindent On the other hand, $\mathsf{RCA}_0 + \mathsf{ADS} \nvdash \mathsf{RT}^2_2$; indeed, $\mathsf{RCA}_0 + \mathsf{ADS} \nvdash \mathsf{SRT}^2_2$~\cite{HirschfeldtShore}. Much of the work in the reverse mathematics of combinatorics has been inspired by major open, and now answered, questions concerning the strength of $\mathsf{RT}^2_2$. The first breakthrough was by Seetapun and Slaman~\cite{SeetapunSlaman}, who showed that $\mathsf{RCA}_0 + \mathsf{RT}^2_2 \nvdash \mathsf{ACA}_0$. More recently, Liu~\cite{LiuRT22vsWKL} showed that $\mathsf{RCA}_0 + \mathsf{RT}^2_2 \nvdash \mathsf{WKL}_0$ and that $\mathsf{RCA}_0 + \mathsf{RT}^2_2 \nvdash \mathsf{WWKL}_0$~\cite{LiuRT22vsWWKL}. We now also know that $\mathsf{RCA}_0 + \mathsf{SRT}^2_2 \nvdash \mathsf{RT}^2_2$, which was first shown by Chong, Slaman, and Yang via a non-$\omega$-model~\cite{ChongSlamanYang}, and again shown by Monin and Patey~\cite{MoninPatey} via an $\omega$-model. Furthermore, Patey and Yokoyama showed that $\mathsf{RT}^2_2$ is $\Pi^0_3$-conservative over $\mathsf{RCA}_0$~\cite{PateyYokoyama}. \section{The reverse mathematics of the Rival--Sands theorem}\label{sec-RMRS} We give our reverse mathematics analysis of the Rival--Sands theorem. In their original formulation of Theorem~\ref{thm-RSg}, Rival and Sands add that we may also require every vertex of $H$ to be adjacent to none or to infinitely many other vertices of $H$. We call the version of the theorem with this additional requirement the \emph{refined} version of the Rival--Sands theorem. We show that the Rival--Sands theorem and its refined version are equivalent to $\mathsf{ACA}_0$ over $\mathsf{RCA}_0$ and that these equivalences remain valid when the theorem is restricted to locally finite graphs. We then analyze the inside-only weak Rival--Sands theorem and its refined version, where the conclusion need only hold for the vertices of $H$. Although the weak Rival--Sands theorem and its refined version look potentially weaker than $\mathsf{RT}^2_2$, we show that they are indeed equivalent to $\mathsf{RT}^2_2$ over $\mathsf{RCA}_0$. Recall that we consider only simple graphs. Thus we represent a graph $G = (V, E)$ by sets $V \subseteq \mathbb{N}$ and $E \subseteq [V]^2$, and we write $(x,y) \in E$ as an abbreviation for $(\min\{x,y\}, \max\{x,y\}) \in E$. For a graph $G = (V,E)$ and an $x \in V$, $N(x) = \{y \in V : (x,y) \in E\}$ denotes the set of \emph{neighbors} of $x$. Recall that a set $H \subseteq V$ is a \emph{clique} if $(x,y) \in E$ for every pair of distinct $x, y \in H$ and that $H$ is an \emph{independent set} if $(x, y) \notin E$ for every $x, y \in H$. The precise formulations of the Rival--Sands theorem and its weak version that we consider are given below. Our terminology and notation emphasize that these are formulations of the Rival--Sands theorem \emph{for graphs} to distinguish Theorem~\ref{thm-RSg} from Theorem~\ref{thm-RSpo}. The reverse mathematics of the Rival--Sands theorem for partial orders (i.e., Theorem~\ref{thm-RSpo}) is studied in~\cite{Fiori-CaronesMarconeShaferSolda}. \begin{Definition}{\ } \begin{itemize} \item \emph{The Rival--Sands theorem for graphs} $(\mathsf{RSg})$ is the following statement. For every infinite graph $G = (V,E)$, there is an infinite $H \subseteq V$ such that for every $x \in V$, either $H \cap N(x)$ is infinite or $|H \cap N(x)| \leq 1$. \medskip \item \emph{The Rival--Sands theorem for graphs, refined} $(\mathsf{RSgr})$ is the following statement. For every infinite graph $G = (V,E)$, there is an infinite $H \subseteq V$ such that \begin{itemize} \item for every $x \in V$, either $H \cap N(x)$ is infinite or $|H \cap N(x)| \leq 1$; and moreover \smallskip \item for every $x \in H$, either $H \cap N(x)$ is infinite or $H \cap N(x) = \emptyset$. \end{itemize} \medskip \item \emph{The weak Rival--Sands theorem for graphs} $(\mathsf{wRSg})$ is the following statement. For every infinite graph $G = (V,E)$, there is an infinite $H \subseteq V$ such that for every $x \in H$, either $H \cap N(x)$ is infinite or $|H \cap N(x)| \leq 1$. \medskip \item \emph{The weak Rival--Sands theorem for graphs, refined} $(\mathsf{wRSgr})$ is the following statement. For every infinite graph $G = (V,E)$, there is an infinite $H \subseteq V$ such that for every $x \in H$, either $H \cap N(x)$ is infinite or $H \cap N(x) = \emptyset$. \end{itemize} \end{Definition} As mentioned in the introduction, Rival and Sands's original proof of $\mathsf{RSg}$ involves detailed elementary reasoning that can be formalized in $\mathsf{ACA}_0$ with a little engineering. We give a quick new proof using cohesive sets. \begin{Theorem}\label{thm-RSgInACA} $\mathsf{ACA}_0 \vdash \text{The Rival--Sands theorem for graphs, refined $(\mathsf{RSgr})$}$. \end{Theorem} \begin{proof} Let $G = (V,E)$ be an infinite graph. Let $F = \{x \in V : \text{$N(x)$ is finite}\}$, which may be defined in $\mathsf{ACA}_0$. There are two cases, depending on whether or not $F$ is finite. If $F$ is finite, simply take \begin{align*} H = V \setminus \bigcup_{x \in F}N(x), \end{align*} and observe that $H$ contains almost every member of $V$. Consider an $x \in V$. If $x \in F$, then $H \cap N(x) = \emptyset$. If $x \notin F$, then $N(x)$ is infinite, so $H \cap N(x)$ is also infinite. So in this case, for every $x \in V$, either $H \cap N(x)$ is infinite or $H \cap N(x) = \emptyset$. Suppose instead that $F$ is infinite. $\mathsf{ACA}_0$ proves $\mathsf{COH}$, so by Lemma~\ref{lem-COH_helper}, let $C \subseteq F$ be cohesive for the sequence $(N(x) : x \in V)$. As we work in $\mathsf{ACA}_0$, we may also define a function $f \colon V \rightarrow \{0,1\}$ by \begin{align*} f(x) = \begin{cases} 0 & \text{if $C \subseteq^* \ol{N(x)}$}\\ 1 & \text{if $C \subseteq^* N(x)$}. \end{cases} \end{align*} Define $H = \{x_0, x_1, \dots\} \subseteq C \subseteq F$ by the following procedure. Let $x_0$ be the first element of $C$. Suppose that $x_0 < x_1 < \cdots < x_n$ have been defined. Let $Y = \bigcup_{i \leq n}N(x_i)$, which is finite because each $x_i$ is in $F$. For each $y \in Y$, if $f(y) = 0$, then $C \subseteq^* \ol{N(y)}$; and if $f(y) = 1$, then $C \subseteq^* N(y)$. By $\mathsf{B}\Sigma^0_2$, which is a consequence of $\mathsf{ACA}_0$, there is a bound $b$ such that for all $y \in Y$ and all $z \in C$ with $z > b$, if $f(y) = 0$ then $z \in \ol{N(y)}$ and if $f(y) = 1$, then $z \in N(y)$. Choose $x_{n+1}$ to be the first member of $C \setminus Y$ with $x_n < x_{n+1}$ and such that, for every $y \in Y$, if $f(y) = 0$, then $x_{n+1} \in \ol{N(y)}$; and if $f(y) = 1$, then $x_{n+1} \in N(y)$. This completes the construction. To verify that $H$ satisfies the conclusion of $\mathsf{RSgr}$, consider a $v \in V$. If $H \cap N(v) \neq \emptyset$, let $m$ be least such that $x_m \in N(v)$ (and hence also least such that $v \in N(x_m)$). If $f(v) = 0$, then every $x_n$ with $n > m$ is chosen from $\ol{N(v)}$, so $|H \cap N(v)| = 1$. If $f(v) = 1$, then every $x_n$ with $n > m$ is chosen from $N(v)$, so $H \cap N(v)$ is infinite. Thus for every $v \in V$, either $H \cap N(v)$ is infinite or $|H \cap N(v)| \leq 1$. Furthermore, if $v \in H$, then $H \cap N(v) = \emptyset$ because if $m < n$, then $x_n$ is chosen from $\ol{N(x_m)}$. \end{proof} Before giving the reversal for the Rival--Sands theorem, we observe that $\mathsf{RCA}_0$ suffices to prove its refined version for highly recursive graphs. \begin{Definition} For a set $X \subseteq \mathbb{N}$, let $\mathcal{P}_\mathrm{f}(X)$ denote the set of (coded) finite subsets of $X$. \begin{itemize} \item A graph $G = (V,E)$ is \emph{locally finite} if $N(x)$ is finite for each $x \in V$. \smallskip \item A graph $G = (V,E)$ is \emph{highly recursive} if it is locally finite, and additionally there is a function $b \colon V \rightarrow \mathcal{P}_\mathrm{f}(V)$ such that $b(x) = N(x)$ for each $x \in V$. \end{itemize} \end{Definition} It would be more natural to use the word \emph{bounded} in place of \emph{highly recursive}, but there is already an unrelated notion of a \emph{bounded graph}. Every highly recursive graph is locally finite by definition. That every locally finite graph is highly recursive requires $\mathsf{ACA}_0$ in general. \begin{Proposition}\label{prop-RSgHighRec} $\mathsf{RCA}_0 \vdash \text{The Rival--Sands theorem for highly recursive graphs, refined}$. \end{Proposition} \begin{proof} Let $G = (V,E)$ be a highly recursive infinite graph, and let $b \colon V \rightarrow \mathcal{P}_\mathrm{f}(V)$ be such that $b(x) = N(x)$ for all $x \in V$. Define an infinite $H = \{x_0, x_1, \cdots \} \subseteq V$ with $x_0 < x_1 < \cdots$ as follows. Let $x_0$ be the first member of $V$. Given $x_0 < x_1 < \cdots < x_n$, let $Y$ be the finite set \begin{align*} Y = \{x_i : i \leq n\} \cup \bigcup_{i \leq n}b(x_i) \cup \bigcup_{\substack{i \leq n\\y \in b(x_i)}}b(y) \end{align*} consisting of all vertices that are of distance $\leq 2$ from an $x_i$ with $i \leq n$. Choose $x_{n+1}$ to be the first member of $V \setminus Y$ with $x_n < x_{n+1}$. Then no two distinct members of $H$ are of distance $\leq 2$, so $H$ satisfies the conclusion of $\mathsf{RSgr}$. \end{proof} \begin{Theorem}\label{thm-ACA_RS_eq} The following are equivalent over $\mathsf{RCA}_0$. \begin{enumerate} \item\label{it-aca} $\mathsf{ACA}_0$. \smallskip \item\label{it-rsg} The Rival--Sands theorem for graphs $(\mathsf{RSg})$. \smallskip \item\label{it-rsgr} The Rival--Sands theorem for graphs, refined $(\mathsf{RSgr})$. \smallskip \item\label{it-rsgLocFin} The Rival--Sands theorem for locally finite graphs. \smallskip \item\label{it-rsgrLocFin} The Rival--Sands theorem for locally finite graphs, refined. \end{enumerate} \end{Theorem} \begin{proof} Notice that (\ref{it-rsgr}) trivially implies (\ref{it-rsg}), (\ref{it-rsgLocFin}), and (\ref{it-rsgrLocFin}). Therefore (\ref{it-aca}) implies (\ref{it-rsg})--(\ref{it-rsgrLocFin}) by Theorem~\ref{thm-RSgInACA}. Notice also that (\ref{it-rsg}), (\ref{it-rsgr}), and (\ref{it-rsgrLocFin}) each trivially imply (\ref{it-rsgLocFin}). Thus to finish the proof, it suffices to show that (\ref{it-rsgLocFin}) implies (\ref{it-aca}) over $\mathsf{RCA}_0$. By Lemma~\ref{lem-ACAinjection}, it suffices to show that $\mathsf{RSg}$ for locally finite graphs implies that the ranges of injections exist. Thus let $f \colon \mathbb{N} \rightarrow \mathbb{N}$ be an injection. Let $G = (\mathbb{N}, E)$ be the graph where $E = \{(v,s) \in [\mathbb{N}]^2 : (v < s) \wedge (f(s) < f(v))\}$, which exists by $\Delta^0_1$ comprehension. To see that $G$ is locally finite, consider a $v \in \mathbb{N}$. The function $f$ is injective, so there are only finitely many $s > v$ with $f(s) < f(v)$. Therefore there are only finitely many $s > v$ that are adjacent to $v$. Apply $\mathsf{RSg}$ for locally finite graphs to $G$ to get an infinite $H \subseteq \mathbb{N}$ such that $|H \cap N(x)| \leq 1$ for every $x \in \mathbb{N}$. Enumerate $H$ in increasing order as $x_0 < x_1 < x_2 < \cdots$. We show that, for any $n \in \mathbb{N}$, if $\exists s (f(s) = n)$, then $(\exists s \leq x_{n+1})(f(s) = n)$. Suppose that $f(s) = n$. Then $s$ is adjacent to all but at most $n$ of the vertices $v < s$. This is because if $v < s$, then $(v, s) \notin E$ if and only if $f(v) \leq f(s)$. The function $f$ is an injection, so there are at most $n = f(s)$ many vertices $v < s$ with $f(v) \leq f(s)$. Thus there are at most $n$ vertices $v < s$ to which $s$ is not adjacent. At most one neighbor of $s$ is in $H$, and therefore there are at most $n+1$ many vertices in $H$ that are $< s$. Thus $x_{n+1} \geq s$. Thus $n$ is in the range of $f$ if and only if $(\exists s \leq x_{n+1})(f(s) = n)$. So the range of $f$ exists by $\Delta^0_1$ comprehension. \end{proof} We finish this section by showing that both the weak Rival--Sands theorem and its refined version are equivalent to $\mathsf{RT}^2_2$ over $\mathsf{RCA}_0$. This was proved in collaboration with Jeffry Hirst and Steffen Lempp. \begin{Theorem}[Fiori-Carones, Hirst, Lempp, Shafer, Sold\`a]\label{thm-RT_WRSG_eq} The following are equivalent over $\mathsf{RCA}_0$. \begin{enumerate} \item\label{it-rt} $\mathsf{RT}^2_2$. \smallskip \item\label{it-wrsg} The weak Rival--Sands theorem $(\mathsf{wRSg})$. \smallskip \item\label{it-wrsgr} The weak Rival--Sands theorem, refined $(\mathsf{wRSgr})$. \end{enumerate} \end{Theorem} \begin{proof} For an infinite graph $G$, every infinite homogeneous set satisfies the conclusion of $\mathsf{wRSgr}$, so (\ref{it-rt}) implies (\ref{it-wrsgr}). Trivially (\ref{it-wrsgr}) implies (\ref{it-wrsg}). It remains to show that (\ref{it-wrsg}) implies (\ref{it-rt}) over $\mathsf{RCA}_0$. We show that $\mathsf{RCA}_0 + \mathsf{wRSg} \vdash \mathsf{SRT}^2_2 \wedge \mathsf{ADS}$, from which it follows that $\mathsf{RCA}_0 + \mathsf{wRSg} \vdash \mathsf{RT}^2_2$ by Proposition~\ref{prop-rt22decomp} and Proposition~\ref{prop-rt22andADS} item~(\ref{it-ADSimpCOH}). We start by showing that $\mathsf{RCA}_0 + \mathsf{wRSg} \vdash \mathsf{ADS}$. Let $L = (L, <_L)$ be an infinite linear order. Let $G = (L, E)$ be the graph with $E = \{(x, y) \in [L]^2 : (x < y) \wedge (x <_L y)\}$. Let $H$ be as in the conclusion of $\mathsf{wRSg}$ for $G$. Then for every $x \in H$, either $H \cap N(x)$ is infinite or $|H \cap N(x)| \leq 1$. First suppose that $|H \cap N(x)| \leq 1$ for all $x \in H$. Then $H$ has no $<_L$-minimum element. Given $x \in H$, let $y_0, y_1 \in H$ be such that $x < y_0, y_1$. Then at most one of $(x, y_0)$ and $(x, y_1)$ is in $E$, so either $y_0 <_L x$ or $y_1 <_L x$. Define a descending sequence $x_0 >_L x_1 >_L x_2 >_L \cdots$ by choosing $x_0$ to be the first member of $H$ and by choosing each $x_{n+1}$ to be the first member of $H$ that is $<_L$-below $x_n$. Now suppose that $H \cap N(x)$ is infinite for some $x \in H$, but further suppose that $|H \cap N(y)| \leq 1$ for all but finitely many $y \in H \cap N(x)$. Let $b$ be a bound such that $|H \cap N(y)| \leq 1$ whenever $y \in H \cap N(x)$ and $y > b$. Let $y_0 < y_1 < y_2 < \cdots$ enumerate in $<$-increasing order the elements of $H \cap N(x)$ that are $> b$. Then $y_0 >_L y_1 >_L y_2 >_L \cdots$ is a descending sequence in $L$. This is because if $y_n <_L y_{n+1}$ for some $n$, then $(y_n, y_{n+1}) \in E$, so both $x$ and $y_{n+1}$ are in $H \cap N(y_n)$, which is a contradiction. Finally, suppose that there is an $x \in H$ with $H \cap N(x)$ infinite and furthermore that whenever $x \in H$ and $H \cap N(x)$ is infinite, then also $H \cap N(y)$ is infinite for infinitely many $y \in H \cap N(x)$. We define an ascending sequence $x_0 <_L x_1 < x_2 <_L \cdots$ where $x_n \in H$ and $H \cap N(x_n)$ is infinite for each $n$. Recall that for $x \in H$, $H \cap N(x)$ is infinite if and only if $|H \cap N(x)| \geq 2$ because $H$ satisfies the conclusion of $\mathsf{wRSg}$. Let $x_0$ be any element of $H$ with $|H \cap N(x_0)| \geq 2$. Given $x_n \in H$ with $|H \cap N(x_n)| \geq 2$, we know by assumption that there are infinitely many $y \in H \cap N(x_n)$ with $|H \cap N(y)| \geq 2$. Let $\langle y, w, z \rangle$ be the first (code for a) triple with $y \in H \cap N(x_n)$, $x_n < y$, $w \neq z$, and $w, z \in H \cap N(y)$. Then $x_n <_L y$ because $x_n < y$ and $(x_n,y) \in E$, so put $x_{n+1} = y$. This completes the proof of $\mathsf{ADS}$. Now we show that $\mathsf{RCA}_0 + \mathsf{wRSg} \vdash \mathsf{SRT}^2_2$. Note that $\mathsf{RCA}_0 + \mathsf{wRSg} \vdash \mathsf{B}\Sigma^0_2$. This is because $\mathsf{RCA}_0 + \mathsf{wRSg} \vdash \mathsf{ADS}$ by the above argument and that $\mathsf{RCA}_0 + \mathsf{ADS} \vdash \mathsf{B}\Sigma^0_2$ by Proposition~\ref{prop-rt22andADS} item~(\ref{it-ADSimpBST}). Let $c \colon [\mathbb{N}]^2 \rightarrow \mathbb{N}$ be a stable coloring, and let $G = (\mathbb{N}, E)$ be the graph with $E = \{(x,y) \in [\mathbb{N}]^2 : (x < y) \wedge (c(x,y) = 1)\}$. Let $H$ be as in the conclusion of $\mathsf{wRSg}$ for $G$. Thus for $x \in H$, $H \cap N(x)$ is infinite if and only if $|H \cap N(x)| \geq 2$. First suppose that there are only finitely many $x \in H$ with $H \cap N(x)$ infinite, and let $b$ be a bound such that $|H \cap N(x)| \leq 1$ whenever $x \in H$ and $x > b$. Define a homogeneous set $K = \{x_0, x_1, \dots\}$ for $c$ with color $0$, where $x_n \in H$ and $x_n > b$ for each $n$. Let $x_0$ be the first member of $H$ with $x_0 > b$. Given $b < x_0 < x_1 < \cdots < x_n$, choose $x_{n+1}$ to be the first member of $H$ with $x_{n+1} > x_n$ and $(\forall i \leq n)(x_{n+1} \notin N(x_i))$. Such an $x_{n+1}$ exists because $H$ is infinite, but $\bigl|H \cap \bigcup_{i \leq n}N(x_i)\bigr| \leq n+1$ since $|H \cap N(x_i)| \leq 1$ for each $i \leq n$. The set $K$ is homogeneous because if $m < n$, then $(x_m, x_n) \notin E$, so $c(x_m, x_n) = 0$. Now suppose that there are infinitely many $x \in H$ with $H \cap N(x)$ infinite. Define a homogeneous set $K = \{x_0, x_1, \dots\}$ for $c$ with color $1$, where $x_n \in H$ and $|H \cap N(x_n)| \geq 2$ for each $n$. Let $x_0$ be any element of $H$ with $|H \cap N(x_0)| \geq 2$. Given $x_0 < x_1 < \cdots < x_n$, let $\langle y, w, z \rangle$ be the first (code for a) triple with $x_n < y$, $(\forall i \leq n)(y \in H \cap N(x_i))$, $w \neq z$, and $w, z \in H \cap N(y)$. Then put $x_{n+1} = y$. To see that such a triple exists, observe that $(\forall i \leq n)(\lim_s c(x_i, s) = 1)$ because $c$ is stable and for each $i \leq n$, there are infinitely many $s$ with $c(x_i, s) = 1$ because $N(x_i)$ is infinite. By $\mathsf{B}\Sigma^0_2$, there is a bound $b$ such that $(\forall i \leq n)(\forall s > b)(c(x_i, s) = 1)$. We assume that there are infinitely many $y \in H$ with $H \cap N(y)$ infinite, so there is a desired $y \in H$ with $y > \max\{b, x_n\}$ and $|H \cap N(y)| \geq 2$. Such a $y$ satisfies $(\forall i \leq n)(y \in H \cap N(x_i))$ because $y > b$, so $c(x_i, y) = 1$ for each $i \leq n$, which means that $(x_i, y) \in E$ for each $i \leq n$. The set $K$ is homogeneous because if $m < n$, then $(x_m, x_n) \in E$, so $c(x_m, x_n) = 1$. This completes the proof of $\mathsf{SRT}^2_2$. \end{proof} \section{Weihrauch degrees preliminaries}\label{sec-WPrelim} The Weihrauch degrees classify mathematical theorems in terms of their uniform computational content. Many theorems from analysis, topology, and combinatorics have been studied in this setting. We refer the reader to~\cite{BrattkaGherardiPaulySurvey} for an introduction to the subject. We think in terms of multi-valued partial functions $\mc{F} \colon \!\!\subseteq\! \mc{X} \rightrightarrows \mc{Y}$ between two sets (in this context called \emph{spaces}) $\mc{X}$ and $\mc{Y}$. Here the `$\subseteq\! \mc{X}$' notation denotes that the domain of $\mc{F}$ is a subset of $\mc{X}$, and the `$\rightrightarrows$' notation denotes that $\mc{F}$ is multi-valued. Multi-valued partial functions $\mc{F}$ are thought of as representing mathematical problems. Inputs $x \in \dom(\mc{F})$ are thought of as instances of the problem, and the possible outputs $y$ to $\mc{F}(x)$ (written $y \in \mc{F}(x)$) are thought of as the valid solutions to instance $x$. Of course, a multi-valued partial function $\mc{F} \colon \!\!\subseteq\! \mc{X} \rightrightarrows \mc{Y}$ is nothing more than a relation $\mc{F} \subseteq \mc{X} \times \mc{Y}$ (or a partial function $\mc{F} \colon \!\!\subseteq\! \mc{X} \rightarrow \mc{P}(\mc{Y}) \setminus \{\emptyset\}$). However, for working with computations it is helpful to think in terms of inputs and outputs in the way described above. Henceforth we drop the word \emph{partial} for simplicity and refer to multi-valued partial functions as \emph{multi-valued functions}. Any mathematical statement of the form $(\forall x \in \mc{X})(\varphi(x) \rightarrow (\exists y \in \mc{Y})\psi(x,y))$ may be thought of as a multi-valued function $\mc{F} \colon \!\!\subseteq\! \mc{X} \rightrightarrows \mc{Y}$ and hence as a mathematical problem. The domain of $\mc{F}$ is $\{x \in \mc{X} : \varphi(x)\}$, and, for $x \in \dom(\mc{F})$, $\mc{F}(x)$ consists of all $y \in \mc{Y}$ such that $\psi(x,y)$. For example, we may think of \emph{weak K\"{o}nig's lemma} as the multi-valued function $\mathsf{WKL} \colon \!\!\subseteq\! \mc{X} \rightrightarrows \mc{Y}$ where $\mc{X}$ is the space of subtrees of $2^{<\omega}$, $\dom(\mathsf{WKL})$ consists of the infinite trees in $\mc{X}$, and for $T \in \dom(\mathsf{WKL})$, $\mathsf{WKL}(T)$ consists of all infinite paths through $T$. Generally we present multi-valued functions in the style of the following definition. \begin{Definition} $\mathsf{WKL}$ is the following multi-valued function. \begin{itemize} \item Input/instance: An infinite tree $T \subseteq 2^{<\omega}$. \smallskip \item Output/solution: An $f \in 2^\omega$ that is a path through $T$. \end{itemize} \end{Definition} Notice that we now use $\omega$ to denote the natural numbers. This is because we consider only the standard natural numbers when working in the Weihrauch degrees. For two multi-valued functions $\mc{F} \colon \!\!\subseteq\! \mc{X} \rightrightarrows \mc{Y}$ and $\mc{G} \colon \!\!\subseteq\! \mc{W} \rightrightarrows \mc{Z}$, $\mc{F}$ \emph{Weihrauch reduces} to $\mc{G}$ if there are uniform computational procedures for encoding any $\mc{F}$-instance $x \in \dom(\mc{F})$ into a $\mc{G}$-instance $w \in \dom(\mc{G})$ and decoding any $\mc{G}$-solution $z \in \mc{G}(w)$ along with the original $x$ into an $\mc{F}$-solution $y \in \mc{F}(x)$. To make this notion precise, the points of spaces $\mc{X}$, $\mc{Y}$, $\mc{W}$, and $\mc{Z}$ must be represented in a way that Turing functionals can access, and $\mc{F}$ and $\mc{G}$ must be thought of in terms of the functions they induce on the representations of their inputs and outputs. In its full glory, Weihrauch reducibility between multi-valued functions on represented spaces is defined as follows. \begin{Definition}\label{def-WredFull}{\ } \begin{itemize} \item Let $\mc{X}$ be any space. A \emph{representation} of $\mc{X}$ is a surjective partial function $\delta \colon \!\!\subseteq\! \omega^\omega \rightarrow \mc{X}$. A space together with a representation $(\mc{X}, \delta)$ is called a \emph{represented space}. \medskip \item Let $\mc{F} \colon \!\!\subseteq\! (\mc{X}, \delta_{\mc{X}}) \rightrightarrows (\mc{Y}, \delta_{\mc{Y}})$ be a multi-valued function between represented spaces. A partial function $F \colon \!\!\subseteq\! \omega^\omega \rightarrow \omega^\omega$ \emph{realizes} $\mc{F}$ (or is a \emph{realizer} for $\mc{F}$) if $\delta_{\mc{Y}}(F(p)) \in \mc{F}(\delta_{\mc{X}}(p))$ for all $p \in \dom(\mc{F} \circ \delta_{\mc{X}})$. \end{itemize} \medskip Now let $\mc{F}$ and $\mc{G}$ be two multi-valued functions on represented spaces. \begin{itemize} \item $\mc{F}$ \emph{Weihrauch reduces} to $\mc{G}$ (written $\mc{F} \leq_\mathrm{W} \mc{G}$) if there are Turing functionals $\Phi, \Psi \colon \!\!\subseteq\! \omega^\omega \rightarrow \omega^\omega$ such that the functional $p \mapsto \Psi(\langle p, G(\Phi(p)) \rangle)$ is a realizer for $\mc{F}$ whenever $G$ is a realizer for $\mc{G}$. \medskip \item $\mc{F}$ and $\mc{G}$ are \emph{Weihrauch equivalent} (written $\mc{F} \equiv_\mathrm{W} \mc{G}$) if $\mc{F} \leq_\mathrm{W} \mc{G}$ and $\mc{G} \leq_\mathrm{W} \mc{F}$. In this case, $\mc{F}$ and $\mc{G}$ are said to have the same \emph{Weihrauch degree}. \medskip \item $\mc{F}$ \emph{strongly Weihrauch reduces} to $\mc{G}$ (written $\mc{F} \leq_\mathrm{sW} \mc{G}$) if there are Turing functionals $\Phi, \Psi \colon \!\!\subseteq\! \omega^\omega \rightarrow \omega^\omega$ such that the functional $p \mapsto \Psi(G(\Phi(p)))$ is a realizer for $\mc{F}$ whenever $G$ is a realizer for $\mc{G}$. \medskip \item $\mc{F}$ and $\mc{G}$ are \emph{strongly Weihrauch equivalent} (written $\mc{F} \equiv_\mathrm{sW} \mc{G}$) if $\mc{F} \leq_\mathrm{sW} \mc{G}$ and $\mc{G} \leq_\mathrm{sW} \mc{F}$. In this case, $\mc{F}$ and $\mc{G}$ are said to have the same \emph{strong Weihrauch degree}. \end{itemize} \end{Definition} In the above definition, $\langle f, g \rangle$ denotes the usual pairing of functions $f, g \in \omega^\omega$, where $\langle f, g \rangle(2n) = f(n)$ and $\langle f, g \rangle(2n+1) = g(n)$ for each $n \in \omega$. The paired function $\langle f, g \rangle$ is often also denoted by $f \oplus g$. Both $\leq_\mathrm{W}$ and $\leq_\mathrm{sW}$ are quasi-orders, so both $\equiv_\mathrm{W}$ and $\equiv_\mathrm{sW}$ are equivalence relations. We emphasize that the difference between Weihrauch reductions and strong Weihrauch reductions is that in strong Weihrauch reductions, the decoding functional $\Psi$ is not given explicit access to the representation $p$ of the original $\mc{F}$-input. For multi-valued functions $\mc{F}$ and $\mc{G}$, if $\mc{F} \leq_\mathrm{sW} \mc{G}$, then also $\mc{F} \leq_\mathrm{W} \mc{G}$; and therefore if $\mc{F} \equiv_\mathrm{sW} \mc{G}$, then also $\mc{F} \equiv_\mathrm{W} \mc{G}$. The mathematical problems we consider all involve spaces of countable combinatorial objects (such as subtrees of $2^{<\omega}$ in the case of $\mathsf{WKL}$) that can be coded as elements of $\omega^\omega$ in a straightforward way. We therefore follow the style of~\cite{DoraisDzhafarovHirstMiletiShafer} by treating representations implicitly and restricting to multi-valued functions $\mc{F} \colon \!\!\subseteq\! \omega^\omega \rightrightarrows \omega^\omega$, thereby dispensing with some of the notational encumbrances of Definition~\ref{def-WredFull}. In this context, Weihrauch reducibility and strong Weihrauch reducibility may be defined as follows. \begin{Definition}[see~\cite{DoraisDzhafarovHirstMiletiShafer}*{Definition~1.5} and~\cite{DoraisDzhafarovHirstMiletiShafer}*{Appendix~A}]\label{def-Wred} Let $\mc{F}, \mc{G} \colon \!\!\subseteq\! \omega^\omega \rightrightarrows \omega^\omega$ be multi-valued functions. \begin{itemize} \item $\mc{F} \leq_\mathrm{W} \mc{G}$ if there are Turing functionals $\Phi, \Psi \colon \!\!\subseteq\! \omega^\omega \rightarrow \omega^\omega$ such that $\Phi(f) \in \dom(\mc{G})$ for all $f \in \dom(\mc{F})$ and $\Psi(\langle f, g \rangle) \in \mc{F}(f)$ for all $f \in \dom(\mc{F})$ and $g \in \mc{G}(\Phi(f))$. \medskip \item $\mc{F} \leq_\mathrm{sW} \mc{G}$ if there are Turing functionals $\Phi, \Psi \colon \!\!\subseteq\! \omega^\omega \rightarrow \omega^\omega$ such that $\Phi(f) \in \dom(\mc{G})$ for all $f \in \dom(\mc{F})$ and $\Psi(g) \in \mc{F}(f)$ for all $f \in \dom(\mc{F})$ and $g \in \mc{G}(\Phi(f))$. \end{itemize} \end{Definition} Our analysis of the weak Rival--Sands theorem in Section~\ref{sec-wRSgWeihrauch} also considers the non-uniform analog of Weihrauch reducibility, which is called \emph{computable reducibility} and is defined as follows for multi-valued functions $\mc{F}, \mc{G} \colon \!\!\subseteq\! \omega^\omega \rightrightarrows \omega^\omega$. \begin{Definition}[see~\cite{DzhafarovStrongRed}*{Definition~1.1}] Let $\mc{F}, \mc{G} \colon \!\!\subseteq\! \omega^\omega \rightrightarrows \omega^\omega$ be multi-valued functions. \begin{itemize} \item $\mc{F}$ \emph{computably reduces} to $\mc{G}$ (written $\mc{F} \leq_\mathrm{c} \mc{G}$) if for every $f \in \dom(\mc{F})$ there is an $\wh{f} \leq_\mathrm{T} f$ with $\wh{f} \in \dom(\mc{G})$ such that for every $\wh{g} \in \mc{G}(\wh{f})$ there is a $g \leq_\mathrm{T} f \oplus \wh{g}$ with $g \in \mc{F}(f)$. \medskip \item $\mc{F}$ and $\mc{G}$ are computably equivalent (written $\mc{F} \equiv_\mathrm{c} \mc{G}$) if $\mc{F} \leq_\mathrm{c} \mc{G}$ and $\mc{G} \leq_\mathrm{c} \mc{F}$. In this case, $\mc{F}$ and $\mc{G}$ are said to have the same \emph{computable degree}. \end{itemize} \end{Definition} For certain multi-valued functions $\mc{F}$, it is possible to encode both a given $p \in \omega^\omega$ and a given $f \in \dom(\mc{F})$ into another $g \in \dom(\mc{F})$ in such a way that every element of $\mc{F}(g)$ encodes both the given $p$ and an element of $\mc{F}(f)$. Such an $\mc{F}$ is called a \emph{cylinder} and has the property that every multi-valued function that Weihrauch reduces to $\mc{F}$ automatically strongly Weihrauch reduces to $\mc{F}$. \begin{Definition}{\ } \begin{itemize} \item Let $\mc{F}$ and $\mc{G}$ be multi-valued functions. Then $\mc{F} \times \mc{G}$ is the following multi-valued function. \begin{itemize} \item Input/instance: A pair $\langle f, g \rangle \in \dom(\mc{F}) \times \dom(\mc{G})$. \smallskip \item Output/solution: An element of $\mc{F}(f) \times \mc{G}(g)$. \end{itemize} \medskip \item Let $\mathsf{id} \colon \omega^\omega \rightarrow \omega^\omega$ denote the identity function on $\omega^\omega$. A multi-valued function $\mc{F}$ is a \emph{cylinder} if $\mathsf{id} \times \mc{F} \leq_\mathrm{sW} \mc{F}$, in which case $\mc{F} \equiv_\mathrm{sW} \mathsf{id} \times \mc{F}$. \end{itemize} \end{Definition} It is straightforward to check that if $\mc{F}$ and $\mc{G}$ are multi-valued functions where $\mc{F}$ is a cylinder and $\mc{G} \equiv_\mathrm{sW} \mc{F}$, then $\mc{G}$ is also a cylinder. \begin{Proposition}[\cite{BrattkaGherardi}*{Corollary~3.6}]\label{prop-cylinder} Let $\mc{F}$ be a multi-valued function that is a cylinder. Then for every multi-valued function $\mc{H}$, $\mc{H} \leq_\mathrm{W} \mc{F}$ if and only if $\mc{H} \leq_\mathrm{sW} \mc{F}$. \end{Proposition} Our characterization of the Rival--Sands theorem in the Weihrauch degrees relies on the important notion of the \emph{jump} of a multi-valued function $\mc{F}$, which is obtained by replacing $\dom(\mc{F})$ by functions approximating elements of $\dom(\mc{F})$. The jump of a multi-valued function was originally defined in~\cite{BrattkaGherardiMarcone}. We present the definition using terminology that we find convenient. \begin{Definition}{\ } \begin{itemize} \item A \emph{$\mbf{\Delta}^0_2$-approximation} to a function $g \colon \omega \rightarrow \omega$ is a function $f \colon \omega \times \omega \rightarrow \omega$ such that $\forall n(g(n) = \lim_s f(n, s))$. Let $\lim f = g$ denote that $f$ is a $\mbf{\Delta}^0_2$-approximation of $g$. \medskip \item A \emph{$\mbf{\Delta}^0_2$-approximation} to a set $Z \subseteq \omega$ is a $\mbf{\Delta}^0_2$-approximation to the characteristic function of $Z$. \end{itemize} \end{Definition} \begin{Definition} Let $\mc{F} \colon \!\!\subseteq\! \omega^\omega \rightrightarrows \omega^\omega$ be a multi-valued function. The \emph{jump} of $\mc{F}$, denoted $\mc{F}'$, is the following multi-valued function. \begin{itemize} \item Input/instance: A $\mbf{\Delta}^0_2$-approximation $f$ to a $g \in \dom(\mc{F})$. \smallskip \item Output/solution: An element of $\mc{F}(g)$. \end{itemize} \end{Definition} For example, $\mathsf{WKL}'$ is the multi-valued function whose inputs are $\mbf{\Delta}^0_2$-approximations to infinite trees $T \subseteq 2^{<\omega}$ and whose outputs are paths through the approximated input trees. Brattka, Gherardi, and Marcone showed that $\mathsf{WKL}'$ is strongly Weihrauch equivalent to several versions of the Bolzano--Weierstra{\ss} theorem~\cite{BrattkaGherardiMarcone}. In Section~\ref{sec-wRSgWeihrauch}, we consider the limit operation as a function in its own right. \begin{Definition} $\lim$ is the following function. \begin{itemize} \item Input/instance: An $f \in \omega^\omega$ such that $\lim f$ exists. \smallskip \item Output/solution: $\lim f$. \end{itemize} \end{Definition} Jumps preserve strong Weihrauch reducibility and therefore preserve strong Weihrauch equivalence. \begin{Proposition}[\cite{BrattkaGherardiMarcone}*{Proposition~5.6}]\label{prop-WJumpPres} For any multi-valued functions $\mc{F}$ and $\mc{G}$, if $\mc{F} \leq_\mathrm{sW} \mc{G}$, then $\mc{F}' \leq_\mathrm{sW} \mc{G}'$. Consequently, if $\mc{F} \equiv_\mathrm{sW} \mc{G}$, then $\mc{F}' \equiv_\mathrm{sW} \mc{G}'$. \end{Proposition} We find it convenient to rephrase the jumps of $\mathsf{WKL}$ in terms of the jumps of the problem of producing $\{0,1\}$-valued diagonally non-recursive functions. For multi-valued functions $\mc{F} \colon \!\!\subseteq\! \omega^\omega \rightrightarrows \omega^\omega$, $\mc{F}^{(n)}$ denotes the $n$\textsuperscript{th} jump of $\mc{F}$, with $\mc{F}^{(0)} = \mc{F}$, $\mc{F}^{(1)} = \mc{F}'$, $\mc{F}^{(2)} = \mc{F}''$, and so on. For functions $f \in \omega^\omega$, $f'$ denotes the usual Turing jump of $f$, and $f^{(n)}$ denotes the $n$\textsuperscript{th} Turing jump of $f$. Let $(\Phi_e : e \in \omega)$ denote the usual effective list of Turing functionals. \begin{Definition}{\ } \begin{itemize} \item A function $f \in \omega^\omega$ is $\mathrm{DNR}$ (for \emph{diagonally non-recursive}) relative to a function $p \in \omega^\omega$ if $\forall e(\Phi_e(p)(e){\downarrow} \rightarrow f(e) \neq \Phi_e(p)(e))$. \medskip \item A function $f \in \omega^\omega$ is $\mathrm{DNR}_2$ (for \emph{2-bounded diagonally non-recursive}) relative to a function $p \in \omega^\omega$ if $f$ is $\mathrm{DNR}$ relative to $p$ and additionally $\ran(f) \subseteq \{0,1\}$. \end{itemize} \end{Definition} \begin{Definition}{\ } \begin{itemize} \item $\mathsf{DNR}$ is the following multi-valued function. \begin{itemize} \item Input/instance: A function $p \in \omega^\omega$. \smallskip \item Output/solution: A function $f \in \omega^\omega$ that is $\mathrm{DNR}$ relative to $p$. \end{itemize} \medskip \item For each $n \in \omega$, $\npdnr{(n+1)}_2$ is the following multi-valued function. \begin{itemize} \item Input/instance: A function $p \in \omega^\omega$. \smallskip \item Output/solution: A function $f \in 2^\omega$ that is $\mathrm{DNR}_2$ relative to $p^{(n)}$. \end{itemize} When $n = 0$, we may write `$\mathsf{DNR}_2$' instead of `$\npdnr{1}_2$'. \end{itemize} \end{Definition} The $\npdnr{n}_2$ notation used here is intended to follow the $n$-$\mathsf{MLR}$ and $\npdnr{n}$ notations from the reverse mathematics literature. The formal difference between $\mathsf{DNR}_2^{(n)}$ and $\npdnr{(n+1)}_2$ is that $\mathsf{DNR}_2^{(n)}$ takes as input a $\mbf{\Delta}^0_{n+1}$-approximation to a function $p$ (in the sense of $n$ iterated limits) and outputs a function that is $\mathrm{DNR}_2$ relative to $p$, whereas $\npdnr{(n+1)}_2$ takes as input a function $q$ and outputs a function that is $\mathrm{DNR}_2$ relative to $q^{(n)}$. One may likewise define multi-valued functions $\npdnr{n}$ and $\npdnr{n}_k$ for each $n \geq 1$ and $k \geq 2$ (where the subscript $k$ denotes that the output function must be $k$-bounded). Our analysis of the Rival--Sands theorem and its variations mostly makes use of $\mathsf{DNR}$ and $\npdnr{3}_2$. \begin{Lemma}\label{lem-WKLequivDNR2} For every $n \in \omega$, $\mathsf{WKL}^{(n)} \equiv_\mathrm{sW} \mathsf{DNR}_2^{(n)} \equiv_\mathrm{sW} \npdnr{(n+1)}_2$. In particular, $\mathsf{WKL}'' \equiv_\mathrm{sW} \npdnr{3}_2$. \end{Lemma} \begin{proof} We start by showing that $\npdnr{(n+2)}_2 \equiv_\mathrm{sW} (\npdnr{(n+1)}_2)'$ for every $n \in \omega$. $\npdnr{(n+2)}_2 \leq_\mathrm{sW} (\npdnr{(n+1)}_2)'$: Let $p \colon \omega \rightarrow \omega$ be an input to $\npdnr{(n+2)}_2$. Let $\Phi$ be the functional given by \begin{align*} \Phi(p)(e,s) = \begin{cases} 0 & \text{if $\Phi_{e,s}(p)(e){\uparrow}$}\\ 1 & \text{if $\Phi_{e,s}(p)(e){\downarrow}$}, \end{cases} \end{align*} so that $\Phi(p)$ is a $\mbf{\Delta}^0_2$-approximation to $p'$. Let $f \in (\npdnr{(n+1)}_2)'(\Phi(p))$. Let $\Psi$ be the identity functional. The function $f$ is $\mathrm{DNR}_2$ relative to the $n$\textsuperscript{th} Turing jump of $p'$. That is, $f$ is $\mathrm{DNR}_2$ relative to $(p')^{(n)} = p^{(n+1)}$. Thus $f \in \npdnr{(n+2)}_2(p)$, so $\Phi$ and $\Psi$ witness that $\npdnr{(n+2)}_2 \leq_\mathrm{sW} (\npdnr{(n+1)}_2)'$. $(\npdnr{(n+1)}_2)' \leq_\mathrm{sW} \npdnr{(n+2)}_2$: Fix recursive functions $c \colon \omega \times \omega \rightarrow \omega$ and $j, d \colon \omega \rightarrow \omega$ with the following properties. \begin{itemize} \item For every $p, q \in \omega^\omega$, if $p = \Phi_e(q)$, then $\Phi_{c(e,i)}(q)$ computes the same partial function as $\Phi_i(p)$. \smallskip \item For every $p, q \in \omega^\omega$, if $p = \Phi_e(q)$, then $p' = \Phi_{j(e)}(q')$. \smallskip \item For every $p, q \in \omega^\omega$ and every $f \in 2^\omega$, if $p = \Phi_e(q)$ and $f \in \mathsf{DNR}_2(q)$, then $\Phi_{d(e)}(f) \in \mathsf{DNR}_2(p)$. \end{itemize} Compute $c(e,i)$ by computing an index $k$ for a machine $\Phi_k$ that simulates $\Phi_i$, but uses $\Phi_e$ to answer $\Phi_i$'s oracle queries. Compute $j(e)$ by computing an index $k$ for a machine $\Phi_k$ that behaves as follows when equipped with any oracle $g$. Given input $\ell$, $\Phi_k(g)(\ell)$ computes an index $i$ such that $\forall h \forall m (\Phi_\ell(h)(\ell){\downarrow} \leftrightarrow \Phi_i(h)(m){\downarrow})$, then it outputs $g(c(e,i))$. If $p = \Phi_e(q)$, then \begin{align*} \ell \in p' \leftrightarrow \Phi_\ell(p)(\ell){\downarrow} \leftrightarrow \Phi_i(p)(c(e,i)){\downarrow} \leftrightarrow \Phi_{c(e,i)}(q)(c(e,i)){\downarrow} \leftrightarrow c(e,i) \in q', \end{align*} so $\Phi_{j(e)}(q')(\ell) = q'(c(e,i)) = p'(\ell)$ as desired. The function $d$ can be computed by a similar strategy. Fix an index $e$ for a machine $\Phi_e$ such that for every $h \colon \omega \times \omega \rightarrow \omega$, if $h$ is a $\mbf{\Delta}^0_2$-approximation to a function $p$, then $\Phi_e(h') = p$. Let $h \colon \omega \times \omega \rightarrow \omega$ be an input to $(\npdnr{(n+1)}_2)'$, and let $p = \lim h$. Let $\Phi$ be the identity functional, and let $f \in \npdnr{(n+2)}_2(h)$. Let $\Psi$ be the functional given by $\Psi(f) = \Phi_{d(j^n(e))}(f)$. We have that $p = \Phi_e(h')$, so $n$ applications of $j$ to $e$ yields an index $j^n(e)$ such that $p^{(n)} = \Phi_{j^n(e)}(h^{(n+1)})$. Then $\Phi_{d(j^n(e))}(f)$ is $\mathrm{DNR}_2$ relative to $p^{(n)}$ because $f$ is $\mathrm{DNR}_2$ relative to $h^{(n+1)}$. Hence $\Phi_{d(j^n(e))}(f) \in (\npdnr{(n+1)}_2)'(h)$, so $\Phi$ and $\Psi$ witness that $(\npdnr{(n+1)}_2)' \leq_\mathrm{sW} \npdnr{(n+2)}_2$. We now prove the lemma by induction on $n$. For the base case, $\mathsf{DNR}_2$ and $\npdnr{1}_2$ are the same problem, and $\mathsf{WKL} \equiv_\mathrm{sW} \mathsf{DNR}_2$ by~\cite{BrattkaHendtlassKreuzer}*{Corollary~5.3}. That $\mathsf{WKL} \equiv_\mathrm{sW} \mathsf{DNR}_2$ may also be observed by noting that the uniformities in the classic arguments of Jockusch and Soare~\cite{JockuschSoare} imply that $\mathsf{WKL} \equiv_\mathrm{W} \mathsf{DNR}_2$ and then by checking that $\mathsf{WKL}$ and $\mathsf{DNR}_2$ are both cylinders. Suppose by induction that $\mathsf{WKL}^{(n)} \equiv_\mathrm{sW} \mathsf{DNR}_2^{(n)} \equiv_\mathrm{sW} \npdnr{(n+1)}_2$. Then $\mathsf{WKL}^{(n+1)} \equiv_\mathrm{sW} \mathsf{DNR}_2^{(n+1)}$ by Proposition~\ref{prop-WJumpPres}. Furthermore: \begin{align*} \mathsf{DNR}_2^{(n+1)} = (\mathsf{DNR}_2^{(n)})' \equiv_\mathrm{sW} (\npdnr{(n+1)}_2)' \equiv_\mathrm{sW} \npdnr{(n+2)}_2, \end{align*} where the first equivalence uses the induction hypothesis and Proposition~\ref{prop-WJumpPres}. \end{proof} Ramsey's theorem for pairs and its consequences have received considerable attention in the Weihrauch degrees. See, for example,~\cites{DoraisDzhafarovHirstMiletiShafer, HirschfeldtJockusch, BrattkaRakotoniaina}. We define the multi-valued functions relevant to our analysis of the Rival--Sands theorem and its weak version. Multi-valued functions corresponding to $\mathsf{RT}^2_2$, $\mathsf{SRT}^2_2$, and $\mathsf{COH}$ are defined as follows. \begin{Definition}{\ } \begin{itemize} \item $\mathsf{RT}^2_2$ is the following multi-valued function. \begin{itemize} \item Input/instance: A coloring $c \colon [\omega]^2 \rightarrow \{0, 1\}$. \smallskip \item Output/solution: An infinite $H \subseteq \omega$ that is homogeneous for $c$. \end{itemize} \medskip \item $\mathsf{SRT}^2_2$ is the following multi-valued function. \begin{itemize} \item Input/instance: A stable coloring $c \colon [\omega]^2 \rightarrow \{0, 1\}$. \smallskip \item Output/solution: An infinite $H \subseteq \omega$ that is homogeneous for $c$. \end{itemize} \medskip \item $\mathsf{COH}$ is the following multi-valued function. \begin{itemize} \item Input/instance: A sequence $\vec{A} = (A_i : i \in \omega)$ of subsets of $\omega$. \smallskip \item Output/solution: A set $C \subseteq \omega$ that is cohesive for $\vec{A}$. \end{itemize} \end{itemize} \end{Definition} Over $\mathsf{RCA}_0$, the ascending/descending sequence principle $\mathsf{ADS}$ decomposes into the conjunction of a stable version $\mathsf{SADS}$ and a cohesive version $\mathsf{CADS}$, similar to how $\mathsf{RT}^2_2$ decomposes into $\mathsf{SRT}^2_2 \wedge \mathsf{COH}$~\cite{HirschfeldtShore}*{Proposition~2.7}. There are choices to be made concerning what one means by \emph{stable} and \emph{sequence} that are inessential when working in $\mathsf{RCA}_0$ or in the computable degrees, but make a difference when working in the Weihrauch degrees. These choices give rise to a number of multi-valued functions related to $\mathsf{ADS}$ that are explored in~\cite{AstorDzhafarovSolomonSuggs}. Officially, a linear order is \emph{stable} if it satisfies the following definition. \begin{Definition} A linear order $(L, <_L)$ is \emph{stable} if every element either has only finitely many $<_L$-predecessors or has only finitely many $<_L$-successors. \end{Definition} Thus the countable stable linear orders are those of type $\omega + k$ for a finite linear order $k$, of type $k + \omega^*$ for a finite linear order $k$, and of type $\omega + \omega^*$. Over $\mathsf{RCA}_0$, $\mathsf{SADS}$ is defined to be $\mathsf{ADS}$ restricted to stable linear orders, which is equivalent to $\mathsf{ADS}$ restricted to linear orders of type $\omega + \omega^*$. In the Weihrauch degrees, restricting to linear orders of type $\omega + \omega^*$ yields a weaker principle than restricting to all stable linear orders. When working with linear orders in the Weihrauch degrees, there is an important distinction between an \emph{ascending sequence} (as defined in Definition~\ref{def-ADS}) and an \emph{ascending chain}. Essentially, the difference is that we can uniformly distinguish ascending sequences from descending sequences, but we cannot uniformly distinguish ascending chains from descending chains. \begin{Definition}[See~\cite{AstorDzhafarovSolomonSuggs}*{Definition~2.1}] Let $(L, <_L)$ be a linear order. \begin{itemize} \item A set $C \subseteq L$ is an \emph{ascending chain} in $L$ if $\{x \in C : x <_L y\}$ is finite for every $y \in C$. \smallskip \item A set $C \subseteq L$ is an \emph{descending chain} in $L$ if $\{x \in C : y <_L x\}$ is finite for every $y \in C$. \end{itemize} \end{Definition} Of the versions of $\mathsf{ADS}$ and $\mathsf{SADS}$ studied in~\cite{AstorDzhafarovSolomonSuggs}, we mostly consider $\mathsf{ADS}$, which is $\leq_\mathrm{W}$-greatest, and $\mathsf{SADC}$, which is $\leq_\mathrm{W}$-least. In Section~\ref{sec-wRSgWeihrauch}, we show that the weak Rival--Sands theorem is above $\mathsf{ADS}$ in the computable degrees, but not above $\mathsf{SADC}$ in the Weihrauch degrees. \begin{Definition}{\ } \begin{itemize} \item $\mathsf{ADS}$ is the following multi-valued function. \begin{itemize} \item Input/instance: An infinite linear order $L = (L, <_L)$. \smallskip \item Output/solution: An infinite $S \subseteq L$ that is either an ascending sequence in $L$ or a descending sequence in $L$. \end{itemize} \medskip \item $\mathsf{ADC}$ (for the \emph{ascending/descending chain principle}) is the following multi-valued function. \begin{itemize} \item Input/instance: An infinite linear order $L = (L, <_L)$. \smallskip \item Output/solution: An infinite $S \subseteq L$ that is either an ascending chain in $L$ or a descending chain in $L$. \end{itemize} \medskip \item $\mathsf{SADC}$ (for the \emph{stable ascending/descending chain principle}) is the following multi-valued function. \begin{itemize} \item Input/instance: An infinite linear order $L = (L, <_L)$ of order-type $\omega + \omega^*$. \smallskip \item Output/solution: An infinite $C \subseteq L$ that is either an ascending chain in $L$ or a descending chain in $L$. \end{itemize} \end{itemize} \end{Definition} We warn the reader that the definitions of $\mathsf{ADS}$, $\mathsf{ADC}$, and $\mathsf{SADC}$ in~\cite{AstorDzhafarovSolomonSuggs} require that the domain of the input linear order $L$ is $\omega$, whereas here we find it convenient to allow the domain of $L$ to be any infinite subset of $\omega$. The difference is exactly the difference between $\leq_\mathrm{W}$ and $\leq_\mathrm{sW}$. Let $\mathsf{ADS}{\restriction}_{\dom(L) = \omega}$ denote the restriction of $\mathsf{ADS}$ to linear orders with domain $\omega$. Then $\mathsf{ADS}{\restriction}_{\dom(L) = \omega} \equiv_\mathrm{W} \mathsf{ADS}$ but $\mathsf{ADS}{\restriction}_{\dom(L) = \omega} <_\mathrm{sW} \mathsf{ADS}$. In fact, $\mathsf{ADS}$ is the \emph{cylindrification} of $\mathsf{ADS}{\restriction}_{\dom(L) = \omega}$, meaning that $\mathsf{ADS} \equiv_\mathrm{sW} \mathsf{id} \times \mathsf{ADS}{\restriction}_{\dom(L) = \omega}$. This can be seen by an argument analogous to the proof of Proposition~\ref{prop-wRSgCyl} below. Similarly, $\mathsf{ADC}$ and $\mathsf{SADC}$ are the cylindrifications of their restrictions $\mathsf{ADC}{\restriction}_{\dom(L) = \omega}$ and $\mathsf{SADC}{\restriction}_{\dom(L) = \omega}$ to linear orders with domain $\omega$. We use the following formulation of $\mathsf{CADS}$ as a multi-valued function. \begin{Definition} $\mathsf{CADS}$ (\emph{for the cohesive ascending/descending sequence principle}) is the following multi-valued function. \begin{itemize} \item Input/instance: An infinite linear order $L = (L, <_L)$. \smallskip \item Output/solution: An infinite $H \subseteq L$ such that $(H, <_L)$ is stable. \end{itemize} \end{Definition} The definition of $\mathsf{CADS}$ is also sensitive to the precise formulation of \emph{stable}. For the purposes of this discussion, call a linear order \emph{strictly stable} if it is of order-type $\omega$, $\omega^*$, or $\omega + \omega^*$. Let $\mathsf{CADS}_\mathrm{strict}$ denote the multi-valued function defined in the same way as $\mathsf{CADS}$, except with \emph{strictly stable} in place of \emph{stable}. Then $\mathsf{CADS} <_\mathrm{W} \mathsf{CADS}_\mathrm{strict}$. The difference in uniformity between $\mathsf{CADS}$ and $\mathsf{CADS}_\mathrm{strict}$ is due to the fact that any finite suborder of an infinite linear order can be extended to an infinite stable suborder but not necessarily to an infinite strictly stable suborder. \begin{Proposition} $\mathsf{CADS}_\mathrm{strict} \nleq_\mathrm{W} \mathsf{CADS}$. Therefore $\mathsf{CADS} <_\mathrm{W} \mathsf{CADS}_\mathrm{strict}$. \end{Proposition} \begin{proof} Suppose for a contradiction that functionals $\Phi$ and $\Psi$ witness that $\mathsf{CADS}_\mathrm{strict} \leq_\mathrm{W} \mathsf{CADS}$. Let $L_0$ be the $\mathsf{CADS}_\mathrm{strict}$-instance $L_0 = (\omega, <)$, let $R_0 = \Phi(L_0)$, and write $R_0 = (R_0, <_{R_0})$. The linear order $R_0$ is a $\mathsf{CADS}$-instance, so let $C_0 \subseteq R_0$ be a $\mathsf{CADS}$-solution. Then $\Psi(\langle L_0, C_0 \rangle)$ is a $\mathsf{CADS}_\mathrm{strict}$-solution to $L_0$. In particular, $\Psi(\langle L_0, C_0 \rangle)$ is infinite. Fix any $\ell \in \Psi(\langle L_0, C_0 \rangle)$. Let $\sigma \subseteq L_0$ and $\tau \subseteq C_0$ be initial segments of $L_0$ and $C_0$ long enough to guarantee that $(\forall n < |\tau|)(\tau(n) = 1 \rightarrow \Phi(\sigma)(n) = 1)$ and that $\ell \in \Psi(\langle \sigma, \tau \rangle)$. The string $\sigma$ only encodes information about elements of $L_0$ that are $<$-less than $|\sigma|$. Let $k$ be the $<$-maximum of $|\sigma|$ and $\ell+1$. Then any linear order $L_1 = (\omega, <_{L_1})$ that defines $0 <_{L_1} 1 <_{L_1} \cdots <_{L_1} k-1$ is consistent with the information contained in $\sigma$ and therefore satisfies $\sigma \subseteq L_1$. Thus let $L_1 = (\omega, <_{L_1})$ be the linear order of type $\omega + k$ in which $i <_{L_1} j$ if and only if $i < j < k$, $k \leq i < j$, or $j < k \leq i$. Then $\sigma \subseteq L_1$. Notice that $\ell$ is in the $k$-part of $L_1$ and therefore that no strictly stable suborder of $L_1$ contains $\ell$. $L_1$ is a $\mathsf{CADS}_\mathrm{strict}$-instance, so $R_1 = \Phi(L_1)$ is an infinite linear order. Write $R_1 = (R_1, <_{R_1})$. Notice that $(\forall n < |\tau|)(\tau(n) = 1 \rightarrow n \in R_1)$ by the choices of $\sigma$ and $\tau$ and the fact that $\sigma \subseteq L_1$. Let $S \subseteq R_1$ be an $\mathsf{ADS}$-solution to $R_1$ with $n > |\tau|$ for every $n \in S$. Let $C_1 = S \cup \{n < |\tau| : \tau(n) = 1\} \subseteq R_1$. Then $\tau \subseteq C_1$. Furthermore, $(C_1, <_{R_1})$ is stable because it is the union of the ascending or descending sequence $S$ and a finite set. Thus $C_1$ is a $\mathsf{CADS}$-solution to $R_1$. However, $\ell \in \Psi(\langle L_1, C_1 \rangle)$ because $\ell \in \Psi(\langle \sigma, \tau \rangle)$, $\sigma \subseteq L_1$, and $\tau \subseteq C_1$. Thus $\Psi(\langle L_1, C_1 \rangle)$ is not a $\mathsf{CADS}_\mathrm{strict}$-solution to $L_1$ because no strictly stable suborder of $L_1$ contains $\ell$. Therefore $\Phi$ and $\Psi$ do not witness that $\mathsf{CADS}_\mathrm{strict} \leq_\mathrm{W} \mathsf{CADS}$. So $\mathsf{CADS}_\mathrm{strict} \nleq_\mathrm{W} \mathsf{CADS}$. \end{proof} The reason we consider $\mathsf{CADS}$ is because $\mathsf{CADS} \equiv_\mathrm{W} \mathsf{COH}$. Indeed, with the formulations of $\mathsf{COH}$ and $\mathsf{CADS}$ given here, $\mathsf{CADS}{\restriction}_{\dom(L) = \omega} \equiv_\mathrm{sW} \mathsf{COH}$, where $\mathsf{CADS}{\restriction}_{\dom(L) = \omega}$ is the restriction of $\mathsf{CADS}$ to linear orders with domain $\omega$. Thus $\mathsf{CADS}$ is the cylindrification of both $\mathsf{CADS}{\restriction}_{\dom(L) = \omega}$ and $\mathsf{COH}$. The proofs are those of~\cite{HirschfeldtShore}, which we repeat here for the sake of completeness. The equivalence between $\mathsf{CADS}$ and $\mathsf{COH}$ helps us show that $\mathsf{COH}$ Weihrauch reduces to the weak Rival--Sands theorem in Theorem~\ref{thm-COHredWRSG} below. \begin{Proposition}[See~\cite{HirschfeldtShore}*{Propositions~2.9 and~4.4}]\label{prop-CADSCOH} $\mathsf{CADS}{\restriction}_{\dom(L) = \omega} \equiv_\mathrm{sW} \mathsf{COH}$. Therefore $\mathsf{CADS} \equiv_\mathrm{sW} \mathsf{id} \times \mathsf{CADS}{\restriction}_{\dom(L) = \omega} \equiv_\mathrm{sW} \mathsf{id} \times \mathsf{COH}$. \end{Proposition} \begin{proof} We have that $\mathsf{CADS} \equiv_\mathrm{sW} \mathsf{id} \times \mathsf{CADS}{\restriction}_{\dom(L) = \omega}$ by an argument analogous to the proof of Proposition~\ref{prop-wRSgCyl} below. So it suffices to show that $\mathsf{CADS}{\restriction}_{\dom(L) = \omega} \equiv_\mathrm{sW} \mathsf{COH}$. For $\mathsf{CADS}{\restriction}_{\dom(L) = \omega} \leq_\mathrm{sW} \mathsf{COH}$, given a linear order $L = (\omega, <_L)$, apply $\mathsf{COH}$ to the sequence $\vec{A} = (A_i : i \in \omega)$ where $A_i = \{n \in \omega : i <_L n\}$. Then any $\vec{A}$-cohesive set $C$ is also a $\mathsf{CADS}$-solution to $L$. The proof of~\cite{HirschfeldtShore}*{Proposition~4.4} showing that $\mathsf{RCA}_0 + \mathsf{B}\Sigma^0_2 + \mathsf{CADS} \vdash \mathsf{COH}$ describes a strong Weihrauch reduction $\mathsf{COH} \leq_\mathrm{sW} \mathsf{CADS}{\restriction}_{\dom(L) = \omega}$. Let $\vec{A} = (A_i : i \in \omega)$ be a $\mathsf{COH}$-instance. Define a functional $\Phi(\vec{A})$ computing a linear order $L = (\omega, <_L)$ as follows. Given $x$ and $y$, define $x <_L y$ if and only if $\langle A_i(x) : i \leq x \rangle <_\mathrm{lex} \langle A_i(y) : i \leq y \rangle$, where $<_\mathrm{lex}$ denotes the lexicographic order on $2^{<\omega}$. Let $C$ be a $\mathsf{CADS}$-solution to $L$, and let $\Psi$ be the identity functional. We claim that $C$ is $\vec{A}$-cohesive and hence that $\Phi$ and $\Psi$ witness that $\mathsf{COH} \leq_\mathrm{sW} \mathsf{CADS}{\restriction}_{\dom(L) = \omega}$. To see that $C$ is $\vec{A}$-cohesive, fix $n$ and let $F_n = \{\sigma \in 2^{n+1} : (\exists x \in C)(\sigma \subseteq \langle A_i(x) : i \leq x \rangle)\}$. Let $\sigma_0 <_\mathrm{lex} \cdots <_\mathrm{lex} \sigma_{k-1}$ list the elements of $F_n$ in $<_\mathrm{lex}$-increasing order. For each $j < k$, let $x_{\sigma_j}$ be the $<$-least element of $C$ witnessing that $\sigma_j \in F_n$. Then $x_{\sigma_0} <_L \cdots <_L x_{\sigma_{k-1}}$. The order $(C, <_L)$ is stable, so in $C$ exactly one interval $(-\infty, x_{\sigma_0}), (x_{\sigma_0}, x_{\sigma_1}), \dots, (x_{\sigma_{k-2}}, x_{\sigma_{k-1}}), (x_{\sigma_{k-1}}, \infty)$ is infinite, where $(-\infty, a)$ and $(a, \infty)$ denote $\{x \in C : x <_L a\}$ and $\{x \in C : a <_L x\}$. If $(x_{\sigma_j}, x_{\sigma_{j+1}})$ is infinite for some $j < k-1$, then almost every $y \in C$ satisfies $\sigma_j \subseteq \langle A_i(y) : i \leq y \rangle$. In particular, $A_n(y) = \sigma_j(n)$ for almost every $y \in C$, so either $C \subseteq^* A_n$ or $C \subseteq^* \ol{A_n}$. Similarly, if $(-\infty, x_{\sigma_0})$ is infinite then $A_n(y) = \sigma_0(n)$ for almost every $y \in C$; and if $(x_{\sigma_{k-1}}, \infty)$ is infinite, then $A_n(y) = \sigma_{k-1}(n)$ for almost every $y \in C$. Thus $C$ is $\vec{A}$-cohesive. \end{proof} Finally, we consider various versions of the infinite pigeonhole principle (i.e., Ramsey's theorem for singletons). In Section~\ref{sec-wRSgWeihrauch}, we show that the weak Rival--Sands theorem is above the infinite pigeonhole principle in the Weihrauch degrees. \begin{Definition}\label{def-RT1}{\ } \begin{itemize} \item For each $k > 0$, $\mathsf{RT}^1_k$ is the following multi-valued function. \begin{itemize} \item Input/instance: A coloring $c \colon \omega \rightarrow \{0, 1, \dots, k-1\}$. \smallskip \item Output/solution: An infinite $H \subseteq \omega$ that is monochromatic for $c$: $(\forall x, y \in H)(c(x) = c(y))$. \end{itemize} \medskip \item $\mathsf{RT}^1_{<\infty}$ is the following multi-valued function. \begin{itemize} \item Input/instance: A coloring $c \colon \omega \rightarrow \omega$ with finite range. \smallskip \item Output/solution: An infinite $H \subseteq \omega$ that is monochromatic for $c$: $(\forall x, y \in H)(c(x) = c(y))$. \end{itemize} \end{itemize} \end{Definition} If $0 < k \leq \ell$, then $\mathsf{RT}^1_k \leq_\mathrm{sW} \mathsf{RT}^1_\ell \leq_\mathrm{sW} \mathsf{RT}^1_{<\infty}$. Furthermore, it is Weihrauch equivalent to specify that solutions to $\mathsf{RT}^1_k$- and $\mathsf{RT}^1_{<\infty}$-instances are the colors of the monochromatic sets instead of the monochromatic sets themselves. For the purposes of this discussion, for $k > 0$, let $\mathsf{cRT}^1_k$ denote the problem whose instances are colorings $c \colon \omega \rightarrow k$ and whose solutions are the numbers $i < k$ such that $c^{-1}(i)$ is infinite. Define $\mathsf{cRT}^1_{<\infty}$ similarly. Then $\mathsf{cRT}^1_k \equiv_\mathrm{W} \mathsf{RT}^1_k$ for each $k > 0$, and $\mathsf{cRT}^1_{<\infty} \equiv_\mathrm{W} \mathsf{RT}^1_{<\infty}$. However, $\mathsf{cRT}^1_k \not\equiv_\mathrm{sW} \mathsf{RT}^1_k$ for $k > 2$, and $\mathsf{cRT}^1_{<\infty} \not\equiv_\mathrm{sW} \mathsf{RT}^1_{<\infty}$. In reverse mathematics, $\mathsf{RT}^1_{<\infty}$ is equivalent to $\mathsf{B}\Sigma^0_2$ over $\mathsf{RCA}_0$ by a well-known theorem of Hirst~\cite{HirstThesis}. Thus $\mathsf{RCA}_0 + \mathsf{ADS} \vdash \mathsf{RT}^1_{<\infty}$ by Proposition~\ref{prop-rt22andADS}. Indeed, the proof that $\mathsf{RCA}_0 + \mathsf{ADS} \vdash \mathsf{B}\Sigma^0_2$ in~\cite{HirschfeldtShore} establishes that $\mathsf{RCA}_0 + \mathsf{ADS} \vdash \mathsf{RT}^1_{<\infty}$. In the Weihrauch degrees, the analogous question of whether $\mathsf{RT}^1_{<\infty} \leq_\mathrm{W} \mathsf{ADS}$ has not yet, to our knowledge, been considered in the literature. We address this gap by showing that $\mathsf{RT}^1_5 \nleq_\mathrm{W} \mathsf{ADS}$ and therefore that $\mathsf{RT}^1_{<\infty} \nleq_\mathrm{W} \mathsf{ADS}$. On the positive side, we show that $\mathsf{RT}^1_3 \leq_\mathrm{sW} \mathsf{ADC}$. Whether $\mathsf{RT}^1_4 \leq_\mathrm{W} \mathsf{ADS}$ remains open. \begin{Theorem} $\mathsf{RT}^1_3 \leq_\mathrm{sW} \mathsf{ADC}$. \end{Theorem} \begin{proof} $\mathsf{RT}^1_3 \equiv_\mathrm{W} \mathsf{cRT}^1_3$ and $\mathsf{ADC}$ is a cylinder, so it suffices to show that $\mathsf{cRT}^1_3 \leq_\mathrm{W} \mathsf{ADC}$. Let $c$ be a $\mathsf{cRT}^1_3$-instance. Define a functional $\Phi$, where $\Phi(c)$ computes a linear order $L = (\omega, <_L)$ as follows. The computation of $L$ proceeds in stages, where at stage $s$ the order $<_L$ is determined on $\{0, 1, \dots, s\}$. Throughout the computation, we maintain three sets $A_s, M_s, D_s \subseteq \{0, 1, \dots, s\}$, with $\max_{<_L}(A_s) <_L \min_{<_L}(M_s)$ and $\max_{<_L}(M_s) <_L \min_{<_L}(D_s)$, where $\min_{<_L}(X)$ and $\max_{<_L}(X)$ denote the minimum and maximum elements of the finite set $X$ with respect to $<_L$. The sets $A_s$ and $D_s$ are used to build an ascending sequence and a descending sequence in $L$ in order to achieve the following. \begin{itemize} \item If only two colors $i < j < 3$ occur in the range of $c$ infinitely often, then $L$ has order-type $\omega + k + \omega^*$ for some finite linear order $k$, with the $\omega$-part of $L$ corresponding to color $i$ and the $\omega^*$-part of $L$ corresponding to color $j$. \medskip \item If only one color $i < 3$ occurs in the range of $c$ infinitely often, then $L$ has either order-type $\omega + k$ or order-type $k + \omega^*$ for some finite linear order $k$, with the $\omega$-part or the $\omega^*$-part of $L$ corresponding to color $i$. \end{itemize} To monitor the last two colors seen up to $s$ (or the only color seen so far, if $c$ is constant up to $s$), let $t < s$ be greatest such that $c(t) \neq c(s)$, let $\mathsf{last}_s = \{c(t), c(s)\}$ if there is such a $t$, and otherwise let $\mathsf{last}_s = \{c(s)\}$. We assign the least color of $\mathsf{last}_s$ to $A_s$ and the other color (if it exists) to $D_s$. At stage $0$, let $A_0 = \{0\}$, $M_0 = \emptyset$, and $D_0 = \emptyset$. Assign $A_0$ color $c(0)$ and assign $D_0$ no color. At stage $s+1$, first check if $\mathsf{last}_{s+1} = \mathsf{last}_s$. If $\mathsf{last}_{s+1} = \mathsf{last}_s$, then color $c(s+1)$ is assigned to either $A_s$ or $D_s$. If $c(s+1)$ is assigned to $A_s$, then set $A_{s+1} = A_s \cup \{s+1\}$, $M_{s+1} = M_s$, and $D_{s+1} = D_s$. Extend $<_L$ so that $s+1$ is the $<_L$-maximum element of $A_{s+1}$ and $<_L$-below all elements of $M_{s+1}$ and $D_{s+1}$. If $c(s+1)$ is assigned to $D_s$, then set $A_{s+1} = A_s$, $M_{s+1} = M_s$, and $D_{s+1} = D_s \cup \{s+1\}$. Extend $<_L$ so that $s+1$ is the $<_L$-minimum element of $D_{s+1}$ and $<_L$-above all elements of $A_{s+1}$ and $M_{s+1}$. Assign $A_{s+1}$ the same color as $A_s$, and assign $D_{s+1}$ the same color as $D_s$. If $\mathsf{last}_{s+1} \neq \mathsf{last}_s$, then set $M_{s+1} = \{0, 1, \dots, s\}$. If $c(s+1)$ is the least color of $\mathsf{last}_{s+1}$, then set $A_{s+1} = \{s+1\}$, set $D_{s+1} = \emptyset$, extend $<_L$ so that $s+1$ is the $<_L$-minimum element of $\{0, 1, \dots, s+1\}$, assign $A_{s+1}$ color $c(s+1)$, and assign $D_{s+1}$ the other color of $\mathsf{last}_{s+1}$. If $c(s+1)$ is not the least color of $\mathsf{last}_{s+1}$, then set $A_{s+1} = \emptyset$, set $D_{s+1} = \{s+1\}$, extend $<_L$ so that $s+1$ is the $<_L$-maximum element of $\{0, 1, \dots, s+1\}$, assign $D_{s+1}$ color $c(s+1)$, and assign $A_{s+1}$ the other color of $\mathsf{last}_{s+1}$. This completes the computation of $L$. The linear order $L$ is a valid $\mathsf{ADC}$-instance, so let $S$ be an $\mathsf{ADC}$-solution to $L$. Define a functional $\Psi(\langle c, S \rangle)$ by finding the $<$-least element $x_0$ of $S$ and outputting $\Psi(\langle c, S \rangle) = c(x_0)$. We show that $c(x_0)$ appears in the range of $c$ infinitely often and therefore that $\Psi(\langle c, S \rangle)$ is a $\mathsf{cRT}^1_3$-solution to $c$. Thus $\Phi$ and $\Psi$ witness that $\mathsf{cRT}^1_3 \leq_\mathrm{W} \mathsf{ADC}$. If every color $i < 3$ appears in the range of $c$ infinitely often, then $c(x_0)$ appears in the range of $c$ infinitely often. Suppose that exactly two colors $i < j < 3$ appear in the range of $c$ infinitely often. Then there is an $s_0$ such that $\mathsf{last}_s = \mathsf{last}_{s_0} = \{i,j\}$ for all $s \geq s_0$. In this case, each $s \geq s_0$ with $c(s) = i$ is added to $A_s$, and each $s \geq s_0$ with $c(s) = j$ is added to $D_s$. Thus $L$ is a linear order of type $\omega + k + \omega^*$ with $\omega$-part $A = \bigcup_{s \geq s_0}A_s$, $\omega^*$-part $D = \bigcup_{s \geq s_0}D_s$, and $k$-part $M_{s_0}$. If $S$ is an ascending chain, then it must be that $S \subseteq A$. We have that $c(x) = i$ for all $x \in A$. In particular, $c(x_0) = i$, which occurs in the range of $c$ infinitely often. If $S$ is a descending chain, then it must be that $S \subseteq D$. We have that $c(x) = j$ for all $x \in D$. Thus $c(x_0) = j$, which occurs in the range of $c$ infinitely often. Finally, suppose that exactly one color $i < 3$ appears in the range of $c$ infinitely often. Then there is an $s_0$ such that $c(s) = i$ for all $s \geq s_0$ and hence is also such that $\mathsf{last}_s = \mathsf{last}_{s_0}$ for all $s \geq s_0$. If $i$ is the least color of $\mathsf{last}_{s_0}$, then $s$ is added to $A_s$ for all $s \geq s_0$, and $L$ is a linear order of type $\omega + k$ with $\omega$-part $A = \bigcup_{s \geq s_0} A_s$ and $k$-part $M_{s_0} \cup D_{s_0}$. It must therefore be that $S \subseteq A$. We have that $c(x) = i$ for all $x \in A$. Thus $c(x_0) = i$, which occurs in the range of $c$ infinitely often. If instead $i$ is not the least color of $\mathsf{last}_{s_0}$, then $s$ is added to $D_s$ for all $s \geq s_0$, and $L$ is a linear order of type $k + \omega^*$ with $\omega^*$-part $D = \bigcup_{s \geq s_0} D_s$ and $k$-part $A_{s_0} \cup M_{s_0}$. It must therefore be that $S \subseteq D$. We have that $c(x) = i$ for all $x \in D$. Thus $c(x_0) = i$, which occurs in the range of $c$ infinitely often. \end{proof} \begin{Theorem} $\mathsf{RT}^1_5 \nleq_\mathrm{W} \mathsf{ADS}$. Therefore $\mathsf{RT}^1_{<\infty} \nleq_\mathrm{W} \mathsf{ADS}$. \end{Theorem} \begin{proof} $\mathsf{RT}^1_5 \equiv_\mathrm{W} \mathsf{cRT}^1_5$ and $\mathsf{ADS}$ is a cylinder, so it suffices to show that $\mathsf{cRT}^1_5 \nleq_\mathrm{sW} \mathsf{ADS}$. Suppose for a contradiction that $\Phi$ and $\Psi$ witness that $\mathsf{cRT}^1_5 \leq_\mathrm{sW} \mathsf{ADS}$. We compute a coloring $c \colon \omega \rightarrow 5$ such that the $\mathsf{ADS}$-instance $\Phi(c)$ has a solution $S$ for which $c^{-1}(\Psi(S))$ is finite, contradicting that $\Phi$ and $\Psi$ witness that $\mathsf{cRT}^1_5 \leq_\mathrm{sW} \mathsf{ADS}$. The computation of $c$ proceeds in stages, where at stage $s+1$ we determine the value of $c(s)$. Thus we compute a sequence of strings $(c_s : s \in \omega)$, where $c_s \in 5^s$ and $c_s \subseteq c_{s+1}$ for each $s$. The final coloring $c$ is $c = \bigcup_{s \in \omega}c_s$. For each $s$, let $L_s = \Phi(c_s) {\restriction} s$ denote the partially-defined structure obtained by running $\Phi(c_s)(n)$ for $s$ steps for each $n < s$. Write also $L_s = (L_s, <_{L_s})$. $L_s$ is not necessarily a linear order, but it must be consistent with being a linear order because there are functions $c \colon \omega \rightarrow 5$ extending $c_s$. For $\sigma \in 2^{<\omega}$, let $\set(\sigma) = \{n < |\sigma| : \sigma(n) = 1\}$ denote the finite set for which $\sigma$ is a characteristic string. The computation of $c$ begins in phase~I, and it may or may not eventually progress to phase~II. The goal of phase~I is to identify $s, m_* \in \omega$, $k_\mathrm{asc}, k_\mathrm{dec} < 5$, and $\sigma_*, \tau_* \in 2^{<\omega}$ such that \begin{itemize} \item $\set(\sigma_*)$ is an ascending sequence in $L_s$ (in the sense of Definition~\ref{def-ADS}) with $k_\mathrm{asc} = \Psi(\sigma_*){\downarrow}$; \smallskip \item $\set(\tau_*)$ is a descending sequence in $L_s$ with $k_\mathrm{dec} = \Psi(\tau_*){\downarrow}$; \smallskip \item $m_*$ is both the $<_{L_s}$-maximum element of $\set(\sigma_*)$ and the $<_{L_s}$-minimum element of $\set(\tau_*)$. \end{itemize} Once $s$, $m_*$, $k_\mathrm{asc}$, $k_\mathrm{dec}$, $\sigma_*$, and $\tau_*$ are found, the computation enters phase~II and no longer uses colors $k_\mathrm{asc}$ and $k_\mathrm{dec}$. The point is that, at the end of the construction, if $L = \Phi(c)$ has an ascending sequence above $m_*$, then it has an ascending sequence $S$ with $\sigma_* \subseteq S$ and hence with $\Psi(S) = k_\mathrm{asc}$. Similarly, if $L$ has a descending sequence below $m_*$, then it has a descending sequence $S$ with $\tau_* \subseteq S$ and hence with $\Psi(S) = k_\mathrm{dec}$. In both cases, $S$ is as desired because $c^{-1}(k_\mathrm{asc})$ and $c^{-1}(k_\mathrm{dec})$ are finite. Computation in phase~I proceeds as follows. We maintain sequences $\vec\sigma = (\langle \sigma_\ell, u_\ell, i_\ell \rangle : \ell < a)$ and $\vec\tau = (\langle \tau_\ell, d_\ell, j_\ell \rangle : \ell < b)$ satisfying the following properties at each stage $s$. \begin{enumerate} \item\label{it-seq1} For each $\ell < a$, $\set(\sigma_\ell)$ is an ascending sequence in $L_s$, $u_\ell$ is the $<_{L_s}$-maximum element of $\set(\sigma_\ell)$, and $\Psi(\sigma_\ell) = i_\ell$. \smallskip \item\label{it-seq2} For each $\ell < b$, $\set(\tau_\ell)$ is an descending sequence in $L_s$, $d_\ell$ is the $<_{L_s}$-minimum element of $\set(\tau_\ell)$, and $\Psi(\tau_\ell) = j_\ell$. \smallskip \item\label{it-seq3} For each $\ell_0 < \ell_1 < a$, $u_{\ell_0} >_{L_s} u_{\ell_1}$. \smallskip \item\label{it-seq4} For each $\ell_0 < \ell_1 < b$, $d_{\ell_0} <_{L_s} d_{\ell_1}$. \end{enumerate} At stage $0$, begin with $c_0 = \emptyset$, $\vec\sigma = \emptyset$, and $\vec\tau = \emptyset$. At stage $s+1$, let $c_{s+1}(s)$ be the least $i < 5$ that is neither $i_{a-1}$ (if $a > 0$) nor $j_{b-1}$ (if $b > 0$). Next, search for an $\eta \in 2^{<s}$ such that $\Psi(\eta){\downarrow}$ and either \begin{enumerate}[\indent(i)] \item\label{it-FindAsc1} $\set(\eta)$ is an ascending sequence in $L_s$ with $<_{L_s}$-maximum element $u$, and $u <_{L_s} u_{a-1}$ if $a > 0$; or \medskip \item\label{it-FindDec1} $\set(\eta)$ is an descending sequence in $L_s$ with $<_{L_s}$-minimum element $d$, and $d >_{L_s} d_{b-1}$ if $b > 0$. \end{enumerate} If there is such an $\eta$, let $\eta$ be the first one found. If $\eta$ satisfies~(\ref{it-FindAsc1}), let $\langle \sigma_a, u_a, i_a \rangle = \langle \eta, u, \Psi(\eta)\rangle$ and append this element to $\vec\sigma$. If $\eta$ satisfies~(\ref{it-FindDec1}), let $\langle \tau_b, d_b, j_b \rangle = \langle \eta, d, \Psi(\eta)\rangle$ and append this element to $\vec\tau$. If there is no such $\eta$, then do not update $\vec\sigma$ or $\vec\tau$. Next, search for an $\theta \in 2^{<s}$ such that $\Psi(\theta){\downarrow}$ and either \begin{enumerate}[\indent\indent(a)] \item\label{it-FindDec2} $\set(\theta) \subseteq \{u_0, \dots, u_{a-1}\}$ is a descending sequence in $L_s$ or \smallskip \item\label{it-FindAsc2} $\set(\theta) \subseteq \{d_0, \dots, d_{b-1}\}$ is an ascending sequence in $L_s$. \end{enumerate} If there is such a $\theta$, let $\theta$ be the first one found. If $\theta$ satisfies~(\ref{it-FindDec2}), let $u_\ell$ be the $<_{L_s}$-minimum element of $\set(\theta)$, which is also the $<_{L_s}$-maximum element of $\sigma_\ell$. Set $\sigma_* = \sigma_\ell$, $\tau_* = \theta$, $m_* = u_\ell$, $k_\mathrm{asc} = i_\ell$, and $k_\mathrm{dec} = \Psi(\theta)$. If $\theta$ satisfies~(\ref{it-FindAsc2}), let $d_\ell$ be the $<_{L_s}$-maximum element of $\set(\theta)$, which is also the $<_{L_s}$-minimum element of $\tau_\ell$. Set $\sigma_* = \theta$, $\tau_* = \tau_\ell$, $m_* = d_\ell$, $k_\mathrm{asc} = \Psi(\theta)$, and $k_\mathrm{dec} = j_\ell$. Go to stage $s+2$ and begin phase~II. If there is no such $\theta$, go to stage $s+2$ and remain in phase~I. The phase~II strategy is to reset $\vec\sigma$ and $\vec\tau$ to the $\sigma_*$, $\tau_*$, $m_*$, $k_\mathrm{asc}$ and $k_\mathrm{dec}$ found at the end of phase~I and then rerun a portion of the phase~I strategy. Upon beginning phase~II, reset $\vec\sigma$ and $\vec\tau$ to $\vec\sigma = \langle \sigma_0, u_0, i_0 \rangle = \langle \sigma_*, m_*, k_\mathrm{asc} \rangle$ and $\vec\tau = \langle \tau_0, d_0, j_0 \rangle = \langle \tau_*, m_*, k_\mathrm{dec} \rangle$. Throughout phase~II, $\vec\sigma$ and $\vec\tau$ satisfy the same items~(\ref{it-seq1})--(\ref{it-seq4}) from phase~I. Computation in phase~II proceeds as follows. At stage $s+1$, let $c_{s+1}(s)$ be the least $i < 5$ not in $\{k_\mathrm{asc}, k_\mathrm{dec}, i_{a-1}, j_{b-1}\}$. Next, as in phase~I, search for an $\eta \in 2^{<s}$ with $\Psi(\eta){\downarrow}$ that satisfies either~(\ref{it-FindAsc1}) or~(\ref{it-FindDec1}). If such an $\eta$ is found, then update either $\vec\sigma$ or $\vec\tau$ as in phase~I and go to stage $s+2$. If no such $\eta$ is found, go to stage $s+2$ without updating $\vec\sigma$ or $\vec\tau$. This completes the computation. Let $L = \Phi(c)$ and write $L = (L, <_L)$. We find an $\mathsf{ADS}$-solution $S$ to $L$ such that $c^{-1}(\Psi(S))$ is finite, contradicting that $\Phi$ and $\Psi$ witness that $\mathsf{cRT}^1_5 \leq_\mathrm{sW} \mathsf{ADS}$. First, suppose that the computation of $c$ never leaves phase~I. Then there must be a stage after which no further elements are appended to either $\vec\sigma$ or $\vec\tau$. This is because if, say, elements are appended to $\vec\sigma$ infinitely often, then $u_0 >_L u_1 >_L u_2 >_L \cdots$, which means that there is a descending sequence $D \subseteq \{u_\ell : \ell \in \omega\}$. This $D$ is an $\mathsf{ADS}$-solution to $L$, so $\Psi(D){\downarrow}$. Let $\theta \subseteq D$ be long enough so that $\Psi(\theta){\downarrow}$. This $\theta$ eventually satisfies item~(\ref{it-FindDec2}) of phase~I, and the construction eventually finds $\theta$. Thus the computation of $c$ eventually enters phase~II, contradicting the assumption that it never leaves phase~I. So let $s_0$ be a stage after which no further elements are appended to $\vec\sigma$ or $\vec\tau$. Then $a$, $b$, $i_{a-1}$ (if $a > 0$), and $j_{b-1}$ (if $b > 0$) do not change after stage $s_0$, and for every $s > s_0$, $c(s)$ is the least $i < 5$ that is neither $i_{a-1}$ (if $a > 0$) nor $j_{b-1}$ (if $b > 0$). Let $A$ be an $\mathsf{ADS}$-solution to $L$, and assume that $A$ is ascending (the descending case is symmetric). If $a = 0$ or if $x <_L u_{a-1}$ for all $x \in A$, then let $\eta \subseteq A$ be long enough so that $\Psi(\eta){\downarrow}$. This $\eta$ eventually satisfies item~(\ref{it-FindAsc1}) of phase~I, so the computation adds an element to $\vec\sigma$ at some stage after $s_0$, which is a contradiction. Therefore it must be that $a > 0$ and that $x \geq_L u_{a-1}$ for some $x \in A$. As $A$ is ascending, this means that $x >_L u_{a-1}$ for almost every $x \in A$. Let $S = \set(\sigma_{a-1}) \cup \{x \in A : (x > u_{a-1}) \wedge (x >_L u_{a-1})\}$. Then $S$ is an ascending sequence in $L$. However, $\sigma_{a-1} \subseteq S$, so $\Psi(S) = i_{a-1}$. We have that $c(s) \neq i_{a-1}$ for all $s > s_0$, so $S$ is as desired. Now, suppose that the computation of $c$ eventually enters phase~II at some stage $s_0$. Then $c(s)$ is neither $k_\mathrm{asc}$ nor $k_\mathrm{dec}$ for all $s > s_0$. Recall that $\vec\sigma$ and $\vec\tau$ are reset at the beginning of phase~II. Suppose that elements are appended to $\vec\sigma$ infinitely often in phase~II. Then $m_* = u_0 >_L u_1 >_L u_2 >_L \cdots$, so there is a descending sequence $D \subseteq \{u_\ell : \ell \in \omega\}$. Recall that $\set(\tau_*)$ is a descending sequence with $\leq_L$-minimum element $m_*$ and $\Psi(\tau_*) = k_\mathrm{dec}$. Let $S = \set(\tau_*) \cup \{x \in D : (x > m_*) \wedge (x <_L m_*)\}$. Then $S$ is a descending sequence with $\tau_* \subseteq S$. Therefore $\Psi(S) = k_\mathrm{dec}$. However, $c(s) \neq k_\mathrm{dec}$ for all $s > s_0$, so $S$ is as desired. If instead elements are appended to $\vec\tau$ infinitely often in phase~II, then a symmetric argument shows that there is an ascending sequence $S$ with $\sigma_* \subseteq S$ and therefore with $\Psi(S) = k_\mathrm{asc}$. Finally, suppose that there is a stage $s_1 > s_0$ after which no further elements are appended to either $\vec\sigma$ or $\vec\tau$. We argue as in the case in which the computation of $c$ never leaves phase~I. Notice that $a$, $b$, $i_{a-1}$, and $j_{b-1}$ do not change after stage $s_1$, and for every $s > s_1$, $c(s)$ is the least $i < 5$ that is not in $\{k_\mathrm{asc}, k_\mathrm{dec}, i_{a-1}, j_{b-1}\}$. Let $A$ be an $\mathsf{ADS}$-solution to $L$, and assume that $A$ is ascending (the descending case is symmetric). If $x <_L u_{a-1}$ for all $x \in A$, then the computation must append an element to $\vec\sigma$ at some stage after $s_1$, which is a contradiction. Otherwise, $x >_L u_{a-1}$ for almost every $x \in A$. Let $S = \set(\sigma_{a-1}) \cup \{x \in A : (x > u_{a-1}) \wedge (x >_L u_{a-1})\}$. Then $S$ is an ascending sequence in $L$ with $\Psi(S) = i_{a-1}$, but $c(s) \neq i_{a-1}$ for all $s > s_1$. Thus $S$ is as desired. \end{proof} \begin{Question} Does $\mathsf{RT}^1_4 \leq_\mathrm{W} \mathsf{ADS}$ hold? \end{Question} \section{The Rival--Sands theorem in the Weihrauch degrees}\label{sec-WRS} In this section, we show that the Rival--Sands theorem is Weihrauch equivalent to $\mathsf{WKL}''$ by showing that it is Weihrauch equivalent to $\npdnr{3}_2$. To our knowledge, the Rival--Sands theorem gives the first example of an ordinary mathematical theorem that is Weihrauch equivalent to $\mathsf{WKL}''$. Multi-valued functions corresponding to the Rival--Sands theorem and its refined version are defined as follows. \begin{Definition}{\ } \begin{itemize} \item $\mathsf{RSg}$ is the following multi-valued function. \begin{itemize} \item Input/instance: An infinite graph $G = (V,E)$. \smallskip \item Output/solution: An infinite $H \subseteq V$ such that, for all $v \in V$, either $|H \cap N(v)| = \omega$ or $|H \cap N(v)| \leq 1$. \end{itemize} \medskip \item $\mathsf{RSgr}$ is the following multi-valued function. \begin{itemize} \item Input: An infinite graph $G = (V,E)$. \smallskip \item Output: An infinite $H \subseteq V$ such that, for all $v \in V$, either $|H \cap N(v)| = \omega$ or $|H \cap N(v)| \leq 1$; and additionally, for all $v \in H$, either $|H \cap N(v)| = \omega$ or $|H \cap N(v)| = 0$. \end{itemize} \end{itemize} \end{Definition} Clearly $\mathsf{RSg} \leq_\mathrm{sW} \mathsf{RSgr}$ because for every infinite graph $G$, every $\mathsf{RSgr}$-solution to $G$ is also an $\mathsf{RSg}$-solution to $G$. The proof that $\mathsf{RSgr} \leq_\mathrm{sW} \npdnr{3}_2$ is a refinement of the proof of Theorem~\ref{thm-RSgInACA}, which we outline before giving the full details. Let $G = (V, E)$ be an infinite graph, and let $F = \{x \in V : \text{$N(x)$ is finite}\}$. Let $f$ be $\mathrm{DNR}_2$ relative to $G''$. We need to uniformly compute an $\mathsf{RSgr}$-solution $H$ to $G$ from $f$. To do this, we begin computing $H$ under the assumption that $F$ is infinite. The function $f$ uniformly computes $G''$, $G'$, and $G$, so we may use these sets in the computation of $H$. If $F$ really is infinite, then $G'$ computes an infinite $F_0 \subseteq F$. Using $f$, we compute an infinite set $C \subseteq F_0$ that is cohesive for the sequence $(N(x) : x \in V)$ together with the function $p \colon V \rightarrow \{0,1\}$ given by \begin{align*} p(x) = \begin{cases} 0 & \text{if $C \subseteq^* \ol{N(x)}$}\\ 1 & \text{if $C \subseteq^* N(x)$} \end{cases} \end{align*} (in fact, we need only the function $p$) using a strategy for producing cohesive sets similar to those of~\cite{JockuschStephan}. The computation of $H$ then proceeds in the same manner as in the proof of Theorem~\ref{thm-RSgInACA}. If $F$ is actually finite, then eventually $G''$ will detect this. At the point when $G''$ detects that $F$ is finite, we will have committed to a finite set $\{x_0, \dots, x_{n-1}\} \subseteq F$ being in $H$. Using $G''$, we may compute a bound $s$ such that $H = \{x_0, \dots, x_{n-1}\} \cup \{y \in V : y > s\}$ is an $\mathsf{RSgr}$-solution to $G$. We introduce a bit of notation to help describe the proof. \begin{Definition} For $\vec{A} = (A_i : i \in \omega)$ a sequence of subsets of $\omega$ and $\sigma \in 2^{<\omega}$, let $A^\sigma \subseteq \omega$ denote the set \begin{align*} A^\sigma = \bigcap_{\substack{i < |\sigma|\\\sigma(i) = 0}}\ol{A_i} \cap \bigcap_{\substack{i < |\sigma|\\\sigma(i) = 1}}A_i, \end{align*} where also $A^\emptyset = \omega$. \end{Definition} \begin{Lemma}\label{lem-RSGRred3DNR2} $\mathsf{RSgr} \leq_\mathrm{sW} \npdnr{3}_2$. \end{Lemma} \begin{proof} The proof takes advantage of several well-known uniformities concerning enumerations, Turing jumps, and $\mathrm{DNR}_2$ functions that we list and briefly sketch for the reader's reference. \begin{enumerate} \item\label{it-ure} There is a recursive function $e \mapsto i$ such that, for every $g \in \omega^\omega$, if $\ran(\Phi_e(g))$ is infinite, then $\Phi_i(g)$ computes the characteristic function of an infinite subset of $\ran(\Phi_e(g))$. If $\ran(\Phi_e(g))$ is finite, then $\Phi_i(g)$ is partial but still satisfies $\forall n [\Phi_i(g)(n) = 1 \rightarrow n \in \ran(\Phi_e(g))]$. \medskip \item\label{it-ujump} There is an index $e$ such that $\Phi_e(g') = g$ for every $g \in \omega^\omega$. \medskip \item\label{it-udnrID} There is an index $e$ such that $\Phi_e(f) = g$ whenever $f,g \in \omega^\omega$ are such that $f$ is $\mathrm{DNR}_2$ relative to $g$. \medskip \item\label{it-uDNRWKL} There is a recursive function $e \mapsto i$ such that whenever $f, g \in \omega^\omega$ are such that $f$ is $\mathrm{DNR}_2$ relative to $g$, we have that $\Phi_i(f) \colon \omega \rightarrow \{0, 1\}$ is total, and also if $\Phi_e(g)$ computes an infinite subtree of $2^{<\omega}$, then $\Phi_i(f)$ computes an infinite path through $\Phi_e(g)$. \end{enumerate} For~(\ref{it-ure}), observe that typical proofs that every infinite r.e.\ set contains an infinite recursive subset (see~\cite{SoareBook}*{Section~II.1}) relativize and are uniform. For~(\ref{it-ujump}), observe that typical proofs that $g'$ computes $g$ are uniform (see~\cite{SoareBook}*{Section~III.2}). For~(\ref{it-udnrID}), $\Phi_e(f)(n)$ generates indices $i_0, i_1, \dots$ such that for every $g \in \omega^\omega$ and every $y \in \omega$, $\Phi_{i_y}(g)(i_y) = 0$ if $g(n) = y$ and $\Phi_{i_y}(g)(i_y) = 1$ if $g(n) \neq y$. Then $\Phi_e(f)(n)$ searches for a $y$ with $f(i_y) = 1$ and outputs the first $y$ found. If $f$ is $\mathrm{DNR}_2$ relative to $g$, then $\Phi_e(f)(n) = g(n)$. For~(\ref{it-uDNRWKL}), observe that typical proofs that $\mathrm{DNR}_2$ functions compute paths through infinite recursive subtrees of $2^{<\omega}$ (see~\cite{NiesBook}*{Theorem~4.3.2}) relativize and are uniform. Let $G = (V,E)$ be an $\mathsf{RSgr}$-instance. Let $\Phi$ be the identity functional, and let $f \in \npdnr{3}_2(G)$. That is, let $f$ be $\mathrm{DNR}_2$ relative to $G''$. Define a functional $\Psi(f)$ computing a set $H$ as follows. By items~(\ref{it-ujump}) and~(\ref{it-udnrID}) above, $f$ uniformly computes $G''$, which uniformly computes $G'$, which uniformly computes $G$, so we may assume that $\Psi(f)$ has access to all these sets. Let $\vec{A} = (A_i : i \in \omega)$ be the sequence of sets where $A_x = N(x)$ if $x \in V$ and $A_x = \emptyset$ if $x \notin V$. Let $F$ denote the set $\{x \in V : \text{$N(x)$ is finite}\}$. The sequence $\vec{A}$ is uniformly computable from $G$, and the set $F$ is uniformly computable from $G''$. Ahead of time, fix indices $e_0$, $e_1$, and $e_2$ for Turing functionals with the following properties. \begin{itemize} \item If $F$ is infinite, then $\Phi_{e_0}(G')$ is total and computes an infinite independent set $F_0 \subseteq F$. If $F$ is finite, then $\{x : \Phi_{e_0}(G')(x) = 1\}$ is a finite independent subset of $F$. \medskip \item If $F$ is infinite, then $\Phi_{e_1}(G'')$ computes an infinite tree $T \subseteq 2^{<\omega}$ where $[T]$ consists of exactly all $p \in 2^\omega$ such that $F_0 \cap A^{p {\restriction} n}$ is infinite for every $n$. \medskip \item The function $\Phi_{e_2}(f)$ is total, and if $F$ is infinite, then $\Phi_{e_2}(f)$ computes an infinite path through $T$. \end{itemize} For $e_0$, first fix an index $e$ such that $\Phi_e(G')$ enumerates an independent subset of $F$ in the following way. On input $0$, $\Phi_e(G')(0)$ uses $G'$ to search for the first pair $\langle x, s \rangle \in V \times \omega$ where $(\forall y > s)(y \notin N(x))$ and then outputs $x$. Likewise, $\Phi_e(G')(n+1)$ uses $G'$ to search for the first pair $\langle x, s \rangle \in V \times \omega$ where $x$ is not adjacent to any of $\Phi_e(G')(0)$, $\Phi_e(G')(1), \dots, \Phi_e(G')(n)$ and $(\forall y > s)(y \notin N(x))$, and then $\Phi_e(G')(n+1)$ outputs $x$. If $F$ is infinite, then such $x$ are always found, and $\Phi_e(G')$ enumerates an infinite independent subset of $F$. Otherwise $\Phi_e(G')$ is partial, but the elements that $\Phi_e(G')$ enumerates form a finite independent subset of $F$. Index $e_0$ may be obtained from $e$ via item~(\ref{it-ure}) above. Let $e_1$ be an index such that $\Phi_{e_1}(G'')$ computes the set of all $\sigma \in 2^{<\omega}$ such that $(\exists n > |\sigma|)(n \in \Phi_{e_0}(G') \cap A^\sigma)$. Index $e_2$ may be obtained from index $e_1$ via item~(\ref{it-uDNRWKL}) above. To compute $H$, follow the strategy from Theorem~\ref{thm-RSgInACA} while simultaneously using $G''$ to check if $F$ is finite. Notice that by item~(\ref{it-uDNRWKL}), $\Phi_{e_2}(f)$ is total regardless of whether or not $F$ is infinite. Let $p$ denote the function computed by $\Phi_{e_2}(f)$. Suppose inductively that $x_0 < x_1 < \cdots < x_{n-1}$ have already been added to $H$ and that each $x_i$ is in $\Phi_{e_0}(G')$. Note that the set $Y = \bigcup_{i < n}N(x_i)$ is finite because each $x_i$ is in $F$. Compute $Y$ and its maximum using $G'$. Use $G''$ to simultaneously search for either an $x > x_{n-1}$ such that \begin{align*} \Phi_{e_0}(G')(x) = 1 \wedge (\forall y \in Y)[x \in N(y) \leftrightarrow (p(y) = 1 \wedge y \notin F)]\label{fmla-findx}\tag{$a$} \end{align*} or an $s$ that is large enough to bound $F$ and its neighbors: \begin{align*} (\forall y \in V)[(\exists b \forall z(z \in N(y) \rightarrow z < b)) \rightarrow (y < s \wedge \forall z(z \in N(y) \rightarrow z < s))].\label{fmla-finds}\tag{$b$} \end{align*} Prenexing~(\ref{fmla-finds}) yields a $\Pi^0_2$ formula relative to $G$, so $G''$ can check if a given $s$ satisfies~(\ref{fmla-finds}). If $x$ is found, let $x_n = x$ and continue computing $H$ according to the foregoing procedure. If $s$ is found, abandon this procedure and instead add $\{y \in V : y > s\}$ to the already-computed $\{x_0, x_1, \dots, x_{n-1}\}$ to compute the set $H = \{x_0, x_1, \dots, x_{n-1}\} \cup \{y \in V : y > s\}$. We now verify that $H$ is an $\mathsf{RSgr}$-solution to $G$. First suppose that $F$ is infinite. The verification in this case is very similar to the analogous case in the proof of Theorem~\ref{thm-RSgInACA}. In this case, each step of the computation of $H$ always finds an $x$ as in~(\ref{fmla-findx}), and there is no $s$ as in~(\ref{fmla-finds}). $F$ is infinite, so $\Phi_{e_0}(G')$ is total, $\Phi_{e_0}(G')$ computes an infinite independent $F_0 \subseteq F$, and $F_0 \cap A^{p {\restriction} n}$ is infinite for every $n$. Notice that in this case, the `$y \notin F$' clause in~(\ref{fmla-findx}) is redundant because $p(y) = 1 \rightarrow y \in V \setminus F$ under the current assumptions. The `$y \notin F$' clause is useful in the next case. Thus for every finite $Y \subseteq V$, the set $F_0 \cap A^{p {\restriction} (\max{Y}+1)}$ is infinite, and therefore there are infinitely many $x \in F_0$ such that $(\forall y \in Y)(x \in N(y) \leftrightarrow p(y) = 1)$. Thus an $x$ as in~(\ref{fmla-findx}) always exists, so the elements of $H$ are computed by finding such elements. Consider a $v \in V$. If $H \cap N(v) \neq \emptyset$, then let $m$ be least such that $x_m \in N(v)$ (and hence also least such that $v \in N(x_m)$). If $p(v) = 0$, then every $x_n$ with $n > m$ is chosen from $\ol{N(v)}$, so $|H \cap N(v)| = 1$. If $p(v) = 1$, then every $x_n$ with $n > m$ is chosen from $N(v)$, so $|H \cap N(v)| = \omega$. Thus for every $v \in V$, either $|H \cap N(v)| = \omega$ or $|H \cap N(v)| \leq 1$. Furthermore, $H \subseteq F_0$ and $F_0$ is an independent set, so if $v \in H$, then $|H \cap N(v)| = 0$. Thus $H$ is an $\mathsf{RSgr}$-solution to $G$. Now suppose that $F$ is finite. In this case there are only finitely many $x$ with $\Phi_{e_0}(G')(x)=1$, and every sufficiently large $s$ witnesses~(\ref{fmla-finds}). Thus the computation of $H$ reaches a point where it has computed some finite independent set $\{x_0, x_1, \dots, x_{n-1}\} \subseteq F$, has found an $s$ as in~(\ref{fmla-finds}), and has switched to computing the set $H = \{x_0, x_1, \dots, x_{n-1}\} \cup \{y \in V : y > s\}$. This $H$ is an $\mathsf{RSgr}$-solution to $G$. Consider a $v \in V$. If $v \notin F$, then $N(v)$ is infinite and $H$ contains almost every element of $V$, so $|H \cap N(v)| = \omega$. Suppose instead that $v \in F$. Then $\{y \in V : y > s\} \cap N(v) = \emptyset$ because the elements of $F$ have no neighbors greater than $s$. If $\{x_0, x_1, \dots, x_{n-1}\} \cap N(v) \neq \emptyset$, let $m$ be least such that $x_m \in N(v)$. Then also $v \in N(x_m)$, so the remaining $x_i$ for $m < i < n$ chosen according to~(\ref{fmla-findx}) are chosen from $\ol{N(v)}$ because $v \in F$. Thus $|\{x_0, x_1, \dots, x_{n-1}\} \cap N(v)| \leq 1$, so $|H \cap N(v)| \leq 1$. Lastly, suppose that $v \in H$. If $v > s$, then $|H \cap N(v)| = \omega$ because $v$ has infinitely many neighbors. If $v \in \{x_0, x_1, \dots, x_{n-1}\}$, then $\{x_0, x_1, \dots, x_{n-1}\} \cap N(v) = \emptyset$ because $\{x_0, x_1, \dots, x_{n-1}\}$ is independent, and $\{y \in V : y > s\} \cap N(v) = \emptyset$ because $\{x_0, x_1, \dots, x_{n-1}\} \subseteq F$ and the elements of $F$ have no neighbors greater than $s$. Thus $|H \cap N(v)| = 0$. So $H$ is an $\mathsf{RSgr}$-solution to $G$. \end{proof} The remainder of this section is dedicated to showing that $\npdnr{3}_2 \leq_\mathrm{W} \mathsf{RSg}$. We then observe that $\leq_\mathrm{W}$ can be improved to $\leq_\mathrm{sW}$. Indeed, it is straightforward to show that $\mathsf{RSg}$ is a cylinder by an argument analogous to that of Proposition~\ref{prop-wRSgCyl}. The proof that $\npdnr{3}_2 \leq_\mathrm{sW} \mathsf{RSg}$ makes use of several intermediate $\mathsf{COH}$-inspired problems interpolating between $\npdnr{3}_2$ and $\mathsf{RSg}$. \begin{Definition}{\ } \begin{itemize} \item $\mathsf{oCOH}$ (for \emph{omniscient $\mathsf{COH}$}) is the following multi-valued function. \begin{itemize} \item Input/instance: A sequence $\vec{A} = (A_i : i \in \omega)$ of subsets of $\omega$. \smallskip \item Output/solution: A function $p \in 2^\omega$ such that $A^{p {\restriction} n}$ is infinite for every $n \in \omega$. \end{itemize} \medskip \item $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$ (for \emph{omniscient $\mathsf{COH}$ in $\mbf{\Delta}^0_2$}) is the following multi-valued function. \begin{itemize} \item Input/instance: A pair $\langle f, \vec{A} \rangle$, where $f$ is a $\mbf{\Delta}^0_2$-approximation to an infinite set $Z \subseteq \omega$, and $\vec{A} = (A_i : i \in \omega)$ is a sequence of subsets of $\omega$. \smallskip \item Output/solution: A function $p \in 2^\omega$ such that $Z \cap A^{p {\restriction} n}$ is infinite for every $n \in \omega$. \end{itemize} \end{itemize} \end{Definition} The intuition behind the name \emph{omniscient} $\mathsf{COH}$ is that an $\mathsf{oCOH}$-solution $p$ to an $\mathsf{oCOH}$-instance $\vec{A}$ can be used to compute an $\vec{A}$-cohesive set $C$ where, for each $i$, $C \subseteq^* \ol{A_i}$ if $p(i) = 0$ and $C \subseteq^* A_i$ if $p(i) = 1$. Thus the function $p$ is omniscient regarding the $\vec{A}$-cohesiveness of $C$ because, for each $i$, $p$ knows whether $C \subseteq^* \ol{A_i}$ or $C \subseteq^* A_i$. \begin{Definition}{\ } \begin{itemize} \item $\mathsf{INForONE}$ (for \emph{infinity or one}) is the following multi-valued function. \begin{itemize} \item Input/instance: A sequence $\vec{A} = (A_i : i \in \omega)$ of subsets of $\omega$ such that each $x \in \omega$ is in only finitely many of the $A_i$: $\forall x \exists n \forall i (i > n \rightarrow x \notin A_i)$. \smallskip \item Output/solution: An infinite $D \subseteq \omega$ such that for every $i \in \omega$, either $|D \cap A_i| = \omega$ or $|D \cap A_i| \leq 1$. \end{itemize} \medskip \item $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$ (for \emph{infinity or one in $\mbf{\Delta}^0_2$}) is the following multi-valued function. \begin{itemize} \item Input/instance: A pair $\langle f, \vec{A} \rangle$, where $f$ is a $\mbf{\Delta}^0_2$-approximation to an infinite set $Z \subseteq \omega$, and $\vec{A} = (A_i : i \in \omega)$ is a sequence of subsets of $\omega$ such that each $x \in Z$ is in only finitely many of the $A_i$: $(\forall x \in Z)(\exists n) (\forall i)(i > n \rightarrow x \notin A_i)$. \smallskip \item Output/solution: An infinite $D \subseteq Z$ such that for every $i \in \omega$, either $|D \cap A_i| = \omega$ or $|D \cap A_i| \leq 1$. \end{itemize} \medskip \item $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$ (for \emph{infinity or one almost in $\mbf{\Delta}^0_2$}) is an alternate version of $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$ where the output $D$ is only required to be an infinite $D \subseteq^* Z$, rather than an infinite $D \subseteq Z$. \end{itemize} \end{Definition} Notice how the dichotomy between \emph{infinitely many} and \emph{at most one} in solutions to the $\mathsf{INForONE}$ problem and its variants reflects the analogous dichotomy in solutions to $\mathsf{RSg}$. The strategy is to prove a sequence of lemmas showing that \begin{itemize} \item $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2 \equiv_\mathrm{W} \mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2 \equiv_\mathrm{W} \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, \smallskip \item $\npdnr{3}_2 \leq_\mathrm{sW} \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, and \smallskip \item $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2 \leq_\mathrm{sW} \mathsf{RSg}$. \end{itemize} It then follows that $\npdnr{3}_2 \leq_\mathrm{W} \mathsf{RSg}$. Out of independent interest, and for the sake of completeness, we first show that $\mathsf{INForONE} \equiv_\mathrm{W} \mathsf{oCOH}$. \begin{Proposition}\label{prop-InfOneEquivOCOH} $\mathsf{INForONE} \equiv_\mathrm{W} \mathsf{oCOH}$. \end{Proposition} \begin{proof} $\mathsf{INForONE} \leq_\mathrm{W} \mathsf{oCOH}$: Let $\vec{A} = (A_i : i \in \omega)$ be an $\mathsf{INForONE}$-instance. Let $\Phi$ be the functional given by $\Phi(\vec{A}) = \vec{B}$, where \begin{align*} B_{2i} &= A_i\\ B_{2\langle x, i \rangle + 1} &= \{k \in \omega : (\forall j \in [i,k])(x \notin A_j)\}. \end{align*} The sequence $\vec{B}$ is a valid $\mathsf{oCOH}$-instance, so let $p \in \mathsf{oCOH}(\vec{B})$. Define a functional $\Psi(\langle \vec{A}, p \rangle)$ computing a set $D$ as follows. Using $\Phi$, we may again compute $\Phi(\vec{A}) = \vec{B}$. Decompose $p$ as $p = q \oplus r$. The sequence $\vec{A}$ is assumed to be a valid $\mathsf{INForONE}$-instance, so each $x \in \omega$ is in only finitely many of the sets $A_i$. Using $r$, we can compute a bound $b \colon \omega \rightarrow \omega$ such that $\forall x (i \geq b(x) \rightarrow x \notin A_i)$. To do this, observe the following for given $x,i \in \omega$. \begin{itemize} \item If $(\exists j \geq i)(x \in A_j)$, then $B_{2\langle x,i \rangle + 1}$ is finite and $r(\langle x,i \rangle) = 0$. \smallskip \item If $(\forall j \geq i)(x \notin A_j)$, then $B_{2\langle x,i \rangle + 1}$ is co-finite and $r(\langle x,i \rangle) = 1$. \end{itemize} Thus we may compute $b$ by letting $b(x)$ be the least $i$ such that $r(\langle x,i \rangle) = 1$. To compute $D$, suppose inductively that $x_0 < x_1 < \cdots < x_{n-1}$ have already been added to $D$. Let $m = n + 1 + \max\{b(x_i) : i < n\}$. The set $A^{q {\restriction} m}$ is infinite because $q \in \mathsf{oCOH}(\vec{A})$ (which is because $q \oplus r \in \mathsf{oCOH}(\vec{B})$). So choose $x_n$ to be the least member of $A^{q {\restriction} m}\setminus \{x_i : i < n\}$, and add $x_n$ to $D$. To see that $D \in \mathsf{INForONE}(\vec{A})$, consider an $i \in \omega$. If $q(i) = 1$, then $|D \cap A_i| = \omega$ because in this case eventually every $x_n$ is chosen from $A_i$. Suppose instead that $q(i) = 0$ and that $x_n \in D \cap A_i$ for some $n$. When choosing $x_k$ for a $k > n$, we use an $m > b(x_n)$ to make the choice. Furthermore, $b(x_n) > i$ because $x_n \in A_i$. Thus $m > b(x_n) > i$, so $x_k$ is chosen from $\ol{A_i}$. This means that if $q(i) = 0$, then at most one $x_n$ can be in $D \cap A_i$. So $|D \cap A_i| \leq 1$. Therefore $D \in \mathsf{INForONE}(\vec{A})$. In fact, $D$ is also cohesive for $\vec{A}$. Thus $\Phi$ and $\Psi$ witness that $\mathsf{INForONE} \leq_\mathrm{W} \mathsf{oCOH}$. $\mathsf{oCOH} \leq_\mathrm{W} \mathsf{INForONE}$: For this argument, we make explicit the bijective encoding of binary strings as natural numbers. For $\sigma \in 2^{<\omega}$, let $\code{\sigma} \in \omega$ denote the code for $\sigma$. Let $\vec{A} = (A_i : i \in \omega)$ be an $\mathsf{oCOH}$-instance. Let $\Phi$ be the functional $\Phi(\vec{A}) = \vec{B}$, where $\vec{B} = (B_i : i \in \omega)$ is the sequence given by \begin{align*} B_{\code{\sigma}} = A^\sigma \setminus \{x : x \leq \code{\sigma}\}. \end{align*} Each $x$ is in only finitely many of the $B_i$, so $\vec{B}$ is a valid input to $\mathsf{INForONE}$. Let $D \in \mathsf{INForONE}(\vec{B})$. Define a functional $\Psi(\langle \vec{A}, D \rangle)$ computing a function $p$ as follows. Using $\Phi$, we may again compute $\Phi(\vec{A}) = \vec{B}$. The goal is to ensure that $B_{\code{p {\restriction} n}}$ is infinite for every $n$ and therefore that $A^{p {\restriction} n}$ is infinite for every $n$. To determine $p(0)$, observe that, for the strings $0$ and $1$, $B_{\code{0}} =^* A^0 = \ol{A_0}$ and $B_{\code{1}} =^* A^1 = A_0$. Thus $B_{\code{0}} \cup B_{\code{1}} =^* \omega$, and therefore either $|D \cap B_{\code{0}}| = \omega$ or $|D \cap B_{\code{1}}| = \omega$. Search $D \cap B_{\code{0}}$ and $D \cap B_{\code{1}}$ until either discovering that $|D \cap B_{\code{0}}| \geq 2$ or discovering that $|D \cap B_{\code{1}}| \geq 2$. If we first discover that $|D \cap B_{\code{0}}| \geq 2$, then in fact $|D \cap B_{\code{0}}| = \omega$ because $D \in \mathsf{INForONE}(\vec{B})$. So output $p(0) = 0$. Likewise, if we first discover that $|D \cap B_{\code{1}}| \geq 2$, then $|D \cap B_{\code{1}}| = \omega$, so output $p(0) = 1$. Now compute the rest of $p$ in the same way. Suppose inductively that we have computed $p {\restriction} n$ and that $|D \cap B_{\code{p {\restriction} n}}| = \omega$. As \begin{align*} B_{\code{p {\restriction} n}} =^* A^{p {\restriction} n} = A^{(p {\restriction} n)^\smallfrown 0} \cup A^{(p {\restriction} n)^\smallfrown 1} =^* B_{\code{(p {\restriction} n)^\smallfrown 0}} \cup B_{\code{(p {\restriction} n)^\smallfrown 1}}, \end{align*} it must be that either $|D \cap B_{\code{(p {\restriction} n)^\smallfrown 0}}| = \omega$ or $|D \cap B_{\code{(p {\restriction} n)^\smallfrown 1}}| = \omega$. As before, search $D \cap B_{\code{(p {\restriction} n)^\smallfrown 0}}$ and $D \cap B_{\code{(p {\restriction} n)^\smallfrown 1}}$ until discovering that $|D \cap B_{\code{(p {\restriction} n)^\smallfrown 0}}| \geq 2$ or that $|D \cap B_{\code{(p {\restriction} n)^\smallfrown 1}}| \geq 2$. If we first discover that $|D \cap B_{\code{(p {\restriction} n)^\smallfrown 0}}| \geq 2$, then $|D \cap B_{\code{(p {\restriction} n)^\smallfrown 0}}| = \omega$, so output $p(n) = 0$. If we first discover that $|D \cap B_{\code{(p {\restriction} n)^\smallfrown 1}}| \geq 2$, then $|D \cap B_{\code{(p {\restriction} n)^\smallfrown 1}}| = \omega$, so output $p(n) = 1$. In the end, $D \cap B_{\code{p {\restriction} n}}$ is infinite for every $n$, so $B_{\code{p {\restriction} n}}$ is infinite for every $n$, so $A^{p {\restriction} n}$ is infinite for every $n$. Thus $p \in \mathsf{oCOH}(\vec{A})$, so $\Phi$ and $\Psi$ witness that $\mathsf{oCOH} \leq_\mathrm{W} \mathsf{INForONE}$. \end{proof} \begin{Lemma}\label{lem-INFONEDequivOCOHD} $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2 \equiv_\mathrm{W} \mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2 \equiv_\mathrm{W} \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$. \end{Lemma} \begin{proof} We show that \begin{align*} \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2 \leq_\mathrm{W} \mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2 \leq_\mathrm{sW} \mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2 \leq_\mathrm{W} \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2. \end{align*} Notice that the middle $\leq_\mathrm{sW}$-reduction is trivial. $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2 \leq_\mathrm{W} \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$: Let $\langle f, \vec{A} \rangle$ be an $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$-instance. The proof is the same as that of the $\mathsf{INForONE} \leq_\mathrm{W} \mathsf{oCOH}$ direction Proposition~\ref{prop-InfOneEquivOCOH}, except now we must also use $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$ to compute the set $Z$ approximated by $f$. Let $\Phi$ be the functional given by $\Phi(\langle f, \vec{A} \rangle) = \langle f, \vec{B} \rangle$, where \begin{align*} B_{3i} &= A_i\\ B_{3\langle x, i \rangle + 1} &= \{k \in \omega : (\forall j \in [i,k])(x \notin A_j)\}\\ B_{3x + 2} &= \{s \in \omega : f(x,s)=1\}. \end{align*} The pair $\langle f, \vec{B} \rangle$ is a valid $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$-instance, so let $p \in \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2(\langle f, \vec{B} \rangle)$. Define a functional $\Psi(\langle \langle f, \vec{A} \rangle, p \rangle)$ computing a set $D$ as follows. Using $\Phi$, we may again compute $\Phi(\langle f, \vec{A} \rangle) = \langle f, \vec{B} \rangle$. Decompose $p$ into functions $q,r,h \colon \omega \rightarrow \omega$ by letting \begin{align*} q(n) = p(3n) && r(n) = p(3n+1) && h(n) = p(3n+2) && \end{align*} for each $n \in \omega$. As $\langle f, \vec{A} \rangle$ is a valid $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$-instance, the function $f$ is a $\mbf{\Delta}^0_2$-approximation to an infinite set $Z$. We have that $h$ is the characteristic function of $Z$. To see this, observe the following for a given $x \in \omega$. \begin{itemize} \item If $\lim_s f(x,s) = 0$, then $B_{3x+2}$ is finite, so $h(x) = 0$. \smallskip \item If $\lim_s f(x,s) = 1$, then $B_{3x+2}$ is co-finite, so $h(x)=1$. \end{itemize} Now proceed as in the proof of Proposition~\ref{prop-InfOneEquivOCOH}. By assumption, each $x \in Z$ is in at most finitely many of the sets $A_i$, so the function $r$ computes a bound $b \colon Z \rightarrow \omega$ such that $(\forall x \in Z)(i \geq b(x) \rightarrow x \notin A_i)$ as before. To compute $D$, suppose inductively that the numbers $x_0 < x_1 < \cdots < x_{n-1}$ in $Z$ have already been added to $D$. Let $m = n + 1 + \max\{b(x_i) : i < n\}$. The set $Z \cap A^{q {\restriction} m}$ is infinite, so choose $x_n$ to be the least member of $(Z \cap A^{q {\restriction} m})\setminus \{x_i : i < n\}$, and add $x_n$ to $D$. The result is that $D \in \mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2(\langle f, \vec{A} \rangle)$, so $\Phi$ and $\Psi$ witness that $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2 \leq_\mathrm{W} \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$. $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2 \leq_\mathrm{W} \mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$: The proof is the same as that of the $\mathsf{oCOH} \leq_\mathrm{W} \mathsf{INForONE}$ direction of Proposition~\ref{prop-InfOneEquivOCOH}. Again, let $\code{\sigma} \in \omega$ denote the number coding the string $\sigma \in 2^{<\omega}$. Let $\langle f, \vec{A} \rangle$ be an $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$-instance. Let $\Phi$ be the functional $\Phi(\langle f, \vec{A} \rangle) = \langle f, \vec{B} \rangle$, where $\vec{B} = (B_i : i \in \omega)$ is the sequence given by $B_{\code{\sigma}} = A^\sigma \setminus \{x : x \leq \code{\sigma}\}$. Then $\langle f, \vec{B} \rangle$ is a valid $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$-instance, so let $D \in \mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2(\langle f, \vec{B} \rangle)$. Let $\Psi(\langle \langle f, \vec{A} \rangle, D \rangle)$ be the functional computing a function $p$ by the same procedure as in the proof of Proposition~\ref{prop-InfOneEquivOCOH}. As $D \in \mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2(\langle f, \vec{B} \rangle)$, we have that $D \subseteq^* Z$, where $Z$ is the set approximated by $f$. The function $p$ has the property that $D \cap B_{\code{p {\restriction} n}}$ is infinite for every $n$, hence also $Z \cap B_{\code{p {\restriction} n}}$ is infinite for every $n$ because $D \subseteq^* Z$. Therefore $Z \cap A^{p {\restriction} n}$ is infinite for every $n$, so $p \in \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2(\langle f, \vec{A} \rangle)$. Thus $\Phi$ and $\Psi$ witness that $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2 \leq_\mathrm{W} \mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$. \end{proof} \begin{Lemma}\label{lem-3DNR2redOCOHD} $\npdnr{3}_2 \leq_\mathrm{sW} \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$. \end{Lemma} \begin{proof} Let $p$ be an input to $\npdnr{3}_2$. Define a functional $\Phi(p) = \langle f, \vec{A} \rangle$ as follows. The function $f$ is a $\mbf{\Delta}^0_2$-approximation to the set \begin{align*} Z = \Bigl\{\sigma \in 2^{<\omega} : \bigl(\forall e < |\sigma|\bigr)\bigl[(\Phi_{e,|\sigma|}(p')(e){\uparrow} \rightarrow \sigma(e) = 0) \wedge (\Phi_{e,|\sigma|}(p')(e){\downarrow} \rightarrow \sigma(e) = 1)\bigr]\Bigr\} \end{align*} of $p'$-approximations to $p''$. To compute $f$, for each $s \in \omega$, let $\tau_s \in 2^s$ denote the $p$-approximation to $p'$ where \begin{align*} \bigl(\forall e < s\bigr)\bigl[(\Phi_{e,s}(p)(e){\uparrow} \rightarrow \tau_s(e) = 0) \wedge (\Phi_{e,s}(p)(e){\downarrow} \rightarrow \tau_s(e) = 1)\bigr]. \end{align*} Now, for $\sigma \in 2^{<\omega}$ and $s \in \omega$, define $f(\sigma, s) = 1$ if \begin{align*} \bigl(\forall e < |\sigma|\bigr)\bigl[(\Phi_{e,\min\{|\sigma|,s\}}(\tau_s)(e){\uparrow} \rightarrow \sigma(e) = 0) \wedge (\Phi_{e,\min\{|\sigma|,s\}}(\tau_s)(e){\downarrow} \rightarrow \sigma(e) = 1)\bigr], \end{align*} and define $f(\sigma, s) = 0$ otherwise. Define $\vec{A} = (A_i : i \in \omega)$ by $A_e = \{\sigma \in 2^{<\omega} : \Phi_{e,|\sigma|}(\sigma)(e){\downarrow} = 0\}$. The pair $\langle f, \vec{A} \rangle$ is a valid $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$-instance, so let $g \in \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2(\langle f, \vec{A} \rangle)$. Let $\Psi$ be the identity functional. We show that $g$ is $\mathrm{DNR}_2$ relative to $p''$. Suppose that $\Phi_e(p'')(e){\downarrow} = 0$, and let $\alpha \subseteq p''$ be long enough so that $\Phi_{e,|\alpha|}(\alpha)(e){\downarrow} = 0$. All but finitely many strings in $Z$ extend $\alpha$, so $Z \subseteq^* A_e$. It must therefore be that $g(e) = 1$ because $Z \cap \ol{A_e}$ is finite. Now suppose instead that $\Phi_e(p'')(e){\downarrow} = n$ for some $n > 0$. Reasoning as before, we conclude that all but finitely many of the $\sigma \in Z$ satisfy $\Phi_{e,|\sigma|}(\sigma)(e){\downarrow} = n$. Therefore $Z \cap A_e$ is finite, so $g(e) = 0$. We have shown that \begin{align*} \forall e\bigl[(\Phi_e(p'')(e){\downarrow} = 0 \rightarrow g(e) = 1) \wedge (\Phi_e(p'')(e){\downarrow} > 0 \rightarrow g(e) = 0)\bigr]. \end{align*} Therefore $g \in \npdnr{3}_2(p)$, so $\Phi$ and $\Psi$ witness that $\npdnr{3}_2 \leq_\mathrm{sW} \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$. \end{proof} \begin{Lemma}\label{lem-INFONESDredRSG} $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2 \leq_\mathrm{sW} \mathsf{RSg}$. \end{Lemma} \begin{proof} Ahead of time, recursively partition $\omega$ into three sets $\omega = W \cup X \cup Y$, and write $W = \{w_i : i \in \omega\}$, $X = \{x_i : i \in \omega\}$, and $Y = \{y_i : i \in \omega\}$. For example, we may take $w_i = 3i$, $x_i = 3i+1$, and $y_i = 3i+2$ for each $i$. Let $\langle f, \vec{A} \rangle$ be an $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$-instance. Define a functional $\Phi(\langle f, \vec{A} \rangle)$ computing the graph $G = (V,E)$ where $V = \omega = W \cup X \cup Y$ and \begin{align*} E = &\{(w_i, y_j) \in W \times Y : j < i\}\\ &\cup \{(w_i, x_n) \in W \times X : i < n\}\\ &\cup \{(x_n, y_i) \in X \times Y : n \in A_i\}\\ &\cup \{(x_n, x_s) \in X \times X : (n < s) \wedge (f(n,s) = 0)\}. \end{align*} The graph $G$ is a valid $\mathsf{RSg}$-instance, so let $H$ be an $\mathsf{RSg}$-solution to $G$. Let $\Psi$ be the functional $\Psi(H) = D$, where $D = \{n \in \omega : x_n \in H\}$. We show that $D \in \mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2(\langle f, \vec{A} \rangle)$. Let $Z = \lim f$. We show that if $n \in Z$, then $x_n$ has only finitely many neighbors. Clearly $x_n$ has only finitely many neighbors in $W$. Among the vertices of $Y$, $(x_n, y_i) \in E$ if and only if $n \in A_i$. The pair $\langle f, \vec{A} \rangle$ is assumed to be a valid $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$-instance, and $n \in Z$, which means that $n$ is in only finitely many of the $A_i$. Thus $x_n$ has only finitely many neighbors in $Y$. Among the vertices of $X$, we know that if $s$ is sufficiently large, then $(x_n, x_s) \notin E$. This is because $\lim_s f(n,s) = 1$ (as $n \in Z$), but for $s > n$, $(x_n, x_s) \in E$ if and only if $f(n,s) = 0$. Thus $x_n$ has only finitely many neighbors in $X$. Thus if $n \in Z$, then $x_n$ has only finitely many neighbors. Now we show that $H \cap X$ is infinite and therefore that $D$ is infinite. To do this, we first show that $|H \cap W| \leq 1$. Suppose for a contradiction that $i < j$ are such that $w_i, w_j \in H$. $Z$ is infinite, so let $n > j$ be such that $n \in Z$. Then $x_n$ has at least the two neighbors $w_i$ and $w_j$ in $H$. However, $x_n$ cannot have infinitely many neighbors in $H$ because $x_n$ has only finitely many neighbors in $V$. This is a contradiction, so $|H \cap W| \leq 1$. Therefore $H \subseteq^* X \cup Y$. If $|H \cap Y| \leq 2$, then $H \subseteq^* X$, so $H \cap X$ is infinite. Suppose instead that $|H \cap Y| \geq 2$ and that $i < j$ are such that $y_i, y_j \in H$. Let $k > j$. Then $w_k$ has at least the two neighbors $y_i$ and $y_j$ in $H$, so $w_k$ must have infinitely many neighbors in $H$. Vertex $w_k$ has only finitely many neighbors in $Y$ and no neighbors in $W$, so $w_k$ must have infinitely many neighbors in $H \cap X$. Therefore $H \cap X$ is infinite in this case as well. Now we show that $|H \cap \{x_n : n \notin Z\}| \leq 1$ and therefore that $D \subseteq^* Z$. Suppose for a contradiction that $m < n$ are such that $x_m, x_n \in H$, but also $m, n \notin Z$. Let $s_0 > n$ be large enough so that $f(m,s) = f(n,s) = 0$ for all $s > s_0$, and, as $Z$ is infinite, let $s > s_0$ be such that $s \in Z$. Then $x_s$ is adjacent to both $x_m$ and $x_n$, so $x_s$ has at least two neighbors in $H$. However, $x_s$ cannot have infinitely many neighbors in $H$ because $s \in Z$, which means that $x_s$ has only finitely many neighbors all together. This is a contradiction, so $|H \cap \{x_n : n \notin Z\}| \leq 1$. We have shown that $D$ is infinite and that $D \subseteq^* Z$. To finish the proof, we show that, for every $i \in \omega$, either $|D \cap A_i| = \omega$ or $|D \cap A_i| \leq 1$. Consider an $i \in \omega$, suppose that $|D \cap A_i| \geq 2$, and let $m < n$ be such that $m,n \in D \cap A_i$. Then $x_m, x_n \in H$ and $y_i$ is adjacent to both $x_m$ and $x_n$. Therefore $y_i$ has infinitely many neighbors in $H$, almost all of which are in $X$ because $|H \cap W| \leq 1$ and $y_i$ has no neighbors in $Y$. That is, $N(y_i) \cap X \cap H$ is infinite. This means that $D \cap A_i$ is infinite, as desired. Therefore $D \in \mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2(\langle f, \vec{A} \rangle)$, so $\Phi$ and $\Psi$ witness that $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2 \leq_\mathrm{sW} \mathsf{RSg}$. \end{proof} \begin{Theorem}\label{thm-RSGequivWKLjj} The following multi-valued functions are pairwise Weihrauch equivalent: $\mathsf{WKL}''$, $\mathsf{RSg}$, $\mathsf{RSgr}$, $\npdnr{3}_2$, $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, and $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$. In particular, \begin{align*} \mathsf{WKL}'' \equiv_\mathrm{W} \mathsf{RSg} \equiv_\mathrm{W} \mathsf{RSgr}. \end{align*} \end{Theorem} \begin{proof} We have that \begin{align*} \mathsf{RSg} &\leq_\mathrm{sW} \mathsf{RSgr}\\ &\leq_\mathrm{sW} \npdnr{3}_2 & &\text{by Lemma~\ref{lem-RSGRred3DNR2}}\\ &\leq_\mathrm{sW} \mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2 & &\text{by Lemma~\ref{lem-3DNR2redOCOHD}}\\ &\equiv_\mathrm{W} \mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2 \equiv_\mathrm{W} \mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2 & & \text{by Lemma~\ref{lem-INFONEDequivOCOHD}}\\ &\leq_\mathrm{sW} \mathsf{RSg} & &\text{by Lemma~\ref{lem-INFONESDredRSG}} \end{align*} and that $\mathsf{WKL}'' \equiv_\mathrm{sW} \npdnr{3}_2$ by Lemma~\ref{lem-WKLequivDNR2}. \end{proof} The Weihrauch equivalences of Theorem~\ref{thm-RSGequivWKLjj} can be improved to strong Weihrauch equivalences by noticing that the multi-valued functions involved are all cylinders. It fact, it suffices to show that $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, and $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$ are cylinders, from which it follows that the Weihrauch equivalences of Lemma~\ref{lem-INFONEDequivOCOHD} can be improved to strong Weihrauch equivalences. \begin{Lemma}\label{lem-CylinderHelp} The following multi-valued functions are cylinders:\\ $\mathsf{oCOH}$, $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, and $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$. \end{Lemma} \begin{proof} For $\mathsf{oCOH}$, convert a given $g \in \omega^\omega$ and $\mathsf{oCOH}$-instance $\vec{A}$ into the $\mathsf{oCOH}$-instance $\vec{B}$ where \begin{align*} B_{2i} &= A_i\\ B_{2\langle m, n \rangle + 1} &= \begin{cases} \omega & \text{if $g(m) = n$}\\ \emptyset & \text{if $g(m) \neq n$.} \end{cases} \end{align*} Let $p$ be an $\mathsf{oCOH}$-solution to $\vec{B}$, and decompose $p$ as $p = q \oplus r$. Then $q$ is an $\mathsf{oCOH}$-solution to $\vec{A}$, and $g$ can be uniformly computed from $r$ because for each $m$, $g(m)$ is the unique $n$ such that $r(\langle m, n \rangle) = 1$. A similar argument shows that $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$ is a cylinder. \begin{sloppypar} For $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, convert a given $g \in \omega^\omega$ and $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$-instance $\langle f, \vec{A} \rangle$ into the $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$-instance $\langle h, \vec{B} \rangle$, where $h \colon \omega^{<\omega} \times \omega \rightarrow 2$ given by \end{sloppypar} \begin{align*} h(\sigma, s) = \begin{cases} f(|\sigma|, s) & \text{if $\sigma \subseteq g$}\\ 0 & \text{if $\sigma \nsubseteq g$} \end{cases} \end{align*} is a $\mbf{\Delta}^0_2$-approximation to $\{g {\restriction} n : n \in \lim f\}$, and $B_i = \{g {\restriction} n : n \in A_i\}$. Let $D \in \mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2(\langle h, \vec{B} \rangle)$. $D$ uniformly computes $g$ because $D$ is an infinite subset of $\{g {\restriction} n : n \in \omega\}$. $D$ therefore also uniformly computes the set $\{n : g {\restriction} n \in D\}$, which is an $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$-solution to $\langle f, \vec{A} \rangle$. Showing that $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$ is a cylinder is slightly more complicated. Convert a given $g \in \omega^\omega$ and $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$-instance $\langle f, \vec{A} \rangle$ into the $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$-instance $\langle h, \vec{B} \rangle$, where $h$ is the $\mbf{\Delta}^0_2$-approximation to $\{g {\restriction} n : n \in \lim f\}$ as above, and $\vec{B}$ is given by \begin{align*} B_{2i} &= \{g {\restriction} n : n \in A_i\}\\ B_{2\sigma + 1} &= \{\tau : \sigma \subseteq \tau\}. \end{align*} Each $\tau$ is in at most finitely many sets of the form $B_{2i}$ because $\langle f, \vec{A} \rangle$ is an $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$-instance, and each $\tau$ is in at most finitely many sets of the form $B_{2\sigma +1}$ because $\tau \in B_{2\sigma+1}$ if and only if $\sigma \subseteq \tau$. Thus $\langle h, \vec{B} \rangle$ is indeed a $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$-instance. Let $D \in \mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2(\langle h, \vec{B} \rangle)$. If $\sigma$ and $\tau$ are two elements of $D$ with $\sigma \subsetneq \tau$, then $\sigma \subseteq g$. To see this, suppose that $\sigma, \tau \in D$ and $\sigma \subsetneq \tau$. Then $|D \cap B_{2\sigma+1}| \geq 2$, so $|D \cap B_{2\sigma+1}| = \omega$. However, $D \subseteq^* \{g {\restriction} n : n \in \omega\}$, so if $\sigma \nsubseteq g$, then $D \cap B_{2\sigma+1}$ would be finite. Thus it must be that $\sigma \subseteq g$. $D$ therefore uniformly computes $g$ by the following procedure. Given $n$, search for $\sigma, \tau \in D$ with $|\sigma| > n$ and $\sigma \subsetneq \tau$, and output $\sigma(n)$. Since $D$ uniformly computes $g$, $D$ therefore also uniformly computes the set $\{n : g {\restriction} n \in D\}$, which is an $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$-solution to $\langle f, \vec{A} \rangle$ as in the $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$ case. \end{proof} \begin{Corollary}\label{cor-SWequiv} The following multi-valued functions are pairwise strongly Weihrauch equivalent: $\mathsf{WKL}''$, $\mathsf{RSg}$, $\mathsf{RSgr}$, $\npdnr{3}_2$, $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, and $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$. In particular, \begin{align*} \mathsf{WKL}'' \equiv_\mathrm{sW} \mathsf{RSg} \equiv_\mathrm{sW} \mathsf{RSgr}. \end{align*} \end{Corollary} \begin{proof} In the proof of Theorem~\ref{thm-RSGequivWKLjj}, the Weihrauch equivalences of Lemma~\ref{lem-INFONEDequivOCOHD} can be improved to strong Weihrauch equivalences because $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, and $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$ are cylinders by Lemma~\ref{lem-CylinderHelp}. \end{proof} We end this section with a number of remarks and observations about its results. First, it follows from Corollary~\ref{cor-SWequiv} that $\mathsf{WKL}''$, $\npdnr{3}_2$, $\mathsf{RSg}$, and $\mathsf{RSgr}$ are all cylinders because they are all strongly Weihrauch equivalent to $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$. It is well-known, and easy to show directly, that $\mathsf{WKL}$ and its jumps are cylinders (see~\cites{BrattkaGherardi, BrattkaGherardiMarcone}). A proof that each $\npdnr{n}_2$ is a cylinder is also implicit in the proof of Lemma~\ref{lem-RSGRred3DNR2}. Direct proofs that $\mathsf{RSg}$ and $\mathsf{RSgr}$ are cylinders can be given using the method of Proposition~\ref{prop-wRSgCyl}. On the other hand, the multi-valued function $\mathsf{INForONE}$ is not a cylinder, which can be seen by observing that every pair of $\mathsf{INForONE}$ instances has a common solution. Second, it is possible to short-circuit the proof that $\npdnr{3}_2 \leq_\mathrm{W} \mathsf{RSg}$ by considering the multi-valued function $\mc{F}$ which is defined in the same way as $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$, except that the output is restricted to sets $D$ with $|D \setminus Z| \leq 1$ instead of with $D \subseteq^* Z$. The proof of Lemma~\ref{lem-INFONESDredRSG} already shows that $\mc{F} \leq_\mathrm{sW} \mathsf{RSg}$, and one may show that $\npdnr{3}_2 \leq_\mathrm{W} \mc{F}$ by a proof similar to that of Lemma~\ref{lem-3DNR2redOCOHD}. However, we find that $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$ and $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$ are more natural problems than $\mc{F}$ and also that the equivalence with $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$ is worth establishing. We hope that the equivalence among $\mathsf{WKL}''$, $\mathsf{oCOH\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, $\mathsf{INForONE\mbox{-}in\mbox{-}}\mathbf{\Delta}^0_2$, and $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2$ will be helpful in future research. Similarly, using the techniques of this section, one may also show that $\mathsf{oCOH} \equiv_\mathrm{sW} \mathsf{WKL}'$ and therefore that $\mathsf{WKL}' \equiv_\mathrm{W} \mathsf{INForONE} \equiv_\mathrm{W} \mathsf{oCOH}$. Third, one may wish to consider the versions of $\mathsf{RSg}$ and $\mathsf{RSgr}$ obtained by restricting the inputs to graphs with $V = \omega$. Denote these restrictions by $\mathsf{RSg} {\restriction}_{V = \omega}$ and $\mathsf{RSgr} {\restriction}_{V = \omega}$. It is straightforward to show that $\mathsf{RSg} {\restriction}_{V = \omega} \equiv_\mathrm{W} \mathsf{RSg}$, that $\mathsf{RSgr} {\restriction}_{V = \omega} \equiv_\mathrm{W} \mathsf{RSgr}$, and therefore that all four multi-valued functions are pairwise Weihrauch equivalent. Notice, however, that the strong Weihrauch reduction of Lemma~\ref{lem-INFONESDredRSG} builds a graph with $V = \omega$ and thus shows that $\mathsf{INForONE\mbox{-}in}^*\mathsf{\mbox{-}}\mathbf{\Delta}^0_2 \leq_\mathrm{sW} \mathsf{RSg} {\restriction}_{V = \omega}$. Therefore $\mathsf{RSg} \leq_\mathrm{sW} \mathsf{RSg} {\restriction}_{V = \omega} \leq_\mathrm{sW} \mathsf{RSgr} {\restriction}_{V = \omega} \leq_\mathrm{sW} \mathsf{RSgr} \equiv_\mathrm{sW} \mathsf{RSg}$, hence all four multi-valued functions are in fact strongly Weihrauch equivalent. Fourth, for a multi-valued function $\mc{F} \colon \!\!\subseteq\! \omega^\omega \rightrightarrows \omega^\omega$, the \emph{parallelization} of $\mc{F}$ is the multi-valued function corresponding to the problem of solving countably many $\mc{F}$-instances simultaneously in parallel. \begin{Definition} Let $\mc{F} \colon \!\!\subseteq\! \omega^\omega \rightrightarrows \omega^\omega$ be a multi-valued function. The \emph{parallelization} $\wh{\mc{F}}$ of $\mc{F}$ is the following multi-valued function. \begin{itemize} \item Input/instance: A sequence $(f_i : i \in \omega)$ with $f_i \in \dom(\mc{F})$ for each $i \in \omega$. \smallskip \item Output/solution: A sequence $(g_i : i \in \omega)$ with $g_i \in \mc{F}(f_i)$ for each $i \in \omega$. \end{itemize} \end{Definition} We have that $\wh{\mathsf{RT}^2_2} \equiv_\mathrm{W} \mathsf{WKL}''$ by \cite{BrattkaRakotoniaina}*{Corollary~4.18}, so $\mathsf{RSg}$ and $\mathsf{RSgr}$ are Weihrauch equivalent to $\wh{\mathsf{RT}^2_2}$ by Theorem~\ref{thm-RSGequivWKLjj}. Hence the relationship between the computational strength of $\mathsf{RSg}$ and $\mathsf{RT}^2_2$ can be summarized thusly. The computational strength required to solve one $\mathsf{RSg}$-instance exactly corresponds to the strength required to solve countably many $\mathsf{RT}^2_2$-instances simultaneously in parallel. Fifth, let $\mathsf{RSg} {\restriction}_{\mathrm{LF}}$ and $\mathsf{RSgr} {\restriction}_{\mathrm{LF}}$ denote the restrictions of $\mathsf{RSg}$ and $\mathsf{RSgr}$ to infinite locally finite graphs. Then $\mathsf{RSg} {\restriction}_{\mathrm{LF}} \equiv_\mathrm{sW} \mathsf{RSgr} {\restriction}_{\mathrm{LF}} \equiv_\mathrm{sW} \lim$. In fact, the proof that $\mathsf{RSg} {\restriction}_{\mathrm{LF}}$ is equivalent to $\mathsf{ACA}_0$ over $\mathsf{RCA}_0$ essentially establishes a Weihrauch equivalence between $\mathsf{RSg} {\restriction}_{\mathrm{LF}}$ and $\lim$. This gives precise meaning to the introduction's claim that the reversal of $\mathsf{RSg}$ in Theorem~\ref{thm-ACA_RS_eq} does not use the full computational strength of $\mathsf{RSg}$. The reversal considers only locally finite graphs, thereby establishing that $\mathsf{RCA}_0 + \mathsf{RSg} {\restriction}_{\mathrm{LF}} \vdash \mathsf{ACA}_0$. However, $\mathsf{RSg} {\restriction}_{\mathrm{LF}} <_\mathrm{c} \mathsf{RSg}$ because $\mathsf{RSg} {\restriction}_{\mathrm{LF}} \equiv_\mathrm{sW} \lim <_\mathrm{c} \mathsf{WKL}'' \equiv_\mathrm{sW} \mathsf{RSg}$. \begin{Proposition}\label{prop-RSgLF} $\mathsf{RSg} {\restriction}_{\mathrm{LF}} \equiv_\mathrm{sW} \mathsf{RSgr} {\restriction}_{\mathrm{LF}} \equiv_\mathrm{sW} \lim$. \end{Proposition} \begin{proof} It suffices to show that $\mathsf{RSgr} {\restriction}_{\mathrm{LF}} \leq_\mathrm{W} \lim$ and that $\lim \leq_\mathrm{W} \mathsf{RSg} {\restriction}_{\mathrm{LF}}$ because all three problems are cylinders (which can be shown for $\mathsf{RSg} {\restriction}_{\mathrm{LF}}$ and $\mathsf{RSgr} {\restriction}_{\mathrm{LF}}$ by the method of Proposition~\ref{prop-wRSgCyl}). For $\mathsf{RSgr} {\restriction}_{\mathrm{LF}} \leq_\mathrm{W} \lim$, let $G = (V, E)$ be an infinite locally finite graph. Use $\lim$ to compute the function $b \colon V \rightarrow \mathcal{P}_\mathrm{f}(V)$ where $b(x) = N(x)$ for all $x \in V$. Then compute an $\mathsf{RSg}$-solution to $G$ by the same procedure as in the proof of Proposition~\ref{prop-RSgHighRec}. For $\lim \leq_\mathrm{W} \mathsf{RSg} {\restriction}_{\mathrm{LF}}$, we use that $\lim$ is strongly Weihrauch equivalent to the Turing jump function $\mathsf{J} \colon \omega^\omega \rightarrow \omega^\omega$ given by $\mathsf{J}(p) = p'$ (see, for example, \cite{BrattkaGherardiPaulySurvey}*{Theorem~6.7}). Given $p$, uniformly compute an injection $f \colon \omega \rightarrow \omega$ with $\ran(f) = p'$. Then proceed exactly as in the proof of the reversal in Theorem~\ref{thm-ACA_RS_eq}. \end{proof} If we insist on the restrictions of $\mathsf{RSg}$ and $\mathsf{RSgr}$ to locally finite graphs with $V = \omega$, then the resulting problems are not cylinders (because every pair of instances has a common solution). In this case, we obtain $\equiv_\mathrm{W}$ in place of $\equiv_\mathrm{sW}$ in the above proposition. Sixth, we may conclude from Corollary~\ref{cor-SWequiv} that $\mathsf{RSg}$ and $\mathsf{RSgr}$ have \emph{universal instances}. $\mathsf{RT}^2_2$, on the other hand, does not have universal instances~\cite{MiletiThesis}*{Corollary~5.4.8}. \begin{Definition} Let $\mc{F} \colon \!\!\subseteq\! \omega^\omega \rightrightarrows \omega^\omega$ be a multi-valued function, thought of as a mathematical problem. A \emph{universal instance} of $\mc{F}$ is a recursive $\mc{F}$-instance $f_*$ with the property that if $g_*$ is any $\mc{F}$-solution to $f_*$ and $f$ is any recursive $\mc{F}$-instance, then there is a $\mc{F}$-solution $g$ to $f$ with $g \leq_\mathrm{T} g_*$. \end{Definition} \begin{Corollary} $\mathsf{RSg}$ and $\mathsf{RSgr}$ have universal instances. \end{Corollary} \begin{proof} We show that $\mathsf{RSg}$ has a universal instance. The argument for $\mathsf{RSgr}$ is similar. By Corollary~\ref{cor-SWequiv}, let $\Phi$ and $\Psi$ be functionals witnessing that $\npdnr{3}_2 \leq_\mathrm{sW} \mathsf{RSg}$, and let $\wh{\Phi}$ and $\wh{\Psi}$ be functionals witnessing that $\mathsf{RSg} \leq_\mathrm{sW} \npdnr{3}_2$. Let $0$ denote the the function with constant value $0$, and let $G_* = \Phi(0)$. The function $0$ is a valid $\npdnr{3}_2$-instance, so $G_*$ is a valid $\mathsf{RSg}$-instance. We show that $G_*$ is universal. First, $G_*$ is recursive because $0$ is recursive. Now, let $H_*$ be any $\mathsf{RSg}$-solution to $G_*$, and let $G$ be any recursive $\mathsf{RSg}$-instance. Let $p = \wh{\Phi}(G)$, which is recursive and therefore satisfies $p'' \equiv_\mathrm{T} 0''$. Let $f_* = \Psi(H_*)$, which is $\mathrm{DNR}_2$ relative to $0''$ and therefore computes a function $f$ that is $\mathrm{DNR}_2$ relative to $p''$. This $f$ is a $\npdnr{3}_2$-solution to $p$, so $\wh{\Psi}(f)$ is an $\mathsf{RSg}$-solution to $G$. We have that $\wh{\Psi}(f) \leq_\mathrm{T} f \leq_\mathrm{T} f_* \leq_\mathrm{T} H_*$, so $H_*$ computes an $\mathsf{RSg}$-solution to $G$. \end{proof} More generally, one may show that if $\mc{F}$ and $\mc{G}$ are Weihrauch equivalent problems and $\mc{F}$ has a universal instance, then so does $\mc{G}$. The Weihrauch equivalence between $\mathsf{RSg}$ and $\mathsf{WKL}''$ also yields the following degree-theoretic corollary. \begin{Corollary} Let $\mbf{a}$ be any Turing degree. A Turing degree $\mbf{b}$ computes solutions to every $\mathsf{RSg}$-instance $G \leq_\mathrm{T} \mbf{a}$ if and only if $\mbf{b}$ is $\mathrm{PA}$ relative to $\mbf{a}''$. The statement also holds with $\mathsf{RSgr}$ in place of $\mathsf{RSg}$. \end{Corollary} \section{The weak Rival--Sands theorem in the Weihrauch degrees and the computable degrees}\label{sec-wRSgWeihrauch} In this section, we compare the Weihrauch degree and the computable degree of the weak Rival--Sands theorem to those of $\mathsf{RT}^2_2$, its consequences, and other familiar benchmarks. The general theme is that although $\mathsf{wRSg}$ and $\mathsf{RT}^2_2$ are equivalent over $\mathsf{RCA}_0$, $\mathsf{wRSg}$ is much weaker than $\mathsf{RT}^2_2$ in the Weihrauch degrees and in the computable degrees. This justifies our description of $\mathsf{wRSg}$ as a weaker formalization of $\mathsf{RT}^2_2$. Multi-valued functions corresponding to the weak Rival--Sands theorem and its refined version are defined as follows. \begin{Definition}{\ } \begin{itemize} \item $\mathsf{wRSg}$ is the following multi-valued function. \begin{itemize} \item Input/instance: An infinite graph $G = (V,E)$. \smallskip \item Output/solution: An infinite $H \subseteq V$ such that, for all $v \in H$, either $|H \cap N(v)| = \omega$ or $|H \cap N(v)| \leq 1$. \end{itemize} \medskip \item $\mathsf{wRSgr}$ is the following multi-valued function. \begin{itemize} \item Input/instance: An infinite graph $G = (V,E)$. \smallskip \item Output/solution: An infinite $H \subseteq V$ such that for all $v \in H$, either $|H \cap N(v)| = \omega$ or $|H \cap N(v)| = 0$. \end{itemize} \end{itemize} \end{Definition} Clearly $\mathsf{wRSg} \leq_\mathrm{sW} \mathsf{wRSgr}$ because given a graph $G$, every $\mathsf{wRSgr}$-solution to $G$ is also a $\mathsf{wRSg}$-solution to $G$. We do not know if this reduction reverses. That is, we do not know if $\mathsf{wRSgr} \leq_\mathrm{W} \mathsf{wRSg}$. We do however show that $\mathsf{wRSgr} \leq_\mathrm{c} \mathsf{wRSg}$ in Proposition~\ref{prop-WRSGRredWRSG} below. One may also wish to consider the restrictions $\mathsf{wRSg} {\restriction}_{V = \omega}$ and $\mathsf{wRSgr} {\restriction}_{V = \omega}$ of $\mathsf{wRSg}$ and $\mathsf{wRSgr}$ to input graphs with $V = \omega$. In the case of $\mathsf{RSg}$, the restriction makes no difference. In the case of $\mathsf{wRSg}$, the difference between $\mathsf{wRSg} {\restriction}_{V = \omega}$ and $\mathsf{wRSg}$ reflects the difference between $\leq_\mathrm{sW}$ and $\leq_\mathrm{W}$. The problem $\mathsf{wRSg}{\restriction}_{V = \omega}$ is not a cylinder, and $\mathsf{wRSg}$ is its cylindrification. Thus $\mathsf{wRSg}{\restriction}_{V = \omega} \equiv_\mathrm{W} \mathsf{wRSg}$, but $\mathsf{wRSg}{\restriction}_{V = \omega} <_\mathrm{sW} \mathsf{wRSg}$. The same comments apply to $\mathsf{wRSgr}$. \begin{Proposition}\label{prop-wRSgCyl}{\ } \begin{enumerate} \item\label{it-notCyl} $\mathsf{wRSg}{\restriction}_{V = \omega}$ and $\mathsf{wRSgr}{\restriction}_{V = \omega}$ are not cylinders. \smallskip \item\label{it-cylify} $\mathsf{wRSg} \equiv_\mathrm{sW} \mathsf{id} \times \mathsf{wRSg}{\restriction}_{V = \omega}$ and $\mathsf{wRSgr} \equiv_\mathrm{sW} \mathsf{id} \times \mathsf{wRSgr}{\restriction}_{V = \omega}$. \end{enumerate} \end{Proposition} \begin{proof} We prove both items for $\mathsf{wRSg}$. The proofs for $\mathsf{wRSgr}$ are analogous. For item~(\ref{it-notCyl}), it suffices to observe that every pair of $\mathsf{wRSg}{\restriction}_{V = \omega}$-instances has a common solution. It follows that $\mathsf{id} \nleq_\mathrm{sW} \mathsf{wRSg}{\restriction}_{V = \omega}$, so $\mathsf{wRSg}{\restriction}_{V = \omega}$ is not a cylinder. Let $G_0 = (\omega, E_0)$ and $G_1 = (\omega, E_1)$ be two $\mathsf{wRSg}{\restriction}_{V = \omega}$-instances. Let $H_0$ be an infinite homogeneous set for $G_0$ (i.e., either an infinite clique or an infinite independent set). Let $G_1 {\restriction} H_0 = (H_0, E_1 \cap [H_0]^2)$ be the subgraph of $G_1$ induced by $H_0$. Let $H$ be an infinite homogeneous set for $G_1 {\restriction} H_0$. Then $H$ is homogeneous for both $G_0$ and $G_1$, so it is a $\mathsf{wRSg}{\restriction}_{V = \omega}$-solution to both $G_0$ and $G_1$. For item~(\ref{it-cylify}), we first show that $\mathsf{id} \times \mathsf{wRSg}{\restriction}_{V = \omega} \leq_\mathrm{sW} \mathsf{wRSg}$. Let $p \in \omega^\omega$, and let $G = (\omega, E)$ be a $\mathsf{wRSg}{\restriction}_{V = \omega}$-instance. Let $\Phi$ be the functional given by $\Phi(\langle p, G \rangle) = \wh{G} = (V, \wh{E})$, where $V = \{p {\restriction} n : n \in \omega\}$ and $\wh{E} = \{(p {\restriction} m, p {\restriction} n) : (m, n) \in E\}$. Let $\wh{H}$ be a $\mathsf{wRSg}$-solution to $\wh{G}$. Define a functional $\Psi(\wh{H})$ computing a pair $\langle q, H \rangle$ as follows. To compute $q$, given $n$ search for a $\sigma \in \wh{H}$ with $|\sigma| > n$ and output $q(n) = \sigma(n)$. To compute $H$, take $H = \{n : q {\restriction} n \in \wh{H}\}$. The set $\wh{H}$ consists of infinitely many initial segments of $p$, so in fact we computed $q = p$ and $H = \{n : p {\restriction} n \in \wh{H}\}$. Furthermore, $H$ is a $\mathsf{wRSg}{\restriction}_{V = \omega}$-solution to $G$ because the function $n \mapsto p {\restriction} n$ is an isomorphism between $G$ and $\wh{G}$. Thus $\Phi$ and $\Psi$ witness that $\mathsf{id} \times \mathsf{wRSg}{\restriction}_{V = \omega} \leq_\mathrm{sW} \mathsf{wRSg}$. Now we show that $\mathsf{wRSg} \leq_\mathrm{sW} \mathsf{id} \times \mathsf{wRSg}{\restriction}_{V = \omega}$. Let $G = (V,E)$ be a $\mathsf{wRSg}$-instance. Let $\Phi$ be the functional given by $\Phi(G) = \langle p, \wh{G} \rangle$, where $p \colon \omega \rightarrow V$ enumerates $V$ in increasing order, and $\wh{G} = (\omega, \wh{E})$ is the graph with $\wh{E} = \{(m, n) : (p(m), p(n)) \in E\}$. Then $\langle p, \wh{G} \rangle$ is a $(\mathsf{id} \times \mathsf{wRSg}{\restriction}_{V = \omega})$-instance. Let $\langle p, \wh{H} \rangle$ be a $(\mathsf{id} \times \mathsf{wRSg}{\restriction}_{V = \omega})$-solution. Define a functional $\Psi(\langle p, \wh{H} \rangle)$ computing the set $H = \{v : p^{-1}(v) \in \wh{H}\}$. Then $H$ is a $\mathsf{wRSg}$-solution to $G$ because $p$ is an isomorphism between $\wh{G}$ and $G$. Thus $\Phi$ and $\Psi$ witness that $\mathsf{wRSg} \leq_\mathrm{sW} \mathsf{id} \times \mathsf{wRSg}{\restriction}_{V = \omega}$. \end{proof} Many of the arguments in the rest of this section are based on the observations made in the following lemma. \begin{Lemma}\label{lem-wRSgObs} Let $G = (V, E)$ be an infinite graph. \begin{enumerate} \item\label{it-CompInd} If $K \subseteq V$ is an infinite set such that $|K \cap N(x)| < \omega$ for every $x \in K$, then $G \oplus K$ computes an infinite independent set $C \subseteq K$. \medskip \item\label{it-FiniteNbd} Let $F = \{x \in V : |N(x)| < \omega\}$. \begin{enumerate} \item\label{it-FiniteNbdFin} If $F$ is finite, then $V \setminus F \leq_\mathrm{T} G$ is a $\mathsf{wRSgr}$-solution to $G$. \smallskip \item\label{it-FiniteNbdInf} If $F$ is infinite, then $G$ has an infinite independent set $C \leq_\mathrm{T} G'$. \end{enumerate} \medskip \item\label{it-NoRecSoln} Assume that no $H \leq_\mathrm{T} G$ is a $\mathsf{wRSgr}$-solution to $G$. \begin{enumerate} \item\label{it-NoRecSolnInf} Then $G$ has an infinite independent set. \smallskip \item\label{it-NoRecSolnFin} Let $D$ be a finite independent set, and let $\sigma \in 2^{<\omega}$ be a characteristic string of $D$: $|\sigma| > \max(D)$ and $(\forall n < |\sigma|)(\sigma(n) = 1 \leftrightarrow n \in D)$. Then $\sigma$ extends to the characteristic function of a $\mathsf{wRSgr}$-solution to $G$. \end{enumerate} \end{enumerate} \end{Lemma} \begin{proof} (\ref{it-CompInd}): Suppose that $K$ is infinite and that $|K \cap N(x)| < \omega$ for every $x \in K$. To compute an infinite independent set $C = \{x_0, x_1, \dots\} \subseteq K$ from $G \oplus K$, let $x_0$ be the first element of $K$, and let $x_{n+1}$ be the first element of $K$ that is $> x_n$ and not adjacent to any of $\{x_0, \dots, x_n\}$. (\ref{it-FiniteNbd}): Let $F = \{x \in V : |N(x)| < \omega\}$. If $F$ is finite, then $I = V \setminus F$ is infinite, $I \leq_\mathrm{T} G$, and $|I \cap N(x)| = \omega$ for every $x \in I$. Thus $I \leq_\mathrm{T} G$ is a $\mathsf{wRSgr}$-solution to $G$. Suppose instead that $F$ is infinite. Then there is an infinite $F_0 \subseteq F$ with $F_0 \leq_\mathrm{T} G'$ because $F$ is r.e.\ relative to $G'$. $F_0$ satisfies $|F_0 \cap N(x)| < \omega$ for every $x \in F_0$, so there is an infinite independent set $C \leq_\mathrm{T} G \oplus F_0 \leq_\mathrm{T} G'$ by~(\ref{it-CompInd}) with $K = F_0$. (\ref{it-NoRecSoln}): Assume that no $H \leq_\mathrm{T} G$ is a $\mathsf{wRSgr}$-solution to $G$. For (\ref{it-NoRecSolnInf}), if $G$ has no infinite independent set, then there would be a $\mathsf{wRSgr}$-solution $H \leq_\mathrm{T} G$ by~(\ref{it-FiniteNbd}). For~(\ref{it-NoRecSolnFin}), let $\sigma \in 2^{<\omega}$ be a characteristic string of a finite independent set $D$. Again, let $F = \{x \in V : |N(x)| < \omega\}$ and let $I = V \setminus F$. If $I$ is finite, then $F$ is infinite, $F \leq_\mathrm{T} G$, and, by definition, $|F \cap N(x)| < \omega$ for every $x \in F$. Thus by~(\ref{it-CompInd}), there is an infinite independent $C \leq_\mathrm{T} G \oplus F \equiv_\mathrm{T} G$. This contradicts that no $H \leq_\mathrm{T} G$ is a $\mathsf{wRSgr}$-solution to $G$. (In this case, one may alternatively show that $\sigma$ extends to a $\mathsf{wRSgr}$-solution to $G$.) Now suppose that $I$ is infinite. Further suppose that there is an $x \in I$ with $|I \cap N(x)| < \omega$. That is, $x$ has infinitely many neighbors, but only finitely many neighbors of $x$ have infinitely many neighbors. In this case, let $K = N(x) \setminus I$. Then $K$ is infinite and $|K \cap N(y)| < \omega$ for every $y \in K$. Furthermore, $K \leq_\mathrm{T} G$ because $|I \cap N(x)| < \omega$. Thus by~(\ref{it-CompInd}), there is an infinite independent $C \leq_\mathrm{T} G \oplus K \leq_\mathrm{T} G$. This again contradicts that no $H \leq_\mathrm{T} G$ is a $\mathsf{wRSgr}$-solution to $G$. Finally, suppose that $I$ is infinite and that $|I \cap N(x)| = \omega$ for every $x \in I$. Let $n$ be greater than $|\sigma|$ and the maximum element of $\bigcup_{v \in D \cap F}N(v)$. Let $H = D \cup \{x \in I : x > n\}$. It is clear that $\sigma \subseteq H$. To see that $H$ is a $\mathsf{wRSgr}$-solution to $G$, consider a $v \in H$. Either $v \in D \cap F$ or $v \in I$. If $v \in D \cap F$, then $|D \cap N(v)| = 0$ because $D$ is independent, and $|\{x \in I : x > n\} \cap N(v)| = 0$ by the choice of $n$. Hence $|H \cap N(v)| = 0$. If $v \in I$, then $|I \cap N(v)| = \omega$ by assumption, and therefore also $|\{x \in I : x > n\} \cap N(v)| = \omega$. So $|H \cap N(v)| = \omega$. Thus $H$ is a $\mathsf{wRSgr}$-solution to $G$. \end{proof} First, we show that $\mathsf{wRSgr} \leq_\mathrm{c} \mathsf{wRSg}$. \begin{Proposition}\label{prop-WRSGRredWRSG} $\mathsf{wRSgr} \leq_\mathrm{c} \mathsf{wRSg}$. Hence $\mathsf{wRSg} \equiv_\mathrm{c} \mathsf{wRSgr}$. \end{Proposition} \begin{proof} Let $G = (V,E)$ be a $\mathsf{wRSgr}$-instance. Then $G$ is also a $\mathsf{wRSg}$-instance, so let $H$ be a $\mathsf{wRSg}$-solution to $G$. We show that there is a $\mathsf{wRSgr}$-solution $\wh{H}$ to $G$ with $\wh{H} \leq_\mathrm{T} G \oplus H$. Let $I = \{x \in H : |H \cap N(x)| = \omega\}$. Notice that also $I = \{x \in H : |H \cap N(x)| \geq 2\}$ because $H$ is a $\mathsf{wRSg}$-solution to $G$. Therefore $I$ is r.e.\ relative to $G \oplus H$. Now consider three cases. Case $1$: The set $I$ is finite. Let $K = H \setminus I$. Then $K$ is infinite, $K \equiv_\mathrm{T} H$, and $|K \cap N(x)| < \omega$ for every $x \in K$. Thus by Lemma~\ref{lem-wRSgObs} item~(\ref{it-CompInd}), there is an infinite independent $\wh{H} \leq_\mathrm{T} G \oplus K \equiv_\mathrm{T} G \oplus H$, which is a $\mathsf{wRSgr}$-solution to $G$. Case $2$: There is a $v \in I$ with $|I \cap N(v)| < \omega$. Let $K = (H \cap N(v)) \setminus I$. Then $K$ is infinite and $K \leq_\mathrm{T} G \oplus H$ because $H \cap N(v)$ is infinite, $H \cap N(v) \leq_\mathrm{T} G \oplus H$, and $I \cap N(v)$ is finite. Furthermore, $|K \cap N(x)| < \omega$ for every $x \in K$. Thus by Lemma~\ref{lem-wRSgObs} item~(\ref{it-CompInd}), there is an infinite independent $\wh{H} \leq_\mathrm{T} G \oplus K \leq_\mathrm{T} G \oplus H$, which is a $\mathsf{wRSgr}$-solution to $G$. Case $3$: $I$ is infinite and $|I \cap N(v)| = \omega$ for every $v \in I$. In this case we compute a set $\wh{H} \leq_\mathrm{T} G \oplus H$ with $\wh{H} \subseteq I$ and $|\wh{H} \cap N(x)| = \omega$ for each $x \in \wh{H}$. This $\wh{H}$ is thus a $\mathsf{wRSgr}$-solution to $G$. To compute $\wh{H} = \{x_0, x_1, \dots\}$, let $x_0$ be the first element of $I$. To find $x_{n+1}$, decompose $n$ as $n = \langle m, s \rangle$, search for a $y \in I \cap N(x_m)$ with $y > x_n$, and set $x_{n+1} = y$. Such a $y$ exists because $x_m \in I$ and every element of $I$ has infinitely many neighbors in $I$. The search for $y$ can be done effectively relative to $G \oplus H$ because $I$ is r.e.\ relative to $G \oplus H$. Finally, $|\wh{H} \cap N(x)| = \omega$ for each $x \in \wh{H}$ because $x_{n+1}$ is adjacent to $x_m$ whenever $n$ is of the form $\langle m, s \rangle$. \end{proof} \begin{Question} Does $\mathsf{wRSgr} \leq_\mathrm{W} \mathsf{wRSg}$ hold? \end{Question} We may situate $\mathsf{wRSg}$ in the computable degrees by combining Lemma~\ref{lem-wRSgObs} and the proof of Theorem~\ref{thm-RT_WRSG_eq} with established results concerning $\mathsf{RT}^2_2$ and its consequences. Recall that the \emph{chain/anti-chain principle} ($\mathsf{CAC}$) of~\cite{HirschfeldtShore} states that every infinite partial order contains either an infinite chain or an infinite anti-chain. \begin{Proposition}\label{prop-wRSgCompLoc} In the computable degrees, $\mathsf{wRSg}$ is \begin{itemize} \item strictly below $\mathsf{RT}^2_2$ and $\lim$; \smallskip \item strictly above $\mathsf{ADS}$ and $\mathsf{SRT}^2_2$; \smallskip \item incomparable with $\mathsf{CAC}$. \end{itemize} \end{Proposition} \begin{proof} Trivially $\mathsf{wRSg} \leq_\mathrm{sW} \mathsf{RT}^2_2$, hence $\mathsf{wRSg} \leq_\mathrm{c} \mathsf{RT}^2_2$. That $\mathsf{RT}^2_2 \nleq_\mathrm{c} \mathsf{wRSg}$ is because every $\mathsf{wRSg}$-instance $G$ has a solution $H \leq_\mathrm{T} G'$ by Lemma~\ref{lem-wRSgObs} item~(\ref{it-FiniteNbd}), whereas by~\cite{JockuschRamsey}*{Theorem~3.1} there are recursive $\mathsf{RT}^2_2$-instances with no solution recursive in $0'$. As mentioned in the proof of Proposition~\ref{prop-RSgLF}, $\lim$ is strongly Weihrauch equivalent, hence computably equivalent, to the Turing jump function $\mathsf{J}$. Every $\mathsf{wRSg}$-instance $G$ has a solution $H \leq_\mathrm{T} G'$ by Lemma~\ref{lem-wRSgObs} item~(\ref{it-FiniteNbd}), so $\mathsf{wRSg} \leq_\mathrm{c} \lim$. That $\lim \nleq_\mathrm{c} \mathsf{wRSg}$ follows from the cone-avoidance result for $\mathsf{RT}^2_2$: by~\cite{SeetapunSlaman}*{Theorem~2.1}, every recursive infinite graph has a homogeneous set, hence $\mathsf{wRSg}$-solution, that does not compute $0'$. For $\mathsf{ADS} \leq_\mathrm{c} \mathsf{wRSg}$ and $\mathsf{SRT}^2_2 \leq_\mathrm{c} \mathsf{wRSg}$, see the proof of the $\mathsf{RCA}_0 \vdash \mathsf{wRSg} \rightarrow \mathsf{RT}^2_2$ direction of Theorem~\ref{thm-RT_WRSG_eq}. The arguments showing that $\mathsf{wRSg}$ implies $\mathsf{ADS}$ and $\mathsf{SRT}^2_2$ over $\mathsf{RCA}_0$ describe computable reductions from $\mathsf{ADS}$ and $\mathsf{SRT}^2_2$ to $\mathsf{wRSg}$. For the non-reductions, by the results of~\cite{HirschfeldtShore}*{Section~2}, there are $\omega$-models of $\mathsf{ADS}$ that are not models of $\mathsf{RT}^2_2$ and therefore not models of $\mathsf{wRSg}$. Hence $\mathsf{wRSg} \nleq_\mathrm{c} \mathsf{ADS}$. By impressive recent work of Monin and Patey~\cite{MoninPatey}, there are also $\omega$-models of $\mathsf{SRT}^2_2$ that are not models of $\mathsf{RT}^2_2$ and therefore not models of $\mathsf{wRSg}$. Hence $\mathsf{wRSg} \nleq_\mathrm{c} \mathsf{SRT}^2_2$. That $\mathsf{CAC} \nleq_\mathrm{c} \mathsf{wRSg}$ is because again every $\mathsf{wRSg}$-instance $G$ has a solution $H \leq_\mathrm{T} G'$, whereas by~\cite{Herrmann}*{Theorem~3.1} there are recursive $\mathsf{CAC}$-instances with no solution recursive in $0'$. That $\mathsf{wRSg} \nleq_\mathrm{c} \mathsf{CAC}$ follows from fact that there are $\omega$-models of $\mathsf{CAC}$ that are not models of $\mathsf{RT}^2_2$ and therefore not models of $\mathsf{wRSg}$, as shown in~\cite{HirschfeldtShore}*{Section~3}. \end{proof} We remark that Proposition~\ref{prop-wRSgCompLoc} implies that $\mathsf{COH} <_\mathrm{c} \mathsf{wRSg}$ as well because $\mathsf{COH} \leq_\mathrm{c} \mathsf{ADS}$ (by Proposition~\ref{prop-CADSCOH}, for example). We return to the Weihrauch degrees and first show that $\mathsf{SADC} \nleq_\mathrm{W} \mathsf{wRSgr}$. As $\mathsf{SADC}$ is below both $\mathsf{ADS}$ and $\mathsf{SRT}^2_2$ in the Weihrauch degrees (see~\cite{AstorDzhafarovSolomonSuggs}, for example), this implies that the computable reductions $\mathsf{ADS} <_\mathrm{c} \mathsf{wRSgr}$ and $\mathsf{SRT}^2_2 <_\mathrm{c} \mathsf{wRSgr}$ cannot be improved to Weihrauch reductions. We also show that $\mathsf{DNR} \nleq_\mathrm{W} \mathsf{wRSgr}$. \begin{Theorem}\label{thm-SADCvWRSGR} $\mathsf{SADC} \nleq_\mathrm{W} \mathsf{wRSgr}$. \end{Theorem} \begin{proof} Suppose for a contradiction that $\mathsf{SADC} \leq_\mathrm{W} \mathsf{wRSgr}$ is witnessed by Turing functionals $\Phi$ and $\Psi$. By a well-known result independently of Tennenbaum and Denisov (see~\cite{RosensteinBook}*{Theorem~16.54}, for example), there is a recursive linear order $L = (\omega, <_L)$ with $L \cong \omega + \omega^*$ that has no infinite recursive ascending or descending sequence. If $\ell \in L$ has finitely many $<_L$-predecessors, then say that $\ell$ is in the $\omega$-part of $L$; and if $\ell$ has finitely many $<_L$-successors, then say that $\ell$ is in the $\omega^*$-part of $L$. Notice that no infinite r.e.\ set is contained entirely in the $\omega$-part of $L$, as such a set could be thinned to a recursive ascending sequence. Similarly, no infinite r.e.\ set is contained entirely in the $\omega^*$-part of $L$. The linear order $L$ is a recursive $\mathsf{SADC}$-instance, so $G = \Phi(L)$ is a recursive $\mathsf{wRSgr}$-instance. Write $G = (V, E)$. $G$ cannot have a recursive $\mathsf{wRSgr}$-solution because if there were a recursive solution $H$ to $G$, then $\Psi(\langle L, H \rangle)$ would be a recursive $\mathsf{SADC}$-solution to $L$, which would be an infinite recursive set either entirely contained in the $\omega$-part of $L$ or entirely contained in the $\omega^*$-part of $L$. Therefore $G$ has an infinite independent set $C$ by Lemma~\ref{lem-wRSgObs} item~(\ref{it-NoRecSolnInf}). This $C$ is a $\mathsf{wRSgr}$-solution to $G$, so $\Psi(\langle L, C \rangle)$ is a $\mathsf{SADC}$-solution to $L$. In particular, $\Psi(\langle L, C \rangle)$ is infinite. Fix any $x \in \Psi(\langle L, C \rangle)$, and assume for the sake of argument that $x$ is in the $\omega$-part of $L$ (the $\omega^*$-part case is symmetric). Let $R$ be the r.e.\ set \begin{align*} R = \bigl\{y : \text{there is a finite independent set $D \subseteq V$ with $x, y \in \Psi(\langle L, D \rangle)$}\bigr\}. \end{align*} Notice that if $y \in \Psi(\langle L, C \rangle)$, then any sufficiently long initial segment $D$ of $C$ witnesses that $y \in R$. Thus $\Psi(\langle L, C \rangle) \subseteq R$. In particular, $R$ is infinite. However, $R$ is r.e., so it cannot be entirely contained in the $\omega$-part of $L$. Therefore there must be a $y \in R$ that is in the $\omega^*$-part of $L$. Let $D$ be a finite independent set witnessing that $y \in R$. By Lemma~\ref{lem-wRSgObs} item~(\ref{it-NoRecSolnFin}), the characteristic string of $D$ extends to the characteristic function of a $\mathsf{wRSgr}$-solution $H$ to $G$. However, $x, y \in \Psi(\langle L, H \rangle)$, $x$ is in the $\omega$-part of $L$, and $y$ is in the $\omega^*$-part of $L$. Thus $\Psi(\langle L, H \rangle)$ can be neither an infinite ascending chain nor an infinite descending chain. Thus $\Phi$ and $\Psi$ do not witness that $\mathsf{SADC} \leq_\mathrm{W} \mathsf{wRSgr}$, so $\mathsf{SADC} \nleq_\mathrm{W} \mathsf{wRSgr}$. \end{proof} \begin{Theorem}\label{thm-DNRvWRSGR} $\mathsf{DNR} \nleq_\mathrm{W} \mathsf{wRSgr}$. \end{Theorem} \begin{proof} The proof is similar to the proof of Theorem~\ref{thm-SADCvWRSGR}. Suppose for a contradiction that $\mathsf{DNR} \leq_\mathrm{W} \mathsf{wRSgr}$ is witnessed by Turing functionals $\Phi$ and $\Psi$. Let $p \colon \omega \rightarrow \omega$ be any recursive function. Then $p$ is a recursive $\mathsf{DNR}$-instance, so $G = \Phi(p)$ is a recursive $\mathsf{wRSgr}$-instance. Write $G = (V, E)$. $G$ cannot have a recursive $\mathsf{wRSgr}$-solution because if there were a recursive solution $H$ to $G$, then $\Psi(\langle p, H \rangle)$ would be a contradictory recursive $\mathsf{DNR}$-solution to $p$. Thus $G$ has an infinite independent set $C$ by Lemma~\ref{lem-wRSgObs} item~(\ref{it-NoRecSolnInf}). This $C$ is a $\mathsf{wRSgr}$-solution to $G$, so $\Psi(\langle p, C \rangle)$ is $\mathrm{DNR}$ relative to $p$. Compute a function $g \colon \omega \rightarrow \omega$ as follows. On input $e$, $g(e)$ searches for a finite independent set $D \subseteq V$ such that $\Psi(\langle p, D \rangle)(e){\downarrow}$ and outputs the value of $\Psi(\langle p, D \rangle)(e)$ for the first such $D$ found. The function $g$ is total because $\Psi(\langle p, C \rangle)$ is total: for any $e$, any sufficiently long initial segment $D$ of $C$ is a finite independent set for which $\Psi(\langle p, D \rangle)(e){\downarrow}$. The function $g$ is recursive, so it is not $\mathrm{DNR}$ relative to $p$. So there is an $e$ such that $g(e) = \Phi_e(p)(e)$. By the definition of $g$, there is a finite independent set $D$ such that $\Psi(\langle p, D \rangle)(e) = g(e) = \Phi_e(p)(e)$. By Lemma~\ref{lem-wRSgObs} item~(\ref{it-NoRecSolnFin}), the characteristic string of $D$ extends to the characteristic function of a $\mathsf{wRSgr}$-solution $H$ to $G$. Then $\Psi(\langle p, H \rangle)(e) = \Phi_e(p)(e)$, so $\Psi(\langle p, H \rangle)$ is not a $\mathsf{DNR}$-solution to $p$. Thus $\Phi$ and $\Psi$ do not witness that $\mathsf{DNR} \leq_\mathrm{W} \mathsf{wRSgr}$, so $\mathsf{DNR} \nleq_\mathrm{W} \mathsf{wRSgr}$. \end{proof} On the positive side, we show that $\mathsf{COH} \leq_\mathrm{sW} \mathsf{wRSg}$ and that $\mathsf{RT}^1_{<\infty} \leq_\mathrm{sW} \mathsf{wRSg}$. \begin{Theorem}\label{thm-COHredWRSG} $\mathsf{COH} \leq_\mathrm{sW} \mathsf{wRSg}$. \end{Theorem} \begin{proof} It suffices to show that $\mathsf{CADS} \leq_\mathrm{W} \mathsf{wRSg}$ because $\mathsf{CADS} \equiv_\mathrm{W} \mathsf{COH}$ by Proposition~\ref{prop-CADSCOH} and because $\mathsf{wRSg}$ is a cylinder by Proposition~\ref{prop-wRSgCyl}. Let $L = (L, <_L)$ be a $\mathsf{CADS}$-instance. Define a functional $\Phi(L)$ computing the graph $G = (V, E)$ where $V = L$ and \begin{align*} E = \{(m, n) : (m,n \in V) \wedge (m < n) \wedge (m <_L n)\}. \end{align*} The graph $G$ is a valid $\mathsf{wRSg}$-instance, so let $H$ be a $\mathsf{wRSg}$-solution to $G$. We define a functional $\Psi(\langle L, H \rangle)$ computing a set $C \subseteq L$ which will be a suborder of $L$ either of type $\omega^*$, of type $1 + \omega^*$, or of type $\omega + k$ for some finite linear order $k$. Using $\Phi$, we may compute $\Phi(L) = G$. Using $G$ and $H$, we may enumerate the set $R = \{x \in H : |H \cap N(x)| \geq 2\}$. We claim that if $|R| \geq 2$, then every $x \in R$ has infinitely many $<_L$-successors in $R$. To see this, suppose that $|R| \geq 2$, let $x \in R$, and let $z \in R$ be different from $x$. Then $|H \cap N(x)| \geq 2$ and $|H \cap N(z)| \geq 2$. Therefore $|H \cap N(x)| = \omega$ and $|H \cap N(z)| = \omega$ because $H$ is a $\mathsf{wRSg}$-solution to $G$. Let $w$ denote the $<_L$-maximum of $x$ and $z$. Then any sufficiently large $y \in H \cap N(w)$ satisfies $y > x$, $y > z$, $y >_L x$, and $y >_L z$. Thus any such $y$ is in $R$ because $y \in H$ and $x, z \in H \cap N(y)$. Therefore there are infinitely many $y \in R$ with $y >_L x$. To compute $C = \{x_0, x_1, \dots\}$, first enumerate $H$ in $<$-increasing order as $h_0 < h_1 < h_2 < \cdots$. For each $s$, let $H_s = \{h_0, \dots, h_s\}$. Take $x_n = h_n$ until possibly reaching an $s_0$ for which there are distinct $u, v \in H_{s_0}$ with $|H_{s_0} \cap N(u)| \geq 2$ and $|H_{s_0} \cap N(v)| \geq 2$. If such an $s_0$ is reached, then $H_{s_0}$ witnesses that $u,v \in R$. Thus $R$ is infinite by the claim, so we may switch to computing an ascending sequence in $R$. Search for a $y \in R$ with $y > x_{s_0 - 1}$ and set $x_{s_0} = y$. Having determined $x_s$ for some $s \geq s_0$, search for a $y \in R$ with $y > x_s$ and $y >_L x_s$, which exists by the claim, and set $x_{s+1} = y$. We now show that $C$ is a suborder of $L$ either of type $\omega^*$, of type $1 + \omega^*$, or of type $\omega + k$ for some finite linear order $k$. First suppose that there is an $s_0$ for which there are distinct $u, v \in H_{s_0}$ with $|H_{s_0} \cap N(u)| \geq 2$ and $|H_{s_0} \cap N(v)| \geq 2$. Then $\{x_n : n \geq s_0\}$ is an ascending sequence in $L$, so $C$ is a suborder of $L$ of type $\omega + k$ for some finite linear order $k$. If there is no such $s_0$, then $C = H$, which in this case is a suborder of $L$ either of type $\omega^*$ or of type $1 + \omega^*$. To see this, suppose for a contradiction that there are $a < b$ such that both $h_a$ and $h_b$ have infinitely many $<_L$-successors in $H$. Then there are infinitely many $n$ with $h_n >_L h_a, h_b$. In particular, there are $n > m > b$ with $h_m >_L h_a, h_b$ and $h_n >_L h_a, h_b$. But then $h_a, h_b \in H_n$; $h_a, h_b \in N(h_m)$; and $h_a, h_b \in N(h_n)$. So for $s_0 = n$ there are $u = h_a$ and $v = h_b$ with $|H_{s_0} \cap N(u)| \geq 2$ and $|H_{s_0} \cap N(v)| \geq 2$, contradicting that there is no such $s_0$. \end{proof} The proof that $\mathsf{RT}^1_{<\infty} \leq_\mathrm{sW} \mathsf{wRSg}$ is similar to Hirst's proof that $\mathsf{RCA}_0 + \mathsf{RT}^2_2 \vdash \mathsf{RT}^1_{<\infty}$ from~\cite{HirstThesis}. \begin{Proposition}\label{prop-PHPredWRSG} $\mathsf{RT}^1_{<\infty} \leq_\mathrm{sW} \mathsf{wRSg}$. \end{Proposition} \begin{proof} It suffices to show that $\mathsf{RT}^1_{<\infty} \leq_\mathrm{W} \mathsf{wRSg}$ because $\mathsf{wRSg}$ is a cylinder by Proposition~\ref{prop-wRSgCyl}. Let $c$ be an $\mathsf{RT}^1_{<\infty}$-instance. Define a functional $\Phi(c)$ computing the graph $G = (\omega, E)$ where $E = \{(m,n) : c(m) = c(n)\}$. The graph $G$ is a valid $\mathsf{wRSg}$-instance, so let $H$ be a $\mathsf{wRSg}$-solution to $G$. Let $\Psi(\langle c, H \rangle)$ be a functional that computes $G = \Phi(c)$, searches for an $x \in H$ with $|H \cap N(x)| \geq 2$, and outputs the set $H \cap N(x)$ for the first such $x$ found. There must be such an $x$ because $G$ is a disjoint union of finitely many complete graphs (depending on the size of $\ran(c)$), and thus $H$ must have infinite intersection with one of these components. The set $H \cap N(x)$ is infinite because $H$ is a $\mathsf{wRSg}$-solution to $G$, and it is monochromatic because $c(y) = c(x)$ for all $y \in H \cap N(x)$. \end{proof} We are ready to summarize the position of $\mathsf{wRSg}$ and $\mathsf{wRSgr}$ in the Weihrauch degrees. Notice that the uniform computational content of $\mathsf{wRSg}$ and $\mathsf{wRSgr}$ is considerably less than that of $\mathsf{RT}^2_2$: $\mathsf{RT}^2_2$ is above both $\mathsf{DNR}$ and $\mathsf{SADC}$ in the Weihrauch degrees, but $\mathsf{wRSgr}$ is above neither of these problems. \begin{Theorem}\label{thm-wRSgWeiLoc} In the Weihrauch degrees, $\mathsf{wRSg}$ and $\mathsf{wRSgr}$ are \begin{itemize} \item strictly below $\mathsf{RT}^2_2$; \smallskip \item strictly above $\mathsf{COH}$ and $\mathsf{RT}^1_{<\infty}$; \smallskip \item incomparable with $\lim$, $\mathsf{SRT}^2_2$, $\mathsf{SADC}$, and $\mathsf{DNR}$. \end{itemize} \end{Theorem} \begin{proof} Trivially $\mathsf{wRSgr} \leq_\mathrm{sW} \mathsf{RT}^2_2$. That $\mathsf{RT}^2_2 \nleq_\mathrm{W} \mathsf{wRSgr}$ follows from the stronger non-reduction $\mathsf{RT}^2_2 \nleq_\mathrm{c} \mathsf{wRSgr}$ of Proposition~\ref{prop-wRSgCompLoc}. We have that $\mathsf{COH} \leq_\mathrm{sW} \mathsf{wRSg}$ and that $\mathsf{RT}^1_{<\infty} \leq_\mathrm{sW} \mathsf{wRSg}$ by Theorem~\ref{thm-COHredWRSG} and Proposition~\ref{prop-PHPredWRSG}. These reductions are strict (indeed, the corresponding computable reductions are strict) because there are $\omega$-models of $\mathsf{COH}$ that are not models of $\mathsf{RT}^2_2$, hence not models of $\mathsf{wRSg}$, by the results of~\cite{HirschfeldtShore}*{Section~2}, for example; and because every recursive $\mathsf{RT}^1_{<\infty}$-instance has a recursive solution. We now show the incomparabilities. Straightforward arguments show that $\mathsf{SADC} \leq_\mathrm{sW} \mathsf{SRT}^2_2$ and that $\mathsf{DNR} \leq_\mathrm{sW} \lim$, so it suffices to show that $\mathsf{wRSgr}$ is above neither $\mathsf{SADC}$ nor $\mathsf{DNR}$ and that $\mathsf{wRSg}$ is below neither $\mathsf{SRT}^2_2$ nor $\lim$. Theorems~\ref{thm-SADCvWRSGR} and~\ref{thm-DNRvWRSGR} give $\mathsf{SADC} \nleq_\mathrm{W} \mathsf{wRSgr}$ and $\mathsf{DNR} \nleq_\mathrm{W} \mathsf{wRSgr}$. We have that $\mathsf{wRSg} \nleq_\mathrm{W} \mathsf{SRT}^2_2$ because $\mathsf{COH} \leq_\mathrm{sW} \mathsf{wRSg}$ as mentioned above, but $\mathsf{COH} \nleq_\mathrm{W} \mathsf{SRT}^2_2$ by~\cite{DzhafarovStrongRed}*{Corollary~4.5}. Finally, $\mathsf{wRSg} \nleq_\mathrm{W} \lim$ because $\mathsf{RT}^1_{<\infty} \leq_\mathrm{sW} \mathsf{wRSg}$ as mentioned above, but $\mathsf{RT}^1_{<\infty} \nleq_\mathrm{W} \lim$ by~\cite{BrattkaRakotoniaina}*{Corollary~4.20}. \end{proof} From Proposition~\ref{prop-PHPredWRSG} and Theorem~\ref{thm-wRSgWeiLoc}, one may deduce that $\mathsf{wRSg}$ and $\mathsf{wRSgr}$ are Weihrauch incomparable with a number of other principles, such as $\mathsf{ADS}$, $\mathsf{CAC}$, and its stable version $\mathsf{SCAC}$. Figure~\ref{fig-reductions} depicts the position of $\mathsf{wRSg}$ and $\mathsf{wRSgr}$ relative to a number of principles below $\mathsf{RT}^2_2$ in the Weihrauch degrees. \begin{figure} \begin{tikzpicture} \node (coh) at (-2,-4) {$\mathsf{COH}$}; \node (DNR) at (-6,-2) {$\mathsf{DNR}$}; \node (wrsgr) at (0,0) {$\mathsf{wRSgr}$}; \node (wrsg) at (0,-2) {$\mathsf{wRSg}$}; \node (RT22) at (-2,2.5) {$\mathsf{RT}^2_2$}; \node (CAC) at (-2,0) {$\mathsf{CAC}$}; \node (ADS) at (-2,-2) {$\mathsf{ADS}$}; \node (cads) at (0,-4) {$\mathsf{CADS}$}; \node (SRT22) at (-4,0) {$\mathsf{SRT}^2_2$}; \node (SCAC) at (-4,-2) {$\mathsf{SCAC}$}; \node (SADS) at (-4,-4) {$\mathsf{SADS}$}; \node (SADC) at (-4,-6) {$\mathsf{SADC}$}; \node (RT1) at (2,-4) {$\mathsf{RT}^1_{<\infty}$}; \draw[->] (SRT22) -- (DNR); \draw[->] (RT22) -- (wrsgr); \draw[->] (RT22) -- (SRT22); \draw[->] (RT22) -- (CAC); \draw[->] (SRT22) -- (SCAC); \draw[->] (CAC) -- (SCAC); \draw[->] (CAC) -- (ADS); \draw[->] (SCAC) -- (SADS); \draw[->] (ADS) -- (cads); \draw[->] (ADS) -- (SADS); \draw[->] (SADS) -- (SADC); \draw[->] (wrsgr) --(wrsg); \draw[->] (wrsg) -- (cads); \draw[<->] (coh) -- (cads); \draw[->] (wrsg) -- (RT1); \draw[->] (CAC) to [out=-25,in=115] (RT1); \end{tikzpicture} \caption{Weihrauch reductions and non-reductions in the neighborhood of $\mathsf{RT}^2_2$. An arrow indicates that the target principle Weihrauch reduces to the source principle. No further arrows may be added, except those that may be inferred by following the arrows drawn. No arrows reverse, except the double arrow indicating that $\mathsf{COH} \equiv_\mathrm{W} \mathsf{CADS}$ and possibly the arrow indicating that $\mathsf{wRSg} \leq_\mathrm{W} \mathsf{wRSgr}$. The reductions and non-reductions (often in the form of $\omega$-model separations) not proved here may be found in~\cites{AstorDzhafarovSolomonSuggs, BrattkaRakotoniaina, DzhafarovStrongRed, HJKHLS, HirschfeldtJockusch, HirschfeldtShore, LermanSolomonTowsner, PateyImmunity}.} \label{fig-reductions} \end{figure} As $\mathsf{RCA}_0 + \mathsf{wRSg} \vdash \mathsf{RT}^2_2$ but $\mathsf{RT}^2_2 \nleq_\mathrm{W} \mathsf{wRSg}$, it is natural to ask what must be added to $\mathsf{wRSg}$ to obtain $\mathsf{RT}^2_2$. In particular, we ask how many applications of $\mathsf{wRSg}$ are necessary to obtain $\mathsf{RT}^2_2$. This question can be formalized by considering \emph{compositional products}. \begin{Theorem}[see~\cites{BrattkaGherardiMarcone, BrattkaPaulyAlg}] Let $\mc{F}$ and $\mc{G}$ be multi-valued functions. The set \begin{align*} \{\mc{F}_0 \circ \mc{G}_0 : (\mc{F}_0 \leq_\mathrm{W} \mc{F}) \wedge (\mc{G}_0 \leq_\mathrm{W} \mc{G}) \wedge (\text{$\mc{F}_0$ and $\mc{G}_0$ are composable})\} \end{align*} has a $\leq_\mathrm{W}$-maximum element up to Weihrauch degree. In a slight abuse of terminology and notation, this maximum element is called the \emph{compositional product} of $\mc{F}$ and $\mc{G}$ and is denoted $\mc{F} \ast \mc{G}$. \end{Theorem} To show that $\mc{H} \leq_\mathrm{W} \mc{F} \ast \mc{G}$ for multi-valued functions $\mc{F}, \mc{G}, \mc{H} \colon \!\!\subseteq\! \omega^\omega \rightrightarrows \omega^\omega$, it suffices to exhibit Turing functionals $\Phi$, $\Theta$, $\Psi$ such that for all $p \in \dom(\mc{H})$, \begin{itemize} \item $\Phi(p) \in \dom(\mc{G})$; \smallskip \item $\Theta(\langle p, q \rangle) \in \dom(\mc{F})$ for all $q \in \mc{G}(\Phi(p))$; \smallskip \item $\Psi(\langle \langle p, q \rangle, r \rangle) \in \mc{H}(p)$ for all $q \in \mc{G}(\Phi(p))$ and all $r \in \mc{F}(\Theta(\langle p, q \rangle))$. \end{itemize} We show that an application of two parallel instances of the \emph{limited principle of omniscience} ($\mathsf{LPO}$) suffices to overcome the non-uniformities in the proof that $\mathsf{SRT}^2_2 \leq_\mathrm{c} \mathsf{wRSg}$, yielding that $\mathsf{SRT}^2_2 \leq_\mathrm{W} (\mathsf{LPO} \times \mathsf{LPO}) \ast \mathsf{wRSg}$. In the case of $\mathsf{wRSgr}$, one application of $\mathsf{LPO}$ suffices: $\mathsf{SRT}^2_2 \leq_\mathrm{W} \mathsf{LPO} \ast \mathsf{wRSgr}$. As $\mathsf{RT}^2_2 \leq_\mathrm{W} \mathsf{SRT}^2_2 \ast \mathsf{COH}$, we conclude that $\mathsf{RT}^2_2 \leq_\mathrm{W} (\mathsf{LPO} \times \mathsf{LPO}) \ast \mathsf{wRSg} \ast \mathsf{COH}$. It follows that $\mathsf{RT}^2_2 \leq_\mathrm{W} \mathsf{wRSg} \ast \mathsf{wRSg} \ast \mathsf{wRSg}$ because below we observe that $(\mathsf{LPO} \times \mathsf{LPO}) \leq_\mathrm{W} \mathsf{wRSg}$, and $\mathsf{COH} \leq_\mathrm{W} \mathsf{wRSg}$ by Theorem~\ref{thm-COHredWRSG}. Thus three applications of $\mathsf{wRSg}$ suffice to obtain $\mathsf{RT}^2_2$. We do not know if two applications suffice. A function corresponding to $\mathsf{LPO}$ is defined as follows. \begin{Definition} $\mathsf{LPO}$ is the following function. \begin{itemize} \item Input/instance: A function $p \in \omega^\omega$. \smallskip \item Output/solution: Output $0$ if there is an $n$ such that $p(n) = 0$. Output $1$ if $p(n) \neq 0$ for every $n$. \end{itemize} \end{Definition} \begin{Theorem}\label{thm-2LPOwRsg}{\ } \begin{enumerate} \item\label{it-LPOwRSgr} $\mathsf{SRT}^2_2 \leq_\mathrm{W} \mathsf{LPO} \ast \mathsf{wRSgr}$. \smallskip \item\label{it-2LPOwRSg} $\mathsf{SRT}^2_2 \leq_\mathrm{W} (\mathsf{LPO} \times \mathsf{LPO}) \ast \mathsf{wRSg}$. \end{enumerate} \end{Theorem} \begin{proof} For~(\ref{it-LPOwRSgr}), let $c \colon [\omega]^2 \rightarrow \{0,1\}$ be an $\mathsf{SRT}^2_2$-instance. Using $c$, compute the graph $G = (\omega, E)$ with $E = \{(n, s) : (n < s) \wedge (c(n,s) = 1)\}$. Let $H$ be a $\mathsf{wRSgr}$-solution to $G$. We use an application of $\mathsf{LPO}$ to determine whether or not $H$ contains two adjacent vertices. Using $G$ and $H$, uniformly compute a function $p \colon \omega \rightarrow \{0,1\}$ by setting $p(n) = 0$ if any two of the least $n$ elements of $H$ are adjacent, and by setting $p(n) = 1$ otherwise. Let $b = \mathsf{LPO}(p)$. If $b = 1$, then $H$ is an independent set and hence an $\mathsf{SRT}^2_2$-solution to $c$. Thus output $H$. If $b = 0$, then $H$ contains a pair of adjacent vertices. Notice that if $u \in H$ has a neighbor in $H$, then $H \cap N(u)$ is infinite because $H$ is a $\mathsf{wRSgr}$-solution to $G$. Furthermore, such a $u$ is adjacent to almost every vertex in $G$ because $c$ is stable. Compute an infinite clique $K = \{x_0, x_1, \dots\}$ uniformly from $G$ and $H$ as follows. First, search for any $x_0 \in H$ with $|H \cap N(x_0)| \geq 1$. Having determined a finite clique $\{x_0, \dots, x_n\} \subseteq H$, search for the first vertex $x_{n+1} \in H$ that is adjacent to each $x_i$ for $i \leq n$. Such an $x_{n+1}$ exists because each $x_i$ for $i \leq n$ is adjacent to almost every vertex of $H$. The resulting $K$ is an infinite clique and hence an $\mathsf{SRT}^2_2$-solution to $c$. For~(\ref{it-2LPOwRSg}), again let $c \colon [\omega]^2 \rightarrow \{0,1\}$ be an $\mathsf{SRT}^2_2$-instance, and again compute the graph $G = (\omega, E)$ with $E = \{(n, s) : (n < s) \wedge (c(n,s) = 1)\}$. Let $H$ be a $\mathsf{wRSg}$-solution to $G$. Refine $H$ to eliminate \emph{bars}, i.e., pairs of vertices in $H$ where each is the only vertex of $H$ adjacent to the other. To do this, compute an infinite $\wh{H} \subseteq H$ by skipping the first neighbor of each vertex already added to $\wh{H}$. Enumerate $H$ in increasing order as $h_0 < h_1 < h_2 < \cdots$. Let $\wh{H}_0 = \{h_0\}$. Given $\wh{H}_n$, consider $h_{n+1}$. If there is a $u \in \wh{H}_n$ such that $h_{n+1}$ is the least element of $H \cap N(u)$, then skip $h_{n+1}$ by putting $\wh{H}_{n+1} = \wh{H}_n$. Otherwise, put $\wh{H}_{n+1} = \wh{H}_n \cup \{h_{n+1}\}$. Let $\wh{H} = \bigcup_{n \in \omega}\wh{H}_n$, which can be computed uniformly from $G$ and $H$ because at stage $n$ we determine whether or not $h_n$ is in $\wh{H}$. If $x, y \in H$ are adjacent to each other but to no other vertices of $H$, then only $\min\{x, y\}$ is in $\wh{H}$. If $x \in \wh{H}$ has infinitely many neighbors in $H$, then it is adjacent to almost every vertex in $G$ because $c$ is stable, and therefore $x$ also has infinitely many neighbors in $\wh{H}$. Call a clique of size three a \emph{triangle}. The set $\wh{H}$ is either an independent set, contains edges but no triangles, or contains triangles. Using $G$ and $\wh{H}$, uniformly compute two $\mathsf{LPO}$-instances $p, q \colon \omega \rightarrow \{0,1\}$ to determine if $\wh{H}$ contains edges or triangles. Set $p(n) = 0$ if any two of the least $n$ elements of $\wh{H}$ are adjacent, and set $p(n) = 1$ otherwise. Set $q(n) = 0$ if any three of the least $n$ elements of $\wh{H}$ form a triangle, and set $q(n) = 1$ otherwise. Let $(a,b) = (\mathsf{LPO} \times \mathsf{LPO})(p, q)$. If $(a,b) = (1,1)$, then $\wh{H}$ contains no edges; if $(a,b) = (0,1)$, then $\wh{H}$ contains edges but not triangles; and if $(a,b) = (0,0)$, then $\wh{H}$ contains triangles. Output $(1,0)$ is not possible because if $\wh{H}$ contains triangles, then it also contains edges. If $\wh{H}$ contains no edges, then it is an independent set and hence an $\mathsf{SRT}^2_2$-solution to $c$. Thus output $\wh{H}$. Suppose that $\wh{H}$ contains edges but not triangles, and suppose that $x, y \in \wh{H}$ are adjacent. If neither $x$ nor $y$ has any other neighbors in $H$, then only one of them would be in $\wh{H}$. Therefore either $x$ or $y$ has at least two, and therefore infinitely many, neighbors in $H$. So either $x$ or $y$ has infinitely many neighbors in $\wh{H}$. Thus there is a $z \in \wh{H}$ with $\wh{H} \cap N(z)$ infinite. We can therefore compute an infinite independent set, hence an $\mathsf{SRT}^2_2$-solution to $c$, uniformly from $G$ and $\wh{H}$ by searching for a $z \in \wh{H}$ with $|\wh{H} \cap N(z)| \geq 2$ and outputting $\wh{H} \cap N(z)$. We have just seen that such a $z$ exists. If $|\wh{H} \cap N(z)| \geq 2$, then $|H \cap N(z)| \geq 2$, so $H \cap N(z)$ is infinite, so $\wh{H} \cap N(z)$ is infinite. Finally, $\wh{H} \cap N(z)$ is independent because $\wh{H}$ contains no triangles. If $\wh{H}$ contains a triangle, then $H$ contains a triangle, so there are distinct $x, y \in H$ with $|H \cap N(x)| \geq 2$ and $|H \cap N(y)| \geq 2$. Then $H \cap N(x)$ and $H \cap N(y)$ are both infinite because $H$ is a $\mathsf{wRSg}$-solution to $G$. The coloring $c$ is stable, which means that $x$ and $y$ are adjacent to almost every vertex of $G$. Thus almost every vertex of $H$ is adjacent to both $x$ and $y$, and therefore is adjacent to almost every other vertex of $H$. Compute an infinite clique $K$ as in~(\ref{it-LPOwRSgr}), except this time start by searching for any distinct $x_0, x_1 \in H$ with $|H \cap N(x_0)| \geq 2$ and $|H \cap N(x_1)| \geq 2$. The resulting clique $K$ is an $\mathsf{SRT}^2_2$-solution to $c$. \end{proof} \begin{Corollary} $\mathsf{RT}^2_2 \leq_\mathrm{W} (\mathsf{LPO} \times \mathsf{LPO}) \ast \mathsf{wRSg} \ast \mathsf{COH}$. Therefore $\mathsf{RT}^2_2 \leq_\mathrm{W} \mathsf{wRSg} \ast \mathsf{wRSg} \ast \mathsf{wRSg}$. \end{Corollary} \begin{proof} We have that $\mathsf{RT}^2_2 \leq_\mathrm{W} \mathsf{SRT}^2_2 \ast \mathsf{COH}$, and $\mathsf{SRT}^2_2 \leq_\mathrm{W} (\mathsf{LPO} \times \mathsf{LPO}) \ast \mathsf{wRSg}$ by Theorem~\ref{thm-2LPOwRsg}. Therefore $\mathsf{RT}^2_2 \leq_\mathrm{W} (\mathsf{LPO} \times \mathsf{LPO}) \ast \mathsf{wRSg} \ast \mathsf{COH}$. That $\mathsf{RT}^2_2 \leq_\mathrm{W} \mathsf{wRSg} \ast \mathsf{wRSg} \ast \mathsf{wRSg}$ follows because $\mathsf{LPO} \times \mathsf{LPO} \leq_\mathrm{W} \mathsf{wRSg}$ and $\mathsf{COH} \leq_\mathrm{W} \mathsf{wRSg}$. Theorem~\ref{thm-COHredWRSG} gives us $\mathsf{COH} \leq_\mathrm{W} \mathsf{wRSg}$. It is straightforward to show that $\mathsf{LPO} \leq_\mathrm{W} \mathsf{RT}^1_2$ and that $\mathsf{RT}^1_2 \times \mathsf{RT}^1_2 \leq_\mathrm{W} \mathsf{RT}^1_4$ (see also~\cite{DoraisDzhafarovHirstMiletiShafer}*{Proposition~2.1}). Therefore \begin{align*} \mathsf{LPO} \times \mathsf{LPO} \leq_\mathrm{W} \mathsf{RT}^1_2 \times \mathsf{RT}^1_2 \leq_\mathrm{W} \mathsf{RT}^1_4 \leq_\mathrm{W} \mathsf{RT}^1_{<\infty} \leq_\mathrm{W} \mathsf{wRSg}, \end{align*} where the last reduction is by Proposition~\ref{prop-PHPredWRSG}. \end{proof} Hence three applications of $\mathsf{wRSg}$ (or of $\mathsf{wRSgr}$) suffice to obtain $\mathsf{RT}^2_2$. We do not know if two applications suffice. \begin{Question} Does $\mathsf{RT}^2_2 \leq_\mathrm{W} \mathsf{wRSg} \ast \mathsf{wRSg}$ hold? Does $\mathsf{RT}^2_2 \leq_\mathrm{W} \mathsf{wRSgr} \ast \mathsf{wRSgr}$ hold? \end{Question} \section*{Acknowledgments} We thank Jeffry Hirst, Steffen Lempp, Alberto Marcone, Ludovic Patey, and Keita Yokoyama for helpful discussions. We thank the \emph{Workshop on Ramsey Theory and Computability} at the University of Notre Dame Rome Global Gateway; Dagstuhl Seminar 18361: \emph{Measuring the Complexity of Computational Content: From Combinatorial Problems to Analysis}; and BIRS/CMO workshop 19w5111: \emph{Reverse Mathematics of Combinatorial Principles} for their generous support. This project was partially supported by a grant from the John Templeton Foundation (\emph{A new dawn of intuitionism: mathematical and philosophical advances} ID 60842). The opinions expressed in this work are those of the authors and do not necessarily reflect the views of the John Templeton Foundation.
\section{Introduction \label{sec:Introduction}} The homogeneous electron gas (HEG) has a special place in the history of the study of many-electron systems in general, and of density-functional theory in particular.\citep{Hohenberg1964, Kohn1965} In fact, the development of accurate exchange-correlation functionals typically begins with the local (spin) density approximation (LDA), whose construction is based on the exchange-correlation energy of the HEG. This is then modified by an enhancement factor that depends on the gradient of the density in the generalized gradient approximation (GGA); the mega-GGA approximation adds further dependence on the local kinetic energy density and/or the Laplacian of the electron density.\citep{Becke2014, Jones2015, Mardirossian2017a} LDAs, GGAs, and meta-GGAs form the first three rungs of the so-called Jacob's ladder of density functional theory,\cite{Perdew2001} each rung generally leading to approximations of better accuracy. Although GGAs and meta-GGAs add more physical information into the density functional approximation (DFA), they are typically constructed to maintain exactness for the exchange-correlation energy of the HEG. In fact, it can be even argued that this is one of the most important exact conditions that a functional should fulfill. In this work, we investigate the accuracy of an ansatz, which alike the LDA is derived from considerations of the HEG only, but which adds a further dependence on the local kinetic energy density, similarly to meta-GGAs. These functionals, which we term meta-LDA functionals, thus constitute a new rung on Jacob's ladder of functionals, that is shown to fall in accuracy between LDAs and GGAs. The work is organized as follows. We will describe the theory behind the meta-LDA approach in \secref{Theory}, and the implementation of the meta-LDA functionals and the details of our computations in \secref{Computational-Details}. The accuracy of the novel functionals is then assessed by benchmarking exchange energies of atoms and atomization energies of molecules in \secref{Results}. A brief summary and conclusions are presented in \secref{Conclusions}. Atomic units are used throughout the manuscript, unless specified otherwise. \section{Theory \label{sec:Theory}} The LDA for the exchange energy is derived for the HEG as\citep{Bloch1929, Dirac1930} \begin{equation} E_{x}^{\text{LDA}}[n]=-C_{x}\int n^{4/3}(\boldsymbol{r}){\rm d}^{3}r\label{eq:lda} \end{equation} where \begin{equation} C_{x}=\frac{3}{4}\left(\frac{3}{\pi}\right)^{1/3}.\label{eq:Cx} \end{equation} The kinetic energy density of the gas is also known, \begin{equation} \tau^{\text{HEG}} = C_F n^{5/3}\label{eq:tau-lda} \end{equation} where \begin{equation} C_{F}=\frac{3}{10}(3\pi^{2})^{2/3}.\label{eq:Cf} \end{equation} Since \eqref{tau-lda} establishes a link between the kinetic energy density and the electron density, \citet{Ernzerhof1999a} proposed an exchange functional similar to \eqref{lda} where \eqref{tau-lda} is used to replace the local density dependence by \begin{equation} \tilde{n}(\boldsymbol{r})=\left[\frac{\tau(\boldsymbol{r})}{C_F}\right]^{3/5}\label{eq:ntau} \end{equation} yielding the local $\tau$ approximation (LTA) exchange functional \begin{align} E_{x}^{\text{LTA}}[\tau] & =-C_{x}\int\left[\frac{\tau(\boldsymbol{r})}{C_{F}}\right]^{4/5}{\rm d}^{3}r.\label{eq:lta} \end{align} Based on the work of \citeauthor{Ernzerhof1999a}, \citet{Eich2014} suggested another exchange functional where only the energy per unit particle is written as a function of the fictitious density of \eqref{ntau}, yielding the tLDA exchange functional \begin{align} E_{x}^{\text{tLDA}}[n,\tau] & =-C_{x}\int n(\boldsymbol{r})\tilde{n}^{1/3}(\boldsymbol{r}){\rm d}^{3}r.\label{eq:tlda} \end{align} In this work, we show the power of this idea by generalizing the approach of Ernzerhof, Scuseria, Eich, and Hellgren. We thus replace the electron density by an effective density $n^\text{eff}({\bf r})$ formed as a weighted combination of the electron density $n(\boldsymbol{r})$ and the fictitious density computed from $\tau(\boldsymbol{r})$ as \begin{equation} n(\boldsymbol{r})\to n^{\text{eff}}(\boldsymbol{r})=\tilde{n}^{x}(\boldsymbol{r})n^{1-x}(\boldsymbol{r}).\label{eq:wdens} \end{equation} This form interpolates between the LDA ($x=0$), tLDA ($x=1/4$) and LTA ($x=1$) in the case of the exchange functional. Furthermore, it can also be employed within any LDA correlation functional, allowing us to generate a complete exchange-correlation ansatz. We note here that the family of functionals generated by \eqref{wdens} is actually a member of a general family of functionals that have the form of an LDA, but which are based on a transformed density variable \begin{align} n(\boldsymbol{r}) \rightarrow n(\boldsymbol{r}) f^\text{mLDA}(t(\boldsymbol{r})), \label{eq:densmlda} \end{align} where $t(\boldsymbol{r})$ is the (dimensionless) reduced kinetic energy density \begin{equation} t(\boldsymbol{r})=\frac{\tau(\boldsymbol{r})}{n^{5/3}(\boldsymbol{r})}.\label{eq:t} \end{equation} It is easily seen that LDA functionals operating on a density transformed according to \eqref{densmlda} are exact for the HEG if the function $f^\text{mLDA}$ reduces to one for the HEG, i.e. \begin{equation} f^\text{mLDA}(C_F) = 1 \,. \end{equation} Because this procedure generates a meta-GGA-type functional without gradient dependence from a LDA, we will term these functionals meta-LDAs. \section{Computational Details\label{sec:Computational-Details}} The effective density of \eqref{wdens} can be rewritten in the form of \eqref{densmlda} as \begin{align} f(t) & =\left(\frac{t}{C_F}\right)^{3x/5} \,. \label{eq:n-reduced} \end{align} The resulting meta-LDA version of the local exchange functional can be easily rewritten in terms of an enhancement function \begin{equation} F(t;x) = \left[\left(\frac{t}{C_F}\right)^{3x/5}\right]^{4/3}=\left(\frac{t}{C_F}\right)^{4x/5}.\label{eq:Fx-geom} \end{equation} The generalization of the Perdew--Wang 1992 correlation functional\citep{Perdew1992a} is equally trivial; the density used to evaluate the energy density is merely re-expressed using \eqref{wdens}. These new functionals have been implemented in version 5.1.0 of the \textsc{Libxc} library of exchange-correlation functionals.\citep{Lehtola2018} In \textsc{Libxc}, the derivatives of the functional are evaluated analytically using the \textsc{Maple} symbolic algebra program, as is the case for all other functionals in \textsc{Libxc} as well. Combined with a basis set, these derivatives can be used to minimize the total energy variationally with respect to the orbital coefficients within a self-consistent field approach; we refer to \citeref{Lehtola2020} for discussion. Fully numerical,\citep{Lehtola2019c} fully variational calculations on closed and partially closed shell atoms from H to Sr were performed with the finite element method as implemented in the \textsc{HelFEM} program,\citep{Lehtola2019a} which allows for an efficient approach to the complete basis set limit.\citep{Lehtola2019e, Lehtola2020c} The atomic calculations employed five radial elements, yielding 139 numerical radial basis functions which suffice to converge the energy to better than $\mu E_h$ precision for these systems. Molecular calculations on the 183 non-multireference molecules in the W4-17 dataset\citep{Karton2017} were performed with the \textsc{Psi4} program.\citep{Smith2020} The \textsc{Psi4} calculations employed the quadruple-$\zeta$ aug-pcseg-3 basis set,\citep{Jensen2001, Jensen2002b, Jensen2014} and a $(100,590)$ quadrature grid. Density fitting\citep{Sambe1975} was used to accelerate the \textsc{Psi4} calculations; a universal auxiliary basis set was used for this purpose.\citep{Weigend2008} \section{Results\label{sec:Results}} \subsection{Atomic calculations\label{subsec:Atomic-calculations}} The errors of exchange-only density functional calculations compared to unrestricted Hartree--Fock (HF) total and exchange energies for atoms from H to Sr were studied with \textsc{HelFEM}; the reference unrestricted HF total energies have been recently reported in \citeref{Lehtola2020c}. Due to the similarity of the results, data is shown here only for the noble gases Ne, Ar, and Kr in \figref{noble}; the rest of the data can be found in the Supporting Information. In addition to the self-consistent data, \figref{noble} also shows the perturbative evaluation of the exchange energy computed on top of the HF density. Following \citet{Becke1988a} and \citet{Sun2015} among others, we fit the parameter $x$ for our meta-LDAs by optimizing the total energy of the argon atom to the Hartree--Fock reference value, leading to the choice $x=0.50$. It is noteworthy that in addition to being quasi-optimal for all systems, $x=0.50$ is also numerically stable for all the studied atoms. Finally, it also leads to uniformly smaller errors in the exchange energy than in the LDA and tLDA, which uniformly underestimate the energy, while LTA grossly overestimates the energy. As was already implied above, the self-consistent calculations diverge for large fractions $x$ of the LTA density. We have analyzed the instability observed in the calculations; see the Appendix for a formal analysis. It turns out that the functional form is inherently unstable for $x>0.625$, since for such values of $x$ the potentials corresponding to both $n$ and $\tau$ diverge asymptotically to $-\infty$ for $r \to \infty$. However, it is clear from the results that the optimal value $x$ for the exchange functional is found at $x<0.625$. \begin{figure*} \subfloat[Ne]{\begin{centering} \includegraphics[width=0.33\textwidth]{figs/Ne} \par\end{centering} }\subfloat[Ar]{\begin{centering} \includegraphics[width=0.33\textwidth]{figs/Ar} \par\end{centering} }\subfloat[Kr]{\begin{centering} \includegraphics[width=0.33\textwidth]{figs/Kr} \par\end{centering} } \caption{Errors in self-consistent total (blue solid line) and exchange (red solid line) energies of Ne, Ar, and Kr, as well as in the perturbative exchange energy calculated on top of the HF density (dashed red line). The vertical dashed blue line shows the critical value $x=0.625$, see main text. The location of the smallest error for the self-consistent total and exchange energies are shown as the blue and red squares, respectively, and the one for the perturbative exchange energy as red diamonds; however, since the optimal value is close to $x=1/2$ for all cases, the markers are on top of each other. \label{fig:noble}} \end{figure*} \subsection{Molecular calculations\label{subsec:Molecular-calculations}} \begin{table*} \caption{Mean absolute error (MAE) and mean error (ME) in atomization energies of the non-multireference part of the W4-17 test set, computed in the aug-pcseg-3 basis with density fitting and a (100,590) grid. The data is divided into exchange-only calculations (\ref{tab:xfunc}), and calculations including both exchange and correlation (\ref{tab:xcfunc}). See the main text for the legend of the functionals shown. To clarify the notation, the used values for $x$ in the meta-LDA exchange and correlation functionals are also shown. } \begin{centering} \subfloat[Results for exchange-only calculations. \label{tab:xfunc}]{\begin{centering} \begin{threeparttable} \begin{tabular}{llr@{\extracolsep{0pt}.}lr@{\extracolsep{0pt}.}l} Functional & $x$ & \multicolumn{2}{c}{MAE (kcal/mol)} & \multicolumn{2}{c}{ME (kcal/mol)}\tabularnewline \hline LDA exchange & & 28&966 & -12&015\tabularnewline \hline hLTA exchange$^{a}$ & $1/2$ & 71&235 & -67&512\tabularnewline tLTA exchange & $1/3$ & 47&504 & -35&863\tabularnewline qLTA exchange$^{b}$ & $1/4$ & 42&181 & -26&070\tabularnewline \hline HF & & 144&848 & -144&848\tabularnewline B88 exchange & & 98&177 & -98&177\tabularnewline PBE exchange & & 87&958 & -87&958\tabularnewline \hline \hline \end{tabular} \begin{tablenotes} \item [$^{a}$] The data for the exchange-only hLTA calculation excludes \ce{CH2NH2} for which the SCF procedure did not converge. \item [$^{b}$] qLTA is the same as the tLDA of \citeauthor{Eich2014}. \end{tablenotes} \end{threeparttable} \par\end{centering} } \par\end{centering} \begin{centering} \subfloat[Results for exchange-correlation functionals. \label{tab:xcfunc}]{\begin{centering} \begin{threeparttable} \begin{tabular}{lllr@{\extracolsep{0pt}.}lr@{\extracolsep{0pt}.}l} Functional & $x_{\text{exchange}}$ & $x_{\text{correlation}}$ & \multicolumn{2}{c}{MAE (kcal/mol)} & \multicolumn{2}{c}{ME (kcal/mol)}\tabularnewline \hline LDA-PW92 & & & 79&879 & 79&879\tabularnewline \hline qLTA-qPW92 & $1/4$ & $1/4$ & 61&089 & 60&897\tabularnewline tLTA-tPW92 & $1/3$ & $1/3$ & 50&207 & 49&494\tabularnewline hLTA-PW92 & $1/2$ & $0$ & 31&388 & 23&913\tabularnewline hLTA-hPW92 & $1/2$ & $1/2$ & 26&907 & 14&088\tabularnewline \hline B88-P86 & & & 19&173 & 18&899\tabularnewline PBE-PBE & & & 18&028 & 17&052\tabularnewline TPSS-TPSS & & & 12&427 & 11&180\tabularnewline B88-LYP & & & 8&176 & 1&714\tabularnewline \hline \hline \end{tabular} \end{threeparttable} \par\end{centering} } \par\end{centering} \label{tab:Errors-in-atomization} \end{table*} The application of the functional to atomization energies \begin{equation} E^{\text{at}}=\left[\sum_{\text{atoms }A}E(A)\right]-E(\text{molecule})\label{eq:Eat} \end{equation} of the non-multireference part of W4-17 yields the errors \begin{equation} \Delta E^{\text{at}}=E^{\text{at}}(\text{DFT})-E^{\text{at}}(\text{W4-17})\label{eq:dEat} \end{equation} shown in \tabref{Errors-in-atomization}. Due to the higher cost of the molecular calculations compared to the atomic ones, the new family of meta-LDA functionals is only studied at select points which suffice for the present purposes of showing the proof of concept. The points at which the meta-LDAs are evaluated are indicated by a prefix to the name of the exchange and correlation functionals: data are presented for the LDA exchange functional as qLTA (same as \citeauthor{Eich2014}'s tLDA), tLTA, and hLTA, which stand for for $x=1/4$, $x=1/3$, and $x=1/2$, respectively. Data is given both for exchange-only calculations, and for combinations with the Perdew--Wang (PW92) correlation functional\citep{Perdew1992a} that also admits meta-LDA generalizations to qPW92, tPW92 and hPW92 for $x=1/4$, $x=1/3$, and $x=1/2$, respectively. For comparison, data is also included for the Perdew--Burke--Ernzerhof exchange-correlation functional;\citep{Perdew1996, Perdew1997} combinations of the Becke'88 (B88) exchange functional,\citep{Becke1988a} with the Perdew'86\citep{Perdew1986, Perdew1986b} (P86) and Lee--Yang--Parr\citep{Lee1988} (LYP) correlation functionals; as well as the Tao--Perdew--Staroverov--Scuseria (TPSS) exchange-correlation functional.\citep{Tao2003, Perdew2004} Starting out with the basics, the table demonstrates the well-known characteristics of HF and LDA: HF severely underbinds molecules due to the complete neglect of electronic correlation effects, while LDA overbinds them. Due to the overbinding, exchange-only LDA calculations are more accurate than those that explicitly include also correlation contributions, although LDA exchange by itself is slightly underbinding. In contrast, while the gradient-corrected exchange functionals yield bad results if used alone, when they are combined with a good gradient-corrected correlation functional they achieve good accuracy. Jacob's ladder\citep{Perdew2001} is also visible in the results: more accurate atomization energies are obtained in the sequence LDA $\to$ PBE $\to$ TPSS. Also the meta-LDA functionals interestingly show monotonic behavior. Going from LDA to qLTA to tLTA and, finally, hLTA in exchange-only calculations leads to systematically increasing underbinding. The same effect holds also in the presence of correlation: while LDA-PW92 is greatly overbinding, as was already established above, the overbinding decreases systematically in the sequence LDA-PW92 $\to$ qLTA-qPW92 $\to$ tLTA-tPW92 $\to$ hLTA-hPW92. Like in the case of the atomic exchange energies, the half-and-half $x=1/2$ mixture of the electron density with the $\tau$-based density as in the hLTA-hPW92 functional yields the best results with a mean absolute error almost three times smaller than in the original LDA-PW92 calculation. This finding is underlined by the error histograms shown in \figref{Errors-in-atomization}: while LDA-PW is consistently overbinding, the errors for hLTA-hPW are almost symmetric, even though the error scale is still large compared to established GGA functionals. \begin{figure*} \subfloat[LDA-PW]{\begin{centering} \includegraphics[width=0.5\textwidth]{figs/lda} \par\end{centering} }\subfloat[hLTA-hPW]{\begin{centering} \includegraphics[width=0.5\textwidth]{figs/hlta_hpw} \par\end{centering} } \caption{Error histograms for the atomization energies of the non-multireference part of W4-17 in the aug-pcseg-3 basis set.\label{fig:Errors-in-atomization}} \end{figure*} \section{Summary and Conclusions \label{sec:Conclusions}} We have proposed a new class of functionals as generalizations of the established class of local density approximations (LDAs) by including a fraction $x$ of fictitious density computed from the local kinetic energy density via a relation derived for the homogeneous electron gas (HEG). The resulting so-called meta-LDA functionals maintain the exactness of LDA for the HEG, and are derived from HEG data only (with the exception of the one parameter $x$ that is fitted to the total exchange-only energy of the argon atom), but afford much improved accuracy for inhomogeneous systems, thus forming a new rung on Jacob's ladder of density functionals in-between LDAs and GGAs. Benchmarks on both perturbative and self-consistent atomic exchange energies, as well as molecular atomization energies in the presence of a correlation functional showed that the half-and-half ratio $x=1/2$ yields quasi-optimal results for both atoms and molecules, almost fully eliminating the overbinding of LDA and reducing the mean absolute error in the atomization energies to a third of the original. Meta-LDAs could also been seen as a better starting point for the inclusion of an extra dependency in the gradient of the density (as in a standard GGA), and in the Laplacian of the density and the kinetic energy density (as in a standard meta-GGA). Due to the extra flexibility we can expect that these will be better performing than the parent functionals. For example, the new degree of freedom introduced with the meta-LDAs could play an important role for, e.g., semi-empirical functionals fitted to experimental data. In many of these cases (see for example on \citerefs{Becke1997, Boese2000, Verma2017}), the functionals do not reduce to the LDA for homogeneous densities, as this would compromise the accuracy of the functional for other systems. By replacing the standard LDA by a meta-LDA form in full or in part on could, in principle, obey the exact condition without compromising accuracy, and at the same time increase the transferability of the functionals to solids. Of course, the GGA or meta-GGA enhancement functionals has to be redesigned (or at least re-optimized) to take the new form into account. Work along these lines has already started. \section*{Appendix: instability of the local tau approximation} The Kohn--Sham electron density is known to behave asymptotically as $n({\bf r}) \propto \exp(-2\sqrt{-2 \epsilon_\text{HOMO}}r)$ due to the highest occupied molecular orbital (HOMO) which behaves as $\psi_\text{HOMO} \propto \exp(-\sqrt{-2\epsilon_\text{HOMO}}r)$.\cite{Katriel1980} For simplicity, we will study hydrogenic orbitals of the form \begin{equation} \psi_\sigma ({\bf r}) = \frac {2 \zeta^{3/2} \exp(-\zeta r)} {\sqrt{4\pi}} \label{eq:asymptotic} \end{equation} to show that the exponentially decaying asymptotic region leads to problems for $r \to \infty$ for the local tau exchange functional. The electron density of the wave function in \eqref{asymptotic} is \begin{equation} n_\sigma ({\bf r}) = \frac {\zeta^{3} \exp(- 2\zeta r)} {\pi}, \label{eq:den} \end{equation} while the kinetic energy density is \begin{equation} \tau_\sigma ({\bf r}) = \frac 1 2 \sum_i |\nabla \psi({\bf r})|^2 = \frac {\zeta^5 \exp(-2\zeta r)}{2 \pi}. \label{eq:tau} \end{equation} The self-consistent implementation of the meta-LDAs is based on the potentials $v_n^\sigma$ and $v_\tau^\sigma$, which are defined as the derivatives of the exchange energy density arising from the substitution of \eqref{wdens} into \eqref{lda} with respect to $n_\sigma$ and $\tau_\sigma$, respectively.\cite{Lehtola2020} It is easy to show using e.g. computer algebra (we used \textsc{Maple 2020} to obtain these results) that when evaluated on an electron density and kinetic energy density of the form of \eqref{den, tau}, both of the potentials $v_n^\sigma$ and $v_\tau^\sigma$ contain a factor of the form $\exp\left[ (16x-10)r\zeta/15 \right]$, which diverges in the limit $r\to \infty$ whenever $x > x_\text{crit}$ with the critical value $x_\text{crit} = 5/8 = 0.625$. Interestingly, also the choice of a HOMO with a Gaussian form $\psi_\sigma \propto \exp(-\zeta r^2)$ leads to divergent potentials---only now of a stronger kind $\exp\left[ (16x-10)r^2\zeta/15 \right]$---and yields the same critical value $x_\text{crit}=5/8$. In fact, it can be shown that \emph{all} asymptotic wave functions of the kind $\psi_\sigma \propto \exp(-\zeta r^p)$ with $p>0$ lead to divergences of the kind $\exp\left[ (16x-10) \zeta r^p /15 \right]$ in $v_n^\sigma$ and $v_\tau^\sigma$. The total exchange energy, however, is finite in each case. For $x>x_\text{crit}$ one then has $v_n^\sigma \to -\infty$ and $v_\tau^\sigma \to -\infty$ for $r \to \infty$, because the potentials are negative everywhere (as expected for an exchange functional). This divergence causes convergence problems. Assuming an orthonormal basis set $\{\chi_\mu\}$, the potentials $v_n^\sigma$ and $v_\tau^\sigma$ contribute to the Kohn--Sham--Fock matrix as\cite{Lehtola2020} \begin{widetext} \begin{equation} F^\sigma_{\mu \nu} \propto \int \left[ v_n^\sigma ({\bf r}) \chi_\mu ({\bf r}) \chi_\nu ({\bf r}) + \frac 1 2 v_\tau^\sigma ({\bf r}) \left[ \nabla \chi_\mu ({\bf r}) \cdot \nabla \chi_\nu ({\bf r}) \right] \right] {\rm d}^3r. \label{eq:Ftau} \end{equation} \end{widetext} The tentative physical interpretation of the divergent negative potentials is that displacing electron density toward $r \to \infty$ would lead to a decrease in the energy. Now, if a Gaussian-type or Slater-type orbital basis set is employed, $\chi_\mu$ and its gradient will decay asymptotically as $\exp(-\alpha_\mu r^2)$ or $\exp(-\zeta_\mu r)$, respectively, where $\alpha_\mu$ and $\zeta_\mu$ are the Gaussian and Slater-type exponent, with analogous expressions for $\nabla \chi_\nu$. Evaluating \eqref{Ftau} then requires quadrature of an expression with an exponentially decaying part and an exponentially increasing part, which is numerically unstable, as the resulting value may be either small or large. The finite element calculations with \textsc{HelFEM}, in turn, feature localized basis functions also at large values of $r$. This leads to exponentially increasing elements of the Kohn--Sham--Fock matrix, making the self-consistent field algorithm unstable. In contrast, the potentials arising in the asymptotic region for $x<0.625$ decay exponentially (like they do in the local density approximation), making self-consisistent field calculations stable. \section*{Acknowledgments} This work has been supported by the Academy of Finland (Suomen Akatemia) through project number 311149. Computational resources provided by CSC -- It Center for Science Ltd (Espoo, Finland) and the Finnish Grid and Cloud Infrastructure (persistent identifier urn:nbn:fi:research-infras\-2016072533) are gratefully acknowledged. \section*{Data Availability} The data that supports the findings of this study are available within the article and its supplementary material. \section*{Supporting Information} \input{supplement_text.tex}
\section{#1}} \newcommand{\nsubsection}[1]{\subsection{#1}} \newcommand{\nsubsubsection}[1]{\subsubsection{#1}} \else \newcommand{\ncaption}[1]{\small\caption{#1}} \newcommand{\nsection}[1]{\vspace{-0.40cm}\section{#1}\vspace{-0.3cm}} \newcommand{\nsubsection}[1]{\vspace{-0.4cm}\subsection{#1}\vspace{-0.15cm}} \newcommand{\nsubsubsection}[1]{\vspace{-0.3cm}\subsubsection{#1}\vspace{-0.15cm}} \fi \input{math_commands.tex} \hypersetup{ colorlinks, linkcolor={green!80!black}, citecolor={red!70!black}, urlcolor={blue!70!black} } \begin{document} \date{} \title{\Large \bf Towards Robust LiDAR-based Perception in Autonomous Driving: General Black-box Adversarial Sensor Attack and Countermeasures} \author{ {\rm Jiachen Sun}\\ University of Michigan\\ \href{mailto:<EMAIL>}{<EMAIL>} \and {\rm Yulong Cao}\\ University of Michigan\\ \href{mailto:<EMAIL>}{<EMAIL>} \and {\rm Qi Alfred Chen} \\ UC Irvine\\ \href{mailto:<EMAIL>}{<EMAIL>} \and {\rm Z. Morley Mao}\\ University of Michigan\\ \href{mailto:<EMAIL>}{<EMAIL>} } \maketitle \input{sections/Abstract.tex} \input{sections/Introduction.tex} \input{sections/Background.tex} \input{sections/Threat_Model.tex} \input{sections/Limitations.tex} \input{sections/Vulnerability.tex} \input{sections/Attack.tex} \input{sections/Ad_Defense.tex} \input{sections/Ml_Defense.tex} \input{sections/Discussion.tex} \input{sections/Related_Works.tex} \input{sections/Conclusion.tex} \renewcommand{\bibfont}{\footnotesize} \bibliographystyle{abbrv} \subsubsection{Hierarchies} \nsubsubsection{Hierarchy Design} To achieve both robustness and efficiency, CARLO hierarchically integrates FSD and LPD. In the first stage, CARLO accepts the detected bounding boxes and leverages LPD to filter the unquestionably fake and valid vehicles by two thresholds (\S\ref{ltd}). The rest bounding boxes are uncertain and will be further fed into FSD for final checking. CARLO achieves around 8.5 ms mean processing time for each vehicle. The entire algorithm of CARLO is detailed in Appendix \ref{ap:algorithm}. \nsubsection{CARLO Evaluation} \textbf{Experimental setup.} We evaluate the defense performance of CARLO on the KITTI trainval and test sets. We apply all the attack traces from $\mathcal{K},\mathcal{R}$ to all point cloud samples at target locations (5-8 meters in front of the victim), and feed them into three CARLO-guarded models $\mathsf{CARLO}(\mathcal{M}(\cdot))$. We also evaluate CARLO against Adv-LiDAR~\cite{cao2019adversarial} on Apollo 5.0. The defense goal is to successfully detect the spoofed fake vehicles from the output bounding boxes without hurting the original performance (\textit{i.e.,}\xspace AP) of the target models. \begin{figure}[!tp] \vspace{-0.4cm} \centering \subfigure[CARLO-guarded Apollo 5.0.]{ \begin{minipage}[t]{0.49\linewidth} \centering \includegraphics[width=4cm]{images/usenix_ad_apollo.pdf} \end{minipage} }% \subfigure[CARLO-guarded PointPillars.]{ \begin{minipage}[t]{0.49\linewidth} \centering \includegraphics[width=4cm]{images/usenix_ad_pointpillars.pdf} \end{minipage}% }% \vskip 0pt \vspace{-0.3cm} \subfigure[CARLO-guarded PointRCNN.]{ \begin{minipage}[t]{0.49\linewidth} \centering \includegraphics[width=4cm]{images/usenix_ad_pointrcnn.pdf} \end{minipage} }% \subfigure[Precision and recall of CARLO.]{ \begin{minipage}[t]{0.49\linewidth} \centering \includegraphics[width=4cm,height=2.4cm]{images/usenix_ad_pr.png} \end{minipage} }% \centering \vspace{-0.2cm} \caption{Attack success rates ($ASR$s) of proposed black-box spoofing attacks on three CARLO-guarded models.} \label{fig:asr_rhd} \vspace{-0.5cm} \end{figure} \textbf{Evaluation metrics.} We evaluate the performance of CARLO in two aspects, which are the $ASR$ of the CARLO-guarded models, and the precision and recall of CARLO itself. $ASR$ directly relates to the defense performance, while the precision and recall of CARLO reflect whether it will harm the original AP of target models. We test the $ASR$ on the validation set and test set since the distributions are estimated from the training set. We only evaluate the precision and recall of CARLO on the validation set as we do not have the ground-truth for the test set. Figure \ref{fig:asr_rhd} (a-c) shows the $ASR$ of three CARLO-guarded models. As shown, CARLO reduces the $ASR$ from more than 95\% to below 9.5\% with the maximum attack capability, and reduce the mean $ASR$ to around 5.5\%. \CR{We observe that the remaining 5.5\% comes from the detection errors (\textit{i.e.,}\xspace the detected bounding box of the fake vehicle cannot match well with the ground-truth) that shift the $f'$ and $g'$ to the distribution of valid vehicles.} The errors occur randomly in the point clouds so that it is hard for adversaries to utilize. The recall in Figure \ref{fig:asr_rhd} (d) reaches around 95\% in all targets models which also validate the results in Figure \ref{fig:asr_rhd} (a-c). \begin{table}[t] \captionsetup{font=small} \footnotesize \caption{PointPillars' and PointRCNN's APs (\%) of 3D car detection on the KITTI validation set. ``Mod.'' refers to the Moderate category introduced in \S\ref{background_kitti}; ``Original'' refers to the original performance of two models; ``Attack'' refers to the performance after spoofing attacks; ``CARLO'' refers to the performance after CARLO applied.} \vspace{-0.1in} \centering \begin{tabular}{|c|c|c|c|c|c|c|} \hline \multirow{2}*{Model} & \multicolumn{3}{ c |}{PointPillars} & \multicolumn{3}{ c |}{PointRCNN} \\ \cline{2-7} & Easy & Mod. & Hard & Easy & Mod. & Hard \\ \hline \hline Original & 86.56 & 76.87 & 72.09 & 88.80 & 78.58 & 77.64 \\ \hline Attack & 74.06 & 56.69 & 53.98 & 84.51 & 71.17 & 68.06 \\ \hline CARLO & 86.57 & 78.60 & 73.55 & 88.91 & 78.61 & 77.63 \\ \hline \end{tabular} \label{tb:model_og_performance} \vspace{-0.5cm} \end{table} Besides delivering satisfactory defense performance, CARLO barely introduces misdetections (\textit{i.e.,}\xspace false negatives) to the models. Figure \ref{fig:asr_rhd} (d) shows that the precision of anomaly detection reaches at least 99.5\% for all target models. We manually verify the 0.5\% misdetections, and find they are all vehicles at least 40 meters away from the AV, which will not affect its immediate driving behavior. Table \ref{tb:model_og_performance} also shows that the AP will slightly increase after CARLO being applied to the original model because the original model has internal false positives such as detecting a flower bed as a vehicle. CARLO detects some of those false positives generated by the original model. \nsubsubsection{Defense against White-box and Adaptive Attacks} To further evaluate CARLO against white-box attacks, we first leverage Adv-LiDAR to generate adversarial examples that fool Apollo 5.0 and test whether they can succeed in attacking CARLO-guarded Apollo 5.0. Figure \ref{fig:white_box_rhd} demonstrates that CARLO can effectively defend Adv-LiDAR, where the $ASR$ drops from more than 95\% to below 5\% consistently. We observe that the defense effects are better than the results shown in Figure~\ref{fig:asr_rhd} (a). We find out that Adv-LiDAR tends to translate the attack traces to a slightly higher place along $z$ axis. Such translations will isolate the adversarial examples in the point cloud, making themselves easier to be detected by CARLO. We also try our best efforts to evaluate CARLO on the adaptive attacks. We assume attackers are aware of the CARLO pipelines and utilize Adv-LiDAR to break CARLO's defense. Due to the sensor attack capability, adversaries have limited ability to modify the absolute free space ($\sum_{\,c \in \mathsf{B}}\mathds{1} \cdot FS(c)$) in Equation \ref{eq:fsd}. However, attackers can try to shrink the volume of the bounding box ($|\mathsf{B}|$) to shift the distribution of $f'$, since it is controlled purely by models. Therefore, the attack goal is to spoof a vehicle at target locations at the same time, minimize the size of the bounding box. We formulate the loss function and follow Adv-LiDAR~\cite{cao2019adversarial} to utilize a global transformation matrix $H(\theta,\tau)$ (Equation~\ref{eq:trans}) for solving the optimization problem: \CR{ \begin{equation} \begin{split} & \min_{\theta,\tau} \qquad {\mathcal{L}} (x \oplus V \cdot H(\theta,\tau)^{T}) + \lambda \cdot {\mathcal{V}}_{B} ( V \cdot H(\theta,\tau)^{T}) \end{split} \label{eq:adaptive_1} \end{equation} where ${\mathcal{L}}(\cdot)$ is the loss function defined in Adv-LiDAR~\cite{cao2019adversarial}, ${\mathcal{V}}_{B}(\cdot)$ is the volume of the target bounding box $B$, and $\lambda$ is a hyper-parameter.} Figure~\ref{fig:adaptive_rhd} shows that such adaptive attacks cannot break CARLO, either. We attribute the reason to $H(\theta,\tau)$ that holistically modifies the spoofed points so that it can barely change the size of the bounding box. \begin{figure}[t] \vspace{-0.3cm} \begin{minipage}[t]{0.49\linewidth} \centering \includegraphics[width=\linewidth]{images/usenix_whitebox_ad.pdf} \caption{Attack success rates ($ASR$s) of Adv-LiDAR on Apollo 5.0 and CARLO-guarded model.} \label{fig:white_box_rhd} \end{minipage \hfill \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=\linewidth]{images/usenix_ad_adaptive.pdf} \caption{Attack success rate ($ASR$) of the adaptive attack on CARLO-guarded Apollo 5.0.} \label{fig:adaptive_rhd} \end{minipage} \vspace{-0.5cm} \end{figure} \subsection{Digital Spoofing Attack} \emph{1. Constructing original attack traces.} As demonstrated in \S\ref{vulnerability_id}, occluded or distant vehicles' point sets that meet the sensor attack capability can be utilized to spoof front-near vehicles. Therefore, our methodology attempts to closely represent realistic physical attacks using traces from real-world datasets (\textit{e.g.,}\xspace KITTI). In order to test different sensor attack capability, we extract occluded vehicles' point sets with varying numbers of points (5-200 points) from the KITTI validation set. Furthermore, we take 10 points as interval, and divide the extracted point sets into 20 groups per their number of points (The first group contains traces with the number of points from 0 to 10, and the second group contains traces with the number of points from 10 to 20, \textit{etc.}\xspace). We then randomly pick five traces in each group forming a small dataset $\mathcal{K}$ containing 100 point sets. Besides collecting existing real-world traces, the identified vulnerability also supports adversaries in generating customized attack traces, which are more efficient for pipelining the attack process. We leverage ray-casting techniques to generate customized attack traces. More specifically, we utilize a 3D car mesh and implement a renderer~\cite{cao2019adversarial2} simulating the function of a LiDAR sensor that probes the car mesh by casting lasers. By doing so, we can render the car mesh's point cloud. We further simulate different occlusion and sparsity patterns on the car mesh to fit the sensor attack capability, as shown in Figure \ref{fig:render}. Similar to $\mathcal{K}$, we collect rendered point clouds with different numbers of points by using different postures and occlusion patterns. We also follow the same procedure to build a small dataset $\mathcal{R}$ containing 100 rendered point sets. More figures of $\mathcal{R}$ are shown in Appendix \ref{ap:figure}. \emph{2. Spoofing original attack traces at target locations.} To trigger severe security and safety consequences, adversaries need to inject the constructed attack traces at target locations in the point cloud. We consider spoofing $\mathcal{K}$ and $\mathcal{R}$ in both digital and physical environments. For digital spoofing, we make sure the injection of attack traces meets the sensor attack capability $\mathcal{A}$ and real-world requirements. We follow the high-level formulation in Adv-LiDAR~\cite{cao2019adversarial} utilizing a global transformation matrix $H(\theta,\tau)$ (Equation \ref{eq:trans}) to translate the attack traces (\textit{i.e.,}\xspace ${V'}^{T} = H(\theta,\tau)\cdot V^{T}$, where $V \in \mathcal{K} \cup \mathcal{R}$). Here the translation interprets the attack capability ($\mathcal{A}$) in terms of modifying the \emph{azimuth} and \emph{distance} of attack traces. We further calibrate each point in the translated attack trace to its nearest laser ray's direction and prune the translated attack trace to fit the attack capability (\textit{i.e.,}\xspace $V' \in \mathcal{A}$). Finally, we merge the attack trace with the pristine point cloud according to the physics of LiDAR. We feed the modified point cloud samples containing the attack traces into three target models. For physical spoofing, we program attack traces from $\mathcal{R}$ as input to the function generator so that we can control the spoofed points and launch the spoofing attack~\cite{shin2017illusion} in our lab. We further collect the physical attack traces and feed them into target models. Due to the limitation of our attack devices, we only conduct preliminary physical spoofing experiments. More details of physical spoofing can be found in \S\ref{practi}. It is worth noting that such limitations do not hurt the validity of our attack model (\S\ref{threat}) since the attack capability $\mathcal{A}$ is adopted from Adv-LiDAR~\cite{cao2019adversarial}, in which has been demonstrated in the real world. \nsubsection{Attack Evaluation and Analysis} \label{attack_analysis} We perform large-scale evaluations on our proposed black-box attack in terms of effectiveness and robustness. \textbf{Experimental setup.} \CR{The evaluations are performed on the KITTI trainval and test sets (introduced in~\S\ref{background_kitti}), which are collected in the physical world. As mentioned before, limited by our attack devices, we leverage $\mathcal{K},\mathcal{R}$ to launch \textit{digital spoofing} attacks. We also utilize attack traces ($\mathcal{S}$) generated by the sensor-level spoofing attack (\S\ref{limitations_existing}) as a baseline. $\mathcal{S}$ is collected from blindly \textit{physical spoofing} attacks on a real Velodyne VLP-16 PUCK LiDAR~\cite{vpl16}. We further inject all the attack traces from above three constructed datasets into the KITTI point clouds at front-near locations (\textit{i.e.,}\xspace 5-8 meters in front of the victim AV) to test their effectiveness.} \textbf{Evaluation metrics.} Object detection models often have default thresholds for confidence scores to filter out detected objects with low confidence (potential false positives). We leverage the default thresholds used by three target models to measure the attack success rate ($ASR$). We label an attack successful as long as the model detects a vehicle at the target location whose confidence score exceeds the default threshold: \begin{equation} ASR = \frac{\mathrm{\#\; of\; successful\; attacks}}{\mathrm{\#\; of\; total\; point\; cloud\; samples}} \label{eq:asr} \end{equation} Besides the default threshold, we also define a new metric that leverages multiple thresholds to evaluate LiDAR spoofing attacks. The corresponding definitions and evaluations are described in Appendix \ref{ap:attack_eval}, which provide insights that point-wise features appear to be more robust than voxel-based features. \nsubsubsection{Attack Effectiveness} \label{attack_effe} Figure \ref{fig:asr_all} shows the $ASR$ of the digital spoofing attack with different attack capabilities (\textit{i.e.,}\xspace number of points). As expected, the $ASR$ increases with more spoofed points. The $ASR$s are able to universally achieve higher than 80\% in all target models with more than 60 points spoofed, and it also stabilizes to around 85\% with more than 80 points spoofed. Notably, the attack traces from $\mathcal{R}$ can achieve comparable $ASR$ with $\mathcal{K}$ on all target models, which demonstrates that adversaries can efficiently leverage a customized renderer to generate attack traces (Figure \ref{fig:render}). Such rendered traces can be directly programmed into hardware for physical spoofing attacks (Appendix \ref{ap:Spoof}). Interestingly, $\mathcal{S}$ achieves much higher $ASR$ on Apollo 5.0, indicating that BEV-based features are less robust to spoofing attacks than the other two categories, which could be attributed to the information loss of feature encoding from BEV. \nsubsubsection{Robustness Analysis} We analyze the robustness of the proposed attack to variations of attack traces $V'$ and the average precision (AP) of target models $\mathcal{M}$. We also evaluate the attack robustness against state-of-the-art defense strategies~\cite{xu2017feature,yang2019menet} designed for image-based adversarial attacks. We find that spoofed traces with around 60 points to trigger major changes in $ASR$. Note that Cao \textit{et al.}\xspace also utilized spoofed traces with 60 points for analysis~\cite{cao2019adversarial}. Therefore, we use attack traces with $(60,70]$ points from $\mathcal{R}$ for the robustness analysis. \textbf{Robustness to variations in attack traces}. First, we apply a scaling matrix $S$ to the attack traces $V'$ with different-level randomness to simulate the inaccuracy of sensor attack: \begin{equation} \begin{split} & \quad {V''}_{\wi} = {V'}_{\wi} \\ \begin{bmatrix} {V''}_{\mathbf{w_x}}\\ {V''}_{\mathbf{w_y}}\\ {V''}_{\wz}\\ \end{bmatrix} & = \begin{bmatrix} s & 0 & 0\\ 0 & s & 0\\ 0 & 0 & s\\ \end{bmatrix} \cdot \begin{bmatrix} {V'}_{\mathbf{w_x}}\\ {V'}_{\mathbf{w_y}}\\ {V'}_{\wz}\\ \end{bmatrix} \end{split} \end{equation} where $s$ subjects to a uniform distribution $U(1-\epsilon,1+\epsilon)$. We use the mean $l$-$2$ norm to measure the distance between $V''$ and $V'$. Figure \ref{fig:robust_1} shows the $ASR$ drops with larger $l$-$2$ distances which is expected. However, as shown, the $ASR$ still reaches around 70\% while the distance is around 10~cm. We also observe that the $ASR$ for PointRCNN drops faster than for PointPillars and Apollo 5.0, which also validates that point-wise features are arguably more robust than voxel-based and BEV-based features (detailed in Appendix \ref{ap:attack_eval}). \begin{figure}[!t] \begin{minipage}[t]{0.478\linewidth} \centering \includegraphics[width=\linewidth]{images/usenix_robustness1.pdf} \vspace{-0.5cm} \caption{Attack robustness to variations in generated attack traces from $\mathcal{R}$.} \label{fig:robust_1} \end{minipage \hfill \begin{minipage}[t]{0.49\linewidth} \centering \includegraphics[width=\linewidth]{images/usenix_robustness2.pdf} \vspace{-0.5cm} \caption{Attack robustness to variations in target models' performance.} \label{fig:robust_2} \end{minipage} \vspace{-0.3cm} \end{figure} \textbf{Robustness to variations in model performance}. To understand the relationship between $ASR$ and the original performance of models (\textit{i.e.,}\xspace AP), we first extract the intermediate models when we trained PointPillars and PointRCNN. We then try to launch attacks on these models. Surprisingly, we find that the $ASR$ increases with higher AP\footnote{\CR{We evaluate the $ASR$s until the training procedures (\textit{i.e.,}\xspace APs) converge on both models.}} (Figure \ref{fig:robust_2}), which implies that a model with better performance could be more vulnerable to such attacks. Our results indirectly demonstrate that the identified vulnerability could be attributed to an ignored dimension (\textit{i.e.,}\xspace occlusion patterns) by current models. Since the models do not notice such a hidden dimension, they will be overfitted to be more vulnerable during training. \CR{\textbf{Robustness to adversarial training}. Adversarial training is not rigorously applicable because it targets classification models, and requires norm-bounded perturbations to make the optimization problem tractable~\cite{madry2017towards}. In contrast, our study targets 3D object detection models, and the proposed attack is constrained by the sensor attack capability ($\mathcal{A}$), which does not fit any existing norm-bounded formulations. Thus, we perform this robust analysis in an empirical setting. Specifically, we generate another 100 attack traces with 60 points using the customized renderer and randomly inject two of them into each point cloud sample in the KITTI training set at areas without occlusions. We further train PointPillars and PointRCNN on this modified dataset and evaluate our proposed attack using the same 60-point attack traces with \S\ref{attack_effe} on them. We observe that the $ASR$s drop from 83.6\% to 70.1\% and 88.3\% to 79.7\% on PointPillars and PointRCNN, respectively, on the KITTI validation set. However, the ``Hard'' category's original detection performance has significant degradation of over 10\% on both models. Our results empirically show that current LiDAR-based perception model designs cannot learn the occlusion information correctly. The slight drop of the $ASR$s comes from the under-fitting effect of existing occluded vehicles (\textit{i.e.,}\xspace significant AP degradation), which is not acceptable in real AD systems.} \textbf{Robustness to randomization-based defenses}. We leverage state-of-the-art image-based defenses: feature squeezing~\cite{xu2017feature} and ME-Net~\cite{yang2019menet} to test the attack robustness on Apollo 5.0 since it has similar pipelines with image-based models. We demonstrate that none of them can defend the black-box spoofing attack without hurting the original AP. More details can be found in Appendix \ref{ap:attack_eval}. \subsubsection{BEV-based 3D Object Detection} \textbf{1. Bird's-eye view (BEV)-based 3D object detection.} Due to the remarkable progress made in 2D image recognition tasks, a large number of existing works~\cite{apollo,yang2018pixor,liang2018deep,meyer2019lasernet} attempt to transform LiDAR point clouds into the 2D structure for 3D object detection in AD systems. Most state-of-the-art methods~\cite{apollo,yang2018pixor,liang2018deep} conduct the transformation by projecting point clouds into the top-down view, also known as the BEV, and utilize convolutional neural networks (CNNs) to perform the final detection. Figure \ref{fig:sota_models} (a) shows the architecture of \emph{Apollo 5.0}\footnote{In this paper, we use ``Apollo 5.0'' to denote the Baidu Apollo 5.0 model.}, \CR{an industry-level BEV-based model,} that has six hard-coded feature maps in the BEV and follows a UNet-like~\cite{ronneberger2015u} pipeline to output the grid-level confidence score. The final stage heuristically clusters the grids that belong to the same object. \begin{figure}[t!] \centering \vspace{-0.2cm} \includegraphics[width=\linewidth]{images/usenix_existing_model_new.pdf} \vspace{-0.3cm} \vspace{-0.15in} \caption{State-of-the-art LiDAR-based perception models.} \label{fig:sota_models} \vspace{-0.5cm} \end{figure} \textbf{2. Voxel-based 3D object detection.} VoxelNet~\cite{zhou2018voxelnet} is the first model that slices the point clouds into voxels and extracts learnable features by applying a PointNet~\cite{qi2017pointnet} to each voxel, after which a 2D convolutional detection layer is applied in the final stage. Many recent works~\cite{lang2019pointpillars,yan2018second,wang2019voxel,lehner2019patch} adopt this voxel-based architecture and achieve state-of-the-art performance~\cite{kitti_3d}. Figure \ref{fig:sota_models} (b) shows the architecture of \emph{PointPillars} that creatively voxelizes the point cloud into pillars (a representation of point clouds organized in vertical columns) to enhance the efficiency and follows the general design of voxel-based detection architectures. \CR{Notably, PointPillars is adopted by Autoware~\cite{autoware}, an industry-level AV platform.} \textbf{3. Point-wise 3D object detection.} Instead of transforming point clouds to regular 2D structures or voxels for feature extraction, recent studies propose to directly operate on point clouds for 3D object detection~\cite{shi2019pointrcnn,yang2019std,chen2019fast,shi2019part} and achieve the state-of-the-art performance. Most existing works in this category use a classic two-stage architecture similar to Faster RCNN~\cite{ren2015faster} in 2D object detection. The first stage is responsible for generating high-quality region proposals in the 3D space. Based on these proposals, the second stage regresses the bounding box parameters and classifies the detected objects. As shown in Figure \ref{fig:sota_models} (c), \emph{PointRCNN} adopts a bottom-up method that generates point-wise region proposals in the first stage and regresses these proposals in the later stage. \nsubsubsection{KITTI Benchmark} \label{background_kitti} KITTI~\cite{Geiger2013IJRR} is a popular dataset for benchmarking AD research, of which the point cloud data are by design divided into a \textbf{trainval set} containing 7481 samples and a \textbf{test set} containing 7518 samples. We follow the methodology by Chen \textit{et al.}\xspace to split the trainval set to a \textbf{training set} (3712 samples) and a \textbf{validation set} (3769 samples) for better experimental studies~\cite{chen20153d}. KITTI evaluates 3D object detection performance by average precision (AP) using the PASCAL~\cite{Everingham10} criteria and requires a 3D bounding box overlap (IoU) over 70\% for car detection. KITTI also defines objects into three difficulty classes: Easy, Moderate, and Hard~\cite{kitti_3d}. The difficulties correspond to different occlusion and truncation levels. We train PointPillars and PointRCNN on the training set, and Table \ref{tb:model_og_performance} shows their APs evaluated on the validation set. We utilize the publicly released Apollo 5.0 model since it has its own labeling, which is incompatible with KITTI. \CR{In this work, we target car detection on the KITTI benchmark as the APs of pedestrian and cyclist detection are not yet satisfactory. However, our methodology can be generalized to other categories.} \nsubsection{LiDAR Sensor and Spoofing Attacks} \label{background_spoof} \textbf{LiDAR sensor}. A LiDAR instrument measures the distance to surroundings by firing rapid laser pulses and obtaining the reflected light with a sensor. Since the speed of light is constant, the accurate distance measurements can be derived from the time difference between laser fires and returns. By firing laser pulses at many predetermined vertical and horizontal angles, a LiDAR generates a point cloud that can be used to make digital 3D representations of surroundings. Each point in a point cloud contains its $xyz$-$i$ information, corresponding to its location and the intensity of the captured laser return. \nsubsubsection{Sensor-level LiDAR Spoofing Attack} \label{background_direct_spoof} In the context of sensors, a spoofing attack is the injection of a deceiving physical signal into a victim sensor~\cite{198480}. Since they share the same physical channels, the victim sensor accepts the malicious signal, trusting it as legitimate. Prior works~\cite{petit2015remote,shin2017illusion} have shown that LiDAR is vulnerable to laser spoofing attacks. Specifically, Petit~\textit{et al.}\xspace showed the feasibility to relay LiDAR laser pulses from other locations to inject fake points into the point cloud~\cite{petit2015remote}. Shin~\textit{et al.}\xspace further improved the attack to control fake points at different locations in the point cloud, even very close to the victim vehicles~\cite{shin2017illusion}. \nsubsubsection{Adv-LiDAR: Model-level LiDAR Spoofing Attack} \label{background_adv_spoof} Besides directly spoofing fake points into LiDAR point clouds, a recent study proposes Adv-LiDAR that uses adversarial machine learning to not only spoof a set of fake points into the point cloud but also manage to deceive the LiDAR-based perception model~\cite{cao2019adversarial}. The authors formulate the attack on Apollo 2.5\footnote{Apollo 2.5 was the latest version when Adv-LiDAR~\cite{cao2019adversarial} was published. In this work, we target Apollo 5.0, the latest version at the time of writing.} as an optimization problem: \begin{equation} \begin{split} & \min \qquad {\mathcal{L}} (x \oplus t';\mathcal{M}) \qquad \\ & \text{s.t.} \qquad t' \in \{ \Phi(T') \,|\, T' \in \mathcal{A} \} \And x = \Phi(X) \end{split} \label{eq:adv_lidar} \end{equation} where $X$ is the pristine point cloud and $x$ represents the hard-coded feature maps in Apollo (\S\ref{background_percpetion}). $\Phi(\cdot)$ is the pre-processing function for crafting the feature maps. $T'$ and $t'$ are the spoofed point cloud and its corresponding feature maps, respectively. $\mathcal{A}$ stands for the sensor attack capability, and $\oplus$ merges the pristine and adversarial feature maps. The attack goal is to spoof a fake vehicle right in front of the victim AV that leads to safety issues, \CR{and the success condition is that the confidence score of the optimized spoofed points ($T'$) exceeds the default threshold so that Apollo 2.5 ($\mathcal{M}$) will detect $T'$ as a valid vehicle.} The authors formulate the sensor attack capability ($\mathcal{A}$) for general LiDAR spoofing attacks and design a specific loss function (${\mathcal{L}}$) and a merging function ($\oplus$) for Apollo 2.5 ($\mathcal{M}$). By strategically controlling the spoofed points, Adv-LiDAR achieves around 75\% attack success rate towards Apollo 2.5 and is considered as the state-of-the-art LiDAR spoofing attack. \subsubsection{Existing View Fusion Frameworks\yl{Does not make sense to have only one subsection.}} Besides the models that only take FV as input, several studies~\cite{chen2017multi,zhou2019end,ku2018joint} present fusion-based architectures for LiDAR-based perception that utilize the combinations of data from different sensors and views as input. MV3D~\cite{chen2017multi} is a classic fusion-based design that takes both LiDAR point clouds and RGB images as input and predicts 3D bounding boxes, where the point cloud is projected into multi-views (\textit{i.e.,}\xspace FV and BEV) for feature encoding. Zhou \textit{et al.}\xspace recently proposed multi-view fusion (MVF), which combines FV with 3D representations~\cite{zhou2019end}. MVF builds on top of PointPillars. Instead of only voxelizing points in 3D, MVF also voxelizes the point cloud into FV frustums and integrates the two voxels' features based on coordination mapping in the 3D space. To better understand the robustness of fusion-based architectures, we reproduce MV3D and MVF based on PointPillars. For MV3D, we ignore the RGB images, and take the FV and BEV as the model input since we focus on LiDAR-based perception. We use a VGG-16~\cite{Simonyan15} for FV feature learning in MV3D. Figure \ref{fig:existing_fusion} shows the architectures we adopt and reproduce. We train the two reproduced models on the KITTI training set and evaluate them on the KITTI validation set. As Table~\ref{tb:fusion_performance} shows, the FV-augmented models can achieve comparable performance than the original PointPillars. The reproduced results also align well with the evaluations in~\cite{zhou2019end,chen2017multi}. \begin{table}[thp!] \captionsetup{font=small} \vspace{-0.25cm} \footnotesize \caption{MV3D-PointPillars' and MVF-PointPillars' APs (\%) of 3D car detection on the KITTI validation set.} \vspace{-0.1in} \centering \begin{tabular}{|c|c|c|c|} \hline \multirow{2}*{Model} & \multicolumn{3}{ c |}{Car Detection} \\ \cline{2-4} & Easy & Moderate & Hard \\ \hline \hline MV3D-PointPillars & 85.67 & 77.12 & 71.65 \\ \hline MVF-PointPillars & 86.77 & 79.15 & 75.72 \\ \hline \end{tabular} \label{tb:fusion_performance} \vspace{-0.3cm} \end{table} We then evaluate their robustness against our proposed black-box attack. The experimental setups are identical to the settings in \S\ref{attack_analysis}. Figure \ref{fig:asr_fusion} shows that the $ASR$ of reproduced models are as high as the original PointPillars. It indicates that existing view fusion-based architectures both cannot help with defending against LiDAR spoofing attacks, although they provide marginally gain on the AP. We further perform ablation studies and find that the BEV (or 3D) features dominate the model decisions (elaborated in Appendix~\ref{ap:ablation}). Since the identified vulnerability exists in 3D space, the models are still vulnerable to LiDAR spoofing attacks. \begin{figure}[tp] \vspace{-0.3cm} \centering \subfigure[$ASR$ of the reproduced MV3D.]{ \begin{minipage}[t]{0.5\linewidth} \centering \includegraphics[width=0.95\linewidth]{images/usenix_mv3d_asr.pdf} \end{minipage}% }% \subfigure[$ASR$ of the reproduced MVF.]{ \begin{minipage}[t]{0.5\linewidth} \centering \includegraphics[width=0.95\linewidth]{images/usenix_mvf_asr.pdf} \end{minipage}% }% \centering \vspace{-0.2cm} \vspace{-0.1in} \caption{Attack success rates ($ASR$s) of proposed black-box spoofing attacks on MV3D and MVF models.} \label{fig:asr_fusion} \vspace{-0.6cm} \end{figure} \nsubsection{Sequential View Fusion} \label{svf} The insights drawn from existing view fusion schemes show that existing fusion designs cannot provide better robustness compared to the original models. The 3D (or BEV) representation dominates the model leaving the FV representation not critical in the end-to-end architectures. Based on the above understandings, we propose a new view fusion schema called sequential view fusion (SVF). SVF comprises of three modules (Figure \ref{fig:svf}), which are: 1) semantic segmentation: a semantic segmentation network that utilizes the FV representation to computes the point-wise confidence scores (\textit{i.e.,}\xspace the probability that one point belongs to a vehicle). 2) view fusion: the 3D representation is augmented with semantic segmentation scores. 3) 3D object detection: a LiDAR-based object detection network that takes the augmented point clouds to predict bounding boxes. Instead of leaving the models to learn the importance of different representations by themselves, we attach a semantic segmentation network to the raw FV data. By doing so, we enforce the end-to-end learning to appreciate the FV features, so that the trained model will be resilient to LiDAR spoofing attacks. \textbf{Semantic segmentation.} The semantic segmentation networks accept the FV represented point clouds and associate each point in FV with a probability score that it belongs to a vehicle. These scores provide aggregated information on the FV representation. Semantic segmentation over FV has several strengths. First, as mentioned before, the FV representation is noisy because of the nature of LiDAR. Compared to 3D object detection or instance segmentation, which is intractable over FV, semantic segmentation is an easier task as it does not need to estimate object-level output. Second, there are extensive studies on semantic segmentation over FV represented point clouds~\cite{wu2018squeezeseg,wang2018pointseg,biasutti2019lu}, and the segmentation networks achieve much more satisfactory results than the 3D object detection task over FV. In our implementation, we adopt the high-level design in LU-Net~\cite{biasutti2019lu}. It is worth noting that the end-to-end SVF architecture is agnostic to the semantic segmentation module. \textbf{View fusion.} The fusion module re-architects existing symmetric designs which integrate the 3D representation with the confidence scores generated by the semantic segmentation module. Specifically, we use Equation \ref{eq:mapping} for mapping between $\vec{p}=(x,y,z)$ and $\vec{p}_{FV}(r,c)$, and augment each $\vec{p}$ with the point-wise confidence score from its corresponding $\vec{p}_{FV}$. \textbf{3D object detection.} SVF is also agnostic to the 3D object detection module. In this paper, we utilize PointPillars and PointRCNN in our implementation. Most of the models introduced in \S\ref{background} can fit into the end-to-end SVF architecture. \nsubsection{SVF Evaluation} \label{svf_eval} \textbf{Experimental setup.} We train SVF-PointPillars and SVF-PointRCNN on the KITTI training set. The setup of robustness analysis against LiDAR spoofing attacks is identical to the settings in \S\ref{attack_analysis}. We also try to evaluate SVF against Adv-LiDAR~\cite{cao2019adversarial} on Apollo 5.0 and the adaptive attacks. \begin{figure}[tp] \vspace{-0.2cm} \centering \includegraphics[width=\linewidth]{images/SVF_models.pdf} \vspace{-0.25in} \caption{Sequential view fusion (SVF) architecture.} \label{fig:svf} \vspace{-0.5cm} \end{figure} \textbf{Evaluation metrics.} We evaluate the AP of SVF-PointPillars and SVF-PointRCNN on the KITTI validation set, and leverage $ASR$ to test their robustness against LiDAR spoofing attacks. As shown in Table \ref{tb:svf_performance}, both SVF models achieve comparable AP compared to the original models. The marginal degradation comes from two-state training. More specifically, the distributions of the semantic segmentation outputs in the training and validation sets do not align well with each other. \CR{We find that the drop of AP will indeed cause a tiny amount of false negatives but will not influence the driving behaviors. Moreover, such degradation could be compensated with better training strategies (\textit{e.g.,}\xspace finer-tuning of the parameters) since the capacity of SVF is larger than the original models.} \begin{table}[!h] \captionsetup{font=small} \footnotesize \caption{SVF-PointPillars' and SVF-PointRCNN's APs (\%) of 3D car detection on the KITTI validation set.} \vspace{-0.1in} \centering \begin{tabular}{|c|c|c|c|} \hline \multirow{2}*{Model} & \multicolumn{3}{ c |}{Car Detection} \\ \cline{2-4} & Easy & Moderate & Hard \\ \hline \hline SVF-PointPillars & 85.93 & 74.12 & 70.19 \\ \hline SVF-PointRCNN & 88.12 & 76.56 & 74.81 \\ \hline \end{tabular} \label{tb:svf_performance} \vspace{-0.3cm} \end{table} We then perform the robustness evaluation of SVF models. Figure \ref{fig:asr_svf} shows the $ASR$ of our proposed spoofing attacks. As shown, the attacks are no longer effective in SVF models. The $ASR$ reduces from more than 95\% (original models) to less than 4.5\% on both models with the maximum attack capability, which is also an around 2.2$\times$ improvement compared to CARLO-guarded models. The mean $ASR$ also drops from 80\% to around 2.3\%. We also perform ablation study on SVF, and demonstrate that the FV features are more important in SVF models (detailed in Appendix~\ref{ap:ablation}). \begin{figure}[tp] \vspace{-0.3cm} \centering \subfigure[$ASR$ of SVF-PointPillars.]{ \begin{minipage}[t]{0.5\linewidth} \centering \includegraphics[width=0.95\linewidth]{images/usenix_svf_pointpillars.pdf} \end{minipage}% }% \subfigure[$ASR$ of SVF-PointRCNN.]{ \begin{minipage}[t]{0.5\linewidth} \centering \includegraphics[width=0.95\linewidth]{images/usenix_svf_pointrcnn.pdf} \end{minipage}% }% \centering \vspace{-0.4cm} \caption{Attack success rates ($ASR$s) of proposed black-box spoofing attack on SVF models.} \label{fig:asr_svf} \vspace{-0.5cm} \end{figure} \nsubsubsection{Defense against White-box and Adaptive Attacks} \label{ml_white_box} Since SVF requires re-training for the model, we cannot directly evaluate Adv-LiDAR on SVF-Apollo (\S\ref{background_kitti}). As a result, we decouple the problem to whether Adv-LiDAR can fool both the semantic segmentation and 3D object detection modules. We first directly apply the attack traces that successfully fool Apollo 5.0 to the segmentation network and record the mean confidence score of all the points belonging to the attack trace. Figure \ref{fig:white_box_svf} shows that the mean confidence scores are consistently below 0.08, which is too low to be classified as a valid vehicle with mean confidence scores of around 0.73 in our trained model. Model-level defenses are usually vulnerable to simple adaptive attacks~\cite{athalye2018obfuscated,carlini2017adversarial}. To demonstrate the effectiveness of SVF against adaptive attack, we assume that the adversaries are aware of the SVF architecture. The attack goal is to both fool the semantic segmentation and 3D object detection modules. We also leverage the formulation in \cite{cao2019adversarial} to utilize the global transformation matrix $H(\theta,\tau)$ to control the spoofed points. \CR{ \begin{equation} \begin{split} & \min_{\theta,\tau} \qquad - {\mathcal{L}}_{seg} (x \odot V \cdot H(\theta,\tau)^{T}) \qquad \end{split} \label{eq:adaptive_2} \end{equation} where $\odot$ represents the point cloud merge in the front view and ${\mathcal{L}}_{seg}(\cdot)$ defines the average confidence score of the attack trace (\textit{i.e.,}\xspace $ V \cdot H(\theta,\tau)^{T}$).} Figure \ref{fig:adaptive_svf} shows that none of the attack traces' average confidence score reaches 0.2 in the segmentation module, which is still far from the mean average confidence score of valid vehicle 0.73. Therefore, the adaptive attacks also cannot break the robustness of SVF. \section{Target Perception Models and Benchmark} \label{Target} \subsection{Target Perception Models} \label{target_models} \begin{figure}[thp!] \centering \missingfigure[figwidth=8cm]{Testing a long text string} \caption{Comparison with State-of-the-art LiDAR-based Perception Architectures.} \label{fig:sota} \vspace{-0.5cm} \end{figure} \subsubsection{Baidu Apollo 5.0 \footnote{\url{https://github.com/ApolloAuto/apollo/tree/r5.0.0/modules/perception/lidar}}} Figure.\ref{fig:sota} (a) shows the perception pipelines of Apollo model \subsubsection{PointPillars \footnote{\url{https://github.com/nutonomy/second.pytorch}}} Figure.\ref{fig:sota} (b) shows the perception pipelines of PointPillars model \subsubsection{PointRCNN \footnote{\url{https://github.com/sshaoshuai/PointRCNN}}} Figure.\ref{fig:sota} (c) shows the perception pipelines of PointRCNN \subsection{Target Benchmark} \label{target_benchmark} KITTI is \subsection{Hypotheses Proposal} \nsubsection{Experimental Validation} \label{hypothesis_validation} We design experiments (\textbf{E}) to test the existence of such potential erroneous predictions (\textit{i.e.,}\xspace \textbf{FP}) on three target models using the KITTI validation set. \textbf{E1}: To validate \textbf{FP1}, we first randomly pick 100 point cloud samples $\mathcal{F}=\{F_{i}\}_{i=1}^{100}$ that contain 100 target \emph{occluded} vehicles $\{v_{i}\}_{i=1}^{100}$ with their point sets $V_i \subseteq F_i$. We then feed $\mathcal{F}$ into three target models and record the confidence scores (\textit{i.e.,}\xspace outputs of models to represent the confidence of detection) of the occluded vehicles as $s_i$ for each $v_i$. Second, we leverage a global translation matrix $H(\theta,\tau)$ (Equation \ref{eq:trans}) to move every $V_{i}$ to a front-near location (\textit{i.e.,}\xspace 5-8 meters in front of the victim AV) in the point cloud $F_{i}$ as $V_{i}'$, where $\theta$ and $\tau$ correspond to the \emph{azimuth} and \emph{distance} of the translation, respectively: \CR{ \vspace{-0.2cm} \begin{equation} \begin{split} & \quad {V_{i}'}_{\wi} = {V_{i}}_{\wi} \\ \begin{bmatrix} {V_{i}'}_{\mathbf{w_x}}\\ {V_{i}'}_{\mathbf{w_y}}\\ {V_{i}'}_{\wz}\\ 1 \end{bmatrix} & = \begin{bmatrix} \cos{\theta} & -\sin{\theta} & 0 & \tau\cos{(\theta+\alpha)}\\ \sin{\theta} & \cos{\theta} & 0 & \tau\sin{(\theta+\alpha)}\\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} \cdot \begin{bmatrix} {V_{i}}_{\mathbf{w_x}}\\ {V_{i}}_{\mathbf{w_y}}\\ {V_{i}}_{\wz}\\ 1 \end{bmatrix} \end{split} \label{eq:trans} \end{equation} } $({V_{i}}_{\mathbf{w_x}},{V_{i}}_{\mathbf{w_y}},{V_{i}}_{\wz},{V_{i}}_{\wi})$ denotes the $xyz$-$i$ feature vectors (introduced in \S\ref{background_spoof}) of all points in $V_{i}$, and \CR{$\alpha=arctan ({V_{i}}_{\mathbf{w_y}} / {V_{i}}_{\mathbf{w_x}})$}. We make sure that there are no other objects standing between the LiDAR and each $V_{i}'$. By doing so, we construct a new set, where the points belong to the target occluded vehicles are moved to a front-near location by Equation \ref{eq:trans}. We further feed the new point cloud set $\mathcal{F}'$ into three target models and record the confidence scores of the translated points $V_{i}'$ as $s_{i}'$. Experimental results show that all of the translated points $V_{i}'$ are detected by three target models, and we calculate the relative errors $e = \frac{|{s_i}'-{s_i}|}{{s_i}}$. Figure \ref{fig:cdf} shows the CDF of $e$ for three target models. As shown, 99.5\% of the picked occluded vehicles only have below 10\% fluctuations of their confidence scores, which successfully validate \textbf{FP1}. The success of \textbf{E1} comes from the fact that LiDAR-based 3D object detection models perform \emph{amodal} perception, where given only the visible portions of a vehicle $v$, the model attempts to reason about occlusions and predict the bounding box for the complete vehicle (Figure \ref{fig:c1-3}). However, \CR{convolutional operations exploit spatial locality by enforcing a local connectivity pattern between neurons of adjacent layers. Such architecture thus ensures to produce the strongest response to a spatially local input pattern.} Since the \emph{occludee}'s and \emph{occluder}'s point sets $V$ and $\mathsf{O}(v)$ stand apart from each other in the 3D space, deep learning models may fail to identify the causality between $V$ and $\mathsf{O}(v)$ and thus learns to regress the bounding box for $v$ by $V$ only. \textbf{E2}: To validate \textbf{FP2}, similarly, we first randomly pick 100 point cloud samples that contain 100 target \emph{distant} vehicles $\{v_{i}\}_{i=1}^{100}$ that locate farther than 30 meters away from the AV, and follow the same procedure with \textbf{E1} to record the confidence score changes. Experimental results show that all of the translated points $V_{i}'$ are detected by three target models, and we calculate the relative errors $e' = \frac{|{s_i}'-{s_i}|}{{s_i}}$. Figure \ref{fig:cdf} shows the CDF of $e'$ for three target models. As shown, 99.5\% of the picked distant vehicles only have below 7.5\% fluctuations of their confidence scores, which successfully validate \textbf{FP2}. The success of \textbf{E2} comes from that 3D object detection models are designed to be non-sensitive to the locations of objects. For example, Apollo 5.0 does not incorporate location information in its hard-coded feature maps, and PointRCNN regards the centers of each bounding box as the origins of their coordinates. Hence the global locations of objects are not valued by the 3D object detection models in AD systems. \begin{figure}[t!] \centering \vspace{-0.1cm} \includegraphics[width=1\linewidth, height=0.4\linewidth]{images/cdf.pdf} \vspace{-0.5cm} \caption{Left: CDF of the relative errors $e$ in \textbf{E1}. Right: CDF of the relative errors $e'$ in \textbf{E2}.} \label{fig:cdf} \vspace{-0.5cm} \end{figure} \nsubsection{Vulnerability Identification} \label{vulnerability_id} As mentioned earlier, the sensor attack capability $\mathcal{A}$ is far from spoofing a fully exposed front-near vehicle's point set. However, \textbf{E1} and \textbf{E2} provide two strategies for adversaries to launch spoofing attacks with fewer points and horizontal angles. As a result, attackers can directly spoof a vehicle imitating various occlusion and sparsity patterns that satisfy the sensor attack capability $\mathcal{A}$ to fool the state-of-the-art models. For example, the $V$ (red points) in Figure \ref{fig:c1-3} only contains 38 points and occupies 4.92$^\circ$ horizontally when translated to 6 meters in front of the AV. We confirm that it can deceive all three target models successfully, as visualized in Appendix~\ref{ap:figure}. \begin{figure*}[!t] \centering \vspace{-0.25cm} \begin{minipage}[b]{.72\linewidth} \subfigure[$ASR$ of Apollo 5.0.]{ \centering \includegraphics[width=0.3333\linewidth]{images/usenix_apollo_asr.pdf} }% \subfigure[$ASR$ of PointPillars.]{ \centering \includegraphics[width=0.3333\linewidth]{images/usenix_pointpillars_asr.pdf} }% \subfigure[$ASR$ of PointRCNN.]{ \centering \includegraphics[width=0.3333\linewidth]{images/usenix_pointrcnn_asr.pdf} }% \end{minipage} \hfill \begin{minipage}[b]{.25\linewidth} \centering \includegraphics[width=\linewidth]{images/mesh.pdf} \end{minipage} \centering \vspace{-0.2cm} \begin{minipage}[b]{.70\linewidth} \caption{Attack success rates ($ASR$s) of proposed black-box spoofing attacks on target state-of-the-art models.} \label{fig:asr_all} \end{minipage} \hfill \begin{minipage}[b]{.26\linewidth} \centering \caption{The process of generating attack traces for $\mathcal{R}$ from the implemented renderer.} \label{fig:render} \end{minipage} \vspace{-0.8cm} \end{figure*} The vulnerability comes from the observation that the state-of-the-art 3D object detection architectures ignore the distinct physical features of LiDAR. Therefore, they leave a gap, as well as an attack surface, between the model capacity and LiDAR point clouds. We further abstract the neglected physical features as two occlusion patterns inside the LiDAR point clouds, described below. \textbf{Inter-occlusion}. We abstract the typical occlusion introduced in \S\ref{hypothesis} as inter-occlusion. As its name indicates, inter-occlusion describes a causal relationship between \emph{occludee} and the corresponding \emph{occluders} (\textit{i.e.,}\xspace the \emph{occluders} cause the \emph{occludee} partially visible). \textbf{FP1} violates the physical law of inter-occlusion since a translated ``occluded'' vehicle's point set $V'$ no longer has its valid \emph{occluder} $\mathsf{O}(v)$. However, \textbf{E1} demonstrates that state-of-the-art LiDAR-based perception models overlook such inter-occlusions in the point clouds. \textbf{Intra-occlusion}. We abstract the other occlusion pattern hidden inside an object as intra-occlusion. The facing surface of a solid object (\textit{e.g.,}\xspace~a vehicle) occludes itself in the point cloud, which indicates that the LiDAR cannot perceive the interior of the object (Figure \ref{fig:fsd}). \textbf{FP2} violates the physical law of intra-occlusion since the abnormal sparseness of a translated ``distant'' vehicle's point set $V'$ can no longer fully occlude a valid vehicle since other laser pulses could penetrate its ``surface''. However, \textbf{E2} demonstrates that state-of-the-art LiDAR-based perception models \CR{are unable to differentiate reflected points of real solid objects from sparse injected points of the same overall shape so that they also} overlook the intra-occlusions in the LiDAR point clouds. To demonstrate the potential real-world impacts of this identified vulnerability, we construct the first black-box spoofing attack on state-of-the-art LiDAR-based perception models in \S\ref{bb_attack}. We find the violations of the physical law of occlusion generally enable LiDAR spoofing attacks. Therefore, we perform the first defense study, exploiting the occlusion patterns as physical invariants to detect spoofing attacks in \S\ref{piad}. Lastly, in \S\ref{ml_defense}, we present a general architecture for robust LiDAR-based perception that embeds occlusion patterns as robust features into end-to-end learning. \section{A General Design-level Vulnerability} \label{vulnerability} As introduced in \S\ref{background_kitti}, a point cloud sample in KITTI consists of around 133,000 points, where a front-near vehicle should contain at least 2000 points and occupy about 15 $^\circ$ of horizontal angles\cite{Geiger2013IJRR}. However, Cao \textit{et al.}\xspace demonstrated that an attack trace with 60 points and 8 $^\circ$ of horizontal angles is sufficient to spoof a front-near vehicle in Apollo 2.5\cite{cao2019adversarial}. It still remains unclear why such spoofing attacks can succeed even with a huge gap existing between adversarial and normal vehicles. Despite the promising results of attacking image-based machine learning models shown in previous studies\cite{eykholt2018robust,220580}, their approaches have internal differences with Adv-LiDAR. We distinguish the spoofing attacks towards LiDARs with extensive prior work in mainly three aspects: \textbf{Different perturbation methods.} Images and point clouds have different data structures, which further leads to different perturbation methods applied. Images have compact structures (\textit{i.e.,}\xspace $H \times W \times C$), where $H \times W$ stands for the image size and $C$ contains the RGB information. However, point clouds are unordered which are oftentimes represented as $N \times C$, where $N$ is the number of points and $C$ contains the location and intensity information (\textit{i.e.,}\xspace$xyz$-$i$). Attackers are able to generate adversarial examples by modifying the RGB values in images. For LiDAR-based attacks, however, attackers can directly shift the point in the 3D Euclidean space as long as it obeys the physics of LiDAR (\S\ref{background_direct_spoof}). \textbf{Different perturbation capabilities.} Prior attacks towards 2D images always treat the whole target area as the attack surface since the threat models assumes that attackers have full controls over the target object (\textit{e.g.,}\xspace the attackers can potentially modify any areas of a stop sign\cite{eykholt2018robust}). However, due to the characteristics of LiDAR spoofing attacks, the attack surface is limited by the sensor attack capability ($\mathcal{A}$) in \S\ref{threat}. Such a small attack surface also introduces more difficulties to launching the adversarial spoofing attack. \textbf{Different perturbation constraints.} Prior attacks towards 2D images leverage \emph{l-p} norms as main constraints for the formulated optimization problem\cite{eykholt2018robust} whose goal is to minimize the perturbation to be stealthy. Such constraints are not applicable to attacking LiDAR because point clouds are not perceived by human beings, thus, stealthiness is not a focus in such attacks. However, due to the limited sensor attack capability (\S\ref{threat}), the optimized attack traces must not exceed the capability boundary, in which case the sensor attack capability naturally becomes the main constraint for attacking LiDAR. Therefore, in order to unveil the general vulnerability exposed by Adv-LiDAR, it is necessary to take the distinct characteristics of the LiDAR point cloud into considerations, which are different from image-based attacks. \subsection{Hypotheses Proposal} \label{hypothesis} \begin{figure}[thp!] \centering \includegraphics[width=6cm]{images/C1-3.pdf} \caption{Illustration of \textbf{C1-3} of LiDAR point cloud.} \label{fig:c1-3} \end{figure} Although deep learning has been successfully applied to LiDAR-based object detection in autonomous driving, the interpretability of such models is always a bottleneck factor. In this section, we first provide several empirical observations (\textbf{O}) of LiDAR-based perception models and unique characteristics (\textbf{C}) of LiDAR point cloud data, based on what, we further propose two hypotheses (\textbf{H}) that could lead to a design-level vulnerability of state-of-the-art models. \textbf{C1}: Occlusion between objects is inevitable in LiDAR point clouds and will cause partial visibility of the occluded objects. As introduced in \S\ref{background_spoof}, a LiDAR sensor functions by firing laser pulses and capturing their returns. As a result, each point in a point cloud represents the distance to the \emph{nearest} solid object that along the laser ray. Similar to human eyes, a LiDAR can only perceive parts of an object (\textit{e.g.,}\xspace a vehicle) if other obstacles standing between the LiDAR and the object that exclude the laser beams. In this paper, we describe such occluded objects as \emph{occludees} and the objects that occlude others as \emph{occluders}. Particularly, we use $\mathsf{O}(x)$ to express the set of points that occludes the object $x$, and we use the captain letter $X$ to express the set of points that belong to object $x$ in the point cloud $F$ ($X = \{\vec{p}\, | \,\vec{p} \in x\} \subseteq F$, where $\vec{p} \in \mathbb{R}^3$). \alfred{need a figure to illustrate the point} \mytodo{I will draw a figure to show C1-3} \textbf{O1}: Deep learning identifies correlations in the training data, but it arguably cannot build causal models by purely observing correlations\cite{doshi2017towards}. The state-of-the-art LiDAR-based perception models (\S\ref{background}) most likely preserve this characteristic as they consist of basic fully-connected and convolutional layers. \textbf{C2}: The \emph{occludee} and the corresponding \emph{occluders} described in \textbf{C1} stand separately from each other in the 3D Euclidean space. Intuitively, an occlusion relation exists as long as the \emph{occluders} shades the \emph{occludee} from the perspective of the LiDAR sensor As a result, $X$ and $\mathsf{O}(x)$ may be far apart with each other in the point cloud. \textbf{O2}: CNNs exploit spatial locality by enforcing a local connectivity pattern between neurons of adjacent layers. The architecture thus ensures to produce the strongest response to a spatially local input pattern. PointPillars and Apollo 5.0 both leverage CNNs for the final detection task, so they are supposed to remain such characteristic, too. PointRCNN only accepts points inside region proposals into its second stage pipeline, thus spontaneously preserves locality. Occlusion is a causation relationship. The existence of the \emph{occluders} leads to the partial visibility of the corresponding \emph{occludee}. From \textbf{O1}, deep learning models can barely identify such causation relationship introduced by occlusions. Besides, since the $X$ and $\mathsf{O}(x)$ stand independently from each other in the 3D Euclidean space (\textbf{C2}), LiDAR-based perception models have limitations to even identify the correlation between the $X$ and $\mathsf{O}(x)$ due to \textbf{O2}. Thus, we propose our first hypothesis: \vspace{0.2cm} \textbf{H1}: \emph{Given a point cloud $F$ containing an occluded object $x$, if $\mathcal{M}(F) \Rightarrow \{\mathsf{B}(x),\ldots\}$, we hypothesize $\mathcal{M}(F-\mathsf{O}(x)) \Rightarrow \{\mathsf{B}(x),\ldots\}$, where $\mathsf{B}(x)$ denotes the bounding box parameters of $x$.} \vspace{0.2cm} \textbf{C3}: Due to the working principles of LiDAR sensors (\S\ref{spoof}), the generated point clouds are collected uniformly in vertical and horizontal angles but not in Euclidean space. The points farther away from the LiDAR sensor are generally sparser than the points nearby the sensor. The horizontal and vertical resolutions are $\propto r\times\sin{\Delta \theta}$ and $\propto r\times\sin{\Delta \phi}$ respectively, where $r$ is the distance from the point to the LiDAR sensor, and $\Delta \theta$ and $\Delta \phi$ are the horizontal and vertical fire angle intervals. \textbf{O3:} CNN-based 2D object detection models are oftentimes translation equivariant\cite{ren2015faster}. Intuitively, if an object is translated to another location in the image plane, its detected bounding box should shift with the translation of the original object\cite{weiler20183d}: \begin{equation} \mathcal{M} \circ \mathsf{T}\,_{\vec{t}} = \mathsf{T}\,_{\vec{t}} \circ \mathcal{M} \end{equation} where $\mathsf{T}\,_{\vec{t}}(\vec{x}) := (\vec{x} + \vec{t})$, where $\vec{x},\vec{t} \in \mathbb{R}^2$ and $\mathcal{M}$ is the deep learning model. In terms of LiDAR-based perception models, first, the hard-coded features in the BEV-based models (\textit{e.g.,}\xspace Apollo 5.0) do not contain location information in $xy$ plane, therefore, will most likely possess the characteristic in $xy$ plane. Second, for the voxel-based models, the initial features inside each voxel contain the location information (\textit{i.e.,}\xspace $x,y,z$). However, they also incorporate the local location $x_c,y_c,z_c$ where the $c$ subscript denotes distance to the arithmetic mean of all points in the voxel (\S\ref{background}) which are translation equivariant. Thus, the characteristic may still hold in the voxel-based models. Third, in the second stage of the point-wise models, canonical coordination transformations are performed in each region proposal, regarding the centers of the region proposals as the origins of their coordinates. This canonical transformation automatically makes the model translation equivariant. Even though the density of point clouds varies a lot along their distances to the sensor (\textbf{C3}), we propose our second hypothesis based on \textbf{O3}: \vspace{0.2cm} \textbf{H2}: \emph{Given a point cloud $F$ containing an object $x$, if $\mathcal{M}(F) \Rightarrow \{\mathsf{B}(x),\ldots\}$, we hypothesize $\mathcal{M}((F - X) \cup \mathsf{T}\,_{\vec{t}}(X)) \Rightarrow \{\mathsf{B}(\mathsf{T}\,_{\vec{t}}(x)),\ldots\}$, where $\mathsf{B}(x)$ denotes the bounding box parameters of $x$.} \subsection{Hypotheses Validation} \label{hypothesis_validation} We test the two proposed hypotheses using point clouds from the KITTI validation set. \textbf{V1}: To validate \textbf{H1}, we first randomly pick 100 point cloud frames $\mathcal{F}=\{F_{i}\}_{i=1}^{100}$ that contain 100 target \emph{occluded} vehicles $\{v_{i}\}_{i=1}^{100}$ where the corresponding set of points $V_i \subseteq F_i$ respectively. We then feed $\mathcal{F}$ into three target models and record the confidence scores of the occluded vehicles as $s_i$ for each $v_i$. Second, we eliminate the specific $\mathsf{O}(v_i)$ for each vehicle $v_i$. The rest of points of each point cloud $F_{i}$ form a new set of point cloud frames $\mathcal{F}^{'}=\{F_{i}-\mathsf{O}(v_{i})\}_{i=1}^{100}$. We feed $\mathcal{F}^{'}$ into the three target models and record new confidence scores of the occluded vehicles as ${s_i}'$ for each $v_i$. Figure \ref{fig:cdf} shows the CDF of $e = \frac{|{s_i}'-{s_i}|}{{s_i}}$ for all three target models. As shown, 99.5\% of the picked occluded vehicles only have below 2\% fluctuations of their confidence scores when their corresponding $\mathsf{O}(\cdot)$ are eliminated from the point cloud on all target models. The experimental results validate \textbf{H1}. \textbf{V2}: To validate \textbf{H2}, we first generate a point cloud $G$ simulating the ground plane's points as reference for the $xy$ plane. Then we again randomly pick and extract 100 vehicles' point clouds $\mathcal{V}=\{V_{i}\}_{i=1}^{100}$. It is worth noting that they are not necessary occluded. We further merge the point cloud of the ground plane $G$ with $\mathcal{V}$ forming a new set $\mathcal{F}=\{G \cup V_{i}\}_{i=1}^{100}$. We feed $\mathcal{F}$ into three target models and record the confidence scores of the occluded vehicles as $s_i$ for each $v_i$. Second, we grid the ground plane $G$ into 1 $m^2$ cells $\{(x_{p},y_{q})\}_{p,q=1}^{N_{x},N_{y}}$, where $N_{x}$ and $N_{y}$ are the number of cells in $x$ and $y$ axes respectively. By applying a global transformation matrix $H(\theta,\tau)$\cite{cao2019adversarial} to $\mathcal{V}$, we translate every $V_{i}$ to every cell $(x_{p},y_{q})$ on the ground plane as $V_{i,p,q}'$: \begin{equation} \begin{split} & \quad {V_{i,p,q}'}_{\wi} = {V_{i}}_{\wi} \\ \begin{bmatrix} {V_{i,p,q}'}_{\mathbf{w_x}}\\ {V_{i,p,q}'}_{\mathbf{w_y}}\\ {V_{i,p,q}'}_{\wz}\\ 1 \end{bmatrix} & = \begin{bmatrix} \cos{\theta} & -\sin{\theta} & 0 & \tau\cos{\theta}\\ \sin{\theta} & \cos{\theta} & 0 & \tau\sin{\theta}\\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \\ \end{bmatrix} \cdot \begin{bmatrix} {V_{i}}_{\mathbf{w_x}}\\ {V_{i}}_{\mathbf{w_y}}\\ {V_{i}}_{\wz}\\ 1 \end{bmatrix} \end{split} \end{equation} where $({V_{i}}_{\mathbf{w_x}},{V_{i}}_{\mathbf{w_y}},{V_{i}}_{\wz},{V_{i}}_{\wi})$ denotes the $xyz$-$i$ features of all points in $V_{i}$. We merge the $V_{i,p,q}'$ with $G$ forming $\mathcal{F}'=\{V_{i,p,q}' \cup G\}_{i,p,q=1}^{100,N_{x},N_{y}}$. We feed $\mathcal{F}'$ into three target models and record the confidence score of the translated vehicle as $s_{i,p,q}'$. Figure \ref{fig:cdf} also shows the CDF of $e' = \frac{|s_{i,p,q}'-{s_i}|}{{s_i}}$ for all three target models. As shown, the relative error $e'$ are larger than $e$, which is expected since the models contain location-sensitive features (\textbf{O3}). However, the results the fluctuations are still below 10\% for 99.5\% picked vehicles, and we verify that with such fluctuations, the models still detect these vehicles as valid which validate \textbf{H2}. \begin{figure}[thp!] \centering \includegraphics[width=1\linewidth, height=0.4\linewidth]{images/cdf.pdf} \caption{CDF of the relative errors $e$ (left) and $e'$ (right).} \label{fig:cdf} \vspace{-0.5cm} \end{figure} \subsection{Vulnerability Identification} \label{vulnerability_id} In this section, we unveil how the validated hypotheses (\textbf{V1-2}) lead to a design-level vulnerability of state-of-the-art LiDAR-based perception models. As introduced in \S\ref{background_adv_spoof}, Equation \ref{eq:adv_lidar} formulates the optimization problem of the adversarial spoofing attack, where $\mathcal{A}$ is the sensor attack capability. Instead of spoofing a complete vehicle, to spoof an occluded vehicle is a much easier task since an occluded vehicle occupies smaller horizontal angles and less points than a complete one. \textbf{V1} shows that even without a valid \emph{occluder}, an ``occluded'' vehicle can still be detected by the models. Moreover, attackers can spoof even sparser points of an occluded vehicle to further reduce the cost. Due to the non-uniform density of LiDAR point clouds (\textbf{C3}), a vehicle far away from the LiDAR sensor contains sparse points. \textbf{V2} shows that translating such a distant vehicle's points to a nearby location will make the models detect the translated points as a vehicle at the new location. As a result, instead of formulating the $\oplus$ function and solving Equation \ref{eq:adv_lidar} by gradient descent-based methods, attackers can directly spoof an ``occluded'' vehicle with sparse points that satisfy the sensor attack capability $\mathcal{A}$ to fool the state-of-the-art models. \mytodo{not sure whether the explanation is clear.}
\section{Introduction} Let $f\colon {\mathbb{C}}\to{\mathbb{C}} $ be a transcendental entire function. The set \[ I(f)\defeq \{z\in {\mathbb{C}}\colon \lim_{n\to\infty} f^n(z) = \infty\} \] is called the \emph{escaping set} of $f$, where \[ f^n = \underbrace{f\circ\dots\circ f}_{n\text{ times}}\] denotes the $n$-th iterate of $f$. The escaping set was first studied by Eremenko~\cite{alexescaping} and has been the subject of intensive research in recent years; see e.g.~\cite{oberwolfach,rrrs,bergweilermeasure,ripponstallarderemenkopoints} and their references. The topological study of $I(f)$ turns out to be surprisingly intricate. For example Eremenko \cite[p.~343]{alexescaping} asked whether, for every transcendental entire function, every connected component of $I(f)$ is unbounded. This question has become known as \emph{Eremenko's conjecture}, and is one of the most famous open problems in transcendental dynamics. Strengthened versions of the conjecture have since been proved false in general; compare~\cite[Theorem~1.1]{rrrs} and~\cite[Theorem~1.6]{arclike}. On the other hand, Rippon and Stallard~\cite{boundariesescaping} have shown that $I(f)\cup\{\infty\}$ is always connected, so any counterexample to Eremenko's original conjecture would have rather subtle topological properties. The \emph{fast escaping set} is a certain subset of the escaping set, first introduced by Bergweiler and Hinkkanen~\cite{bergweilerhinkkanen}. This set has also received considerable attention recently; in part because it appears to be more tractable than the full escaping set $I(f)$. In particular, the analogue of Eremenko's conjecture holds for $A(f)$ \cite{ripponstallardfatoueremenko}. One difference between the two objects lies in the topological complexity of their definitions. Indeed, $A(f)$ can be written as a countable union of closed sets~\cite[Formula~(1.3)]{ripponstallardfast}; so it is an $F_{\sigma}$ set. On the other hand, by definition \begin{align*} I(f) &= \{z\in{\mathbb{C}}\colon \forall M\geq 0\, \exists N\geq 0 \colon \lvert f^n(z)\rvert \geq M \text{ for $n\geq N$}\} \\ &=\bigcap_{M= 0}^{\infty} \bigcup_{N=0}^{\infty} \bigcap_{n=N}^{\infty} f^{-n}({\mathbb{C}}\setminus D(0,M)), \end{align*} where $D(0,M)$ denotes the disc of radius $M$ around $0$. So $I(f)$ is $F_{\sigma \delta}$: a countable intersection of countable unions of closed sets. This raises the following question, posed by Rippon in 2009~\cite[Problem~8, p.~2960]{oberwolfach}. \begin{question}\label{qu:Fsigma} Is there a transcendental entire function $f$ for which $I(f)$ itself is $F_{\sigma}$? \end{question} Since any closed subset of ${\mathbb{C}}$ is a countable union of compact sets, it is equivalent to ask whether $I(f)$ is ever \emph{$\sigma$-compact} (a countable union of compact sets); compare also \cite{lipham}. It is well-known that $I(f)$ cannot be a $G_{\delta}$ (a countable intersection of open sets); see Lemma~\ref{lemma:Gdelta} below. As far as we are aware, there is no function $f$ for which Question~\ref{qu:Fsigma} has been previously resolved; the goal of this paper is to give a negative answer in general. In fact, we prove a stronger result, as follows. Let $\operatorname{UO}(f)$ consist of all $z\in{\mathbb{C}}$ whose orbit $\{f^n(z)\colon n\geq 0\}$ is unbounded, and let $\operatorname{BU}(f) = \operatorname{UO}(f)\setminus I(f)$ denote the ``bungee set''; see \cite{bungee}. Recall that the \emph{Julia set} $J(f)$ is the set of non-normality of the iterates of~$f$. \begin{thm}\label{thm:main} Let $f$ be a transcendental entire function. Then every $\sigma$-compact subset of $\operatorname{UO}(f)$ omits some point of $I(f)\cap J(f)$ and some point of $\operatorname{BU}(f)\cap J(f)$. In particular, the sets $I(f)$, $\operatorname{UO}(f)$, $\operatorname{BU}(f)$ and their intersections with $J(f)$ are not $\sigma$-compact. \end{thm} \subsection*{Acknowledgements} I thank David Lipham and Phil Rippon for interesting discussions. I also thank David Mart\'i-Pete, James Waterman and the referee for helpful comments that improved the presentation of the paper. \section{Proof of the Theorem} We require a result on the existence of arbitrarily slowly escaping points, which follows from work of Rippon and Stallard~\cite{ripponstallardannular}; see also~\cite[Theorem~1]{ripponstallardslow}. \begin{thm}\label{thm:slow} Let $f$ be a transcendental entire function, and let $R_0\geq 0$. Then there exists $M_0>R_0$ with the following property. If $(a_m)_{m=0}^{\infty}$ is a sequence with $a_m\to\infty$ and $a_m\geq M_0$ for all $m$, then there are $\zeta \in J(f)\cap I(f)$ and $\omega\in J(f)\cap \operatorname{BU}(f)$ with \[ R_0 \leq \lvert f^m(\zeta)\rvert \leq a_m\quad\text{and}\quad R_0 \leq \lvert f^m(\omega)\rvert \leq a_m \quad\text{for $m\geq 0$}. \] \end{thm} \begin{proof} The result is an easy consequence of~\cite{ripponstallardannular}, which studies ``annular itineraries'' of entire functions. Fix some $R>0$ such that $M(r)>r$ for $r\geq R$, where $M(r)$ denotes the maximum modulus of $f$ on the disc $\overline{D(0,r)}$. Then the \emph{annular itinerary} of a point $z$ is the sequence $(s_m)_{m=0}^{\infty}$ such that $s_m=0$ if $\lvert f^m(z)\rvert < R$, and \[ M^{s_m-1}(R) \leq \lvert f^m(z) \rvert < M^{s_m}(R) \] otherwise. (Here $M^k$ is the $k$-th iterate of $r\mapsto M(r)$.) Theorem 1.2 of~\cite{ripponstallardannular} implies that for suitable $R\geq R_0$, for an entry $s_m=n\geq 0$ in an annular itinerary, there is a subset $X_n\subset \{0,\dots,n+1\}$ of allowable next entries $s_{m+1}$, and that, for infinitely many $n$, all entries but at most one are allowable. More precisely, \begin{enumerate}[(a)] \item any sequence $(s_m)_{m=0}^{\infty}$ with $s_{m+1}\in X_{s_m}$ for all $m$ is the annular itinerary of some $z\in J(f)$;\label{item:admissible} \item $n+1\in X_n$ for all $n$; \item there is an increasing sequence $(n_j)_{j=1}^{\infty}$ such that $\# X_{n_j} \geq n+1$. \end{enumerate} (With the notation of~\cite{ripponstallardannular}, $X_{n_j}=\{0,\dots,n_j+1\}\setminus I_j$, where $\# I_j \leq 1$, and $X_n = \{n+1\}$ when $n\neq n_j$ for all $j$.) We may suppose that the sequence $(n_j)$ is chosen such that $n_1 \geq 2$. Set $M_0\defeq M^{n_1}(R)$ and let $(a_m)_{m=0}^{\infty}$ be a sequence as in the statement of the theorem. We may assume that $(a_m)$ is non-decreasing. Similarly as in the proof of \cite[Corollary~1.3~(d)]{ripponstallardannular}, we can construct an annular itinerary $(s_m)_{m=0}^{\infty}$ satisfying~\ref{item:admissible} such that $s_m\to\infty$ and \begin{equation}\label{eqn:slowgrowth} M^{s_m}(R) \leq a_m \qquad\text{for } m\geq 0. \end{equation} Indeed, for each $j$, either $n_j\in X_{n_j}$ or $n_{j}-1\in X_{n_j}$; let us denote this element of $X_{n_j}$ by $\tilde{n}_j$. Then any sequence of the form \[ (s_m)_{m=0}^{\infty} = \underbrace{n_1, \tilde{n}_1, n_1, \tilde{n}_1,\dots, n_1}_{\text{length }N_1},n_{1}+1, n_1+2, \dots, \underbrace{n_{2}, \tilde{n}_{2}, \dots, n_{2}}_{\text{length }N_2} ,n_{2} + 1, n_{2} + 2, \dots \] satisfies~\ref{item:admissible}. If $N_j$ is chosen sufficiently large that \begin{equation}\label{eqn:Nj} a_m \geq M^{n_{j+1}}(R) \quad\text{for } m\geq N_j, \end{equation} then~\eqref{eqn:slowgrowth} holds for $m\geq N_1$. It also holds for $m\leq N_1$, since $s_m\leq n_1$ for these values of $m$, and $a_m \geq M_0 = M^{n_1}(R)$ by assumption. Let $\zeta \in J(f)$ have annular itinerary $(s_m)_{m=0}^{\infty}$; then $\zeta\in I(f)$ and \[ R_0\leq R \leq M^{s_m-1}(R) \leq \lvert f^m(\zeta)\rvert < M^{s_m}(R) \leq a_m \quad \text{for all $m$}. \] Hence $\zeta$ has the desired properties. To obtain $\omega$, we instead use an unbounded but non-escaping sequence of the form \[(\tilde{s}_m)_{m=0}^{\infty} = B_1,n_{1}+1, n_1+2, \dots, n_{2}, \hat{n}_2, B_2 , n_1+1,n_1+2,\dots,n_3,\hat{n}_3, B_3,\dots, \] where $\hat{n}_j\in X_{n_j}$ is either $n_1$ or $n_1-1$, and $B_j$ is a block alternating between entries $n_1$ and $\tilde{n}_1$. To ensure that the sequence satisfies~\ref{item:admissible}, $B_j$ should end in $n_1$; it should begin with $n_1$ if $\hat{n}_j=n_1-1$, and with $\tilde{n}_1$ if $\hat{n}_j = n_1$. The length $N_j$ of the block $B_j$ is again chosen to satisfy~\eqref{eqn:Nj}. \end{proof} \begin{proof}[{Proof of Theorem~\ref{thm:main}}] If $D\subset{\mathbb{C}}$ is closed and $z\in{\mathbb{C}}$, we set \[ n_D(z) \defeq \min\{n\geq 0\colon f^n(z)\notin D\} \leq \infty, \] with the convention that $n_D(z)=\infty$ if no such $n$ exists. Observe that $n_D$ depends upper semicontinuously on $z$, as the infimum of upper semicontinuous functions. Indeed, \[ n_D(z) = \min\{\chi_n(z) \colon n \geq 0\}, \qquad\text{where}\qquad \chi_n(z) = \begin{cases} \infty & \text{if } z\in f^{-n}(D) \\ n & \text{if } z\notin f^{-n}(D),\end{cases} \] and each $\chi_n$ is upper semicontinuous since $f^{-n}(D)$ is closed. Note also that $z\in \operatorname{UO}(f)$ if and only if $n_D(z)<\infty$ for every compact $D\subset{\mathbb{C}}$. Now let $R_0 \geq 0$ be arbitrary, and choose $M_0$ as in Theorem~\ref{thm:slow}. Let $X\subset \operatorname{UO}(f)$ be $\sigma$-compact; say $X = \bigcup_{j=0}^{\infty} K_j$ where each $K_j$ is compact. Define $M_j \defeq M_0 +j$ and $D_j \defeq \overline{D(0,M_j)}$. Then $n_{D_j}(z)<\infty$ for every $z\in K_j$. Since $K_j$ is compact and $n_{D_j}$ is upper semicontinuous, \[ n_j \defeq \max_{z\in K_j} n_{D_j}(z) \] exists for every $j$. Set $N_0\defeq n_0$ and $N_{j+1}\defeq \max\{n_{j+1},N_j+1\}$. For $n\geq 0$, define $j(n)\defeq\min\{j\colon N_j\geq n\}$ and \[ a_n \defeq M_{j(n)} = \min\{ M_j \colon N_j\geq n \}. \] Then $a_n\geq M_0$ for all $n$ and $\lim_{n\to\infty} a_n = \infty$. So by Theorem~\ref{thm:slow}, there are $\zeta\in I(f)\cap J(f)$ and $\omega\in \operatorname{BU}(f)\cap J(f)$ such that $\lvert f^n(z)\rvert \leq a_n$ for $z\in \{\zeta,\omega\}$ and all $n\geq 0$. Let $j\geq 0$. Then, for $n\leq n_j\leq N_j$, we have $\lvert f^n(z)\rvert \leq a_n \leq M_j$, and hence $f^n(z) \in D_j$. So $n_{D_j}(z) > n_j$, and $z\notin K_j$ by choice of $n_j$. Thus $z\notin X = \bigcup_{j=0}^{\infty} K_j$, as claimed. \end{proof} By the expanding property of the Julia set, we also obtain the following answer to a question of Lipham (personal communication). \begin{cor}\label{cor:nowheresigmacompact} Let $f$ be a transcendental entire function and let $Y$ be one of the sets $I(f)\cap J(f)$, $\operatorname{UO}(f)\cap J(f)$ and $\operatorname{BU}(f)\cap J(f)$. Then $Y$ is nowhere $\sigma$-compact. That is, if $X\subset Y$ is $\sigma$-compact, then $X$ does not contain a non-empty relatively open subset of $Y$. \end{cor} \begin{proof} We prove a slightly stronger statement. Let $Y$ be as in the statement and let $X\subset \operatorname{UO}(f)\cap J(f)$ be $\sigma$-compact. If $U\subset{\mathbb{C}}$ is open with $U\cap Y \neq \emptyset$, then $X$ omits some point of $U\cap Y$. Let $R_0$ and $M_0$ be as in Theorem~\ref{thm:slow}, and set $L_0\defeq J(f)\cap \overline{D(0,M_0)}\setminus D(0,R_0)$. If $R_0$ is chosen sufficiently large, then $L_0$ contains no Fatou exceptional point of $f$. (Recall that a Fatou exceptional point is a point with finite backward orbit, and that $f$ has at most one finite exceptional point \cite[p.~156]{waltersurvey}.) Since $U\cap J(f)\neq \emptyset$, it follows that there is some $n$ such that $f^n(U)\supset L_0$. The proof of Theorem~\ref{thm:main} shows that no $\sigma$-compact subset of $\operatorname{UO}(f)\cap J(f)$ contains $L_0\cap Y$. (Note that we may take $a_0=M_0$ in the proof to ensure that $\lvert \zeta \rvert,\lvert \omega\rvert \leq M_0$.) Moreover, $f^n(X)$ is $\sigma$-compact as the image of a $\sigma$-compact set under a continuous function. So $f^n(X)$ omits some points of $L_0\cap Y$. Since $Y$ is backward-invariant, $X$ omits some points of $U\cap Y$, as claimed. \end{proof} We remark that the proof of Theorem~\ref{thm:main} establishes the following very general principle: \begin{prop}[Abstract version of the main theorem]\label{prop:abstract} Let $f\colon U\to V$ be continuous, where $U,V$are non-empty topological spaces and $U$ is $\sigma$-compact. Let $\operatorname{UO}(f)$ denote the set of $z\in U$ such that $f^n(z)$ is defined and in $U$ for all $n\geq 0$, but the orbit $\{f^n(z)\}$ is not contained in any compact subset of $U$. Suppose that $X\subset \operatorname{UO}(f)$ is $\sigma$-compact and $\Delta\subset U$ is compact. Then there is a sequence $(\Delta_n)_{n=0}^{\infty}$ of compact subsets $\Delta_n\subset U$ with $\Delta\subset \Delta_0\subset \Delta_1\subset \dots$ and $\bigcup_{n=0}^{\infty} \Delta_n = U$ such that $X$ contains no point $\zeta\in \operatorname{UO}(f)$ with $f^n(\zeta)\in \Delta_n$ for all $n\geq 0$. \end{prop} \begin{remark} Note that we are not assuming any relation between the spaces $U$ and $V$. However, the statement is vacuous when $\operatorname{UO}(f)=\emptyset$, and in particular when $U\cap V\neq \emptyset$. \end{remark} \begin{sketch} Let $(D_j)_{j=0}^{\infty}$ be an increasing sequence of compact subsets $D_j\subset U$ with $\bigcup _{j=0}^{\infty} D_j= U$. Define $j(n)$ as in the proof of Theorem~\ref{thm:main}; then the sets $\Delta_n \defeq D_{j(n)}$ have the desired property. \end{sketch} It follows that the set of escaping points is not $\sigma$-compact in any setting where an analogue of Theorem~\ref{thm:slow} holds. This includes: \begin{enumerate}[(a)] \item transcendental meromorphic functions ${\mathbb{C}}\to\hat{\C}$ \cite{ripponstallardslow};\label{item:mero} \item transcendental self-maps of the punctured plane \cite[Theorem~1.2]{martipeteCstar};\label{item:Cstar} \item quasiregular self-maps $f\colon {\mathbb{R}}^d\to{\mathbb{R}}^d$ of transcendental type \cite{nicksslow}; \item continuous functions $\phi\colon [0,\infty)\to [0,\infty)$ with $\phi(t)\not\to\infty$ as $t\to\infty$, and such that $I(\phi)\neq \emptyset$ \cite[Theorem~2.2]{osborneripponstallard}. \end{enumerate} A more general setting than both~\ref{item:mero} and \ref{item:Cstar} is provided by the \emph{Ahlfors islands maps} of Epstein; see e.g.~\cite{exotic}. These are maps $f\colon W\to X$, where $X$ is a compact one-dimensional manifold, $W\subset X$ is open, and $f$ satisfies certain transcendence conditions near $\partial W$. We may define the escaping set $I(f)$ as the set of points $z\in W$ with $f^n(z)\in W$ for all $n$ and $\operatorname{dist}(f^n(z),\partial W)\to 0$ as $n\to\infty$. It is plausible that an analogue of Theorem~\ref{thm:slow} holds for Ahlfors islands maps with $W\neq X$, using a similar proof as in~\cite{ripponstallardslow}. This would mean, by Proposition~\ref{prop:abstract}, that $I(f)$ is not $\sigma$-compact for such functions. For completeness, we conclude by giving the simple proof that $I(f)$ is never a $G_{\delta}$ set; compare also \cite[Corollary~3.2]{liphametds}. \begin{lem}\label{lemma:Gdelta} Let $f$ be a transcendental entire function. Then $I(f)$ and $I(f)\cap J(f)$ are not $G_{\delta}$ sets. \end{lem} \begin{proof} Every closed subset of ${\mathbb{C}}$ (or any metric space) is $G_{\delta}$; so $J(f)$ is $G_{\delta}$. The intersection of two $G_{\delta}$ sets is again $G_{\delta}$, so it is enough to prove the claim for $I(f)\cap J(f)$. By \cite[Theorem~2]{alexescaping}, $I(f)\cap J(f)$ is nonempty, and hence dense in $J(f)$ by Montel's theorem. By Baire's theorem, any two dense $G_{\delta}$ subsets of $J(f)$ must intersect. Hence it is enough to observe that $\operatorname{BU}(f)\cap J(f)$ contains a dense $G_{\delta}$ by Montel's theorem, namely the set of points whose orbits are dense in $J(f)$. (See \cite[Lemma~1]{bakerdominguezresidual}.) \end{proof} Lipham has pointed out the following reformulation of Corollary~\ref{cor:nowheresigmacompact}. \begin{cor} Any $G_{\delta}$ set $A\subset Y\defeq J(f)\setminus I(f)$ is nowhere dense in $Y$. In particular, $Y$ is $G_{\delta \sigma}$ but not \emph{strongly $\sigma$-complete}; that is, it cannot be written as a countable union of relatively closed $G_{\delta}$ subsets. \end{cor} \begin{proof} Suppose, by contradiction, that $\overline{D(\zeta,\varepsilon)}\cap Y \subset A$ for some $\zeta\in J(f)$ and $\varepsilon>0$. The complement of a $G_{\delta}$ set is $F_{\sigma}$, so $B \defeq J(f)\cap \overline{D(\zeta,\varepsilon)} \setminus A$ is an $F_{\sigma}$ set with \[ D(\zeta,\varepsilon)\cap I(f)\cap J(f)\subset B \subset I(f)\cap J(f),\] which contradicts Corollary~\ref{cor:nowheresigmacompact}. The set $Y$ is $G_{\delta \sigma}$ by definition. As mentioned in the proof of Lemma~\ref{lemma:Gdelta}, $Y$ contains a $G_{\delta}$ subset $U$ that is dense in $J(f)$. On the other hand, if $(A_k)_{k=0}^{\infty}$ is a sequence of relatively closed $G_{\delta}$ subsets of $Y$, then $\overline{A_k}$ is closed and nowhere dense in $J(f)$. Hence \[ \bigcup_{k=0}^{\infty} A_k \subset \bigcup_{k=0}^{\infty} \overline{A_k} \not\supset U \subset Y, \] by Baire's theorem, and $Y$ is indeed strongly $\sigma$-complete. \end{proof} \providecommand{\href}[2]{#2}
\section*{Acknowledgements} This work was supported by NSF Award CPS-1953740 and a Siebel Energy Institute grant. \section{Information on Datasets} \begin{table}[H] \centering \caption{Data representation dimensions for each dataset.} \label{tab:feature_dimensions} \begin{tabular}{|c|c|c|c|c|} \toprule Device & \Cell{IAT,\$IAT$-FFT} & \Cell{SIZE,\$SIZE$-FFT} & \Cell{STATS} & \Cell{SAMP-NUM,\\SAMP-NUM-FFT,\\SAMP-SIZE} \\ \midrule \multirow{5}{*}\ PC1 & 14&15&10&14 \\ \ PC2 & 16&17&10&16 \\ \ PC3 & 15&16&10&15 \\ \ PC4 & 17&18&10&17 \\ \ PC5 & 17&18&10&17 \\ \midrule \ 2Rsps & 8&9&10&8\\ \midrule \ 2PCs & 25&26&10&25\\ \midrule \multirow{5}{*}\ TV\&PC & 12&13&10&12 \\ \ GHom & 19&20&10&19 \\ \ SCam & 6&7&10&6 \\ \ SFrig & 30&31&10&30 \\ \ BSTch & 148&149&10&148 \\ \bottomrule \end{tabular} \end{table} \begin{table}[H] \centering \caption{Train and Test sample set sizes.} \label{tab:train_test_sets} \begin{tabular}{|c|c|l|l|} \toprule Reference & Devices & Train set size & Test set sizes \\ \midrule \multirow{5}{*}{UNB IDS } & PC1 & Normal: 10000 & Normal: 179, Attack: 179 \\ & PC2 & Normal: 10000 & Normal: 257, Attack: 257 \\ & PC3 & Normal: 10000 & Normal: 221, Attack: 221 \\ & PC4 & Normal: 10000 & Normal: 209, Attack: 209 \\ & PC5 & Normal: 10000 & Normal: 360, Attack: 360 \\ \midrule CTU IoT & 2Rsps & Normal: 3991 & Normal: 400, Novel device: 400 \\ \midrule MAWI & 2PCs & Normal: 824 & Normal: 400, Novel device: 400 \\ \midrule \multirow{5}{*}{Private IoT } & TV\&PC & Normal: 4636 & Normal: 346, Novel device: 346 \\ & GHom & Normal: 7376 & Normal: 513, Novel activity: 513 \\ & SCam & Normal: 10000 & Normal: 197, Novel activity: 197 \\ & SFrig & Normal: 2952 & Normal: 296, Novel activity: 296 \\ & BSTch & Normal: 997 & Normal: 236, Novel activity: 236 \\ \bottomrule \end{tabular} \end{table} \newpage \section{Evaluation with Best Parameters} \begin{longtable}{|c|c|g|c|g|c|g|c|} \caption{AUCs for 4 ML approaches on basic feature representations with best parameters.} \label{tab:OCSVM_IF_AE_KDE_with_best_parameters} \endfirsthead \endhead \toprule Detector & Dataset & \Cell{STATS} & \Cell{SIZE} & \Cell{IAT} & \Cell{IAT+\$SIZE$} & \Cell{SAMP-\\NUM} & \Cell{SAMP-\$SIZE$} \\ \midrule \multirow{5}{*}{OCSVM} &UNB(PC2) & 0.64 & 0.75 & 0.82 & 0.81 & 0.82 & 0.85 \\ &UNB(PC3) & 0.59 & 0.85 & 0.87 & 0.88 & 0.83 & 0.85 \\ &UNB(PC5) & 0.47 & 0.73 & 0.84 & 0.86 & 0.76 & 0.81 \\ \cmidrule{2-8} &GHom & 0.76 & 0.97 & 0.70 & 0.70 & 0.95 & 0.96\\ &SCam & 0.58 & 0.61 & 0.56 & 0.62 & 0.56 & 0.61\\ \midrule \multirow{5}{*}{IF} &UNB(PC2) & 0.68 & 0.61 & 0.68 & 0.75 & 0.81 & 0.80 \\ &UNB(PC3) & 0.62 & 0.63 & 0.70 & 0.79 & 0.81 & 0.80 \\ &UNB(PC5) & 0.55 & 0.61 & 0.69 & 0.74 & 0.79 & 0.74 \\ \cmidrule{2-8} &GHom & 0.88 & 0.77 & 0.44 & 0.54 & 0.96 & 0.96\\ &SCam & 0.52 & 0.51 & 0.53 & 0.54 & 0.60 & 0.56\\ \midrule \multirow{5}{*}{AE} &UNB(PC2) & 0.78 & 0.66 & 0.71 & 0.83 & 0.83 & 0.77 \\ &UNB(PC3) & 0.76 & 0.58 & 0.71 & 0.90 & 0.85 & 0.80 \\ &UNB(PC5) & 0.82 & 0.66 & 0.73 & 0.87 & 0.88 & 0.87 \\ \cmidrule{2-8} &GHom & 0.84 & 0.69 & 0.35 & 0.86 & 0.97 & 0.96\\ &SCam & 0.63 & 0.61 & 0.57 & 0.65 & 0.61 & 0.60\\ \midrule \multirow{5}{*}{KDE} &UNB(PC2) & 0.61 & 0.73 & 0.82 & 0.80 & 0.81 & 0.80 \\ &UNB(PC3) & 0.53 & 0.84 & 0.84 & 0.87 & 0.82 & 0.85 \\ &UNB(PC5) & 0.53 & 0.69 & 0.84 & 0.86 & 0.75 & 0.82 \\ \cmidrule{2-8} &GHom & 0.60 & 0.97 & 0.71 & 0.72 & 0.96 & 0.96\\ &SCam & 0.52 & 0.50 & 0.56 & 0.63 & 0.54 & 0.60\\ \bottomrule \end{longtable} \newpage \begin{longtable}{|c|c|g|c|g|c|g|c|} \caption{AUCs for GMM and PCA on basic feature representations with best parameters.} \label{tab:GMM_and_PCA_basic_representation_with_best_parameters} \endfirsthead \endhead \toprule Detector & Dataset & \Cell{STATS} & \Cell{SIZE} & \Cell{IAT} & \Cell{IAT+\$SIZE$} & \Cell{SAMP-\\NUM} & \Cell{SAMP-\$SIZE$} \\ \midrule \multirow{12}{*}{GMM} &UNB(PC1) & 0.55 & 0.59 & 0.62 & 0.75 & 0.84 & 0.74 \\ &UNB(PC2) & 0.84 & 0.72 & 0.71 & 0.74 & 0.83 & 0.84 \\ &UNB(PC3) & 0.87 & 0.78 & 0.75 & 0.91 & 0.83 & 0.81 \\ &UNB(PC4) & 0.68 & 0.59 & 0.61 & 0.65 & 0.89 & 0.86 \\ &UNB(PC5) & 0.60 & 0.64 & 0.72 & 0.79 & 0.85 & 0.76 \\ \cmidrule{2-8} &CTU & 0.98 & 0.96 & 0.90 & 0.93 & 0.91 & 0.88\\ \cmidrule{2-8} &MAWI & 0.80 & 0.63 & 0.53 & 0.59 & 0.62 & 0.69\\ \cmidrule{2-8} &TV\&PC & 1.00 & 1.00 & 0.97 & 0.99 & 0.99 & 0.99\\ \cmidrule{2-8} &GHom & 0.96 & 0.93 & 0.90 & 0.93 & 0.97 & 0.96\\ &SCam & 0.62 & 0.61 & 0.59 & 0.63 & 0.63 & 0.65\\ &SFrig & 0.97 & 0.97 & 0.95 & 0.97 & 0.96 & 0.95 \\ &BSTch & 0.99 & 0.99 & 0.98 & 0.99 & 0.98 & 0.97 \\ \midrule \multirow{12}{*}{PCA} &UNB(PC1) & 0.74 & 0.41 & 0.35 & 0.93 & 0.86 & 0.85 \\ &UNB(PC2) & 0.86 & 0.67 & 0.71 & 0.82 & 0.85 & 0.81 \\ &UNB(PC3) & 0.75 & 0.56 & 0.70 & 0.88 & 0.83 & 0.82 \\ &UNB(PC4) & 0.72 & 0.52 & 0.65 & 0.82 & 0.89 & 0.88 \\ &UNB(PC5) & 0.79 & 0.64 & 0.73 & 0.87 & 0.91 & 0.89 \\ \cmidrule{2-8} &CTU & 0.95 & 0.95 & 0.84 & 0.97 & 0.84 & 0.87\\ \cmidrule{2-8} &MAWI & 0.66 & 0.71 & 0.49 & 0.74 & 0.59 & 0.54\\ \cmidrule{2-8} &TV\&PC & 1.00 & 1.00 & 0.96 & 1.00 & 0.94 & 0.94\\ \cmidrule{2-8} &GHom & 0.85 & 0.71 & 0.34 & 0.97 & 0.97 & 0.96\\ &SCam & 0.63 & 0.61 & 0.57 & 0.65 & 0.62 & 0.59\\ &SFrig & 0.97 & 0.95 & 0.79 & 0.97 & 0.96 & 0.96 \\ &BSTch & 0.96 & 0.98 & 0.99 & 0.99 & 0.97 & 0.97 \\ \bottomrule \end{longtable} \newpage \subsection{Effect of Fourier Domain Representation} The figures below show the difference in AUC for the FFT vs. raw timeseries representations with the best model parameters for each model. FFT transformations have little effect on model accuracy. \begin{figure}[H] \centering \includegraphics[width=0.99\textwidth ]{OCSVM_IF_AE_KDE_with_best_parameters_on_basic_representations_rest_diff.pdf} \caption{Difference in AUC for {\bf FFT vs. raw time series} representations with best parameters.} \label{fig:OCSVM_IF_AE_KDE_with_best_parameters_on_basic_representations_diff} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.99\textwidth]{GMM_PCA_with_best_parameters_on_basic_representations_diff.pdf} \caption{Difference in AUC for {\bf FFT vs. raw time series} representations generated by GMM and PCA with best parameters.} \label{fig:GMM_PCA_with_best_parameters_on_basic_representations_diff} \end{figure} \subsection{Effect of Packet Size Information} The figures below show the difference in AUC for including vs. excluding packet size information for different models: IAT and SAMP. Including packet size can significantly improve model accuracy in certain cases. \begin{figure}[H] \centering \includegraphics[width=0.99\textwidth ]{Effect_of_Size_OCSVM_IF_AE_KDE_with_best_parameters_rest_diff.pdf} \caption{Differences in AUC due to {\bf including vs. excluding packet size} information with best parameters.} \label{fig:Effect_of_Size_OCSVM_IF_AE_KDE_with_best_parameters_diff} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.99\textwidth]{Effect_of_Size_GMM_PCA_with_best_parameters_diff.pdf} \caption{Differences in AUC due to {\bf including vs. excluding packet size} information generated by GMM and PCA with best parameters.} \label{fig:Effect_of_Size_GMM_PCA_with_best_parameters_diff} \end{figure} \subsection{Effect of Packet Header} The figures below show the difference in AUC for including vs. excluding packet header information (i.e., IP TTL, TCP flags) for different models: STATS, IAT, and SAMP. Including packet header information almost always improves model accuracy for these models. \begin{figure}[H] \centering \includegraphics[width=0.99\textwidth ]{Effect_of_Packet_Header_OCSVM_IF_AE_KDE_with_best_parameters_rest_diff.pdf} \caption{Differences in AUC due to {\bf including vs. excluding packet header} information with best parameters.} \label{fig:Effect_of_Packet_Header_OCSVM_IF_AE_KDE_with_best_parameters_diff} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.99\textwidth]{Effect_of_Packet_Header_GMM_PCA_with_best_parameters_diff.pdf} \caption{Differences in AUC due to {\bf including vs. excluding packet header} information generated by GMM and PCA with best parameters.} \label{fig:Effect_of_Packet_Header_GMM_PCA_with_best_parameters_diff} \end{figure} \newpage \section{Evaluation with Default Parameters} \begin{scriptsize} \begin{longtable}{|c|c|g|c|g|c|g|c|} \caption{AUCs for 4 ML approaches on basic feature representations with default parameters.} \label{tab:OCSVM_IF_AE_and_KDE_with_default_parameters} \\ \toprule Detector & Dataset & \Cell{STATS} & \Cell{SIZE} & \Cell{IAT} & \Cell{IAT+S\\IZE} & \Cell{SAMP-\\NUM} & \Cell{SAMP-\$SIZE$} \\ \midrule \multirow{12}{*}{OCSVM} &UNB(PC1) & 0.56 & 0.20 & 0.40 & 0.89 & 0.66 & 0.74 \\ &UNB(PC2) & 0.43 & 0.66 & 0.82 & 0.74 & 0.79 & 0.85 \\ &UNB(PC3) & 0.30 & 0.83 & 0.82 & 0.85 & 0.82 & 0.85 \\ &UNB(PC4) & 0.42 & 0.58 & 0.82 & 0.76 & 0.67 & 0.78 \\ &UNB(PC5) & 0.41 & 0.64 & 0.84 & 0.82 & 0.75 & 0.74 \\ \cmidrule{2-8} &CTU & 0.96 & 0.97 & 0.95 & 0.96 & 0.88 & 0.88\\ \cmidrule{2-8} &MAWI & 0.43 & 0.38 & 0.56 & 0.38 & 0.58 & 0.59\\ \cmidrule{2-8} &TV\&PC & 1.00 & 1.00 & 0.94 & 0.98 & 0.70 & 0.86\\ \cmidrule{2-8} &GHom & 0.73 & 0.97 & 0.10 & 0.11 & 0.95 & 0.94\\ &SCam & 0.58 & 0.51 & 0.54 & 0.61 & 0.59 & 0.58\\ &SFrig & 0.91 & 0.90 & 0.77 & 0.84 & 0.94 & 0.95 \\ &BSTch & 0.96 & 0.98 & 0.94 & 0.98 & 0.92 & 0.92 \\ \midrule \multirow{12}{*}{IF} &UNB(PC1) & 0.47 & 0.45 & 0.48 & 0.69 & 0.65 & 0.65 \\ &UNB(PC2) & 0.65 & 0.61 & 0.68 & 0.74 & 0.80 & 0.75 \\ &UNB(PC3) & 0.61 & 0.62 & 0.70 & 0.73 & 0.80 & 0.72 \\ &UNB(PC4) & 0.45 & 0.46 & 0.61 & 0.61 & 0.81 & 0.70 \\ &UNB(PC5) & 0.47 & 0.59 & 0.69 & 0.70 & 0.78 & 0.72 \\ \cmidrule{2-8} &CTU & 0.94 & 0.92 & 0.78 & 0.88 & 0.83 & 0.84\\ \cmidrule{2-8} &MAWI & 0.86 & 0.68 & 0.53 & 0.66 & 0.56 & 0.55\\ \cmidrule{2-8} &TV\&PC & 0.95 & 0.98 & 0.89 & 0.99 & 0.73 & 0.78\\ \cmidrule{2-8} &GHom & 0.86 & 0.68 & 0.44 & 0.47 & 0.96 & 0.96\\ &SCam & 0.51 & 0.51 & 0.52 & 0.54 & 0.56 & 0.56\\ &SFrig & 0.96 & 0.95 & 0.54 & 0.94 & 0.93 & 0.93 \\ &BSTch & 0.94 & 0.98 & 0.94 & 0.98 & 0.96 & 0.96 \\ \midrule \multirow{12}{*}{AE} &UNB(PC1) & 0.66 & 0.39 & 0.33 & 0.75 & 0.78 & 0.75 \\ &UNB(PC2) & 0.74 & 0.54 & 0.56 & 0.81 & 0.78 & 0.76 \\ &UNB(PC3) & 0.65 & 0.56 & 0.71 & 0.81 & 0.83 & 0.78 \\ &UNB(PC4) & 0.60 & 0.39 & 0.63 & 0.74 & 0.85 & 0.86 \\ &UNB(PC5) & 0.79 & 0.25 & 0.37 & 0.79 & 0.84 & 0.85 \\ \cmidrule{2-8} &CTU & 0.91 & 0.95 & 0.80 & 0.96 & 0.80 & 0.76\\ \cmidrule{2-8} &MAWI & 0.45 & 0.50 & 0.48 & 0.60 & 0.57 & 0.54\\ \cmidrule{2-8} &TV\&PC & 1.00 & 1.00 & 0.96 & 0.99 & 0.77 & 0.88\\ \cmidrule{2-8} &GHom & 0.77 & 0.62 & 0.33 & 0.70 & 0.96 & 0.95\\ &SCam & 0.61 & 0.61 & 0.56 & 0.61 & 0.59 & 0.55\\ &SFrig & 0.92 & 0.78 & 0.71 & 0.91 & 0.96 & 0.96 \\ &BSTch & 0.95 & 0.87 & 0.97 & 0.98 & 0.96 & 0.95 \\ \midrule \multirow{12}{*}{KDE} &UNB(PC1) & 0.28 & 0.37 & 0.51 & 0.92 & 0.74 & 0.75 \\ &UNB(PC2) & 0.59 & 0.63 & 0.82 & 0.74 & 0.77 & 0.80 \\ &UNB(PC3) & 0.52 & 0.78 & 0.82 & 0.83 & 0.82 & 0.84 \\ &UNB(PC4) & 0.37 & 0.51 & 0.71 & 0.77 & 0.81 & 0.84 \\ &UNB(PC5) & 0.33 & 0.62 & 0.84 & 0.84 & 0.74 & 0.81 \\ \cmidrule{2-8} &CTU & 0.96 & 0.94 & 0.93 & 0.97 & 0.82 & 0.84\\ \cmidrule{2-8} &MAWI & 0.66 & 0.38 & 0.56 & 0.41 & 0.57 & 0.56\\ \cmidrule{2-8} &TV\&PC & 1.00 & 1.00 & 0.95 & 0.98 & 0.66 & 0.83\\ \cmidrule{2-8} &GHom & 0.55 & 0.94 & 0.05 & 0.46 & 0.96 & 0.95\\ &SCam & 0.49 & 0.51 & 0.55 & 0.60 & 0.56 & 0.57\\ &SFrig & 0.94 & 0.91 & 0.73 & 0.77 & 0.94 & 0.94 \\ &BSTch & 0.96 & 0.96 & 0.95 & 0.98 & 0.92 & 0.91 \\ \bottomrule \end{longtable} \end{scriptsize} \begin{longtable}{|c|c|g|c|g|c|g|c|} \caption{AUCs for 2 additional ML approaches (GMM and PCA) on basic feature representations with default parameters.} \label{tab:GMM_and_PCA_basic_representation_with_default_parameters} \endfirsthead \endhead \toprule Detector & Dataset & \Cell{STATS} & \Cell{SIZE} & \Cell{IAT} & \Cell{IAT+S\\IZE} & \Cell{SAMP-\\NUM} & \Cell{SAMP-\$SIZE$} \\ \midrule \multirow{12}{*}{GMM} &UNB(PC1) & 0.37 & 0.23 & 0.16 & 0.81 & 0.76 & 0.73 \\ &UNB(PC2) & 0.56 & 0.52 & 0.65 & 0.71 & 0.85 & 0.54 \\ &UNB(PC3) & 0.52 & 0.61 & 0.75 & 0.90 & 0.81 & 0.56 \\ &UNB(PC4) & 0.40 & 0.47 & 0.60 & 0.57 & 0.81 & 0.82 \\ &UNB(PC5) & 0.36 & 0.43 & 0.70 & 0.71 & 0.71 & 0.73 \\ \cmidrule{2-8} &CTU & 0.95 & 0.92 & 0.89 & 0.84 & 0.88 & 0.84\\ \cmidrule{2-8} &MAWI & 0.65 & 0.37 & 0.52 & 0.40 & 0.60 & 0.58\\ \cmidrule{2-8} &TV\&PC & 1.00 & 0.88 & 0.86 & 0.57 & 0.60 & 0.80\\ \cmidrule{2-8} &GHom & 0.33 & 0.30 & 0.06 & 0.39 & 0.96 & 0.96\\ &SCam & 0.47 & 0.46 & 0.52 & 0.60 & 0.54 & 0.59\\ &SFrig & 0.73 & 0.91 & 0.82 & 0.93 & 0.96 & 0.95 \\ &BSTch & 0.96 & 0.95 & 0.93 & 0.99 & 0.93 & 0.90 \\ \midrule \multirow{12}{*}{PCA} &UNB(PC1) & 0.66 & 0.29 & 0.27 & 0.65 & 0.72 & 0.85 \\ &UNB(PC2) & 0.59 & 0.67 & 0.43 & 0.32 & 0.84 & 0.77 \\ &UNB(PC3) & 0.71 & 0.48 & 0.70 & 0.48 & 0.73 & 0.68 \\ &UNB(PC4) & 0.65 & 0.22 & 0.64 & 0.63 & 0.89 & 0.69 \\ &UNB(PC5) & 0.73 & 0.29 & 0.44 & 0.78 & 0.66 & 0.67 \\ \cmidrule{2-8} &CTU & 0.95 & 0.94 & 0.80 & 0.97 & 0.77 & 0.79\\ \cmidrule{2-8} &MAWI & 0.65 & 0.71 & 0.46 & 0.54 & 0.59 & 0.51\\ \cmidrule{2-8} &TV\&PC & 0.98 & 0.97 & 0.40 & 0.99 & 0.94 & 0.94\\ \cmidrule{2-8} &GHom & 0.20 & 0.71 & 0.30 & 0.97 & 0.96 & 0.95\\ &SCam & 0.55 & 0.61 & 0.49 & 0.64 & 0.62 & 0.58\\ &SFrig & 0.96 & 0.90 & 0.76 & 0.97 & 0.96 & 0.95 \\ &BSTch & 0.95 & 0.98 & 0.97 & 0.98 & 0.97 & 0.96 \\ \bottomrule \end{longtable} \newpage \subsection{Effect of Fourier Domain Representation} The figures below show differences in model accuracy for Fourier domain representation vs. raw timeseries representations for different models and datasets. Fourier domain representations in general do not improve model accuracy. \begin{figure}[H] \centering \includegraphics[width=0.99\textwidth]{OCSVM_IF_AE_KDE_with_default_parameters_on_basic_representations_diff.pdf} \caption{Difference in AUC for {\bf FFT vs. raw time series} representations with default parameters.} \label{fig:OCSVM_IF_AE_KDE_with_default_parameters_on_basic_representations_diff} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.99\textwidth]{GMM_PCA_with_default_parameters_on_basic_representations_diff.pdf} \caption{Difference in AUC for {\bf FFT vs. raw time series} representations generated by GMM and PCA with default parameters.} \label{fig:GMM_PCA_with_default_parameters_on_basic_representations_diff} \end{figure} \newpage \subsection{Effect of Packet Size Information} The figures below show differences in model accuracy as a result of including packet size information for different models and datasets. Packet size information generally improves model accuracy. \begin{figure}[H] \centering \includegraphics[width=0.99\textwidth ]{Effect_of_Size_OCSVM_IF_AE_KDE_with_default_parameters_diff.pdf} \caption{Differences in AUC due to {\bf including vs. excluding packet size} information with default parameters.} \label{fig:Effect_of_Size_OCSVM_IF_AE_KDE_with_default_parameters_diff} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.99\textwidth]{Effect_of_Size_GMM_PCA_with_default_parameters_diff.pdf} \caption{Differences in AUC due to {\bf including vs. excluding packet size} information generated by GMM and PCA with default parameters.} \label{fig:Effect_of_Size_GMM_PCA_with_default_parameters_diff} \end{figure} \newpage \subsection{Effect of Packet Header} The figures below show differences in model accuracy as a result of including packet header information for different models and datasets. Packet header information generally improves model accuracy. \begin{figure}[H] \centering \includegraphics[width=0.99\textwidth ]{Effect_of_Packet_Header_OCSVM_IF_AE_KDE_with_default_parameters_diff.pdf} \caption{Differences in AUC due to {\bf including vs. excluding packet header} information with default parameters.} \label{fig:Effect_of_Packet_Header_OCSVM_IF_AE_KDE_with_default_parameters_diff} \end{figure} \begin{figure}[H] \centering \includegraphics[width=0.99\textwidth]{Effect_of_Packet_Header_GMM_PCA_with_default_parameters_diff.pdf} \caption{Differences in AUC due to {\bf including vs. excluding packet header} information generated by GMM and PCA with default parameters.} \label{fig:Effect_of_Packet_Header_GMM_PCA_with_default_parameters_diff} \end{figure} \section{Conclusion}\label{sec:conclusion} Novelty detection problems in computer networking require making important decisions about how to represent traffic data. Traffic data are captured as ``raw'' packet captures, where each packet has an individual timestamp, thus taking the format of an irregularly sampled timeseries. The data itself must be subsequently transformed into a representation for model input; often, the representation of the input data can be as important for model accuracy as the choice of the model or model parameters. This paper takes a first step towards exploring the effects of network traffic representation for novelty detection, focusing on a range of novel behaviors in the Internet of Things (IoT)---security events, novel devices, and novel human behaviors and interactions. We use a collection of datasets to evaluate different traffic representations across a range of models. Our work reveals several important findings: (1)~popular Fourier domain representations do not significantly improve accuracy over simple time-domain representations; (2)~representations that include traffic sizes and packet header fields (e.g., IP TTL, TCP flags) can significantly improve model accuracy as measured by area under the curve (AUC). This study has important implications for the design of future measurement and analysis systems that use network traffic data for novelty detection, in the IoT and more generally for deployed network systems. From a systems perspective, capturing full packet traces can introduce significant costs, yet aggressive aggregation can preclude certain data representations that are important for model accuracy. In particular, we find that raw packet traces can be summarized in terms of flow-level statistics in short time windows or inter-arrival times, and augmented with sequences of packet sizes and flags; augmentation of simple timeseries representations with this metadata significantly improves accuracy. \section{Introduction} An increasing number of interconnected ``Internet-of-Things'' (IoT) are being deployed to monitor and manage homes, buildings, infrastructure, and even outdoor spaces. An intention of many such deployments is to monitor the environment for new, unusual, or anomalous activities---in other words, patterns that have previously not been observed. Such new or unusual activities can be indicative of many types of noteworthy events, including network or physical security incidents, device or infrastructure malfunctions, even behavioral changes in the users of the devices that might be indicative of abnormal human conditions or behaviors. The general goal of detecting such new, unseen events falls under the general category of {\em novelty detection} problems in machine learning, for which there are a wide variety of possible procedures, including Gaussian mixture models (GMM), one-class support vector machines (OCSVM), kernel density estimation (KDE), and others. The success of any of these procedures---and, in fact, for {\em any} machine learning approach---depends fundamentally on how the data are represented as input features to the model. Often the choice of features and how they are represented are more fundamental to the effectiveness of the approach than the model itself. IoT devices provide useful ``digital exhaust'' that can be used to detect a broad class of new, unseen events and anomalies. Specifically, Internet-connected devices must necessarily generate network traffic as they communicate with other devices on the network (e.g., other devices on the home network, cloud-hosted services that control these devices). Unusual activities or incidents may be reflected in changes to the underlying traffic itself. As a simple example, an Internet-connected light switch generates associated traffic when it is turned on and off, effectively generating a timeseries of network traffic over time. The data itself is timestamped, and multi-dimensional---for example, the device may talk to more than one destination on the network; the timestamped nature of the dataset makes the data itself irregularly sampled in the time domain. Intuitively, one could assume that the things that a human (or computer program) does to interact with such a device might follow some normal patterns, and that novelty detection might be interested in identifying deviations in these patterns, where those deviations might reflect anything from a malware infection to someone entering the room at an unusual or unexpected time. As Internet-connected devices become increasingly ubiquitous, the digital exhaust that these devices produce provides a wealth of signal for detecting a wide variety of anomalies for just about any activity in our daily lives. Approaches to capture novelty in the traffic that these devices generate are less well explored. Unfortunately, representations of network traffic that are most effective for novelty detection remain a priori unclear. By default, representation choices involve various statistics on traffic volumes, decisions on packet sampling rates, and choices of observation intervals; however, which of these choices retain predictive information remains a priori unclear, especially given the large variety of IoT devices with vastly different traffic patterns. For instance, if we decide to record and build on \emph{number of packets per second}, then changes in traffic patterns at the micro-second level might go undetected; on the other hand, recording at the microsecond level would result in higher dimensional observations that machine learning procedures might fail to scale up to, due to well-known challenges with high dimensional data\footnote{The so-called \emph{curse of dimensionality} in machine learning is the observed fact that the higher the dimension of the input, the harder it is to achieve good accuracy; in particular, we might then require an amount of training data exponential as a function of dimension.}. Our goal is to explore how different data representations for network traffic affect novelty detection rates, across a range of IoT devices, types of novelty, and unsupervised machine learning models. Given raw traffic inputs, we focus on the problem of identifying novel network \emph{flows}---sequences of packets from a fixed source to a fixed destination, a common, intuitive unit of identification in network traffic that, at a high-level, represents a single exchange of data between two network endpoints. From a practical perspective, the ability to identify a novel flow of course lends itself to detecting other types of novelty; for example, a device that generates novel traffic flows may itself be considered novel. There are many possible ways to represent raw traffic traces (i.e., packets) as inputs. The data itself can be aggregated on various time windows, elided, transformed into different bases, sampled, and so forth. \paragraph{Results and contributions.} We compare flow-based data representations as combined with various machine learning procedures for novelty detection. To compare the performance of different machine learning procedures, we report the area under the ROC curve (AUC) for each approach and each dataset. Because machine learning procedures are very sensitive to hyperparameter choices (e.g., bandwidth choice in OCSVMs, or the number of dimensions in PCA), we consider both the best possible choices of such hyperparameters, which unfortunately are hard to find in practice without labeled data, and default choices that might be made in practice based on rule-of-thumbs. To ensure an apples-to-apples comparison across procedures, we ensure that all data representations result in feature vectors of a similar order in dimension, in the range of 10 to 30 dimensions. Our primary results are as follows: \begin{itemize} \itemsep=-1pt \item No single data representation works best across all devices and models. \item Performing a Fourier transform on the raw network packet traces generally has minimal effect on model accuracy, regardless of the representation of the data in the time domain. \item Incorporating packet size and TCP transport header information (e.g., IP TTL, TCP flags) into the timeseries can significantly improve the accuracy of novelty detection, across a variety of models and outlier detection techniques. \end{itemize} \paragraph{Outline} Section~\ref{sec:data_representations} outlines the common ways of representing network traffic flows in the literature. It is difficult to be completely exhaustive, yet we focus on the most established approaches for representing traffic data both in general network anomaly detection and in the growing literature on novelty detection for IoT, comparing tuning and configuration and tuning decisions that might be made in practice. Section~\ref{sec:ml_procedures} outlines the machine learning models and performance metrics that we use for our comparative analysis, as well as the metrics that we use to evaluate these models. Section~\ref{sec:experimentalsetup} describes the setup of our experiments, including how we selected hyperparameters for various novelty detection models, as well as the datasets that we used in our evaluation and how we processed those datasets. Section~\ref{sec:results} describes the results from our experiments, and Section~\ref{sec:conclusion} concludes with a summary and directions for future work. \section{Machine Learning Models and Performance Metrics} \label{sec:ml_procedures} We describe the novelty detection procedures that we evaluate in our study, as well as the performance metrics that we use to compare each of these procedures. \subsection{Novelty Detection Procedures} We consider popular novelty detection procedures from Machine Learning and Statistics, approaches based on {Isolation Forests} (IF), {One-Class Support Vector Machines} (OCSVM), {Kernel Density Estimation} (KDE), {Gaussian Mixture Models} (GMM), {Principal Component Analysis} (PCA), and {Auto Encoders} (AE). Important common aspects of all such detection procedures are as follows: \begin{enumerate} \item \emph{Data representation as features.} Detection procedures invariably require data---here network flows---represented as a vector $X \in \mathbb{R}^d$ of $d$ predictive features. While many procedures operate directly on that feature representation (e.g., IF, KDE, GMM), others (e.g., OCSVM, PCA, AE) remap vectors $X$ into refined representations where certain patterns---clusters of similar network activities---might be more evident. \item \emph{Training and testing phase.} Detection procedures are trained in a first phase using $n$ training datapoints $\{X_i\}_{i=1}^n$ -- i.e., $n$ copies $X_i$ of typical values of \emph{normal} features $X$ (e.g., each $X_i$ representing a normal traffic flow), from which they produce a \emph{scoring function $S(X)$}; high scores $S(X)$ are expected to be typical of normal observations such as the training datapoints $X_i$, while low-scores would be indicative of the query $X$ being an outlier (novelty). Subsequently, in the so-called testing phase (or deployment phase), a threshold $t$ might be chosen so that any query $X$ is flagged as \emph{novelty} whenever $S(X) < t$. Note that, in practical use cases, the right choice of threshold can be difficult since the available training data is assumed to be all \emph{normal} making it hard to assess \emph{false negative rates}. Instead, one might choose a threshold based on the \emph{false positive rates} the application can tolerate, which can be estimated for each choice of $t$ based on the \emph{normal data} (i.e., data known to not have positive label). Related issues are discussed in Section \ref{sec:performancemetric} on performance metrics. \end{enumerate} \paragraph{Normality scores in ML.} In KDE or GMM, the training data is used to estimate the \emph{density} function $f$ of the data in $\mathbb{R}^d$ (that is their spatial distribution), where by definition $f(x)$ is low in those regions of space that have little data. This density would then serve as a scoring function $S(X) \doteq f(X)$. IF works similarly by first partitioning the space $\mathbb{R}^d$ into ensembles of high and low density regions, and flagging any query $X$ as a novelty if it lies in a low density region. On the other hand, PCA and AE work by identifying a lower-dimensional space ${\cal X}$ embedded in the representation space $\mathbb{R}^d$ on which most of the training datapoints $X_i$ appear to lie. In PCA $\cal X$ is a linear space, while in AE it can be highly nonlinear (using nonlinear activation functions in a neural network). The score $S(X)$ then denotes how \emph{close} $X$ is to $\cal X$ with lowest scores for points farthest from $\cal X$. OCSVM stands farther apart as it proceeds by first remapping all $X_i$'s -- through a transformation $\Phi(X_i)$ into a higher dimensional feature space $\cal H$ (possibly of infinite dimension) and then essentially identifying regions of high density in $\cal H$. The underlying assumption is that patterns might be more visible in $\cal H$, for instance, all $\Phi (X_i)$ might cluster together into a \emph{normal} region (either a half space in $\cal H$ or an enclosing ball; the score $S(X)$ is then lower for queries $X$ that map as $\Phi(X)$ outside the \emph{normal} region of $\cal H$. \subsection{Performance Metric}\label{sec:performancemetric} \paragraph{Area Under the Curve (AUC).} As explained above, detection procedures flag new queries $X$ as novel if it scores below a certain threshold $t$ (i.e., if $S(X) < t$). Now notice a tension: the higher the threshold $t$, the more likely it is that all novel $X$ are correctly detected, but unfortunately, the more likely it is also that normal datapoints are flagged as novel (a false alarm). Thus, the best performing approaches---combination of data representation and choice of detection procedure---are those that alleviate this tension, performing accurate detection while minimizing false positives. Such tradeoffs are well captured by a Receiver Operating Characteristic (ROC) curve, which plots the detection rate against the false alarm rate as $t$ is varied from small to large; a large area under the curve (AUC) indicates that good tradeoffs are possible under the given detection approach. We therefore adopt AUC as a sensible measure of performance. \paragraph{Sensitivity to Hyperparameters.} All detection procedures come with hyperparameters, i.e., configuration choices that can greatly affect performance. Important hyperparameters are e.g., bandwidth in KDE or OSCVM, number of partitions in IF, number of components in GMM, embedding dimension in PCA and AE. We therefore have to carefully pick such parameters in practice, although the right approach remains unclear, especially in \emph{unsupervised learning} problems such as novelty detection where we typically do not have a labeled validation set to evaluate choices. Since hyperparameter tuning in unsupervised learning remains the subject of ongoing research in Machine Learning and Statistics, \emph{we decided to present results for the best choices of parameters}, picked a posteriori as those choices that result in the best performance on a test set, as described in Section \ref{sec:hyperparamTuning} below. More configuration details such as range or parameters are given in Section \ref{sec:hyperparamTuning}. Other configuration choices based on common rule-of-thumbs are covered in the appendix along with relevant results. \section{Data Representation} \label{sec:data_representations} The importance of data representation has in fact fostered many subfields such as \emph{metric learning}, \emph{representation learning} which aim to \emph{automatically} find the right representation to be coupled with given procedures, so far with mixed results, but with much success in application areas such as computer vision and speech processing {\color{red} \cite{}}. No such automatic approach has yet been developed in the fledgling application area of novelty detection for IoT, and a main aim of this work is to bring attention to the importance of data representation, and identify representations that work well in general while meeting practical needs for succinct representations. Machine learning procedures require for the most part, \emph{feature vectors} of the same dimension, i.e., every flow has to be represented as a vector of a fixed number of carefully chosen features -- i.e., information extracted from the flow. We consider various feature-representations of \emph{forward flows}, where a forward flow aggregates all packets, with a same \emph{five-tuple} identifier, sent from a device being monitored to another device or server. The five-tuple identifier consists of source IP address, source port, destination IP address, destination port, and protocol. The basic representations considered are as follows. \begin{itemize} \item {\bf STATS:} a set of statistical quantities compiled from a flow. In particular, we choose 10 of the most common such statistics in the literature (see e.g., \cite{Moore2005}), namely, flow duration, number of packets sent per second, number of bytes per second, and the following statistics on \emph{packet sizes} (in bytes) in a flow: mean, standard deviation, the first to third quantiles, the minimum, and maximum. \item {\bf SIZES:} a flow is represented as a time series of packet sizes in bytes. \item {\bf IAT:} a flow is represented as a time series of inter-arrival times between packets, i.e., elapsed time in seconds between any two packets in the flow. \item {\bf SAMP-NUM:} a flow is partitioned into small time intervals of equal length $\delta t$, and the number of packets in each interval is recorded; thus a flow is represented as a time series of packet counts in small time intervals. Here, $\delta t$ might be viewed as a choice of \emph{sampling rate} for the time series, hence the nomenclature. \item {\bf SAMP-SIZE:} a flow is partitioned into small time intervals of equal length $\delta t$, and the total packet size (i.e., byte count) in each interval is recorded; thus, a flow is represented as a time series of byte counts in small time intervals. \end{itemize} Remark that any of the above time series representations (i.e., all but STATS) might be given in time domain (which we choose by default) or in Fourier domain, in which case we append \emph{FFT} to the representation name, i.e., IAT-FFT, SAMP-NUM-FFT, and SAMP-SIZE-FFT. When using ML procedures for novelty detection, we have to ensure that all of the above representations result in feature-vectors of the same dimension for any given device being monitored. This is automatically the case for STATS, but not for the other representations, in light of variations in flow durations and lengths (number of packets) for a given device. To ensure that each sample has the same dimension, we select a fixed time duration for all flows corresponding to the 90th percentile of all flow lengths or durations for a device. We use this duration so as to capture the typical behavior of most device instances of a particular type. Any definition of typicality may be appropriate here, depending on the desired compactness and complexity of the corresponding representation. Using the 90th percentile of all flow durations results in a comparable number of dimensions (typically 10--30) for most of the devices that we consider in this study. Details on achieving fixed feature dimensions are given in Section \ref{sec:experimentalsetup} on experimental setup. \begin{table}[t] \centering \caption{Data representations that are commonly used for anomaly detection.} \begin{tabular}{|l|p{1.5cm}|p{1cm}|p{1cm}|p{2cm}|p{1cm}|p{1cm}|} \toprule Reference & Flow duration & IAT & SIZES & FFT of IAT and SIZES & SAMP-NUM & SAMP-SIZES \\ \midrule {\bf Network Intrusion Detection} \\ \midrule Lakshari {\em et al.}~\cite{lashkari2018toward} & \cmark & \cmark& \cmark & \xmark & \xmark & \xmark \\ \midrule Mukar {\em et al.}~\cite{kumar2018novel} & \xmark & \cmark& \xmark & \xmark & \xmark & \xmark \\ Mirsky {\em et al.}~\cite{mirsky2018kitsune} &\xmark & \xmark& \xmark & \xmark & \cmark & \cmark \\ \midrule \midrule {\bf IoT Anomaly Detection} \\ \midrule Al Jawarneh {\em et al.}\cite{aljawarneh2018garuda} & \cmark & \xmark& \cmark & \xmark & \xmark & \xmark \\ Doshi {\em et al.}~\cite{doshi2018machine} & \xmark & \cmark& \cmark & \xmark & \xmark & \xmark \\ \midrule Meidan {\em et al.}~\cite{meidan2018n} &\xmark & \cmark& \xmark & \xmark & \cmark & \cmark \\ \midrule Bhatia {\em et al.}~\cite{bhatia2019unsupervised} & \xmark & \xmark& \cmark & \xmark & \cmark & \xmark \\ \midrule Thamilarasu {\em et al.}~\cite{thamilarasu2019towards} & \xmark & \xmark& \cmark & \xmark & \xmark & \xmark \\ \midrule \midrule {\bf DDoS Detection} \\ \midrule Fouladi {\em et al.}~\cite{fouladi2016frequency} &\xmark & \xmark& \xmark & \cmark & \xmark & \xmark \\ \midrule Lima {\em et al.}~\cite{lima2019smart} &\xmark & \xmark& \cmark & \xmark & \xmark & \xmark \\ \bottomrule \end{tabular} \label{features} \end{table} \section{Results} \label{sec:results} In this section, we explore how data representation affects the performance of different novelty detection algorithms. We are interested in the difference in AUC due to the presence or absence of particular feature types with respect to a set of basic feature representations, namely STATS, SIZE, IAT, SUMP-NUM, and SAMP-SIZE (Table \ref{tab:OCSVM_IF_AE_and_KDE_with_best_parameters} also includes IAT+SIZE as a baseline for future comparisons). We will see that across ML procedures, (1) Fourier domain representations have little advantage over raw time series (despite being generally thought of as a better way to capture important trends in timeseries), while the effect of (2) packet size information, and (3) packet header information tend to be significant overall. We focus on some of the most popular ML approaches (OCSVM, IF, AE, KDE) in the main text, under {\bf OPT} tuning, while results for omitted ML approaches, for {\bf Default} tuning, and omitted datasets are given in the appendix. We substantiate messages (1), (2), and (3) in subsections \ref{sec:fft}, \ref{sec:size}, and \ref{sec:header}. Table \ref{tab:OCSVM_IF_AE_and_KDE_with_best_parameters} gives baselines for comparisons. \paragraph{Statistical significance.} Throughout this section, we often display error bars of length $1/\sqrt{n}$ ($n$ denoting test sample sizes as given in Table \ref{tab:train_test_sets}), which is a ballpark for standard deviation in AUC computed on a test sample of size $n$. We first explore the effect of Fourier domain representations; then we explore how including packet sizes and fields from the packet header ultimately affect the performance of different novelty detection approaches. \begin{table}[t] \centering \caption{AUCs for 4 ML approaches on basic feature representations.} \label{tab:OCSVM_IF_AE_and_KDE_with_best_parameters} \begin{tabulary}{0.99\textwidth}{|C|C|>{\columncolor[gray]{0.9}}C|C|>{\columncolor[gray]{0.9}}C|C|>{\columncolor[gray]{0.9}}C|C|} \toprule Detector & Dataset & \Cell{STATS} & \Cell{SIZE} & \Cell{IAT} & \Cell{IAT+\$SIZE$} & \Cell{SAMP-\\NUM} & \Cell{SAMP-\$SIZE$} \\ \midrule \multirow{7}{*}{OCSVM} &UNB(PC1) & 0.56 & 0.70 & 0.78 & 0.92 & 0.74 & 0.76 \\ &UNB(PC4) & 0.48 & 0.66 & 0.82 & 0.80 & 0.81 & 0.79 \\ \cmidrule{2-8} &CTU & 0.98 & 0.97 & 0.95 & 0.96 & 0.88 & 0.88\\ \cmidrule{2-8} &MAWI & 0.88 & 0.71 & 0.58 & 0.43 & 0.60 & 0.61\\ \cmidrule{2-8} &TV\&PC & 1.00 & 1.00 & 0.96 & 0.99 & 0.95 & 0.93\\ \cmidrule{2-8} &SFrig & 0.98 & 0.93 & 0.81 & 0.85 & 0.96 & 0.95 \\ &BSTch & 0.97 & 0.99 & 0.97 & 0.99 & 0.96 & 0.95 \\ \midrule \multirow{7}{*}{IF} &UNB(PC1) & 0.49 & 0.49 & 0.51 & 0.74 & 0.66 & 0.70 \\ &UNB(PC4) & 0.49 & 0.51 & 0.62 & 0.65 & 0.81 & 0.79 \\ \cmidrule{2-8} &CTU & 0.94 & 0.93 & 0.81 & 0.88 & 0.83 & 0.85\\ \cmidrule{2-8} &MAWI & 0.86 & 0.70 & 0.54 & 0.67 & 0.56 & 0.55\\ \cmidrule{2-8} &TV\&PC & 0.95 & 0.98 & 0.90 & 0.99 & 0.74 & 0.79\\ \cmidrule{2-8} &SFrig & 0.96 & 0.96 & 0.56 & 0.94 & 0.93 & 0.93 \\ &BSTch & 0.97 & 0.98 & 0.94 & 0.98 & 0.98 & 0.96 \\ \midrule \multirow{7}{*}{AE} &UNB(PC1) & 0.72 & 0.40 & 0.50 & 0.93 & 0.81 & 0.77 \\ &UNB(PC4) & 0.70 & 0.52 & 0.64 & 0.84 & 0.83 & 0.86 \\ \cmidrule{2-8} &CTU & 0.91 & 0.96 & 0.85 & 0.96 & 0.83 & 0.87\\ \cmidrule{2-8} &MAWI & 0.56 & 0.58 & 0.50 & 0.70 & 0.58 & 0.55\\ \cmidrule{2-8} &TV\&PC & 1.00 & 1.00 & 0.97 & 0.99 & 0.85 & 0.95\\ \cmidrule{2-8} &SFrig & 0.95 & 0.85 & 0.72 & 0.92 & 0.96 & 0.96 \\ &BSTch & 0.97 & 0.93 & 0.98 & 0.99 & 0.96 & 0.96 \\ \midrule \multirow{7}{*}{KDE} &UNB(PC1) & 0.34 & 0.58 & 0.68 & 0.92 & 0.74 & 0.76 \\ &UNB(PC4) & 0.47 & 0.63 & 0.76 & 0.80 & 0.81 & 0.85 \\ \cmidrule{2-8} &CTU & 0.96 & 0.93 & 0.94 & 0.97 & 0.82 & 0.84\\ \cmidrule{2-8} &MAWI & 0.88 & 0.48 & 0.57 & 0.43 & 0.60 & 0.57\\ \cmidrule{2-8} &TV\&PC & 1.00 & 1.00 & 0.96 & 0.99 & 0.88 & 0.93\\ \cmidrule{2-8} &SFrig & 0.97 & 0.91 & 0.79 & 0.78 & 0.95 & 0.95 \\ &BSTch & 0.97 & 0.98 & 0.95 & 0.98 & 0.95 & 0.95 \\ \bottomrule \end{tabulary} \end{table} \subsection{Effect of Fourier Domain Representation}\label{sec:fft} \begin{figure}[t] \centering \includegraphics[width=0.99\textwidth]{OCSVM_IF_AE_KDE_with_best_parameters_on_basic_representations_diff.pdf} \caption{Difference in AUC for {\bf FFT vs. raw time series} representations.} \label{fig:diffinFFT} \end{figure} We compare Fourier domain representations---obtained by \emph{Fast Fourier Transforms} (FFT), where we retain as many FFT components as the number of time points---to raw time-domain representations of each flow IAT, SAMP-NUM, SAMP-SIZE. Figure \ref{fig:diffinFFT} presents the difference in AUC, i.e., the AUC obtained under FFT minus that obtained under the corresponding raw time series representation. The same trend is observed across ML procedures: apart for a few device datasets (e.g., positive effect in SFrig and negative effect in BSTch w.r.t. IAT), FFT makes no significant difference in the achieved AUC over raw time series. In other words, the various ML procedures seem able to extract much of the same information already from the raw time series, i.e., their \emph{internal representations} of the data already account for major trends in the times series and thus do away with the need to preprocess through FFT. Henceforth, we focus attention on raw representations for time series in subsequent discussions. \subsection{Effect of Packet Size Information}\label{sec:size} \begin{figure}[t] \centering \includegraphics[width=0.99\textwidth]{Effect_of_Size_OCSVM_IF_AE_KDE_with_best_parameters_diff.pdf} \caption{Differences in AUC due to {\bf including vs. excluding packet size} information.} \label{fig:diffinsize} \end{figure} Referring back to Table~\ref{tab:OCSVM_IF_AE_and_KDE_with_best_parameters}, packet size information immediately appears to be important based on the generally higher AUCs achieved under STATS (which primarily compiles statistics on packet sizes in a flow) to those achieved under basic representations such as IAT and SAMP-NUM (devoid of packet size information). Interestingly, SIZE, a time series of packet sizes in a flow, does not perform as well as STATS does over IAT, and SAMP-NUM. As it turns out, adding packet size information to IAT or SAMP-NUM representations improves on such representations alone. Namely, in the case of IAT, size information is added in by concatenating IAT and SIZE vectors, which we denote IAT+SIZE. For SAMP-NUM, a time-series of \emph{number of packets} in small fixed time intervals $\delta t$, size information is accounted for by instead compiling \emph{total packet size} in fixed time intervals $\delta t$. Figure \ref{fig:diffinsize} presents the differences in AUC obtained using packet size information, minus those obtained on corresponding representations without size information. We observe significant positive differences for most ML procedures on most datasets---which correspond to a range of novelty detection problems, whether malicious attacks, or novel devices or activity. Even in those cases when size information does not help, it nonetheless does not hurt, except in rare cases such as MAWI under IAT when employing OCSVM and KDE. However, even in this case, we observe (see Table \ref{tab:OCSVM_IF_AE_and_KDE_with_best_parameters}) that the concatenation of IAT+SIZE yields {\em worse} AUC than IAT or SIZE alone. The exact reason is unclear and could be due to \emph{overfitting}, as the concatenation increases feature dimension in ways that might affect \emph{nonparametric} models such as OCSVM and KDE given the relatively modest training size of MAWI (800+ datapoints). The most significant positive differences are observed for IF, AE, and PCA in the case of IAT, while no significant differences are observed for sampling-based representations, such as SAMP-SIZE vs. SAMP-NUM. Interestingly, for fixed datasets, trends are generally consistent across ML methods, suggesting that whether size information helps depends most on devices' characteristics, rather than the ML method employed or the type of detection problem. In general, the inclusion of packet sizes for novelty detection makes sense, as the packet size can provide some indication about the nature of the underlying activity. For example, for the case of the UNB dataset, attack traffic may be unique in size relative to other types of activities. In the case of the private IoT datasets, novel activities may be less likely to produce individual packets of differing sizes unless the activities themselves are new. \subsection{Effect of Packet Header} \label{sec:header} We now consider the effects of information in packet headers on novelty detection, focusing on the information available in various TCP flags. We focus on the following eight flags in each packet: FIN, SYN, RST, PSH, ACK, URG, ECE, and CWR, and TTL. We do not include IP address or port information in this part of our analysis. Given the already established benefits (or at least invariance in AUC) of including packet size information, we now take representations such as STATS, IAT+SIZE and SAMP-SIZE as baselines to which we concatenate packet header information (for each packet in a flow) and record differences in performance. In general, we observe no significant degradation in performance in adding header information, and in fact, observe improvements for some datasets such as SFrig under OCSVM and KDE (novel activity detection) where we might not necessarily expect such header information to help. The simple explanation is that in fact, even for problems such as activity detection, a device might switch destination IP or ports depending on the type of activity being performed. Figure \ref{fig:diffpacketheader} presents the differences in AUC obtained with packet header information minus that obtained without header information. The same trends are observed across ML approaches. As might be expected, we observe the most significant improvements on those datasets corresponding to (1) detecting malicious activity (UNB)---where infected traffic might be rerouted to new destinations, thereby resulting in traffic with different distributions of packet TTL values corresponding to the different, new destinations---or (2) detecting novel devices (CTU, MAWI)---where header information such as certain TCP options can a device or operating system pertinent to a device. Although TV \& PC seem to be an exception to (2), the general lack of improvement is simply due to the fact that AUC's for the baseline representations were already near perfect (close to 1) across ML approaches (see Table \ref{tab:OCSVM_IF_AE_and_KDE_with_best_parameters}). This happens to also be the case (i.e., near perfect AUC's) for those baseline representations where we observe little difference in AUC for the two detection problems (1) and (2). The most improvement across ML methods is observed for MAWI where the baseline representations yielded poor AUC's to start with (Table \ref{tab:OCSVM_IF_AE_and_KDE_with_best_parameters}). \begin{figure}[t] \centering \includegraphics[width=0.99\textwidth]{Effect_of_Packet_Header_OCSVM_IF_AE_KDE_with_best_parameters_diff.pdf} \caption{Differences in AUC due to {\bf including vs. excluding packet header} information.} \label{fig:diffpacketheader} \end{figure} \begin{figure}[h] \centering \includegraphics[width=0.99\textwidth]{correlation-bar.pdf} \caption{Top 6 correlation between each value in packet headers and ground truth ($y$).} \label{fig:correlation} \end{figure} Figure~\ref{fig:correlation} shows that certain packet header fields can be particularly useful for novelty detection, depending on the anomaly; these results are evident in the results. One of the more important findings from taking a closer look at the correlations between features and ground truth is that the most important packet header values will {\em depend on the novelty detection problem}. We explore this in more detail below. \paragraph{Attack detection.} In the case of the UNB dataset, we see that the SYN flag can be very useful in identifying novelty events related to security, as the SYN flag correspond to a TCP handshake that occurs at the beginning of the connection and is commonly related to certain types of denial of service attacks, such as a SYN flood. Other packet header information that exhibits correlation include other flags that are commonly associated with denial of service attacks, including the RST and FIN flags, which victim hosts may send in response to a SYN. In all of these cases, an increase in packets that include these flags could likely correspond with a volumetric denial of service attack, such as a SYN flood. \paragraph{Novel device detection.} The MAWI dataset, where the novelty detection problem involves detecting a novel device, finds the TTL field in a packet header to be significant. This also follows intuition, as the TTL value is a coarse indicator of network topology (i.e., how many network-level ``hops'' a device is from a particular destination endpoint) and naturally two different devices on the network may be located at different network attachment points and thus be different distances away from common network locations. Such topological differences would be apparent in the TTL field, and a new device attaching at a different location on the network could appear as a sudden influx of network traffic that bears a different distribution in TTL values. In particular, sudden deviations in distributions of TTL values in the dataset may thus reflect the injection of traffic from new devices, or possibly attackers. On the other hand, we see in this dataset that the SYN and TTL fields are less useful for novelty detection concerning activities (e.g., the SFrig dataset, which involves detection of activities in the dataset). \paragraph{Novel activity detection.} If someone begins to interact with a connected IoT device in new ways---triggering new types of activities---the traffic itself may bear differences from previously seen traffic. Differences in the traffic itself may arise because activities themselves may bear unique signatures in the underlying network traffic. For example, the amount and nature of traffic generated by opening and closing a refrigerator door in SFrig will generate different types of traffic than the kind of traffic that is generated by activities that do not involve human interaction (e.g., a software update). These fundamental differences may appear in different ways, such as differences in traffic volume or timing, and in some cases they may appear in the TCP header flags themselves. In the case of SFrig, we see that the ACK flag has a high correlation with ground truth, indicating that changes in the prevalence of ACKs (i.e., packet acknowledgments) may represent changes in underlying activities. This characteristic likely results from the underlying behavior of TCP, the Internet's transport protocol, and how it handles packet acknowledgments for flows of different sizes and timings. For example, for large traffic flows, TCP will sometimes optimize its acknowledgment behavior, using techniques such as {\em delayed ACK} to improve network performance. Highly interactive behavior and the traffic it generates may exhibit very different qualities than automated traffic (e.g., a software update involving the transfer of a large amount of data) and thus different behavior in ACK traffic. The distribution of ACK fields in the traffic may reflect higher traffic volumes during periods of novel activity. \section{Experiment Setup} \label{sec:experimentalsetup} We first describe the process by which we choose hyperparameters for each of the novelty detection procedures that we evaluate in this study. We then describe the datasets we use to evaluate each novelty detection method, including how we process each of these datasets and select parameters for each corresponding feature representation. \subsection{Hyperparameter Choices for Novelty Detection Procedures} \label{sec:hyperparamTuning} All detection procedures are implemented in the scikit-learn Python package. We now describe configuration choices, both for the best hyperparameter choice (OPT) -- picked a posteriori using test data as described in Section \ref{sec:performancemetric} above -- and a rule-of-thumbs choice (Default). The results in the main paper are presented for the OPT choice, while results for Default are presented in the appendix. \begin{itemize} \item OCSVM \cite{scholkopf2000support} (implemented by \cite{zhao2019pyod}). We choose a Gaussian kernel of the form $K(x, x') \propto \exp(-\|x-x'\|^2/2\sigma^2)$, and pick $\sigma$ as follows. We consider the quantiles $[0.1, 0.2, \ldots, 0.9] \cup \{0.95\}$ on increasing distances between pairs of points in the training sample.\\ {\bf OPT:} The parameter $\sigma$ is then picked as that quantile which yields the best AUC.\\ {\bf Default:} $\sigma$ is picked as the 0.3 quantile of inter-point distances. \item KDE \cite{latecki2007outlier, scott2005multidimensional}. We use a Gaussian kernel, of the same form as OCSVM above, and pick the \emph{bandwidth} $\sigma$ exactly the same way for both {\bf OPT} and {\bf Default}. \item GMM \cite{Bishop2006Pattern}. We choose the number of Gaussian components $k$ on a range $[2, 5, 8, 11, 14, 17, 20, 23, 26, 30]$. \\ {\bf OPT:} $k$ is chosen as the value in the range maximizing AUC. \\ {\bf Default:} $k$ is obtained as the number of high-density regions (or modes) in the training data, as obtained by the \texttt{quickshift++} procedure of \cite{jiang2018quickshift++}. \item IF \cite{liu2012isolation} (implemented by \cite{zhao2019pyod}). We pick the number $k$ of trees in the range 30 to 300 with increments of 10. \\ {\bf OPT:} $k$ is chosen as the value in the range maximizing AUC. \\ {\bf Default:} $k$ is 100, which is the same as the default value in pyod. \item PCA \cite{aggarwal2015outlier} For $X \in \mathbb{R}^d$, i.e., having $d$ features, we pick the projection dimension $\text{dim}$ in a range. We pick $\text{dim}$ in a range $\{\lceil 1 + i\cdot (d -2)/9 \rceil \}_{i = 0}^9$ of (up to 10) values (approximately evenly spaced) between $1$ and $d-1$.\\ {\bf OPT:} $\text{dim}$ is chosen as the value in the range maximizing AUC. \\ {\bf Default:} $\text{dim}$ is estimated by maximum likelihood (MLE) in scikit-learn. \item AE \cite{zhou2017anomaly} (from PyTorch \cite{NEURIPS2019_9015} using LeakyRelu for activation functions). For $X\in \mathbb{R}^d$, we use the following architecture with 5 layers, determined by a tuning parameter $\text{dim}$: one input layer of size $d$ (number of \emph{neurons}), followed by a hidden layer of size $\text{h-dim} \doteq \text{min}\{(d-1), \lceil 2\cdot \text{dim}\rceil \}$, a latent layer of size $\text{dim}$, a subsequent hidden layer of size $\text{h-dim}$, and finally an output layer of size $d$. {We pick $\text{dim}$ in a range $\{\lceil 1 + i\cdot (d -2)/9 \rceil \}_{i = 0}^9$ of (up to 10) values (approximately evenly spaced) between $1$ and $d-1$}. \\ {\bf OPT:} $\text{dim}$ is chosen as the value in the range maximizing AUC. \\ {\bf Default:} $\dim$ is $\lceil d/2\rceil $. \end{itemize} \subsection{Data} We consider a combination of publicly available traffic traces and traces collected on private consumer IoT devices. We aim to evaluate representative set of devices, from multi-purpose devices such as laptop PCs, and Google Home, to less complex electronics and appliances such as smart cameras and TVs. Furthermore we aim at a a representative set of novelty, from benign novelties (new activity, or a new device type), to novelties due to malicious activities (DDoS attack). Table \ref{dataset_sources} describes these datasets, and types of novelty being detected. \begin{table}[t!] \centering \caption{Datasets.} \begin{tabular}{|p{1.5cm}|p{6.1cm}|p{3.6cm}|p{3.6cm}|} \toprule Reference & \begin{tabular}[c]{p{6.1cm}}{Description} \end{tabular} & \begin{tabular}[c]{p{3.5cm}}{Devices } \end{tabular}& \begin{tabular}[c]{p{3.6cm}}{Type of Novelty} \end{tabular} \\ \hline UNB IDS~\cite{cicids2017} & \begin{tabular}{p{6.1cm}} Normal and DDoS attack traces from personal computers (PC), which are chosen from Monday trace and Friday trace. \end{tabular} & \begin{tabular}{p{3.6cm}}Five PCs (noted as PC1, PC2, PC3, PC4, and PC5, respectively) \end{tabular}& \begin{tabular}{p{3.5cm}} DDoS attack\end{tabular}\\ \hline CTU IoT~\cite{ctu2019iot} & \begin{tabular}{p{6.1cm}} Bitcoin-Mining and Botnet traffic traces generated by two Raspberries; we aim to distinguish the two devices by their attack traces (i.e., Mirai and CoinMiner); hence we use one generated Mirai as \emph{normal}, the other generated CoinMiner as \emph{novel}.\end{tabular} & \begin{tabular}{p{3.6cm}}Two Raspberries \end{tabular} & \begin{tabular}{p{3.5cm}} Novel (infected) device \end{tabular} \\ \hline MAWI~\cite{mawi2019normal} & \begin{tabular}{p{6.1cm}} Normal traffic generated by two PCs, which are collected on Dec. 07, 2019; we use one PC (whose IP address is 202.171.168.50) as \emph{normal}, the other (whose IP address is 202.4.27.109) as \emph{novel}. \end{tabular} & \begin{tabular}{p{3.6cm}}Two PCs \end{tabular} & \begin{tabular}{p{3.5cm}} Novel (normal) device \end{tabular}\\ \hline \multirow{5}{*}{\Cell{Lab \\IoT}} & \begin{tabular}{p{6.3cm}}Data traces are generated by IoT devices (e.g., fridge) in a private lab environment. We choose two kinds of normal traffic generated by a smart TV and a PC. \end{tabular} & \begin{tabular}{p{3.6cm}}A smart TV and a PC (noted as TV\&PC) \end{tabular} & \begin{tabular}{p{3.5cm}}Novel device\end{tabular} \\ \cline{2-4} & \begin{tabular}[c]{p{6.3cm}} Four smart-home devices, each with two types of traffic traces labeled as \emph{normal} when there is no human interaction, and \emph{novel} when being operated by a human. \end{tabular} & \begin{tabular}[l]{p{3.6cm}} Google home (GHom), Samsung camera (SCam), Samsung fridge (SFrig), and Bose soundtouch (BSTch)\end{tabular} & \begin{tabular}{p{3.5cm}}Novel activity \end{tabular} \\ \bottomrule \end{tabular} \label{dataset_sources} \end{table} \paragraph{Obtaining flows.} We parse upstream flows from datasets in Table \ref{dataset_sources} using Scapy \cite{scapy}. Given that certain devices can have arbitrarily long flows, we truncate each flow from a given dataset to have duration at most that of the 90th upper-percentile of flow durations in the dataset. Henceforth, a \emph{flow} refers to these choices of flows involving truncation. \paragraph{Selecting feature representation dimension.} Each flow is then represented using any of the feature-representation choices described in Section \ref{sec:data_representations}. Here, we have to ensure that, given a representation choice, e.g., IAT, all flows result in vectors of the same dimension $d$ for each dataset. We apply a similar approach to enforce such fixed dimension $d$, as outlined below. For a fixed dataset, let $d_0$ denote the 90th upper-percentile of number of packets per flow. \begin{itemize} \item STATS: automatically results in vectors of the same dimension $d$, equal to the number of statistics (on packet size) computed on a flow. \item IAT, or SIZE: dimension is fixed to $d = d_0-1$ for IAT, and $d = d_0$ for size; namely, for long flows, we truncate the number of packets in a flow to the first $d_0$; for short flows where the number of packets is less than $d_0$, we append $0$'s to the IAT representation to arrive at $d$ features. \item IAT + SIZE: just concatenates IAT and SIZE representations to dimension $d = 2d_0 -1$. \item SAMP-NUM or SAMP-SIZE: dimension is fixed to $d = d_0-1$ as in the case of IAT. Now we pick a fixed window size $\delta t$, and each flow is divided into up to $d$ windows of length $\delta t$; for flows of short duration, where $\delta t$ is large w.r.t. duration, we simply append $0$'s. \emph{Choice of $\delta t$:} we start with candidate choices $\Delta \doteq \{t_f/d\}$, over durations $t_f$ of flows $f$ in a given dataset. We then consider 10 choices of $\delta_t$ in $\Delta$, each choice an $i$-th quantile of values in $\Delta$, for each $i \in \{10, 20, 30, 40, 50, 60, 70, 80, 90, 95\}$. Thus, each such choice of $\delta t$ yields one (SAMP-NUM or SAMP-SIZE) representation for all flows; since we do not know which such representation (i.e. choice of $\delta t$) is best a priori\footnote{In fact we do not know how such choice might be automated in practice, as automating \emph{sampling rates} remains an largely open research problem.} we report the best AUC resulting out of all 10 choices of $\delta t$. \end{itemize} Each of the above representations, besides STATS, can then be viewed as fixed length time series, and therefore admit a Fourier domain representation; the corresponding Fourier representation is then set to the same dimension $d$, i.e., we retain as many Fourier components as the original time series. The resulting representation dimensions for each dataset are reported in Table \ref{tab:feature_dimensions} in the appendix.
\section{Introduction} Estimating software effort is a challenging and important activity in the software development process. This activity depends on the success of other crucial aspects of a project, mainly related to the achievement of time and budget constraints, directly impacting on the quality of the software product developed. The success of any particular software project depends heavily on how accurate its effort estimates are \cite{idri2016systematic}. An accurate estimate assists in contract negotiations, scheduling, and synchronization of project activities and efficient allocation of resources. The importance of the accuracy of estimates has explored by studies in the field of software engineering (SE) published in recent years, such as: \cite{kazemifard2011fuzzy}, \cite{azzeh2011adjusted}, \cite{bardsiri2013lmes}, \cite{hamdy2014improving}, \cite{amazal2014improving}, \cite{moharreri2016cost} and \cite{ionescu2017approach}. These studies continually seek to explore computational techniques individually or in combination, always seeking to achieve better levels of precision for effort estimation techniques. Among the existing classifications for software effort estimation techniques, we highlight in this article non-algorithmic models - which do not use predefined metrics, such as points per function and points per use cases. These models make use of Machine Learning techniques (e.g. linear regression, neural networks) and are also called models by analogy \cite{shepperd1996effort}. According to the authors, in some ways, this method is a systematic way of judging specialists, who are already experts in seeking similar situations to inform their opinions. Manikavelan et al. \cite{manikavelan2014software} says that these models are built from historical data from projects to generate custom models. According to Idri and Abran \cite{idri2016missing}, the accuracy of the estimate is improved when the analogy is combined with Artificial Intelligence (AI) techniques to generate estimates. In this way, fuzzy systems, decision trees, neural networks, and collaborative filtering are are some examples of techniques that improve Analogy-based Software Effort Estimation (ABSEE). Idri et al. \cite{idri2015analogy} reinforces that software effort estimation models by analogy are reproducible and closely resemble human reasoning because they based on experience gained from past projects. ABSEE can fit either agile or traditional models as long as the estimation approach is based on data and previous team experiences to estimate software projects. One challenge that has been presented for using these techniques, especially in agile models, is the lack of project data and their requirements in the early stages of the development process. The basic specification of software requirements used in these models is the user story, which is user needs, usually written informally \cite{cohn2005agile}. Assigning effort estimates to software requirements, especially in the early stages of development, becomes quite critical as it depends on the empirical expertise of the experts involved (e.g. project managers and systems analysts), as there are not always complete records of historical data on projects and requirements. But this is still a limitation for most companies, as in most cases there are only textual requirements that briefly describe user needs. This fact makes this task very complex and sometimes even unfeasible. The difficulty with textual requirements (e.g. use cases, user stories) is related to intrinsic informality in many software development processes, which makes it difficult to use as a basis for predicting software costs. This limitation occurs because these texts include a diversity of domain-specific information such as natural language text containing source code, numeric data (e.g. IP addresses, artifact identification codes), among others. A very common aspect is the occurrence of different words, but they are used in the same context; in this case, they should be considered similars (polysemy) because their context is similar. Or, equal words (ambiguous), but applied in different contexts, therefore, should not be represented in the same way. On the other hand, in the AI world, especially in the Natural Language Process (NLP) field, word embedding methods mainly aim to capture the semantics of a given word in a specific context. This method allows words to be represented densely and with low dimensionality, facilitating machine learning tasks that use textual characteristics. Breakthroughs in training word embedding models for a variety of purposes began in years recent with the emergence of Word2Vec \cite{mikolov2013efficient} and GloVe \cite{pennington2014glove}, enabling models to learn from a very large corpus. Thus, contextual representations through embeddings models have been very useful in identifying context-sensitive similarity \cite{huang2012improving}, disambiguation of the meaning of the word \cite{bordes2012joint}, \cite{chen2014unified}, the induction of the meaning of the word \cite{kaageback2015neural}, lexical substitution by the creation of a generic embeddings model \cite{melamud2016role}, sentence complementation \cite{liu2015learning}, among others. Some studies have been conducted specifically in the field of SE, such as recommending domain-specific topics from Stack Overflow question tags \cite{chen2016mining}, recommending similar bugs \cite{yang2016combining}, sentiment analysis in SE \cite{calefato2018journal}, embedding model using Word2Vec for the SE domain \cite{efstathiou2018word}, ambiguity detection in requirements engineering \cite{ferrari2019nlp}, among others. More specifically applied in the generation of software effort estimates, the use of embeddings is highlighted in the studies by \cite{ionescu2017approach} and \cite{choetkiertikul2018deep}. In the first case, Ionescu (2017) explores the use of word embeddings generated by a context-less approach (Word2Vec), aggregated with design attributes and textual metrics (e.g. TF-IDF), from which positive results were obtained. Choetkiertikul et al. \cite{choetkiertikul2018deep} it seeks to infer estimates from the text of user stories, which were given as input to a deep learning architecture, with an embedding layer as input. However, these initiatives face two main limitations, which make it difficult to solve in the specific field of SE. Are they: \begin{enumerate} \item \textbf{Domain-specific terms present their meanings changed according to the context in which they are used:} in this article, domain-specific terms are a set of words common to a specific area (e.g. software engineering, medicine), among which there are strong semantic relationships. Some studies were carried out, seeking to develop resources to facilitate textual representation in software engineering \cite{tian2014sewordsim, efstathiou2018word}, but no complete solution for the presentation of contexts. Still, regarding the context representation, the textual requirements are usually short, bringing an inherent difficulty in identifying the context to which they refer. This reality makes it difficult to extract significant characteristics from the analyzed texts, making the inference process difficult. \item \textbf{Lack of domain-specific SE data to train smart models:} this aspect makes it very difficult to train deep neural networks, which tend to overfiting themselves in these small training data sets, not reaching generalization. This reality is no different for textual software requirements and becomes more critical when we need these texts to be accompanied by their labels, which should represent the effort required to implement them. \end{enumerate} To solve both problems, this work explores the use of contextualized pre-training embedding models (e.g. BERT \cite{devlin2019bert}) to infer an estimate of software effort from textual requirements. Pre-trained models present the concept of transfer learning \cite{howard2018universal}, or allow to solve these problems, because we can train or model on a generic dataset (solve a lack of data problems) and adjust it (solver o problem of the specific meaning of words in different contexts). Although there has been a lot of research on the application of word embedding in various areas, so far, only \cite{ionescu2017approach} and \cite{choetkiertikul2018deep} have sought to apply embeddings to estimate or run software. No research has explored the application of contextualized pre-trained embedding models following the task of ABSEE. In this way, this article \textbf{aims to present a model for the inference of effort estimates by analogy, both for existing and new software requirements, using contextualized pre-trained embeddings models, having as input the exclusive use of textual requirements (e.g. user stories), generated in the initial stage of development}. This approach was named Software Effort Estimation Embedding Model (S$E^3$M). With this model, greater precision is sought for this activity, since it has currently been carried out based on human empiric experience. This characteristic makes these estimates quite subjective. As noted by Howard and Ruder \cite{howard2018universal}, even though deep learning models have achieved state-of-the-art in many NLP tasks, these models are trained from scratch, requiring large datasets, and days to converge. Thus, pre-trained embeddings models make it easy to perform NLP tasks related to SE, without the need for training from scratch and with a low computational cost. According to the authors, this is possible through the fine-tuning technique, eliminating the need for a representative corpus.The fine-tuning approach consists of changing minimal task-specific parameters and is trained on the downstream tasks by simply fine-tuning all pre-trained parameters \cite{devlin2019bert}. Most language representation models (e.g. Word2Vec, ELMo, OpenAI GPT) are classified as context-less, i.e. each token considers only words on the left or right as part of its context \cite{vaswani2017attention}. This makes fine-tuning approaches difficult, where it is relevant to incorporate the context bidirectionally, the reason for using BERT models. BERT is a contextual representation model that solves the one-way constraint mentioned earlier, which will be further explained in section 2.3. Therefore, the approach also aims to infer software effort estimation using pre-trained embeddings models, with and without fine-tuning on a SE specific corpus. Thus, with the results of this article, we intend to answer the following research questions (RQ): \begin{itemize} \item RQ1. Does a generically pre-trained word embedding model show similar results with a software engineering pre-trained model? \item RQ2. Would embedding models generated by context-less methods (i.e. Word2Vec) be effective as models generated by contextualized methods (i.e. BERT)? \item RQ3. Are pre-trained embeddings models useful to a text-based software effort estimation? \item RQ4. Are pre-trained embeddings models useful to a text-based software effort estimation, both on new and existing projects? \item RQ5. Are the results found generalizable, aiming to generate estimates of effort between projects or companies? \end{itemize} It is worth mentioning that, unlike the more similar approaches (\cite{ionescu2017approach}, \cite{choetkiertikul2018deep}), the proposed approach proposes to be generalizable, that is, it should allow the generation of estimates between projects and/or between companies, both for new requirements, as for existing ones (e.g. maintenance). In addition, similar approaches that perform the estimation process through text representation, apply textual representation methods by embeddings without context, which disregard the actual context of each word. The structure of this article to organize as follows. Session 2 presents the background of software effort estimation and word embeddings (context-less and contextualized), in sequence to present the related works. Session 4 presents the theoretical aspects necessary for the proposed approach. Then, in session 5 the results of each step of the proposed method are presented, ending with session 6, where the initial research questions are to answer before concluding and presenting the future works. \section{Background} In this section, we first introduce aspects related to software effort estimation (Section 2.1). The following are the concepts of word embedding and the context-less and contextualized paradigms (Sections 2.2 and 2.3). \subsection{Software Effort Estimation} Various classifications for software effort estimation models have been applied in the last decades, with small differences, according to each author's point of view. According to Shivhare \cite{shivhare2014software}, software effort estimation models can subdivide into algorithmic/parametric and non-algorithmic. The first ones are those that use algorithmic models, applied to project attributes and/or requirements to calculate their estimate, presenting themselves as reproducible methods in substitution to non-algorithmic human expert methods \cite{kocaguneli2010use}. Examples of algorithmic models are COCOMO II \cite{boehm2000software} and Function Point Analysis \cite{choi2011arule}. Non-algorithmic ones are those based on Machine Learning techniques (e.g. linear regression, neural networks) and are also called models by analogy, which rely on historical data to generate custom models that can learn from this data \cite{manikavelan2014software}. Chiu and Huang \cite{chiu2007adjusted} point out that the ABSEE estimate deals with the process of identifying one or more historical projects similar to the target project, and from them infer the estimate. In other words, but using the same line of reasoning, Shepperd's \cite{shepperd1996effort}, says that the basis for the ABSEE technique is to describe (in terms of several variables) the project that must be estimated, and then, to use this description to find other similar projects that have been completed. In this way, the known effort values for these completed projects can be used to create an estimate for the new project. Therefore, the ABSEE is classified as non-algorithmic. Idri and Abran \cite{idri2016systematic} also classify a technique by analogy as a machine learning technique. These authors further point out that machine learning models have also gained significant attention for effort estimation purposes, as they can model the complex relationship between effort and software attributes (cost factors), especially when this relationship is not linear, and it does not appear to have any predetermined form. Analog-based reasoning approaches have proven to be promising in the field of software effort estimation, and their use has increased among software researchers \cite{idri2016missing}. Idri and Abran \cite{idri2016systematic} conducted a systematic review of the literature on ABSEE and found that these techniques outperform other prediction techniques. This conclusion to support by most of the works selected in their mapping. Among the main advantages of ABSEE is the similarity with human reasoning by analogy and, therefore, they are easier to understand. Thus, the estimation of software effort by analogy is perceived as a very appropriate technique when the input resources are requirements specifications in the unstructured text format, as is the case of this research. Since it is possible to submit textual characteristics, drawn from these specifications, as input to machine learning models (e.g. neural networks). \subsection{Word Embeddings} Unlike lexical dictionaries (e.g. WordNet), which basically consist of a thesaurus, grouping words based on their meanings \cite{fellbaum2012wordnet} and which are usually built with human support, a word embedding model is made up of word representation vectors. Through these vectors, it is possible to identify a semantic relationship between words in a given domain, based on the properties observed in a training body and their automatically created generation \cite{mikolov2013efficient}. Word embeddings are currently being a strong trend in NLP. Word embedding models use neural networks arquitectures to represent each word as a dense vector with low dimensionality and focusing on the relationship between words \cite{mikolov2013efficient}. Such vectors are used independently to calculate similarities between terms and as a basis of representation for NLP tasks (e.g. text classification, entity recognition, sentiment analysis). The word embedding models emerged to solve some limitations imposed by the bag-of-words (BOW) model, which usually present sparse and high dimensionality matrices. Word2Vec, one of the most popular methods for generating word embeddings from a text corpus, is an unsupervised learning algorithm that automatically attempts to learn the relationship between words by grouping words that have similar meanings into similar clusters \cite{raschka2015python}. In the Word2Vec model \cite{mikolov2013efficient}, a neural network is trained to represent each word in the vocabulary as an n-dimensional vector. The general idea is that the distance between the vectors representing the word embedding is smaller if the corresponding words are semantically more similar (or related). Pennington et al. \cite{pennington2014glove} adds that for the generation of these vectors, the method captures the distributional semantics and co-occurrence statistics for each word in the presented training corpus. The Word2Vec model internally implements two neural network-based approaches: Common Bag of words (CBOW) and skip-gram. Both are models for word embedding widely used in information retrieval tasks. The goal of the CBOW model is to predict the current word based on its context, while the skip-gram model is intended to predict the current surrounding words for the given word. For both cases, the model consists only of a single weight matrix (in addition to the word analyzed), which results in training capable of capturing semantic information \cite{mikolov2013efficient}. After training, each word is to map to a low dimension vector. Results presented by their authors \cite{mikolov2013efficient} show that words with similar meanings are much closer to those with different meanings. Generally speaking, the key concept of Word2Vec is to find words that share common contexts in the training corpus, close to the vector space compared to others. Word2Vec, like other models (e.g. Glove, FastText) is considered a context-less (static) method for generating pre-trained textual representations. This feature means that these models have constraints regarding the representation of the context of words in a text, making sentence-level or even fine-tuning token tasks difficult. Also, according to their authors \cite{mikolov2013efficient}, these models are to consider too shallow, as they represent each word by only one layer, and there is a limit to how much information they can capture. And finally, these models do not consider word polysemy, that is, the same word to use in different contexts can have different meanings, which is not dealt with by these models, The Figure \ref{fig:figure0} presents a non-exhaustive differentiation between contextualized and context-less models. As we can see, Word2Vec is a form of static word embeddings such as Glove \cite{pennington2014glove}, Fast Text \cite{bojanowski2017enriching}, among others. \begin{figure*}[ht] \centering \includegraphics[width= 1.0\textwidth]{Figuras/contextualized-static.pdf} \caption{Differentiation between contextualized and context-less (static) embedding models (adapted of Haj-Yahia et al., 2019)} \label{fig:figure0} \end{figure*} \subsection{BERT} The BERT is an innovative method, considered the state of the art in pre-trained language representation \cite{devlin2019bert}. BERT models are considered contextualized or dynamic models, and have shown much-improved results in several NLP tasks \cite{dai2015semi}, \cite{peters2018deep}, \cite{radford2018improving}, \cite{howard2018universal} as sentiment classification, calculation of semantic tasks of textual similarity and recognition of tasks of textual linking. This model originated from various ideas and initiatives aimed at textual representation that have emerged in the area of NLP in recent years, such as: coVe \cite{mccann2017learned}, ELMo \cite{peters2018deep}, ULMFiT \cite{howard2018universal}, CVT \cite{clark2018semi}, context2Vec \cite{melamud2016context2vec}, the OpenAI transformer (GPT and GPT-2) \cite{radford2018improving} and the Transformer \cite{vaswani2017attention}. BERT is characterized as a dynamic method, mainly because it has an attention mechanism, also called Transformer \cite{devlin2019bert}, which allows analyzing the context of each word in a text individually, including checking if each word has been previously used in a text with the same context. This allows the method to learn contextual relationships between words (or subwords) in a text. BERT consists of several Transformer models \cite{vaswani2017attention} whose parameters are pre-trained on an unlabeled corpus like Wikipedia and BooksCorpus \cite{zhu2015aligning}. It can say that for a given input sentence, BERT “looks left and right several times” and outputs a dense vector representation for each word. For this reason, BERT is classified as a profoundly two-way model because it learns two representations of each word, one on the right and one on the left, and this learning to repeat n times. These representations are concatenated to obtain a final representation to use in future tasks. The preprocessing model adopted by BERT accomplishes two main tasks: masked language modeling (MLM) and next sentence prediction (NSP). In the MLM task, the authors argue \cite{devlin2019bert} that it is possible to predict a particular masked word from the context. For example, let's say we have a phrase: "I love reading data science articles." We want to train a contextualized language model. In this case, you need to replace "data" with "[MASK]". It is a token to indicate that it is missing. We will then train the model so that it can predict "date" as the missing token: "I love reading articles from [MASK] science". This technique aims to make the model learn the relationship between words, improving the level of learning, avoiding a possible “vicious cycle”, in which the prediction of a word to base on the word itself. Devlin et al. \cite{devlin2019bert} used 15-20\% of words as masked words. The task of NSP is to learn the relationship between sentences. As with MLM, given two sentences (A and B), we want to know if B is the next sentence after A in the corpus or if it would be any sentence. With this, BERT combines the pre-training tasks of both tasks (MLM and NSP), making it a task-independent model. For this, their authors provided pre-trained models in a generic corpus but allowing fine-tuning. It means that instead of taking days to pre-workout, it only takes a few hours. According to the authors of BERT \cite{devlin2019bert}, a new state of the art has been achieved in all NLP tasks they have attempted (e.g. Question Answering (QA) and Natural Language Inference (NLI)). \section{Related Works} Performing a systematic mapping focusing on ABSEE, we found few studies, as (\cite{abrahamsson2011predicting}, \cite{hussain2013approximation}, \cite{moharreri2016cost}, \cite{choetkiertikul2018deep}, \cite{zhang2016esse}, \cite{ionescu2017approach}, \cite{ochodek2016functional}, \cite{ayyildiz2016case}), that obtain the effort estimate from text using texts. It was observed in most of the studies presented the bag of words approaches are applied, considering word-level features (e.g. tf, tf-idf, part-of-speech tag), which to treated individually, that, is based on quantitative and qualitative data, not employing specific knowledge about the text structure of the requirements, ignoring aspects of context. Only two studies (\cite{ionescu2017approach}, \cite{choetkiertikul2018deep}) differ from these attributes, as they apply word embedding models, but none of them use pre-trained embeddings models. Ionescu \cite{ionescu2017approach} proposed a machine learning-based method for estimating effort for software development, using as input the text of project management requirements and metrics. The authors applied an original statistical preprocessing method to try out better results. First, a custom vocabulary was made. It is done using the standard deviation of the effort of those requirements where each word appears in the training set. For each requirement, a percentage of your words is maintained based on this statistic. The resulting requirements are concatenated with available project metrics. A modified TF-IDF calculation was also used, and numerical data were produced to form a bag-of-words, which is used as input to a linear regression algorithm. Choetkiertikul et al. \cite{choetkiertikul2018deep} proposed the use of deep learning. Two neural network models were to combine into the proposed deep learning architecture: The Long Short Term Memory (LSTM), which are long term memories and the recurrent highway network. The model is trainable from start to finish with raw input data that has only gone through a preprocessing step. The model learns from the story point estimated by previous projects to predict the effort of new stories. This proposal \cite{choetkiertikul2018deep} uses context-less word embeddings as input to the LSTM layer. As input data, the title and description of the requirements report were combined into a single sentence, where the description follows the title. The embeddings vectors generated in this first layer serve as input to the LSTM layer, which then generates a representation vector for the full sentence. It should be to note that this process of training the embedding layer and then the LSTM layer, to then generate the embedding vectors for each sentence, becomes computationally expensive. For this reason, the authors pre-train these layers, and only then make these models available for use. This sentence vector is then to feed into the recurrent highway network, which transforms the document vector several times before producing a final vector that represents each sentence. Finally, the sentence vectors undergo simple linear regression, predicting their effort. The possible bottleneck of this approach is the difficulty to feeding the model with new data. This feedback would fine-tune models, making them increasingly accurate. This difficulty occurs because with each new insertion into the dataset, the pre-training process, and consequently, its cost needs to be to repeat. Besides, Choetkirtkul's \cite{choetkiertikul2018deep} method realizes inter-project prediction, which is not repository independent. Another aspect to point is that, because requirement texts do not usually have a structured form, more words may not represent more complexity \cite{zhang2016esse} and \cite{hussain2013approximation} and therefore greater effort. Actually, it is the context that influences the effort most. As a differential, our visa method for making effort estimation in a generic way, that is, using a single requirements repository, independent of projects or repositories. A method of incorporating contextualized words (i.e. BERT) allows you to deeply learn the context of each selected word, solving problems of polysemy and ambiguity. When feeding the model with new training data, the adjustment can be made a few hours, that is, cheaper computationally than the generation of a pre-trained model from zero. \section{Construction Approach} \label{const_approach} The main objective of this research is to evaluate the efficacy of pre-trained embedding models contextualized according to effort estimation and based on requirement texts. A requirement in this context can be a case of use, a user’s story, or any software requirement, provided that the data is in text format, and aligned with the target effort. For this paper, user’s stories serve as the input to the proposed model, and are composed of their description and their effort, provided in points per story. This data’s textual format requires some basic preprocessing (e.g. removal of special characters and stop words) before their use in the models. It is important to note the nature of the software’s requirement texts, which are usually presented informally, that is, they do not have a standard format. In addition, these texts have a series of very specific elements (e.g. links, numeric addresses, method names). Considering these attributes, we propose that software automatically learn the characteristics of the original text. For the purpose of a comparison, pre-trained models generated from two approaches for modeling language will be applied: context-less and contextualized models. Figure \ref{fig:figure1} presents the steps that make up the overall architecture of the proposed model, which will be described below. \begin{figure}[!ht] \centering \includegraphics[width=.48\textwidth]{Figuras/Abordproposta_NOVA2_ing_mod.pdf} \caption{General architecture of the proposed model.} \label{fig:figure1} \end{figure} \begin{enumerate} \item \textbf{Data collection and pre-processing:} in this step, the data collection and preparation procedures are performed for later use during the \textit{feature learning} step, which will generate a context vector (i.e. numerical representation) for a given requirement text. For the proposed model, two corpus of texts containing software requirements will be required: \textit{corp\_SE} e \textit{corpPret\_SE} (as shown in Table \ref{tab:esp_corpus}). One of them will be the fine-tuning corpus, in which the texts are not labeled. The other corpus will be used during the training and testing stages of the inference model, in which each text will be labeled with their respective efforts. The texts for both corpus go through basic pre-processing procedures (e. g. removal of special characters and \textit{stopwords}). \item \textbf{\textit{Textual representation model}:} this step consists in applying methods of deep learning to the textual characteristics \cite{bengio2012unsupervised}, aiming to generate the vector representation for each of the texts. Therefore, these methods do not use manual activity for the generation of characteristics. To achieve this goal, methods to generate context-less embeddings (e.g. Word2Vec) and contextualized embeddings (e.g. BERT) are used. Therefore, this step comprises the fine-tuning procedure of the generic pre-trained models for both approaches, which are given as input to the inference model. For fine-tuning, an unlabeled corpus (corpPret\_SE - according to Table \ref{tab:esp_corpus}) is applied together with generic pre-trained models for each incorporation approach (\textit{word2vec\_base} and \textit{BERT\_base} - according to Table \ref{tab:pret_model}). As an output, two pre-trained adjusted models are generated: \textit{word2vec\_SE} and \textit{BERT\_SE} (according to Table\ref{tab:model_ajuste}. Then, the pre-trained and adjusted models are used to extract the textual representations for each requirement that makes up the training and testing corpus, using appropriate pooling techniques (e.g. mean, sum) applied to embeddings for each word. This textual representation is given by a matrix containing the number of samples from the training and test corpuses in relation to the number of dimensions of the respective embeddings (context-less and contextualized). The vector representation of each requirement is given as an input to the ABSEE inference model, aiming to learn and infer new estimates. \item \textbf{Inference model for ABSEE}: the textual representation for the set of training and testing requirements is submitted as input to the inference model. This model is composed of a deep learning architecture, which is considered to be quite simplified, when compared to VGG-type models \cite{simonyan2014very}, Resnet \cite{he2016deep}, among others. It is important to note that the concept of deep learning is not related to the number of layers of neural networks that make up the architecture, but rather to the fact that this architecture executes a deep learning of the text’s characteristics, through the process of learning features, which begins by representing the texts using an embedding model. Therefore, the characteristics learned during this process are applied through the embedding layer of the deep learning architecture used. Since the network entry is a sequence of words (100 words are considered for each text), an LSTM layer has the function of processing that sequence, generating a representation for the sentence (that is, for each text). Subsequently, two dense layers with nonlinear activation functions are used (the dimensions of the hidden layers are 50 and 10 respectively), ending with a linear regression layer. This is an even smaller architecture, when compared to the one used in the work of \cite{choetkiertikul2018deep}, excluding the role of recurring networks \cite{graves2012supervised}, \cite{sak2014long} and applying a single sequence feedforward after the representation layer. This is possible due to the feature learning methods applied in the previous step. A simplified architecture also aims to not mask the results generated from the expected inputs to the network. \end{enumerate} After performing an inference of the estimates for each textual requirement for the training and testing sets, metrics for performance evaluation were applied, identified in the learning model used (according to the section \ref{sec:metric_eval}), in order to analyze the feasibility of the application of the model developed. This evaluation process was carried out using applicable statistical and graphic techniques, always related to the real development environment. \subsection{Evaluation Metrics} \label{sec:metric_eval} The evaluation metrics used to evaluate model performance, which refers to the distance between the test set values and the predicted values. For this, some metrics were selected, which have been recommended for the evaluation of regression-based software effort prediction models \cite{sarro2016multi},\cite{choetkiertikul2018deep}, \cite{raschka2015python}, They are: Mean Absolute Error (MAE), Median Absolute Error (MdAE) and Mean Square Error (MSE). \begin{equation} MAE = \frac{1}{N}\sum_{i=1}^{N} |actual\_eff - estimated\_eff\textsubscript{i}| \end{equation} Where N is the number of textual requirements (e.g. user stories) that make up the test suite used to evaluate model performance, actual\_eff is the current effort measure, and estimated\_eff\textsubscript{i} is the estimated effort measure for a given textual requirement i. We also used the Median Absolute Error (MdAE), suggested as a more robust metric for large outliers \cite{choetkiertikul2018deep}. MdAE is defined as: \begin{equation} MdAE = median{|actual\_eff\textsubscript{i} - estimated\_eff\textsubscript{i}|} \end{equation} The Mean Squared Error (MSE) metric, represented by Equation x, was also applied: \begin{equation} MSE = \sqrt{\frac{1}{N}\sum_{i=1}^{N} (actual\_eff\textsubscript{i} - estimated\_eff\textsubscript{i})^2} \end{equation} \subsection{Data Collection and Pre-Processing} \label{section4} In order to obtain and prepare the data that makes up the training and testing corpus, and the fine-tuning corpus, the data collection and pre-processing step was performed using API's for the NLP, based on models previously established by the literature. These steps precede the process of representing textual characteristics, that is, the generation of the context vector for each requirement. Thus, in order to create the training and testing data set, a corpus specific to the software engineering context (\textit{corp\_SE}) was used, composed of textual requirements, more specifically user’s stories \cite{choetkiertikul2018deep}, labeled according to their respective development efforts. It is important to highlight that, despite being referred to as user’s stories, the text with requirements does not have a standard structure. Regarding the effort attributed to each requirement, it is worth mentioning that no single measurement scale was adopted (ex. \textit{Fibonacci}). The \textit{corp\_SE} (Table \ref{tab:esp_corpus}) is considered by the authors to be the first data set where the focus is on the level of requirements (e.g. user’s stories) and not just on the project level, as in most data sets available for SE research. The requirements texts, as well as the effort given to each of them, were obtained from large open sources from project management systems (e.g. Jira), totaling 23.313 requirements (Table \ref{tab:numreq_Project}), which were initially made available by \cite{porru2016estimating}. Subsequently, \cite{choetkiertikul2018deep} used the same database to carry out his research, aiming to estimate software effort by analogy. Despite the difficulty in obtaining the real effort to implement a software requirement, the authors claim to have been able to obtain the implementation time based on the situation (\textit{status}) of the requirement. Thus, the effort was obtained beginning from the moment when the situation was defined as "in progress" until the moment when it was changed to "resolved". Thus, \cite{choetkiertikul2018deep} applied two statistical tests (\textit{Spearman's} and \textit{Pearson} correlation) \cite{zwillinger1999crc}, which suggested a correlation between the points throughout the history and their real effort. Therefore, this same database was applied to the research proposed for this paper. It is known that these story points were estimated by human teams and, therefore, may contain biases and, in some cases, may not be accurate, which may cause some level of inaccuracy in the models. \begin{table}[!ht] \footnotesize \begin{tabularx} {0.48\textwidth}{l|X|c} \hline \textbf{Projct ID} & \textbf{Description} & \textbf{Requirements/project} \\ \hline {0} & {Mesos} & {1680}\\ {1} & {Usergrid} & {482}\\ {2} & {Appcelerator Studio} & {2919}\\ {3} & {Aptana Studio} & {829}\\ {4} & {Titanium SDK/CLI} & {2251}\\ {5} & {DuraCloud} & {666}\\ {6} & {Bamboo} & {521}\\ {7} & {Clover} & {384}\\ {8} & {JIRA Software} & {352}\\ {9} & {Moodle} & {1166}\\ {10} & {Data Management} & {4667}\\ {11} & {Mule} & {889}\\ {12} & {Mule Studio} & {732}\\ {13} & {Spring XD} & {3526}\\ {14} & {Talend Data Quality} & {1381}\\ {15} & {Talend ESB} & {868}\\ \hline \textbf{Total} & {} & \textbf{23.313}\\ \hline \end{tabularx} \caption{Number of textual requirements (user stories) and description of each of the 16 projects used in the experiments \cite{choetkiertikul2018deep}.} \label{tab:numreq_Project} \end{table} Typically, user’s stories are measured on a scale based on a series of \textit{Fibonacci} \cite{scott2014origin}, called \textit{Planning Poker} (e.g. 1, 2, 3, 5, 8, 13, 21, 40, 100) \cite{cohn2005agile}. As there is no standardized use of this scale among the projects used to create \textit{corp\_SE}, there was no way of approximating the points by the history provided. Therefore, 100 possible predictions were considered, distributed over the \textit{corp\_SE}, of which some are nonexistent, as can be seen in the histogram of Figure \ref{figure3}. In this way, the effort estimate was treated as a regression problem. \begin{table}[!ht] \footnotesize \begin{tabularx}{0.48\textwidth}{l|X|c|c} \hline \textbf{Corpus} & \textbf{Specification} & \textbf{Aplication} & \textbf{Labeled}\\ \hline \textit{corp\_SE} & Contains 23.313 user stories and consists of 16 large open source projects in 9 repositories (Apache, Appcelerator, DuraSpace, Atlassian, Moodle, Lsstcorp, Mulesoft, Spring e Talendforge). & Train and test & YES \\ \hline \textit{corpPret\_SE} & It consists of more than 290 thousand texts of software requirements of different projects (ex. \textit{Apache, Moodle, Mesos}). & Fine-tuning & NO\\ \hline \end{tabularx} \caption{Corpus used in the experiments carried out.} \label{tab:esp_corpus} \end{table} For the fine-tuning process, which makes up the proposed model, a corpus of specific texts from software engineering, the \textit{corpPret\_SE} (shown in the Table (\ref{tab:esp_corpus}), is used. It is not labeled, therefore the training carried out is unsupervised, and is composed of texts with specifications of requirements, obtained from open source repositories, according to the procedure described by \cite{choetkiertikul2018deep}. While exploring the data available in \textit{corp\_SE}, some relevant aspects that interfere with the inference model’s settings were observed. The histogram of Figure \ref{figure2} allows for one to evaluate the maximum number of words to be considered per text. The average number of words per text, accompanied by its standard deviation, is $53\pm108.6$. \begin{figure}[!ht] \centering \includegraphics[width=.48\textwidth]{Figuras/Tokens-por-Texto.pdf} \caption{Histogram representing the number of words in each sentence of the dataset of training and testing.} \label{figure2} \end{figure} \begin{figure}[!ht] \centering \includegraphics[width=.48\textwidth]{Figuras/esforco-frequencia.pdf} \caption{Histogram representing the size of the effort in relation to its frequency in the corp\_SE.} \label{figure3} \end{figure} Figure \ref{figure3} shows the frequency of distribution of the effort size in the training and testing database (\textit{corp\_SE}). It can be seen that most of the samples have smaller efforts (between 1 and 8 points per story). The cross validation \textit{k-fold} method was applied in order to partition the data set used to carry out the experiments (\textit {corp\_SE}). Thus, a number of equal subsets (\textit{nsplit}) was defined, represented by \textit{k} with a value of 10. Thus, the data from the \textit{corp\_SE} were divided into a set of training and validation (90\% of texts), and a set of tests (10\% of texts). For each subset of the data, the mean and standard deviation for the metrics applied in the performance evaluation were obtained, as described in the section \ref{sec:metric_eval}. \subsection{Textual Representation Model} The purpose of the procedures described in this section is to generate models to represent the texts that make up the training and test corpus. These representation models will be obtained from the generic and adjusted pre-trained \textit{embeddings} models, that must consider the diversity of existing contexts. Thus, the representation models (according to the Figure \ref{fig:figure1}) serve as input to the proposed sequential architecture. To perform the experiments, two pre-trained generic \textit{word embeddings} models were applied, one using the context-less approach (\textit{Word2Vec}) and the other the contextualized approach (\textit{BERT}). Thus, for the context-less approach, a pre-trained model called \textit{word2vec\_base} was used, the specifications of which are shown in Table \ref{tab:pret_model}. As a contextualized model, a generic BERT model (\textit{BERT\_base uncased}) had previously been pre-trained and made available by its authors \cite{devlin2019bert} for free use in PLN tasks, as specified in Table\ref{tab:pret_model}. \begin{table}[htp] \footnotesize \begin{tabularx}{0.48\textwidth}{X|X} \hline \textbf{Pre-trained model} & \textbf{Specification} \\ \hline \textit{word2vec\_base} & trained on a \textit{corpus} from \textit{Wikipedia} using the \textit{Word2Vec} \cite{mikolov2013efficient} algorithm. For this, the following hyperparameters were used: number of dimensions of the hidden layer = 100; method applied to the learning task = \emph{cbow}. \\ \hline \textit{BERT\_base} & \textit{Bert\_base uncased}: 12 layers for each \textit{token}, 768 hidden layers, 12 heads of attention, 110 million parameters. The \textit{uncased} specification means that the text was converted to lower case before \textit{tokenization} based on \textit{WordPiece}, in addition, removes any accent marks. This model was trained with english texts (Wikipedia) with lowercase letters. \\ \hline \end{tabularx} \caption{Pre-trained models used in the performed experiments.} \label{tab:pret_model} \end{table} The \textit{BERT\_base} model, as well as the other pre-trained BERT models, offers 3 components \cite{devlin2019bert}: \begin{itemize} \item A \textit{TensorFlow checkpoint (bert\_model.ckpt)} that contains pre-trained weights (consisting of 3 files). \item A vocabulary file (vocab.txt) for mapping \textit{WordPiece} \cite{zhang2016google} for word identification. \item A configuration file (\textit {bert\_config.json}) that specifies the model's hyperparameters. \end{itemize} Then, these two generic models go through a fine-tuning process, as presented in the section \ref{sec:fine-tuning}. \subsection{Fine-tuning} \label{sec:fine-tuning} It is worth noting that the fine-tuning process consists of the use of a pre-trained embedding model (trained on a generic dataset) in an unsupervised way, which is adjusted, that is, retrained on a known data set that is specific to the area of interest. In this case, the fine-tuning was performed on the generic models \textit{word2vec\_base} and \textit{BERT\_base}, using corpus \textit{corpPret\_SE} (shown in Table \ref{tab:esp_corpus}). The following are the pipelines (Figures \ref{fig:fig_preWord2vec} and \ref{fig:fig_ajusteBert}) used to adjust and generate the representation of the texts \textit {corp\_SE}. This representation was used as input to the proposed sequential architecture. \begin{figure}[!htb] \centering \includegraphics[width=.48\textwidth]{Figuras/gera_rep_fig1_ing.pdf} \caption{Pipeline of the \textit{word2vec\_base} fine-tuning process and generation of textual representation for the corp\_SE.} \label{fig:fig_preWord2vec} \end{figure} A fine-tuning of the generic model \textit{word2vec\_base} (Figure \ref{fig:fig_preWord2vec}) was performed using specific methods for this purpose provided by the \textit{Gensim} library in the \textit{Python} language. This process generated the \textit{word2vec\_SE} model. This adjusted model was used to generate the average representation (see section \ref{obtCaract}) for each requirement text of the training and testing corpus (corp\_SE). The fine-tuning process of the pre-trained BERT model consists of two main steps \cite{devlin2019bert}: \begin{enumerate} \item \textbf{Preparation of data for pre-training:} initially the input data is generated for pre-training. This is done by converting the input sentences into the format expected by the BERT model (using \textit{create\_pretraining\_data} algorithm). As BERT can receive one or two sentences as input, the model expects an input format in which special tokens mark the beginning and end of each sentence, as shown in Table \ref{tab:exe_entradaBERT}. In addition, the \textit{tokenization} process needs to be performed. BERT provides its own \textit{tokenizer}, which generates output as shown in Table \ref{tab:exe_tokenizerBERT}. \begin{table}[ht] \footnotesize \begin{tabularx}{0.48\textwidth}{X|X} \hline \textbf{Entry of two sentences} & \textbf{Entry of a sentence} \\ \hline [CLS] The man went to the store. [SEP] He bought a gallon of milk. [SEP] & [CLS] The man went to the store. [SEP] \\ \hline \end{tabularx} \caption{Example of formatting input texts for pre-training with BERT.} \label{tab:exe_entradaBERT} \end{table} \begin{table}[ht] \footnotesize \begin{tabularx}{0.48\textwidth}{l|X} \hline \textbf{Input sentence} & "Here is the sentence I want embeddings for." \\ \hline \textbf{Text after \textit{tokenizer}} & ['[CLS]', 'here', 'is', 'the', 'sentence', 'i', 'want', 'em', '\#\#bed', '\#\#ding', '\#\#s', 'for', '.', '[SEP]'] \\ \hline \end{tabularx} \caption{Example application of \textit{tokenizer} provided by BERT.} \label{tab:exe_tokenizerBERT} \end{table} \item \textbf{Application of the pre-training method:} the method used for pre-training by BERT (\textit{run\_pretraining}) was made available by its authors. The necessary hyperparameters were informed, the most important being: \begin{itemize} \item \textit{input\_file}: directory containing pre-formatted pre-training data (as per step 1). \item \textit{output\_dir}: output file directory. \item \textit{max\_seq\_length}: defining the maximum size of the input texts (set at 100). \item \textit{batch-size}: maximum lot size (set at 32, per use guidance of the pre-trained model \textit{BERT\_base}. \item \textit{bert\_config\_file}: BERT model configuration file, supplied with the pre-trained model (\textit{bert\_config.json}). \item \textit{init\_checkpoint}: files of the pre-trained model used containing the weights (\textit{bert\_model.ckpt}). \end{itemize} \end{enumerate} For the generic BERT model (Table \ref{tab:pret_model}, we opted for its version \textit{Uncased\_L-12\_base}, here called \textit {BERT\_base} (Table \ref{tab:pret_model}). The fine-tuning process for the BERT model also used the \textit{corpPret\_SE} (Figure \ref{fig:fig_ajusteBert}) and was performed as shown above. \begin{figure}[!htb] \centering \includegraphics[width=.48\textwidth]{Figuras/gera_rep_fig4_ing.pdf} \caption{Pipeline of the fine-tuning process of the \textit{BERT\_base} model and generation of the textual representation for the corp\_SE.} \label{fig:fig_ajusteBert} \end{figure} The entire process, from data preparation to fine-tuning the BERT model, used the algorithms produced in the repository \cite{BERTGit}, in which \cite{devlin2019bert} provides the full \textit {framework} developed in the \textit {Python} language. After performing the fine-tuning, two new pre-trained models are available, as shown in Table \ref{tab:model_ajuste}, which will also compose the experiments. It is noteworthy that the proposed model requires pre-training only for the embedding layer. This allows, for example, for this pre-trained model to be made available for other software engineering tasks, or even for different effort estimation tasks. Thus, this pre-trained model may undergo successive adjustments, according to the need of the task to which it will be applied. \begin{table}[ht] \footnotesize \begin{tabularx}{0.48\textwidth}{l|X} \hline \textbf{Pre-trained models} & \textbf{Specification} \\ \hline \textit{word2vec\_SE} & consists of the \textit{word2vec\_base} model after fine-tuning with the corpus \textit{corpPret\_SE}. \\ \hline \textit{BERT\_SE} & consists of the \textit{BERT\_base} model after fine-tuning with the corpus \textit{corpPret\_SE}. \\ \hline \end{tabularx} \caption{Adjusted pre-trained models applied to the performed experiments.} \label{tab:model_ajuste} \end{table} \subsection{Obtaining Characteristics} \label{obtCaract} After the fine-tuning was completed, processing was performed to obtain textual representations from the four models of embeddings (\textit{word2vec\_base, BERT\_base, word2vec\_SE and BERT\_SE)}. For the context-less embeddings model, represented by the \textit{word2vec\_base} and \textit{word2vec\_SE} models (as shown in Figure \ref{fig:fig_preWord2vec}), the embeddings vectors of the words contained in each text were averaged \cite{wieting2017revisiting, palangi2016deep}. As for the contextualized embeddings model, the textual representations generated by the BERT model (according to Figure \ref{fig:fig_ajusteBert}) present a different structure from the context-less embeddings models (e.g. Word2Vec). This is primarily due to the fact that the number of dimensions of the embeddings vectors is not defined by the user, but by the model itself. Therefore, the number of dimensions of word embeddings for the model \textit{BERT\_base} is defined in 768. In addition, each word in this model is represented by 12 layers (standard for \textit{BERT\_base}), with the need to pool \cite{lev2015defense} the embeddings of some of the layers for each word. In order to define the pooling strategies to be applied, the article by \cite{devlin2019bert} was taken as a basis. Thus, one of the proposed strategies was used, considering that there were no significant differences between the results obtained with the other tested strategies. Thus, for the models \textit{BERT\_base} and \textit {BERT\_SE}, the strategy chosen was to use the penultimate layer of each word to generate a vector of average embeddings for each sentence. More details on pooling strategies can be found in \cite{lev2015defense, alammar2018illustrated}. \subsection{Exploratory data analysis} Before presenting the results of the effort estimation, it is first important to highlight some observable aspects regarding the vector of textual representation obtained after the embeddings layer. These sentence embeddings were generated from the models specified in Tables \ref{tab:pret_model} and \ref{tab:model_ajuste}, that is, generic and fine-tuned models for both approaches (without context and contextualized). In order to show the characteristic of the generated embeddings, the \textit{t-Distributed Stochastic Neighbor Embedding} (t-SNE) algorithm was applied. This algorithm has been used to represent complex data graphically and in smaller dimensions, while preserving the relationships between neighboring words \cite{maaten2008visualizing}, which greatly facilitates their understanding. Thus, Figure \ref{fig:projIdEffort} shows sentence embeddings generated from the \textit{BERT\_SE} for each textual requirement. Only 100 instances of requirements were included for each of the 16 projects analyzed (Table \ref{tab:numreq_Project}) (represented by “idProj”). The \textit{t\_SNE} algorithm reduced the 768-dimension model (BERT standard) to just two dimensions, which allowed for a visual analysis of the representations obtained and, based on these representations, some conclusions were reached. \begin{figure}[!htb] \centering \includegraphics[width=.48\textwidth]{Figuras/alt_projId_effort_legal.pdf} \caption{Embeddings generated by \textit{BERT\_SE}. The points represent the effort for each requirement, according to its size. The larger the point size, the greater the effort.} \label{fig:projIdEffort} \end{figure} Table \ref{exe2_simTextos} present examples of requirement texts extracted from 2 different groups according to Figure \ref{fig:projIdEffort}. The texts, in each of the tables, have minimum distances between them. \begin{table*}[ht] \footnotesize \begin{tabularx}{0.98\textwidth}{l|X} \hline \textbf{ID} & \textbf{Text} \\ \hline \textit{Texto 18994} & for the \textbf{sqlserver and postgresql connection} can not show the structure correctly.1. \textbf{create a\textbf{postgresql sqlserver connection} set} or not set the catalog parameter(doesn't set the textbf{schema}). 2. check the structure, only one \textbf{schema} show under each catalog. in fact i have several. please check it same issue as \textbf{informix db}. \\ \hline \textit{Texto 17552} & sqoop - unable \textbf{to create job using merge command} as a user, i need to use xd \textbf{sqoop} module to support the merge command. currently, the sqoop runner createfinalarguments method forces the requirement for \textbf{connect}, \textbf{username and password} options which are not valid for the merge option. a check of the module type to not force these options being assigned to \textbf{sqoop arg list} would be preferred. \\ \hline \textit{Texto 15490} & need \textbf{to create a persistent-job-registry} in order to hook up the \textbf{to get access} to all the jobs available the job registry has to be shared. currently the only \textbf{implementation} is the mapjobregistry. testability. the admin will need to be see all \textbf{jobs created} by its containers. \\ \hline \end{tabularx} \caption{Contextual similarity between grouped texts.} \label{exe2_simTextos} \end{table*} In this example (Table \ref{exe2_simTextos}), the context of the requirements presented is related to connection and database operations. Among the highlighted words (in bold), one can find, for example "sqoop". This word is part of to an application that transfers data between relational databases and \textit{Hadoop} \footnote{Hadoop is an open source software platform for the storage and distributed processing of large databases. The services \textit{Hadoop} provides includes storage, processing, access, governance, security and data operations, making use of powerful hardware architectures, which are usually on loan.}. Therefore, the identification of similar contexts is more clearly perceived, even with very different words, as is the case of "sqoop", "sqlserver" and "persistent". These are different words, but part of the same context. Thus, although the groupings did not demonstrate clear groups, either by project or by effort, the groupings demonstrated, at a certain level, a representation of requirements from the same context, even if from different projects and/or efforts. \subsection{Effort Estimation Model Settings} In this section, the stages of the S$E^3$M model will be presented, in which representation vectors for each textual requirement are obtained according to the procedures presented in section \ref{obtCaract}, are given as a parameters to the layers \textit{dense} of the architecture \textit{deep learning}, as shown in Figures \ref{figure7} and \ref{figure8}. \begin{figure}[!ht] \centering \includegraphics[width=0.48\textwidth]{Figuras/historyRede_LSTM_word2vec.pdf} \caption{Architecture \textit{deep learning} with the pre-trained embedding layer using Word2Vec.} \label{figure7} \end{figure} \begin{figure}[!ht] \centering \includegraphics[width=0.48\textwidth]{Figuras/historyRede_LSTM_BERT.pdf} \caption{Architecture \textit{deep learning} with the pre-trained embedding layer using BERT.} \label{figure8} \end{figure} The \textit{embedding()} layers (Figures \ref{figure7} and \ref{figure8}) are represented by the vector of pre-trained weights for each sentence. These vectors are processed by two dense nonlinear layers, followed by a linear regression layer. The output is the estimate of the predicted effort (e.g. points per story). Each instance of textual requirement submitted to the \textit{Embedding ()} layer is represented by an average vector representing each sentence. A sentence consists of a maximum of 100 words, each of which is represented by 100 text embeddings for the \textit{Word2Vec} models and 768 dimension embeddings according to BERT models, as justified below. The maximum number of words per text was defined based on the representation of the histogram shown in Figure \ref{figure2}, which shows that this number would include most of the sentences used in the training and test database, with reduced data loss. As presented in the architecture specification S$E^3$M (section \ref{const_approach}), it is a very simple architecture, post layer of embedding, consisting only of two dense non-linear layers and a linear regression layer. The fact that the \textit{deep learning} architecture is very simplified was purposeful, considering that the objective of this thesis is to present how to infer effort estimates in software projects by analogy using pre-trained embeddings models, verifying whether these models are promising for text-based software effort estimation. In this way, a more robust architecture could mask the results generated at each of the different network entrances. A textual requirement, also referred to in this study as a sentence, is represented by an average vector of the word embeddings that compose this sentence. This average vector is generated from each of the generated models (Tables \ref{tab:pret_model} and \ref{tab:model_ajuste}, considering the particularities of each applied approach (without context and contextualized), as presented in section \ref{obtCaract}. Therefore, each generated embedding model is represented as a matrix, where each line represents an average embedding vector for a given textual requirement. Thus, each embedding model has the same number of samples, and what varies is the dimension applied. Previous tests were performed using the \textit{grid search} method. For the embeddings models without a context, tests were performed with dimensions 50, 100, and 200 with the best results presented by dimensions 50 and 100. As there was no significant variation for the MAE between both dimensions using the same neural network architecture, the number of dimensions of embeddings was fixed at 100. For the \textit{transformers} BERT the standard dimension defined for the \textit{BERT\_base} model was used, that is, equal to 768. For the training of the learning model, it was necessary to configure some hyperparameters. Therefore, the \textit{Adam} optimizer \cite {kingma2014adam}, learning rate 0.002 was used and the size of the \textit{batch\_size} was 128. Twenty epochs and an early stopping mechanism were defined, in which, if the MAE value remains stable for 5 epochs, the best results are averaged. \subsection{Experiment Settings} The results obtained in this study will be presented below in order to make a comparative analysis with the most similar study \cite{choetkiertikul2018deep} we identified, in addition to answering the following research questions defined initially. \begin{table*}[ht] \footnotesize \begin{tabular}{c|c|c} \hline \textbf{Experiments} & \textbf{Pre-trained model} & \textbf{Sequential network architecture} \\ \hline E1 & \textit{word2vec\_base} & Embedding() + LSTM + Dense (not-linear) + Dense (not-linear) + Dense (linear) \\ \hline E2 & \textit{word2vec\_SE} & Embedding() + LSTM + Dense (not-linear) + Dense (not-linear) + Dense (linear) \\ \hline E3 & \textit{BERT\_base} & Embedding() + LSTM + Dense (not-linear) + Dense (not-linear) + Dense (linear) \\ \hline E4 & \textit{BERT\_SE} & Embedding() + LSTM + Dense (not-linear) + Dense (not-linear) + Dense (linear) \\ \hline E5 & \textit{BERT\_SE} & Embedding() + LSTM + Dense (not-linear) + Dense (not-linear) + Dense (softmax) \\ \hline \end{tabular} \caption{Description of performed experiments.} \label{tab:ord_experiments} \end{table*} \section{Results and Discussions} The results will be presented below, to make a comparative analysis with the most similar study \cite{choetkiertikul2018deep}, in addition to answering the following research questions defined initially. \textbf{RQ1. Does a generically pre-trained word embedding model show similar results to a software engineering pre-trained model?} To answer this question, experiments (\textbf{E1}, \textbf{E2}, \textbf{E3} and \textbf{E4}) were performed, with pre-trained models with and without fine-tuning, for context-less and contextualized approaches, a task that aimed to determine effort estimation. The approach consists of using a pre-trained embedding model as the only source of input in the deep learning architecture used. Table \ref{tab:resultgeral} presents the average values for the MAE, MdAE and MSE measurements obtained after the application of cross-validation \textit{10-fold} during the execution of the proposed sequential architecture, in which each model was used as input for pre-trained embedding available for each of the experiments (according to Table \ref{tab:ord_experiments}). \begin{table*}[ht] \footnotesize \begin{tabular}{c|c|c|c|c|c} \cline{1-1}\cline{2-2}\cline{3-3}\cline{4-4}\cline{5-5} \multicolumn{1}{c|}{\textbf{Approach} \centering } & \multicolumn{1}{c|}{\textbf{Pre-trained model} \centering } & \multicolumn{1}{c|}{\textbf{MAE} \centering } & \multicolumn{1}{c|}{\textbf{MSE} \centering } & \multicolumn{1}{c}{\textbf{MdAE} \centering }\\ \cline{1-1}\cline{2-2}\cline{3-3}\cline{4-4}\cline{5-5} \multicolumn{1}{c}{Context-less} & \multicolumn{1}{|c|}{word2vec\_base} & \multicolumn{1}{c|}{4.66 $\pm$0.14} & \multicolumn{1}{c|}{100.26 $\pm$7.04} & \multicolumn{1}{c}{2.9}\\ \cline{2-2}\cline{3-3}\cline{4-4}\cline{5-5} \multicolumn{1}{c|}{ } & \multicolumn{1}{c|}{word2vec\_SE} & \multicolumn{1}{c|}{4.36 $\pm$0.31} & \multicolumn{1}{c|}{89.9 $\pm$14.37} & \multicolumn{1}{c}{2.5}\\ \cline{1-1}\cline{2-2}\cline{3-3}\cline{4-4}\cline{5-5} \multicolumn{1}{c}{Contextualized} & \multicolumn{1}{|c|}{BERT\_base} & \multicolumn{1}{c|}{4.52 $\pm$0.094} & \multicolumn{1}{c|}{100.95 $\pm$7.3} & \multicolumn{1}{c}{2.7}\\ \cline{2-2}\cline{3-3}\cline{4-4}\cline{5-5} \multicolumn{1}{c|}{ } & \multicolumn{1}{c|}{BERT\_SE} & \multicolumn{1}{c|}{\textbf{4.25 $\pm$0.17}} & \multicolumn{1}{c|}{\textbf{86.15 $\pm$1.66}} & \multicolumn{1}{c}{\textbf{2.3}} \\ \hline \end{tabular} \caption{Evaluation of the results obtained for experiments E1, E2, E3 and E4. Bold are the best results for each pre-trained embedding model. For all the metrics used, the lower the value, the better the result.} \label{tab:resultgeral} \end{table*} As can be seen in Table \ref{tab:resultgeral}, the models that underwent fine-tuning (with SE suffix), regardless of the approach used, gave better results for MAE, MSE and MdAE. Thus, it is clear that a pre-trained embedding model, in which fine-tuning is performed with a specific corpus of the task domain, presents a better performance than a pre-trained model with a generic corpus, as is the case with \textit{word2vec\_base} and \textit{BERT\_base}. This can be proven by comparing the generic context-less embedding model (\textit{word2vec\_base}) to the same fine-tuned model (\textit{word2vec\_SE}), where a 5\% improvement is seen in relation to the MAE value for the second model. Likewise, when applying the contextualized embedding model with fine-tuning (\textit{BERT\_SE}), an improvement of 7.8\% for the MAE was observed in relation to the generic model \textit{BERT\_base}. Thus, it is noted that, in general, the results achieved improved after adjusting the models with a specific corpus of the domain . If the MAE value obtained for the best model in Table \ref{tab:resultgeral} (\textit{BERT\_SE}), which was 4.03, is applied in practice, this will indicate that, for a given user story, in if the real effort is 5 points per story, the estimated effort value could be between 1 and 9 points per story. This is one of the reasons why human participation in the estimation process is indicated, in order to calibrate these effort values to new requirements. In terms of MSE, the improvement was of 3.5\% for the \textit{word2vec\_SE} model, when compared to \textit{word2vec\_base}, and 13.5\% for MdAE. When evaluating MSE and MdAE for the contextualized approach, the fine-tuned model outperforms the generic model by 14.6\% and 14.8\%, respectively. Thus, we conclude that the representation of the training and test model (\textit{corp\_SE}), when generated from pre-trained and adjusted embeddings models, improves the performance of activities such as the ABSEE. To this end, it is estimated that the greater the volume and diversity of samples in the corpus used in fine-tuning (\textit{corpPret\_SE}, the better the results can be. Therefore, this fact must be considered when giving continuity to this task in future studies. \textbf{RQ2. Would embedding models generated by context-less methods (i.e. Word2Vec) be effective as models generated by contextualized methods (i.e. BERT)?} As stated by Ruder \cite{howard2018universal}, “it only seems to be a question of time until pre-trained word embeddings (i.e. word2vec and similar) will be dethroned and replaced by pre-trained language models (i.e. BERT) in the toolbox of every NLP practitioner.” Thus, the objective of this study was to analyze if context-less embeddings models are effective in effort estimates, as compared to contextualized embeddings models in a specific corpus. As can be seen in Table \ref{tab:resultgeral} the results obtained by the contextualized models (\textit{BERT\_base} and \textit{BERT\_ES}), surpass the results of the models without context. When comparing MAE values, the \textit{BERT\_base} model shows a 3\% improvement over \textit{word2vec\_base}. Likewise, for the values of MdAE and MSE there was an improvement of 0.7\% and 6.9\%, respectively. When comparing how these metrics between the models with fine tuning (\textit {Word2vec\_ES} and \textit {BERT\_ES}), as improvements of the contextualized model in relation to no context were 2.5\%, 4.2\% and 8\% for the values of MAE, MSE and MdAE, respectively. It is believed that this result is due to the fact that methods context-less (ex. \textit{Word2Vec}) allow to represent a single context for a given word in a set of texts. This aspect causes a lot of information to be lost. In an effort estimate, based on the requirements texts (e.g. user stories), a contextualized strategy certainly produces better results. Unlike the \textit{Word2vec} approach, BERT methods offer this dynamic context, allowing the actual contexts of each word to be represented in each text. This aspect is important, as textual software requirements (i.e. user stories, use cases) generally have short texts and little vocabulary, which means that many words are common to the field of software engineering and are repeated in many texts. This is the importance of identifying different contexts of use for each word, in order to differentiate them. Contextualized methods like BERT guarantee this dynamic treatment of each word, addressing problems of polysemy and ambiguity in an intrinsic way. This is possible due to the fact that the contextualized models use a model of deep representation of each word in the text (that is, 12 or 24 layers), unlike the models of embeddings context-less that present a superficial representation (of a single layer) for a word. In addition, contextualized models use an attention model that allows verifying whether the same word occurred previously in the same context or not (example in Table \ref{tab:exe_poli}), or whether different words can present the same context (e.g. create, implement, generate) - example in Table \ref{tab:exe_ambi}. \begin{table}[ht] \footnotesize \begin{tabularx}{0.48\textwidth}{l|X} \hline \textbf{Text 22810} & \textbf{Add} that contact as a favorite notice that the images for contacts (driven by remote url) change unexpectedly. Under the covers all that is happening, is that the data of the list view is refreshed. \\ \hline \textbf{Text 23227} & \textbf{Add} qparam to skip retrieving metadata and graph edges if the qparam is not there, use current default behavior. \\ \hline \end{tabularx} \caption{Example of requirement texts that have polysemy - same words and different contexts.} \label{tab:exe_poli} \end{table} \begin{table}[!ht] \footnotesize \begin{tabularx}{0.48\textwidth}{l|X} \hline \textbf{Text 18} & {\textbf{create} new titanium studio splash screen there is a placeholder image...} \\ \hline \textbf{Text 22810} & {\textbf{build} the corporate directory app for ios...} \\ \hline \end{tabularx} \caption{Example of requirement texts that have ambiguity - different words in the same context.} \label{tab:exe_ambi} \end{table} \textbf{RQ3. Are pre-trained embeddings models useful to a text-based software effort estimation?} To answer this question regarding the perspectives of contextualized pre-trained models applied to ABSEE, it is necessary to observe whether MAE, MSE and MdAE obtained good results. As shown in Table \ref{tab:resultgeral}, the best MAE value was 4.25, which means that a software effort of 6 will be predicted between 2 and 10. When questioning whether this result is good or bad, can be observed that, considering the small number of samples in the training set and tests, the high degree of imbalance between classes, and the high variability of the text, this result is quite adequate. It is precisely due to the perception that, at least currently, there is little data to estimate the effort involved in software development that motivated these researchers to investigate pre-trained embedding models, so as to solve the proposed problem. \begin{table}[htbp] \begin{tabularx}{0.48\textwidth} {l|c|c} \hline \textbf{Method} & \textit{S$E^3$M} (multi-repositories) & \textit{Deep-SE} (cross-repository) \\ \hline \textbf{MAE} & 4.25 $\pm$ 0.17 & 3.82 $\pm$ 1.56 \\ \hline \end{tabularx} \caption{Mean Absolute Error (MAE) obtained for \textit{BERT\_SE} compared to the Deep-SE model \cite{choetkiertikul2018deep}} \label{tab:comparaMAE} \end{table} When comparing the best MAE results, obtained though the \textit{BERT\_SE} model, with the MAE results given by the Deep-SE \cite{choetkiertikul2018deep} model, the latter of which was the study found to be most similar to the present research, some aspects stand out, as shown below. As can be seen in Table \ref{tab:comparaMAE}, the MAE obtained by \textit{BERT\_SE} was slightly higher than \textit{Deep-SE}. However, one should note that, to obtain this result, \cite{choetkiertikul2018deep} inferred the effort estimates between projects (e.g. Moodle/Titanium, Mesos/Mule). Therefore, there is a large chance that two projects share a similar context, which would make predictability easier for projects in different contexts. This statement is reflected directly in the standard deviation of the MAE values (e.g. 5.37, 6.36, 5.55, 2.67, 4.24) for the Deep-SE between projects, which is 1.56. One can see that some values of MAE are relatively low (e.g. 2.67), while others are higher (ex. 6.36). This means that there may be a higher variation for the estimates inferred by Deep-SE, which, in the worst case, can cause a requirement whose effort is 7 points per story, to return 1 or 13 points per story. Thus, it is suggested that if the Deep-SE model is applied using a single repository approach, as well as the S$E^3$M, the MAE values may be even higher. S$E^3$M, on the other hand, uses a single repository approach, that is, all requirements are independent of project or repository, aiming to generalize the model. Thus, although the S$E^3$M MAE is close to the Deep-SE value, the standard deviation obtained is smaller (0.17), or almost nonexistent (ex. 3.87, 4.21, 4.15, 4.12, 3.97, 4.25, 4.01), which can be proven by observing the pattern of MAE values obtained by the model. In this sense, it can be said that the proposed method is more generic and applicable to different problems, demonstrating a greater degree of reliability than Deep-SE. This is mainly due to the ability of the BERT \textit{Transformer} mechanism (attention mechanism) to resolve long-term dependency and “vanishing gradient” \cite{hochreiter1991untersuchungen} and \cite{bengio1994learning}, that presents itself as limitations in recurrent network architectures, as is the case with RHN and LSTM, used by \cite{choetkiertikul2018deep}. The “vanishing gradient” is the loss of relevant context information, used to identify the semantics of a given word in a text. Therefore, the attention mechanism allows for one to ignore irrelevant information and focus on what is relevant, making it possible to connect two related words, even if they are not located one after the other. In order to reinforce the positive trend of applying pre-trained embeddings models in the process of inferring effort estimation, the \textbf{E5} experiment was performed. In this case, the same set of training and testing data was used, applying a classification layer (with softmax activation) instead of linear regression. This required some modifications to the dataset. First, there was a need to make the dataset more homogeneous and bulky as compared to the existing labels. Then the closest estimates were grouped, considering the series of \textit{Fibonacci} proposed for the \textit{Planning Poker} \cite{cohn2005agile} estimation method. As a result of this process, the data set only had 9 possible labels: 1, 2, 3, 5, 8, 13, 20, 40, 100. Therefore, compared to the regression problem, each label had its data volume increased and balanced in relation to the existing classes, mainly for the smaller labels (between 1 and 8), as shown in Table \ref{numreqPP}. \begin{table*}[!ht] \footnotesize \begin{tabular} {p{0.25\linewidth}|p{0.04\linewidth}|p{0.04\linewidth}|p{0.04\linewidth}|p{0.04\linewidth}|p{0.04\linewidth}|p{0.04\linewidth}|p{0.04\linewidth}|p{0.04\linewidth}|p{0.04\linewidth}|p{0.04\linewidth}} \hline \textbf{Number of labels} & \textbf{1} & \textbf{2} & \textbf{3} & \textbf{5} & \textbf{8} & \textbf{13} & \textbf{20} & \textbf{40} & \textbf{100} & \textbf{Total}\\ \hline \textbf{Number of textual requirements/labels} & 4225 & 3406 & 4809 & 4725 & 3588 & 1238 & 706 & 451 & 165 & \textbf{23.313}\\ \hline \end{tabular} \caption{Number of textual requirements allocated to each Planning Poker class.} \label{numreqPP} \end{table*} The Figure \ref{fig_confusion_matrix} shows the confusion matrix generated for the experiment \textbf{E5}. One can see that the greatest confusion occurs between the lowest efforts (1, 2, 3, 5 and 8). Considering the MAE value of the regression experiment (4.25), it is possible to understand this bias in the confusion matrix; after all, as explained previously, an effort of 4 points per story could be 1 or 8. \begin{figure}[!htb] \centering \includegraphics[width=0.48\textwidth]{Figuras/confusion_matrix.pdf} \caption{Confusion matrix for the E5 experiment using the 9 classes from \textit{Planning Poker}.} \label{fig_confusion_matrix} \end{figure} One can also observe that, similarly, the larger classes (13, 20, 40 and 100) became more confused with each other and, in very low percentages there was confusion among the smaller classes. This aspect leads us to suggest that human intervention at the end of the process is needed, with the aim of approving/modifying the estimate generated, according to the user's working reality. Thus, considering its application for the end user, the proposed method would be classified as semi-automated. Another aspect to be observed in the results of Figure \ref{fig_confusion_matrix} is an indication that the larger the data set representing each of the labels, the better the results. This study argues that effective techniques for increasing data in texts can improve this result. Another alternative would be to collect a more significant number of real samples, complementing the pre-training and fine-tuning data set \textit{corpPret\_SE}, as well as sets for training and testing (\textit{corp\_SE}). Thus, the generated embeddings will be more representative, that is, they can better represent each situation found in the requirements. \textbf{RQ4. Are pre-trained embeddings models useful to a text-based software effort estimation, both on new and existing projects?} Another aspect that can be observed is the indication of the S$E^3$M model to estimates new and non-existing requirements. For this, an additional experiment was carried out containing the same configuration as \textbf{E4}, and only changing the type of data partitioning. In this experiment \textit{cross validation} was applied by projects in order to evaluate the results of inferring the estimates for each project, that is, for completely new projects. Thus, during each of the iterations one of the projects was considered a target for the estimates (test set), while the others were considered a source (training set). Table \ref{tab:crossval_proj} shows the results obtained for the MAE in each project. \begin{table}[!ht] \footnotesize \begin{tabularx}{0.48\textwidth}{c|c|X|c|c|c} \hline \textbf{ID project} & \textbf{Description} & \textbf{Num. requirement} & \textbf{Med} & \textbf{Std} & \textbf{MAE}\\ \hline {AS} & {Appcelerator Studio} & {2919} & {5.63} & {3.32} & {2.50}\\ {AP} & {Aptana Studio} & {829} & {8.01} & {5.95} & {4.18}\\ {BB} & {Bamboo} & {521} & {2.41} & {2.14} & {2.76}\\ {CV} & {Clover} & {384} & {4.6} & {6.54} & {3.87}\\ {DM} & {Data Management} & {4667} & {9.56} & {16.6} & {7.78}\\ {DC} & {DuraCloud} & {666} & {2.12} & {2.03} & {3.79}\\ {JI} & {JIRA Software} & {352} & {4.43} & {3.51} & {3.13}\\ {ME} & {Mesos} & {1680} & {3.08} & {2.42} & {3.39}\\ {MD} & {Moodle} & {1166} & {15.54} & {21.63} & {11.99}\\ {MU} & {Mule} & {889} & {5.08} & {3.49} & {3.51}\\ {MS} & {Mule Studio} & {732} & {6.39} & {5.38} & {3.51}\\ {XD} & {Spring XD} & {3526} & {3.69} & {3.22} & {3.16}\\ {TD} & {Talend Data Quality} & {1381} & {5.92} & {5.19} & {4.04}\\ {TE} & {Talend ESB} & {868} & {2.16} & {1.49} & {3.42}\\ {TI} & {Titanium SDK/CLI} & {2251} & {6.31} & {5.09} & {3.49}\\ {UG} & {Usergrid} & {482} & {2.85} & {1.40} & {3.24}\\ \hline \end{tabularx} \caption{MAE values when estimating the effort for each project in relation to the others. The number of requirements by project (Num. requirement), the average (med) and standard deviation (std) of the effort by requirement in each project are presented.} \label{tab:crossval_proj} \end{table} When considering the cross-project estimation approach, if target projects are considered (UG, ME, AP, TI, AS, TI, MS, MU), as listed in Table 9 of the article by \cite{choetkiertikul2018deep}, the authors were able to an average MAE value of 3.82 for the Deep-SE model, while the S$E^3$M model presented a MAE of 3.4 (Table \ref{tab:MAE_reqNovos}). It is observed that this comparison was made only with the results obtained in the mode between repositories of \cite{choetkiertikul2018deep}, and for the results obtained with S$E^3$M, all 15 projects were considered as source projects remaining, while the target projects are the same chosen by the authors. It is still observed that the authors of Deep-SE used a source project for training and another target project for tests, that is, the diversity of characteristics that the learning method needs to deal with, is limited only by the domain of a single project. In other words, the model needs to deal with less variability of data, which supposedly can facilitate learning, since some important relationships between these data can be discovered more easily by the learning method. However, the proposal presented here uses all projects (except one) for training, that is, the variety of relationships that the model must deal with is much greater, when compared to the Deep-SE approach. From a certain point of view this is good, as the learning method should learn a better generalization, for any type of problem presented. On the other hand, however, learning is hampered due to curse of dimensionality, in which many important relationships can be more difficult to be inferred automatically, mainly due to the very small corpus. The explanation for this is that in a smaller data set, basic relationships are easily learned, whereas more specific relationships are often not sufficiently representative. In the case of software projects, each project used as training and testing data is in fact an another domain (when compared to another project), which can be composed of several sub-domains, such as: application areas of the project, programming languages (e.g. Java, Python, C), databases (e.g. SQL Server, Oracle, MySQL, MongoDB), application modalities (e.g. web, mobile, desktop), development teams with different characteristics (e.g. beginner, full), among others. Therefore, each sub-domain can be composed of different relationships, since different aspects can change the context of one project in relation to the other, which leads, for example, to the use of different terms for the same purpose. Thus, there is a need for a balanced volume of representative samples from each sub-domain, so that the model can learn properly. \begin{table}[!ht] \footnotesize \begin{tabularx}{0.48\textwidth}{c|c|c|c} \hline \textbf{Source projects} & \textbf{Target projects} & \textbf{MAE (Deep-SE)} & \textbf{MAE (S$E^3$M)}\\ \hline {} & {UG} & {1.57} & {3.24} \\ {} & {ME} & {2.08} & {3.39} \\ {} & {AP} & {5.37} & {4.18} \\ {15 remaining projects} & {TI} & {6.36} & {3.49} \\ {} & {AS} & {5.55} & {2.50} \\ {} & {TI} & {2.67} & {3.49} \\ {} & {MS} & {4.24} & {3.51} \\ {} & {MU} & {2.70} & {3.51} \\ \hline \textbf{Avg} & {} & {3.82} & \textbf{3.40} \\ \hline \end{tabularx} \caption{Mean Absolute Error (MAE) in estimating effort for new projects.} \label{tab:MAE_reqNovos} \end{table} Although the results of this study are not very different from that obtained in the article by \cite{choetkiertikul2018deep}, the proposed approach presents a much simpler and potentially more robust network architecture. This is possible because part of the textit{feature learning} process previously performed, which extracts the contextualized textual representation for new project requirements, is performed only once, during the process of generating the pre-trained model (\textit{BERT\_SE}). This model is then employed as a parameter in the embedding layer of the sequential architecture used. This aspect is important, considering that there is the need to feed the training database with new cases of requirements, as well as with the cases’ respective efforts, which makes it possible to increase precision in effort estimates for new projects. \textbf{RQ5. Are the results found generalizable, aiming to generate estimates of effort between companies?} In our approach, the results show that even a new project can have its effort predicted without any pre-existing data (as shown in RQ4). Although the MAE still does not deliver a perfect result, a good estimate of the effort can be achieved and used, in a semi-automated way, by companies, as explained in the RQ3 response. Additionally, when considering the application of the model for multiple companies, it is necessary to consider the possibility that existing requirements contain different metrics (e.g. function points, story points), since the data-set would be fed by requirements from different companies. To address this question, the means of converting these metrics into a standard form, which, if obtained from the estimator, could be converted into the format to be used by the user, is suggested. This conversion of software effort metrics is proposed by \cite{pressman2016engenharia}. Thus, generalizing the proposed method so that is can be used by several companies in a web application, for example, would be perfectly possible. This claim is supported by the fact that the method is based on a single repository (i. e. grouping multiple repositories), in which different projects’ requirements are met, regardless of the format for registering the requirements texts. Furthermore, considering its practical application, the proposed model can be adjusted by the user. Therefore, real estimates generated and approved by specialists can be fed back, making the system more and more adjusted to a specific company, for example. \section{Threats to validity} Thus as several research in the area of software engineering that apply machine learning techniques for the use with the texts, this paper propose a kind of software estimate or effort by analogy from requirements texts, difficult approaches regarding the availability of real data. These data should reflect the reality of software projects in different areas, levels of complexity, uses of technologies, among other attributes. Typically, these difficulties are related to the volume of data, the language in which the data is given, the quality of the data (for example, text formats, completed, nonexistent labels, among others). This way, after accomplished a search for textual requirements databases, we decided to use database used by \cite{choetkiertikul2018deep}, which provided the first database at the level of requirements for the realization of area research. Since the model proposed in this article (S$E^3$M) aims to compare the results obtained for estimating software effort with the Deep-SE model, proposed by \cite{choetkiertikul2018deep}, it was defined by using same database. Therefore, actions to containing or reducing threats to validity carried out by \cite{choetkiertikul2018deep}, were adopted and maintained for this work. Are they: \begin{itemize} \item It is used the Actual project requirements data, which were obtained from large and different open source projects. \item The story of points per user, that accompany each textual requirement, were first estimated by human teams, and therefore, may not be accurate in some situations. \cite{choetkiertikul2018deep} performed two tests to mitigate this threat: one with the original story points, the other with normalized and adjusted story points. With that it was verified that the proportions of points for history attributed to each requirement were adequate. \item It was observed that project managers and analysts determine the estimate for a new requirement, based on their comparison with requirements already implemented in the past, and thus carry out the estimate consistently. In this way, the problem is indicated for a machine apprentice, since the training and testing database presents the description of the requirements, accompanied by their respective efforts in points by history. Thus, new requirements can be estimated, as long as they have these two attributes. \end{itemize} In order to perform the experiments, appropriate metrics were applied to evaluate regression models, which are commonly used to evaluate models of software effort estimates \cite{choetkiertikul2018deep} which attest to the validity of the model. In addition, different forms of data partitioning (\textit{cross-validation}) were used, in order to validate the results obtained. In order to compare the results obtained in this work with those obtained by \cite{choetkiertikul2018deep}, considering that our implementation may not present all the details that Deep-SE presents, our model was tested using the same data set as the authors. Thus, it was possible to state that our results are consistent. In order to validate the possibility of generalization, it should be noted that the training and testing data set is composed of 23.313 requirements from sixteen open source projects, which differ significantly in size, complexity, developer team and community \cite{choetkiertikul2018deep}. It is observed that open source projects do not present the same aspects as commercial projects in general, especially in relation to the human resources involved, which requires more research. It would be prudent to test the S$E^3$ M model with a database of commercial projects only (with data available containing the same attributes used in this research) and then with all types of projects (commercial and open source) in order to check for significant differences. \section{Conclusions and Future Work} The main objective of this research is to evaluate if pre-trained embeddings models are promising for the inference of text-based software effort estimation, evaluating two approaches to embeddings: context-less and contextualized. The study obtained positive results for the pre-trained models for the ABSEE task, particularly the contextualized models, such as BERT. As predicted in the literature, the contextualized methods demonstrate the best performance numbers. In addition, we show that fine-tuning the embedding layers can help improve the results. All of these results can be improved, especially if trained with more data and/or using some effective data augmentation. The researchers observed that the database was a limitation of this research, particularly because it is not very bulky, which prevents the results from being even better, especially when using cutting-edge PLN techniques (e.g. pre-trained models, fine-tuning and deep learning). When observing the volume of data used in fine-tuning tasks for specific domains, such as \cite{beltagy2019scibert} and \cite{lee2020biobert}, it is clear that even though the domain’s base is considered to be light, they contain billions of words. On the other hand, the domain-specific database applied in the fine-tuning of the \textit{BERT\_SE} model, has around 800 thousand words. Thus, it was observed that the results obtained with the use of BERT could be improved if there was a more voluminous and diverse set of data, in which it was possible to better adjust the model for different problems, or even train a model of its own (from scratch), which would present an even greater level of adjustment according to the domain area. Thus, this study argues that the S$E^3E$M model analyzed in this article can best adapt to different project contexts (for example, agile development). Estimation of story points or another similar estimation metric (e.g. use case points or function points) have a fine granularity (i.e. they are assigned to each user requirement). But this same inference method can be applied to estimate a coarser granularity element. An example would be a sprint in agile models \cite{paasivaara2009using}, which is estimated by the sum of the smaller tasks that compose it. Compared with the results obtained by Choetkiertikul et al. \cite{choetkiertikul2018deep}, the most similar work considering the objectives, note that S$E^3$M used a pre-trained contextualized incorporation layer, which went through a fine tuning process, without the need to add any noise to the texts. In addition, the proposed architecture is more simplified, with just one recurring layer. As a result of the feature learning process, which applies a contextualized incorporation approach, we have a more generalized and multi-project method, which can be applied even in new projects. Thus, the method has more flexibility regarding the format of the input and multi-project texts, allowing for interference to be used in any new requirement, even during the initial stage of development. Using the pre-trained BERT model (even the generic one), there is no need for prior training of a specific corpus, or one that requires a large volume of data. This has the advantage of involving no pre-training cost (which takes days \cite{howard2018universal}). Rather, there is only the need for fine-tuning, which takes a few hours (\cite{devlin2019bert}). That is, there is no need for training from scratch, as performed by \cite{choetkiertikul2018deep}. Thus, we provide the pre-trained BERT\_SE model that can be used in various software engineering tasks, in addition to allowing for further adjustments, if necessary. In addition, the S$E^3$M model can be applied in a generic way and, in addition to being reliable, it is a cheap and provides for a computationally fast solution, due to the fine tuning process. The results demonstrated that this is a promising research field with many available resources and room for innovation. Therefore, several research possibilities are presented as future work: \begin{itemize} \item Collect more textual requirement data to balance the dataset against existing labels, and thereby increase the number of contexts; or apply data augmentation techniques to improve results. \item update BERT\_base vocabulary, including specific vocabulary, and then fine-tune. \item perform fine tuning, such as with model BERT\_large, and compare the results. \item study and apply effective data augmentation techniques in order to balance the number of samples in each existing effort class, and thus obtain possible improvements in the results. \item study and apply different combinations of the layers in the BERT model, in order to evaluate the performance of the model regarding fine-tuning and its effects on EESA. \item study and apply pre-trained "light" (e.g. ALBERT \cite{lan2019albert}) to the S$E^3$M model, and evaluate its performance aiming to achieve EESA. \end{itemize} \bibliographystyle{acm}
\section{Introduction} Dark matter (DM) is a key ingredient for models that try to explain cosmological structure formation without modifying gravity. Although the gravitational effects of DM are well documented \cite{Betoule:2014frx,Ade:2013zuv}, direct detection of particles for this dominant matter component continues to elude proofs: in accelerators or in nuclear recoil experiments \cite{ Felcini:2018osp, Klasen:2015uma}, indirect WIMP annihilation searches \cite{Conrad:2014tla}, in DM stars \cite{Dai:2009ik,Kouvaris:2015rea} or in some other indirect quests as illustrated in Refs.~\cite{ Bertolami:2012yp, Abdalla:2007rd, Delliou:2014awa}. In this context, different testing avenues of possible DM effects are welcome, such as in pulsars, i.e. rotating neutron stars (NSs), which provide the advantage of extreme densities and can accrete DM, thus straining the saturated neutron gas. The amount of DM acquired by a NS follows the Tolman-Oppenheimer-Volkoff (TOV) equation , as in e.g. \cite{Tolos2015}. Moreover, the effect of DM on NSs can directly lead to bounds for the masses of the different DM candidates \cite{Goldman:1989nd,Kouvaris:2011fi}. Self-annihilating DM can also produce characteristic effects on NS \cite{Kouvaris2008, Bertone2008, Kouvaris2010, McCullough:2010ai, deLavallaz2010, PerezGarcia:2011hh, PerezGarcia:2010ap}. In particular, WIMPs annihilation in DM cores should produce temperature and luminosity changes, through heat, of old stars \cite{Kouvaris2008,Bertone2008,Kouvaris2010,deLavallaz2010}. However, those changes are difficult to detect \cite{Kouvaris2008,Sandin:2008db}. In this short report, based on the results obtained in our previous work \cite{Deliyergiyev:2019vti} and on our recent paper \cite{DelPopolo:2019nng}, we propose a testable galactic probe for DM existence in the form of evolution of the pulsar mass towards the galactic centre (GC). According to the discussion above, NSs in increasingly DM rich environments should accrete more DM and thus display a characteristic mass decrease, the closer they are to the galactic centre. We use NSs because first of all the very large baryon density inside NSs makes the interaction between baryons and DM following DM capture most likely; second, the NSs strong gravitational force makes DM particles escape very unlikely, after they interact and loose energy. This mass evolution is easier to test than other probes such as NS temperature time evolution with DM accretion, as discussed previously. \section{Mass Change of Neutron Stars} \label{sec:Implementation} \begin{figure}[t] \begin{center} \includegraphics[width=0.395\textwidth]{densProfiles_Fig1a} \includegraphics[width=0.395\textwidth]{accreteMasses_Fig1b_3rdParam} \caption{ Figures taken from Ref.~\cite{DelPopolo:2019nng}. (Left panel) Einasto profile for $\alpha=0.06,0.09,0.11,0.15,0.17$ (black dot dot dashed, blue dotted, red solid, yellow long dashed, and green dot dashed lines, respectively). The cyan dashed line is the Di Cintio profile \cite{DiCintio:2014xia} (labelled DC14 in the text). (Right panel) The accreted mass according to Kouvaris formula (Eq.~(\ref{eq:Kouv2013})). In this plot we do not consider the accreted mass corresponding to the Di Cinto profile, nor to the Einasto profile with $\alpha=0.06$, in order to be conservative in our calculations. } \label{fig:einasto} \end{center} \end{figure} As shown by Ref.~\cite{Kouvaris2013}, in the framework of a spherically symmetric accretion scenario for a typical NS of mass $1.4 M_\odot$ and $R=10$ km, the total accreted mass is given by Ref.~\cite{DelPopolo:2019nng} \begin{equation} M_{\rm acc}= 1.3 \times 10^{43} \left( \frac{\rho_{\rm dm}}{\rm 0.3 \, GeV/cm^3} \right) \left(\frac{\rm t} {\rm Gyr} \right) f \,\,\, \rm GeV, \label{eq:Kouv2013} \end{equation} which is an underestimation of a factor $\simeq 10$, since the accretion during the NS progenitor phase, of the same order as in the NS phase \cite{Kouvaris2010} (factor of 2), and the accretion coming from DM self-interaction \cite{Guver2014} are not taken into account. Moreover, $M_{acc}$ of Eq.~(\ref{eq:Kouv2013}) should be corrected by factor 2.05 for 2 $M_{\odot}$ We obtain DM accretion $\simeq 10^{-11} {\rm M}_{\odot}$ for a typical NS in the solar neighborhood, which is in agreement with the capture rates of Refs~\cite{Kouvaris2013, Guver2014, Zheng2016, Zhong2012} and the results from \cite{Kouvaris2011}, but below the estimates from the DM accumulated using TOV. A better agreement between the accreted DM mass and the accumulated DM mass coming from TOV is obtained for NSs located in Superdense DM clumps, Ultra Compact mini-haloes \cite{Berezinsky2013}, and close to the GC. The another approach starts, as in usual structure formation, from linear perturbation, followed by non-linear collapse of DM, and then continued by baryons collapse in the DM potential wells previously formed \cite{Chang2018}. Once the accreted DM mass, $M_{acc}$, as a function of the distance to the GC is determined from the right panel of Fig.~\ref{fig:einasto}, we can determine the corresponding mass change of the NS towards the galactic center. In order to do so, we use Fig.10 of our previous work \cite{Deliyergiyev:2019vti}, where the maximum mass of NSs was obtained as a function of the DM mass inside the NS, $M_{DM}$, for the DM weakly interacting case, $y=0.1$\footnote{ The interaction strength is expressed in terms of the ratio of the DM fermion mass $m_f$, and scale of interaction $m_I$, $y=m_f/m_I$. This can be converted to usual units: one can estimate the cross section of DM self-interaction, taking the mass of the DM particle $m_f$ in units of GeV, as \begin{align} \sigma =& \frac{1}{4\pi}\frac{m_f^2}{m_I^4} = \frac{y^4}{m_f^2} 3.2\times 10^{-27} \textrm{cm}^2 & \rightarrow \sigma/m_f =& \frac{y^4}{m_f^3} 1.8\times 10^{-3} \frac{\textrm{cm}^2}{g} \label{eq:yCrossSection} \end{align} }. Moreover, we obtained similar plots for larger values of the interaction parameter $y$, $y=1,10,100$. Since $M_{DM}$ must be equal to the accreted mass, $M_{acc}$, we find a relation between the total mass of the NS, $M_{NS}$ ($M_T$ in the notation of \cite{Deliyergiyev:2019vti}) and the distance from the GC. The result is plotted in Fig.~\ref{fig:accreteMass}. Its leftmost panel displays the change in mass of a NS moving towards the Milky Way (MW) halo center (colour and line coding as in Fig.~\ref{fig:einasto}), for a particle mass, $m_{DM}=500$ GeV, and $y=0.1$. Our reference model ($\alpha=0.11$, red solid line) shows a NS mass change from 2 to 1 $M_{\odot}$ at 0.4 pc, while in the case $\alpha = 0.9$ (blue dotted line) the same change is observed at 1.35 pc. The other two cases show a slower mass change. The yellow long dashed line ($\alpha = 0.15$), and the green dot dashed line ($\alpha = 0.17$) show that the mass reduces from 2 to 1.2 $M_{\odot}$, and from 2 to 1.7 $M_{\odot}$, at $10^{3}$ pc, respectively. The next two panels show how the mass changes with decreasing the DM particle mass ($m_{DM}=200$ GeV, centre left, 100 GeV, centre right). Finally the rightmost plot shows the effect of the interaction strength for our reference profile ($\alpha=0.11$), and from right to left, in the cases $y=0.1;1;10;10;100$. Strong interaction ($y=100$) produces very small mass changes, while the weaker the interaction, the larger the change is. \begin{figure}[t] \begin{center} \includegraphics[width=0.95\textwidth]{accreteMass_Fig2c_newlines} \caption{ Figures taken from Ref.~\cite{DelPopolo:2019nng}. The changes of the NS mass from DM accumulation as a function of the NS distance to GC, for a particle mass $m_{DM}=500$ (leftmost), 200 (center left) and 100 (center right) GeV, with $y=0.1$ and $\alpha=0.09; 0.11; 0.15; 0.17$ (blue dotted, red solid, yellow long dashed, and green dot dashed). The rightmost panel shows the role of the interaction strength for particle mass $m_{DM}=500$ GeV, $\alpha=0.11$, and $y=0.1, 1, 10, 100$ (solid, long dashed, dash dotted, and long dashed dotted lines). } \label{fig:accreteMass} \end{center} \end{figure} All the above results are obtained with conservative assumptions, i.e. (a) not taking into account (i) NS progenitor accretion, expected of order of the NS phase \cite{Kouvaris2010}, (ii) DM self-interaction accretion \cite{Guver2014}, (b) using a density profile from DM-only simulations, shallower than in recent hydrodynamic simulations \cite{DiCintio:2014xia}. As the right panel of Fig.~\ref{fig:einasto} shows, we excluded from the analysis the $\alpha = 0.06$ Einasto profile, and even the DC14 profile \cite{DiCintio:2014xia}, a realistic profile calculated with hydro-dynamical simulations, to remain conservative. Although we made this choice, the orbital dynamics of PSR B1257+12 \cite{Iorio:2010hb}, together with the accretion predictions \cite{Bertone:2004pz} allows much larger DM accumulation in NS than in our present work: up to 10\% of a NS mass, in agreement with DC14 \cite{DiCintio:2014xia}. Moreover, complex astrophysical phenomena are occurring on sub-parsec scale near the GC, such as DM particles gravitational scattering by stars and capture in the supermassive BH, together with highly enhanced central density from the supermassive BH formation \cite{Gondolo1999}. Thus, more accurate density profiles can be introduced \cite{Bertone:2004pz}. \section{Conclusion} We have shown that the NS mass should reflect the changes of the DM environment in the MW(Fig.~\ref{fig:accreteMass}). This is done taking into account the DM accretion of NSs [see \cite{Deliyergiyev:2019vti}, for details], as it changes because of the increase of DM content \cite{Kouvaris2013} when we move towards the GC \cite{Bernal:2011pz}. This allows us to propose that the evolution of the pulsar masses towards the GC of the MW can be a probe of the existence of DM. In fact, the decrease of the NS mass for NSs located closer and closer to the GC would put constraints on the characteristics of the Galaxy halo dark matter profile, on the dark matter particle mass, and on the self-interaction strength. Such changes are expected to be observed in the near future in telescopes such as ngVLA \cite{murphy2018science}, SKA \cite{Konar:2016lgc}, Athena \cite{barcons2012athena, EESA2014athena}, NICER \cite{10.1117/12.926396} or eXTP \cite{Watts2018}. \section{Acknowledgements} M.D. work was supported by the Polish National Science Centre (NCN) grant 2016/23/B/ ST2 / 00692. MLeD acknowledges the financial support by Lanzhou University starting fund and the Fundamental Research Funds for the Central Universities (Grant No.lzujbky-2019-25). L.T. acknowledges support from the FPA2016-81114-P Grant from Ministerio de Ciencia, Innovacion y Universidades, Heisenberg Programme of the Deutsche Forschungsgemeinschaft under the Project Nr. 383452331 and PHAROS COST Action CA16214.
\section{Introduction} Let $A \in \mathbb{R}^{m \times n}$ with $m \geq n$ and full rank. Suppose $x \in \mathbb{R}^n$ and $$ Ax =b,$$ how would one go about finding $x$? A popular method for solving these types of problems is the Kaczmarz method \cite{kac} (also known as the Algebraic Reconstruction Technique (ART) in computer tomography \cite{gordon, her, natterer} or as the Projection onto Convex Sets method \cite{cenker, sezan}). Denoting the rows of $A$ by $a_1, \dots, a_m$, the linear system can be written as a collection of inner products $$ \forall~1 \leq i \leq m: \left\langle a_i, x\right\rangle = b_i.$$ The Kaczmarz method is an iterative scheme: given $x_k$, let us pick an equation, say the $i-$th equation, and modify $x_k$ the smallest possible amount necessary to make it correct: set $x_{k+1} = x_k + \delta a_i,$ where $\delta$ is such that $\left\langle a_i,x_{k+1} \right\rangle = b_i$. Formally, $$ x_{k+1} = x_k - \frac{b_i - \left\langle a_i, x_k\right\rangle}{\|a_i\|^2}a_i.$$ The Kaczmarz method is then given by cycling through the indices. The method has a geometric interpretation (see Fig. 1): $x_{k+1}$ is obtained by projecting $x_k$ onto the hyperplane given by $\left\langle a_i, x \right\rangle = b_i$. This interpretation is already given in the original 1937 paper of Kaczmarz who ends his paper by saying that `The convergence of this method is completely obvious from a geometric perspective' \cite{kac}. However, given the intricate underlying geometry, convergence rates are difficult to obtain. In a seminal paper, Strohmer \& Vershynin \cite{strohmer} showed that by choosing the equations in a random order (where the $i-$th equation is chosen with a likelihood proportional to $\|a_i\|^2$), the method converges exponentially: more precisely, they show that $$ \mathbb{E} \left\| x_k - x \right\|_2^2 \leq \left(1 - \frac{1}{\|A\|_F^2 \| A^{-1}\|_2^2}\right)^k \|x_0 - x\|_2^2,$$ where $\|A^{-1}\|_2$ is the operator norm of the inverse and $\|A\|_F$ is the Frobenius norm. This is a remarkable result in many ways. The analysis of Kacmarz and Kacmarz-type algorithms has become quite popular: we refer to \cite{bai, eldar, gower, lee, leventhal, liu, ma, need, need2, need3, need4, tan, zouz} and references therein. \begin{center} \begin{figure}[h!] \begin{tikzpicture}[scale=2] \draw[thick] (-1, -1) -- (1, 1); \draw[thick] (0, -1) -- (0, 1); \draw[thick] (1, -1) -- (-1, 1); \filldraw (0,0) circle (0.03cm); \node at (0.2, 0) {$x$}; \filldraw (0.7, 0.7) circle (0.03cm); \node at (0.9, 0.7) {$x_k$}; \filldraw (0, 0.7) circle (0.03cm); \node at (0.25, 0.78) {$x_{k+1}$}; \draw [ <-] (0.1, 0.7) -- (0.7, 0.7); \filldraw (-0.7/2, 0.7/2) circle (0.03cm); \filldraw (-0.35, 0.35) circle (0.03cm); \node at (-0.6, 0.35) {$x_{k+2}$}; \draw [->] (0, 0.7) -- (-0.3, 0.4); \end{tikzpicture} \caption{A geometric interpretation: iterative projections onto the hyperplanes given by $\left\langle a_i, x\right\rangle = b_i$.} \end{figure} \end{center} \section{ Results} \subsection{Summary} A priori, one might be inclined to believe that the very nature of the algorithm produces an essentially random sequence in the sense that the normalized vectors $(x_k-x)/\|x_k - x\|$ behave mostly randomly or, alternatively put, that the approximations converge to $x_k \rightarrow x$ `from all directions'. It is the goal of this short note to show that this is decidedly \textit{not} the case: the singular vectors $v_1, \dots, v_n$ of the matrix $A$ describe directions of distinguished dynamics. We describing three main observations: \begin{enumerate} \item \S 2.1: while $\|x_k-x\|$ decreases exponentially, this is happening at different rates in different subspaces. We show (Theorem 1) that for any (right) singular vector $v_{\ell}$ of $A$ associated to the singular value $\sigma_{\ell}$ $$\mathbb{E} \left\langle x_{k}-x, v_{\ell}\right\rangle = \left(1 - \frac{\sigma_{\ell}^2 }{\|A\|_F^2}\right)^k\left\langle x_0-x, v_{\ell}\right\rangle.$$ Contributions from the smallest singular vectors ($\sigma_{\ell}$ small) decays the slowest: hence we expect them to be dominant for $k$ large. We recall that for the smallest singular vector $\sigma_n$, we have the identity $$ \sigma_n = \|A^{-1}\|_2 \qquad \mbox{leading to the rate} \qquad 1 - \frac{1}{\|A\|_F^2 \|A^{-1}\|_2^2}$$ which recovers the convergence rate of Strohmer \& Vershynin \cite{strohmer}. Thus in the generic setting one cannot hope to improve the rate. \item \S 2.2: this phenomenon also impacts convergence rates: if $x_k$ is not mainly the linear combination of singular vectors corresponding to small singular values, Randomized Kaczmarz converges \textit{faster}: we have $$\mathbb{E} ~ \|x_{k+1} - x\|_2^2 \leq \left(1 - \frac{1}{\|A\|_F^2} \left\| A \frac{x_k-x}{\|x_k - x\|} \right\|^2 \right) \|x_{k} - x\|_2^2.$$ We observe that this factor may actually be quite large since $$ \|A^{-1}\|^2\leq \left\| A \frac{x_k-x}{\|x_k - x\|} \right\|^2 \leq \|A\|^2.$$ The lower bound is only close to being attained when $x_k-x$ is close to the space spanned by singular vectors given by small singular values of $A$. \item \S 2.3: once $x_k$ is mainly the combination of singular vectors corresponding to small singular values, the Randomized Kaczmarz Method is also less likely to explore adjacent subspaces. We show that the normalized vector $(x_k-x)/\|x_k-x\|$ then moves only very slowly on $\mathbb{S}^{n-1}$ since $$ \mathbb{E} ~\left\langle \frac{x_k-x}{\|x_k-x\|}, \frac{x_{k+1}-x}{\|x_{k+1}-x\|} \right\rangle^2 = 1 - \frac{1}{\|A\|_F^2}\left\| A \frac{x_k-x}{\|x_k - x\|} \right\|^2.$$ \end{enumerate} \subsection{Transfer to Small Singular Vectors} We start by establishing the main phenomenon which can be phrased as a simple algebraic identity. \begin{theorem} Let $v_{\ell}$ be a (right) singular vector of $A$ associated to the singular value $\sigma_{\ell}$. Then $$\mathbb{E} \left\langle x_{k} - x, v_{\ell} \right\rangle = \left(1 - \frac{\sigma_{\ell}^2 }{\|A\|_F^2}\right)^k\left\langle x_0 - x, v_{\ell}\right\rangle.$$ \end{theorem} We recall that $$ \sum_{i=1}^{n}{\sigma_{i}^2} = \|A\|_{F}^2,$$ so the arising factor multiplicative factor is always in between 0 and 1. This shows that the Randomized Kaczmarz method has exponential decay at different exponential rates that depend on the singular values. In particular, the slowest rate of decay is given by the smallest singular value $\sigma_n$. Since $$ \sigma_n = \|A^{-1}\|_2 \qquad \mbox{the rate is} \qquad 1 - \frac{1}{\|A\|_F^2 \|A^{-1}\|_2^2}$$ which recovers the convergence rate of Strohmer \& Vershynin \cite{strohmer}. In particular, if $x_0$ has contributions from singular vectors corresponding to large singular values, the sequence initially decays faster than expected since components corresponding to larger singular values decay quicker. A previous result in that spirit was obtained by Jiao, Jin \& Lu \cite{jiao} who obtained an `averaged' version of Theorem 1: by decomposing $\mathbb{R}^n = L + H$ into subspaces spanned by low singular vectors $L$ (corresponding to small singular values) and high singular vectors $H$ (corresponding to large singular values), they obtain the estimate $$ \mathbb{E} \| \pi_{H} x_{k+1} \|^2 \leq (1-c_1) \| \pi_H x_{k}\|^2 + c_2 \| \pi_{L} x_k\|^2$$ where $\pi$ is the projection and $c_1, c_2 > 0$ are given in terms of singular values. \subsection{Speed of Convergence} The phenomenon described in Theorem 1 obviously has an effect on the speed of the algorithm: whenever $x_k - x$ is not close to singular vectors of $A$ that correspond to small singular vector, the Randomized Kaczmarz method actually converges faster. Theorem 2 is already implicit in Strohmer \& Vershynin \cite{strohmer} where a formulation of it appears as an intermediate step. \begin{theorem} We have $$\mathbb{E} ~ \|x_{k+1} - x\|_2^2 \leq \left(1 - \frac{1}{\|A\|_F^2} \left\| A \frac{x_k-x}{\|x_k - x\|} \right\|^2 \right) \|x_{k} - x\|_2^2.$$ \end{theorem} Observe that for any vector $\|v\|=1$, we have $$ \|Av\|^2 \geq \sigma_n^2 \|v\|^2 = \|A^{-1}\|_2^2 \cdot \|v\|_2,$$ where $\sigma_n$ is the smallest singular value. But clearly this last inequality is only sharp or close to sharp if $v$ is close to linear combination of singular vectors corresponding to small singular values: otherwise, the quantity is indeed larger. \subsection{Stability of Small Singular Vectors.} We conclude with a result of a geometric flavor. A natural object is the sequence of vectors $$ \frac{x_k - x}{\|x_k - x\|} \in \mathbb{S}^{n-1}.$$ It essentially describes from which direction the sequence $(x_k)_{k=0}^{\infty}$ approaches the solution $x$. The result in the prior sections have shown that we expect this vector will eventually be concentrated on subspaces corresponding to singular vectors associated to small singular values. A different questions would be how much we expect the normalized vector to `move around'. \begin{theorem} If $x_k \neq x$ and $\mathbb{P}(x_{k+1} = x)=0$, then $$ \mathbb{E} ~\left\langle \frac{x_k-x}{\|x_k-x\|}, \frac{x_{k+1}-x}{\|x_{k+1}-x\|} \right\rangle^2 = 1 - \frac{1}{\|A\|_F^2}\left\| A \frac{x_k-x}{\|x_k - x\|} \right\|^2.$$ \end{theorem} We recall that for two unit vectors $\|u\| = 1 = \|v\|$, the inner quantity $\left\langle u, v\right\rangle^2$ can be interpreted as a notion of distance between the vectors: it is only close to 1 if $u \sim \pm v$. Since we only care about subspaces, the ambiguity in the sign does not play a role. We observe that the direction $(x_k-x)/\|x_k-x\|$ undergoes large fluctuations when $\|A (x_k-x)\|$ is large and is quite stable when $\|A(x_k-x)\|$ is small. Once $x_k$ is mainly comprised of small singular vectors, its direction does not change very much anymore: randomized Kaczmarz spends more time close to these subspaces than it does in other regions of space: the smaller the smallest singular value, the more pronounced phenomenon. Could this property be used for convergence acceleration? \subsection{An Application: Finding Small Rayleigh Quotients} We discuss an amusing application: finding vectors $\|x\|=1$ such that $\|Ax\|$ is small. In light of our results, such a sequence of vectors can be obtained from the Randomized Kaczmarz method applied to the equation $$ Ax = 0.$$ We illustrate this with a simple example: we take $A \in \mathbb{R}^{1000 \times 1000}$ by picking each entry to be iid $\sim \mathcal{N}(0,1)$, we add $100\cdot \mbox{Id}_{1000}$ and then set the last row $a_{1000}$ to be a tiny perturbation of $a_{999}$ by adding 0.01 to each entry. This generates a matrix having singular values between $\sim 0.5$ and $\sim 1.5$ and one tiny singular value at scale $\sim 10^{-4}$. We start with $x_0 = (1,\dots, 1)$ and plot $\|A x_k\|/\|x_k\|$ (see Fig. 2). We observe that within $5000 \sim 5n$ iterations, the ratio is actually smaller than any singular value but the last one -- this implies that $x_k$ is actually already mostly given by $v_{1000}$. After 10.000 iterations, we observe $|\left\langle x_{10^4}/\|x_{10^4}\|, v_{1000}\right\rangle| \sim 0.9$. \begin{center} \begin{figure}[h!] \begin{tikzpicture}[scale=2] \node at (0,0.3) {\includegraphics[width=0.6\textwidth]{pic4.pdf}}; \end{tikzpicture} \caption{A sample evolution of $\|Ax_k\|/\|x_k\|$.} \end{figure} \end{center} \section{Proofs} \subsection{Reduction to $Ax = 0$} We start with the ansatz $$ x_k = x + y_k.$$ Plugging in, we obtain \begin{align*} x + y_{k+1} &= x_{k+1} = x_k + \frac{ b_i - \left\langle a_i, x_k\right\rangle}{\|a_i\|^2} a_i \\ &=x + y_k + \frac{ b_i - \left\langle a_i, x + y_k\right\rangle}{\|a_i\|^2} a_i \\ &= x + y_k - \frac{ \left\langle a_i, y_k\right\rangle}{\|a_i\|^2} a_i + \left( \frac{ b_i - \left\langle a_i, x\right\rangle}{\|a_i\|^2} a_i\right). \end{align*} We note that the final term in parenthesis vanishes because $x$ is the exact solution and thus $b_i - \left\langle a_i, x\right\rangle=0$. This results in $$ y_{k+1} = y_k - \frac{ \left\langle a_i, y_k\right\rangle}{\|a_i\|^2} a_i$$ which is exactly the Randomized Kaczmarz method for $Ay = 0$. Linearity of all the underlying objects (or, alternatively, the geometric interpretation in terms of hyperplane intersections) explains why this is perhaps not too surprising. In any case, this allows us to restrict ourselves to the case $Ax = 0$. \subsection{Proof of Theorem 1} \begin{proof} As discussed above, we can assume without loss of generality that $b=0$. It remains to understand the behavior of the Randomized Kaczmarz method when applied to $Ax=0$. We have \begin{align*} \mathbb{E} \left\langle x_{k+1} , v_{\ell} \right\rangle &= \sum_{i=1}^{m} \frac{\|a_i\|^2}{\|A\|_F^2} \left\langle x_k - \frac{\left\langle a_i, x_k \right\rangle }{\|a_i\|^2} a_i , v_{\ell} \right\rangle \\ &= \frac{1}{\|A\|_F^2}\sum_{i=1}^{m} \left( \|a_i\|^2 \left\langle x_k, v_{\ell}\right\rangle - \left\langle a_i, x_k\right\rangle \left\langle a_i, v_{\ell} \right\rangle \right)\\ &= \left\langle x_k, v_{\ell}\right\rangle - \frac{1}{\|A\|_F^2}\sum_{i=1}^{m} \ \left\langle a_i, x_k\right\rangle \left\langle a_i, v_{\ell} \right\rangle. \end{align*} This sum has a special structure: $\left\langle a_i, x_k\right\rangle$ is simply the $i-$th entry of $A x_k$ and, likewise, $\left\langle a_i, v_{\ell}\right\rangle$ is simply the $i-$th entry of $A v_{\ell}$. This simplifies the sum. We then expand $x_k$ into right-singular vectors $v_i$, make use of $A v_i = \sigma_i u_i$ and the orthogonality of the left singular vectors $u_i$ to obtain \begin{align*} \left\langle x_k, v_{\ell}\right\rangle - \frac{1}{\|A\|_F^2}\sum_{i=1}^{m} \ \left\langle a_i, x_k\right\rangle \left\langle a_i, v_{\ell} \right\rangle &= \left\langle x_k, v_{\ell}\right\rangle - \frac{1}{\|A\|_F^2} \left\langle A x_k, A v_{\ell}\right\rangle \\ &= \left\langle x_k, v_{\ell}\right\rangle- \frac{1}{\|A\|_F^2} \left\langle A \left(\sum_{i=1}^{n}{\left\langle x_k, v_i \right\rangle v_i}\right), A v_{\ell}\right\rangle \\ &= \left\langle x_k, v_{\ell}\right\rangle- \frac{1}{\|A\|_F^2} \left\langle \sum_{i=1}^{n}{\sigma_i \left\langle x_k, v_i \right\rangle u_i}, \sigma_{\ell} u_{\ell}\right\rangle\\&= \left\langle x_k, v_{\ell}\right\rangle\left(1 - \frac{\sigma_{\ell}^2 }{\|A\|_F^2}\right) \end{align*} which is the desired result. \end{proof} \subsection{Proof of Theorem 2} \begin{proof} This proof follows the argument of Strohmer \& Vershynin \cite{strohmer}. If $Z$ is the (vector-valued) random variable assuming the value $Z = a_j/\|a_j\|^2$ with probability $\|a_j\|^2/\|A\|_F^2$, then Strohmer \& Vershynin have established the inequality $$ \|x_{k+1} - x\|_2^2 \leq \left(1 - \left| \left\langle \frac{x_k-x}{\|x_k - x\|}, Z \right\rangle\right|^2 \right) \|x_{k} - x\|_2^2.$$ At this point we simply compute \begin{align*} \mathbb{E} ~\left| \left\langle \frac{x_k-x}{\|x_k - x\|}, Z \right\rangle\right|^2 &= \sum_{i=1}^{m} \frac{\|a_j\|_2^2}{\|A\|_F^2} \left\langle \frac{x_k-x}{\|x_k - x\|}, \frac{a_j}{\|a_j\|_2} \right\rangle^2 \\ &= \frac{1}{\|A\|_F^2} \sum_{i=1}^{m} \left\langle \frac{x_k-x}{\|x_k - x\|}, a_j \right\rangle^2 \\ &= \frac{1}{\|A\|_F^2} \left\| A \frac{x_k-x}{\|x_k - x\|} \right\|^2. \end{align*} \end{proof} \subsection{Proof of Theorem 3} \begin{proof} As above, we can assume without loss of generality that $b=0$. Moreover, since the entire expression is invariant under scaling, we can assume w.l.o.g. that $\|x_k\|=1$. If $\mathbb{P}(x_{k+1}=0)=0$, we have \begin{align*} \mathbb{E} \left\langle x_k, \frac{x_{k+1}}{\|x_{k+1}\|} \right\rangle^2 &= \sum_{i=1}^{m} \frac{\|a_i\|^2}{\|A\|_F^2} \left\langle x_k, \frac{x_k - \frac{\left\langle a_i, x_k \right\rangle }{\|a_i\|^2} a_i}{\| x_k - \frac{ \left\langle a_i, x_k \right\rangle }{\|a_i\|^2} a_i \|} \right\rangle^2 \\ &= \sum_{i=1}^{m} \frac{\|a_i\|^2}{\|A\|_F^2} \frac{ \left\langle x_k, x_k - \frac{\left\langle a_i, x_k \right\rangle }{\|a_i\|^2} a_i \right\rangle^2}{\| x_k - \frac{ \left\langle a_i, x_k \right\rangle}{\|a_i\|^2} a_i \|^2}. \end{align*} We observe that $$x_k - \frac{ \left\langle a_i, x_k \right\rangle}{\|a_i\|^2} a_i $$ is the projection of $x_k$ onto the subspace $\left\langle x, a_i \right\rangle =0$ and thus $$ \left\langle x_k, x_k - \frac{ \left\langle a_i, x_k \right\rangle}{\|a_i\|^2} a_i \right\rangle = \left\|x_k - \frac{ \left\langle a_i, x_k \right\rangle}{\|a_i\|^2} a_i \right\|^2.$$ Thus \begin{align*} \sum_{i=1}^{m} \frac{\|a_i\|^2}{\|A\|_F^2} \frac{ \left\langle x_k, x_k - \frac{\left\langle a_i, x_k \right\rangle }{\|a_i\|^2} a_i \right\rangle^2}{\| x_k - \frac{ \left\langle a_i, x_k \right\rangle}{\|a_i\|^2} a_i \|^2} &= \sum_{i=1}^{m} \frac{\|a_i\|^2}{\|A\|_F^2} \frac{ \| x_k - \frac{\left\langle a_i, x_k \right\rangle}{\|a_i\|^2} a_i \|^4}{\| x_k - \frac{\left\langle a_i, x_k \right\rangle }{\|a_i\|^2} a_i \|^2}\\ &= \sum_{i=1}^{m} \frac{\|a_i\|^2}{\|A\|_F^2} \left\| x_k - \frac{\left\langle a_i, x_k \right\rangle}{\|a_i\|} \frac{a_i}{\|a_i\|} \right\|^2. \end{align*} We recall that $\|x_k\| = 1$ and thus \begin{align*} \left\| x_k - \frac{\left\langle a_i, x_k \right\rangle}{\|a_i\|} \frac{a_i}{\|a_i\|} \right\|^2 &= \|x_k\|^2 - 2\left\langle \frac{\left\langle a_i, x_k \right\rangle}{\|a_i\|} \frac{a_i}{\|a_i\|}, x_k\right\rangle + \left\| \frac{\left\langle a_i, x_k \right\rangle}{\|a_i\|} \frac{a_i}{\|a_i\|} \right\|^2\\ &= 1- 2\frac{\left\langle a_i, x_k \right\rangle^2}{\|a_i\|^2} + \frac{\left\langle a_i, x_k \right\rangle^2}{\|a_i\|^2} = 1- \frac{\left\langle a_i, x_k \right\rangle^2}{\|a_i\|^2}. \end{align*} Altogether, we have \begin{align*} \sum_{i=1}^{m} \frac{\|a_i\|^2}{\|A\|_F^2} \left\| x_k - \frac{\left\langle a_i, x_k \right\rangle}{\|a_i\|} \frac{a_i}{\|a_i\|} \right\|^2 &= \sum_{i=1}^{m} \frac{\|a_i\|^2}{\|A\|_F^2} \left( 1 - \frac{\left\langle a_i, x_k \right\rangle^2}{\|a_i\|^2} \right) \\ &= \frac{1}{\|A\|_F^2} \sum_{i=1}^{m} \left(\|a_i\|^2 - \left\langle a_i, x_k \right\rangle^2\right) \\ &= 1 - \frac{1}{\|A\|_F^2} \sum_{i=1}^{m} \left\langle a_i, x_k \right\rangle^2 = 1 - \frac{\|Ax_k\|^2}{\|A\|_F^2}. \end{align*} \end{proof}
\section{Introduction} We study the function \[ P_\alpha : (0,1) \to (0,1) : x \mapsto \exp(1-x^{-\alpha}) \] with $\alpha > 0$ in the context of counting rational points. In \cite{countpointsexp}, Pila gave an upper bound on the number of rational points of bounded height on a certain exponential-algebraic surface by parametrizing it using $P_\alpha$. The bound on the derivatives of $P_\alpha$, or more generally of mild functions, are suited to bound the number of rational points on the set that it parametrizes, see \cite[Corollary 3.3]{countpointsexp}. The constant $C$ in the definition of a mild function (see Definition \ref{defmild}) plays an important role in this bound. We will show that for the map $P_\alpha$, one can take $C = 1/\alpha$. This is sharper than the result of Pila, where he shows $C = 1+1/\alpha$ (\cite[Proposition 2.8.]{countpointsexp}) and has the advantage of being close to zero for $\alpha$ large. The main obstacle in bounding the derivatives is the polynomial in $1/x$ that appears in the computations, which is rather large. The reason why the map $P_\alpha$ is interesting in this field, is because some functions become mild after composing with it. This has been applied successfully for $\alpha = 1$ in \cite{ccs} to construct $2$-mild parametrizations of families of subanalytic sets. In Section \ref{sec3} we show our main results. We prove such properties for some classes of functions which appear in \cite{unif} in Theorem \ref{abmmild}, from which the result on parametrizations of curves follows in Theorem \ref{curvepara}. In both results we obtain $C = 1/\alpha$ for $\alpha > 0$. If one considers a fixed subanalytic set, there are model theoretic results that imply that it has a $0$-mild parametrization (see for instance \cite{mildpara} for subanalytic sets). However, Yomdin has shown in \cite{yomdin2} that any analytic parametrization of the algebraic family of curves in the abstract necessarily has to contain infinitely many charts (see also \cite{ex}). More precisely, the number of charts in a $0$-mild parametrization will depend on $\epsilon$ and tend to infinity as $\epsilon$ tends to zero. We will construct an explicit $1/\alpha$-mild parametrization of this family where the size of the parametrization does not depend on $\epsilon$. Moreover, we can do this for any family of power-subanalytic curves using a pre-parametrization result of \cite{unif} or \cite{para}. Taking the above example in mind, this seems optimal. More on the field of parametrizations can be found in the survey \cite{ex}. \section{Preliminaries} In this short section we fix some notation for multidimensional calculus and revisit the formula for arbitrary derivatives of a function in several variables, also known as the Fa\`a di Bruno formula. Let $f \in C^\infty(U,\R)$ be an infinitely differentiable function on an open $U \subset (0,1)^m$. For $\nu \in \N^m$ we denote $|\nu| = \nu_1+\ldots + \nu_m$ and \[ f^{(\nu)}(x) = \left(\frac{\partial^{|\nu|}}{\partial x_1^{\nu_1}\cdots \partial x_m^{\nu_m}} f\right)(x). \] For $f \in C^\infty(U,\R^n)$ we set $f^{(\nu)} = (f_1^{(\nu)},\ldots,f_n^{(\nu)})$. Finally, for $x \in U$ and $\mu \in \R^m$ we denote: \[ x^\mu = \prod_{i = 1}^m x_i^{\mu_i}. \] \begin{definition}[Mild functions] \label{defmild} Let $f \in C^\infty(U,\R)$, $A,B \in \R_{>0}$ and $C \in \R_{\geq 0}$. We say that $f$ is $(A,B,C)$-mild if for any $x \in U$ and $\nu \in \N^m$: \[ |f^{(\nu)}(x)| \leq B A^{|\nu|}(|\nu|!)^{C+1}. \] A map $f \in C^\infty(U,\R^n)$ is $(A,B,C)$-mild if all its component functions are. We say that $f$ is $C$-mild if it is $(A,B,C)$-mild for some $A$ and $B$. \end{definition} A $0$-mild function is analytic, but the converse is not true. The composition of $C$-mild functions is $C$-mild. A proof can be found in the next section. It relies on the formula for arbitrary order derivatives of a composition, which is also known as the Fa\`a di Bruno formula. In the univariate case, in propositions \ref{comp}, \ref{main} and \ref{weakpower}, we will use a more compact version stated in \cite[p.51]{dio}. \begin{proposition}[Fa\`a di Bruno, \cite{faa}]\label{chain} Suppose that $n$ is a positive integer, $V \subset \R^d$ and $U \subset \R^e$ are open, $f: V \to \R$, $g: U \to V$ and that $f$ and $g$ are $C^n$. For any $x \in U$ and $\nu \in \N^e$ with $|\nu| = n$ we have that: $$(f \circ g)^{(\nu)}(x) = \sum_{1 \leq |\lambda| \leq n} f^{(\lambda)}(g(x)) \sum_{s = 1}^n \sum_{p_s(\nu,\lambda)} \nu! \prod_{j = 1}^s \frac{(g^{(l_j)}(x))^{k_j}}{k_j!(l_j!)^{k_j}}$$ where $p_s(\nu,\lambda)$ is the set consisting of all $k_1,\ldots,k_s \in \N^d$ with $|k_i| > 0$ and $l_1,\ldots,l_s \in \N^e$ with $0 \prec l_1 \prec \ldots \prec l_s$ such that: $$ \sum_{i = 1}^sk_i = \lambda$$ and $$\sum_{i = 1}^s |k_i|l_i = \nu.$$ Here $l_i \prec l_{i+1}$ means that $|l_i| < |l_{i+1}|$ or, if $|l_i| = |l_{i+1}|$, then $l_i$ comes lexicographically before $l_{i+1}$. \end{proposition} \section{The mildness of $P_\alpha$} In this section we prove that $P_\alpha$ is $1/\alpha$-mild. Writing $P_\alpha$ as a composition of two functions, we will use the Fa\`a di Bruno formula to bound the derivatives. The proof uses the fact that the composition of $0$-mild functions is $0$-mild. Indeed, this follows from the theory of Gevrey functions \cite{Ge}, and a proof in full generality can be found in \cite{para}. To be self contained, we briefly repeat its proof, but formulated in terms of mild functions. \begin{proposition} \label{comp} Suppose that $f$ and $g$ are respectively $(A_f,B_f,C)$-mild and $(A_g,B_g,C)$-mild. Then the composition $f \circ g$ is $C$-mild. Moreover, if $C = 0$ we have: \[ A = A_g(1+A_fB_g) \quad \text{and} \quad B = \frac{A_fB_fB_g}{1+A_fB_g} < B_f. \] \end{proposition} \begin{proof} By Proposition \ref{chain}, using the triangle inequality and the mildness of $f$ and $g$, we obtain for any $x \in (0,1)$ a sum of positive terms: \[ |(f \circ g)^{(n)}(x)| \leq \sum_{k = 1}^n B_fA_f^k (k!)^{C+1} \left( \sum_{n,k} B_n(k_1,\ldots,k_n) \prod_{i = 1}^n (B_gA_g^i(i!)^{C+1})^{k_i}\right), \] where the sum is over all $n$ and $k$ satisfying the relations stated in the theorem. Since $x \mapsto x^{C+1}$ is convex, taking the $(C+1)$-th rooth of the constants where needed, we are done if we can show that if $C = 0$ the sum can be bounded by $BA^nn!$. To this end, consider the maps: \[ \psi(x) = \frac{B_f}{1-A_f(x-B_g)} \quad \text{and} \quad \phi(x) = \frac{B_g}{1 - A_gx}. \] One easily verifies that $\psi^{(k)}(B_g) = B_fA_f^kk!$ and $\phi^{(k)}(0) = B_gA_g^kk!$, which are exactly the bounds on the derivatives of $f$ and $g$. Now in this case, one can compute $(\psi \circ \phi)^{(n)}(0)$ directly, without using the chain rule. One checks that: \[ (\psi \circ \phi)^{(n)}(0) = \frac{A_fB_fB_g}{1+A_fB_g} (A_g(1+A_fB_g))^n n!. \] \end{proof} Clearly, the composition of a $C_1$-mild map and a $C_2$-mild map is $\max(C_1,C_2)$-mild. We need two more elementary lemma's which will be used frequently. \begin{lemma} \label{umild} Suppose that $\alpha \geq 1$ and let $u_\alpha$ be the map $(0,1) \to \R$ given by $u_\alpha(x) = 1-x^{-\alpha}$. Then, for any $x \in (0,1)$ and $k > 0 \in \N$, we have: \[ x^{\alpha+k}|u_\alpha^{(k)}(x)| \leq \alpha^k k!. \] \end{lemma} \begin{proof} This follows immediately from: \[ u_\alpha^{(k)}(x) = (-1)^{k+1}x^{-(\alpha+k)}\alpha(\alpha+1)\cdots(\alpha+(k-1)) \] using that $\alpha \geq 1$ to obtain the desired upper bound. \end{proof} Clearly, if $\alpha < 1$, one can find the upper bound $k!$ instead of $\alpha^k k!$ in the lemma. \begin{lemma} \label{expmild} For $r,s \in \R_{>0}$ we have: \[ \max_{x > 0} x^{-r}\exp(-sx^{-\alpha}) = \left(\frac{r}{es\alpha}\right)^{r/\alpha}. \] \end{lemma} \begin{proof} The maximum is reached in $x = (s\alpha/r)^{1/\alpha}$. \end{proof} \begin{proposition} \label{main} The map $$P_\alpha: (0,1) \to (0,1): x \mapsto \exp(1-x^{-\alpha})$$ is $(A,e,1/\alpha)$-mild, where $A = 6\alpha$ if $\alpha \geq 1$ and $A = 3 (2/\alpha)^{1/\alpha}$ for $0 < \alpha < 1$. \end{proposition} \begin{proof} Defining $u_\alpha(x) = 1-x^{-\alpha}$ as in Lemma \ref{umild}, we will use the Fa\`a di Bruno formula for the map $P_\alpha = \exp \circ \, u_\alpha$. This yields: \[ P_\alpha^{(n)}(x) = \sum_{k = 1}^n \exp(u_\alpha(x)) \left( \sum_{n,k} B_n(k_1,\ldots,k_n) \prod_{i = 1}^n (u_\alpha^{(i)}(x))^{k_i}\right). \] The summation over $n,k$ is subject to the conditions of Proposition \ref{chain}: $\sum_{i = 1}^n ik_i = n$ and $\sum_{i = 1}^n k_i = k$. Thus, in the product over the derivatives of $u_\alpha$, we obtain a factor: \[ \prod_{i = 1}^n (x^{-(\alpha+i)})^{k_i} = x^{-\sum_{i = 1}^n (\alpha+i)k_i} = x^{-(k\alpha+n)}. \] Therefore, we obtain: \begin{align*} P_\alpha^{(n)}(x) &= \sum_{k = 1}^n x^{-(k\alpha+n)}\exp(u_\alpha(x)) \left( \sum_{n,k} B_n(k_1,\ldots,k_n) \prod_{i = 1}^n (x^{\alpha+i}u_\alpha^{(i)}(x))^{k_i}\right) \\ &= x^{-n}e^{1-(1/2)x^{-\alpha}}\sum_{k = 1}^n x^{-k\alpha}e^{-(1/2)x^{-\alpha}} \left( \sum_{n,k} B_n(k_1,\ldots,k_n) \prod_{i = 1}^n (x^{\alpha+i}u_\alpha^{(i)}(x))^{k_i}\right). \end{align*} We proceed by taking absolute value and using the triangle inequality. Suppose now $\alpha \geq 1$, the other case is similar. By Lemma \ref{umild} we have that: \[ x^{\alpha+i}|u_\alpha^{(i)}(x)| \leq \alpha^i i! \] and by Lemma \ref{expmild} we find that: \[ x^{-k\alpha}e^{-(1/2)x^{-\alpha}} \leq \left(\frac{2k\alpha}{e\alpha}\right)^k \leq 2^k k! \] where we have used the inequality $k ^k \leq e^k k!$. Thus by Proposition \ref{comp} the sum can be bounded by $(3\alpha)^n n!$. Finally, by Lemma \ref{expmild}, we have: \[ x^{-n}e^{1-(1/2)x^{-\alpha}} \leq e \left(\frac{2n}{e\alpha} \right)^{n/\alpha} \leq e (2/\alpha)^{n/\alpha} (n!)^{1/\alpha}, \] using that $\alpha \geq 1$ to obtain $(2/\alpha)^{1/\alpha} \leq 2$. \end{proof} \section{parametrizations} In this section we prove some results that indicate that the map $P_\alpha$ can be used to construct mild parametrizations. We start with a classical example that motivates this idea. We generalize this result in Proposition \ref{power}, which yields a parametrization result for definable families of curves. Proposition \ref{weakpower} is more general, but we obtain a $(1/\alpha + 1)$-mild map in that case. \begin{definition}[Mild parametrization] Let $X$ be a subset of $\R^n$. A $C$-mild parametrization of $X$ is a finite collection of $C$-mild maps $\{\phi_i: (0,1)^m \to X \mid i = 1,\ldots,N\}$ such that $X$ is covered by the images of these maps. If $X_T$ is a family of subsets of $\R^n$, then a uniform $C$-mild parametrization is a finite collection of families of $C$-mild maps $\{\phi_i: T \times (0,1)^m \to X_T \mid i = 1,\ldots,N\}$. That is: there exist $A$,$B$ and $C$ such that for any $t \in T$ the maps $\phi_{i,t}$ are $(A,B,C)$-mild and $X_t$ is covered by the union of all their images. \end{definition} \subsection{Yomdin's example}\label{sec41} Consider the family of hyperbolas in $(0,1)^2$ given by $xy = \epsilon^2$, with $\epsilon \in (0,1)$. There is no uniform $0$-mild parametrization for this family (see \cite[Section 3.2]{ex}). We will show that it has a $1/\alpha$-mild parametrization consisting of three charts. We will use the map $P_\alpha$ as a power substitution, similarly to the map $x \mapsto x^2$ in \cite[Lemma 4.2]{ex} and more generally $x \to x^r$ in \cite[Proposition 4.1.5]{unif}. First, consider the family as the graph of the map $f_\epsilon(x) = f(\epsilon,x) = \epsilon^2/x$ on the interval $\epsilon^2 < x < 1$. Now, on this interval, the first order derivative (with respect to $x$) is not uniformly bounded as $x \to \epsilon^2$. To this end we divide the domain in three parts: $\epsilon^2 < x < \epsilon$, $x = \epsilon$ and $\epsilon < x < 1$. Changing variables, the first case becomes the third case and the second case is trivial. Hence we proceed on the interval $\epsilon < x < 1$. Let $C$ be the set $\{ (\epsilon,x) \in (0,1)^2 \mid \epsilon < x < 1\}$ and let $\tilde{C}$ be the preimage under the map $P:(0,1)^2 \to (0,1)^2: (\epsilon,x) \mapsto (P_\alpha(\epsilon),P_\alpha(x))$. Then for any $\epsilon$ and $x$ in $\tilde{C}$ we have: \[ e^{1-\epsilon^{-\alpha}} < e^{1-x^{-\alpha}} < 1 \iff \epsilon < x < 1. \] We claim that for any $\epsilon$ the map $(f \circ P)_{\epsilon}$ is $1/\alpha$-mild. Moreover, the constants $A$ and $B$ do not depend on $\epsilon$ (uniform mildness). To this end, note that $$(f \circ P)(\epsilon,x) = e^{2(1-\epsilon^{-\alpha})-(1-x^{-\alpha})}.$$ We use the same approach as in the proof of the mildness of $P_\alpha$. The $n$-th derivative with respect to $x$ can be bounded in absolute value by: \[ |(f \circ P)_{\epsilon}^{(n)}(x)| \leq \sum_{k = 1}^n e^{2(1-\epsilon^{-\alpha})-(1-x^{-\alpha})} \left( \sum_{n,k} B_n(k_1,\ldots,k_n) \prod_{i = 1}^n (|u_\alpha^{(i)}(x)|)^{k_i}\right). \] Writing the exponent as $2(1-\epsilon^{-\alpha}) - 2(1-x^{-\alpha}) + (1-x^{-\alpha})$ and using that $e^{(1-\epsilon^{-\alpha})} < e^{-(1-x^{-\alpha})}$, bounding the above sum completely reduces to the proof of Proposition \ref{main}. (Here we really used that we bounded the first order derivative.) Finally, one should revert the transformation in $\epsilon$ and map $(0,1)$ onto the domain of the obtained function. More precisely, denote $\Gamma(f_\epsilon)$ for the graph of $f_\epsilon$, then we get: \[ \phi: (0,1) \to \Gamma(f_\epsilon) : x \mapsto ( (1-P^{-1}_\alpha(\epsilon))x+P^{-1}_\alpha(\epsilon), \epsilon e^{-(1-x^{-\alpha})}). \] Note that we do not need the power substitution in $\epsilon$, as we will show in Theorem \ref{curvepara}. \subsection{Results on compositions}\label{sec3} We would like to generalize this example, using the results of \cite{unif}. Their pre-parametrization result (Theorem 4.3.1) leads to a uniform $C^r$-parametrization by using the power substitution $P_r: x \to x^r$. More precisely, given a map $\phi$ obtained by this result, the composition $\phi \circ P_r$ is mild (up to order $r$). Using the map $P_\alpha$, it might be possible to construct a uniform $1/\alpha$-mild parametrization, which would improve bounds on the number of rational points of bounded heights on sets that we can parametrize. We will show that $\phi \circ P_\alpha$ is $1/\alpha$-mild. This yields a uniform $1/\alpha$-mild parametrization for power-subanalytic curves. We start with a more general class of functions defined in \cite{unif}, which also become mild after composing with $P_\alpha$. \begin{definition}[Weakly mild functions] Let $f \in C^\infty(U,\R)$, $A,B \in \R_{>0}$ and $C \in \R_{\geq 0}$. We say that $f$ is weakly $(A,B,C)$-mild if for any $x \in U$ and $\nu \in \N^m$: \[ |f^{|\nu|}(x)| \leq \frac{B A^{|\nu|}(|\nu|!)^{C+1}}{x^\nu}. \] \end{definition} The next result is similar to \cite[Proposition 4.1.5]{unif}. Intuitively, near $0$, $x \to x^r$ is a vanishing function of order $r$, thus is capable of rendering functions mild up to order $r$. In our case, this will be up to order $+\infty$. In the proof of the next proposition, we use that $\alpha \geq 1$, but clearly, it is also true for $0 < \alpha < 1$. \begin{proposition}\label{weakpower} Let $f:U \to \R$, $U \subset (0,1)$ open, be weakly $(A,B,0)$-mild and suppose that $f^{(1)}$ is weakly $(A,B,0)$-mild. Then the map $f \circ P_\alpha: P_\alpha^{-1}(U) \to \R$ is $(1+1/\alpha)$-mild. \end{proposition} \begin{proof} Of course, we will use the Fa\`a di Bruno formula and the triangle inequality again. This leaves us with the task to bound: \[ |(f \circ P_\alpha)^{(n)}(x)| \leq \sum_{k = 1}^n \frac{BA^kk!}{e^{(k-1)(1-x^{-\alpha})}} \left( \sum_{n,k} B_n(k_1,\ldots,k_n) \prod_{i = 1}^n (|P_\alpha^{(i)}(x)|)^{k_i}\right). \] Here, we have $k-1$ in the denominator because of the additional assumption on $f^{(1)}$. From the proof of Proposition \ref{main}, we know that: \begin{align*} |P_\alpha^{(i)}(x)| &= \left|\sum_{l = 1}^i x^{-(l\alpha+i)}e^{1-x^{-\alpha}} \left( \sum_{i,l} B_i(l_1,\ldots,l_i) \prod_{j = 1}^i (x^{\alpha+j}u_\alpha^{(j)}(x))^{l_j}\right)\right| \\ &\leq x^{-(\alpha+1)i}e^{1-x^{-\alpha}}\sum_{l = 1}^i \left( \sum_{i,l} B_i(l_1,\ldots,l_i) \prod_{j = 1}^i (x^{\alpha+j}|u_\alpha^{(j)}(x)|)^{l_j}\right). \end{align*} The sum over $l$ can be considered as the composition of an $(1,1,0)$-mild map and a $(\alpha,1,0)$-mild map, yielding a $(2\alpha,1,0)$-mild map. Using the relations for the sum over $n,k$ and Lemma \ref{expmild} we get: \begin{align*} |(f \circ P_\alpha)^{(n)}(x)| &\leq \sum_{k = 1}^n \frac{BA^kk!}{e^{(k-1)(1-x^{-\alpha})}}x^{-(\alpha+1)n}e^{k(1-x^{-\alpha})} \left( \sum_{n,k} B_n(k_1,\ldots,k_n) \prod_{i = 1}^n ((2\alpha)^ii!)^{k_i}\right) \\ &= x^{-(\alpha+1)n}e^{1-x^{-\alpha}}\sum_{k = 1}^n BA^kk!\left( \sum_{n,k} B_n(k_1,\ldots,k_n) \prod_{i = 1}^n ((2\alpha)^ii!)^{k_i}\right) \\ &\leq e\left(\frac{(\alpha+1)n}{e\alpha}\right)^{(\alpha+1)n/\alpha} B(2\alpha(A+1))^nn! \\ &\leq eB\left(\frac{\alpha+1}{\alpha}\right)^{(\alpha+1)n/\alpha}(2\alpha(A+1))^n (n!)^{2+1/\alpha}. \end{align*} \end{proof} Following the strategy of the proof of \cite[Proposition 4.1.5]{unif} for several variables, will also yield this result for weakly mild functions in more variables. Now this result is not very satisfying and it seems that it cannot be improved in general. For $\alpha = 1$ it is equal to the bound in \cite[Lemma 77]{ccs}. However, if $f$ is of a specific form, we can improve it. The maps we consider are the maps obtained from the pre-parametrization result of \cite{unif}. Our motivating example falls within this scope. The key observation is that these maps have a good interaction with $P_\alpha$. Indeed, the main obstruction to a better result in the proof above is that we completely factor out a power of $x$ in the estimate of $|P^{(i)}_\alpha(x)|$. We will not have to do this below. Let us be more precise about which maps are given by this parametrization result. \begin{definition}[a-b-m functions]\label{abmdef} A map $b:U \subset (0,1)^m \to \R$ is bounded-monomial if it is either identically zero, or is of the form $x^\mu$ for some $\mu \in \R^m$ and its image is bounded. A map $b: U \to \R^n$ is bounded-monomial if all of its component functions are. A map $f: U \to \R$ is analytic-bounded-monomial (a-b-m) if $f$ is of the from \[ f(x) = b_j(x)F(b(x)) \] where $b$ is a bounded-monomial map, $b_j$ a component function of $b$ and $F$ is a unit on $\im(b)$, that is: it is analytic and non-vanishing on an open neighborhood of the topological closure of $\im(b)$. \end{definition} It is shown in \cite[Corollary 4.2.4]{unif} that if all partial derivatives of the associated bounded-monomial map $b$ of $f$ are bounded, then $f$ and all its first order derivatives are weakly $0$-mild. Thus one could apply the previous proposition to this class of functions. In the next proposition, we use that $\alpha \geq 1$ in the proof and the statement, but it is straightforward to deduce an analogue for $0 < \alpha < 1$. One just has to compute the constant $A$. \begin{proposition} \label{power} Suppose that $b(x) = x^{\mu}$ is a bounded-monomial map whose first order derivatives are bounded on an open $U \subset (0,1)^m$. Let $P: (0,1)^m \to (0,1)^m$ be given by \[ P(x_1,\ldots,x_m) = (P_\alpha(x_1),\ldots,P_\alpha(x_m)). \] Then $b \circ P: P^{-1}(U) \to \R$ is $(A,B,1/\alpha)$-mild with $A = 2\alpha(2mN+1)$ with $N = \max_{i = 1}^m |\mu_i|$, $B = e^{|\mu|}M^2$ and $M$ a constant that depends on $b$. \end{proposition} \begin{proof} We use the same strategy as in the proof of Proposition \ref{main}: using the multivariate Fa\`a di Bruno formula. We write \[ (b \circ P)(x) = e^{\sum_{i = 1}^m\mu_i(1-x_i^{-\alpha})} = (E \circ u_\alpha)(x_1,\ldots,x_m) \] where $E = \exp(x_1+\ldots+x_m)$ and $u_\alpha = (u^1_\alpha(x_1),\ldots,u^m_\alpha(x_m))$ where $u^i_\alpha(x_i) = \mu_i(1-x_i^{-\alpha})$. We may suppose that all $\mu_i$ are nonzero, otherwise the map does not depend on $x_i$ and any derivative with respect to $x_i$ is trivial. We have that: \[ (E \circ u_\alpha)^{(\nu)}(x) = \sum_{1 \leq |\lambda| \leq n} E^{(\lambda)}(u_\alpha(x)) \sum_{s = 1}^n \sum_{p_s(\nu,\lambda)} \nu! \prod_{j = 1}^s \frac{(u_\alpha^{(l_j)}(x))^{k_j}}{k_j!(l_j!)^{k_j}}. \] As in the proof of Proposition \ref{main}, we rewrite the formula as follows: \[ (E \circ u_\alpha)^{(\nu)}(x) = \sum_{1 \leq |\lambda| \leq n} \frac{1}{x^{\nu+\alpha\lambda}}E^{(\lambda)}(u_\alpha(x)) \sum_{s = 1}^n \sum_{p_s(\nu,\lambda)} \nu! x^{\nu+\alpha\lambda}\prod_{j = 1}^s \frac{(u_\alpha^{(l_j)}(x))^{k_j}}{k_j!(l_j!)^{k_j}}, \] which equals \[ e^{|\mu|}\frac{1}{x^\nu}e^{-(1/2)\sum_{i = 1}^m \mu_ix_i^{-\alpha}} \sum_{1 \leq |\lambda| \leq n} \frac{1}{x^{\alpha\lambda}}e^{-(1/2)\sum_{i = 1}^m \mu_ix_i^{-\alpha}} \sum_{s = 1}^n \sum_{p_s(\nu,\lambda)} \nu! x^{\nu+\alpha\lambda}\prod_{j = 1}^s \frac{(u_\alpha^{(l_j)}(x))^{k_j}}{k_j!(l_j!)^{k_j}}. \] Taking the extra factor $x^{\nu+\alpha\lambda}$ into account, using the relations on $l_j$ and $k_j$, we can bound everything concerning $u_\alpha$ by the appropriate bounds of an $(\alpha,N,0)$-mild function (see Lemma \ref{umild}). Now let $I$ be such that $x_I = \min_{i = 1}^m x_i$. Let $\mu' \in \R^m$ be given by $\mu'_i = \mu_i$ for $i \neq I$ and $\mu'_I = \mu_I - 1$. Then we have: \[ \frac{1}{x^{\alpha\lambda}}e^{-(1/2)\sum_{i = 1}^m \mu_ix_i^{-\alpha}} \leq \frac{1}{x_I^{\alpha|\lambda|}}e^{-(1/2)x_I^{-\alpha}}e^{-(1/2)\sum_{i = 1}^m \mu'_ix_i^{-\alpha}} \leq \left(\frac{2|\lambda|}{e}\right)^{|\lambda|} e^{-(1/2)\sum_{i = 1}^m \mu'_ix_i^{-\alpha}} \] by Lemma \ref{expmild}. Now denote $K = e^{-(1/2)\sum_{i = 1}^m \mu'_ix_i^{-\alpha}}$, then $e^{|\mu'|}K^2 = ((\partial / \partial x_I)(b)/\mu_I) \circ P$. By our assumption on the partial derivatives of $b$, taking the maximum, this can be bounded independent of $I$. Thus we find that $K < M$ for some $M$ depending on $b$ only. Similarly we find that \[ \frac{1}{x^\nu}e^{-(1/2)\sum_{i = 1}^m \mu_ix_i^{-\alpha}} \leq \left(\frac{2|\nu|}{e\alpha}\right)^{|\nu|/\alpha}M. \] Using the multivariate version of Proposition \ref{comp} (see \cite[Corollary 2.5.1]{para}) we obtain that for any $x \in U$: \[ |(b \circ P)^{(\nu)}(x)| \leq e^{|\mu|}M^2 (2/\alpha)^{|\nu|/\alpha}(\alpha(1+m2N))^{|\nu|} (|\nu|!)^{1+1/\alpha}. \] \end{proof} As we have mentioned in the example, the fact that all first order partial derivatives of $b$ are bounded is crucial. Not only for the proof, but the statement can fail if it is not bounded. Indeed, if one does not bound the first order derivative in the example of Section \ref{sec41}, one would obtain the relation $e^{2(1-\epsilon^{-\alpha})} < e^{1-x^{-\alpha}}$, which is not sufficient to bound $e^{-2(1-x^{-\alpha})}$. \begin{theorem}\label{abmmild} Suppose that $f: U \to \R$ is a-b-m on an open $U \subset (0,1)^m$ such that the first order derivatives of its associated bounded-monomial map $b$ are bounded. Then $f \circ P: P^{-1}(U) \to \R$ is $1/\alpha$-mild. \end{theorem} \begin{proof} This follows by Proposition \ref{power} and the fact that the unit $F$ is $0$-mild since it is analytic on an open neighborhood of $\overline{\text{Im}(b)}$ \cite[Proposition 2.2.10]{primer}. This concludes the proof by the remark below Proposition \ref{comp} and the fact the the product of $C$-mild functions is $C$-mild. \end{proof} Before moving to our final result, let us point out that by the method above, one can show that the parametrization of the exponential-algebraic surface on the last line of \cite[p. 507]{countpointsexp} is $1/g$-mild (improving $1+1/g$). This improves the upper bound on rational points in that paper to $c(\epsilon)(\log T)^{35+\epsilon}$. We will now use the pre-parametrization result of \cite[Theorem 3.5]{para}, which is a slight modification of \cite[Theorem 4.3.1]{unif}, to obtain a uniform $1/\alpha$-mild parametrization of a family of power-subanalytic curves. This improves the $2$-mild parametrization of subanalytic curves of \cite{ccs}. \begin{theorem}\label{curvepara} If $X_T$ is a power-subanalytic family of power-subanalytic curves in $(0,1)^n$, then it has a uniform $1/\alpha$-mild parametrization. \end{theorem} \begin{proof} By \cite[Theorem 3.5]{para} we obtain finitely many $f: C \subset T \times (0,1) \to [-1,1]^{n-1}$, where $C$ is an open cell in $T \times (0,1)$. The map $f$ is of the following form \[ f(x) = b_j(t,x) F(b(t,x)), \] where $b_j$ is a component function of $b$, all component functions of $b$ are of the form $a(t)x^r$ for some definable function $a(t)$, $r \in \R$ and $F$ is a non-vanishing analytic function on an open neighborhood of $\overline{\im(b)}$. Moreover, $(\partial/\partial x)(b)$ is (uniformly) bounded. Consider the map \[ P: T \times (0,1) \to T \times (0,1) : (t,x) \mapsto (t,P_\alpha(x)) \] and set $\tilde{C} = P^{-1}(C)$. It follows that for any $t$ the map $(f \circ P)_t$ is $(A,B,1/\alpha)$-mild, where $A$ and $B$ are independent of $t$ (using the same technique as in the proof of Proposition \ref{power}, using the fact that $a(t)x^r$ and its first order derivative are uniformly bounded). Since in the case of curves the walls of the cell bounding the variable $x$ only depend on $t$, for any $t$ they are automatically $(1,1,0)$-mild. \end{proof} It would be interesting to know whether the techniques in this paper can be applied to the cellular maps in \cite{ccs} to obtain a uniform $1/\alpha$-mild parametrization of families of subanalytic sets (of arbitrary dimension). For power-subanalytic sets, one does not really require an analogue of \cite[Proposition 4.2.6]{unif}, as mentioned in the introduction of this section. One could argue by induction instead. The obstacle in that case is the fact that $P_\alpha^{-1}(C)$ is not power-subanalytic. \bibliographystyle{alpha}
\section*{Abstract} Inverse probability weighting is increasingly used in causal inference, but the g-computation constitutes a promising alternative. We aimed to compare the performances of these methods with time-to-event outcomes. Given the limitations of the interpretability of the hazard ratio for causal inference, our target estimand of interest is the difference in restricted mean survival times. We report the findings of an extensive simulation study showing that both inverse probability weighting and g-computation are unbiased under a correct model specification, but g-computation is generally more efficient. We also analyse two real-world datasets to illustrate these results. Finally, we update the {\tt{R}} package {\tt{RISCA}} to facilitate the implementation of g-computation.\\ \section*{Keywords} Causal inference, Parametric g-formula, Propensity score, Restricted mean survival time, Simulation study. \section{Introduction} Real-world evidence is scientific evidence obtained from data collected outside the context of randomised clinical trials \cite{Sherman_RWE_2016}. The absence of randomisation complicates the estimation of the marginal causal effect (hereafter referred to merely as causal effect) of exposure (including treatment or intervention) due to a potential risk of confounding \cite{Hernan_2004}. Rosenbaum and Rubin \cite{rosenbaum_central_1983} introduced the propensity score (PS) as a tool for causal inference in the presence of measured confounders. In a binary exposure setting, it has been shown that the estimated PS is a balancing score, meaning that conditional on the estimated PS, the distribution of covariates is similar for exposed and unexposed patients. Following this property, the PS can be used in four ways to provide estimates of the causal exposure effect: matching, stratification, adjustment, and inverse probability weighting (IPW) \cite{robins_marginal_2000}. Stratification leads to residual confounding and adjustment relies on strong modelling assumptions \cite{lunceford_stratification_2004, Vansteelandt_Daniel_2014}. Although matching on PS has long been the most popular \cite{ali_reporting_2015}, IPW appears to be less biased and more precise in several studies \cite{le_borgne_comparisons_2015, Hajage__2016, austin_performance_2013}. Moreover, King and Nielsen \cite{King_PSM} argued for halting the use of PS matching for many reasons, including covariate imbalance, inefficiency, model dependence, and bias. Causal effects can also be estimated using the g-computation (GC), a maximum likelihood substitution estimator of the g-formula \cite{Robins_1986, Snowden_2011, Keil_2014}. While IPW is based on exposure modelling, the GC relies on the prediction of the potential outcomes for each subject under each exposure status. Several studies (see \cite{Chatton_2020} and references therein) compared the IPW and GC in different contexts. They reported a lower variance for the GC than the IPW. Nevertheless, to the best of our knowledge, no study has focused on time-to-event outcomes. The presence of right-censoring and its magnitude is of prime importance since a small number of observed events due to censoring may impact the estimation of the outcome model involved in the GC. By contrast, the IPW may perform well as long as the number of exposed patients is sufficient to estimate the PS and the total sample size is sufficiently large to limit variability in the estimated weights. In addition to the lack of simulation-based studies comparing the GC and the IPW in a time-to-event context, the GC-based estimates, such as hazard ratio or restricted mean survival, are not straightforward to obtain. Continuous-time data result in methodological difficulties, mainly due to the time-varying distribution of individual baseline characteristics. In the present paper, we aimed to detail the statistical framework for using the GC in time-to-event analyses. We restricted our developments to time-invariant confounders because the joint modelling of time-to-event and longitudinal data requires for controlling the time-varying confounding by GC or IPW \cite{Hernan_2001}, which is beyond the scope of this paper. We also compared the performances of the GC and IPW. The rest of this paper is structured as follows. In section 2, we detail the methods. Section 3 presents the design and findings of a simulation study. In section 4, we propose a practical comparison with two real-world applications related to treatment evaluations in multiple sclerosis and kidney transplantation. Finally, we discuss the results and provide practical recommendations to help analysts to choose the appropriate analysis method. \section{Methods} \subsection{Notations} Let $(T_i,\delta_i,A_i,L_i)$ be the random variables associated with subject $i$ ($i=1,...,n)$. $n$ is the sample size, $T_i$ is the participating time, $\delta_i$ is the censoring indicator (0 if right-censoring and 1 otherwise), $A_i$ is a binary time-invariant exposure initiated at time $T=0$ (1 for exposed subjects and 0 otherwise), and $L_i=(L_{1i},...,L_{pi})$ is a vector of the $p$ measured time-invariant confounders. Let $S_a(t)$ be the survival function of group $A=a$ at time $t$, and let $\lambda_a(t)$ be the corresponding instantaneous hazard function. Suppose $D_a$ is the number of different observed times of event in group $A=a$. At time $t_j$ ($j=1,... , D_a$), the number of events $d_{ja}$ and the number of at-risk subjects $Y_{ja}$ in group $A=a$ can be defined as $d_{ja} = \sum_{i:t_i = t_j} \delta_i \mathds{1}(A_i=a)$ and $Y_{ja} = \sum_{i:t_i \geq t_j} \mathds{1}(A_i=a)$. \subsection{Estimands} \label{estimand} The hazard ratio ($HR$) has become the estimand of choice in confounder-adjusted studies with time-to-event outcomes. However, it has also been contested \cite{hernan_hazards_2010, Aalen_2015}, mainly because the baseline distribution of confounders varies over time. For instance, consider a population in which there is no confounder at baseline, \textit{i.e.}, the distribution of $L$ is identical regardless of exposure level $A$. Suppose additionally that the quantitative covariate $L_1$ and the exposure $A$ are independently associated with a higher risk of death. In this situation, as illustrated in Figure \ref{L1}, the difference between the $L_1$ mean values of the two groups increases over time. Then, even when the subject-specific proportional hazard (PH) assumption is true, \textit{i.e.}, the $HR$ between an exposed and an unexposed patient with the same characteristics $L$ is constant over time, the population-average $HR$ varies over time. Instead of $HR$, one can estimate the average over time of the different time-specific $HRs$: $AHR = \int [ \lambda_1(t) / \lambda_0(t) ] f(t)$ \cite{Schemper_2009}. Nevertheless, Aalen \textit{et al.} \cite{Aalen_2015} concluded that it is difficult to draw causal conclusions from such a relative estimand. Hern\'an\cite{hernan_hazards_2010} advocated the use of the adjusted survival curves and related differences. For instance, the restricted mean survival time (RMST) allows us to summarise a survival curve for a specific time-window and to compare two curves by looking at the difference in RMST \cite{Royston_Parmar_2013}. The RMST difference up to time $\tau$ is formally defined as : \begin{equation} \Delta (\tau) = \int_{0}^{\tau} [S_1(t) - S_0(t)]dt \label{eq_rmst} \end{equation} This value corresponds to the difference in terms of mean event-free time between two groups of exposed and unexposed individuals followed up to time $\tau$. A further advantage of the RMST difference is its usefulness for public health decision making \cite{Poole_2010}. Note that other alternatives that might avoid this problem exist, such as the attributable fraction or the number needed to treat \cite{Sjolander_2018}. Hereafter, we considered $AHR$ and $\Delta (\tau)$. \subsection{Weighting on the inverse of propensity score} Formally, the PS is $p_{i} = P(A_i=1|L_i)$, \textit{i.e.}, the probability that subject $i$ is exposed according to her/his characteristics $L_i$. In practice, analysts often use logistic regression. Let $\omega_i$ be the weight of subject $i$. Xu \textit{et al.} \cite{xu_use_2010} defined $\omega_i = A_i P(A_i=1) / p_i + (1-A_i) P(A_i=0) / (1-p_i)$ to obtain a pseudo-population in which the distribution of covariates is balanced between exposure groups, enabling estimation of the causal effect in the entire population \cite{Hernan_2004}. The use of stabilised weights has been shown to produce a suitable estimate of the variance even when there are subjects with extremely large weights \cite{robins_marginal_2000, xu_use_2010}. The weighted numbers of events and at-risk subjects at time $t_j$ in group $A=a$ are $d_{ja}^\omega = \sum_{i:t_i = t_j} \omega_i \delta_i \mathds{1}(A_i=a)$ and $Y_{ja}^\omega = \sum_{i:t_i \geq t_j} \omega_i \mathds{1}(A_i=a)$, respectively. Cole and Hern\'an \cite{cole_adjusted_2004} proposed a weighted Kaplan-Meier estimator defined as: \begin{equation} \hat S_a(t)= \prod_{t_j \leq t} \Big [ 1- d_{ja}^\omega / Y_{ja}^\omega \Big ] \label{eq1} \end{equation} To estimate the corresponding $AHR$, they suggested the use of a weighted univariate Cox PH model, in which exposure is the single explanatory variable. We use equation (\ref{eq_rmst}) to estimate the corresponding $\Delta(\tau)$. \subsection{G-computation} Akin to the IPW, the GC involves two steps. The first consists of estimating the outcome model, called the Q-model \cite{Snowden_2011}. When suitable, it can consist of a PH regression: $h(t|A_i,L_i) = h_0(t)\exp(\gamma A_i + \beta L_i)$ where $h(t|A_i,L_i)$ is the conditional hazard function of subject $i$ at time $t$, $h_0(t)$ the baseline hazard function, and $\gamma$ and $\beta$ are regression coefficients. Estimates of the cumulative baseline hazard $\hat{H}_0(t)$ and the regression coefficients ($\hat \gamma, \hat \beta$) can be obtained by the joint likelihood approach proposed by Breslow \cite{Breslow_1972}. The second step consists of predicting the counterfactual mean survival function if all subjects would have been exposed ($do(A=1)$) or unexposed ($do(A=0)$): \begin{equation} \hat{S}_a(t) = n^{-1} \sum_{i=1}^n \exp \Big [- \hat{H}_0(t) \times \exp(\hat\gamma \times do(A_i=a) + \hat\beta L_i) \Big ] \label{eq2} \end{equation} Then, $\widehat{AHR}$ can be computed as the mean of the individual counterfactual hazard ratios at the observed event times \cite{Schemper_2009}: \begin{equation} \widehat{AHR} = \Big [ \sum_{i=1}^n \delta_i \Big ]^{-1} \sum_{i=1}^n \delta_i \Big [\hat{\lambda}_1(t_i)/ \hat{\lambda}_0(t_i) \Big ], \label{eq3} \end{equation} where $\hat{\lambda}_a(t) = - \partial \log\hat{S}_a(t)/\partial t$, which is obtained from equation (\ref{eq2}) by numerical differentiation. We use equation (\ref{eq_rmst}) to estimate the corresponding $\Delta(\tau)$. \subsection{Software} We performed all the analyses using {\tt{R}} version 3.6.0. \cite{R} Source code to reproduce the results is available as Supporting Information on the journal’s web page. To facilitate their use in practice, we have implemented the previous methods in the {\tt{R}} package entitled {\tt{RISCA}} (versions $\geq$ 0.8.1), which is available at {\tt{cran.r-project.org}}. We obtained the variances by bootstrap, as recently recommended by Austin \cite{Austin_boot}. \subsection{Identifiability conditions} As for standard regression models, the IPW and the GC require assumptions of non-informative censoring, no measurement error, no model misspecification, and no interference \cite{Hudgens_Halloran_2008}. Three additional assumptions, called \emph{identifiability conditions}, are necessary for causal inference \cite{Naimi_2016}. (i) The values of exposure under comparisons correspond to well-defined interventions that, in turn, correspond to the versions of exposure in the data. (ii) The conditional probability of receiving every value of exposure depends only on the measured covariates. (iii) The conditional probability of receiving every value of exposure is greater than zero. These assumptions are known as \emph{consistency}, \emph{conditional exchangeability} and \emph{positivity}, respectively. \section{Simulation study} \subsection{Data generation} We generated data in three steps. (a) We simulated three covariates ($L_1$ to $L_3$) from a Bernoulli distribution with parameter equal to 0.5 and three covariates ($L_4$ to $L_6$) from a standard normal distribution (Figure \ref{DAG}). (b) We generated the exposure $A$ according to a Bernoulli distribution with probability obtained by the logistic model with the following linear predictor: $-0.5 + \log(2) \cdot L_2 + \log(1.5) L_3 +\log(1.5) L_5 +\log(2) L_6$. We set the intercept to obtain the prevalence of exposed individuals at 50\%. (c) We generated the times-to-event from a Weibull PH model. We set the scale and shape parameters to 40.0 and 2.0, respectively. Based on a random variable $U_i$ drawn from a standard uniform distribution, we then computed the time-to-event from a Weibull PH model as $40.0 * [(1 - \log(1-U_i) \exp(-\gamma A_i - \log(1.8) L_1 - \log(1.3) L_2 - \log(1.8) L_4 - \log(1.3) L_5 )) - 1]^{-2.0}$, where $\gamma = \log(1.0)$ under the null hypothesis or $\log(1.3)$ under the alternative hypothesis. We subsequently censored the times-to-event using a uniform distribution on [0,70] or [0,15], leading to approximately 40\% and 90\% censored observations, respectively. We explored three sample sizes: $n=$ 100, 500, and 2000. When the censoring rate was 90\%, we did not investigate the smallest sample size due to the reduced number of events. For each scenario, we randomly generated 10,000 datasets. To compute the difference in $\Delta (\tau)$, we defined $\tau$ in each dataset as the time at which at least 10\% of the individuals in each group (exposed or unexposed) were still at risk. We furthermore considered two sets of covariates: $(L_1, L_2, L_4, L_5)$ the risk factors of the outcome, or $(L_2, L_5)$ the true confounders. \subsection{Performance criteria} We computed the theoretical values of the $AHR$ and $\Delta(\tau)$ by averaging the estimations obtained, respectively, from univariate Cox PH models ($A$ as the only explanatory covariate) and by equation (\ref{eq_rmst}) where the survival functions were estimated by the Kaplan-Meier estimator, fitted from datasets simulated as above, except $A$ was simulated independently of $L$ \cite{gayat_propensity_2012}. We reported the following criteria: (i) the percentage of datasets without convergence ; (ii) the mean absolute bias $MAB=E(\hat \theta)-\theta$, where $\theta$ is the estimand of interest; (iii) the mean square error $MSE = E[(\hat\theta - \theta)^2]$; (iv) the variance estimation bias $VEB = 100 \times (E[\widehat{SD}(\hat\theta)]/SD(\hat\theta) - 1)$, where $\widehat{SD}(\bullet)$ is the asymptotic standard deviation and $SD(\bullet)$ is the empirical standard deviation; (v) the empirical coverage rate of the nominal 95\% confidence interval (CI), defined as the percentage of 95\% CIs including $\theta$; (vi) the type I error, defined as the percentage of times the null hypothesis is rejected when the null hypothesis is true; and (vii) the statistical power, defined as the percentage of times the null hypothesis is rejected when the alternative hypothesis is true. We computed the Monte Carlo standard errors for each performance measure \cite{Morris_simulation}. \subsection{Results} The Monte Carlo errors were weak, and we did not encounter any convergence problems. Figures \ref{resAHR} and \ref{resRMST} present the results under the alternative hypotheses for $AHR$ and $\Delta$, respectively. The results under the null hypothesis were comparable and can be found in the supplementary material available online. The MAB values associated with IPW and GC were similar to zero in all scenarios, regardless of the considered covariate set (all the risk factors or only the true confounders). Nevertheless, the MAB under the alternative hypothesis was slightly lower with the GC when considering all the risk factors. For instance, in terms of $\Delta$ when $n=500$ with a censoring rate of 40\%, the MAB was 0.033 for GC versus 0.061 for IPW. When considering only true confounders, these values were 0.147 and 0.066, respectively. The GC, when considering all outcome causes, produced the best results in terms of MSE, especially for small sample sizes. For instance, when $n=100$ with a censoring rate of 40\%, the MSE related to the $AHR$ was 0.056 for GC versus 0.068 for IPW. When considering only true confounders, these values were 0.076 and 0.079, respectively. Regarding the VEB, the results were close for the GC and IPW. One can nevertheless note lower values for the IPW when $n=100$ to estimate the $AHR$. For instance, for a censoring rate of 40\%, the VEB values were between 4.1\% and 4.7\% for GC versus 2.4\% and 3.7\% for IPW. All scenarios broadly respected the nominal coverage value of 95\%. The power was the highest for the GC, especially when considering all the risk factors, with a gain between 10\% and 13\%. With a censoring rate of 90\%, the two methods produced similar results, irrespective of the considered scenario. \section{Applications} We used data from two studies performed for multiple sclerosis and for kidney transplantation \cite{Laplaud_2019,Masset_2019}. We conducted these studies following the French law relative to clinical noninterventional research. Written informed consent was obtained. Moreover, the French commission for data protection approved the collection (CNIL decisions DR-2014-327 and 914184). To guide variable selection, we asked experts which covariates were causes of the exposure or the outcome prognosis to define the causal structure \cite{VanderWeele_Shpitser_2011}. We checked the positivity assumption and the considered covariates balance (see supplementary materials available online). The log-linearity hypothesis of continuous covariates was confirmed in the univariate analysis if the Bayesian information criterion \cite{BIC} was not reduced using natural spline transformation compared to the inclusion of the covariate in its natural scale. In case of violation, we used a natural spline transformation. We also assessed the PH assumption via the Grambsch-Therneau test at a significance level of 5\% \cite{Grambsch_Therneau_1994}. For simplicity, we performed complete case analyses. \subsection{Dimethylfumarate versus Teriflunomide to prevent relapse in multiple sclerosis} With the increasing number of available drugs for preventing relapses in multiple sclerosis and the lack of head-to-head randomised clinical trials, Laplaud \textit{et al.} \cite{Laplaud_2019} aimed to compare Teriflunomide (TRF) and Dimethylfumarate (DMF) using data from the multicentric cohort OFSEP. We reanalysed the primary outcome, defined as the time-to-first relapse. We presented the cohort characteristics of 1770 included patients in Table 1: 1057 patients were in the DMF group (59.7\%) versus 713 in the TRF group (40.3\%). Approximately 39\% of patients (40\% in the DMF group versus 38\% in the TRF group) had at least one relapse during follow-up. We presented the confounder-adjusted results in the left panel of Figure \ref{forCVC}. The GC and IPW were equally robust to the considered set of covariates. For the difference in RMST, the width of the 95\% CI was lower for the GC. For instance, when we considered all the risk factors, the CI of GC had a width of 44.2 days versus 50.9 days for IPW. The conclusion of no significant difference between TRF and DMF was unaffected by the method or the choice of the estimand. \subsection{Basiliximab versus Thymoglobulin to prevent post-transplant complications} Amongst non-immunised kidney transplant recipients, one can expect similar rejection risk between Thymoglobulin (ATG) and Basiliximab (BSX), two possible immunosuppressive drugs proposed as induction therapy. However, ATG may be associated with higher serious events, especially in the elderly. We aimed to reassess the difference in cardiovascular complications in ATG versus BSX patients \cite{Masset_2019}. Table 2 describes the 383 included patients from the multicentric DIVAT cohort: 204 patients were in the BSX group (53.3\%) versus 179 in the ATG group (46.7\%). Approximately 30\% of patients (29\% in the BSX group and 31\% in the ATG group) had a least one cardiovascular complication during follow-up. The median follow-up time was 1.8 years (min: 0.0; max: 8.2). In the right panel of Figure \ref{forCVC}, we present the confounder-adjusted RMST differences for a cohort followed up to 3 years. First, the GC-based results obtained were slightly less sensitive to the considered set of covariates than those obtained by the IPW. Indeed, GC resulted in a $\hat{\Delta}(3)$ of 2.6 (IC 95\% from -1.2 to 7.0) and 4.0 (IC 95\% from 0.2 to 8.5) months with all the risk factors and only the true confounders, respectively. In contrast, the IPW resulted in a $\hat{\Delta}(3)$ of 1.5 (IC 95\% from -2.5 to 5.8) and 3.4 (IC 95\% from -0.5 to 7.9) months, respectively. Likewise, the log of $\widehat{AHR}$ obtained by GC was between -0.272 (IC 95\% from -0.703 to 0.123) and -0.440 (IC 95\% from -0.898 to -0.021) versus -0.188 (IC 95\% from -0.639 to 0.226) and -0.384 (IC 95\% from -0.830 to 0.002) for IPW. This variability in the estimations, according to the set of covariates, illustrates the importance of this choice. Second, we obtained the smallest 95\% CIs using the GC with all risk factors, in line with the corresponding lower variance previously reported in the simulations. Third, the conclusion differed depending on the method: the IPW-based results did not point to a significant difference in effect between BSX and ATG, in contrast to the GC with the true confounders. \section{Discussion} We aimed to explain and compare the performances of the GC and IPW for estimating causal effects in time-to-event analyses with time-invariant confounders. We focused on the average HR and the RMST difference. The results of the simulations showed that the two methods performed similarly in terms of MAB, VEB, coverage rate, and type I error rate. Nevertheless, the GC outperformed the IPW in terms of statistical power, even when the censoring rate was high. Furthermore, the simulations showed that the Q-model in the GC approach should preferentially include all the risk factors to ensure a smaller mean bias. Therefore, the main advantage of using the GC is the gain in statistical power. In the two applications, the 95\% CIs were also narrower when using the GC with all the risk factors. Moreover, while the first application in multiple sclerosis did not highlight relevant differences between the GC and IPW, the second one in kidney transplantation illustrated the importance of the set of covariates to consider. On the basis of the GC with all risk factors, we concluded there was a significant difference between Basiliximab and Thymoglobulin. In contrast, when using the GC with only the true confounders, we reported a non-significant difference. Two arguments can explain why the consideration of all risk factors in the Q-model was associated with the best performance. First, this approach reduces the residual variance and increases the precision of the predictions of potential outcomes. Second, even if a risk factor is balanced between the exposure groups at baseline, it could become unbalanced over time (as illustrated in Figure~\ref{L1}). Nevertheless, the higher power of the GC is counterbalanced by the inability of GC to evaluate balance of characteristics between exposure groups over time and the need for bootstrapping to estimate the variance, analytic estimators that are available for the IPW \cite{Conner_Trinquart_2019, Hajage_2018}. In practice, we must emphasise that bootstrapping the entire estimation procedure has the advantage of valid post-selection inference \cite{Efron_2014}. For instance, data-driven methods for variables selection, such as the super learner \cite{vdl_2007}, have recently been developed and may represent a promising perspective when such clinical knowledge is unavailable \cite{Blakely_2019}. The IPW and GC are not the only available methods to estimate the causal effect. For instance, Conner \textit{et al.} \cite{Conner_Trinquart_2019} compared the performance of IPW with that of other regression-based methods. Overall, the statistical performance was similar. However, the advantage of the IPW and GC compared to other methods is the visualisation of the confounder-adjusted results in terms of the survival curve or an indicator such as RMST. The use of doubly robust estimators (DREs) could be an extension of our work \cite{Benkeser_2018, Cai_vdl_2019}. DREs combine both the PS and GC approaches for a consistent estimation of the exposure effect if a least one model has been correctly specified, circumventing the aforementioned potential model misspecification \cite{Lendle_2013}. Unfortunately, DREs can increase bias when the two models are misspecified \cite{Kang_Schafer_2007}. Moreover, several studies have reported a lower variance for the GC than DREs \cite{Chatton_2020, Kang_Schafer_2007, Lendle_2013}. The use of the GC also represents a partial solution to prevent the selection of instrumental variables \cite{Myers_2011} since it is independent of the exposure modelling. Our study has several limitations. First, the results of the simulations and applications are not a theoretical argument for generalising to all situations. Second, we studied only logistic and Cox PH regression: other models could be applied. Keil and Edwards \cite{Keil_Edwards_2018} proposed a review of possible Q-models with a time-to-event outcome. Third, we considered only a reduced number of covariates, which could explain the abovementioned equivalence between the GC and the IPW with the extreme censoring rate. Last, we did not consider competing events or time-varying confounders that require specific estimation methods \cite{Young_2020, Daniel_2013}. To conclude, by means simulation and two applications on real datasets, this study tended to show the higher power of the GC compared to IPW to estimate the causal effect with time-to-event outcomes. All the risk factors should be considered in the Q-model. Our work is a continuation of the emerging literature that questions the near-exclusivity of propensity score-based methods in causal inference. \section*{Acknowledgements} The authors would like to thank the members of DIVAT and OFSEP Groups for their involvement in the study, the physicians who helped recruit patients and all patients who participated in this study. We also thank the clinical research associates who participated in the data collection. We also thank David Laplaud and Magali Giral for their clinical expertise. The analysis and interpretation of these data are the responsibility of the authors. This work was partially supported by a public grant overseen by the French National Research Agency (ANR) to create the Common Laboratory RISCA (Research in Informatic and Statistic for Cohort Analyses, {\tt{www.labcom-risca.com}}, reference: ANR-16-LCV1-0003-01) involving the development of Plug-Stat software. \section*{Competing interest} The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article. Arthur Chatton obtained a grant from IDBC for this work. Other authors received no financial support for the research, authorship, and/or publication of this article. \section*{Supplemental material and code} Supplemental material for this article is available online. \bibliographystyle{vancouver}
\section{Introduction} The \textit{Fermi } LAT (4LAC) catalog of high-confidence AGN associations published by \cite{4LAC} contains 2863 $\gamma$-ray source detections above 0.1 GeV, 98\% of which are classified as blazars or blazar candidates. These AGN have powerful relativistic jetted outflows aligned close to our line of sight, and dominate the $\gamma$-ray sky due to strong Doppler boosting of their high-energy emission \citep[e.g.,][]{MF1,MF2,2010AA...512A..24S}. At present there are only a few known detections of weakly-boosted $\gamma$-ray emission from non-blazar (i.e., ``misaligned'') AGN. Of the dozen $\gamma$-ray loud radio galaxies listed by \cite{2016arXiv161102986R}, all but 3 show either one-sided pc-scale jets and/or superluminal jet motion, indicative of small viewing angles. The exceptions are Centaurus A (distance d = 4 Mpc) and Fornax A (d = 18 Mpc), where resolved $\gamma$-ray emission has been detected from their kpc-scale lobes, and 3C~84 (d = 70 Mpc, in the Perseus cluster). The latter is unusual in terms of having two-sided radio jet structure on both pc- and kpc-scales, a strong compact radio core, and rapidly variable $\gamma$-ray emission \citep{2009ApJ...699...31A}. The \textit{Fermi } catalog statistics suggest that extra-galactic $\gamma$-ray emission can only be detected in either highly boosted jets, or in very nearby radio galaxies. However, there have been theoretical predictions of strong $\gamma$-ray emission from the pc-scale lobes of powerful young radio sources. These lobes are powered by recently activated jets that are plowing into dense gas in their host galaxy \citep{2008ApJ...680..911S,2009MNRAS.395L..43K, 2007MNRAS.376.1630K,2011MNRAS.412L..20K}. Very few such candidates have been identified to date. \cite{2014ApJ...780..165M} initially found no $\gamma$-ray counterparts at the locations of twelve young radio sources, but subsequently claimed a LAT detection near the position of PKS 1718--649 \citep{2016ApJ...821L..31M}. The latter is believed to have a kinematic age of less than 100 years \citep{2009AN....330..193G}. Also \cite{2011ApJ...738..148M} and \cite{2014AA...562A...4M} have claimed that the $\gamma$-ray AGN IERS B0954+556 and PMN~J1603$-$4904, respectively, may either be young radio sources, or unusual examples of beamed blazars. Finally, \cite{2020AA...635A.185P} have reported another young radio galaxy, NGC 3894, as a high-confidence LAT detection. Here we present the results of a multi-frequency VLBA study of the nearby ($z = 0.0365$; \citealt{2012ApJS..199...26H}) AGN TXS~0128+554, which is associated with the \textit{Fermi } $\gamma$-ray catalog source 4FGL J0131.2+5547 / 3FHL J0131.1+5546. The radio source has a compact morphology that indicates it is a new example of a young, non-blazar AGN that is emitting at $\gamma$-ray energies. It is among the lowest luminosity $\gamma$-ray AGN detected by \textit{Fermi } to date. We also present targeted 19~ks Chandra X-ray observations, and analyze the overall measurements in terms of the \cite{2008ApJ...680..911S} and \cite{2009MNRAS.395L..43K} cocoon models. We compare the physical characteristics of TXS~0128+554 to those of other known young AGN, and conclude that the \textit{Fermi } LAT $\gamma$-ray detection of these radio sources depends strongly on both their cosmological distance and the current activity state of their inner jet region. Throughout this paper we adopt the convention $S_\nu \propto \nu^{\alpha}$ for spectral index $\alpha$, and use the cosmological parameters $\Omega_m = 0.27$, $\Omega_\Lambda = 0.73$ and $H_o = 71 \; \mathrm{km\; s^{-1} \; Mpc^{-1}}$ \citep{Komatsu09}. Under these assumptions the redshift of TXS~0128+554 corresponds to a luminosity distance of 158 Mpc and a linear scaling of 0.72 pc per milliarcsecond. With regards to the \textit{Fermi } $\gamma$-ray observatory, we note that true \textit{Fermi } AGN detections are rare, due to the poor angular localization of sources on the sky by the LAT instrument. They typically require additional information, such as co-temporaneous multi-wavelength variability. At the same time, the \textit{Fermi } associations made on the basis of VLBI catalogs are shown to deliver a very low probability of chance coincidence \citep{2009ApJ...707L..56K}. For the purposes of this paper, we will refer to AGN listed as high-confidence associations in the \textit{Fermi } LAT catalogs as \textit{Fermi } detections. \section{\label{background} Background and Identification} MOJAVE (Monitoring of Jets in AGN with VLBA Experiments) is a long term project to study the kinematic and polarization evolution of pc-scale AGN jets with regular VLBA imaging at 15 GHz \citep{MOJAVE_V}. It originally focused on a complete sample of the 135 strongest, most compact radio-loud AGN in the northern sky, and has been expanded during the \textit{Fermi } era to encompass over 400 AGN. In September 2016, the survey added all AGN in the 3FGL catalog with mean $\gamma$-ray photon index harder than 2.1 and an associated radio source with at least 100 mJy of flux density at 15 GHz. The majority of these have a spectral energy distribution with a synchrotron peak above $10^{13}$ Hz, placing them in the intermediate- or high-spectral peaked classes. They are thus prime candidates for detection at TeV $\gamma$-ray energies with current (e.g., VERITAS, HESS, HAWC) and future high-energy observatories such as CTA. The first VLBA images of these sources were obtained in late 2016, and show typical one-sided (core + jet) structures, similar to other AGN in the MOJAVE survey \citep{MOJAVE_XV}. However, the radio galaxy TXS~0128+554 stood out as having a two-sided (lobe-core-lobe) morphology similar to known compact symmetric objects (CSOs). This class was first identified in the 1990s and generally consists of young radio sources that enter into flux-density-limited surveys due to their powerful pc-scale lobe emission \citep{1998PASP..110..493O}. Because they are not selected on the basis of Doppler boosted jet emission, they are not subject to orientation bias, and therefore are more likely have jets lying close to the plane of the sky. Their lobe emission is usually confined to pc-scales, and typically dominates over that of the core, resulting in either a convex spectrum, or one that remains steep down to MHz frequencies. The radio emission from GPS/CSO jets is often strongly depolarized due to dense ionized gas in their external environment \citep{2003ApJ...586...33A,2013MNRAS.433..147D, 2016MNRAS.459..820T}. \begin{deluxetable*}{cccccccc} \tablewidth{0pt} \tablecaption{\label{t:imagestats} VLBA Image Properties} \tablehead{ \colhead{$\nu$} & \colhead{$I_\mathrm{tot}$} &\colhead{$I_\mathrm{peak}$} & \colhead{Maj.} & \colhead{Min.} & \colhead{PA}\ & \colhead{$I_\mathrm{rms}$} & \colhead{$I_\mathrm{base}$} \\[-2ex] \colhead{(GHz)} & \colhead{(mJy)} & \colhead{(mJy$\ \mathrm{bm}^{-1}$)} & \colhead{(mas)} & \colhead{(mas)} & \colhead{($^\circ$)} & \colhead{(mJy$\ \mathrm{bm}^{-1}$)} & \colhead{(mJy$\ \mathrm{bm}^{-1}$)} } \decimalcolnumbers \startdata 2.3 &207 &79 &5.71 &4.42 &$-$10.2 &0.07 &0.30 \\ 5 &162 &61 &2.21 &1.87 &0.3 &0.03 &0.10 \\ 6.6 &151 &62 &1.63 &1.37 &$-$3.1 &0.04 &0.15 \\ 8.4 &151 &64 &1.35 &1.12 &$-$9.0 &0.05 &0.16 \\ 15.4 &114 &63 &0.70 &0.58 &$-$11.8 &0.04 &0.12 \\ 22.2 &97 &84 &0.53 &0.45 &$-$8.8 &0.06 &0.20 \\ \enddata \tablecomments{Columns are as follows: (1) observing frequency (GHz), (2) total cleaned flux density (mJy), (3) map peak (mJy per beam), (4) FWHM major axis of restoring beam (milliarcseconds), (5) FWHM minor axis of restoring beam (milliarcseconds), (6) position angle of major axis of restoring beam (degrees), (7) rms noise level of image (mJy per beam), (11) lowest I contour (mJy per beam).} \end{deluxetable*} The radio source TXS~0128+554 is positionally coincident with the nucleus of a $\mathrm{K_s} = 10.7$ mag elliptical galaxy in the 2MASS survey at $z = 0.036$ (158 Mpc; \citealt{2012ApJS..199...26H}). Its WISE infrared colors place it within the blazar color-color strip as defined by \cite{2012ApJ...750..138M} but well outside the region occupied by $\gamma$-ray-loud blazars. It is associated with the {\it ROSAT} X-ray source RX J0131.2+5545, and the LAT source 4FGL J0131.2+5547. The radio position is offset 116 arcsec from the LAT centroid, but is within the 95\% confidence ellipsoid dimensions of 143 arcsec by 122 arcsec. The $\gamma$-ray source was listed in the \textit{Fermi } 3LAC (high-confidence AGN) catalog \citep{3LAC} but not in 4LAC \citep{4LAC}. In the 4FGL catalog it is fitted by a single power law spectrum of index = 2.10$\pm$ 0.09 and an energy flux of 5.6 $\times 10^{-13}$ erg cm$^{-2}$ s$^{-1}$ between 0.1 GeV and 100 GeV (detection significance = 11 sigma). It has a $\gamma$-ray variability index of 62, which is below the value of 72 at which sources in the 4FGL are considered variable at $>99$\,\% confidence \citep{4FGL}. Its properties above 10 GeV are also tabulated in the 3FHL catalog \citep{3FHL}, with a relatively steep power law index of $3.1 \pm 0.9$ and no significant spectral curvature. The source was listed as an association with 3FGL J0131.3+5548 in the 3FGL catalog \citep{3FGL}, which included \textit{Fermi } data from 2008--2012, but not in any of the previous EGRET or \textit{Fermi } $\gamma$-ray catalogs. No observations have been reported to date at TeV energies. \section{\label{data}OBSERVATIONAL DATA} \subsection{Multi-frequency VLBA observations} We observed TXS~0128+554 over a 13 h period on 2018 June 29 (obscode BL251) with the VLBA. The North Liberty antenna did not participate due to a damaged elevation motor. Two scans were made of the bright radio blazar TXS~0059+581 for fringe calibration. During each of the target and calibrator pointings, scans were made successively at central observing frequencies of 2.3 GHz, 5.0 GHz, 6.6 GHz, 8.4 GHz, 15.4 GHz, 22.2 GHz. The data were recorded at 2048 Mbps in dual circular polarization, with a bandwidth of 256 MHz at each frequency. We processed the data in AIPS \citep{AIPS} following standard procedures, and self-calibrated and imaged the data with the Difmap package \citep{DIFMAP}. Approximately 40\% of the data at 2.3 GHz were unusable due to radio frequency interference from satellite radio signals. In Figure~\ref{multifreqmap} we show the natural-weight total intensity contour maps at all six frequencies, and list the map properties in Table~\ref{t:imagestats}. \input{tables/gaussiantablestub.tex} We fitted bright jet features in the visibility plane to the 15 GHz data and other MOJAVE 15 GHz epochs (\S~\ref{kinematics}) with circular Gaussians (Table~\ref{t:gaussiantable}). Based on previous analysis \citep{MOJAVE_VI}, the typical uncertainties in the feature centroid positions are $\sim 20$\% of the FWHM naturally-weighted image restoring beam dimensions. For the bright and compact features, the positional errors are smaller by approximately a factor of two. We estimate the formal errors on the feature sizes to be roughly twice the positional error, according to \cite{1999ASPC..180..301F}. The flux density accuracies are approximately 5\% \citep{2002ApJ...568...99H}. \begin{figure*}[p] \centering \includegraphics[width=0.78\linewidth]{figures/multifreqmap.pdf} \caption{\label{multifreqmap} Clockwise from the top left: total intensity VLBA contour maps of TXS~0128$+$554 at 2.3 GHz, 5 GHz, 6.6 GHz, 8.4 GHz, 15.4 GHz, and 22.2 GHz. The Gaussian FWHM restoring beam dimensions of each map are indicated by a cross in the lower left corner of each panel. } \end{figure*} \subsection{X-ray Observations} \input{tables/chandra-obs.tex} The {\it{}Chandra}\ ACIS-S \citep{2002PASP..114....1W} observations of TXS\,0128+554 were performed in four separate pointings during March-April 2019 (see Table~\ref{t:chandraobstable} for details). The source was placed at the default aim point on the back-illuminated ACIS charge coupled device (CCD, ACIS-S3). The VFAINT mode and 1/8 CCD readout mode was used to avoid a potential pile-up (see {\it Chandra} Proposer Observatory Guide\footnote{see \url{https://cxc.harvard.edu/proposer/POG/}}). The source was detected in each individual observation, resulting in a total exposure time of 19.3\,ks. We performed the X-ray analysis of the {\it{}Chandra}\ observations with CIAO software version 4.12 \citep{2006SPIE.6270E..1VF} and the {\it{}Chandra}\ calibration data base version 4.9. We reprocessed the pipeline data by running the {\tt chandra\_repro} CIAO tool in order to apply the version 4.9 of the ACIS-S calibration, and used the sub-pixel event repositioning algorithm\footnote{\url{https://cxc.harvard.edu/ciao/why/acissubpix.html}} ({\tt pix\_adj=EDSER}) to obtain the highest resolution X-ray image. We performed the initial inspection of the data in {\tt ds9} \citep{2003ASPC..295..489J} displaying the event files and confirming a strong detection of the source in each individual observation. We defined the source region to be a circle with the 1.5\,arcsec radius corresponding to $\sim 95$\% fraction of the {\it{}Chandra}\ point spread function, PSF) centered at the source position J2000(RA,Dec) = (01:31:13.8,+55:45:13.2). We assumed a background region to be an annulus centered on the source position with the radii between 2.5\,arcsec and 4.5\,arcsec. We discuss the details of the X-ray spectral fitting analysis in Section~\ref{xraydatareduction}. \section{Data analysis}\label{analysis} \subsection{Radio morphology} The radio source TXS~0128+554 is unresolved in the 1.4 GHz NVSS \citep{NVSS}, GMRT \citep{2017AA...598A..78I}, and 2--4 GHz VLASS \citep{VLASS} sky surveys, and in a 5 GHz VLA snapshot image taken in 1994 \citep{1997AAS..122..235L}. The overall radio spectrum is peaked below 1 GHz (\S~\ref{VLBA_flux-density}), with no upturn at low-frequencies that might be expected if significant steep-spectrum extended lobe emission were present. \begin{figure} \centering \includegraphics[width=\linewidth]{figures/VLBA_flux-density.pdf} \caption{\label{VLBA_flux-density} Continuum radio spectrum plot for TXS~0128+554. The single dish flux densities (purple dot-dashed curve) are taken from published surveys as listed in NED. The solid green curve represents total VLBA flux density measurements from our observations, while the red dashed and blue dotted curves represent the pc-scale lobe and core components, respectively. } \end{figure} The pc-scale radio morphology of TXS~0128+554 (Figure \ref{multifreqmap}) consists of a bright unresolved core feature flanked by two arc-shaped radio lobes. This is typical of the compact symmetric object class of young radio sources \citep{1994ApJ...432L..87W}. The leading edges of the lobes appear brightened, indicative of interaction with the host galaxy's interstellar medium. The radio structure is similar to the two-sided inner lobe morphology of the radio galaxy 3C 84 (NGC 1275; d = 70 Mpc), which has a similar overall diameter ($\sim$ 9 pc) and has been modeled as an expanding plasma cocoon by \cite{2016MNRAS.455.2289F}. \begin{figure*} \centering \includegraphics[width=0.8\linewidth]{figures/specindexC-K.pdf} \caption{\label{specindexC-K} Total intensity 5 GHz contour map of TXS~0128$+$554, with spectral index map superimposed in false color. The crosses indicate the Gaussian feature positions fitted to the 15 GHz 2018 June 29 epoch. The spectral indices are derived from a single power-law fit to the pixel values at 5 GHz, 6.6 GHz, 8.4 GHz, 15.4 GHz, and 22.2 GHz. We aligned the individual frequency maps on the core feature C0 (position at the origin) and restored them with a common circular beam of FWHM = 1.4 mas and a pixel size of 0.3 mas. } \end{figure*} The overall projected extent of the lobes is similar in the images at 6.6 GHz and at higher frequencies, ranging from 3.2 pc to 4.3 pc from the core for the eastern lobe, and from 4.5 pc to 6.5 pc for the western lobe. The 2.3 and 5 GHz images reveal faint steep-spectrum emission regions farther out, at 8.8 pc (eastern lobe), and at 7.8 pc (western lobe) from the core, respectively. These steep-spectrum regions are aligned along the source axis at $256^\circ$ that is defined by the position angles of features C2 and C6, and the bright inner jet features C8, C9, and C10 (see Fig.~\ref{specindexC-K} and Table~\ref{t:gaussiantable}). \subsection{Spectral index map and the core-shift effect} We created a spectral index map from the 5~GHz -- 22.2~GHz data by aligning the maps on the core feature positions. We checked for possible opacity-related core shifts \citep[e.g.,][]{2011AA...532A..38S,MOJAVE_IX,2018ARep...62..787V} by applying small shifts in different directions and calculating the standard deviation of the spectral index values for all pixels within 1.5 beamwidths of the core position. For all of the frequency maps the minimum standard deviation value occurred for shifts smaller than 0.03 mas, so we chose to not apply any shifts before combining the final maps. A similar approach was used and proven to be efficient and robust by \cite{2019MNRAS.485.1822P}. We also checked the results of the alignment using an alternative approach to estimate the core shift effect. The algorithm is based on the fast normalized cross-correlation \citep{2D_cross_corr} to register the total intensity maps at different frequencies assuming no strong spectral gradients within the matched areas. We first convolved all the maps with the same circular beam size 1.4~mas and a small pixel size of 0.06~mas, which corresponds to the positional accuracy of the core feature. We then performed the image registration using the optically thin regions of western lobe. We detected no shift for any of the frequency pairs, confirming our other result that was based on minimizing the standard deviation of the spectral index. To construct the spectral index map we applied a Gaussian taper to the maps above 8 GHz, and restored each map with a circular beam of FWHM = 1.4 mas and a pixel size of 0.3 mas. The former corresponds to the minimum dimension of the uniformly weighted 5 GHz restoring beam. We blanked any pixels with intensity below three times the noise level at any frequency, and calculated the spectral index for the remaining pixels using single power law fits. We note that at the highest frequencies, there is sparser coverage at short spacings in the {\it (u,v)} plane, which can result in less sensitivity to diffuse lobe emission and some artificial steepening of the spectra. In Figure~\ref{specindexC-K} we show the spectral index map in false color, superimposed on the 5 GHz total intensity contours. The map reveals an inverted spectrum core region with $\alpha \simeq +0.2$, which steepens to $\alpha \simeq -0.5$ at $r = 2$ mas west of the core. The lobe regions have spectral indices in the range $-0.7 < \alpha < -1.1$. The two steepest spectrum regions in the lobes are located on the source axis, slightly further from the core than features C2 and C6. Although TXS~0128+554 displays a flat-spectrum core region typically seen in compact jetted AGN, its negligible core shift is unusual. For a typical AGN jet with dominating synchrotron opacity and seen at small viewing angle, one would expect a core shift between 5 and 22~GHz to be about 0.3~mas (e.g., \citealt{MOJAVE_IX}). This is an order of magnitude larger than our upper limit that corresponds to a projected distance of 0.02~pc. It could result from not being able to separately resolve the emission from the approaching and receding jets very close to the core, but we note that there are other high viewing angle AGN jets with measurable core shifts (e.g., NGC~4261; \citealt{2015ApJ...807...15H} and NGC~315; \citealt{2019MNRAS.488..939P}). Alternatively, we propose that the nature of the apparent radio core in TXS~0128+554 is not the optically thick $\tau=1$ surface, but rather a recollimation or reconfinement shock \citep[e.g.,][]{2014ApJ...787..151C,2013AA...557A.105F,Kovalev_geometry2020}, the position of which is not frequency dependent. We note that the inverted spectral index value of $\sim +0.2$ in the core region further supports this scenario. The latter could be a result of absorption by a circumnuclear torus, but additional VLBI spectral line studies would be needed to further investigate this possibility. \subsection{\label{kinematics}Multi-epoch VLBA data and jet kinematics} TXS~0128+554 was added to the MOJAVE VLBA monitoring program \citep{MOJAVE_XVII} in 2016 after its detection as a hard-spectrum (3FHL catalog photon index $\Gamma = 2.1$) $\gamma$-ray source by the {\it Fermi} LAT instrument \citep{3FHL}. We obtained a total of seven VLBA 15 GHz epochs between 2016 September 26 and 2019 August 23. In Figure~\ref{stackedimage} we show a stacked total intensity image of these epochs (plus the 2018 June 29 BL251 non-MOJAVE epoch), restored with a circular beam of FWHM = 0.5 mas and pixel size of 0.1 mas. The MOJAVE observations were also sensitive to linear polarization, but we detected no significant polarized flux density at any epoch, with upper limits on the fractional polarization of 0.5\%. \begin{figure*} \centering \includegraphics[width=0.8\linewidth, trim=0cm 0cm 0cm -0.2cm]{figures/stackedplot.pdf} \caption{\label{stackedimage} Stacked epoch 15 GHz VLBA contour image of TXS~0128+554, which combines 8 epochs between 2016 September 26 and 2019 August 23, aligned on the core feature C0 (positioned at the origin) and restored with a circular beam of FWHM = 0.5 mas. The contours are $\sqrt{2}$ times the base contour level of 0.15 mJy per beam. The blue circles indicate the FWHM Gaussian diameters of features fit to the 2018 June 29 epoch at 15 GHz, and the red arrows are representative of their fitted proper motion vectors. Their lengths correspond to the projected displacement in 20 years assuming constant speed. Only features C1, C8 and C5 have significant proper motion.} \end{figure*} \input{tables/vectormotiontable.tex} We fitted the interferometric visibilities at each 15 GHz epoch using Gaussian features as in \cite{MOJAVE_XVII} and list their properties in Table~\ref{t:gaussiantable}. The outer jet features (C1 -- C7) display very little flux density variability, and are weak and diffuse, with brightness temperatures ($T_\mathrm{b}$) between $10^6$~K and $10^8$~K. The innermost jet features (C8 -- C10) vary in flux density by a factor of 2--3 over the epochs and are more compact, with $T_\mathrm{b}$ values between $10^8$~K and $10^9$~K. The core feature maintains a steady brightness temperature of $\sim 10^{10}$~K but shows a drop in flux density by roughly 30\% between 2017 November and 2019 August. The core $T_\mathrm{b}$ is one to two orders of magnitude lower than typical blazars in the MOJAVE program \citep{2011ApJ...742...27L}, and is similar to those of less Doppler-boosted radio galaxies and members of the CSO/GPS class \citep{2005AA...435..521N}. Stable radio flux densities are a common characteristic of the CSO/GPS class, since their jet emission is less affected by relativistic Doppler boosting \citep{2001AJ....122.1661F}. We fit the Gaussian component positions with respect to the (presumed stationary) core feature at each 15 GHz epoch with a simple vector motion model, as described in \cite{MOJAVE_XVII}. Our code fits a constant velocity independently in the right ascension and declination directions, and solves for the feature position at a reference epoch date (2018.19) that is midway between the first and last epoch. We list the kinematic fit parameters for each feature in Table~\ref{t:vectormotiontable}. Most of the features display no significant proper motion over the $\sim 3$ year monitoring period, with the exception of C1, C5 and C8. The inner features C9 and C10 do not have sufficient epochs for a reliable proper motion determination, and any apparent motion of the off-axis features may be affected by the three-dimensional expansion of the lobes. The velocity vector directions of C5 and C8 do not point back to the direction of the core feature, indicating a current or past acceleration (Fig.~\ref{stackedimage}). Also, the separation of C1 and the core is decreasing at a rate of $72 \pm 18$ \hbox{$\; \mu{\rm as \ y}^{-1}\;$}, which may be due to projection effects, backflow of plasma from the lobe, or changes in the feature's internal brightness distribution. A comparison of the 2019 June epoch at 8 GHz with an archival 2010 August epoch (VLBA obscode = BC191I, PI = Jim Condon) shows an outward shift of 127 $\hbox{$\; \mu{\rm as \ y}^{-1}\;$}$ of C5 along PA = $209 \arcdeg$, which is consistent with the C5 speed measurement at 15 GHz from 2016--2019. The apparent speeds of C5 (0.32 c $\pm \, 0.07$ c) and C8 (0.28 c $\pm \,0.06$ c) are self-consistent to within the errors, and are similar to the sub-luminal expansion speeds measured in other GPS/CSO jets \citep{2005ApJ...622..136G}. Given the double-lobed morphology of this source, its jets likely lie close to the plane of the sky (see \S~\ref{intrinsic}), and superluminal motion is therefore not expected. \subsection{\label{intrinsic}Intrinsic jet speed and viewing angle} The asymmetry of the jet morphology and reasonably high apparent velocities of features C5 and C8 suggest that the radio properties of TXS~0128+554 are affected by relativistic beaming and time delay effects. In this case, the western (approaching) jet and lobe emission are Doppler boosted, while the eastern lobe emission is de-boosted. The eastern lobe emission also has to travel a longer distance to the observer, so we are seeing it at an earlier stage of its evolution (and thus with a smaller apparent size). In the same vein, the photons we see from the western lobe were emitted at a later stage of the sources' evolution than those from the core region. Under the assumption of identical jet and counter-jet expansion speeds $v = \beta c$ at viewing angles $\theta$ and $180^\circ - \theta$ from the line of sight, respectively, we can use the apparent separation of two jet features located on opposite sides of the core to measure $\beta\cos{\theta}$ \citep{1967MNRAS.136..123R}. Considering only time-lag effects, the expected separation ratio is $$Q = {1 + \beta\cos{\theta} \over 1 - \beta\cos{\theta}}.$$ Because the location of C2 represents the centroid of a complex emission region, we use the two steepest spectrum locations in the lobes, at $r = 5.6 \pm 0.1$ mas and $r = 8.4 \pm 0.1$ mas along the main jet axis (PA = $256^\circ$). This yields $Q = 1.50 \pm 0.03$ and $\beta\cos{\theta} = 0.20 \pm 0.01$. The separation ratio for the mean positions of features C4 and C1 (Table~\ref{t:vectormotiontable}) yields a similar value of $Q = 1.53 \pm 0.03$, which would be expected if the lobes are expanding radially from the central source. The expected flux density ratio due to relativistic boosting is $$J = \left[{1 + \beta\cos{\theta} \over 1 - \beta\cos{\theta}}\right]^p.$$ The boosting index $p$ is $2-\alpha$ for continuous jet emission, and $3-\alpha$ for an isolated bright feature, where $\alpha$ is the spectral index \citep{UP95}. There are several possible ways to measure $J$ in the source. The first is to sum the emission from each lobe, excluding the core feature, which gives $J = (42 \pm 2 \;\mathrm{mJy}) / (21 \pm 1 \;\mathrm{mJy}) = 2.0 \pm 0.1$. A second method involves taking a slice along the main jet axis in the 15 GHz stacked epoch image. There is an initial peak of $J = 5.5 \pm 0.5$ at the location of feature C8, where $\alpha = -0.07 \pm 0.04$. $J$ drops below unity until $r = 6.2$ mas, and then rises to a plateau of $J = 1.8 \pm 0.1$ at $r = 6.5$ mas. Past $r \gtrsim 7$ mas, $J$ rapidly rises above 8 due to the smaller size of the eastern lobe. The interpretation of the jet/counter-jet flux density ratio is complicated by the time delay effects in the two lobes. For example, if feature C8 represents a (more recent) large jet outburst, its counterpart feature in the eastern jet may be located very close to the core and not currently resolvable in the 15 GHz image. Likewise, the total flux density of each lobe represents emission at different evolutionary stages and thus may not be intrinsically identical. In Figure~\ref{betacostheta} we plot the constraints on $\beta\cos{\theta}$ based on the measured apparent speed, separation ratio, and flux density ratio. For the latter, we assume $p = 2.8$ and plot two dashed curves, for $J = 2.0$ and $J = 5.5$. The dotted curves represent the $\pm 1 \sigma$ ranges. The measured quantities constrain the intrinsic jet velocity to the range $0.25 < \beta < 0.4$. The apparent speed and jet length ratio provide a narrower constraint on the viewing angle ($43^\circ < \theta < 59^\circ$) than the flux density ratios ($31^\circ < \theta < 70^\circ$). The intersection point of the $\beta_\mathrm{app}$ and $Q$ curves is at $\theta = 52^\circ, \beta = 0.32$, which corresponds to mild Doppler boosting factors of $\delta = 1.2$ in the approaching jet and $\delta = 0.79$ in the counter-jet. \begin{figure} \centering \includegraphics[width=\linewidth]{figures/beta_vs_theta.pdf} \caption{\label{betacostheta} Diagram showing constraints on jet speed $\beta$ and viewing angle $\theta$ derived from the apparent jet speed (blue solid curve), jet/counter-jet length ratio (purple solid curve) and jet/counter-jet flux density ratios (red dashed curves). The dotted curves represent the $\pm 1 \sigma$ ranges on the measured quantities. The intersection point of the $\beta_\mathrm{app}$ and $Q$ curves is at $\theta = 52^\circ, \beta = 0.32$. } \end{figure} By assuming that the plasma in the western lobe has been expanding at constant velocity of $0.32 \; c$ and using its de-projected size, we derive a kinematic age of $r_\mathrm{max} / c\beta_\mathrm{app} = 82 \pm 17$ years. This places TXS~0128+554 among the youngest known relativistic AGN jet systems. We compare its properties to other recently launched AGN jets in Section~\ref{agn_comparisons}. \subsection{\label{xraydatareduction}Chandra X-ray Analysis} The {\it Chandra} ACIS-S observations of TXS\,0128+554 were taken at four separate epochs and needed to be merged into one event file for detailed image analysis of the spatial properties of the source, and to look for any extended structures. We merged individual {\it Chandra} observations using {\tt reproject\_obs} in CIAO. For each observation we simulated the {\it Chandra} point spread function (PSF) using {\tt simulate\_psf}, and merged the individual simulations into one image file. We then used both images to generate the radial surface brightness profiles of the source and the PSF, assuming a set of annuli centered at the (J2000) coordinates: RA=1:31:13.8588, DEC=+55:45:13.532. We excluded the position angle covered by the known PSF asymmetry region given by {\tt make\_psf\_asymmetry\_region}. The final radial profiles were fit to check for any extended features and were found to be consistent with a point source. We show the merged {\it Chandra} image centered on TXS\,0128+554 in Fig.~\ref{xrayimage}. \begin{figure} \centering \includegraphics[width=\linewidth]{figures/chandra_image_color.pdf} \caption{\label{xrayimage} The {\it Chandra} ACIS-S X-ray image centered on TXS~0128+554 (image size 7.5\arcsec$\times$6.2\arcsec). The four individual observations have been merged. The image is binned to 0.246\arcsec, half of the native ACIS pixel size. The circle marks the region assumed for the spectral extraction (radius of 1.5\arcsec = 1.08\,kpc) and containing 95\% fraction of the PSF counts. The {\it Chandra} PSF artifact region is marked with the cyan color. The color intensity represents the number of counts per pixel with the color bar showing the scale.} \end{figure} We extracted the spectra and all the corresponding standard calibration files (i.e., {\tt arf} and {\tt rmf}) for each observation using {\tt specextract} in CIAO\footnote{\url{https://cxc.harvard.edu/ciao/}}, assuming the source and background regions defined above. We performed all spectral modeling of the {\it Chandra} X-ray data in {\it Sherpa}\footnote{\url{http://cxc.harvard.edu/sherpa/}} \citep{2001SPIE.4477...76F,2009pysc.conf...51R}. We used Cash and Cstat fitting statistics \citep{1979ApJ...228..939C} and the Nelder-Mead optimization method \citep{10.1093/comjnl/7.4.308}. We tabulate the fit parameters resulting from a simultaneous fit of all spectra in Table~\ref{t:models}. The fitted total X-ray luminosities are $3.2\times10^{42}\, \rm erg\,s^{-1}$ between 0.5 keV and 2 keV, and $2.1\times10^{42}\, \rm erg \, s^{-1}$ between 2 keV and 10 keV. \input{tables/Spectra.tex} In all models we assumed a constant Galactic absorption column of $2.6\times10^{20}$ cm$^{-2}$ (from COLDEN\footnote{\url{https://cxc.harvard.edu/toolkit/colden.jsp}}, \citealt{1992ApJS...79...77S}). We initially fit an absorbed power law model and obtained the best fit photon index, $\Gamma = 2.38\pm0.10$ and an intrinsic absorber at $z=0.0365$ with an equivalent column of hydrogen of ${\rm N}_H(z)=6.7\times10^{21}$\,cm$^{-2}$. The latter is in agreement with the {\ion{H}{1}} absorbing column density of $1.2 \times 10^{21} \rm \,cm^{-2}$ predicted from the $N_{\rm H{\hskip 0.02cm\scriptscriptstyle I}}$ -- linear size relation found by \cite{2003AA...404..871P}. Recent studies of neutral $N_{\rm H{\hskip 0.02cm\scriptscriptstyle I}}$ (21\,cm) and total $N_{H}$ (X-rays) absorbing columns in compact radio AGN indicate a correlation between the two column densities, with a scatter related to the spin temperature and a covering fraction of the absorbing gas \citep{2010ApJ...715.1071O,2017ApJ...849...34O}. Our X-ray measurement of $N_H(z)$ and the extrapolated $N_{\rm H{\hskip 0.02cm\scriptscriptstyle I}}$ value place TXS\,0128+544 at the upper part of this scatter, indicating a larger amount of neutral medium in comparison to the sources with similar $N_{H}$. A future detection of 21\,cm absorption could provide an important data point for this correlation. Interestingly, the TXS\,0128+544 X-ray absorption is in agreement with the relation between the radio source size, radio luminosity and a total $N_H$ column studied by \cite{2019ApJ...871...71S}, in which the more compact CSOs show higher absorption columns. However, these correlation results were based on a small number of CSOs observed in X-rays and they require confirmation with larger samples. The photon index of $\Gamma=2.38$ is steep in comparison to a more typical value of $\Gamma_\mathrm{ave} \sim 1.7$ found in other CSOs with {\it Chandra} spectra \citep{2016ApJ...823...57S}. The soft X-ray spectrum might due to a hot thermal gas in the central kpc-scale region. We therefore added a thermal component to the spectral model and obtained an upper limit on the temperature of $\rm kT = 0.08\, \rm keV$ (APEC\footnote{\url{https://heasarc.gsfc.nasa.gov/xanadu/xspec/manual/XSmodelApec.html}; \url{http://atomdb.org/}} model in {\it Sherpa}). The contribution from such thermal emission would dominate the spectrum at lower energies. However, the current {\it Chandra} spectra do not provide any constraint on the fraction of thermal radiation within the nuclear, $<1$\,kpc region, and no diffuse X-ray hot gas outside that region above the background flux level of $2.6\times10^{-15}$\,erg\,s$^{-1}$\,cm$^{-2}$. We also looked for an iron line at 6.4\,keV often indicating a presence of a reflection of the primary absorbed X-ray radiation off the cold medium (e.g., a large scale clumpy torus; see \citealt{2018ARA&A..56..625H} for a review). We fit the spectrum with an absorbed power law model (fixed $N_H(z)=7\times10^{21}$\,cm$^{-2}$) and an unresolved narrow Gaussian line (0.1\,keV width). The line was not detected and we obtained an upper limit on the normalization of the line of $< 1.2\times10^{-6}$\,photons\,s$^{-1}$\,cm$^{-2}$ corresponding to a 3$\sigma$ upper limit of 780\,eV on the line's equivalent width. We ran simulations, following \cite{2002ApJ...571..545P}, to test for the presence of the iron line, resulting in a $p$-value of 0.832. This indicated that the spectra are consistent with the absorbed power law model and no additional line is required by the current data. Thus we do not find any strong reflection signatures in the {\it Chandra} spectrum. Future high resolution, high S/N spectra with addition of the high energy X-rays are needed for any detection of spectral or reflection features and more detailed study of the X-ray nature of this source. \section{Discussion} \subsection{Cocoon model} The overall compact radio morphology of TXS~0128+554 can be attributed to a highly over-pressurized cocoon structure that is driving a bow shock into the surrounding galactic medium. In this scenario a thin shell exists around the cocoon and is the site of particle acceleration, with synchrotron emission being produced by the non-thermal electrons. Simple analytical models (e.g., \citealt{1989ApJ...345L..21B}, \citealt{2005MNRAS.364..659K}, \citealt{2008ApJ...680..911S}) have been developed to describe the evolution of the cocoon as it is inflated by a relativistic jet outflow. These generally contain several features associated with the jet and counter-jet: a head (hotspot) where the collimated outflow impacts the external medium, and a working surface over which the jet kinetic energy is dissipated. The latter is the leading curved edge of a radio lobe embedded within the cocoon (see, e.g., Fig. 1 of \citealt{1989ApJ...345L..21B}, and Fig. 1 of \citealt{2009MNRAS.395.1999C}). The jet head advances at a speed $v_h$ dictated by ram pressure equilibrium, such that $L_j/c = \rho v_h^2 A_h$, where $\rho$ is the external medium density, $L_j$ is the jet kinetic power, $c$ is the speed of light, and $A_h$ is the area of the working surface. The hotspots of radio galaxies (e.g., Cyg A, see \citealt{1996AARv...7....1C}) frequently exhibit a flat or inverted radio spectra ($\alpha > -0.5$), implying that they are principal sites of particle acceleration \citep{1989AA...219...63M}. Such active hotspots are not seen in TXS~0128+554. All of the inverted spectrum regions are located in the bright inner jet region close to the core. Those regions are also bright in the higher-frequency VLBI bands, indicating ongoing particle acceleration. In contrast, the radio lobes of the source have steep-spectra, and their low frequency emission is likely due to an aging population of electrons. The distinct gap between the inner and outer regions in the VLBI images above 6 GHz leads us to conclude that they are not causally connected. The brightness temperature and steep spectral index of C5 are comparable to the other bright features in the eastern lobe, whereas its radio brightness might be expected to be enhanced if it is actively being energized by the C10-C8 jet. Although the velocity vector of C8 does point to C5, the velocity vectors of these two features are not collinear, suggesting that their similar apparent speeds are merely a coincidence. We conclude that the jets in TXS~0128+554 turned off for a period during its lifetime, and have subsequently re-started. Such intermittent jet activity has been proposed in theoretical models for young radio sources, e.g., \citep{1997ApJ...487L.135R,2009ApJ...698..840C}. The radio lobes are remnants from the initial period of jet activity, while the inner jet (associated with core features C8, C9 and C10; \S~\ref{kinematics}) was launched more recently and is advancing during the present epoch. In Figure~\ref{jet-timeline} we show a schematic timeline of the jet activity in the source. The marked epochs refer to times in the rest frame of the central engine. The jet was initially launched at $t_1$, and turned off at $t_j$, producing the radio lobes that we see today. The bright C8 radio feature marks the outer edge of a restarted jet that was launched at $t_2$. Photons we currently receive from the core region were emitted at $t_{c,\mathrm{now}}$. The shorter light travel distance to the western lobe and its relativistic advance speed imply that its photons were emitted at a later time $t_f$. Conversely, we see a relatively younger version of the eastern lobe (i.e., at epoch $t_b$) since it is farther away and receding with respect to its western counterpart. For a constant advance speed, we would expect \citep{1967MNRAS.136..123R} $$t_f = t_{c,\mathrm{now}}/(1-\beta\cos{\theta}) = 1.25\, t_{c,\mathrm{now}} $$ and $$ t_b = t_{c,\mathrm{now}}/(1+\beta\cos{\theta}) = 0.84\, t_{c,\mathrm{now}}.$$ \begin{figure} \centering \includegraphics[width=\linewidth]{figures/jet-activity-schematic.pdf} \caption{\label{jet-timeline} Schematic diagram of the evolution of kinetic jet luminosity in TXS~0128+554 with times in the rest frame of the central engine (in arbitrary units and not to scale). The first jet turn-off happened at a time $t_j$ after its initial birth at $t_1$. A period of jet inactivity lasted until the jet re-started at $t_2$. The latter event generated the bright $\sim 2$ mas long inner jet visible in the VLBA 15.4 GHz image at the current epoch $t_{c,\mathrm{now}}$. Due to light time delays and the relativistic expansion speeds, radiation from the western (approaching) lobe, which originated from the initial jet activity epoch, is seen at a later epoch than the core emission, while the eastern (receding) lobe is viewed at an earlier epoch than the core. } \end{figure} Clearly $t_j$ is an important parameter since it (along with $L_{j,1}$) dictates how much total energy has been injected into the lobe structure. Given the young kinematic age of $82\pm 17$ y, there is insufficient time for the lobes to experience much spectral ageing at low radio frequencies, and we see little indication of curvature in our radio spectra of the bright lobe features. Assuming a magnetic field strength typical of CSOs, a spectral downturn would occur at 22 GHz in the lobes of TXS~0128+554 only after $\sim1700$ y \citep{1970ranp.book.....P}. We can place a conservative lower limit on the duration of the initial period of jet activity by equating the source cavity enthalpy to the energy injected during the initial epoch of jet activity, i.e., $4pV=L_{j,1}(t_j-t_1 )$. If we were to assume that the maximum jet kinetic luminosity TXS 0128+554 could have had in this phase was equal to that of the most powerful known CSOs ($L_{j,1} \simeq 10^{45}\, \rm erg\,s^{-1}$; \citealt{2020ApJ...892..116W}), we find $t_j - t_1 \geq 2.7$ y. We apply the model of \cite{2008ApJ...680..911S} to the first epoch of jet activity which is responsible for production of the outer radio lobes. Here the jet kinetic power is constant over time, and the external medium has a flat density profile $\rho = m_p n_o$, where $m_p$ is the proton mass and $n_o = 0.1$ cm$^{-3}$ (typical for CSO environments). This leads to a constant head advance speed over time. This is a reasonable assumption as we see no evidence of a significant change in speed in the moving features over the three year period of the MOJAVE 15 GHz VLBA observations, and over a 10 year period at 8 GHz (\S~\ref{kinematics}). The energy transported by the jet is transformed into the cocoon's internal pressure $p$, which also causes it to expand sideways with a velocity $v_c = (p/\rho)^{1/2}$. Additionally, the transverse size $l_c$ is taken to vary with time as $l_c\propto t^{1/2}$, so as to reproduce the ballistic phase of jet advance, following the numerical simulations of \cite{2002MNRAS.331..615S}. The model has three free parameters: $v_h$, $l_c$, and the linear size ($LS$), with the latter being defined as the separation of the jet head from the core. From the observations, the parameter values at epoch $t_f$ are $v_h = 0.32 \pm 0.07$ c, $l_c = 2.87 \pm 0.36$ pc, and $LS = 5.67 \pm 0.65$ pc. This yields a jet kinetic power of $(1.28\pm1.16) \times10^{43}\, \rm erg\,s^{-1}$, which agrees to within an order of magnitude with the predicted value based on previously published correlations with jet radio luminosity \citep{1999MNRAS.309.1017W, 2012MNRAS.423.2498D}. We note that this is an estimate of the jet kinetic power $L_{j,1}$ of the initial jet activity epoch ($t_1 < t < t_j$) only, since this method takes into consideration the features of the lobes only and not the (re-started) inner jet. The radio emission from the lobes, as in other GPS/CSS sources, is most likely of synchrotron origin. The lobe is injected with freshly accelerated electrons from the terminal jet hotspot, which then undergo adiabatic and radiative cooling. We assume a power-law energy distribution injection function that stays fairly constant with time during the initial jet activity (ballistic expansion) phase. By further assuming the electron energy density to be in rough equipartition with the magnetic energy density and lobe pressure, the lobe synchrotron luminosity is predicted to be log L=$41\pm1\, \rm erg\,s^{-1}$. This is in agreement with the integrated radio luminosity, $2.8\times10^{41}\, \rm erg\,s^{-1}$, which we obtained by fitting a single component synchrotron self-absorption (SSA) model to the single dish and VLBI radio flux densities as plotted in Figure 2. The fit yields a SSA turnover frequency of $\sim657\, \rm MHz$, which is in agreement with the $\sim630\, \rm MHz$ turnover that is predicted by the \cite{2008ApJ...680..911S} cocoon model. Equipartition magnetic field estimates based on a spherical cocoon geometry \citep[e.g.,][]{2012MNRAS.424..532O, 1970ranp.book.....P} yield values in the range $3\mbox{-}9$ mG. The \cite{2008ApJ...680..911S} cocoon model yields a similar range: $\sim5\mbox{-}20$ mG, depending on the choices for the magnetic field and electron energy equipartition parameters $\eta_B$ and $\eta_e$. This is comparable to the typical range of $1\mbox{-}10$ mG measured in GPS and CSO galaxies (\citealt{2002AA...389..115D}, \citealt{2006AA...450..959O}). It is somewhat surprising that TXS~0128+554 lies significantly outside the well-studied trend between turnover frequency and linear size (e.g., \citealt{ODe97}), which would predict a much higher turnover frequency of $\sim 50$~GHz. \cite{2008AA...482..483T} found a cluster of several GPS sources that lie in a similar location in the turnover -- linear size plane. In the case of TXS~0128+554 this may be due to the fact that the outer lobes have not been re-supplied by the central AGN for some time, which has affected their overall evolution and radio properties. With a 150 MHz radio luminosity of only $10^{23.6}$ W Hz$^{-1}$, TXS~0128+554 is at the low end of the luminosity range of a large sample of over 23 000 AGN from the LOFAR 1st data release studied by \cite{2019AA...622A..12H}. These authors found that most AGN in the luminosity range $10^{25} < L_{150} < 10^{27}$ W Hz$^{-1}$ are long-lived objects in relatively poor (group-like) environments, and there are relatively few physically small objects in this luminosity range. The large number of small objects at lower luminosities led them to conclude that they must either have a different lifetime distribution, or different jet physics from the more powerful objects. It may be possible, therefore, that many weak AGN like TXS~0128+554 never grow to large sizes, due to their episodic/short-lived jet activity. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figures/L_8ghz_vs_Lgamma.pdf} \caption{\label{vlbi8ghzvsgamraylum} Plot of VLBI 8 GHz luminosity versus $\gamma$-ray luminosity ($> 0.1$ GeV) for AGN in the 4LAC catalog. Small red circles denote BL Lac objects, small blue circles denote flat-spectrum radio quasars, and black dots denote other AGN. The blue cross denotes TXS~0128+554, and large light blue symbols represent \textit{Fermi}-detected CSOs. The other large symbols denote selected nearby radio galaxies detected by {\it Fermi}.} \end{figure} \begin{figure}[t] \centering \includegraphics[width=\linewidth]{figures/LAT_gamma_vs_Lgamma.pdf} \caption{\label{plindexvsgamraylum} Plot of power law photon index versus $\gamma$-ray luminosity ($> 0.1$ GeV) for AGN in the 4LAC catalog. Small red circles denote BL Lac objects, small blue circles denote flat-spectrum radio quasars, and black dots denote other AGN. The blue cross denotes TXS~0128+554, and large light blue symbols represent \textit{Fermi}-detected CSOs. The other large symbols denote selected nearby radio galaxies detected by {\it Fermi}.} \end{figure} \subsection{Origin of the high-energy emission} \cite{2008ApJ...680..911S} predict that the lobes in powerful GPS/CSS sources should also emit significant $\gamma$-ray emission via inverse Comptonization of seed photons by the lobe electrons. Stellar emission in the near-IR from the host galaxy, synchrotron emission from the lobe electrons, IR radiation from the dusty torus, UV radiation from the accretion disk and cosmic microwave background radiation are considered to be the main components for the seed photon field. However, when applied to our source, the model under-predicts the $\gamma$-ray flux observed by Fermi-LAT by three orders of magnitude. We therefore conclude that it is highly unlikely that the observed $\gamma$-ray emission of TXS~0128+554 originates in its lobes. The other possible sources of X-rays and $\gamma$-rays are the inner jet/optically thick core region and a shocked shell surrounding the cocoon. We can compare the un-absorbed X-ray luminosities of the cores and bright knots or hotspots of some of well-known, {\it Chandra}-resolved jets to that of TXS~0128+554 to examine whether the majority of the high energy emission may originate in the radio-loud inner core. We consider the cases of M87 and Cen A, which are both nearby and well-resolved in X-rays. The core of M87 has a luminosity of $4.4\times10^{40}\, \rm erg\,s^{-1}$ in the 0.5--10 keV band \citep{2002ApJ...564..683M}, while the HST-1 feature reached an order of higher magnitude X-ray luminosity during a large flare \citep{2006ApJ...640..211H}. Cen A is slightly more luminous in X-rays; the nucleus has a luminosity of $5\times10^{41}\, \rm erg\,s^{-1}$ in the 2--10 keV band \citep{2000ApJ...531L...9K} while the brighter knots have luminosities of the order of $10^{38}$--$10^{39}\, \rm erg\,s^{-1}$ in the 0.1--10 keV band \citep{2001ApJ...560..675K}. Hence, when compared to the unbeamed X-ray luminosity of TXS~0128+554 ($2.30\times10^{42}\, \rm erg\,s^{-1}$ and $1.51\times10^{42}\, \rm erg\,s^{-1}$ in the 0.5--2 keV and 2--10 keV bands, respectively), it is plausible that the core is the major source of the high energy emission. We note that the shell surrounding the south-west lobe of Cen A has also been observed to emit strongly in X-rays ($\sim10^{38}\, \rm erg\,s^{-1}$), and the majority of the X-ray emission has been shown to be non-thermal \citep{2009MNRAS.395.1999C}. The jet power of Cen A, calculated from the size of the cavity excavated by the jets, is found to be $\sim10^{43}\, \rm erg\,s^{-1}$. This is similar to that of TXS~0128+554, although Cen A is considerably older, with a kinematic age of $\sim2\times10^6\, \rm years$. \subsection{\label{agn_comparisons} Comparison of TXS~0128+554 with other CSOs} \input{tables/othersources.tex} TXS~0128+554 is the fourth confirmed CSO to be detected in $\gamma$-rays by the \textit{Fermi } LAT instrument. Current CSO catalogs (e.g., \citealt{2016MNRAS.459..820T}) contain on the order of $\sim 50$ AGN, making the \textit{Fermi}-detected ones a very rare subset. With the exception of PMN J1603$-$4904 at $z = 0.232$ (see discussion of the redshift in the Appendix), all of the \textit{Fermi } CSOs are at redshift less than $z<0.04$. In Figure~\ref{vlbi8ghzvsgamraylum} we plot 8~GHz radio luminosity versus $\gamma$-ray luminosity for all 4FGL AGN with a known redshift and a compact radio luminosity tabulated in the radio fundamental catalog\footnote{http://astrogeo.org/rfc/}), which is complete down to approximately 150~mJy \citep{VCS5,VCS6}. Most GPS and CSO AGN are not detected by \textit{Fermi }, yet have radio luminosities in the $10^{27}$ to $10^{28}$ W Hz$^{-1}$ range, comparable to the flat-spectrum blazars that dominate the \textit{Fermi } catalogs. TXS~0128+0554 and two of the other \textit{Fermi } CSOs have considerably lower radio powers, however, and lie among the lowest $\gamma$-ray luminosity AGN detected so far by \textit{Fermi}. The detection of AGN by the LAT instrument is strongly influenced by the spectral hardness (photon index $\Gamma$) of the source in the $\gamma$-ray regime. Weak-lined BL Lac objects tend to have harder $\gamma$-ray spectra (lower $\Gamma$) than flat-spectrum radio quasars, and are therefore detectable to lower flux levels. This is illustrated in Figure~\ref{plindexvsgamraylum}, where we present an updated version of the \cite{2020AA...635A.185P} plot of photon index versus $\gamma$-ray luminosity for all AGN in the 4LAC catalog \citep{4LAC}. The large light blue symbols represent the \textit{Fermi } CSOs, with the blue cross denoting TXS~0128+554. We have also highlighted several nearby \textit{Fermi}-detected radio galaxies in the plot for comparison. Cen A is among the closest jetted AGN and along with Fornax A are the only AGN where \textit{Fermi } has resolved $\gamma$-ray emission from the jet lobe structure \cite{2010Sci...328..725A,2016ApJ...826....1A}. M87 is a nearby well-studied jetted AGN in the Virgo cluster that lies in the same location in the $\Gamma$--$L_\gamma$ plane as Fornax A and the CSO NGC 3894. \input{tables/othersources_lum.tex} The large luminosity of PMN J1603$-$4904 clearly sets it apart from the other CSOs and nearby radio galaxies in Fig.~\ref{plindexvsgamraylum}, as its $\gamma$-ray properties have more in common with the BL Lac objects. Its spectral energy distribution is strongly Compton-dominated, and its $\gamma$-ray emission is known to be highly variable \citep{2009ApJ...699...31A,2018AA...610L...8K}. We have included the radio galaxy 3C 84, another highly variable $\gamma$-ray emitter, in the plot, as it presents an interesting case of restarted jet activity in its core, marked by large radio outbursts occurring in 1960 and 2005 \citep{2014ApJ...785...53N}. The former event led to the production of two CSO-like mini-lobes that are expanding supersonically into the surrounding medium \citep{2017ApJ...843...82K}. There has been considerable debate as to the source of the $\gamma$-ray rays in 3C 84, which may originate in the inner jet \citep{2018NatAs...2..472G} and/or its pc-scale lobes. Its jets show only mildly relativistic motion ($0.4 c$; \citealt{MOJAVE_XVII}), and the radio morphology, free-free absorption, and kinematics of the lobe emission suggest a high viewing angle of $60^\circ$ \citep{2017MNRAS.465L..94F}. Despite the relatively low levels of Doppler boosting in 3C 84 and TXS~0128+554, they both lie near the region populated by BL Lac objects in Figure~\ref{plindexvsgamraylum}. Along with PMN J1603$-$4904, they have substantially higher $\gamma$-ray luminosities than the other CSOs. It is likely that their strong $\gamma$-ray emission may be associated with a heightened activity state near the base of the jet, which is associated with their recently launched jets. A similar conclusion was reached by \cite{2020AA...635A.185P} in their comparison of NGC 3894 to other CSOs and \textit{Fermi}-detected AGN. In Table~\ref{t:othersources} and Table~\ref{t:othersources2} we have compiled information on all \textit{Fermi}-detected and other confirmed CSOs in the literature with $z < 0.1$. We provide detailed individual descriptions of these sources in the Appendix. This is not likely a complete list, as new CSOs (such as TXS~0128+554) are still being discovered. In particular, we have omitted three AGN that have been proposed as CSOs by \cite{2016MNRAS.459..820T}: VIPS J09062+4636, VIPS J11488+5924, VIPS J12201+2916, since they do not have published kinematic ages. We have also excluded the compact AGN OQ 208, as it has shown a significant radio flux density decline by a factor of $\sim$ 4.5 since 2000, which is highly atypical of CSOs (e.g., \citealt{2001AJ....122.1661F}). The three CSOs with $z < 0.1$ that do not have \textit{Fermi } LAT detections are 4C 31.04, PMN J1511+0518, and B2 0035+22. Comparing the properties of the nearby non-\textit{Fermi } detected CSOs, all have low pc-scale core fractions, which is typical for members of this AGN class \citep{2001AA...377..377S}. Whereas 4C 31.04 and B2 0035+22 both have kinematic ages of $\sim 500$ y, roughly an order of magnitude larger than the \textit{Fermi}-detected CSOs, PMN J1511+0518 has a relatively young age of only 55 y. It has an X-ray luminosity comparable to TXS~0128+554 and would be a strong candidate for future detection by the \textit{Fermi } LAT instrument. \section{SUMMARY} We have performed a {\it Chandra} X-ray and multi-frequency radio VLBA study of the AGN TXS~0128+554, which is associated with the \textit{Fermi } $\gamma$-ray source 4FGL J0131.2+5547. We summarize our major findings as follows: (i) Our multi-frequency VLBA observations between 2.3 GHz and 22.2 GHz reveal a compact radio structure typical of the compact symmetric object (CSO) class. Archival VLA and published GMRT observations indicate no extended radio emission on kpc-scales. On pc-scales the emission consists of a strong flat-spectrum core flanked by two steep-spectrum lobes, with a diameter of approximately 11~pc, that extends to $\sim 16$~pc at the lowest observing frequencies. (ii) The flat-spectrum core is atypically bright compared to the lobes for a typical CSO, and shows no apparent shift in position (upper limit = 0.03~mas) between 5.0~GHz and 22.2~GHz. The cores of most compact blazars typically show shifts of $\sim 0.3$~mas over this frequency range due to opacity effects. This suggests that the core feature in TXS~0128+554 is not the optically thick $\tau=1$ surface, but rather a recollimation or reconfinement shock. (iii) We analyzed 7 additional 15 GHz epochs from the MOJAVE archive, and found significant proper motions for three features over a three year period. The bright features C5 and C8 in the approaching (western) lobe are moving away from the core with apparent speeds of $0.32 c \pm 0.07 c$ and $0.28 c\pm 0.06 c$, respectively. Feature C1 in the receding lobe has an apparent motion of $0.174 c \pm 0.042 c$ toward the core. (iv) The relativistic expansion speeds suggest that the emission from the approaching and receding effects suffers from time delay effects, and are viewed at different epochs than photons from the core region of the source. By assuming intrinsic symmetry in the lobes, we used the apparent size and flux density asymmetry in the VLBA images to determine a jet axis viewing angle of $52^{+7}_{-9}$ degrees, and an intrinsic expansion speed of $0.32^{+0.08}_{-0.07} \, c$. This implies only mild Doppler boosting factors of $\delta = 1.2$ in the approaching jet and $\delta=0.79$ in the counter-jet. (v) Under the assumption of a constant advance speed in the western lobe, we derive a kinematic age of $82 \pm 17$~y, placing TXS~0128+554 among the youngest known relativistic AGN jet systems. (vi) We detected TXS~0128+554 in our targeted 19.3~ks {\it Chandra} ACIS-S imaging observations, and the structure is consistent with an unresolved point source. The spectrum between 0.5 keV and 7\,keV is well fit by an absorbed power law model with photon index $\Gamma = 2.38 \pm 0.10$. The fitted absorbing column of ${\rm N}_H(z)=6.7\times10^{21}$\,cm$^{-2}$ is in agreement with the expected {\ion{H}{1}} absorbing column density predicted from the $N_{\rm H{\hskip 0.02cm\scriptscriptstyle I}}$ -- linear size relation, as well as the trend between source size, radio luminosity and absorbing column studied by \cite{2019ApJ...871...71S}. We do not find evidence for a spectral feature at 6.4 keV that would be due to the presence of a reflection of the primary absorbed X-ray radiation off a cold medium. The relatively soft X-ray spectrum compared to other X-ray detected CSOs may be indicative of a thermal emission component, for which we were able to obtain an upper temperature limit of kT = 0.08 keV. (vii) A distinct emission gap between the bright inner jet and the outer lobe structure, as well as the lack of compact, inverted-spectrum hotspots indicate that TXS~0128+554 has undergone pc-scale episodic jet activity. The jets originally became active approximately 90 y ago, producing and energizing the outer lobe structures. After a period of quiescence, the jets were re-launched roughly 10 y ago, producing the bright inner jet features and increasing the synchrotron emission from the compact core. Intermittent jet activity has been proposed \citep{1997ApJ...487L.135R,2009ApJ...698..840C} and observed in young radio sources \citep{1998A&A...336L..37O}. TXS\,0128+554 is the first CSO with a measured kinematic age which can potentially provide constraints on the theoretical models. (viii) The 1.4 GHz radio luminosities of TXS~0128+554 and two of three other \textit{Fermi}-detected CSOs are in the range of $10^{23}$ W Hz$^{-1}$ to $10^{24}$ W Hz$^{-1}$, several orders of magnitude below the typical values for CSOs. These two $\gamma$-ray CSOs: NGC 3894, PKS 1718$-$649, both have redshifts below 0.02, while the third $\gamma$-ray CSO, PMN J1603$-$4904 has a redshift of 0.23, based on three blended lines in a near-featureless spectrum \citep{2016AA...586L...2G}. Comparing the properties of the $\gamma$-ray CSOs to three other known CSOs with $z < 0.1$, the latter have radio powers of $\sim 10^{25}$ W Hz$^{-1}$ and very weak/non-detected core features. We therefore find support for the suggestion put forward by \cite{2020AA...635A.185P} that the $\gamma$-ray emission in these CSOs is originating in the core region, and is a hallmark of recently started jet activity. Indeed, a fit to our measured properties of TXS 0128+554 based on the high-energy inverse Compton model of \cite{2008ApJ...680..911S} predicts a $\gamma$-ray lobe (cocoon) luminosity that is three orders of magnitude lower than that observed by \textit{Fermi }. \acknowledgments We thank Alexander V. Plavin, Eduardo Ros, and the anonymous referee for useful suggestions on the manuscript. This work was supported by NASA-\textit{Fermi} grant 80NSSC17K0517, NASA-\textit{Chandra} grant GO9-20085X, and NASA contract NAS8-03060 (Chandra X-ray Center). YK and AB were supported by the Russian Science Foundation grant 16-12-10481. The MOJAVE project was supported by NASA-\textit{Fermi} grants NNX08AV67G, NNX12A087G, NNX15AU76G, and 80NSSC19K1579. The Very Long Baseline Array and the National Radio Astronomy Observatory are facilities of the National Science Foundation operated under cooperative agreement by Associated Universities, Inc. This work made use of the Swinburne University of Technology software correlator \citep{2011PASP..123..275D}, developed as part of the Australian Major National Research Facilities Programme and operated under licence. This research has made use of data from the OVRO 40-m monitoring program \cite{2011ApJS..194...29R}, which is supported in part by NASA grants NNX08AW31G, NNX11A043G, and NNX14AQ89G as well as NSF grants AST-0808050 and AST-1109911. This research has made use of the NASA/IPAC Extragalactic Database (NED) which is operated by the Jet Propulsion Laboratory, California Institute of Technology, under contract with the National Aeronautics and Space Administration. The authors made use of the database CATS \cite{2005BSAO...58..118V} of the Special Astrophysical Observatory. This research has made use of data obtained by the {\it Chandra} X-ray Observatory, and software provided by the {\it Chandra} X-ray Center (CXC) in the application packages CIAO and {\it Sherpa}. \facilities{VLBA, \textit{Chandra}, \textit{Fermi}}.
\section{Introduction} Machine learning often relies on a large data set, especially for training deep models. However, training and prediction \Freddy{with limited} data (a.k.a low-resource learning) is common in applications such as labeling images with new concepts \cite{nikolaus2019compositional}, learning embeddings of new relations in a knowledge graph \cite{qin2020generative}, extracting long-tail information from text \cite{wu2008information}, \Freddy{and Visual Question Answering (VQA) \cite{DBLP:conf/eccv/TeneyH18} with outside knowledge \cite{okvqa}}. In supervised classification, prediction with new classes that have never appeared in the training data is often known as \textit{zero-shot learning} (ZSL) \cite{palatucci2009zero}. Those new classes are called \textit{unseen classes}, while those classes that have labeled training samples are called \textit{seen classes}. One popular solution for ZSL is building the classifier of an unseen class by combining the classifiers (or learned model parameters) of seen classes with some side information, including \textit{(i)} text (e.g., \cite{qin2020generative} learns the embedding of zero-shot relations via relation text description, \cite{lei2015predicting} predicts images of unseen classes via class text description), \textit{(ii)} human annotations (e.g., \cite{lampert2009learning} classifies images of new classes via their annotations of visual characteristics), and \textit{(iii)} graph data (e.g., \cite{kampffmeyer2019rethinking} aligns image classes with WordNet nodes and predicts for unseen classes by Graph Neural Network (GNN) while \cite{gengexplainable} further extends the idea with explanation). However, the semantic expressiveness of such side information is often too week to represent complex inter-class relationships, thus limiting the performance. Inspired by compositional learning, where learned components are combined by symbolic operations for a new component (e.g., the language model by \cite{socher2012semantic} represents a phrase or a sentence by recursively combing the vectors of its words via its parse tree), we propose to formally represent the semantics of each class label in ZSL by OWL 2 (Web Ontology Language) class definitions. With the ontology we first embed its logic axioms, textual information and paths, and encode classes into vectors (i.e., semantic encodings). We then follow a mapping-based ZSL paradigm which learns a mapping function from the input to the semantic encoding via the training samples, and predicts by comparing the input's semantic encoding with the semantic encodings of class labels. For example, given an image of a whale, we map it to a semantic encoding and compare it to those semantic encodings of class labels (Blue Whale, Humpback Whale and Killer Whale) -- the nearest neighbour is adopted as the image's class label. This paper \Freddy{introduces} a new ontology-guided neural-symbolic design pattern for the sample shortage problem in machine learning. Specially it develops a framework for using OWL ontology as an expressive side information for improving ZSL. Although this study is in an early stage, some promising results have been achieved in our evaluation with animal image classification and \Freddy{visual} question answering. \section{Background} \subsection{OWL Ontology} In this paper, we adopt OWL 2 EL ($\mathcal{EL}^{++}$ Description Logic) ontologies \cite{BaaBL05}. A signature $\Sigma$, noted $(\mathcal{CN}, \mathcal{RN}, \mathcal{IN})$, consists of $3$ disjoint sets of \textit{(i)} atomic concepts $\mathcal{CN}$, \textit{(ii)} atomic relations $\mathcal{RN}$, and \textit{(iii)} individuals $\mathcal{IN}$. Given a signature, the top concept $\top$, the bottom concept $\bot$, an atomic concept $A$, an individual $a$, an atomic relation $r$, $\mathcal{EL}^{++}$ concept expressions $C$ and $D$ can be composed with the following constructs: \begin{equation} \top\;|\;\bot\;|\;A\;|\;C\sqcap D\;|\;\exists r.C\;|\;\{a\}\nonumber \end{equation} An OWL 2 EL ontology consists of a TBox and an ABox, where the TBox is a finite set of General Concept Inclusion axioms (e.g. $C \sqsubseteq D$), relation inclusion and composition axioms (e.g., $r \sqsubseteq s$, $r_1\circ \cdots \circ r_n \sqsubseteq s$), etc. An ABox is a set of concept assertion axioms, relation assertion axioms, individual in/equality axioms, etc. \subsection{The Problem of ZSL} In machine learning classification, a classifier is trained to approximate a target function $f: x \rightarrow y$, where $x$ denotes the input data, $y$ denotes the output i.e., class label. ZSL is to classify data whose possible class labels have been omitted from the training data \cite{palatucci2009zero,xian2018zero}. Formally, we denote \textit{(i)} the samples for training as $\mathcal{D}_{tr} = \{(x, y) | x \in \mathcal{X}_s, y \in \mathcal{Y}_s\}$, where $\mathcal{X}_s$ and $\mathcal{Y}_s$ represent the training data and seen class labels, respectively; \textit{(ii)} the samples for testing (prediction) as $\mathcal{D}_{te} = \{(x, y) | x \in \mathcal{X}_u, y \in \mathcal{Y}_u\}$\footnote{The label set of $\mathcal{D}_{te}$ is often set to $\mathcal{Y}_u \cup \mathcal{Y}_s$, a.k.a generalized ZSL. Our method can deal with both ZSL and generalized ZSL. }, where $\mathcal{X}_u$ and $\mathcal{Y}_u$ represent the testing data and unseen class labels, respectively, with $\mathcal{Y}_u \cap \mathcal{Y}_s = \emptyset$; and \textit{(iii)} the side information as a function $h: y \rightarrow z$, where $z$ represents the semantic encoding of class label $y$. Our ZSL problem is to predict the class labels of samples in $\mathcal{X}_u$ as correctly as possible. \section{Methodology} As shown in Figure \ref{fig:framework}, our ZSL framework includes \textit{(i)} an OWL ontology for representing complex concepts, where each class label corresponds to a concept, \textit{(ii)} ontology embedding which encodes concepts into vectors with semantics of logic axioms, text and paths, and \textit{(iii)} a mapping-based ZSL method. \Freddy{We mainly describe the core component of the ZSL framework such as the semantic encoding, while the initial architecture for feature learning does need to be changed according to the task. } \begin{figure*}[!t] \centering \includegraphics[width=6.7in]{figure/framework.pdf} \caption{The ZSL Framework with Ontology and Ontology Embedding. The framework is illustrated on an image classification task but could be adapted to any machine learning architectures in \textit{Train} and \textit{Predict}. For instance we could envision applying ZSL on a VQA task where joint features of both question text and image are used as the input.} \label{fig:framework} \end{figure*} \subsection{Ontology for Semantic Composition}\label{sec:onto} We build an OWL 2 EL ontology ~\cite{BaaBL05} to define the corresponding complex concepts for class labels. Take the animal image classification as an example, the subsumption can model the taxonomic relations, e.g., $Killer\_Whale \sqsubseteq Toothed\_Whale$. The existential quantification can define the visual characteristics of animals, e.g., $\exists hasTexture.Patches$ and $\exists hasHabitat.Ocean$. Concept definitions can then be used to define composed classes, such as $Killer\_Whale \doteq Toothed\_Whale \sqcap \exists hasTexture.Patches \sqcap \cdots$. We choose OWL 2 EL due to \textit{(i)} its support of the existential quantification, \textit{(ii)} polynomial time complexity for entailment reasoning, and \textit{(iii)} and the availability of ontology embedding method for OWL 2 EL, rather than expressive languages like f-SWRL~\cite{PSTH05} In addition to logical axioms, textual information of concepts in ontologies are useful for ZSL too \cite{qin2020generative,xian2018zero,xian2016latent}. It often contains different but complementary semantics as the aforementioned logical axioms. OWL 2 EL ontologies allow the use of rich annotations, including the names, synonyms and descriptions of concepts and relations by e.g., \textit{rdfs:label} and \textit{rdfs:comment}. Given a specific ZSL task, the supporting ontology can be either edited by domain experts, or (more often) semi-automatically created and curated with expert knowledge, third party data and ontologies. In the above examples: the taxonomyic relations can come from WordNet \cite{miller1995wordnet}; the textual information can be extracted from DBpedia \cite{auer2007dbpedia}; the existential quantification can be created by domain experts or via reusing existing ontologies. \subsection{Ontology Embedding} With a given ontology, we implement the label encoding function $h: y \rightarrow z$ by \textit{(i)} embedding the logical axioms according to their geometric construction \cite{kulmanov2019embeddings}, and \textit{(ii)} fine-tuning the word vector model by textual information and graph paths. \subsubsection{Embedding of Logical Axioms} Ontology embedding is to approximate the interpretation of a given ontology by mapping logical axioms into a geometric space, based on which numeric losses are calculated and vector representations of concepts and relations are learned by optimization. Specially, a concept $C$ is modeled as a ball, namely a vector denoted as $\nu(C) \in \mathbb{R}^n$, where $n$ is the embedding dimension that can be configured, and a radius denoted as $\gamma(C) \in \mathbb{R}$. A relation $r$ is modeled as a vector $\nu(r) \in \mathbb{R}^n$. To extract samples for training, OWL 2 EL axioms are first normalized into four normal forms: $C \sqsubseteq D$, $C \sqsubseteq \exists r.D$, $ \exists r.D \sqsubseteq C$ and $C \sqcap D \sqsubseteq E$. This can be implemented by OWL ontology reasoners such as jCel \cite{mendez2012jcel}, TrOWL~\cite{TPR2010} and HermiT \cite{glimm2014hermit}. A loss function which separately deals with the axioms of each normal form is defined, denoted as $\mathcal{L}$. For simplicity, we present the loss calculation of $C \sqsubseteq D$ and $C \sqsubseteq \exists r.D$ bellow as they are the most commonly used in defining the complex concept for a ZSL problem: \begin{equation}\label{eq:CD} \begin{aligned} \mathcal{L}(C \sqsubseteq D) = \\ max(0, \parallel\nu (C) - \nu (D)\parallel + \gamma(C) - \gamma(D) - \epsilon) \\ + \left| \left\| \nu (C)\right\| - 1 \right| + \left| \left\| \nu (D)\right\| - 1 \right|, \end{aligned} \end{equation} \begin{equation}\label{eq:CRD} \begin{aligned} \mathcal{L}(C \sqsubseteq \exists r.D) = max(0, \\ \parallel\nu (C) + \nu (r) - \nu(D) \parallel + \gamma(C) - \gamma(D) - \epsilon) \\ + \left| \left\| \nu (C)\right\| - 1 \right| + \left| \left\| \nu (D)\right\| - 1 \right|, \end{aligned} \end{equation} where $\left\| \cdot \right\|$ denotes L2-norm, $\left| \cdot \right|$ denotes the absolute value, $max(\cdot, \cdot)$ denotes selecting the maximum value, $\epsilon$ is a hyper parameter for the max margin loss. The subsumption $\sqsubseteq$ is modeled by geometric inclusion of two balls (violation will be punished by increasing the loss), while the existential logic $\exists r.C$ is modeled by translation (i.e., a directed movement of the concept vector). The concept vectors are also normalized. Readers are refferred to \cite{kulmanov2019embeddings} for the loss functions of the remaining normal forms In training, axioms of the normal forms are extracted from the ontology as samples. A stochastic gradient descent algorithm is used to learn the embeddings of concepts and relations by minimizing the overall loss. The embedding vector of the concept that corresponds to a ZSL class label $y$ is denoted as $\nu (y)$. \subsubsection{Embedding of Text and Paths} We can directly use the word vector of a class label (or the average of vectors of its compositional words), using a pre-trained language model by a general corpus like Wikipedia articles; however, this would ignore the statistical correlation between words and concepts in the ontology. Thus we propose to fine-tune the pre-trained model by a corpus extracted from the ontology which includes the semantics of text and paths, following and extending the idea of OWL2Vec \cite{holter2019embedding}. To extract the local corpus we first project the original OWL ontology into an RDF (Resource Description Framework) graph using the method in \cite{agibetov2018supporting}. For example, the concept inclusion axiom $C \sqsubseteq D$ is transformed into $\langle C, \textit{rdfs:subClassOf}, D\rangle$, while the existential logic axioms $C \sqsubseteq \exists r. D$ and $\exists r.D \sqsubseteq C$ are both transformed into $\langle C, r, D\rangle$. As we only aim at keeping the relative position (statistical correlation) of concepts, relations and words in the ontology, such approximations are reasonable. We then apply a random walk algorithm over the graph to extract paths, and transform them into word sequences as the new corpus by concatenating the concept and relation labels. The corpus from the ontology is finally used to fine-tune a pre-trained language model, and its resulting vector of a class label $y$ is denoted as $\omega(y)$. We merge the embedding of logic axioms and the word vector by concatenating them; i.e., $h(y) = \left[ \nu(y), \omega(y) \right]$. \subsection{Mapping-based Training and Prediction} We adopt a mapping-based ZSL paradigm (see Figure 1) which includes \textit{(i)} the training of a mapping function from the input features (like image features) to the semantic encoding of seen class labels, and \textit{(ii)} the prediction of unseen class labels according to nearest neighbour. Instead of directly learning the target function $f:x \rightarrow y$ as in normal supervised learning, a mapping-based algorithm learns a function from the input to the class label's semantic encoding space, denoted as $g:x \rightarrow z$. Given the original training samples $\mathcal{D}_{tr}$, it first calculates the semantic encoding of the class labels and gets $\mathcal{D}_{tr}^{\prime} = \left\{ (x,z) | z=h(y), (x,y) \in \mathcal{D}_{tr} \right\}$, and then uses $\mathcal{D}_{tr}^{\prime}$ to train the function $g$. Some state-of-the-art mapping-based ZSL algorithms such as DeViSe \cite{frome2013devise} and SAE (Semantic Autoencoder) \cite{kodirov2017semantic} can be adopted. Take SAE as an example, briefly it learns a linear encoder from $x$ to $z$ and a decoder from $z$ back to $x$, by minimizing the loss of both the encoder (on $z$) and the decoder (on $x$), and adopts the encoder as the function $g$. In prediction, for each testing sample $x_u$ in $\mathcal{X}_u$, the learned function $g$ maps it to a semantic encoding $g(x_u)$, and $g(x_u)$ then is compared with the semantic encoding of each unseen class label in $\mathcal{Y}_u$. The unseen class label whose semantic encoding leads to the lowest distance to $g(x_u)$ is determined as the label of $x_u$: \begin{equation}\label{eq:prediction} f(x_u) = \underset{y_u \in \mathcal{Y}_u}{\arg\min} \text{ } dist(h(y_u), g(x_u)), \end{equation} where $dist(\cdot,\cdot)$ denotes a distance function such as L2-norm and cosine similarity. \section{\Freddy{Experimental Results}} \Freddy{Preliminary but promising results are reported on two different ZSL tasks to demonstrate the broad potential impact of ontology embeddings.} \subsection{\Freddy{Settings}} \vspace{+0.1cm} \Freddy{\noindent \bf{Animal Image Classification (AIC):}} \Freddy{We are using the AwA2\footnote{http://cvml.ist.ac.at/AwA2/} \cite{xian2018zero} benchmark, including $50$ mammals} that are partitioned into $40$ seen classes and $10$ unseen classes. Each class on average has $746$ training / testing images whose $2048$-dimension features (used as the input $x$ in our method) have been extracted by a deep residual neural network. The corresponding ontology, constructed with the taxonomy from WordNet and expertise of animal visual characteristics (cf. concrete examples in Methodology), includes $1488$ axioms, $180$ classes and $12$ relations. \vspace{+0.1cm} \Freddy{\noindent \bf{Visual Question Answering (VQA):}} We are considering a VQA task which is to predict an answer for a given pair of image and question. The answer is an object (concept) in the image \Freddy{or a Boolean for closed-ended questions}. Features of the image-question pair are learned from both question text and image by a BERT-based Concept-Vision-Language model (cf. \cite{lu2019vilbert} for the details of the model). The ZSL framework here is to predict answers that have never appeared in the training data. \Freddy{ We adopt the Outside Knowledge-VQA (OK-VQA) dataset \cite{okvqa} which contains $14,031$ images and $14,055$ questions (see example in Figure \ref{fig:fire}). There are $768$ seen classes and $339$ unseen classes. The ontology is built with ConceptNet knowledge graph \cite{speer2016conceptnet} and a core $\mathcal{EL}^{++}$ schema which has been operated on ConceptNet properties that connect answer concepts in OK-VQA questions. Specifically $2.3\%$ of ConceptNet properties are involved.} Figure \ref{fig:fire} presents an example of VQA, where the potential answers of Truck and Firefighter are two seen classes in our ZSL setting while Firetruck is an unseen class. \begin{figure}[h] \centering \includegraphics[scale=0.28]{./figure/okvqa_example1.jpg} \vspace{-0.2cm} \caption{OK-VQA Example. Question: \emph{What vehicle uses this item?} Answer: Firetruck. In our ontology Firetruck is related to FireHydrant by axioms e.g., $Firetruck \sqsubseteq Vehicle \;\sqcap\;\exists\; hasWaterSupply.(ConnectionPoint\;\sqcap FireHydrant)$.} \label{fig:fire} \end{figure} \subsection{\Freddy{Evaluation}} \vspace{+0.1cm} \Freddy{\noindent \bf{AIC:}} We calculate the micro accuracy of each unseen class as the ratio of its correctly annotated images, and then average the micro accuracy of all the unseen classes as the metric \textit{accuracy}. Table \ref{res} presents the results of using different semantic encodings: Label\_W2V denotes the average word vector of the class label; Attribute denotes the continuous attribute vector, each of whose slots denotes a real value degree of an attribute annotation on visual characteristics \cite{lampert2009learning}; and EL\_Embed denotes the embedding of ontology logic axioms. Note that the Label\_W2V now adopts \textit{Word2Vec} \cite{mikolov2013distributed} pre-trained by the Wikipedia dump in June 2018, while the language model fine-tuned by the ontology corpus will be implemented and evaluated in our future work. \vspace{+0.1cm} \noindent {\bf{VQA:}} We evaluate the performance of our ZSL framework by comparing the predicted answer with the ground truth answer, and calculating the metric \textit{accuracy} as the ratio of the testing image-question pairs whose answers are correct. Image-question pairs of both seen and unseen answers are tested. As in AIC, we compare different semantic encodings of the answer label. The state-of-the-art result comes from \cite{lu2019vilbert} where the word vector of the answer label is adopted \Freddy{(cf. results on VQA in row Label\_W2V in Table \ref{res}).} \subsection{Results and Discussion} In \Freddy{both cases i.e., AIC and VQA (cf. Table \ref{res})}, the embedding of logic axioms outperforms both label word vector and attribute vector, both of which are widely applied and studied semantic encoding solutions in ZSL \cite{xian2018zero}. Meanwhile, we also find concatenating the embedding to both label word vector and attribute vector significantly improves the accuracy. For example \Freddy{adding} EL\_Embed improves the accuracy of Label\_W2V by \Freddy{respectively $47.3\%$ and $45.5\%$ in AIC and VQA}. These observations indicate that the embedding of ontology logic axioms which model the compositional semantics of class labels is an effective and complementary side information for ZSL. \vspace{+0.1cm} \Freddy{\noindent {\bf{On AIC-specific Results:}}} The best ZSL accuracy on \Freddy{AIC case} is now achieved by GNNs \cite{kampffmeyer2019rethinking,wang2018zero}, but they rely on a big graph with around $21$k nodes (concepts) extracted from WordNet. Such a big graph is often unavailable or hard to be constructed in many real word applications. In contrast, our ontology only contains $96$ mammal concepts and uses expressive logic axioms to specify the compositional semantics. With this small graph, \cite{kampffmeyer2019rethinking} only achieves an accuracy of $6.2\%$ due to sample shortage. \vspace{+0.1cm} \Freddy{\noindent {\bf{On VQA-specific Results:}} The result with ontology embedding outperforms the state-of-the-art approach, specifically for unseen answers. The semantic encoding has been crucial for encoding semantic relationships among properties and concepts, and derive out-of-knowledge answers i.e., answers which are not given in training data, and only available in the ontology. } \begin{table}[h!] \small{ \centering \renewcommand{\arraystretch}{1.3} \begin{tabular}[t]{c|c|c}\hline Semantic Encoding & AIC & VQA \\ \hline Label\_W2V & $34.2\%$ & \Freddy{$30.5\%$} \\ \hline Attribute & $47.6\%$ & \Freddy{$32.1\%$} \\ \hline EL\_Embed & $48.3\%$ & \Freddy{$41.6\%$} \\ \hline Label\_W2V + EL\_Embed &$50.4\%$ & \Freddy{$44.4\%$} \\ \hline Attributes + EL\_Embed &$56.7\%$ & \Freddy{$48.1\%$} \\ \hline Label\_W2V + Attribute &$54.6\%$ & \Freddy{$34.9\%$} \\ \hline Label\_W2V + Attribute + EL\_Embed &$58.9\%$ & \Freddy{$50.1\%$} \\ \hline \end{tabular} \vspace{-0.2cm} \caption{\small The Accuracy of SAE with Different Semantic Encodings ($h$). $+$ denotes vector concatenation. }\label{res} } \end{table} \section{Conclusion and Future Work} In this paper we present a new ZSL framework which utilises an OWL ontology to express the compositional semantics of class labels. It first learns ontology embeddings that encode the semantics of logical axioms, graph paths and text, and then incorporates the embeddings into a mapping-based ZSL paradigm. Such a framework provides a new neural symbolic design pattern for dealing with low-resource learning, via synergistic integration of well expressed formal semantics and neural models. Some preliminary evaluation results have shown the effectiveness of introducing OWL ontology in ZSL. In the future, we will \textit{(i)} develop more robust ontology embeddings, \textit{(ii)} evaluate the framework with more ZSL algorithms such as the generation based \cite{geng2020generative}, and \textit{(iii)} explain the prediction and feature transfer with ontologies \cite{chen2018knowledge}. \section*{Acknowledgments} We want to thank Ian Horrocks from University of Oxford for helpful discussions. The work is supported by the AIDA project (Alan Turing Institute), the SIRIUS Centre for Scalable Data Access (Research Council of Norway), Samsung Research UK, Siemens AG, and the EPSRC projects AnaLOG (EP/P025943/1), OASIS (EP/S032347/1) and UK FIRES (EP/S019111/1). \balance \bibliographystyle{kr}
\section{Introduction}\label{sec:intro} A graph $G=(V,E)$ is \emph{$k$-thin} if there exist an ordering $v_1, \dots , v_n$ of $V$ and a partition of $V$ into $k$ classes $(V^1,\dots,V^k)$ such that, for each triple $(r,s,t)$ with $r<s<t$, if $v_r$, $v_s$ belong to the same class and $v_t v_r \in E$, then $v_t v_s \in E$. The minimum $k$ such that $G$ is $k$-thin is called the \emph{thinness} of $G$ and denoted by $\thin(G)$. The thinness is unbounded on the class of all graphs, and graphs with bounded thinness were introduced in~\cite{M-O-R-C-thinness} as a generalization of interval graphs. In~\cite{B-D-thinness}, the concept of \emph{proper thinness} is defined in order to obtain an analogous generalization of proper interval graphs, and it is proved that the proper thinness is unbounded on the class of interval graphs. A graph $G=(V,E)$ is \emph{proper $k$-thin} if there exist an ordering $v_1, \dots , v_n$ of $V$ and a partition of $V$ into $k$ classes $(V^1,\dots,V^k)$ such that, for each triple $(r,s,t)$ with $r<s<t$, if $v_r$, $v_s$ belong to the same class and $v_t v_r \in E$, then $v_t v_s \in E$, and if $v_s$, $v_t$ belong to the same class and $v_t v_r \in E$, then $v_s v_r \in E$. The minimum $k$ such that $G$ is proper $k$-thin is called the \emph{proper thinness} of $G$ and denoted by $\pthin(G)$. {The parameters of thinness and proper thinness represent how far a graph is from being an interval and proper interval graph, respectively. The class of (proper) $1$-thin graphs is that of (proper) interval graphs. This is so because, considering a $1$-partitioning, a (strongly) consistent ordering is sufficient to characterize (proper) interval graphs~\cite{Ola-interval,Rob-uig}.} When a representation of the graph as a $k$-thin graph is given, for a constant value $k$, a wide family of NP-complete problems can be solved in polynomial time, and the family of problems can be enlarged when a representation of the graph as a proper $k$-thin graph is given, for a constant value $k$~\cite{B-D-thinness,B-M-O-thin-tcs,M-O-R-C-thinness}. Hardness results for relaxed versions of this family of problems are shown in~\cite{Bentz-thin}, even for classes of graphs with thinness one or two. Many operations are defined over graphs, and some of them arise in structural characterizations of particular graph families or graph classes, for example union and join in the case of cographs~\cite{CorneilLerchsStewart81}. The operations known as \emph{graph products} are those for which the graph obtained by the operation of graphs $G_1$ and $G_2$ has as vertex set the Cartesian product $V(G_1) \times V(G_2)$. Different graph products are determined by the rules that define the edge set of the obtained graph. The main properties of these products are surveyed in~\cite{I-K-prod}. There is a wide literature about the behavior of graph parameters under graph operations, and in particular graph products. For the chromatic number, it includes the famous conjecture of Hedetniemi (1966)~\cite{Hed-conj}, that remained open more than fifty years, it was shown to hold for many particular classes, and was recently disproved by Shitov~\cite{Shitov2019}. Other results on the chromatic number and its variations in product graphs can be found in~\cite{A-H-L-prod,Mat-product,B-K-T-V-lagos15-dam,C-G-H-L-M-prod,C-F-prod,G-S-lex,Har,H-M-prod,I-K-prod,I-K-R-Cart,J-P-prod,J-T-color, Kla-col-prod,K-P-b-col,K-M-prod1,K-M-prod2,Sabidussi1964,V-V-col,Zhu-frac}, and on domination in product graphs in~\cite{H-R-dom-prod,Hed-thesis,I-K-prod,I-K-R-Cart}. For width parameters, there is a recent paper studying the boxicity and cubicity of product graphs~\cite{C-I-M-R-box-prod}. In~\cite{B-D-thinness}, the behavior of the thinness and proper thinness under the graph operations union, join, and Cartesian product is studied. These results allow, respectively, to fully characterize $k$-thin graphs by forbidden induced subgraphs within the class of cographs, and to show the polynomiality of the $t$-rainbow domination problem for fixed $t$ on graphs with bounded thinness. In this paper, we give bounds for the thinness and proper thinness of union and join of graphs, as well as the thinness and proper thinness of the lexicographical, Cartesian, direct, strong, disjunctive, modular, homomorphic and hom-products of graphs in terms of invariants of the component graphs. We also show that in some cases such bounds do not exist. Furthermore, we describe new general lower and upper bounds for the thinness of graphs. Also, we consider the concepts of independent and complete (proper) thinness, corresponding to the situations in which the classes are all independent or complete sets. Several of the results on the bounds of products of graphs are given additionally for these cases. The organization of the paper is as follows. In Section~\ref{sec:thin} we state the main definitions and present some basic results on thinness and proper thinness. In Section~\ref{sec:families}, we determine the (proper) thinness of some graph families, and prove some lower and upper bounds for the parameters. Section~\ref{sec:thin-and-oper} contains the main results of the paper, namely bounds of (proper) thinness for different binary operations, in terms of the (proper) thinness of their factors. Some concluding remarks form the last section. \section{Definitions and basic results}\label{sec:thin} All graphs in this work are finite, undirected, and have no loops or multiple edges. For all graph-theoretic notions and notation not defined here, we refer to West~\cite{West}. Let $G$ be a graph. Denote by $V(G)$ its vertex set, by $E(G)$ its edge set, by $\overline G$ its complement, by $\Delta(G)$ (resp. $\delta(G)$) the maximum (resp. minimum) degree of a vertex in $G$. A graph is \emph{$k$-regular} if every vertex has degree $k$. Denote by $N(v)$ the neighborhood of a vertex $v$ in $G$, and by $N[v]$ the closed neighborhood $N(v)\cup\{v\}$. If $X \subseteq V(G)$, denote by $N(X)$ the set of vertices of $G$ having at least one neighbor in $X$. A vertex $v$ of $G$ is \emph{universal} (resp. \emph{isolated}) if $N[v] = V(G)$ (resp. $N(v) = \emptyset$). {An \emph{homogeneous set}} is a proper subset $X \subset V(G)$ of at least two vertices such that every vertex not in $X$ is adjacent either to all the vertices in $X$ or to none of them. Denote by $G[W]$ the subgraph of $G$ induced by $W\subseteq V(G)$, and by $G - W$ or $G \setminus W$ the graph $G[V(G)\setminus W]$. A subgraph $H$ (not necessarily induced) of $G$ is a \emph{spanning subgraph} if $V(H)=V(G)$. Denote the size of a set $S$ by $|S|$. A \emph{clique} or \emph{complete set} (resp.\ \emph{stable set} or \emph{independent set}) is a set of pairwise adjacent (resp.\ nonadjacent) vertices. We use \emph{maximum} to mean maximum-sized, whereas \emph{maximal} means inclusion-wise maximal. The use of \emph{minimum} and \emph{minimal} is analogous. The size of a maximum clique (resp.\ stable set) in a graph $G$ is denoted by $\omega(G)$ (resp.\ $\alpha(G)$). A \emph{vertex cover} is a set $S$ of vertices of a graph $G$ such that each edge of $G$ has at least one endpoint in $S$. Denote by $\tau(G)$ the size of a minimum vertex cover in a graph $G$. A graph is called \emph{trivial} if it has only one vertex. A graph is \emph{complete} if its vertices are pairwise adjacent. Denote by $K_n$ the complete graph of size~$n$. Let $H$ be a graph and $t$ a natural number. The disjoint union of $t$ disjoint copies of the graph $H$ is denoted by $tH$. In particular, $\overline{tK_2}$ is the complement of a matching of size~$t$. Denote by $\mim(G)$ the size of a maximum induced matching of a graph $G$. {Denote by $P_n$ the path on $n$ vertices.} Given a connected graph $G$, let $\lip(G)$ be the length of the longest induced path of $G$, and $\diam(G)$ its diameter. A graph is a \emph{cograph} if it contains no induced $P_4$. For a positive integer $r$, the \emph{$(r \times r)$-grid} $GR_r$ is the graph whose vertex set is $\{(i,j) : 1 \leq i, j \leq r\}$ and whose edge set is $\{(i,j)(k,l) : |i - k| + |j - l| = 1, \mbox{ where } 1 \leq i,j,k, l \leq r \}$. The \emph{crown graph} $CR_n$ {(also known as Hiraguchi graph)} is the graph on $2n$ vertices obtained from a complete bipartite graph $K_{n,n}$ by removing a perfect matching. A \emph{dominating set} in a graph is a set of vertices such that each vertex outside the set has at least one neighbor in the set. A \emph{coloring} of a graph is an assignment of colors to its vertices such that any two adjacent vertices are assigned different colors. The smallest number $t$ such that $G$ admits a coloring with $t$ colors (a \emph{$t$-coloring}) is called the \emph{chromatic number} of $G$ and is denoted by $\chi(G)$. A coloring defines a partition of the vertices of the graph into stable sets, called \emph{color classes}. A graph $G(V,E)$ is a \emph{comparability graph} if there exists an ordering $v_1, \dots , v_n$ of $V$ such that, for each triple $(r,s,t)$ with $r<s<t$, if $v_r v_s$ and $v_s v_t$ are edges of $G$, then so is $v_r v_t$.\ Such an ordering is a \emph{comparability ordering}. A graph is a \emph{co-comparability graph} if its complement is a comparability graph. In the context of thinness, an ordering $v_1, \dots , v_n$ of $V(G)$ and a partition of $V(G)$ satisfying that for each triple $(r, s, t)$ with $r <s<t$, if $v_r$, $v_s$ belong to the same class and $v_tv_r \in E(G)$, then $v_tv_s \in E(G)$, are said to be \emph{consistent}. If both $v_1, \dots , v_n$ and $v_n, \dots , v_1$ are consistent with the partition, the partition and the ordering $v_1,\dots,v_n$ are said to be \emph{strongly consistent}. Notice that a graph is (proper) $k$-thin if and only if it admits a vertex ordering and a vertex partition into $k$ classes that are (strongly) consistent. We will often use the following definitions and results. Let $G$ be a graph and ${<}$ an ordering of its vertices. The graph $G_{<}$ has $V(G)$ as vertex set, and $E(G_{<})$ is such that for $v < w$ in the ordering, $vw \in E(G_{<})$ if and only if there is a vertex $z$ in $G$ such that $w < z$ in the ordering, $zv \in E(G)$ and $zw \not \in E(G)$. Similarly, the graph $\tilde{G}_{<}$ has $V(G)$ as vertex set, and $E(\tilde{G}_{<})$ is such that for $v < w$ in the ordering, $vw \in E(\tilde{G}_{<})$ if and only if either $vw \in E(G_{<})$ or there is a vertex $x$ in $G$ such that $x < v$ in the ordering, $xw \in E(G)$ and $xv \not \in E(G)$. An edge of $G_{<}$ (respectively $\tilde{G}_{<}$) represents that its endpoints cannot belong to the same class in a vertex partition that is consistent (respectively strongly consistent) with the ordering ${<}$. \begin{theorem}\label{thm:thin-comp-order}\cite{B-D-thinness,B-M-O-thin-tcs} Given a graph $G$ and an ordering ${<}$ of its vertices, the graphs $G_{<}$ and $\tilde{G}_{<}$ have the following properties: \begin{enumerate}[(1)] \item\label{item:2} the chromatic number of $G_{<}$ (resp. $\tilde{G}_{<}$) is equal to the minimum integer $k$ such that there is a partition of $V(G)$ into $k$ sets that is consistent (resp. strongly consistent) with the order ${<}$, and the color classes of a valid coloring of $G_{<}$ (resp. $\tilde{G}_{<}$) form a partition consistent (resp. strongly consistent) with ${<}$; \item $G_{<}$ and $\tilde{G}_{<}$ are co-comparability graphs; \item if $G$ is a co-comparability graph and ${<}$ a comparability ordering of $\overline{G}$, then $G_{<}$ and $\tilde{G}_{<}$ are spanning subgraphs of $G$. \end{enumerate} \end{theorem} Since co-comparability graphs are perfect~\cite{Meyn-co-comp}, $\chi(G_{<})=\omega(G_{<})$ and $\chi(\tilde{G}_{<})=\omega(\tilde{G}_{<})$. We thus have the following. \begin{corollary}\label{cor:thin-comp-order} Let $G$ be a graph, and $k$ a positive integer. Then $\thin(G) \geq k$ (resp. $\pthin(G) \geq k$) if and only if, for every ordering ${<}$ of $V(G)$, the graph $G_{<}$ (resp. $\tilde{G}_{<}$) has a clique of size $k$. \end{corollary} We will define also two new concepts related to (proper) thinness: independent (proper) thinness and complete (proper) thinness. These concepts are involved in some of the bounds of Section~\ref{sec:thin-and-oper}. A graph $G=(V,E)$ is \emph{$k$-independent-thin} if there exist an ordering of $V$ and a partition of $V$ into $k$ classes, consistent with the ordering, and such that each class is an independent set of the graph. The minimum $k$ such that $G$ is $k$-independent-thin is called the \emph{independent thinness} of $G$ and is denoted by $\indthin(G)$. Similarly, we can define the concept of \emph{proper $k$-independent-thin} and \emph{independent proper thinness} (denoted by $\indpthin(G)$), where the partition has to be consistent with the ordering and its reverse. Exchanging independent set by complete set, we define the concepts of \emph{$k$-complete-thin}, \emph{complete thinness} (denoted by $\compthin(G)$), \emph{proper $k$-complete-thin} and \emph{complete proper thinness} (denoted by $\comppthin(G)$). \begin{remark}\label{rem:co-comp-ind-thin} Notice that $\indpthin(G) \geq \indthin(G) \geq \chi(G)$ and, by Theorem~\ref{thm:thin-comp-order}, $\indpthin(G) = \indthin(G) = \chi(G)$ when $G$ is a co-comparability graph. Indeed, we can also see the independent (proper) thinness as a coloring problem in a graph whose vertex set is $V(G)$ and whose edge set is $E(G) \cup E(G_{<})$ (resp. $E(G) \cup E(\tilde{G}_{<})$). Similarly, $\comppthin(G) \geq \compthin(G) \geq \chi(\overline{G})$ and we can see the complete (proper) thinness as a coloring problem in a graph whose vertex set is $V(G)$ and whose edge set is $E(\overline{G}) \cup E(G_{<})$ (resp. $E(\overline{G}) \cup E(\tilde{G}_{<})$). Theorem~\ref{thm:tK2} and Corollary~\ref{cor:crown} show that the bounds $\compthin(G) \geq \chi(\overline{G})$ and $\indthin(G) \geq \chi(G)$ can be arbitrarily bad. Notice also that, given a (proper) $k$-thin representation of a graph, we can split each class into independent sets and obtain a (proper) $k$-independent-thin representation. Thus $\opindthin(G) \leq \chi(G)\opthin(G)$. Analogously, $\opcompthin \leq \chi(\overline{G})\opthin(G)$. \end{remark} \begin{figure}[t] \begin{center} \begin{tikzpicture} \node (max) at (0,4) {$|V(G)|$}; \node (a) at (-2,2) {$\indpthin(G)$}; \node (c) at (2,2) {$\comppthin(G)$}; \node (d) at (-2,0) {$\indthin(G)$}; \node (e) at (0,0) {$\pthin(G)$}; \node (f) at (2,0) {$\compthin(G)$}; \node (min) at (0,-2) {$\thin(G)$}; \draw (min) -- (d) -- (a) -- (max) (e) -- (min) -- (f) -- (c) -- (max); \draw[preaction={draw=white, -,line width=6pt}] (a) -- (e) -- (c); \end{tikzpicture} \end{center} \caption{Hasse diagram of the parameters involved (if $\alpha$ precedes $\beta$ in the diagram, then $\alpha\leq \beta$). We will state the strongest results, and the consequences for other parameters can be deduced from the diagram.}\label{fig:hasse} \end{figure} \section{Thinness of some graph families and general bounds}\label{sec:families} In this section, we determine or give lower bounds for the thinness and proper thinness of families of graphs, as induced matchings, crowns, and hypercubes. In addition, we determine both general lower and upper bounds for the thinness and proper thinness of graphs. Also, we relate the thinness to the independence and clique numbers of graphs. For the complement of an induced matching, the exact value of the thinness is known. \begin{theorem}\cite{C-M-O-thinness-man}\label{thm:tK2} For every $t \geq 1$, $\thin(\overline{tK_2})=t$. \end{theorem} The vertex partition used when proving the part ``$\thin(\overline{tK_2})=t$'' of the equation of Theorem~\ref{thm:tK2}, which is consistent with any vertex ordering, is the one where each class consists of a pair of nonadjacent vertices. It is easy to see that this partition is also strongly consistent with any vertex ordering. So we have the following corollary. \begin{corollary}\label{thm:tK2prop} For every $t \geq 1$, $\pthin(\overline{tK_2})=\indthin(\overline{tK_2})=\indpthin(\overline{tK_2})=t$. \end{corollary} \subsection{Lower bounds} { Let $G_1$ and $G_2$ be graphs on $n$ vertices, and $f: V(G_1) \to V(G_2)$ a bijection. Let $G_1 \boxminus_f G_2$ with vertex set $V(G_1) \cup V(G_2)$, such that $V(G_i)$ induces $G_i$ for $i = 1,2$, and the edges from $V(G_1)$ to $V(G_2)$ are exactly $\{vf(v)\}_{v \in V(G_1)}$. When $G_1$ or $G_2$ is either the complete graph $K_n$ or the empty graph $nK_1$, we can omit $f$ by symmetry. Notice that $\overline{tK_2} = \overline{tK_1 \boxminus tK_1}$, and the \emph{crown} $CR_n = \overline{K_n \boxminus K_n}$. \begin{theorem}\label{thm:gcrown} For $G_1$ and $G_2$ graphs on $n$ vertices and $f: V(G_1) \to V(G_2)$ a bijection, $\thin(\overline{G_1 \boxminus_f G_2}) \geq n/2$. \end{theorem} \begin{proof} Let $G = \overline{G_1 \boxminus_f G_2}$, and $<$ an arbitrary ordering of its vertices. We will show that $\omega(G_{<}) \geq n/2$. Let $A = V(G_1)$ and $A'=V(G_2)$, and for each vertex $v \in A$, let $v' = f(v)$ (the only vertex in $A'$ that is not adjacent to $v$ in $G$). By definition of $G_{<}$, if $v < v'$ then $v$ is adjacent in $G_{<}$ to every vertex $w$ in $A$ such that $w < v$, and to every vertex $w$ in $A$ such that $v < w < w'$. Analogously, if $v' < v$, then $v'$ is adjacent in $G_{<}$ to every vertex $w'$ in $A'$ such that $w' < v'$, and to every vertex $w'$ in $A'$ such that $v' < w' < w$. Therefore, the vertices $v \in A$ such that $v < v'$ form a clique in $G_{<}$, and the vertices $v' \in A'$ such that $v' < v$ form a clique in $G_{<}$. Since for each of the $n$ pairs of vertices $v,v'$ one of the inequalities holds, by the pigeonhole principle, $G_{<}$ has a clique of size at least $n/2$. \end{proof} \begin{corollary}\label{cor:crown} For every $n \geq 1$, $\thin(CR_n) \geq n/2$. \end{corollary} Since a \emph{fat spider} is the graph $\overline{K_n \boxminus nK_1}$, the theorem above implies that split graphs have unbounded thinness.} \medskip The \emph{vertex isoperimetric peak} of a graph $G$, denoted as $b_v(G)$, is defined as $b_v(G) = \max_s \min_{X\subset V, |X|=s} |N(X) \cap (V(G) \setminus X)|$, i.e., the maximum over $s$ of the lower bounds for the number of boundary vertices (vertices outside the set with a neighbor in the set) in sets of size $s$. \begin{theorem}\cite{C-M-O-thinness-man}\label{thm:peak} For every graph $G$ with at least one edge, $\thin(G)\geq b_v(G)/\Delta(G)$. \end{theorem} The thinness of the grid $GR_r$ was lower bounded by using Theorem~\ref{thm:peak}. \begin{corollary}\cite{C-M-O-thinness-man}\label{cor:grid} For every $r \geq 2$, $\thin(GR_r) \geq r/4$. \end{corollary} We will prove next some other lower bounds, which are very useful for bounding the thinness of highly symmetric graphs, as is the case of graph products of highly symmetric graphs. \begin{theorem}\label{thm:degree} Let $G$ be a graph. If $|N(u) \setminus N[v]| \geq k$ for all $u,v \in V(G)$ then $\thin(G) \geq k+1$. Moreover, for every order $<$ of $V(G)$, the first $k+1$ vertices induce a complete graph in $G_{<}$. \end{theorem} \begin{proof} Let $v_1, \ldots, v_n$ be an ordering of the vertices of $G$. Let $i,j$ be such that $1 \leq i < j \leq k+1$. We know that $|N(v_i) \setminus N[v_j]| \geq k$. Hence, $|(N(v_i) \setminus N[v_j]) \setminus (\{v_1, \ldots, v_{j-1}\} \setminus \{v_i\})| \geq 1$. Therefore, there exists a vertex $v_h$ with $h > j$ such that $v_h \in N(v_i)$ and $v_h \notin N(v_j)$, implying that $v_i$ and $v_j$ are adjacent in $G_{<}$. So, for every order $<$ of vertices of $G$, we have that the first $k+1$ vertices induce a complete graph in $G_{<}$. By Corollary~\ref{cor:thin-comp-order}, $\thin(G) \geq k+1$. \end{proof} \begin{corollary}\label{cor:k-reg} Let $G$ be a graph with $\delta(G) \geq d$ and such that for all $u,v \in V(G)$, $|N(u) \cap N(v)| \leq c < d$. Then $\thin(G) \geq d-c$. \end{corollary} The class of hypercubes $Q_n$ consists of the graphs whose vertex sets correspond to all binary strings with fixed size $n$ and two vertices $u$ and $v$ are adjacent if $u$ and $v$ differ exactly in one position. We say that $n$ is the \emph{dimension} of the hypercube $Q_n$. Clearly, $Q_n$ is a $n$-regular graph. \begin{lemma}\cite{Mulder-Qn} For all $u,v\in V(Q_n)$, $|N(u) \cap N(v)| \leq 2$. \end{lemma} \begin{corollary}\label{cor:Qn} For every $n \geq 1$, $\thin(Q_n) \geq n-2$. \end{corollary} \begin{theorem} Let $G$ be a graph. Let $S \subseteq V(G)$ and $p = |S|$. If $|N(u) \setminus N[v]| \geq k$ for all $u,v \in S$ and $|V(G)| - p \leq k$ then $\thin(G) \geq 1 + k + p - |V(G)|$. \end{theorem} \begin{proof} Let $v_1, \ldots, v_n$ be an ordering of the vertices of $G$. Let {$v_i,v_j \in S$ be} such that $1 \leq i < j \leq k+1$. We know that $|N(v_i) \setminus N[v_j]| \geq k$. Hence, $|(N(v_i) \setminus N[v_j]) \setminus (\{v_1, \ldots, v_{j-1}\} \setminus \{v_i\})| \geq 1$. Therefore, there exists a vertex $v_h$ with $h > j$ such that $v_h \in N(v_i)$ and $v_h \notin N(v_j)$, implying that $v_i$ and $v_j$ are adjacent in $G_{<}$. So, for every order $<$ of vertices of $G$, we have that the vertices in $S$ within the first $k+1$ vertices induce a complete graph in $G_{<}$. Since they are at least {$k+1-|V(G) \setminus S| = k+1-|V(G)|+p$, by Corollary~\ref{cor:thin-comp-order}, $\thin(G) \geq k+1-|V(G)|+p$.} \end{proof} \subsection{Upper Bounds} {Two general upper bounds were known for the thinness of a graph. \begin{theorem}\cite{C-M-O-thinness-man}\label{thm:n-log4} Let $G$ be a graph. Then $\thin(G) \leq |V(G)| - \log(|V(G)|)/4$. \end{theorem} \begin{theorem}\cite{C-M-O-thinness-man}\label{thm:bound-delta} Let $G$ be a graph. Then $\thin(G) \leq |V(G)|(\Delta(G)+3)/(\Delta(G)+4)$. \end{theorem} We will prove here other general upper bounds.} \begin{lemma}\label{n-S+thin} Let $S \subseteq V(G)$. Then $\thin(G) \leq |V(G)| - |S| + \thin(G[S])$. \end{lemma} \begin{proof} Consider an order $<$ of vertices of $G$ such that $v < s$ for all $v \in V(G) - S$ and $s \in S$, and such that $\omega(G[S]_{<_S}) = \thin(G[S])$, where $<_S$ stands for the order restricted to $S$. Such an order exists by Corollary~\ref{cor:thin-comp-order}. Notice that, since $v < s$ for all $v \in V(G) - S$ and $s \in S$, $G_{<}[S] = G[S]_{<_S}$. Then $\thin(G) \leq \omega(G_{<}) \leq \omega(G_{<}[S]) + \omega(G_{<}[V(G) \setminus S]) \leq \omega(G[S]_{<_S}) + |V(G)| - |S| = |V(G)| - |S| + \thin(G[S])$. \end{proof} \begin{corollary}\label{cor:subgint} Let $S \subseteq V(G)$ be such that $G[S]$ is an interval graph. Then $\thin(G) \leq |V(G)| - |S| + 1$. \end{corollary} An \emph{interval completion} of a graph $G$ is a spanning supergraph of $G$ which is an interval graph. \begin{lemma} Let $G$ be a graph. Let $H$ be an interval completion of $G$. Let $F$ be the subgraph of $H$ whose edges are $E(H) - E(G)$. Then {the number of vertices of a maximum induced interval subgraph of $G$} is at least $|V(G)| - \tau(F)$. \end{lemma} \begin{proof} Let $H$ be an interval completion of $G$. Then $H$ has $|V(G)|$ vertices. Let $F$ be the subgraph of $H$ whose edges are $E(H) - E(G)$. If we remove from $H$ the vertices of a vertex cover in $F$, we get an interval graph that is an induced subgraph of $G$. \end{proof} \begin{corollary} Let $G$ be a graph. Let $H$ be an interval completion of $G$. Let $F$ be the subgraph of $H$ whose edges are $E(H) - E(G)$. Then $\thin(G) \leq \tau(F) + 1$. \end{corollary} In particular, stable and complete sets induce interval graphs. Moreover, if $\alpha(G) < |V(G)|$ (resp. $\omega(G) < |V(G)|$), we can add one more vertex $v$ and reorder the vertices of the stable or complete set $S$ such that $u < w$ for all $u \in S - N(v)$ and $w \in N(s) \cap S$ and $s < v$ for all $s \in S$, so $G$ has an induced interval graph of size at least $\alpha(G) + 1$ (resp. $\omega(G) +1$). As corollaries of Corollary~\ref{cor:subgint}, we have the following two results. \begin{corollary}\label{cor:thin-alpha} If $V(G)$ is not a stable set then $\thin(G) \leq |V(G)| - \alpha(G)$. \end{corollary} \begin{corollary}\label{cor:thin-omega} If $G$ is not a complete graph then $\thin(G) \leq |V(G)| - \omega(G)$. \end{corollary} \begin{remark}\label{rem:bounds-indep} In the same way, one can see that $\indthin(G) \leq |V(G)| - \alpha(G)+1$ and $\compthin(G) \leq |V(G)| - \omega(G)+1$ (in this case we cannot add another vertex to the class containing the maximum stable set or maximum clique, respectively). \end{remark} We have also the following bound for co-comparability graphs. As already noticed in~\cite{B-M-O-thin-tcs}, Theorem~\ref{thm:thin-comp-order} implies that if $G$ is a co-comparability graph, then $\thin(G) \leq \chi(G)$. Recalling that co-comparability graphs are perfect~\cite{Meyn-co-comp}, this implies $\thin(G) \leq \omega(G)$. We prove next a new upper bound for the thinness of co-comparability graphs. \begin{theorem} If $G$ is a non trivial co-comparability graph, then $\thin(G) \leq |V(G)|/2$. \end{theorem} \begin{proof} If $G$ is complete and non trivial, then $\thin(G) = 1 \leq |V(G)|/2$. If $G$ is not complete, by Corollary~\ref{cor:thin-omega}, $\thin(G) \leq |V(G)| - \omega(G)$. Adding this inequality to the inequality $\thin(G) \leq \omega(G)$ that holds for co-comparability graphs, we have $2\thin(G) \leq |V(G)|$, thus $\thin(G) \leq |V(G)|/2$. \end{proof} The bound is attained, for example, by the family $\overline{tK_2}$ (Theorem~\ref{thm:tK2}). \section{Thinness and binary graph operations}\label{sec:thin-and-oper} In this section, we analyze the behavior of the thinness and proper thinness under different binary graph operations. {Each one of these operations will be defined over a pair of graphs $G_1 = (V_1,E_1)$ and $G_2 = (V_2,E_2)$ such that $|V_1| = n_1$, $|V_2| = n_2$ and $V_1 \cap V_2 = \emptyset$. Besides, for some of the following proofs, we consider an implicit ordering and partition for both $V_1$ and $V_2$, as defined next. The ordering of $V_1$ will be denoted by $v_1,\dots, v_{n_1}$ and that of $V_2$ by $w_1,\dots, w_{n_2}$. Moreover, if the value $t_i$ of some variation of thinness of $G_i$ (for $i \in \{1,2\}$) is involved in the bound to be proved, the implicit ordering is one consistent, according to the specified variation of thinness, with a partition $(V_i^1, \ldots, V_1^{t_i})$. If, otherwise, only the cardinality $n_i$ of $V_i$ is involved in the bound, the implicit ordering is an arbitrary one. For instance, if $G_1$ is a proper $t_1$-independent-thin graph, and $t_1$ is involved in the bound to be proved, it means that the implicit ordering and partition of $V_1$ are strongly consistent and all the $t_1$ parts of the partition are independent sets.} {Although the proofs in this section are not exactly the same, some of them indeed share a common structure in the reasoning. For the sake of conciseness, some of them were omitted and can be found in~\ref{apdx:sec4:proofs}. } \subsection{Union and join}\label{sec:unionjoin} The \emph{union} of $G_1$ and $G_2$ is the graph $G_1 \cup G_2 = (V_1 \cup V_2, E_1 \cup E_2)$, and the \emph{join} of $G_1$ and $G_2$ is the graph {$G_1 \vee G_2 = (V_1 \cup V_2, E_1 \cup E_2 \cup \{vv' : v \in V_1, v' \in V_2\})$} (i.e., $\overline{G_1\vee G_2} = \overline{G_1} \cup \overline{G_2}$). (The join is sometimes also noted by $G_1 \otimes G_2$, but we follow the notation in~\cite{B-D-thinness}). The class of \emph{cographs} can be defined as the graphs that can be obtained from trivial graphs by the union and join operations~\cite{CorneilLerchsStewart81}. Aiming to characterize $k$-thin graphs by forbidden induced subgraphs within the class of cographs, the following results were proved. \begin{theorem}\label{thm:union}\cite{B-D-thinness} Let $G_1$ and $G_2$ be graphs. Then $f(G_1 \cup G_2) = \max\{f(G_1),$ $f(G_2)\}$, for $f \in \{\thin,\pthin\}$. \end{theorem} \begin{theorem}\label{thm:join}\cite{B-D-thinness} Let $G_1$ and $G_2$ be graphs. Then $f(G_1 \vee G_2) \leq f(G_1)+f(G_2)$, for $f \in \{\thin,\pthin\}$. Moreover, if $G_2$ is complete, then $\thin(G_1 \vee G_2) = \thin(G_1)$. \end{theorem} \begin{lemma}\label{lem:join}\cite{B-D-thinness} If $G$ is not complete, then $\thin(G \vee 2K_1) = \thin(G)+1$. \end{lemma} Lemma~\ref{lem:join} implies that if there is some constant value $k$ such that recognizing $k$-thin graphs is NP-complete, then for every $k' > k$, recognizing $k'$-thin graphs is NP-complete. The existence of such $k$ is still not known, and in general the complexity of recognition of $k$-thin and proper $k$-thin graphs, both with $k$ as a parameter and with constant $k$, is open. \begin{remark}\label{rem:clique-top} By definition of $G_{<}$, every non-smallest vertex of any non-trivial clique has a vertex in $V(G)$ greater than it and non-adjacent to it in $G$. \end{remark} The following lemma is necessary to prove Theorem~\ref{thm:join2}. \begin{lemma}\label{lem:clique-top} Let $G=(V,E)$ be a graph with $\thin(G)=k$ and $v_1 < \dots < v_n$ be an ordering of $V$. If $G$ is not complete, then there exist a clique of size $k$ of $G_{<}$, $v_{i_1} < \dots < v_{i_k}$, and $v_j > v_{i_1}$, such that $v_j v_{i_1} \not \in E$. \end{lemma} \begin{proof} By Corollary~\ref{cor:thin-comp-order}, for every order $<$ of the vertices of $G$, $\omega(G_{<}) \geq k$. If $\thin(G)=1$, the statement follows because $G$ is not complete. Suppose $\thin(G) > 1$, and let $v_1 < \dots < v_n$ be an ordering of $V$. By definition of $G_{<}$, for every clique of $G_{<}$, all the vertices that are not the smallest one have a vertex in $V(G)$ which is greater than it and non-adjacent to it in $G$. So, if $G_{<}$ contains a clique of size greater than $k$, the statement follows. {Consider} now that $\omega(G_{<})=k$. {In order to reach a contradiction, suppose that} no clique of size $k$ of $G_{<}$ satisfies the property, then each vertex in the {set $S = \{v \in V(G_<):v\text{ is the first vertex in $<$ of a clique of size $k$ of $G_<$}\}$} is adjacent to every vertex greater than it in $G$. So, modifying the order by placing $S$ as the largest vertices produces a graph $G_{<'}$ which is a subgraph of $G_{<}$ and {in which the vertices of $S$ are isolated vertices}. In particular, $\omega(G_{<'}) < \omega(G_{<}) = k$, a contradiction since, {by Corollary~\ref{cor:thin-comp-order}, $\omega(G_{<'}) \geq k $}. \end{proof} We strength the result of Theorem~\ref{thm:join} for thinness. \begin{theorem}\label{thm:join2} Let $G_1$ and $G_2$ be graphs. If $G_1$ is complete, then $\thin(G_1 \vee G_2) = \thin(G_2)$. If neither $G_1$ nor $G_2$ are complete, then $\thin(G_1 \vee G_2) = \thin(G_1) + \thin(G_2)$. \end{theorem} \begin{proof} Let $G = G_1 \vee G_2$. If one of them is complete (suppose without loss of generality $G_1$), then, by Theorem \ref{thm:join}, $\thin(G) = \thin(G_2)$. Otherwise, by Theorem \ref{thm:join}, $\thin(G_1 \vee G_2) \leq \thin(G_1)+\thin(G_2)$. Let us prove the equality. Let $k_1 = \thin(G_1)$, $k_2 = \thin (G_2)$, and $k = \thin(G_1 \vee G_2)$. Let $<$ be an ordering consistent with a $k$-partition of $V(G)$. Let ${G_1}_{<}$ and ${G_2}_{<}$ {be the incompatibility graphs} obtained from the order $<$ restricted to $V_1$ and $V_2$, respectively. By Lemma \ref{lem:clique-top}, there exist a $k_1$-clique of ${G_1}_{<}$, $v^1_{i_1} < \dots < v^1_{i_{k_1}}$, and $v^1_j > v^1_{i_1}$, such that $v^1_j v^1_{i_1} \not \in E_1$. As well, there exist a $k_2$-clique of ${G_2}_{<}$, $v^2_{i_1} < \dots < v^2_{i_{k_2}}$, and $v^2_j > v^2_{i_1}$, such that $v^2_j v^2_{i_1} \not \in E_2$. Notice also that, by definition of ${G_i}_{<}$, $i=1,2$, every non-smallest vertex of the clique of ${G_i}_{<}$ has a vertex in $V_i$, greater than it and non-adjacent to it in $G_i$. Considering this property and the fact that every vertex of $G_1$ is adjacent to every vertex of $G_2$ in $G$, it follows that every vertex of $\{v^1_{i_1}, \dots, v^1_{i_{k_1}}\}$ is adjacent to every vertex of $\{v^2_{i_1}, \dots, v^2_{i_{k_2}}\}$ in $G_{<}$, hence $k \geq k_1+k_2$. This completes the proof of the theorem. \end{proof} \begin{remark} The proper thinness of the join $G_1 \vee G_2$ cannot be expressed as a function whose only parameters are the proper thinness of $G_1$ and $G_2$ (even excluding simple particular cases, like trivial or complete graphs). The graph $tK_1$ has proper thinness~1 for every $t$. By Theorem~\ref{thm:join}, the proper thinness of the join of two graphs of proper thinness~1 is either 1~or~2, and there are examples for both of the values. The graph $P_3 = 2K_1 \vee K_1$ has proper thinness~1 but $3K_1 \vee K_1$, known as \emph{claw}, or $C_4 = 2K_1 \vee 2K_1$ have proper thinness~2 (the claw and $C_4$ are not proper interval graphs). Similarly, by Theorem~\ref{thm:join}, the proper thinness of the join of a graph of proper thinness~2 and a graph of proper thinness~1 is either 2~or~3, and there are examples for both of the values. The graph $(\mbox{claw} \cup tK_1) \vee K_1$ has proper thinness~2, but the graph $3\mbox{claw} \vee K_1$ has proper thinness~3~\cite{B-D-thinness}. \end{remark} Nevertheless, we have a lemma similar to Lemma~\ref{lem:join} for proper thinness. \begin{lemma}\label{lem:joinp}\cite{B-D-thinness} For every graph $G$, $\pthin(3G \vee K_1) = \pthin(G)+1$. \end{lemma} \begin{proof} Theorems~\ref{thm:union} and~\ref{thm:join} imply $\pthin(3G \vee K_1) \leq \pthin(G)+1$. To show $\pthin(3G \vee K_1) \geq \pthin(G)+1$, we will use Corollary~\ref{cor:thin-comp-order}. Let $u$ be the corresponding vertex of the $K_1$ in $H=3G \vee K_1$, and let $<$ be an ordering of the vertices of $H$. Let $w,w'$ be the minimum and maximum vertices, respectively, according to $<$ restricted to $H \setminus \{u\}$. Let $S$ be the set of vertices of the copy of $G$ in $H$ which contains neither $w$ nor $w'$. We will show that in $\tilde{H}_{<}$, all the vertices of $S$ are adjacent to $u$. Let $v$ be a vertex of $S$. If $u < v$, then $u < v < w'$, $w'v \not \in V(H)$ and $w'u \in V(H)$. If $v < u$, then $w < v < u$, $wv \not \in V(H)$ and $wu \in V(H)$. In either case, by definition of $\tilde{H}_{<}$, $uv \in V(\tilde{H}_{<})$. By Corollary~\ref{cor:thin-comp-order}, $\tilde{H}_{<}[S]$ contains a clique of size $\pthin(G)$, and thus $\tilde{H}_{<}[S \cup \{u\}]$ contains a clique of size $\pthin(G)+1$. As the order $<$ was arbitrary, again by Corollary~\ref{cor:thin-comp-order}, $\pthin(H) \geq \pthin(G)+1$. \end{proof} We will now study the behavior of independent and complete (proper) thinness under the union and join operations. \begin{theorem}\label{thm:union-ind} Let $G_1$ and $G_2$ be graphs. Then $f(G_1 \cup G_2) = \max\{f(G_1),$ $f(G_2)\}$, for $f \in \{\indthin, \indpthin\}$. \end{theorem} \begin{proof} Since both $G_1$ and $G_2$ are induced subgraphs of $G_1 \cup G_2$, then $\indthin(G_1 \cup G_2) \geq \max\{\indthin(G_1),\indthin(G_2)\}$ and the same holds for the independent proper thinness. Let $G_1$ and $G_2$ be two graphs with independent thinness (resp. independent proper thinness) $t_1$ and $t_2$, respectively. Suppose without loss of generality that $t_1 \leq t_2$. For $G = G_1 \cup G_2$, define a partition $(V^1,\dots, V^{t_2})$ such that $V^i = V_1^i \cup V_2^i$ for $i = 1, \dots, t_1$ and $V^i = V_2^i$ for $i = t_1+1, \dots, t_2$, and define $v_1,\dots, v_{n_1},w_1,\dots, w_{n_2}$ as an ordering of the vertices. By definition of union of graphs, the sets of the partition are independent and, if three ordered vertices according to the order defined in $V(G_1 \cup G_2)$ are such that the first and the third are adjacent, either the three vertices belong to $V_1$ or the three vertices belong to $V_2$. Since the order and the partition restricted to each of $G_1$ and $G_2$ are the original ones, the properties required for consistency (resp. strong consistency) are satisfied. \end{proof} \begin{theorem}\label{thm:union-comp} Let $G_1$ and $G_2$ be graphs. Then $f(G_1 \cup G_2) = f(G_1)+f(G_2)$, for $f \in \{\compthin,\comppthin\}$. \end{theorem} \begin{proof} Let $G_1$ and $G_2$ be two graphs with complete thinness (resp. complete proper thinness) $t_1$ and $t_2$, respectively. By definition of $G_1 \cup G_2$, any vertex ordering and partition into complete sets of $G_1 \cup G_2$ which are (strongly) consistent are (strongly) consistent when restricted to $V_1$ and $V_2$. Notice that no complete set of $G_1 \cup G_2$ contains both a vertex of $V_1$ and a vertex of $V_2$. So, $\compthin(G_1 \cup G_2)$ (resp. $\comppthin(G_1 \cup G_2)$) is at least $t_1 + t_2$. On the other hand, consider orderings and partitions of $V_1$ and $V_2$ into $t_1$ and $t_2$ complete sets, respectively, which are consistent (resp. strongly consistent). For $G_1 \cup G_2$, define a partition with $t_1+t_2$ complete sets as the union of the two partitions and define as ordering of the vertices the concatenation of the orderings of $V_1$ and $V_2$ ({i.e., $v < v'$ if either $v$ and $v'$ belong to $V_i$ and $v < v'$, for $i\in \{1,2\}$, or $v \in V_1$ and $v'$ in $V_2$}). By definition of union of graphs, if three ordered vertices according to the order defined in $V(G_1 \cup G_2)$ are such that the first and the third are adjacent, either the three vertices belong to $V_1$ or the three vertices belong to $V_2$. Since the order and the partition restricted to each of $G_1$ and $G_2$ are the original ones, the properties required for consistency (resp. strong consistency) are satisfied. Thus $\compthin(G_1 \cup G_2)$ (resp. $\comppthin(G_1 \cup G_2)$) is at most $t_1 + t_2$, which completes the proof. \end{proof} \begin{theorem}\label{thm:join-ind} Let $G_1$ and $G_2$ be graphs. Then $f(G_1 \vee G_2) = f(G_1)+f(G_2)$, for $f \in \{\indthin, \indpthin\}$. \end{theorem} \begin{proof} Let $G_1$ and $G_2$ be two graphs with independent thinness (resp. independent proper thinness) $t_1$ and $t_2$, respectively. By definition of $G_1 \vee G_2$, any vertex ordering and partition into independent sets of $G_1 \vee G_2$ which are (strongly) consistent are (strongly) consistent when restricted to $V_1$ and $V_2$. Notice that no independent set of $G_1 \vee G_2$ contains both a vertex of $V_1$ and a vertex of $V_2$. So, $\indthin(G_1 \vee G_2)$ (resp. $\indpthin(G_1 \vee G_2)$) is at least $t_1 + t_2$. On the other hand, consider orderings and partitions of $V_1$ and $V_2$ into $t_1$ and $t_2$ independent sets, respectively, which are consistent (resp. strongly consistent). For $G = G_1 \vee G_2$, define a partition with $t_1+t_2$ {independent sets} as the union of the two partitions and define as ordering of the vertices the concatenation of the orderings of $V_1$ and $V_2$. Let $x,y,z$ be three vertices of $V(G)$ such that $x < y < z$, $xz \in E(G)$, and $x$ and $y$ are in the same class of the partition of $V(G)$. Then, in particular, $x$ and $y$ both belong either to $V_1$ or to $V_2$. If $z$ belongs to the same graph, then $yz \in E(G)$ because the ordering and partition restricted to each of $G_1$ and $G_2$ are consistent. Otherwise, $z$ is also adjacent to $y$ by the definition of join. We have proved that the defined partition and ordering are consistent. The respective proof of the strong consistency, given the strong consistency of the partition and ordering of each of $G_1$ and $G_2$, is symmetric. Then $\indthin(G_1 \vee G_2)$ (resp. $\indpthin(G_1 \vee G_2))$ is at most $t_1+t_2$, which completes the proof. \end{proof} Lemma~\ref{lem:joinp} and Theorems~\ref{thm:union-comp} and~\ref{thm:join-ind} imply the following corollary. \begin{corollary} If there is some constant value $k$ such that recognizing proper $k$-thin graphs (resp. (proper) $k$-independent-thin and (proper) $k$-complete-thin graphs) is NP-complete, then for every $k' > k$, recognizing proper $k'$-thin graphs (resp. (proper) $k'$-independent-thin and (proper) $k'$-complete-thin graphs) is NP-complete. \end{corollary} Recall that the existence of such $k$ is still not known for all these classes. \begin{theorem}\label{thm:join-comp} Let $G_1$ and $G_2$ be graphs. Then $f(G_1 \vee G_2) \leq f(G_1)+f(G_2)$, for $f \in \{\compthin, \comppthin\}$. Moreover, if $G_2$ is complete, then $\compthin(G_1 \vee G_2) = \compthin(G_1)$. \end{theorem} \subsection{Graph composition or lexicographical product}\label{sec:lex} {Let $v \in V_1$.} The \emph{lexicographical product} of $G_1$ and $G_2$ \emph{over the vertex} $v$ is the graph $G_1 \bullet_v G_2$ obtained from $G_1$ by replacing vertex $v$ by graph $G_2$, i.e., $V(G_1 \bullet_v G_2) = V_2 \cup V_1 \setminus \{v\}$, and $x$, $y$ are adjacent if either $x, y \in V_1 \setminus \{v\}$ and $xy \in E_1$, or $x, y \in V_2$ and $xy \in E_2$, or $x \in V_1 \setminus \{v\}$, $y \in V_2$, and $xv \in E_1$. \begin{theorem}\label{thm:lexv} Let $G_1$ and $G_2$ be two graphs. Then $f(G_1 \bullet_v G_2) \leq f(G_1) + f(G_2)$, for $f \in \{\thin,$ $\pthin,$ $\compthin,$ $\comppthin\}$, and $f(G_1 \bullet_v G_2) \leq f'(G_1) + f(G_2)-1$, for $(f,f') \in \{(\thin,\indthin),$ $(\indthin,\indthin),$ $(\pthin,\indpthin),$ $(\indpthin,\indpthin)\}$. Moreover, if $G_2$ is complete, $f(G_1 \bullet_v G_2) = f(G_1)$, for $f \in \{\thin,$ $\pthin,$ $\compthin,$ $\comppthin\}$. \end{theorem} \begin{proof} Let $G_1$ and $G_2$ be two graphs with thinness (resp. proper thinness) $t_1$ and $t_2$, respectively. For $G = G_1 \bullet_v G_2$, if $v$ is the $i$-th vertex in the ordering of $V_1$ and belongs to the class $V_1^j$, define $v_1,\dots,v_{i-1}, w_1,\dots, w_{n_2},v_{i+1}, \dots, v_{n_1}$ as an ordering of the vertices of $G$, and a partition with at most $t_1+t_2$ sets as the union of the two partitions, where $V_1^j$ is replaced by $V_1^j \setminus \{v\}$ (or eliminated if $v$ is the only vertex in the class, justifying the partition to have \emph{at most} $t_1+t_2$ classes). Let $x,y,z$ be three vertices of $V(G)$ such that $x < y < z$, $xz \in E(G)$, and $x$ and $y$ are in the same class of the partition of $V(G)$. Then, in particular, $x$ and $y$ both belong either to $V_1 \setminus \{v\}$ or to $V_2$. If $z$ belongs to the same graph, then $yz \in E(G)$ because the ordering and partition restricted to each of $G_1$ and $G_2$ are consistent. Otherwise, if $x$ and $y$ belong to $V_2$ and $z$ belongs to $V_1 \setminus \{v\}$, then $z$ is adjacent to $y$ because $V_2$ is an homogeneous set in $G$. If $x$ and $y$ belong to $V_1 \setminus \{v\}$ and $z$ belongs to $V_2$, by the definition of the order in $G$, $y < v$ in the order of $V_1$, so $v$ is adjacent to $y$ in $G_1$. By the definition of $G$, $y$ is adjacent to $z$. We have proved that the defined partition and ordering are consistent, and thus that $\thin(G_1 \bullet_v G_2) \leq \thin(G_1)+\thin(G_2)$. The proof of the strong consistency, given the strong consistency of the partition and ordering of each of $G_1$ and $G_2$, is symmetric and implies $\pthin(G_1 \bullet_v G_2) \leq \pthin(G_1)+\pthin(G_2)$. Notice that if the partitions of $G_1$ and $G_2$ are into complete sets (resp. independent sets), so is the defined partition of $G_1 \bullet_v G_2$. Moreover, we will define a new partition with $t_1+t_2-1$ sets as the union of the partitions of $V_1$ and $V_2$, where $V_1^j$ and $V_2^1$ are replaced by $V_1^j \setminus \{v\} \cup V_2^1$. Notice that if the partitions of $G_1$ and $G_2$ are into complete sets (resp. independent sets), so is the new class. We will prove first that if the partition of $V_1$ consists of independent sets (not necessarily the partition of $V_2$), then the order and the new partition are consistent. For strongly consistence the proof is symmetric. The only cases that need to be re-considered are the ones in which $x$ and $y$ belong to the new class and, moreover, one of them belongs to $V_1$ and the other one belongs to $V_2$. If $x$ belongs to $V_2$ and $y$ belongs to $V_1$, since the vertices of $G_2$ are consecutive in the order, this implies that $z$ belongs to $V_1$. Since $xz \in E(G)$, $vz \in E_1$. By the order definition, $v < y < z$ in $G_1$. Since the ordering and partition of $G_1$ are consistent, $yz \in E_1$ and thus $yz \in E(G)$. If $x$ belongs to $V_1$ and $y$ belongs to $V_2$, since the partition of $G_1$ consists of independent sets, $xv \not \in V_1$. So, if $xz \in E(G)$, $z$ belongs to $V_1$. By the order definition, $x < v < z$ in $G_1$. Since the ordering and partition of $G_1$ are consistent, $vz \in E_1$ and thus $yz \in E(G)$. Now we will prove that if $G_2$ is complete, i.e., $V_2 = V_2^1$, then the order and the new partition are consistent. For strongly consistence, the proof is symmetric. Again, the only cases that need to be re-considered are the ones in which $x$ and $y$ belong to the new class and, moreover, one of them belongs to $V_1$ and the other one belongs to $V_2$. We will prove them for consistence, and for strongly consistence the proof is symmetric. If $x$ belongs to $V_2$ and $y$ belongs to $V_1$, since the vertices of $G_2$ are consecutive in the order, this implies that $z$ belongs to $V_1$. Since $xz \in E(G)$, $vz \in E_1$. By the order definition, $v < y < z$ in $G_1$. Since the ordering and partition of $G_1$ are consistent, $yz \in E_1$ and thus $yz \in E(G)$. If $x$ belongs to $V_1$ and $y$ belongs to $V_2$, since $G_2$ is complete, if $z \in V_2$, $zy \in V(G)$. So, assume $z$ belongs to $V_1$. By the order definition, $x < v < z$ in $G_1$. Since the ordering and partition of $G_1$ are consistent, $xz \in E_1$ implies $vz \in E_1$ and thus $yz \in E(G)$. \end{proof} \begin{remark} Notice that if $v$ is isolated in $G_1$, then $G_1 \bullet_v G_2 = G_1[V(G_1) \setminus \{v\}] \cup G_2$, and if $v$ is universal in $G_1$, then $G_1 \bullet_v G_2 = G_1[V(G_1) \setminus \{v\}] \vee G_2$, so we can obtain better bounds by using the results of Section~\ref{sec:unionjoin}. \end{remark} An equivalent formulation of Theorem~\ref{thm:lexv} is the following. \begin{theorem}\label{thm:lexhom} Let $H$ be an homogeneous set of $G$, and $G|_H$ be the graph obtained by contracting $H$ into a vertex. Then $f(G) \leq f(G|_H) + f(H)$, for $f \in \{\thin,$ $\pthin,$ $\compthin,$ $\comppthin\}$, and $f(G) \leq f'(G|_H) + f(H)-1$, for $(f,f') \in \{(\thin,\indthin),$ $(\indthin,\indthin),$ $(\pthin,\indpthin),$ $(\indpthin,\indpthin)\}$. Moreover, if $H$ is complete, $f(G) = f(G|_H)$, for $f \in \{\thin,$ $\pthin,$ $\compthin,$ $\comppthin\}$. \end{theorem} The \emph{lexicographical product} of $G_1$ and $G_2$ (also known as \emph{composition} of $G_1$ and $G_2$) is the graph $G_1 \bullet G_2$ (also noted as $G_1[G_2]$) whose vertex set is the Cartesian product $V_1 \times V_2$, and such that two vertices $(u_1,u_2)$ and $(v_1,v_2)$ are adjacent in $G_1 \bullet G_2$ if and only if either $u_1 = v_1$ and $u_2$ is adjacent to $v_2$ in $G_2$, or $u_1$ is adjacent to $v_1$ in $G_1$. It is not necessarily commutative. \begin{theorem}\label{thm:lex} Let $G_1$ and $G_2$ be two graphs. Then, if $G_2$ is complete, $f(G_1 \bullet G_2) = f(G_1)$, for $f \in \{\thin,$ $\pthin,$ $\compthin,$ $\comppthin\}$. Also, $f(G_1 \bullet G_2) \leq f'(G_1)f(G_2)$, for $(f,f') \in \{(\thin,\indthin),$ $(\indthin,\indthin),$ $(\pthin,\indpthin),$ $(\indpthin,\indpthin)\}$, and $f(G_1 \bullet G_2) \leq |V_1|f(G_2)$, for $f \in \{\compthin,$ $\comppthin\}$. If $G_2$ is not complete, $\omega(G_1)f(G_2) \leq f(G_1 \bullet G_2)$, for $f \in \{\thin,\indthin,\allowbreak \indpthin\}$. \end{theorem} \begin{proof} If $G_2$ is complete, we can iteratively apply Theorem~\ref{thm:lexv}, since $G_1 \bullet G_2 = ((\dots((G_1 \bullet_{v_1} G_2) \bullet_{v_2} G_2) \dots ) \bullet_{v_{n_1}} G_2)$, with {$\{v_1,\dots, v_{n_1}\} = V_1$}. By induction in $n_1$, $f(G_1 \bullet G_2) = f(G_1)$, for $f \in \{\thin,$ $\pthin,$ $\compthin,$ $\comppthin\}$. So, let $G_1$ and $G_2$ be two graphs, such that $f'(G_1) = t_1$ and $f(G_2) = t_2$, and assume $G_2$ is not complete. In $G_1 \bullet G_2$, consider $V_1 \times V_2$ lexicographically ordered with respect to the {defined} orderings of $V_1$ and $V_2$. Consider first $(f,f') \in \{(\thin,\indthin),$ $(\indthin,\indthin),$ $(\pthin,\indpthin),$ $(\indpthin,\indpthin)\}$, and the partition $\{V^{i,j}\}_{1\leq i \leq t_1,\ 1 \leq j \leq t_2}$ such that $V^{i,j} = \{(v,w) : v \in V_1^i, w \in V_2^j\}$ for each $1\leq i \leq t_1$, $1 \leq j \leq t_2$. Since the partition of $V_1$ consists of independent sets, vertices $(v,w)$ and $(v',w)$ in the same partition are not adjacent for $v \neq v'$, and if furthermore the partition of $V_2$ consists of independent sets, the same property holds for the defined partition of $V_1 \times V_2$ for $G_1 \bullet G_2$. We will show now that this ordering and partition of $V_1 \times V_2$ are consistent (resp. strongly consistent, when $f, f'$ are proper). Let $(v_p,w_i), (v_q,w_j), (v_r,w_{\ell})$ be three vertices appearing in that ordering in $V_1 \times V_2$. \emph{Case 1: $p = q = r$.} In this case, $i < j < \ell$. Suppose first that $(v_p,w_i), (v_q,w_j)$ belong to the same class, i.e., $w_i, w_j$ belong to the same class in $G_2$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \bullet G_2$ if and only if $w_i w_{\ell} \in E_2$. Since the order and partition of $G_2$ are consistent, $w_j w_{\ell} \in E_2$, so $(v_q,w_j)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \bullet G_2$, as required. If $f$ and $f'$ are proper, the proof for strongly consistence is symmetric. \emph{Case 2: $p = q < r$.} Suppose first that $(v_p,w_i), (v_q,w_j)$ belong to the same class, i.e., $w_i, w_j$ belong to the same class in $G_2$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \bullet G_2$ if and only if $v_p v_r \in E_1$. Since $p = q$, $v_q v_r \in E_1$, so $(v_q,w_j)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \bullet G_2$, as required. Suppose now $f$ and $f'$ are proper, and {$(v_q, w_j), (v_r, w_{\ell})$} belong to the same class, and, in particular, $v_q, v_r$ belong to the same class in $G_1$ thus they are not adjacent. Since $p = q$, $(v_p,w_i)$ and $(v_r, w_{\ell})$ are not adjacent in $G_1 \bullet G_2$. \emph{Case 3: $p < q = r$.} Suppose first that $(v_p,w_i), (v_q,w_j)$ belong to the same class, and, in particular, $v_p, v_q$ belong to the same class in $G_1$. Thus, they are not adjacent. Since $q = r$, $(v_p,w_i)$ and $(v_r, w_{\ell})$ are not adjacent in $G_1 \bullet G_2$. Suppose now $f$ and $f'$ are proper, and $(v_q, w_j), (v_r, w_{\ell})$ belong to the same class, i.e., $w_i, w_j$ belong to the same class in $G_2$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \bullet G_2$ if and only if $v_p v_r \in E_1$. Since $q = r$, $v_p v_q \in E_1$, so $(v_p,w_i)$ and $(v_q,w_j)$ are adjacent in $G_1 \bullet G_2$, as required. \emph{Case 4: $p < q < r$.} Suppose first that $(v_p,w_i), (v_q,w_j)$ belong to the same class, and, in particular, $v_p, v_q$ belong to the same class in $G_1$. Since the ordering an the partition of $G_1$ are consistent, if $(v_p,w_i), (v_r, w_{\ell})$ are adjacent in $G_1 \bullet G_2$, in particular $v_p, v_r$ are adjacent in $G_1$, thus $v_q, v_r$ are adjacent in $G_1$ and $(v_q,w_j), (v_r, w_{\ell})$, as required. If $f$ and $f'$ are proper, the proof for strongly consistence is symmetric. Consider $f \in \{\compthin,$ $\comppthin\}$, and the partition $\{V^{i,j}\}_{1\leq i \leq n_1,\ 1 \leq j \leq t_2}$ such that $V^{i,j} = \{(v_i,w) : w \in V_2^j\}$ for each $1\leq i \leq n_1$, $1 \leq j \leq t_2$. Since the partition of $V_2$ consists of complete sets, the same property holds for the defined partition of $V_1 \times V_2$ for $G_1 \bullet G_2$. We will show now that this ordering and partition of $V_1 \times V_2$ are consistent (resp. strongly consistent). Let $(v_p,w_i), (v_q,w_j), (v_r,w_{\ell})$ be three vertices appearing in that ordering in $V_1 \times V_2$. \emph{Case 1: $p = q = r$.} In this case, $i < j < \ell$. Suppose first that $(v_p,w_i), (v_q,w_j)$ belong to the same class, i.e., $w_i, w_j$ belong to the same class in $G_2$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \bullet G_2$ if and only if $w_i w_{\ell} \in E_2$. Since the order and partition of $G_2$ are consistent, $w_j w_{\ell} \in E_2$, so $(v_q,w_j)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \bullet G_2$, as required. If $f = \comppthin$, the proof for strongly consistence is symmetric. \emph{Case 2: $p = q < r$.} Suppose first that $(v_p,w_i), (v_q,w_j)$ belong to the same class, i.e., $w_i, w_j$ belong to the same class in $G_2$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \bullet G_2$ if and only if $v_p v_r \in E_1$. Since $p = q$, $v_q v_r \in E_1$, so $(v_q,w_j)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \bullet G_2$, as required. No further restriction has to be satisfied if $f = \comppthin$, since by definition of the classes $(v_q, w_j), (v_r, w_{\ell})$ belong to different classes. \emph{Case 3: $p < q = r$.} No restriction has to be satisfied for consistence, as $(v_p,w_i), (v_q,w_j)$ belong to different classes. If $f = \comppthin$, suppose that $(v_q, w_j), (v_r, w_{\ell})$ belong to the same class, i.e., $w_j, w_{\ell}$ belong to the same class in $G_2$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \bullet G_2$ if and only if $v_p v_r \in E_1$. Since $q = r$, $v_p v_q \in E_1$, so $(v_p,w_i)$ and $(v_q,w_j)$ are adjacent in $G_1 \bullet G_2$, as required. \emph{Case 4: $p < q < r$.} In this case, the three vertices are in different classes, so no restriction has to be satisfied. To prove the lower bound when $G_2$ is not complete, notice that $K_r \bullet G_2$ is isomorphic to $(((G_2 \vee G_2) \vee G_2) \dots \vee G_2)$ ($r$ times). By Theorems~\ref{thm:join2} and~\ref{thm:join-ind}, $\omega(G_1)f(G_2) \leq f(G_1 \bullet G_2)$, for $f \in \{\thin,\indthin,\indpthin\}$. \end{proof} \begin{corollary}\label{thm:lexomega} Let $G_1$ and $G_2$ be graphs. If $G_2$ is not complete, then $\thin(G_1 \bullet G_2) \geq \omega(G_1)$. \end{corollary} Notice that $K_n \bullet 2K_1 = \overline{tK_2}$. So, we have the following corollary of Theorem~\ref{thm:tK2}. \begin{corollary}\label{thm:nblex} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \bullet G_2) \leq f(\comppthin(G_1),|V(G_2)|)$ for any pair of graphs $G_1$, $G_2$. \end{corollary} The non existence of bounds in terms of other parameters can be deduced from diagram in Figure~\ref{fig:hasse}. \begin{corollary} Let $G_1$ be a co-comparability graph. If $G_2$ is complete, then $\thin(G_1 \bullet G_2) = \thin(G_1)$, and if not, then $\thin(G_1 \bullet G_2) = \omega(G_1)\thin(G_2)$. \end{corollary} \begin{theorem}\label{thm:pthin-indpthin} Let $G$ be a graph and $t \geq 3$, $q \geq 1$. Then, $\pthin(G \bullet tK_1) = \indpthin(G)$, and $\pthin((G \bullet tK_1) \vee qK_1) = \pthin((G \bullet tK_1) \vee K_q) = \indpthin(G)+1$. \end{theorem} \begin{proof} The upper bounds are a consequence of Theorems~\ref{thm:lex} and~\ref{thm:join}. For the lower bounds, we will prove the statement for $t = 3$ and $q = 1$, since $(G \bullet 3K_1)$ (resp. $(G \bullet 3K_1) \vee K_1$) is an induced subgraph of $(G \bullet tK_1)$ (resp. $(G \bullet tK_1) \vee qK_1$ and $(G \bullet tK_1) \vee K_q$). Let $G' = (G \bullet 3K_1)$ and $G'' = G' \vee K_1$. Let $V(G') = \{v_i^1 < v_i^2 < v_i^3 : v_i \in V(G)\}$, and $V(G'') = V(G') \cup \{u\}$. Consider an ordering of the vertices of $G''$, and let $<$ be the vertex order of $V(G)$ induced by the order of $\{v_i^2\}_{v_i \in V(G)}$. We will show the following three statements, that are enough to prove the theorem: if $vw \in E(\tilde{G}_{<})$ then $v^2w^2 \in E(\tilde{G'}_{<})$; if $vw \in E(G)$ then $v^2w^2 \in E(\tilde{G'}_{<})$; for any $v \in V(G)$, $v^2u \in E(\tilde{G''}_{<})$. First, let $v < w$ be adjacent in $\tilde{G}_{<}$. Then either there is a vertex $z$ such that $v < w < z$, $vz \in E(G)$ and $wz \not \in E(G)$, or there is a vertex $z$ such that $z < v < w$, $zw \in E(G)$ and $zv \not \in E(G)$. In either case, the same holds for $v^2, w^2, z^2$, so $v^2w^2 \in E(\tilde{G'}_{<})$. Next, let $v < w$ be adjacent in $G$. Then $v^2 < w^2 < w^3$, $v^2w^3 \in E(G')$ and $w^2w^3 \not \in E(G')$, so $v^2w^2 \in E(\tilde{G'}_{<})$. Finally, for $v \in V(G)$, if $u < v^2$, then $u < v^2 < v^3$, $uv^3 \in E(G')$ and $v^2v^3 \not \in E(G')$, so $uv^2 \in E(\tilde{G'}_{<})$. If $v^2 < u$, then $v^1 < v^2 < u$, $v^1u \in E(G')$ and $v^1v^2 \not \in E(G')$, so $uv^2 \in E(\tilde{G'}_{<})$. By Remark~\ref{rem:co-comp-ind-thin}, it holds that $\pthin(G') \geq \indpthin(G)$, and that $\pthin(G'') \geq \indpthin(G)+1$. \end{proof} Theorem~\ref{thm:pthin-indpthin} implies that if recognizing proper $k$-independent-thin graphs is NP-complete, then recognizing proper $k$-thin graphs is NP-complete (both with $k$ as a parameter and with constant $k$). \subsection{Cartesian product} The \emph{Cartesian product} $G_1 \ \square \ G_2$ is a graph whose vertex set is the Cartesian product $V_1 \times V_2$, and such that two vertices $(u_1,u_2)$ and $(v_1,v_2)$ are adjacent in $G_1 \ \square \ G_2$ if and only if either $u_1 = v_1$ and $u_2$ is adjacent to $v_2$ in $G_2$, or $u_2 = v_2$ and $u_1$ is adjacent to $v_1$ in $G_1$. The following result was proved in~\cite{B-D-thinness}. We include the proof in order to make some remarks about it. Most of the proofs for other graph products are structurally similar to this one. \begin{theorem}\label{thm:cart}\cite{B-D-thinness} Let $G_1$ and $G_2$ be graphs. Then, for $f \in \{\thin,\pthin\}$, {$f(G_1 \ \square \ G_2) \leq f(G_1)|V(G_2)|$}. \end{theorem} \begin{proof} Let $G_1$ be a $k$-thin (resp. proper $k$-thin) graph. Consider $V_1 \times V_2$ lexicographically ordered with respect to the {defined} orderings of $V_1$ and $V_2$. Consider now the partition $\{V^{i,j}\}_{1\leq i \leq k,\ 1 \leq j \leq n_2}$ such that $V^{i,j} = \{(v,w_j) : v \in V_1^i\}$ for each $1\leq i \leq k$, $1 \leq j \leq n_2$. We will show that this ordering and partition of $V_1 \times V_2$ are consistent (resp. strongly consistent). Let $(v_p,w_i), (v_q,w_j), (v_r,w_{\ell})$ be three vertices appearing in that ordering in $V_1 \times V_2$. \emph{Case 1: $p = q = r$.} In this case, the three vertices are in different classes, so no restriction has to be satisfied. \emph{Case 2: $p = q < r$.} In this case, $(v_p,w_i)$ and $(v_q,w_j)$ are in different classes. So suppose $G_1$ is proper $k$-thin and $(v_q,w_j), (v_r,w_{\ell})$ belong to the same class, i.e., $j=\ell$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \ \square \ G_2$ if and only if $i = \ell$ and $v_pv_r \in E_1$. But then $(v_p,w_i)=(v_q,w_j)$, a contradiction. \emph{Case 3: $p < q = r$.} In this case, $(v_q,w_j)$ and $(v_r,w_{\ell})$ are in different classes. So suppose $G_1$ is $k$-thin (resp. proper $k$-thin) and $(v_p,w_i), (v_q,w_j)$ belong to the same class, i.e., $i=j$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \ \square \ G_2$ if and only if $i = \ell$ and $v_pv_r \in E_1$. But then $(v_r,w_{\ell})=(v_q,w_j)$, a contradiction. \emph{Case 4: $p < q < r$.} Suppose first $G_1$ is $k$-thin (resp. proper $k$-thin) and $(v_p,w_i), (v_q,w_j)$ belong to the same class, i.e., $i=j$ and $v_p$, $v_q$ belong to the same class in $G_1$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \ \square \ G_2$ if and only if $i = \ell$ and $v_pv_r \in E_1$. But then $j=\ell$ and since the ordering and the partition are consistent (resp. strongly consistent) in $G_1$, $v_rv_q \in E_1$ and so $(v_r,w_{\ell})$ and $(v_q,w_j)$ are adjacent in $G_1 \ \square \ G_2$. Now suppose that $G_1$ is proper $k$-thin and $(v_q,w_j), (v_r,w_{\ell})$ belong to the same class, i.e., $j=\ell$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \ \square \ G_2$ if and only if $i = \ell$ and $v_pv_r \in E_1$. But then $i=j$ and since the ordering and the partition are strongly consistent in $G_1$, $v_pv_q \in E_1$ and so $(v_p,w_i)$ and $(v_q,w_j)$ are adjacent in $G_1 \ \square \ G_2$. \end{proof} \begin{remark}\label{rem:cart} Notice that if the partition of $G_1$ consists of independent sets (respectively, complete sets), the partition defined for $G_1 \ \square \ G_2$ consists also of independent sets (respectively, complete sets). So, $f(G_1 \ \square \ G_2) \leq f(G_1)|V(G_2)|$, for $f \in \{\thin, \pthin, \indthin, \compthin, \indpthin, \comppthin\}$. \end{remark} These results can be strengthened by replacing $|V(G_2)|$ by the size of the largest connected component of $G_2$, by Theorem~\ref{thm:union} and since $G \ \square \ (H \cup H') = (G \ \square \ H) \cup (G \ \square \ H')$. On the negative side, since $P_r$ has independent proper thinness~2 (with the order given by the definition of path), but $P_r \ \square \ P_r = GR_r$, we have the following corollary of Corollary~\ref{cor:grid}. \begin{corollary}\label{cor:nbcart} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \ \square \ G_2) \leq f(\indpthin(G_1),\indpthin(G_2))$ for any pair of graphs $G_1$, $G_2$. \end{corollary} \begin{lemma}\label{lem:Knsq} For $n \geq 1$, $\thin(K_n \ \square \ K_n) = n$. \end{lemma} \begin{proof} For $n \geq 1$, $K_n \ \square \ K_n$ is $(2n-2)$-regular, and for any pair of vertices $u$, $v$, $|N(u) \cap N(v)| \leq n-2$. By Corollary~\ref{cor:k-reg}, $\thin(K_n \ \square \ K_n) \geq n$. By Theorem~\ref{thm:cart}, {$\thin(K_n \ \square \ K_n) \leq n$}. \end{proof} \begin{corollary}\label{cor:nbcart2} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \ \square \ G_2) \leq f(\comppthin(G_1),\comppthin(G_2))$ for any pair of graphs $G_1$, $G_2$. \end{corollary} \begin{lemma}\label{lem:KnKnn} For $n \geq 1$, $\thin(K_n \ \square \ K_{n,n}) \geq n-1$. \end{lemma} \begin{proof} For $n \geq 1$, $K_n \ \square \ K_{n,n}$ is $(2n-1)$-regular, and for any pair of vertices $u$, $v$, $|N(u) \cap N(v)| \leq n$. By Corollary~\ref{cor:k-reg}, $\thin(K_n \ \square \ K_{n,n}) \geq n- 1$. \end{proof} \begin{corollary}\label{cor:nbcart3} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \ \square \ G_2) \leq f(\comppthin(G_1),\indpthin(G_2))$ for any pair of graphs $G_1$, $G_2$. \end{corollary} The non existence of bounds in terms of other parameters can be deduced from diagram in Figure~\ref{fig:hasse}. Further consequences of the examples above are the following. \begin{corollary}\label{cor:lowercart} Given two connected graphs $G_1$ and $G_2$, $(\min\{\diam(G_1),$ $\diam(G_2)\}+1)/4 \leq (\min\{\lip(G_1),\lip(G_2)\}+1)/4 \leq \thin(G_1 \ \square \ G_2)$. \end{corollary} \begin{corollary}\label{cor:lowercart2} Given two graphs $G_1$ and $G_2$, $\min\{\omega(G_1),\omega(G_2)\} \leq $ $\thin(G_1 \ \square \ G_2)$. \end{corollary} \subsection{Tensor or direct or categorical product} The \emph{tensor product} or \emph{direct product} or \emph{categorical product} or \emph{Kronecker product} $G_1 \times G_2$ is a graph whose vertex set is the Cartesian product $V_1 \times V_2$, and such that two vertices $(u_1,u_2)$ and $(v_1,v_2)$ are adjacent in $G_1 \times G_2$ if and only if $u_1$ is adjacent to $v_1$ in $G_1$ and $u_2$ is adjacent to $v_2$ in $G_2$. \begin{theorem}\label{thm:direct} Let $G_1$ and $G_2$ be graphs. Then {$f(G_1 \times G_2) \leq \indf(G_1 \times G_2) \leq \indf(G_1)|V(G_2)| \leq f(G_1)\chi(G_1)|V(G_2)|$}, for $f \in \{\thin, \pthin\}$. \end{theorem} This result can be strengthened by replacing $|V(G_2)|$ by the size of the largest connected component of $G_2$, by Theorem~\ref{thm:union-ind} and since $G \times (H \cup H') = (G \times H) \cup (G \times H')$. Since $\comppthin(K_n) = 1$, $|K_2|=2$, and $K_n \times K_2 = CR_n$, we have the following consequence of Corollary~\ref{cor:crown}. \begin{corollary}\label{cor:nbdirect} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \times G_2) \leq f(\comppthin(G_1),|V(G_2)|)$ for any pair of graphs $G_1$, $G_2$. \end{corollary} The graph $P_{2r-1} \times P_{2r-1}$ contains $GR_r$ as an induced subgraph. Since $\indpthin(P_{2r-1}) = 2$, we have also the following. \begin{corollary}\label{cor:nbdirect2} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \times G_2) \leq f(\indpthin(G_1),\indpthin(G_2))$ for any pair of graphs $G_1$, $G_2$. \end{corollary} The non existence of bounds in terms of other parameters can be deduced from diagram in Figure~\ref{fig:hasse}. Further consequences of the examples above are the following. \begin{corollary}\label{cor:lowerdirect} Given two graphs $G_1$ and $G_2$, if $G_2$ has at least one edge, then $\omega(G_1)/2 \leq \thin(G_1 \times G_2)$. \end{corollary} \begin{corollary}\label{cor:lowerdirect2} Given two connected graphs $G_1$ and $G_2$, $(\min\{\diam(G_1),$ $\diam(G_2)\}+1)/8 \leq (\min\{\lip(G_1),\lip(G_2)\}+1)/8 \leq \thin(G_1 \times G_2)$. \end{corollary} \begin{figure} \begin{center} \begin{tikzpicture} \vertex{0}{0}{v00}; \vertex{0}{1}{v01}; \vertex{0}{2}{v02}; \vertex{0}{3}{v03}; \vertex{0}{4}{v04}; \vertex{1}{0}{v10}; \vertex{1}{1}{v11}; \vertex{1}{2}{v12}; \vertex{1}{3}{v13}; \vertex{1}{4}{v14}; \vertex{2}{0}{v20}; \vertex{2}{1}{v21}; \vertex{2}{2}{v22}; \vertex{2}{3}{v23}; \vertex{2}{4}{v24}; \vertex{3}{0}{v30}; \vertex{3}{1}{v31}; \vertex{3}{2}{v32}; \vertex{3}{3}{v33}; \vertex{3}{4}{v34}; \vertex{4}{0}{v40}; \vertex{4}{1}{v41}; \vertex{4}{2}{v42}; \vertex{4}{3}{v43}; \vertex{4}{4}{v44}; \edge{v00}{v11}; \edge{v01}{v12}; \edge[ultra thick]{v02}{v13}; \edge{v03}{v14}; \edge{v01}{v10}; \edge[ultra thick]{v02}{v11}; \edge{v03}{v12}; \edge{v04}{v13}; \edge{v10}{v21}; \edge[ultra thick]{v11}{v22}; \edge{v12}{v23}; \edge[ultra thick]{v13}{v24}; \edge[ultra thick]{v11}{v20}; \edge{v12}{v21}; \edge[ultra thick]{v13}{v22}; \edge{v14}{v23}; \edge[ultra thick]{v20}{v31}; \edge{v21}{v32}; \edge[ultra thick]{v22}{v33}; \edge{v23}{v34}; \edge{v21}{v30}; \edge[ultra thick]{v22}{v31}; \edge{v23}{v32}; \edge[ultra thick]{v24}{v33}; \edge{v30}{v41}; \edge[ultra thick]{v31}{v42}; \edge{v32}{v43}; \edge{v33}{v44}; \edge{v31}{v40}; \edge{v32}{v41}; \edge[ultra thick]{v33}{v42}; \edge{v34}{v43}; \vertex{7}{0}{w00}; \vertex{7}{1}{w01}; \vertex{7}{2}{w02}; \vertex{7}{3}{w03}; \vertex{7}{4}{w04}; \vertex{8}{0}{w10}; \vertex{8}{1}{w11}; \vertex{8}{2}{w12}; \vertex{8}{3}{w13}; \vertex{8}{4}{w14}; \vertex{9}{0}{w20}; \vertex{9}{1}{w21}; \vertex{9}{2}{w22}; \vertex{9}{3}{w23}; \vertex{9}{4}{w24}; \vertex{10}{0}{w30}; \vertex{10}{1}{w31}; \vertex{10}{2}{w32}; \vertex{10}{3}{w33}; \vertex{10}{4}{w34}; \vertex{11}{0}{w40}; \vertex{11}{1}{w41}; \vertex{11}{2}{w42}; \vertex{11}{3}{w43}; \vertex{11}{4}{w44}; \edge{w00}{w11}; \edge{w01}{w12}; \edge[ultra thick]{w02}{w13}; \edge{w03}{w14}; \edge{w01}{w10}; \edge[ultra thick]{w02}{w11}; \edge{w03}{w12}; \edge{w04}{w13}; \edge{w10}{w21}; \edge[ultra thick]{w11}{w22}; \edge{w12}{w23}; \edge[ultra thick]{w13}{w24}; \edge[ultra thick]{w11}{w20}; \edge{w12}{w21}; \edge[ultra thick]{w13}{w22}; \edge{w14}{w23}; \edge[ultra thick]{w20}{w31}; \edge{w21}{w32}; \edge[ultra thick]{w22}{w33}; \edge{w23}{w34}; \edge{w21}{w30}; \edge[ultra thick]{w22}{w31}; \edge{w23}{w32}; \edge[ultra thick]{w24}{w33}; \edge{w30}{w41}; \edge[ultra thick]{w31}{w42}; \edge{w32}{w43}; \edge{w33}{w44}; \edge{w31}{w40}; \edge{w32}{w41}; \edge[ultra thick]{w33}{w42}; \edge{w34}{w43}; \edge{w00}{w01}; \edge{w01}{w02}; \edge{w02}{w03}; \edge{w03}{w04}; \edge{w10}{w11}; \edge{w11}{w12}; \edge{w12}{w13}; \edge{w13}{w14}; \edge{w20}{w21}; \edge{w21}{w22}; \edge{w22}{w23}; \edge{w23}{w24}; \edge{w30}{w31}; \edge{w31}{w32}; \edge{w32}{w33}; \edge{w33}{w34}; \edge{w40}{w41}; \edge{w41}{w42}; \edge{w42}{w43}; \edge{w43}{w44}; \edge{w00}{w10}; \edge{w10}{w20}; \edge{w20}{w30}; \edge{w30}{w40}; \edge{w01}{w11}; \edge{w11}{w21}; \edge{w21}{w31}; \edge{w31}{w41}; \edge{w02}{w12}; \edge{w12}{w22}; \edge{w22}{w32}; \edge{w32}{w42}; \edge{w03}{w13}; \edge{w13}{w23}; \edge{w23}{w33}; \edge{w33}{w43}; \edge{w04}{w14}; \edge{w14}{w24}; \edge{w24}{w34}; \edge{w34}{w44}; \end{tikzpicture} \end{center} \caption{The $(r \times r)$-grid $GR_r$ as an induced subgraph of $P_{2r-1} \times P_{2r-1}$ and of $P_{2r-1} \boxtimes P_{2r-1}$.} \end{figure} \subsection{Strong or normal product} The \emph{strong product} (also known as \emph{normal product}) $G_1 \boxtimes G_2$ is a graph whose vertex set is the Cartesian product $V_1 \times V_2$, and such that two vertices $(u_1,u_2)$ and $(v_1,v_2)$ are adjacent in $G_1 \boxtimes G_2$ if and only if they are adjacent either in $G_1 \ \square \ G_2$ or in $G_1 \times G_2$. \begin{theorem}\label{thm:strong} Let $G_1$ and $G_2$ be graphs. Then $f(G_1 \boxtimes G_2) \leq f(G_1)|V(G_2)|$ for $f \in \{\thin, \pthin, \compthin, \comppthin, \indthin, \indpthin\}$. Moreover, if $G_2$ is complete, then $f(G_1 \boxtimes G_2) = f(G_1)$ for $f \in \{\thin, \pthin, \compthin, \comppthin\}$. \end{theorem} This result can be strengthened for $f \in \{\thin, \pthin, \indthin, \indpthin\}$, replacing $|V(G_2)|$ by the size of the largest connected component of $G_2$, by Theorems~\ref{thm:union} and~\ref{thm:union-ind}, and since $G \boxtimes (H \cup H') = (G \boxtimes H) \cup (G \boxtimes H')$. The graph $P_{2r-1} \boxtimes P_{2r-1}$ contains $GR_r$ as an induced subgraph. Since $\indpthin(P_{2r-1}) = 2$, we have the following corollary of Corollary~\ref{cor:grid}. \begin{corollary}\label{cor:nbstrong} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \boxtimes G_2) \leq f(\indpthin(G_1),\indpthin(G_2))$ for any pair of graphs $G_1$, $G_2$. \end{corollary} \begin{lemma}\label{lem:Knsqbox} For $n \geq 2$, $\thin((K_n \ \square \ K_2) \boxtimes (K_n \ \square \ K_2)) \geq n+2$. \end{lemma} \begin{proof} For $n \geq 2$, $(K_n \ \square \ K_2) \boxtimes (K_n \ \square \ K_2)$ is $(n^2+2n)$-regular, and for any pair of vertices $u$, $v$, $|N(u) \cap N(v)| \leq n^2+n-2$. By Corollary~\ref{cor:k-reg}, $\thin((K_n \ \square \ K_2) \boxtimes (K_n \ \square \ K_2)) \geq n+2$. \end{proof} Remark~\ref{rem:cart} implies $\comppthin(K_n \ \square \ K_2) = 2$ for $n \geq 2$, since the graph contains an induced cycle of length four, which is not an interval graph. So we have also the following. \begin{corollary}\label{cor:nbstrong2} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \boxtimes G_2) \leq f(\comppthin(G_1),\comppthin(G_2))$ for any pair of graphs $G_1$, $G_2$. \end{corollary} The non existence of bounds in terms of other parameters can be deduced from diagram in Figure~\ref{fig:hasse}. A further consequence of the example used for Corollary~\ref{cor:nbstrong} is the following. \begin{corollary}\label{cor:lowerstrong} Given two connected graphs $G_1$ and $G_2$, $(\min\{\diam(G_1),$ $\diam(G_2)\}+1)/8 \leq (\min\{\lip(G_1),\lip(G_2)\}+1)/8 \leq \thin(G_1 \boxtimes G_2)$. \end{corollary} \subsection{Co-normal or disjunctive product} The \emph{co-normal product} or \emph{disjunctive product} $G_1 \ast G_2$ is a graph whose vertex set is the Cartesian product $V_1 \times V_2$, and such that two vertices $(u_1,u_2)$ and $(v_1,v_2)$ are adjacent in $G_1 \ast G_2$ if and only if either $u_1$ is adjacent to $v_1$ in $G_1$ or $u_2$ is adjacent to $v_2$ in $G_2$. Notice that $\overline{G \ast H} = \overline{G} \boxtimes \overline{H}$. \begin{theorem}\label{thm:conorm} Let $G_1$ and $G_2$ be graphs. Then $f(G_1 \ast G_2) \leq \indf(G_1 \ast G_2) \leq \indf(G_1)|V(G_2)| \leq f(G_1)\chi(G_1)|V(G_2)|$, for $f \in \{\thin, \pthin\}$. \end{theorem} Since $\comppthin(K_t) = 1$, $|2K_1|=2$, and $K_t \ast 2K_1 = \overline{tK_2}$, we have the following corollary of Theorem~\ref{thm:tK2}. \begin{corollary}\label{cor:nbconorm} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \ast G_2) \leq f(\comppthin(G_1),|V(G_2)|)$ for any pair of graphs $G_1$, $G_2$. \end{corollary} Consider the graph $tK_2 \ast tK_2$. It is $(4t-1)$-regular, and for every pair of vertices $u,v$, it holds $|N(u) \cap N(v)| \leq 2t+1$. By Corollary~\ref{cor:k-reg}, $\thin(tK_2 \ast tK_2) \geq 2t-2$. Since $\indpthin(tK_2) = 2$, we have also the following corollary. \begin{corollary}\label{cor:nbconorm2} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \ast G_2) \leq f(\indpthin(G_1),\indpthin(G_2))$ for any pair of graphs $G_1$, $G_2$. \end{corollary} The non existence of bounds in terms of other parameters can be deduced from diagram in Figure~\ref{fig:hasse}. Further consequences of the examples above are the following. \begin{corollary}\label{cor:lowerconorm} Given two graphs $G_1$ and $G_2$, if $G_2$ is not complete, then $\omega(G_1) \leq \thin(G_1 \ast G_2)$. \end{corollary} \begin{corollary}\label{cor:lowerconorm2} Given two graphs $G_1$ and $G_2$, $2\min\{\mim(G_1),\mim(G_2)\}-2 \leq \thin(G_1 \ast G_2)$. \end{corollary} \subsection{Modular product} The \emph{modular product} $G_1 \diamond G_2$ is a graph whose vertex set is the Cartesian product $V_1 \times V_2$, and such that two vertices $(u_1,u_2)$ and $(v_1,v_2)$ are adjacent in $G_1 \diamond G_2$ if and only if either $u_1$ is adjacent to $v_1$ in $G_1$ and $u_2$ is adjacent to $v_2$ in $G_2$, or $u_1$ is nonadjacent to $v_1$ in $G_1$ and $u_2$ is nonadjacent to $v_2$ in $G_2$. Notice that $K_n \diamond K_2 = CR_n$ and $tK_2 \diamond K_1 = \overline{tK_2}$, so we have the following. \begin{corollary}\label{cor:nbmodular} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \diamond G_2) \leq f(h(G_1),|G_2|)$, for $h \in \{\comppthin,\indpthin\}$ for any pair of graphs $G_1$, $G_2$. \end{corollary} The non existence of bounds in terms of other parameters can be deduced from diagram in Figure~\ref{fig:hasse}. Further consequences of the examples above are the following. \begin{corollary}\label{cor:lowermodular} Given two graphs $G_1$ and $G_2$, if $G_2$ has at least one edge, then $\omega(G_1)/2 \leq \thin(G_1 \diamond G_2)$. \end{corollary} \begin{corollary}\label{cor:lowermodular2} Given two graphs $G_1$ and $G_2$, $\mim(G_1) \leq \thin(G_1 \diamond G_2)$. \end{corollary} \subsection{Homomorphic product} The \emph{homomorphic product} $G_1 \ltimes G_2$~\cite{M-R-hom-prod} is a graph whose vertex set is the Cartesian product $V_1 \times V_2$, and such that two vertices $(u_1,u_2)$ and $(v_1,v_2)$ are adjacent in $G_1 \ltimes G_2$ if and only if either $u_1 = v_1$ or $u_1$ is adjacent to $v_1$ in $G_1$ and $u_2$ is nonadjacent to $v_2$ in $G_2$. It is not necessarily commutative. \begin{theorem}\label{thm:homo} Let $G_1$ and $G_2$ be graphs. Then $f(G_1 \ltimes G_2) \leq f(G_1)|V(G_2)|$ for $f \in \{\thin, \pthin, \compthin, \comppthin, \indthin, \indpthin\}$. \end{theorem} Let $G_1$ be isomorphic to $K_2$, such that $V(G_1) = \{v_1,v_2\}$, and $G_2$ be isomorphic to $tK_2$, for some $t \geq 1$, such that $V(G_2) = \{w_1,z_1,\dots,w_t,z_t\}$ and $E(G_2) = \{w_iz_i : 1 \leq i \leq t\}$. In $G_1 \ltimes G_2$, the vertices $\{(v_1,w_i) : 1 \leq i \leq t\} \cup \{(v_2,z_i) : 1 \leq i \leq t\}$ induce the graph $\overline{tK_2}$. In other words, $K_2 \ltimes tK_2$ has $\overline{tK_2}$ as induced subgraph. Now let $G_3$ be isomorphic to $K_t \ \square \ K_2$, for some $t \geq 1$, such that $V(G_3) = \{w_1,z_1,\dots,w_t,z_t\}$, $\{w_1, \dots, w_t\}$ is a clique, $\{z_1, \dots, z_t\}$ is a clique, and $w_i$ is adjacent to $z_j$ if and only if $i = j$. In $G_1 \ltimes G_3$, the vertices $\{(v_1,w_i) : 1 \leq i \leq t\} \cup \{(v_2,z_i) : 1 \leq i \leq t\}$ induce the graph $\overline{tK_2}$. In other words, $K_2 \ltimes (K_t \ \square \ K_2)$ has $\overline{tK_2}$ as induced subgraph. Since $\indpthin(tK_2)=2$ and $\comppthin(K_n \ \square \ K_2)=2$ (Remark~\ref{rem:cart}), we have the following. \begin{corollary}\label{cor:nbhomo} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \ltimes G_2) \leq f(|G_1|,h(G_2))$, for $h \in \{\indpthin,\comppthin\}$ for any pair of graphs $G_1$, $G_2$. \end{corollary} The non existence of bounds in terms of other parameters can be deduced from diagram in Figure~\ref{fig:hasse}. Another consequence of the example above is the following. \begin{corollary}\label{cor:lowerhomo} Given two graphs $G_1$ and $G_2$, if $G_1$ has at least one edge, then $\mim(G_2) \leq \thin(G_1 \ltimes G_2)$. \end{corollary} \subsection{Hom-product} The \emph{hom-product} $G_1 \circ G_2$~\cite{Bacik-phd-hom-prod} is a graph whose vertex set is the Cartesian product $V_1 \times V_2$, and such that two vertices $(u_1,u_2)$ and $(v_1,v_2)$ are adjacent in $G_1 \circ G_2$ if and only if $u_1 \neq v_1$ and either $u_1$ is nonadjacent to $v_1$ in $G_1$ or $u_2$ is adjacent to $v_2$ in $G_2$. It is not necessarily commutative, indeed, $G_1 \circ G_2 = \overline{G_1 \ltimes G_2}$. \begin{theorem}\label{thm:hom} Let $G_1$ and $G_2$ be graphs. Then {$f(G_1 \circ G_2) \leq \indf(G_1 \circ G_2) \leq |V(G_1)|\indf(G_2)$}, for $f \in \{\thin, \pthin\}$. \end{theorem} \begin{proof} Let $G_2$ be a $k$-independent-thin (resp. proper $k$-independent-thin) graph. Consider $V_1 \times V_2$ lexicographically ordered with respect to the {defined} orderings of $V_2$ and $V_1$. Consider now the partition $\{V^{i,j}\}_{1\leq i \leq n_1,\ 1 \leq j \leq k}$ such that $V^{i,j} = \{(v_i,w) : w \in V_2^j\}$ for each $1\leq i \leq n_1$, $1 \leq j \leq k$. By definition of the hom-product, each $V^{i,j}$ is an independent set. We will show now that this ordering and partition of $V_1 \times V_2$ are consistent (resp. strongly consistent). Let $(v_p,w_i), (v_q,w_j), (v_r,w_{\ell})$ be three vertices appearing in that ordering in $V_1 \times V_2$. \emph{Case 1: $i = j = \ell$.} In this case, the three vertices are in different classes, so no restriction has to be satisfied. \emph{Case 2: $i = j < \ell$.} In this case, $(v_p,w_i)$ and $(v_q,w_j)$ are in different classes. So, suppose $G_2$ is proper $k$-independent-thin and $(v_q,w_j), (v_r,w_{\ell})$ belong to the same class, i.e., $q=r$ and $w_i = w_j$ and $w_{\ell}$ belong to the same class in $G_2$. In particular, since the classes are independent sets, $w_i w_{\ell} \not \in E_2$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \circ G_2$ if and only if $p\neq r$ and either $v_p v_r \not \in E_1$ or $w_i w_{\ell} \in E_2$. So, assume $p \neq r$. Since $q=r$, $p \neq q$, and since the graph is loopless and $i = j$, $w_i w_j \not \in E_2$. So $(v_p,w_i)$ is adjacent to $(v_q,w_j)$ in $G_1 \circ G_2$, as required. \emph{Case 3: $i < j = \ell$.} In this case, $(v_q,w_j)$ and $(v_r,w_{\ell})$ are in different classes. So suppose $G_2$ is $k$-independent-thin (resp. proper $k$-independent-thin) and $(v_p,w_i), (v_q,w_j)$ belong to the same class, i.e., $p=q$ and $w_i$ and $w_j = w_{\ell}$ belong to the same class in $G_2$. In particular, since the classes are independent sets, $w_i w_j \not \in E_2$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \circ G_2$ if and only if $p \neq r$ and either $v_p v_r \not \in E_1$ or $w_i w_{\ell} \in E_2$. So, assume $p \neq r$. Since $p=q$, $q \neq r$, and since the graph is loopless and $j = \ell$, $w_j w_{\ell} \not \in E_2$. So $(v_q,w_j)$ is adjacent to $(v_r,w_{\ell})$ in $G_1 \circ G_2$, as required. \emph{Case 4: $i < j < \ell$.} Suppose first that $G_2$ is $k$-independent-thin (resp. proper $k$-independent-thin) and $(v_p,w_i), (v_q,w_j)$ belong to the same class, i.e., $p=q$ and $w_i$, $w_j$ belong to the same class in $G_2$. Since the classes are independent, $w_i$ and $w_j$ are not adjacent. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \circ G_2$ if and only if $p \neq r$ and either $v_p v_r \not \in E_1$ or $w_i w_{\ell} \in E_2$. So, assume $p \neq r$, and since $p=q$, $q \neq r$ too. If $v_p v_r \not \in E_1$, then since $p=q$, $v_q v_r \not \in E_1$, and $(v_q,w_j)$ is adjacent to $(v_r,w_{\ell})$ in $G_1 \circ G_2$, as required. If $w_i w_{\ell} \in E_2$, since $w_i$, $w_j$ belong to the same class in $G_2$ and the partition of $V_2$ is (strongly) consistent with the ordering, {$w_j w_{\ell} \in E_2$}, and $(v_q,w_j)$ is adjacent to $(v_r,w_{\ell})$ in $G_1 \circ G_2$, as required. Now suppose that $G_1$ is proper $k$-thin and $(v_q,w_j), (v_r,w_{\ell})$ belong to the same class, i.e., $q = r$ and $w_j$, $w_{\ell}$ belong to the same class in $G_2$. Vertices $(v_p,w_i)$ and $(v_r,w_{\ell})$ are adjacent in $G_1 \circ G_2$ if and only if $p \neq r$ and either $v_p v_r \not \in E_1$ or $w_i w_{\ell} \in E_2$. So, assume $p \neq r$, and since $q = r$, $p \neq q$ too. If $v_p v_r \not \in E_1$, then since $q = r$, $v_p v_q \not \in E_1$, and $(v_p,w_i)$ and $(v_q,w_j)$ are adjacent in $G_1 \circ G_2$, as required. If $w_i w_{\ell} \in E_2$, since $w_j$, $w_{\ell}$ belong to the same class in $G_2$ and the partition of $V_2$ is strongly consistent with the ordering, $w_i w_j \in E_2$, and $(v_p,w_i)$ is adjacent to $(v_q,w_j)$ in $G_1 \circ G_2$, as required. \end{proof} Notice that $K_2 \circ K_n = CR_n$. Also, $G \circ K_1 = \overline{G}$, so, by taking $G = tK_2$ and $G = K_n \ \square \ K_2$, we have the following. \begin{corollary}\label{cor:nbhom} There is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \circ G_2) \leq f(|G_1|,\comppthin(G_2))$, and there is no function $f: \mathbb{R}^2 \to \mathbb{R}$ such that $\thin(G_1 \circ G_2) \leq f(h(G_1),|G_2|)$ for $h \in \{\indpthin,\comppthin\}$ for any pair of graphs $G_1$, $G_2$. \end{corollary} The non existence of bounds in terms of other parameters can be deduced from diagram in Figure~\ref{fig:hasse}. Further consequences of the examples above are the following. \begin{corollary}\label{cor:lowerhom} Given two graphs $G_1$ and $G_2$, if $G_1$ has at least one edge, then $\omega(G_2)/2 \leq \thin(G_1 \circ G_2)$. \end{corollary} \begin{corollary}\label{cor:lowerhom2} Given two graphs $G_1$ and $G_2$, $\mim(G_1) \leq \thin(G_1 \circ G_2)$. \end{corollary} \section{Conclusion}\label{sec:conc} In this paper, we give upper bounds for the thinness, complete thinness, independent thinness and their proper versions for the union and join of graphs, as well as the lexicographical, Cartesian, direct, strong, disjunctive, modular, homomorphic and hom-products of graphs. These bounds are given in terms of the parameters (depicted in the Hasse diagram of Figure~\ref{fig:hasse}) of the component graphs, and for each of the cases, it is proved that no upper bound in terms of lower parameters (from those in the diagram) of the component graphs exists. The non existence proofs are based on the determination of exact values or lower bounds for the thinness of some families of graphs like complements of matchings, grids, crown graphs, hypercubes, or products of simple graphs like complete graphs, stable sets, induced matchings and induced paths. We summarize the main bounds obtained and the graph families with high thinness in Table~\ref{table1}. \begin{table} \footnotesize \begin{tabular}{|l|l|} \hline \textbf{Upper bounds} & \textbf{High thinness} \\ \hline $\opthin(G_1 \cup G_2) =\max\{\opthin(G_1),\opthin(G_2)\}$ & \\ $\opindthin(G_1 \cup G_2) =\max\{\opindthin(G_1),\opindthin(G_2)\}$ & \\ $\opcompthin(G_1 \cup G_2) =\opcompthin(G_1)+\opcompthin(G_2)$ & \\ \hline $\thin(G_1^* \vee G_2^*)=\thin(G_1^*)+\thin(G_2^*)$ & \\ $\thin(G_1 \vee K_n)=\thin(G_1)$ & \\ $\pthin(G_1 \vee G_2) \leq \pthin(G_1)+\pthin(G_2)$ & \\ $\opindthin(G_1 \vee G_2)=\opindthin(G_1)+\opindthin(G_2)$ & \\ $\opcompthin(G_1 \vee G_2) \leq \opcompthin(G_1)+\opcompthin(G_2)$ & \\ $\compthin(G_1 \vee K_n) =\compthin(G_1)$ & \\ \hline $\opthin(G_1 \bullet G_2) \leq \opindthin(G_1)\cdot \opthin(G_2)$ & $K_n \bullet 2K_1$ \\ $\opthin(G_1 \bullet K_n) =\opthin(G_1)$ & \\ $\opindthin(G_1 \bullet G_2) \leq \opindthin(G_1)\cdot \opindthin(G_2)$ & \\ $\opcompthin(G_1 \bullet G_2) \leq |V(G_1)|\cdot \opcompthin(G_2)$ & \\ $\opcompthin(G_1 \bullet K_n) =\opcompthin(G_1)$ & \\ \hline $\opthin(G_1 \ \square \ G_2) \leq \opthin(G_1) \cdot |V(G_2)|$ & $P_n \ \square \ P_n$ \\ $\opindthin(G_1 \ \square \ G_2) \leq \opindthin(G_1) \cdot |V(G_2)|$ & $K_n \ \square \ K_n$ \\ $\opcompthin(G_1 \ \square \ G_2) \leq \opcompthin(G_1) \cdot |V(G_2)|$ & $K_n \ \square \ K_{n,n}$ \\ \hline $\opthin(G_1 \times G_2) \leq \opindthin(G_1) \cdot |V(G_2)|$ & $K_n \times K_2$ \\ $\opindthin(G_1 \times G_2) \leq \opindthin(G_1) \cdot |V(G_2)|$ & $P_n \times P_n$ \\ \hline $\opthin(G_1 \boxtimes G_2) \leq \opthin(G_1)\cdot |V(G_2)|$ & $P_n \boxtimes P_n$ \\ $\opthin(G_1 \boxtimes K_n) = \opthin(G_1)$ & $(K_n \ \square \ K_2) \boxtimes (K_n \ \square \ K_2)$ \\ $\opindthin(G_1 \boxtimes G_2) \leq \opindthin(G_1)\cdot |V(G_2)|$ & \\ $\opcompthin(G_1 \boxtimes G_2) \leq \opcompthin(G_1)\cdot |V(G_2)|$ & \\ $\opcompthin(G_1 \boxtimes G_2) = \opcompthin(G_1)$ & \\ \hline $\opthin(G_1 \ast G_2) \leq \opindthin(G_1) \cdot |V(G_2)|$ & $K_n \ast 2K_1$ \\ $\opindthin(G_1 \ast G_2) \leq \opindthin(G_1) \cdot |V(G_2)|$ & $nK_2 \ast nK_2$ \\ \hline & $K_n \diamond K_2$ \\ & $nK_2 \diamond K_1$ \\ \hline $\opthin(G_1 \ltimes G_2) \leq \opthin(G_1)\cdot |V(G_2)|$ & $K_2 \ltimes nK_2$ \\ $\opindthin(G_1 \ltimes G_2) \leq \opindthin(G_1)\cdot |V(G_2)|$ & $K_2 \ltimes (K_n \ \square \ K_2)$ \\ $\opcompthin(G_1 \ltimes G_2) \leq \opcompthin(G_1)\cdot |V(G_2)|$ & \\ \hline $\opthin(G_1 \circ G_2) \leq |V(G_1)| \cdot \opindthin(G_2)$ & $K_2 \circ K_n$ \\ $\opindthin(G_1 \circ G_2) \leq |V(G_1)| \cdot \opindthin(G_2)$ & $nK_2 \circ K_1$ \\ & $(K_n \ \square \ K_2) \circ K_1$ \\ \hline \end{tabular} \caption{We summarize the upper bounds (when needed, graphs with an asterisk are not complete). We also summarize the families of graphs with bounded parameters whose product have high thinness, used to show the nonexistence of bounds in terms of certain parameters. Recall that the lexicographic, homomorphic, and hom-product are not necessarily commutative.}\label{table1} \end{table} Furthermore, we describe new general lower and upper bounds for the thinness of graphs, and some lower bounds for the graph operations in terms of other well known graph invariants like clique number, maximum induced matching, longest induced path, or diameter. Some open problems and possible research directions are: \begin{itemize} \item It would be interesting to find tighter bounds, in the case in which it is possible. \item It remains as an open problem the computational complexity of computing the independent and complete (proper) thinness for general graphs. For co-comparability graphs, both the independent thinness and independent proper thinness are exactly the chromatic number, which can be computed in polynomial time~\cite{Go-comp2}. \item Regarding lower and upper bounds in Section~\ref{sec:families}, can we have some similar results for proper thinness? Or for the independent and complete versions of (proper) thinness? \item Does there exist a graph $G$ such that $\thin(G) > |V(G)|/2$? \item Does there exist a co-comparability graph $G$ such that $\pthin(G) > |V(G)|/2$? \end{itemize} \section*{Acknowledgements} \label{sec:ack} This work was done when Moys\'es S. Sampaio Jr. was visiting the University of Buenos Aires, funded by a grant from FAPERJ. The work was also partially supported by UBACyT Grants 20020170100495BA and 20020160100095BA (Argentina), FAPERJ, CAPES and CNPq (Brazil), and Programa Regional MATHAMSUD MATH190013. Carolina L. Gonzalez is partially supported by a CONICET doctoral fellowship. We want to thank the anonymous referees for their valuable suggestions that helped us improving this work.
\section{Introduction}\label{sec:I} In recent years, theoretical and experimental evidence has shown that periodic driving can be a key element for engineering exotic quantum mechanical states of matter, such as time crystals and superconductors at room temperature \cite{OK19}, \cite{H16}, \cite{RL20}. The renewed interest in Floquet engineering, i.~e., the control of quantum systems by periodic driving, is due to (a) the rapid development of laser and ultrashort spectroscopy techniques \cite{BAP15}, (b) the discovery and understanding of various ``quantum materials" that exhibit interesting exotic properties \cite{RL19}, \cite{Fetal19} , and (c) the interaction with other emerging fields of physics such as programmable matter \cite{TM91} and periodic thermodynamics \cite{Kohn01} - \cite{DSSH20}. One of the simplest system to study periodic driving is a two level system (TLS) interacting with a classical periodic radiation field. The special case of a constant magnetic field in, say, $x$-direction plus a circularly polarized field in the $y-z$-plane was already solved more than eight decades ago by I.~I.~Rabi \cite{R37} and can be found in many textbooks. This case is referred to as RPC in the following. Shortly thereafter, F.~Bloch and A.~Siegert \cite{BS40} considered the analogous problem of a linearly polarized magnetic field orthogonal to the direction of the constant field (henceforth called RPL) and proposed the so-called rotating wave approximation. They also investigated the shift of the resonant frequencies due to the approximation error of the rotating wave approximation, since then called the "Bloch-Siegert shift." In the following decades one noticed \cite{AT55}, \cite{S65} that the underlying mathematical problem leads to the Floquet Theory \cite{Floquet83}, which deals with linear differential matrix equations with periodic coefficients \cite{YS75}, \cite{T12}. Accordingly, analytical approximations for solutions were worked out, which formed the basis for subsequent research. In particular, the groundbreaking work of J.~H.~Shirley \cite{S65} is has been cited over 13,000 times. Among the numerous applications of the theory of periodically driven TLS are nuclear magnetic resonance \cite{R38}, ac-driven quantum dots \cite{WT10}, Josephson qubit circuits \cite{YN11}, and coherent destruction of tunnelling \cite{MZ16}. On a theoretical level, the methods for solving the RPL and related problems have been gradually refined and include power series approximations for Bloch-Siegert shifts \cite{HPS73}, \cite{AB74}, perturbation theory and/or various boundary cases \cite{LP92} -- \cite{WY07} and the hybridized rotating wave approximation \cite{YLZ15}. Also, the inverse method yields analytical solutions for certain periodically driven TLS \cite{GDG10} -- \cite{SNGM18}. In the meantime also the RPL has been analytically solved \cite{ML07}, \cite{XH10}. This solution is based on a transformation of the Schr\"odinger equation into a confluent Heun differential equation. A similar approach was previously applied to the TLS subject to a magnetic pulse \cite{JR10}, \cite{JR10a} and has been extended to other cases of physical interest \cite{IG14}, \cite{ISI15}. In the special case of the RPL the analytical solution has been further elaborated to include time evolution over a full period and explicit expressions for the quasienergy \cite{SSH20a}. In this paper we will extend these results to the Rabi problem with elliptic polarization (RPE) that is also of experimental interest, see \cite{Letal14}, \cite{Ketal15}. Here we will approach the Floquet problem of the TLS via its well-known classical limit, see, e.~g., \cite{AW05}. It has been shown that, for the particular problem of a TLS with periodic driving, the classical limit is already equivalent to the quantum problem \cite{S18}, \cite{S20b}. More precisely, to each periodic solution of the classical equation of motion there exists a Floquet solution of the original Schr\"odinger equation that can be explicitly calculated via integrations. Especially, the quasienergy is essentially given by the action integral over one period of the classical solution. This is reminiscent of the semiclassical Floquet theory developed in \cite{BH91}. The motion of a classical spin vector ${\mathbf S}(\tau)$ in a monochromatical magnetic field with elliptic polarization and an orthogonal constant component can be analyzed by following an approach analogous to that leading to the confluent Heun equation in \cite{ML07}, \cite{XH10}. We differentiate the first order equation of motion twice and eliminate two components of the spin vector. The resulting third order differential equation for the remaining component $x(\tau)$ can be transformed into a differential equation with polynomial coefficients by the change from the dimensionless time variable $\tau$ to $u=\sin^2 \frac{\tau}{2}$. The latter differential equation is solved by a power series in $u$ such that its coefficients satisfy a six terms recurrence relation. The second component $y(\tau)$ can be treated in the same way whereas the third component $z(\tau)$ is obtained in a different way. As in the RPL case the transformation from $\tau$ to $u$ is confined to the half period $0< \tau < \pi$ and, and moreover, the resulting power series diverges for $u=1$ corresponding to $\tau=\pi$. Hence it is necessary to reduce the full time evolution of the classical spin vector to the first quarter period. This is done analogously to the procedure in \cite{SSH20a} utilizing the discrete symmetries of the polarization ellipse. The structure of the paper is the following. In Section \ref{sec:Def} we present the scenario of the classical Rabi problem with elliptic polarization and its connection to the underlying Schr\"odinger equation. The above-mentioned reduction of the time evolution to the first quarter period is made in Section \ref{sec:R}. Already in the following Section \ref{sec:Q}, before solving the equation of motion, it can be shown that the fully periodic monodromic matrix depends only on two parameters $r$ and $\alpha$, which determine the quasienergy and the initial value of the periodic solution ${\mathbf S}(\tau)$, respectively. The Fourier series of this solution necessarily have the structure of an even/odd $\cos$-series for $x(\tau)/y(\tau)$ and an odd $\sin$-series for $z(\tau)$. The third order differential equations for $X(u(\tau))=x(\tau)$ and $Y(u(\tau))=y(\tau)$ and their power series solutions are derived in Section \ref{sec:H}. First consequences of this solution for the Fourier series coefficients and the parameters $r$ and $\alpha$ are considered in Section \ref{sec:FS}. In order to check our results obtained so far we consider, in Section \ref{sec:T}, an example of the time evolution with simple values of the parameters of the polarization ellipse and two different initial values. On the one hand, we calculate the time evolution by using ten terms of the above-mentioned power series solutions for the first quarter period and extend the result to the full period. One the other hand, we numerically calculate the time evolution and find satisfactory agreement between both methods. The quasienergy is discussed in more details in Section \ref{sec:QIII} with the emphasis on curves in parameter space where it vanishes. The resonance frequencies $\omega_{res}^{(n)}$ can be expressed in terms of power series in the variables $F$ and $G$ denoting the semi-axes of the polarization ellipse and compared with known results for the limit cases of linear and circular polarization, see Section \ref{sec:RES}. The next Section \ref{sec:L} is devoted to the discussion of further limit cases along the lines of \cite{S18}. In the adiabatic limit of vanishing driving frequency $\omega\rightarrow 0$ the spin vector follows the direction of the magnetic field, see Subsection \ref{sec:LOM}. The corresponding quasienergy can be expressed through a complete elliptic integral of the second kind. The next two order corrections proportional to $\omega^1$ and $\omega^2$ can be obtained recursively and yield a kind of asymptotic envelope of a certain branch of the quasienergy as a function of $\omega$. In the next limit case of $F,G\rightarrow 0$ in Subsection \ref{sec:FG} the solution ${\mathbf S}(t)$ and the quasienergy can be written in the form of a so-called Fourier-Taylor series. This series is also of interest for the limit case of vanishing energy level splitting $\omega_0\rightarrow 0$ in Subsection \ref{sec:LOMO}, where it replaces the exact solution of the RPL for $\omega_0=0$, and allows analytical approximations for the further limit cases $F\rightarrow 0$ and $F\rightarrow G$. An application concerning the work performed on a TLS by an elliptically polarized field is given in Section \ref{sec:WO}. We close with a summary and outlook in Section \ref{sec:SO}. \section{The classical Rabi problem: General Definitions and results}\label{sec:Def} We consider the Schr\"odinger equation \begin{equation}\label{SE1} {\sf i}\hbar\, \frac{d}{dt}\Psi(t)=H(t)\,\Psi(t) \;, \end{equation} of a spin with quantum number $s=1/2$, $\Psi(t)={\Psi_1(t)\choose \Psi_2(t)}$ and a time-dependent, periodic Hamiltonian \begin{equation}\label{SE2} H(t) = \frac{\hbar}{2}\left( \omega_0\,\sigma_1+G\,\cos(\omega t)\,\sigma_2+F\,\sin(\omega t)\,\sigma_3\right) \;, \end{equation} where the $\sigma_i,\;i=1,2,3$ are the Pauli matrices \begin{equation}\label{SE3} \sigma_1=\left(\begin{array}{cc} 0 & 1 \\ 1 & 0 \end{array} \right),\; \sigma_2=\left(\begin{array}{cc} 0 & -{\sf i} \\ {\sf i} & 0 \end{array} \right),\; \sigma_3=\left(\begin{array}{cc} 1 & 0 \\ 0 & -1 \end{array} \right)\;. \end{equation} Hence $H(t)$ can be understood as a Zeeman term w.~r.~t.~a (dimensionless) magnetic field \begin{equation}\label{SE4} {\mathbf H}(t)=\left( \begin{array}{c} \omega_0 \\ G\,\cos\omega t \\ F\,\sin\omega t \end{array} \right) \;. \end{equation} Alternatively, $\frac{\hbar}{2}\omega_0\,\sigma_1$ can be understood as the zero field Hamiltonian of a two level system and (\ref{SE4}) without the constant component as a monochromatic, elliptically polarized magnetic field. Setting $\hbar=1$ and passing to a dimensionless time variable $\tau=\omega\,t$ we may rewrite (\ref{SE1}) in the form \begin{equation}\label{SE5} {\sf i}\,\frac{d}{d\tau} {\psi_1(\tau)\choose \psi_2(\tau)}= {\textstyle\frac{1}{2}} \left( \begin{array}{cc} f\,\sin\tau & \nu-g\,\cos\tau \\ \nu+g\,\cos\tau & -f\,\sin\tau \end{array} \right)\, {\psi_1(\tau)\choose \psi_2(\tau)} \;, \end{equation} where $G=g\,\omega$, $F=f\,\omega$ and $ \omega_0=\nu\,\omega$. The dimensionless period is always $T\,\omega=2\pi$. Sometimes, we will denote the derivative w.~r.~t.~$\tau$ by an overdot $\frac{d}{d\tau}=\dot{}\;$. Let \begin{equation}\label{SE6} P(\tau)=\left| {\psi_1(\tau)\choose \psi_2(\tau)} \right\rangle \left\langle {\psi_1(\tau)\choose \psi_2(\tau)}\right| \end{equation} denote the one-dimensional time-dependent projector onto a solution of (\ref{SE5}) and \begin{equation}\label{SE7} P(\tau) = {\textstyle\frac{1}{2}}\left({\mathbbm 1}+ x(\tau)\,\sigma_1+ y(\tau)\,\sigma_2+ z(\tau)\,\sigma_3\right) \end{equation} its expansion w.~r.~t.~the basis $({\mathbbm 1},\sigma_1,\sigma_2,\sigma_3)$ of Hermitean $2\times 2$-matrices. It follows that the vector ${\mathbf S}(\tau)=(x(\tau),y(\tau),z(\tau))^\top$ satisfies the classical equation of motion \begin{equation}\label{D1} \frac{d}{d\tau}{\mathbf S}(\tau) = {\mathbf h}(\tau)\times {\mathbf S}(\tau) \;, \end{equation} and hence ${\mathbf S}(\tau)$ can be viewed as a classical spin vector (not necessarily normalized). Moreover, \begin{equation}\label{D2} {\mathbf h}(\tau)=\left( \begin{array}{c} h_1 \\ h_2 \\ h_3 \end{array} \right) =\left( \begin{array}{c} \nu \\ g\,\cos\tau \\ f\,\sin\tau \end{array} \right) \end{equation} denotes the dimensionless magnetic field vector (\ref{SE4}) written as a function of $\tau$. Conversely, to each solution of (\ref{D1}) one obtains the corresponding solution of (\ref{SE5}) up to a time-dependent phase that can be obtained by an integration, see \cite{S18} for the details. The coefficients of the Taylor series w.~r.~t.~$\tau$ of $x(\tau),y(\tau)$ and $z(\tau)$ can be recursively determined by using (\ref{D1}) and the initial values $x(0),y(0)$ and $z(0))$. Note that $h_1$ and $h_2$ are even functions of $\tau$ and that $h_3$ is an odd one. Hence there exist special solutions of (\ref{D1}) such that $x(\tau)$ and $y(\tau)$ are even functions of $\tau$ and $z(\tau)$ is an odd one, symbolically: \begin{equation}\label{Deo1} {\mathbf S}(\tau)=\left( \begin{array}{c} \mbox{even} \\ \mbox{even}\\ \mbox{odd} \end{array} \right) \;. \end{equation} In fact, this is consistent with (\ref{D1}) and (\ref{D2}) since \begin{equation}\label{Deo2} \frac{d}{d \tau}{\mathbf S}(\tau)=\left( \begin{array}{c} \mbox{odd} \\ \mbox{odd}\\ \mbox{even} \end{array} \right) \;, \end{equation} and \begin{equation}\label{Deo3} {\mathbf h}\times {\mathbf S}=\left( \begin{array}{c} \mbox{even} \\ \mbox{even}\\ \mbox{odd} \end{array} \right) \times \left( \begin{array}{c} \mbox{even} \\ \mbox{even}\\ \mbox{odd} \end{array} \right)= \left( \begin{array}{c} \mbox{odd} \\ \mbox{odd}\\ \mbox{even} \end{array} \right) \;, \end{equation} and can be proven by induction over the degree of the Taylor series coefficients of $ {\mathbf S}(\tau)$ using the necessary initial condition $z(0)=0$. Analogously, there exist solutions ${\mathbf S}(\tau)$ of type \begin{equation}\label{Deo4} {\mathbf S}(\tau)=\left( \begin{array}{c} \mbox{odd} \\ \mbox{odd}\\ \mbox{even} \end{array} \right) \;. \end{equation} satisfying $x(0)=y(0)=0$. We will state these results in the following form: \begin{prop}\label{Peo} \begin{enumerate} \item The solution ${\mathbf S}(\tau)$ of (\ref{D1}) is of type (\ref{Deo1}) iff $z(0)=0$. \item Analogously, the solution ${\mathbf S}(\tau)$ of (\ref{D1}) is of type (\ref{Deo4}) iff $x(0)=y(0)=0$. \end{enumerate} \end{prop} For general initial conditions the solution ${\mathbf S}(\tau)$ of (\ref{D1}) will be of mixed type.\\ Next, let ${\mathbf S}^{(i)}(\tau),\;i=1,2,3,$ denote the three solutions of (\ref{D1}) with initial conditions ${\mathbf S}^{(i)}_j(\tau_0)=\delta_{ij}$ and $R(\tau,\tau_0)$ be the $3\times 3$-matrix with columns ${\mathbf S}^{(i)}(\tau)$. Since the ${\mathbf S}^{(i)}(\tau)$ are mutually orthogonal and and right-handed for $\tau=\tau_0$ this holds for all $\tau\in{\mathbbm R}$ and hence $R(\tau,\tau_0)\in SO(3)$. It satisfies the differential equation \begin{equation}\label{D3} \frac{d}{d\tau}R(\tau,\tau_0)=H(\tau)\, R(\tau,\tau_0) \;, \end{equation} with initial condition \begin{equation}\label{D4} R(\tau_0,\tau_0)={\mathbbm 1} \;. \end{equation} Here $H(\tau)\in so(3)$ is the real anti-symmetric $3\times 3$-matrix corresponding to ${\mathbf h}(\tau)$, i.~e.~, \begin{equation}\label{D5} H(\tau)= \left( \begin{array}{ccc} 0 & -f\,\sin\tau & g\,\cos\tau \\ f\,\sin\tau & 0 & -\nu \\ -g\,\cos\tau & \nu & 0 \end{array} \right) \;. \end{equation} The differential equation (\ref{D3}) with initial condition (\ref{D4}) has a unique solution $R(\tau,\tau_0)$ for all $\tau,\,\tau_0\in{\mathbbm R}$, see, e.~g., theorem $3.9$ in \cite{T12}. Obviously, this implies the composition law \begin{equation}\label{DRcomp} R(\tau_2,\tau_0)= R(\tau_2,\tau_1)\, R(\tau_1,\tau_0) \;, \end{equation} and hence \begin{equation}\label{DRinv} R(\tau_2,\tau_1)^{-1}= R(\tau_1,\tau_2) \;, \end{equation} for all $\tau_0,\tau_1, \tau_2\in{\mathbbm R}$. Usually we will set $\tau_0=0$. The matrix $H(\tau)$ is obviously $2\pi$-periodic. Hence we may apply Floquet theory to the classical equation of motion (\ref{D1}). The monodromy matrix $R(2\pi,0)$ has the eigenvalues $\{1,\exp\left(\pm {\sf i}\rho\}\right)$ which leads to the corresponding classical quasienergy (or Floquet exponent) of the form \begin{equation}\label{D6} \epsilon^{(cl)}=0,\pm \frac{\rho}{2\pi} \;, \end{equation} uniquely defined up to integer multiples (note that effectively $\omega=1$ in our approach). The connection to the quasienergy $\epsilon^{(qu)}$ of the underlying spin $s=\frac{1}{2}$ Schr\"odinger equation (\ref{SE5}) can be given in two ways. Either we may utilize the fact that the classical Rabi problem can be understood as the ``lift" of the spin $s=\frac{1}{2}$ problem to spin $s=1$. Then Eq.~(38) of \cite{S18} implies \begin{equation}\label{D7} \epsilon^{(cl)}=2\, m\,\epsilon^{(qu)},\quad \mbox{where } m=-1,0,1 \;. \end{equation} Taking into account the mentioned ambiguity of $\epsilon^{(cl)}$ this means that we have two possibilities: Either $\epsilon^{(qu)}=\pm \frac{1}{2} \epsilon^{(cl)}$ or $\epsilon^{(qu)}=\frac{1}{2}(1\pm \epsilon^{(cl)})$. Since we have, modulo integers, only two values for $\epsilon^{(qu)}$ these two possibilities are generally exclusive. One way to decide between the two possibilities would be to utilize the well-known quasienergies for the RPC, that agree with the case $\epsilon^{(qu)}=\frac{1}{2}(1\pm \epsilon^{(cl)})$, and to argue with continuity. Another way to obtain $\epsilon^{(qu)}$ would be to follow the prescription given in \cite{S18} and write \begin{equation}\label{D8} \epsilon^{(qu)}=\overline{\frac{1}{2}\left(h_1+\frac{h_2\,y+h_3\,z}{1+z} \right)} \;, \end{equation} where the overline indicates the time average over one period of a $2\pi$-periodic solution ${\mathbf S}(\tau)$ of (\ref{D1}). An equivalent expression, that is manifestly invariant under rotations, is given by \begin{equation}\label{D8a} \epsilon^{(cl)}= \textstyle{ \overline{{\mathbf h}\cdot {\mathbf S} - \frac{{\mathbf S}\cdot\left(\dot{\mathbf S}\times \ddot{\mathbf S} \right)}{\dot{\mathbf S}\cdot \dot{\mathbf S}}} } \;, \end{equation} see Eq.~(46) in \cite{S20b}. Periodic solutions of (\ref{D1}) can be found by using the initial value ${\mathbf S}(0)={\mathbf r}$, where ${\mathbf r}$ is the normalized eigenvector of $R(2\pi,0)$ corresponding to the eigenvalue $1$, see also \cite{S20b}. Of course, both ways, (\ref{D7}) and (\ref{D8}), to obtain $\epsilon^{(qu)}$ agree within the usual ambiguity modulo integers. This will be explicitly checked in Section \ref{sec:QIII} for the case of circular polarization. \section{Reduction to the first quarter period}\label{sec:R} Due to the discrete symmetries of the polarization ellipse it is possible to reduce the time evolution of the classical spin to the first quarter period $\tau\in [0,\frac{\pi}{2}]$. This is similar to the corresponding considerations in \cite{SSH20a}. Let $T^{(i)},\,i=1,2,3$ denote the involutory diagonal $3\times 3$-matrices with entries $T^{(i)}_{jk}=(-1)^{\delta_{ij}}\,\delta_{jk}$, for example, \begin{equation}\label{R1} T^{(1)}=\left( \begin{array}{rrr} -1&0 & 0\\ 0 & 1 &0 \\ 0 & 0 & 1 \end{array} \right) \;, \end{equation} and $T^{(ij)}\equiv T^{(i)}\,T^{(j)}$, for example, \begin{equation}\label{R2} T^{(13)}=\left( \begin{array}{rrr} -1&0 & 0\\ 0 & 1 &0 \\ 0 & 0 & -1 \end{array} \right) \;. \end{equation} First we will formulate a proposition that allows us to reduce the time evolution for the classical spin from the full period to the first half period $\tau\in[0,\pi]$. \begin{prop}\label{prop1} \begin{equation}\label{R3} R(\pi+\tau,0)=T^{(1)}\,R(\tau,0)\,T^{(1)}\,R(\pi,0) \end{equation} for all $\tau\in{\mathbbm R}$. \end{prop} \noindent Proof:\\ Let $\tilde{R}(\tau)\equiv T^{(1)}\,R(\pi+\tau,\pi)\,T^{(1)}$ such that $\tilde{R}(0)=T^{(1)}\,R(\pi,\pi)\,T^{(1)}={\mathbbm 1}$. It satisfies the differential equation \begin{eqnarray} \label{R4a} \frac{d}{d\tau} \tilde{R}(\tau)&=& T^{(1)}\,\left( \frac{d}{d\tau} R(\pi+\tau,\pi)\right)\,T^{(1)} \\ \label{R4b} &\stackrel{(\ref{D3})}{=}& T^{(1)}\,\left(H(\pi+\tau)\, R(\pi+\tau,\pi)\right)\,T^{(1)}\\ \label{R4c} &=& \left(T^{(1)}\,H(\pi+\tau)\,T^{(1)}\right)\left(T^{(1)}\, R(\pi+\tau,\pi)\,T^{(1)}\right)\\ \label{R4d} &=& H(\tau)\,\left(T^{(1)}\, R(\pi+\tau,\pi)\,T^{(1)}\right)\\ \label{R4e} &=& H(\tau)\, \tilde{R}(\tau) \;. \end{eqnarray} In (\ref{R4d}) we have used that $\sin( \pi+\tau)= -\sin\tau$, $\cos(\pi+\tau)=-\cos\tau$ and hence \begin{equation}\label{R5} T^{(1)}\,H(\pi+\tau)\,T^{(1)}= \left( \begin{array}{rrr} -1&0 & 0\\ 0 & 1 &0 \\ 0 & 0 & 1 \end{array} \right)\; \left( \begin{array}{ccc} 0 & f\,\sin\tau &- g\,\cos\tau \\ -f\,\sin\tau & 0 & -\nu \\ g\,\cos\tau & \nu & 0 \end{array} \right) \; \left( \begin{array}{rrr} -1&0 & 0\\ 0 & 1 &0 \\ 0 & 0 & 1 \end{array} \right) \end{equation} \begin{equation}\label{R6} = \left( \begin{array}{ccc} 0 & -f\,\sin\tau & g\,\cos\tau \\ f\,\sin\tau & 0 & -\nu \\ -g\,\cos\tau & \nu & 0 \end{array} \right) =H(\tau) \;. \end{equation} It follows that $\tilde{R}(\tau)$ satisfies the same differential equation and initial condition as $R(\tau,0)$ and hence\\ $T^{(1)}\,R(\pi+\tau,\pi)\,T^{(1)}=\tilde{R}(\tau)=R(\tau,0)$. Consequently, \begin{equation}\label{R7} R(\pi+\tau,0)\stackrel{(\ref{DRcomp})}{=}R(\pi+\tau,\pi)\,R(\pi,0)=T^{(1)}\,R(\tau,0)\,T^{(1)}\,R(\pi,0) \;, \end{equation} which completes the proof of the proposition. \hfill$\Box$\\ Setting $\tau=\pi$ in (\ref{R3}) gives \begin{equation}\label{R7a} R(2\pi,0)=T^{(1)}\,R(\pi,0)\,T^{(1)}\,R(\pi,0)=\left(T^{(1)}\,R(\pi,0)\right)^2 \;. \end{equation} Next we show how to further reduce the time evolution to the first quarter period $\tau\in [0,\frac{\pi}{2}]$. \begin{prop}\label{prop2} \begin{equation}\label{R8} R(\pi-\tau,0)=T^{(13)}\,R(\tau,0)\,T^{(13)}\,R(\pi,0) \end{equation} for all $\tau\ge 0$. \end{prop} \noindent Proof: The proof is similar to that of proposition \ref{prop1} except that an additional time reflection is involved. Let $\tilde{R}(\tau)\equiv T^{(13)}\,R(\pi-\tau,\pi)\,T^{(13)}$ such that $\tilde{R}(0)=T^{(13)}\,R(\pi,\pi)\,T^{(13)}={\mathbbm 1}$. It satisfies the differential equation \begin{eqnarray} \label{R9a} \frac{d}{d\tau} \tilde{R}(\tau)&=& T^{(13)}\,\left( \frac{d}{d\tau} R(\pi-\tau,\pi)\right)\,T^{(13)} \\ \label{R9b} &\stackrel{(\ref{D3})}{=}& T^{(13)}\,\left(-H(\pi-\tau)\, R(\pi-\tau,\pi)\right)\,T^{(13)}\\ \label{R9c} &=& \left(T^{(13)}\,\left(-H(\pi-\tau)\,T^{(13)}\right)\right)\left(T^{(13)}\, R(\pi-\tau,\pi)\,T^{(13)}\right)\\ \label{R9d} &=& H(\tau)\,\left(T^{(13)}\, R(\pi-\tau,\pi)\,T^{(13)}\right)\\ \label{R9e} &=& H(\tau)\, \tilde{R}(\tau) \;. \end{eqnarray} In (\ref{R9d}) we have used that $\sin (\pi-\tau)= \sin\tau$, $\cos (\pi-\tau)= -\cos\tau$ and hence \begin{equation}\label{R10} T^{(13)}\,(-H(\pi-\tau))\,T^{(13)}= \left( \begin{array}{rrr} -1&0 & 0\\ 0 & 1 &0 \\ 0 & 0 & -1 \end{array} \right)\; \left( \begin{array}{ccc} 0 & f\,\sin\tau & g\,\cos\tau \\ -f\,\sin\tau & 0 & \nu \\ -g\,\cos\tau & -\nu & 0 \end{array} \right) \; \left( \begin{array}{rrr} -1&0 & 0\\ 0 & 1 &0 \\ 0 & 0 & -1 \end{array} \right) \end{equation} \begin{equation}\label{R11} = \left( \begin{array}{ccc} 0 & -f\,\sin\tau & g\,\cos\tau \\ f\,\sin\tau & 0 & -\nu \\ -g\,\cos\tau & \nu & 0 \end{array} \right) =H(\tau) \;. \end{equation} It follows that $\tilde{R}(\tau)$ satisfies the same differential equation and initial condition as $R(\tau,0)$ and hence \begin{equation}\label{R11a} T^{(13)}\,R(\pi-\tau,\pi)\,T^{(13)}=\tilde{R}(\tau)=R(\tau,0) \;. \end{equation} Consequently, \begin{equation}\label{R12} R(\pi-\tau,0)\stackrel{(\ref{DRcomp})}{=} R(\pi-\tau,\pi)\, R(\pi,0) = T^{(13)}\, R(\tau,0)\,T^{(13)}\,R(\pi,0) \;, \end{equation} which completes the proof of the proposition. \hfill$\Box$\\ Setting $\tau=\pi$ in (\ref{R11a}) implies \begin{equation}\label{R12a} T^{(13)}\,R(0,\pi)\,T^{(13)}=R(\pi,0) \;, \end{equation} and hence \begin{equation}\label{R12b} R(0,\pi)\stackrel{(\ref{DRinv})}{=}R(\pi,0)^\top=T^{(13)}\,R(\pi,0)\,T^{(13)} \;. \end{equation} Moreover, if we set $\tau=\frac{\pi}{2}$ in (\ref{R8}) we obtain \begin{equation}\label{R13} R({\textstyle\frac{\pi}{2},0})=T^{(13)}\, R({\textstyle\frac{\pi}{2},0})\,T^{(13)}\,R(\pi,0) \;, \end{equation} and hence, solving for $ R(\pi,0)$, \begin{equation}\label{R14} R(\pi,0)=T^{(13)}\, R({\textstyle\frac{\pi}{2},0})^\top\,T^{(13)}\, R({\textstyle\frac{\pi}{2},0}) \;. \end{equation} Thus (\ref{R8}) can be re-written as \begin{equation}\label{R15} R(\pi-\tau,0)=T^{(13)}\,R(\tau,0)\, R({\textstyle\frac{\pi}{2},0})^\top\,T^{(13)}\, R({\textstyle\frac{\pi}{2},0}) \;, \end{equation} and hence the evolution data for $\tau\in [\frac{\pi}{2},\pi]$ can be completely written in terms of those for $\tau\in[0,\frac{\pi}{2}]$. Together with (\ref{R3}) this shows that the complete time evolution can be reduced to that in the first quarter period. \section{Fourier series and quasienergy: Preliminary results}\label{sec:Q} First we will re-derive (\ref{R12b}) under more general assumptions. \begin{prop}\label{prop3} Let $ R\in SO(3)$ and $T\in O(3)$ be such that $T^2={\mathbbm 1}$ and hence $T^\top=T$. Define $\tilde{R}\in SO(3)$ by \begin{equation}\label{Q1} \tilde{R}\equiv T\,R^\top\,T\,R \;, \end{equation} then \begin{equation}\label{Q2} \tilde{R}^\top = T\,\tilde{R}\,T \end{equation} holds. \end{prop} Proof: $\tilde{R}^\top =\left(T\,R^\top\,T\,R\right)^\top= R^\top\,T\,R\,T=T^2\,R^\top\,T\,R\,T =T\,\left( T\,R^\top\,T\,R\right)\,T=T\,\tilde{R}\,T$. \hfill$\Box$\\ Let us specialize to the case $T=T^{(13)}$, then (\ref{Q2}) is equivalent to the following three equations: \begin{equation}\label{Q3} \tilde{R}_{12}=-\tilde{R}_{21},\quad \tilde{R}_{13}=\tilde{R}_{31},\quad \tilde{R}_{23}=-\tilde{R}_{32}\;. \end{equation} A general rotational matrix $\tilde{R}\in SO(3)$ can be determined by three real parameters; by the three equations (\ref{Q3}) the number of parameters can be reduced to two: \begin{prop}\label{prop4} Every rotational matrix $\tilde{R}\in SO(3)$ satisfying (\ref{Q3}) will be of the form \begin{equation}\label{Q4} \tilde{R}=\left( \begin{array}{ccc} r^2+\left(1-r^2\right) \cos (2 \alpha ) & \left(1-r^2\right) \sin (2 \alpha ) & 2 r \sqrt{1-r^2} \sin (\alpha ) \\ -\left(1-r^2\right) \sin (2 \alpha ) &\left(1-r^2\right) \cos (2 \alpha )-r^2 & 2 r \sqrt{1-r^2} \cos (\alpha ) \\ 2 r \sqrt{1-r^2} \sin (\alpha ) & -2 r \sqrt{1-r^2} \cos (\alpha ) & 1-2 r^2 \\ \end{array} \right)\;, \end{equation} where $r\in [0,1]$ and $\alpha\in [0,2\pi]$. \end{prop} Proof:\\ Obviously, the $3^{rd}$ column $\tilde{R}_3$ of $\tilde{R}$ according to (\ref{Q4}) is the most general form of a unit vector. The $2^{nd}$ column $\tilde{R}_2$ must be a unit vector orthogonal to $\tilde{R}_3$ with a given component $\tilde{R}_{3,2}=-\tilde{R}_{2,3}=-2 r \sqrt{1-r^2} \cos (\alpha )$. If $r>0$ there are only two possibilities for $\tilde{R}_2$: the first one is given by (\ref{Q4}) and the second one is ${\mathbf b}=\left(-r^2 \sin (2 \alpha ), -r^2\cos (2 \alpha )-r^2+1,-2 r \sqrt{1-r^2} \cos(\alpha )\right)^\top$. The $1^{st}$ column of $\tilde{R}$ is uniquely given by $\tilde{R}_1=\tilde{R}_2\times \tilde{R}_3$, but $\tilde{R}_2={\mathbf b}$ does not yield a matrix satisfying (\ref{Q3}) and hence has to be excluded. We have still to consider the case $r=0$ such that $\tilde{R}_3=(0,0,1)^\top$. Then the representation (\ref{Q4}) reduces to \begin{equation}\label{Q5} \left( \begin{array}{ccc} \cos (2 \alpha ) & \sin (2 \alpha ) & 0 \\ -\sin (2 \alpha ) & \cos (2 \alpha ) & 0 \\ 0 & 0 & 1 \\ \end{array} \right) \;, \end{equation} which is obviously the most general case satisfying (\ref{Q3}) and $\tilde{R}_3=(0,0,1)^\top$. \hfill$\Box$\\ Recall that the ``half period monodromy matrix" $R(\pi,0)$ satisfies (\ref{R12b}), hence, according to Prop.~\ref{prop3}, also (\ref{Q3}) and, by virtue of Prop.~\ref{prop4}, must be of the form (\ref{Q4}). In the case of linear polarization ($g=0$) this result also follows from the form of the half period monodromy matrix $U(\pi,0)$ of the corresponding Schr\"odinger equation, see equation (30) in \cite{SSH20a}, where the parameters $r$ and $\alpha$ have the same meaning as in this paper. Using (\ref{R7a}) we can immediately derive the form of the full period monodromy matrix \begin{equation}\label{Q6} R(2\pi,0)=\left( \begin{array}{ccc} \left(1-2 r^2\right)^2+4 r^2 \left(1-r^2\right) \cos (2 \alpha ) & 4 r^2 \left(1-r^2\right) \sin (2 \alpha ) & 4 r \sqrt{1-r^2} \left(2 r^2-1\right) \sin (\alpha ) \\ 4 r^2 \left(1-r^2\right) \sin (2 \alpha ) & 4 \left(r^2-1\right) r^2 \cos (2 \alpha )+\left(1-2 r^2\right)^2 & 4 r \left(1-2 r^2\right) \sqrt{1-r^2} \cos (\alpha ) \\ 4 r \left(1-2 r^2\right) \sqrt{1-r^2} \sin (\alpha ) & 4 r \sqrt{1-r^2} \left(2 r^2-1\right) \cos (\alpha ) & 8 r^4-8 r^2+1 \\ \end{array} \right). \end{equation} It will be instructive to sketch another derivation of (\ref{Q6}). To this end we state without proof that the monodromy matrix of the Schr\"odinger equation (\ref{SE5}) will assume the form \begin{equation}\label{QQ1} U= U(2\pi,0)=\left( \begin{array}{cc} 1-2 r^2 & 2{\sf i}r\sqrt{1-r^2}e^{-{\sf i}\alpha} \\ 2{\sf i}r\sqrt{1-r^2}e^{{\sf i}\alpha} & 1-2 r^2 \end{array} \right)\;, \end{equation} completely analogous to eq.~(33) of \cite{SSH20a}. $U$ has the eigenvalues $\exp (\pm 2 \,{\sf i}\,\arcsin r)$ with respective eigenvectors $\left(e^{\pm{\sf i}\alpha},1\right)^\top$. Then the corresponding monodromy matrix $\rho$ of the classical RPE is given by the equation \begin{equation}\label{QQ2} U\,\sigma_i\,U^\ast = \sum_{j=1}^{3}\rho_{j,i}\,\sigma_j \;, \end{equation} where the $\sigma_i$ are the Pauli matrices (\ref{SE3}). It is easy to check that the so defined matrix $\rho$ coincides with $R(2\pi,0)$ given by (\ref{Q6}). Like $R(\pi,0)$ also $R(2\pi,0)$ depends only on two parameters $\alpha$ and $r$ and satisfies a similar equation that characterizes the corresponding two-dimensional submanifold of $SO(3)$, to wit, \begin{equation}\label{QQ3} R(2\pi,0)^\top = T^{(3)}\,R(2\pi,0)\,T^{(3)} \;. \end{equation} This equation can be proven either directly by checking (\ref{Q6}) or by applying (\ref{R7a}) and (\ref{R12b}). According to the general theory \cite{S18} the eigenvalues of $R(2\pi,0)$ that are generally of the form $(1,\exp (\pm{\sf i}\rho))$ yield the quasienergies $\epsilon_\pm^{(qu)}$ of the underlying Schr\"odinger equation for spin $s=\frac{1}{2}$ via \begin{equation}\label{Q7} \exp \pm{\sf i}\rho=\exp\left( 4\,\pi\,{\sf i}\,\epsilon_\pm^{(qu)}\right) \;. \end{equation} As in \cite{SSH20a} it follows that \begin{equation}\label{Q8} \epsilon_\pm^{(qu)}=\pm\frac{1}{4 \pi }\arg \left(1+8 r^4-8 r^2+4 {\sf i}r \left(1-2 r^2\right) \sqrt{1-r^2}\right) =\pm\frac{1}{\pi} \arcsin r \;. \end{equation} The eigenvector ${\mathbf r}$ corresponding to the real eigenvalue $1$ of $R(2\pi,0)$ is \begin{equation}\label{Q9} {\mathbf r}=\left( \begin{array}{c} \cos\alpha \\ \sin\alpha \\ 0 \end{array} \right) \;. \end{equation} Choosing ${\mathbf r}$ as the initial value ${\mathbf r}={\mathbf S}(0)$ for the time evolution (\ref{D1}) yields a $2\pi$-periodic solution. Any other unit vector in the plane $P$ orthogonal to ${\mathbf r}$ will, in general, not return to its initial value after the time $\tau=2\pi$ but will be rotated in the plane $P$ by the angle $2\pi\epsilon^{(cl)}$. This endows the parameters $r$ and $\alpha$ occurring in (\ref{Q4}) and (\ref{Q6}) with a geometrical and dynamical meaning. Another remarkable result follows from $R(\pi,0)$ being of the form (\ref{Q4}): \begin{equation}\label{Q10} R(\pi,0)\,\left( \begin{array}{c} \cos\alpha \\ \sin\alpha \\ 0 \end{array} \right)= \left( \begin{array}{c} \cos\alpha \\ -\sin\alpha \\ 0 \end{array} \right) \;, \end{equation} which means that for the initial value ${\mathbf S}(0)={\mathbf r}$ the half period time evolution is equivalent to a reflection at the $x-z$-plane. This has further consequences for the Fourier series of the $2\pi$-periodic functions $x(\tau),\,y(\tau),$ and $z(\tau)$ with initial values $x(0)=\cos\alpha,\;y(0)=\sin\alpha$ and $z(0)=0$. Since $x(\tau)$ and $y(\tau)$ will be even functions of $\tau$ and $z(\tau)$ will be an odd one, see Proposition \ref{Peo}, we can write their Fourier series in the form \begin{eqnarray} \label{Q11a} x(\tau) &=& \sum_{\mu=0}^\infty x_\mu\,\cos(\mu\tau),\\ \label{Q11b} y(\tau) &=& \sum_{\mu=0}^\infty y_\mu\,\cos(\mu\tau),\\ \label{Q11c} x(\tau) &=& \sum_{\mu=1}^\infty z_\mu\,\sin(\mu\tau) \;. \end{eqnarray} Now consider the sequence of linear mappings \begin{equation}\label{Q12} {\mathbf r}= \left( \begin{array}{c} \cos\alpha \\ \sin\alpha \\ 0 \end{array} \right) \stackrel{R(\pi,0)}{\longrightarrow} \left( \begin{array}{c} \cos\alpha \\ -\sin\alpha \\ 0 \end{array} \right) \stackrel{T^{(1)}}{\longrightarrow} \left( \begin{array}{c} -\cos\alpha \\ -\sin\alpha \\ 0 \end{array} \right) \stackrel{R(\tau,0)}{\longrightarrow} \left( \begin{array}{c} -x(\tau) \\ -y(\tau) \\ -z(\tau) \end{array} \right) \stackrel{T^{(1)}}{\longrightarrow} \left( \begin{array}{c} x(\tau) \\ -y(\tau) \\ -z(\tau) \end{array} \right) \stackrel{(\ref{R3})}{=} R(\pi+\tau,0)\,{\mathbf r} = \left( \begin{array}{c} x(\pi+\tau) \\ y(\pi+\tau) \\ z(\pi+\tau) \end{array} \right) \;. \end{equation} From this we conclude \begin{equation}\label{Q13} x(\pi+\tau)=\sum_{\mu=0}^\infty x_\mu\,\cos(\mu(\pi+\tau))= \sum_{\mu\,\mbox{ \scriptsize even}} x_\mu\,\cos(\mu\tau)\, -\sum_{\mu\,\mbox{ \scriptsize odd}}x_\mu\,\cos(\mu\tau) =x(\tau)= \sum_{\mu\,\mbox{ \scriptsize even}} x_\mu\,\cos(\mu\tau)\, +\sum_{\mu\,\mbox{ \scriptsize odd}}x_\mu\,\cos(\mu\tau) \;. \end{equation} Hence the odd terms of the $\cos$-series must vanish and $x(\tau)$ is an even $\cos$-series. Similarly we conclude from (\ref{Q12}) that $y(\tau)$ is an odd $\cos$-series and $z(\tau)$ an odd $\sin$-series. Summarizing, we have proven the following \begin{prop}\label{prop5} The components of the $2\pi$-periodic solution ${\mathbf S}(\tau)$ of (\ref{D1}) with initial values ${\mathbf S}(0)={\mathbf r}$ according to (\ref{Q9}) have the Fourier series \begin{eqnarray} \label{Q14a} x(\tau) &=& \sum_{\mu \text{ even}}x_\mu\,\cos(\mu\tau), \\ \label{Q14b} y(\tau) &=& \sum_{\mu\text{ odd}}y_\mu\,\cos(\mu\tau), \\ \label{Q14c} z(\tau) &=& \sum_{\mu\text{ odd}}z_\mu\,\sin(\mu\tau) \;. \end{eqnarray} In particular, the time averages of $y(\tau)$ and $z(\tau)$ over one period vanish. \end{prop} \section{Third order differential equations for single spin components}\label{sec:H} We consider again (\ref{D1}) and its higher derivatives that read \begin{equation}\label{H1} \frac{d}{d\tau} {\mathbf S}= \left(\begin{array}{c} \dot{x} \\ \dot{y} \\ \dot{z} \end{array} \right)= \left( \begin{array}{c} g z \cos \tau-f y \sin \tau \\ f x \sin \tau-\nu z \\ \nu y-g x \cos \tau \\ \end{array} \right) \;, \end{equation} \begin{equation}\label{H2} \frac{d^2}{d\tau^2} {\mathbf S}= \left(\begin{array}{c} \ddot{x} \\ \ddot{y} \\ \ddot{z} \end{array} \right)= \left( \begin{array}{c} -\sin \tau \left(f^2 x \sin \tau+z (g-f \nu )\right)+y \cos \tau (g \nu -f)-g^2 x \cos^2\tau \\ \cos \tau(x (f+g \nu )+f g z \sin\tau)-y \left(f^2 \sin ^2\tau+\nu ^2\right) \\ \sin \tau (x (f \nu +g)+f g y \cos \tau)-z \left(g^2 \cos ^2\tau +\nu ^2\right) \\ \end{array} \right) \;, \end{equation} \begin{equation}\label{H3} \frac{d^3}{d\tau^3} {\mathbf S}= \left(\begin{array}{c} \dddot{x} \\ \dddot{y} \\ \dddot{z} \end{array} \right)=: x\, {\mathbf S}^{(3)}_1+ y\, {\mathbf S}^{(3)}_2+ z\, {\mathbf S}^{(3)}_3 \;, \end{equation} with \begin{equation}\label{H3a} {\mathbf S}^{(3)}_1= \left( \begin{array}{c} -3 \left(f^2-g^2\right) \sin \tau \,\cos\tau \\ -\sin\tau \left(f^3 \sin ^2\tau+f g^2 \cos ^2\tau+f \nu ^2+f+g \nu \right) \\ \cos \tau \left(f^2 g \sin ^2\tau+f \nu +g^3 \cos ^2\tau+g \nu ^2+g\right) \\ \end{array} \right) \;, \end{equation} \begin{equation}\label{H3b} {\mathbf S}^{(3)}_2= \left( \begin{array}{c} \sin \tau \left(f^3 \sin ^2\tau+f g^2 \cos ^2\tau+f \nu ^2+f-2 g \nu \right) \\ -3 f^2 \sin\tau\, \cos \tau \\ -f \sin ^2\tau (f \nu +2 g)-g \cos ^2\tau (g \nu -f)-\nu ^3 \\ \end{array} \right) \;, \end{equation} and \begin{equation}\label{H3c} {\mathbf S}^{(3)}_3= \left( \begin{array}{c} -\cos \tau \left(f^2 g \sin ^2\tau-2 f \nu +g^3 \cos ^2\tau+g \nu ^2+g\right) \\ f \sin ^2\tau (f \nu -g)+g \cos ^2\tau (2 f+g \nu )+\nu ^3 \\ 3 g^2 \sin \tau\, \cos\tau \\ \end{array} \right) \;. \end{equation} It is obvious that $\dot{x}$ and $\ddot{x}$ depend linearly on $y$ and $z$ and that this dependence can be inverted to express $y$ and $z$ in terms of $x$, $\dot{x}$ and $\ddot{x}$. Inserting this result into $\dddot{x}$ yields a third order linear differential equation for $x(\tau)$ where the coefficients are trigonometric functions of $\tau$. Similarly, we can obtain third order differential equations for $y(\tau)$ and $z(\tau)$. For the preparation of the next step we make the restriction to solutions of (\ref{H1}) such that $x(\tau)$ and $y(\tau)$ are even functions of $\tau$ whereas $z(\tau)$ is an odd one, according to Prop.~\ref{Peo}. In this way we could obtain two solutions ${\mathbf S}^{(1)}$ and ${\mathbf S}^{(2)}$ with different initial conditions for $x(\tau)$ and $y(\tau)$ and the initial condition $z(0)=0$, the latter being a consequence of the restriction to odd functions $z(\tau)$. The third solution ${\mathbf S}^{(3)}$ with $x(\tau)$ and $y(\tau)$ odd and $z(\tau)$ even is then uniquely determined by ${\mathbf S}^{(1)}$ and ${\mathbf S}^{(2)}$. For example, if ${\mathbf S}^{(1)}$ and ${\mathbf S}^{(2)}$ are chosen to be orthogonal for $\tau=0$ then they will be orthogonal for all $\tau$ and ${\mathbf S}^{(3)}$ is just the vector product of ${\mathbf S}^{(1)}$ and ${\mathbf S}^{(2)}$. Following \cite{XH10} we will consider a transformation $\tau\mapsto u$ of the independent variable such that the coefficients of the transformed differential equations become rational functions of $u$. This transformation will be chosen as \begin{equation}\label{H4} u(\tau)=\sin^2\frac{\tau}{2}=\frac{1}{2}\left(1-\cos\tau\right) \;, \end{equation} the same as in \cite{XH10}, and maps the half period $\tau\in[0,\pi]$ bijectively onto $u\in[0,1]$. Since (\ref{H4}) defines an even function of $\tau$ the corresponding transformation is only appropriate for the even functions $x(\tau)$ and $y(\tau)$. Their transforms will be denoted by $X(u)$ and $Y(u)$ such that \begin{equation}\label{H5} X(u(\tau))=x(\tau),\quad \mbox{and } Y(u(\tau))=y(\tau) \mbox{ for } \tau\in[0,\pi] \;. \end{equation} The remaining function $z(\tau)$ has to be calculated differently, e.~g., by using that the length of ${\mathbf S}(\tau)$ is conserved under time evolution according to (\ref{D1}). This gives the result \begin{equation}\label{H6} z(\tau)=\pm\sqrt{x(0)^2+y(0)^2-x(\tau)^2-y(\tau)^2} \;, \end{equation} where $z(0)=0$ has been used, and the sign has to be chosen in such a way that $z(\tau)$ remains a smooth function in the neighbourhood of its zeros. An alternative procedure would be possible if $x(\tau)$ and $y(\tau)$ can be written as Fourier series (maybe only locally valid for $\tau\in[0,\pi/2]$). Then $z(\tau)$ could be obtained by a direct integration of $\dot{z}(\tau)= \nu y(\tau)-g x(\tau)\, \cos (\tau )$. This last procedure will be applied in Section \ref{sec:T}. We come back to the differential equation for $X(u)$ and write it with polynomial coefficients $p_n(u)$ in the form \begin{equation}\label{H7} 0=\sum_{n=0}^3 p_n(u) X^{(n)}(u) \;. \end{equation} The coefficients are the following ones: \begin{eqnarray} \label{H8a} p_3(u) &=& u \left(1-u)(4 f^2 \nu (u-1) u+f g-g^2 \nu (1-2 u)^2\right)\\ \label{H8b} p_2(u) &=& -\frac{1}{2} (2 u-1) \left(4 f^2 \nu (u-1) u+3 f g+g^2 \nu (-4 (u-1) u-3)\right) \\ \nonumber p_1(u) &=& -16 f^4 \nu (u-1)^2 u^2-4 f^3 g (u-1) u+4 f^2 \nu (u-1) u \left(2 g^2 (1-2u)^2+\nu ^2\right)\\ \label{H8c} && +f g^3 (1-2 u)^2+3 f g \nu ^2-g^2 \nu \left(g^2 (1-2 u)^4+\nu ^2 (1-2 u)^2+2\right) \\ \label{H8d} p_0(u) &=& -2 (2 u-1) (f-g) (f+g) \left(4 f^2 \nu (u-1) u+3 f g-g^2 \nu (1-2 u)^2\right). \end{eqnarray} The singular points of the differential equation are the zeros of $p_3(u)$. Except the points $u=0$ and $u=1$ that occur also for the confluent Heun equation, see \cite{XH10} and \cite{SSH20a}, we have an additional pair of singular points, real or complex ones, depending on the parameters $f,g$ and $\nu$. The obvious ansatz to obtain a physically relevant solution of (\ref{H7}) is a power series \begin{equation}\label{H8e} X(u)=\sum_{n=0}^\infty \xi_n\,u^n \end{equation} at the singular point given by $u=0$. We have not investigated its radius of convergence, but it is clear that the series diverges at least for the second singular point $u=1$, which has been our motivation to restrict the application of (\ref{H8e}) to $|u|\le{\textstyle\frac{1}{2}}$ corresponding to the first quarter period $\tau\in[0,\pi/2]$. In contrast to \cite{XH10} we need only one real solution and can neglect further solutions of the fundamental system. However, due to the degree three of the differential equation and the additional singular points we need a six-term recurrence relation for the coefficients of the power series. We will not give the details of the recurrence relation but rather sketch how to obtain it by means of computer-algebraic aids. We take a finite part $\sum_{n=m-3}^{m+2} \xi_n\,u^n$ of the power series and insert it into the differential equation (\ref{H7}). The result is expanded into a $u$-polynomial and the coefficient of $u^m$ is set to $0$. It has been checked that only the above considered finite part of the power series influences this coefficient. Thus we obtain a six-term recurrence relation of the form \begin{equation}\label{H9} \xi_{m+2}=\sum_{i=m-3}^{m+1}a_i\,\xi_i \;, \end{equation} where the $a_i$ have been determined as rational functions of $f,g,\nu$, but they are too complicated to be presented here. The next problem is that we need the first five coefficients of $X(u)=\sum_n \xi_n\,u^n$ to get the next coefficients using the recursion relation. Since the original equation (\ref{D1}) is of $1^{st}$ order we have only two undetermined initial values $x(0)$ and $y(0)$, taking into account that $z(0)=0$. To solve this problem we have compared the first terms of the $\tau$-power series of $x(\tau)$ and $X(u(\tau))$, using the differential equation (\ref{D1}), and thereby determined $\xi_0,\ldots,\xi_4$ as functions of $x(0)$ and $y(0)$. This also compensates the enlargement of the solution space by passing from a $1^{st}$ order differential equation to a $3^{rd}$ order one. To give an impression of the kind of results we display the first three coefficients: \begin{eqnarray} \label{H10a} \xi_0 &=& x(0) \\ \label{H10b} \xi_1 &=& -2 \left(y(0) (f-g \nu )+g^2 x(0)\right) \\ \label{H10c} \xi_2 &=& \frac{1}{3} \left(2 x(0) \left(-3 f^2-2 f g \nu +g^2 \left(g^2+\nu ^2+3\right)\right)+2 y(0) \left(f \left(g^2+3 \nu ^2\right)-g \nu \left(g^2+\nu ^2+2\right)\right)\right) \;. \end{eqnarray} Obviously, $\xi_n$ is a linear function of $x(0)$ and $y(0)$ that can be written as \begin{equation}\label{H10d} \xi_n=\xi_n^{(x)}\,x(0)+\xi_n^{(y)}\,y(0) \;. \end{equation} After these preparations it is, in principle, possible to calculate any finite number of power series coefficients $\xi_n$ as a function of the physical parameters $f,g$ and $\nu$ and the initial values $x(0)$ and $y(0)$, although the expressions become more and more intricate, and finally to obtain a truncated approximation of $X(u(\tau))$. For a comparison to a numerical solution of (\ref{D1}) see Section \ref{sec:T}.\\ Analogous considerations apply for the case of the solution $y(\tau)=Y(u(\tau))$. This time we obtain a differential equation of the form \begin{equation}\label{H11} 0=\sum_{n=0}^3 q_n(u) Y^{(n)}(u) \;, \end{equation} where \begin{eqnarray} \label{H12a} q_3(u) &=& (u-1) u (2 u-1)^3 \left(f^2 g+f \nu +g \nu ^2\right) \left(4 f^2 g (u-1) u-f \nu -g \nu ^2\right)\\ \label{H12b} q_2(u) &=& \frac{1}{2} (1-2 u)^2 \left(f^2 g+f \nu +g \nu ^2\right) \left(4 f^2 g (u-1)u+f \nu (-8 (u-1) u-3)+g \nu ^2 (-8 (u-1) u-3)\right) \\ \nonumber q_1(u) &=&(1-2 u)^2 (2 u-1) \left(f^2 g+f \nu +g \nu^2\right) \left(16 f^4 g (u-1)^2 u^2-4 f^3 \nu (u-1) u-4 f^2 g (u-1) u \left(g^2 (1-2 u)^2 +2 \nu^2\right) \right. \\ \label{H12c} && \left. +f \nu \left(3 g^2 (1-2 u)^2+\nu ^2\right)+g^3 \nu ^2 (1-2 u)^2+g \nu ^4\right)\\ \nonumber q_0(u)&=&2 (1-2 u)^2 \left(f^2 g+f \nu +g \nu ^2\right) \left(4 f^4 g (u-1) u+f^3 \nu (-8 (u-1) u-3)+f^2 g \nu ^2 (4 (u-1) u-1)-f \nu ^3-g \nu ^4\right).\\ \label{H12d} && \end{eqnarray} The zeros of $q_3(u)$ yield five singular points. The power series solution ansatz \begin{equation}\label{H12e} Y(u)=\sum_{n=0}^\infty \eta_n\,u^n \end{equation} leads to a $9$-term recursion relation and the first $8$ coefficients are again determined by calculating the corresponding $t$-power series coefficients. We show the first three ones. \begin{eqnarray} \label{H13a} \eta_0 &=& y(0) \\ \label{H13b} \eta_1 &=& 2 x(0) (f+g \nu )-2 \nu ^2 y(0) \\ \label{H13c} \eta_2 &=& \frac{1}{3} \left(2 y(0) \left(-3 f^2+2 f g \nu +\nu ^2 \left(g^2+\nu ^2-1\right)\right)-2 x(0) \left(f \left(3 g^2+\nu ^2\right)+g \nu \left(g^2+\nu ^2\right)\right)\right) \;. \end{eqnarray} Analogously to (\ref{H10d}), $\eta_n$ is a linear function of $x(0)$ and $y(0)$ that can be written as \begin{equation}\label{H13d} \eta_n=\eta_n^{(x)}\,x(0)+\eta_n^{(y)}\,y(0) \;. \end{equation} The further details are too intricate to be displayed here, but, in principle, the procedure is completely analogous to the power series solution of the confluent Heun equation investigated in \cite{SSH20a}. \section{Fourier series and quasienergy: Results based on the power series solutions}\label{sec:FS} It is clear that $u^n=\sin^{2n}\frac{\tau}{2}=\left(\frac{1}{2}\left(1-\cos\tau\right)\right)^n$ is a finite Fourier series including only $\cos$-terms. It explicitly reads \begin{equation}\label{FS1} \sin^{2n}\frac{\tau}{2}=\frac{(2 n-1){!!}}{2^n n!}+\sum _{\mu =1}^n \frac{(2 n-1){!!} (1-\mu +n)_{\mu } (-1)^{\mu } }{2^{n-1} (\mu +n)!}\,\cos (\mu \tau) \;, \end{equation} where $(a)_\mu=a(a+1)\ldots(a+\mu-1)$ denotes the Pochhammer symbol. Inserting (\ref{FS1}) into the power series (\ref{H8e}) and (\ref{H12e}) for $x(\tau)$ and $y(\tau)$ yields Fourier series representations valid within the convergence radius of the power series. This does {\it not} mean that $x(\tau)$ and $y(\tau)$ are generally periodic functions but only that they locally, within the respective domains of convergence, coincide with periodic functions. We may explicitly write down the corresponding Fourier coefficients of \begin{eqnarray} \label{FSfourx} x(\tau) &=&\sum_{\mu=0}^\infty x_\mu\,\cos(\mu\tau)\;, \\ \label{FSfoury} y(\tau) &=& \sum_{\mu=0}^\infty y_\mu\,\cos(\mu\tau) \;, \end{eqnarray} to wit, \begin{eqnarray} \label{FS2a} x_\mu &=& \left\{ \begin{array}{r@{\quad}l} \sum_{n=0}^\infty \frac{ (2 n-1)!!}{2^n n!}\,\xi_n &:\quad\mu=0, \\ &\\ \sum _{n=\mu}^{\infty } \frac{(2 n-1){!!} (1-\mu+n)_\mu (-1)^\mu}{2^{n-1} (\mu+n)!}\,\xi_n & :\quad \mu>0 , \end{array} \right.\\ \label{FS2b} y_\mu &=& \left\{ \begin{array}{r@{\quad}l} \sum_{n=0}^\infty \frac{ (2 n-1)!!}{2^n n!}\,\eta_n &:\quad\mu=0, \\ &\\ \sum _{n=\mu}^{\infty } \frac{(2 n-1){!!} (1-\mu+n)_\mu (-1)^\mu}{2^{n-1} (\mu+n)!}\,\eta_n &:\quad \mu>0 . \end{array} \right. \end{eqnarray} Recall that the $\xi_n$ and $\eta_n$ are the coefficients of the power series (\ref{H8e}) and (\ref{H12e}) to be determined by means of recurrence relations. The case of $z(\tau)$ is a bit more complicated. Using the above local Fourier series representation of $x(\tau)$ and $y(\tau)$ we may directly solve the differential equation \begin{equation}\label{FSfourz} \dot{z}(\tau)=\nu\, y(\tau)-g\,\cos\tau\, x(\tau) \;, \end{equation} since the r.~h.~s.~of (\ref{FSfourz}) is again a $\cos$-series. In general, there will be a non-vanishing constant term $z_0$ at the r.~h.~s.~of (\ref{FSfourz}) that generates a corresponding part $z_0\,\tau$ of $z(\tau)$ taking into account that $z(0)=0$. The complete result is the following: \begin{eqnarray} \label{FS2d} z(\tau) &=&z_0\,\tau +\sum_{\mu=1}^{\infty} z_\mu\,\sin(\mu\,\tau)\;,\\ \label{FS2e} z_\mu &=& \left\{ \begin{array}{r@{\quad:\quad}l} \nu\,y_0-\frac{g}{2}\,x_1&\mu=0, \\ \nu\,y_1-g\,x_0-\frac{g}{2}\,x_2& \mu=1 ,\\ \frac{1}{\mu}\left(\nu\,y_\mu-\frac{g}{2}\,\left( x_{\mu-1}+x_{\mu+1}\right)\right)& \mu>1. \end{array} \right. \end{eqnarray} The expressions (\ref{FS2a}) and (\ref{FS2b}) for the Fourier coefficients still depend, via $\xi_n$ and $\eta_n$, on the initial conditions $x(0)$ and $y(0)$. In the special case of $x(0)=\cos\alpha,\;y(0)=\sin\alpha$ according to (\ref{Q9}) the solutions $x(\tau)$ and $y(\tau)$ will be $2\pi$-periodic functions and hence, according to proposition \ref{prop5}, can be written as even resp.~odd $\cos$-series valid for all $\tau\in{\mathbbm R}$. In particular, \begin{equation}\label{FS3} y_0=0= \sum_{n=0}^\infty \frac{ (2 n-1)!!}{2^n n!}\,\eta_n=\sum_{n=0}^\infty \frac{ (2 n-1)!!}{2^n n!}\,(\eta_n^{(x)}x(0)+\eta_n^{(y)}y(0)) =\sum_{n=0}^\infty \frac{ (2 n-1)!!}{2^n n!}\,(\eta_n^{(x)}\cos\alpha+\eta_n^{(y)}\sin\alpha) \;. \end{equation} This equation can be solved for the auxiliary parameter $\alpha$: \begin{equation}\label{FS4} \alpha=-\arctan\left(\frac{\sum_{n=0}^\infty \frac{ (2 n-1)!!}{2^n n!}\,\eta_n^{(x)} }{\sum_{n=0}^\infty \frac{ (2 n-1)!!}{2^n n!}\,\eta_n^{(y)}} \right) \;, \end{equation} if the numerator and denominator of this fraction do not vanish simultaneously. This solution is only determined modulo $\pi$ in accordance with the fact that $x(0)=-\cos\alpha,\;y(0)=-\sin\alpha$ also gives a periodic solution. The determination of the second auxiliary parameter $r$ is more involved. We consider the following procedure that does not presuppose the determination of $\alpha$. First we calculate the quarter period monodromy matrix $R(\frac{\pi}{2},0)$ by means of the local Fourier series representation considered above. From this we obtain $R(\pi,0)$ via (\ref{R14}) and finally $r$ by \begin{equation}\label{FS5} r=\pm\sqrt{\frac{1-R(\pi,0)_{3,3}}{2}} \,. \end{equation} The latter holds since $R(\pi,0)$ is of the form (\ref{Q4}). It will be instructive to give some more details. First consider $R(\frac{\pi}{2},0)_{1,1}=x(\frac{\pi}{2})$, where $x(\tau)$ has the initial values $x(0)=1,\;y(0)=z(0)=0$. It follows that \begin{equation}\label{FS6} x\left({\textstyle\frac{\pi}{2}}\right)=\sum_{\mu=0}^{\infty}x_\mu \cos\left(\mu{\textstyle\frac{\pi}{2}}\right)=\sum_{\mu=0,4,\ldots}x_\mu-\sum_{\mu=2,6,\ldots}x_\mu \;, \end{equation} because the only non-vanishing terms are $\cos(\mu\frac{\pi}{2})=1$ for $\mu$ being an integer multiple of $4$ and $\cos(\mu\frac{\pi}{2})=-1$ for even $\mu$ such that $\mu/2$ is odd. Recall that the Fourier coefficients $x_\mu$ have to be determined via (\ref{FS2a}) where the $\xi_n$ have to be chosen as $\xi_n^{(x)}$ according to (\ref{H10d}) and the above initial values. The procedure for the calculation of $R(\frac{\pi}{2},0)_{2,1}=y(\frac{\pi}{2})$ is completely analogous. For $R(\frac{\pi}{2},0)_{3,1}=z(\frac{\pi}{2})$ we employ (\ref{FS2d}) and (\ref{FS2e}) as well as \begin{equation}\label{FS7} z\left({\textstyle\frac{\pi}{2}}\right)=z_0\,{\textstyle\frac{\pi}{2}}+\sum_{\mu=1,5,\ldots}z_\mu-\sum_{\mu=3,7,\ldots}z_\mu \;. \end{equation} For the $2^{nd}$ column of $R(\frac{\pi}{2},0)$ the calculation is again the same as for the $1^{st}$ column except that $\xi_n^{(x)}$ has to be replaced by $\xi_n^{(y)}$ and $\eta_n^{(x)}$ by $\eta_n^{(y)}$. As mentioned before, the $3^{rd}$ column of $R(\frac{\pi}{2},0)$ is the vector product of the $1^{st}$ and the $2^{nd}$ ones. Since we only need a particular matrix element of the half period monodromy, namely $R(\pi,0)_{3,3}$, it suffices to use the following equation resulting from (\ref{R14}): \begin{equation}\label{FS8} R(\pi,0)_{3,3}=R({\textstyle\frac{\pi}{2}},0)_{1,3}^2-R({\textstyle\frac{\pi}{2}},0)_{2,3}^2+R({\textstyle\frac{\pi}{2}},0)_{3,3}^2 =1-2\,R({\textstyle\frac{\pi}{2}},0)_{2,3}^2 \;, \end{equation} and hence \begin{equation}\label{FS9} r=\left| R({\textstyle\frac{\pi}{2}},0)_{2,3}\right| =\left| R({\textstyle\frac{\pi}{2}},0)_{3,1}\, R({\textstyle\frac{\pi}{2}},0)_{1,2}- R({\textstyle\frac{\pi}{2}},0)_{1,1}\, R({\textstyle\frac{\pi}{2}},0)_{3,2} \right| \;, \end{equation} where the entries from the first and second column of $ R({\textstyle\frac{\pi}{2}},0)$ have been calculated above. This completes the determination of the auxiliary parameter $r$ and the quasienergy via (\ref{Q8}). \begin{figure}[h] \centering \includegraphics[width=0.75\linewidth]{FIGPNA.eps} \caption[T1] {The three components of the classical spin vector as functions of dimensionless time $\tau$ over one period according to the equation of motion (\ref{D1}). We have chosen the parameters $f=1,\,g=1/2$ and $\nu=1$ and the initial conditions $x(0)=1,\;y(0)=z(0)=0$. The solid curves are numerical results; the dashed curve represents $x(\tau)$ as calculated analytically, likewise $y(\tau)$ (dotted curve) and $z(\tau)$ (dotted-dashed curve). } \label{FIGPNA} \end{figure} \begin{figure}[h] \centering \includegraphics[width=0.75\linewidth]{FIGPNB.eps} \caption[T1] {The three components of the classical spin vector as periodic functions of dimensionless time $\tau$ over one period according to the equation of motion (\ref{D1}). We have chosen the parameters $f=1,\,g=1/2$ and $\nu=1$ and the initial conditions $x(0)=\cos\alpha,\;y(0)=\sin\alpha$ and $z(0)=0$. The dashed curve represents $x(\tau)$ as calculated numerically and analytically, likewise $y(\tau)$ (dotted curve) and $z(\tau)$ (dotted-dashed curve). } \label{FIGPNB} \end{figure} We have checked the results (\ref{FS4}) and (\ref{FS9}) by comparison with a numerical solution of the $s=\frac{1}{2}$ Schr\"odinger equation (\ref{SE5}) for the choice of the parameters $\nu=1,\;f=1,$ and $g=1/2$. For this case both methods come to the same conclusion \begin{equation}\label{FS10} \alpha=1.40464\ldots,\quad r=0.387328\ldots,\quad \mbox{and hence}\quad \epsilon^{(qu)}=0.126602\ldots \;. \end{equation} \section{Time evolution: An example}\label{sec:T} As an example we consider the time evolution over one period $\tau\in[0,2\pi]$ according to (\ref{D1}). We choose the values of the parameters $f=1,\,g=1/2$ and $\nu=1$ and analytically calculate three mutually orthogonal solutions ${\mathbf S}^{(i)}(\tau),\;i=1,2,3$ for $\tau\in[0,\frac{\pi}{2}]$ by evaluating the corresponding power series solutions with ten terms. For the remaining three quarter periods we adopt the reduction equations (\ref{R3}) and (\ref{R8}) for ${\mathbf S}^{(1)}$, where $R(\pi,0)$ can be expressed through $R({\textstyle\frac{\pi}{2}},0)$ via (\ref{R14}). We observe a satisfactory agreement with the numerical solution of (\ref{D1}), see Figure \ref{FIGPNA}. The alternative choice of the initial conditions as $x(0)=\cos\alpha$ and $y(0)=\sin\alpha$, whereas $z(0)=0$ remains unchanged, leads to $2\pi$-periodic solutions, see Figure \ref{FIGPNB}. This calculation uses the value of the auxiliary parameter $\alpha$ that has been determined according to (\ref{FS4}). The first few terms of the corresponding Fourier series read: \begin{eqnarray} \label{T2a} x(\tau) &=& 0.0240019\, +0.144012 \cos (2 t)-0.00263811 \cos (4 t)+\ldots\\ \label{T2b} y(\tau) &=& 1.01784 \cos (t)-0.0319147 \cos (3 t)+0.000303923 \cos (5 t)+\ldots \\ \label{T2c} z(\tau) &=& 0.969835 \sin (t)-0.0224197 \sin (3 t)+0.000192725 \sin (5 t)+\ldots \;. \end{eqnarray} \section{Vanishing of the Quasienergy}\label{sec:QIII} \begin{figure}[h] \centering \includegraphics[width=0.75\linewidth]{FIGSFP.eps} \caption[T1] {The branch of the quasienergy ${\mathcal E}(\omega_0,F,G,\omega)$ satisfying (\ref{QIIIbranch}) as a function of $\omega$ and $G$ for fixed values of $\omega_0=1$ and $F=1$. $G$ varies from $G=0$ (linear polarization) to $G=F=1$ (circular polarization). Along the red, dashed curve the quasienergy vanishes. An analytical approximation of this curve according to (\ref{QIII3}) is shown as a black, dashed curve. } \label{FIGSFP} \end{figure} \begin{figure}[h] \centering \includegraphics[width=0.75\linewidth]{FIGS1.eps} \caption[T1] {The branch of the quasienergy ${\mathcal E}(\omega_0,F,G,\omega)$ satisfying (\ref{QIIIbranch}) as a function of $\omega$ for fixed $\omega_0=1,\,F=1$ and two values $G=1$ (red curves) and $G=0.95$ (blue and orange curves). In the circular case ($G=1$) we observe level crossing whereas in the case with small eccentricity ($G=0.95$) this crossing is avoided as demonstrated by the inset. The dashed red line is the tangent of ${\mathcal E}(1,1,1,\omega)$ at $\omega=1$. According to (\ref{QIIIslope}) it has the slope ${\mathcal E}_g=\frac{1}{2}$. } \label{FIGS1} \end{figure} \begin{figure}[h] \centering \includegraphics[width=0.75\linewidth]{FIGSP12.eps} \caption[T1] {Three periodic solutions ${\mathbf S}^{(i)}(\tau),\;i=1,2,3$ (blue, red and green curves) of (\ref{D1}) for the parameters $\omega_0=F=1,\;G=\frac{1}{2}$ and $\omega=\omega_1$ such that the quasienergy vanishes. The magnetic field vector (black arrow) moves on the black ellipse; the initial vectors ${\mathbf S}^{(i)}(0),\;i=1,2,3$ are shown as colored arrows. The time average of the energy vanishes for ${\mathbf S}^{(2)}$ and ${\mathbf S}^{(3)}$. } \label{FIGSP12} \end{figure} \begin{figure}[h] \centering \includegraphics[width=0.75\linewidth]{FIGS2.eps} \caption[T1] {The branch of the quasienergy ${\mathcal E}(\omega_0,F,G,\omega)$ satisfying (\ref{QIIIbranch}) as a function of $\omega$ for fixed values of $\omega_0=F=1$ and $G=\frac{1}{2}$. The function has its largest zero at $\omega_1=0.781665$ where the tangent (dashed red line) has a slope of $0.64787$, see the text after Eq.~(\ref{QIIIedb}). } \label{FIGS2} \end{figure} We will discuss the quasienergy in physical units \begin{equation}\label{QIII1} {\mathcal E}(\omega_0,F,G,\omega)\equiv\hbar\,\omega\, \epsilon^{(qu)}\left(\frac{\omega_0}{\omega},\frac{F}{\omega},\frac{G}{\omega}\right) = \hbar\,\omega \,\epsilon^{(qu)}\left(\nu,f,g\right) \;, \end{equation} where usually $\hbar$ is set to $1$. Analogously to the ambiguity of $\epsilon^{(qu)}$ also ${\mathcal E}$ will be only defined up to integer multiples of $\hbar\omega$. A typical plot of the functions $\omega\mapsto {\mathcal E}(\omega_0,F,G,\omega)$ for the values $\omega_0=F=1$ and $G$ varying from $G=0$ (linear polarization) to $G=F=1$ (circular polarization) is shown in Figure \ref{FIGSFP}, where the branch and the sign of the quasienergy are chosen according to \begin{equation}\label{QIIIbranch} 0\le \frac{1}{\hbar\omega} {\mathcal E}(1,1,G,\omega)\le \frac{1}{2} \;. \end{equation} We notice that these curves qualitatively all look the same. First we note that the family of curves shows the same asymptotic behaviour of ${\mathcal E}(\omega_0,F,G,\omega)$ for $\omega\rightarrow\infty$. In the case of circular polarization we have ${\mathcal E}(\omega_0,F,G,\omega)\rightarrow \frac{\omega_0}{2}$ for $G=F$ as well as ${\mathcal E}(\omega_0,F,G,\omega)\rightarrow\frac{\omega_0}{2}$ for linear polarization, see Eq.~(269) in \cite{S18}. Further, the quasienergy functions have an infinite number of zeros with a non-vanishing slope, the largest being slightly below $\omega=1$.\\ To better understand this behavior in detail we re-visit the RPC. It is well-known that in the special case of circular polarization the quasienergy can be analytically determined in a rather simple form. In the context of the present discussion we note that the fundamental matrix solution of (\ref{D3}) with initial condition (\ref{D4}) assumes the form $R(\tau,0)=\left( R_1, R_2, R_3\right)$ with the three columns reading \begin{eqnarray} \label{QIIIColumn1} R_1 &=& \left(\begin{array}{c} f^2 \cos (\tau \Omega )+(\nu -1)^2 \\ f \left(2 (\nu -1) \cos (\tau ) \sin ^2\left(\frac{\tau \Omega }{2}\right)+\Omega \sin (\tau ) \sin (\tau \Omega )\right) \\ f \left(2 (\nu -1) \sin (\tau ) \sin ^2\left(\frac{\tau \Omega }{2}\right)-\Omega \cos (\tau ) \sin (\tau \Omega )\right) \end{array} \right) \;,\\ \label{QIIIColumn2} R_2&=& \left(\begin{array}{c} -f (\nu -1) (\cos (\tau \Omega )-1) \\ \cos (\tau ) \left(f^2+(\nu -1)^2 \cos (\tau \Omega )\right)-(\nu -1) \Omega \sin (\tau ) \sin (\tau \Omega ) \\ \sin (\tau ) \left(f^2+(\nu -1)^2 \cos (\tau \Omega )\right)+(\nu -1) \Omega \cos (\tau ) \sin (\tau \Omega ) \end{array} \right) \;, \\ \label{QIIIColumn3} R_3&=& \left(\begin{array}{c} f \Omega \sin (\tau \Omega ) \\ -\Omega ((\nu -1) \cos (\tau ) \sin (\tau \Omega )+\Omega \sin (\tau ) \cos (\tau \Omega )) \\ \Omega (\Omega \cos (\tau ) \cos (\tau \Omega )-(\nu -1) \sin (\tau ) \sin (\tau \Omega )) \\ \end{array} \right) \;, \end{eqnarray} where we have used the abbreviation \begin{equation}\label{QIIIOmega} \Omega\equiv \sqrt{f^2+(1-\nu)^2} \;, \end{equation} known as the ``Rabi frequency". The corresponding monodromy matrix $R(2\pi,0)$ reads: \begin{equation}\label{QIIImono} R(2\pi,0) =\left( \begin{array}{ccc} \frac{f^2 \cos (2 \pi \Omega )+(\nu -1)^2}{\Omega ^2} & \frac{2 f (\nu -1) \sin ^2(\pi \Omega )}{\Omega ^2} & \frac{f \sin (2 \pi \Omega )}{\Omega } \\ \frac{2 f (\nu -1) \sin ^2(\pi \Omega )}{\Omega ^2} & \frac{f^2+(\nu -1)^2 \cos (2 \pi \Omega )}{\Omega ^2} & -\frac{(\nu -1) \sin (2 \pi \Omega )}{\Omega } \\ -\frac{f \sin (2 \pi \Omega )}{\Omega } & \frac{(\nu -1) \sin (2 \pi \Omega )}{\Omega } & \cos (2 \pi \Omega ) \\ \end{array} \right). \end{equation} Its trace is evaluated as $\mbox{Tr}\left( R(2\pi,0)\right)=1+2\,\cos(2\pi\,\Omega)$ and yields the eigenvalues $(1,\exp(\pm 2\,\pi\,{\sf i} \,\Omega))$, corresponding to a classical quasienergy \begin{equation}\label{QIIIepscl} \epsilon^{(cl)}=\Omega \;. \end{equation} On the other hand, we may apply (\ref{D8}) to the periodic solution \begin{equation}\label{QIIIperiodic} {\mathbf S}(\tau)=\frac{1}{\Omega}\left( \begin{array}{c} \nu -1 \\ f\,\cos \tau \\ f\,\sin\tau \end{array} \right) \end{equation} with the well-known result \begin{equation}\label{QIIIepsqu} \epsilon^{(qu)}=\frac{1\pm \Omega}{2} \;, \end{equation} that is compatible with (\ref{QIIIepscl}) and (\ref{D7}). For $G=F=\omega_0=1$ the quasienergy curve has a zero at $\omega=1$, i.~e., ${\mathcal E}(1,1,1,1)=0$. For slightly lower values of $G$ this zero shifts to lower values of $\omega$, see Figures \ref{FIGSFP} and \ref{FIGS1}. We will denote by $G={\mathcal E}_0(\omega; F,\omega_0)$ the position of the largest zero of the quasienergy. The vanishing of the quasienergy is in so far interesting as it means that {\it all} solutions of (\ref{D1}) will be $2\pi$-periodic, not only the special one with the initial condition ${\mathbf S}(0)=(\cos\alpha,\sin\alpha,0)^\top$ according to (\ref{Q9}). Moreover, ${\mathcal E}(\omega_0,F,G,\omega)=0$ means degeneracy of the Floquet states for the two level system, which may produce some $2^{nd}$ order phase transition in the parameter space, see \cite{S20a}. The vanishing of the quasienergy implies that the linear term $z_0\,\tau$ in (\ref{FS2d}) must vanish and hence \begin{equation}\label{QIII2} 0=z_0\stackrel{(\ref{FS2e})}{=}\nu\,y_0-\frac{g}{2}\,x_1 \;. \end{equation} In order to check the consistency we will evaluate the condition (\ref{QIII2}) by using a truncation of the power series solutions (\ref{H8e}) and (\ref{H12e}) to the first ten terms. This yields the exact first five terms of $G={\mathcal E}_0(\omega;1,1)$ expanded into a power series in terms of $\omega-\omega_0=\omega-1$: \begin{equation}\label{QIII3} {\mathcal E}_0(\omega;1,1)=1+2 (\omega-1)-\frac{5}{6} (\omega-1)^2+\frac{49}{36} (\omega-1)^3-\frac{577}{240} (\omega-1)^4 +\frac{58357}{12960}(\omega-1)^5+O\left((\omega -1)^6\right) \;. \end{equation} The result is shown in Figure \ref{FIGSFP} as a black dashed curve and fits to the numerically determined red dashed curve of vanishing quasienergy in the domain $0.7<\omega<1$. Further we note that according to \cite{S18} the quasienergy ${\mathcal E}$ can be split into a geometrical part ${\mathcal E}_g$ and a dynamical part ${\mathcal E}_d$ such that ${\mathcal E}={\mathcal E}_g+{\mathcal E}_d$ and the slope relation \begin{equation}\label{QIIIslope} \frac{\partial {\mathcal E}}{\partial \omega }=\frac{{\mathcal E}_g}{\omega} \end{equation} holds, see Eq.~(151) in \cite{S18}. Recall that ${\mathcal E}_d$ is the time average of the energy, i.~e, ${\mathcal E}_d=\frac{1}{2}\overline{{\mathbf h}(t)\cdot{\mathbf S}(t)}$ and ${\mathcal E}_g=\frac{\omega}{4\pi}\,\left|{\mathcal A}\right|$, where $\left|{\mathcal A}\right|$ denotes the signed area of the Bloch sphere swept by ${\mathbf S}(t)$ over one period. In our case this implies that for vanishing quasienergy and hence $G={\mathcal E}_0(\omega)$ we have ${\mathcal E}_g+{\mathcal E}_d=0$ and the slope of the curve $\omega\mapsto {\mathcal E}(\omega_0,F,G,\omega)$ equals $\left| {\mathcal E}_g\right|=\left| {\mathcal E}_d\right|$. We have illustrated this relation for the special case of circular polarization in Figure \ref{FIGS1} by drawing the tangent (dashed red line) with the slope $\frac{1}{2}$. This corresponds to a periodic solution of (\ref{D1}) tracing a great circle on the Bloch sphere with solid angle $\left|{\mathcal A}\right|=2\,\pi$. In general the quasienergy (\ref{QIIIepsqu}) of the RPC has its first zero at $\omega =\omega_1\equiv\frac{F^2+\omega _0^2}{2 \omega _0}$. Hence the series (\ref{QIII3}) will assume its general form as $G={\mathcal E}_0(\omega;F,\omega_0)=F+\sum_{n=1}^\infty g_n\,(\omega-\omega_1)^n$. It begins with \begin{equation}\label{QIII4} G= {\mathcal E}_0(\omega)= F-\frac{6 \left(-60 F^4+50 F^4 \omega _0-100 F^2 \omega _0^2+71 F^2 \omega _0^3-25\omega _0^4\right) \left(\omega -\frac{F^2+\omega _0^2}{2 \omega _0}\right)}{F\left(30 F^4+20 F^2 \omega _0+67 F^2 \omega _0^2+10 \omega _0^3 +65 \omega_0^4\right)}+\ldots\;, \end{equation} but the next terms are too intricate to be shown here. We will consider the case of vanishing quasienergy along the curve $G={\mathcal E}_0(\omega)$ in more details. As already mentioned, in this case all solutions of (\ref{D1}) will be $2\pi$-periodic and hence the local Fourier series representations (\ref{FSfourx}), (\ref{FSfoury}) and (\ref{FS2d}) can be extended to all times $\tau$. It turns out that the slope relation (\ref{QIIIslope}) cannot be satisfied by {\it all} periodic solutions of (\ref{D1}) but only by a particular one that is the limit of the (up to a sign) unique periodic solutions for non-vanishing quasienergy. Instead of again using Eq.~(\ref{FS4}) to determine this limit we will proceed in a different way. Recall that for a general periodic, not necessarily normalized solution ${\mathbf S}(\tau)=(x(\tau),y(\tau),z(\tau))^\top$ of (\ref{D1}) of the form (\ref{FSfourx}), (\ref{FSfoury}) and (\ref{FSfourz}) the functions $x(\tau)$ and $y(\tau$) are represented by $\cos$-series whereas $z(\tau)$ will be a $\sin$-series. Consider the decomposition of $x(\tau)=x_e(\tau)+x_o(\tau)$ into an even $\cos$-series and an odd one and analogously for $y(\tau)=y_e(\tau)+y_o(\tau)$ and $z(\tau)=z_e(\tau)+z_o(\tau)$. Consequently, the time derivative $\dot{x}$ can be uniquely split into an even $\sin$-series and an odd one: \begin{equation}\label{QIIIsplit} \dot{x}=\dot{x_e}+\dot{x_o}= \left( g\,\cos(\tau)\,z_o-f\,\sin(\tau)\,y_o\right)+\left( g\,\cos(\tau)\,z_e-f\,\sin(\tau)\,y_e\right) \;. \end{equation} Analogous decompositions for $\dot{y}$ and $\dot{z}$ lead to a decomposition of ${\mathbf S}(\tau)$ into two separate solutions \begin{equation}\label{QIIIdec} {\mathbf S}(\tau)= {\mathbf S}^{(1)}(\tau)+ {\mathbf S}^{(2)}(\tau)\equiv \left(\begin{array}{c} x_e(\tau) \\ y_o(\tau) \\ z_o(\tau) \end{array} \right)+ \left(\begin{array}{c} x_o\tau) \\ y_e(\tau) \\ z_e(\tau) \end{array} \right) \;. \end{equation} It is clear that ${\mathbf S}^{(1)}(\tau)$ equals the limit of periodic solutions for non-vanishing quasienergies since these periodic solutions have the same even/odd character as ${\mathbf S}^{(1)}(\tau)$, see Proposition \ref{prop5}. Moreover, the two solutions (\ref{QIIIdec}) are orthogonal for all $\tau$: Their scalar product is constant in time, on the other hand an odd $\cos$-series and has thus a vanishing time average. Further, it follows that ${\mathbf S}^{(2)}(\tau)$ belongs to ${\mathcal E}_d=0$ since ${\mathbf h}\cdot {\mathbf S}^{(2)}$ will be an odd $\cos$-series and thus has a vanishing time average. In contrast, ${\mathbf h}\cdot {\mathbf S}^{(1)}$ will be an even $\cos$-series which is compatible with $\left|{\mathcal E}_d\right|>0$ and a positive slope of the quasienergy curves at $G={\mathcal E}_0(\omega)$, see Figure \ref{FIGSFP}. For the sake of completeness we note that the third solution ${\mathbf S}^{(3)}= {\mathbf S}^{(1)}\times {\mathbf S}^{(2)}$ will be of the following type: $x^{(3)}(\tau)$ is an odd $\sin$-series, $y^{(3)}(\tau)$ is an even $\sin$-series, and $z^{(3)}(\tau)$ is an even $\cos$-series. Hence also for this solution the time average of ${\mathbf h}\cdot {\mathbf S}^{(3)}$ will be an odd $\sin$-series and hence ${\mathcal E}$ vanishes. An example is shown in Figure \ref{FIGSP12}. In the case of the periodic solutions ${\mathbf S}^{(1)}(\tau)$ or ${\mathbf S}^{(2)}(\tau)$ the time average of ${\mathbf h}\cdot {\mathbf S}$ can be expressed in terms of the first Fourier coefficients: \begin{equation}\label{QIIIav} \epsilon_d^{(qu)}=\frac{1}{2}\overline{ {\mathbf h}\cdot {\mathbf S}}=\frac{1}{2} \left( \nu\,x_0+\frac{g}{2}y_1+\frac{f}{2}z_1\right) \;, \end{equation} where we have again passed to the dimensionless quasienergy and the Fourier coefficients are given in (\ref{FS2a}), (\ref{FS2b}) and (\ref{FS2d}). The suitable initial conditions $x(0)=\cos\beta$ and $y(0)=\sin\beta$ can be derived from the result $\epsilon_d^{(qu)}=0$ analogously to (\ref{FS4}): \begin{equation}\label{QIIIbeta} \beta=-\arctan\frac{ \nu\,x_0^{(x)}+\frac{g}{2}y_1^{(x)}+\frac{f}{2}z_1^{(x)}}{ \nu\,x_0^{(y)}+\frac{g}{2}y_1^{(y)}+\frac{f}{2}z_1^{(y)}} \;. \end{equation} Here the superscript $(x)$ or $(y)$ refers to the dependence of the Fourier coefficients, via $\xi_n$ and $\eta_n$, on the initial conditions $x(0)$ and $y(0)$. Finally, the initial conditions $x(0)=\cos\alpha$ and $y(0)=\sin\alpha$ for the first solution $(\mathbf S)^{(1)}(\tau)$ are given by \begin{equation}\label{QIIIalpha} \alpha=\beta\pm\frac{\pi}{2} \;, \end{equation} using the orthogonality of ${\mathbf S}^{(1)}(\tau)$ and ${\mathbf S}^{(2)}(\tau)$. After some calculations it follows that the dynamical part of the quasienergy of the first solution ${\mathbf S}^{(1)}(\tau)$ assumes the value \begin{eqnarray}\label{QIIIeda} \epsilon_d&=&\frac{1}{2}\overline{ {\mathbf h}\cdot {\mathbf S}^{(1)}}=\frac{1}{2} \left( \left(\nu\,x_0^{(x)}+\frac{g}{2}y_1^{(x)}+\frac{f}{2}z_1^{(x)} \right)\cos\alpha+ \left(\nu\,x_0^{(y)}+\frac{g}{2}y_1^{(y)}+\frac{f}{2}z_1^{(y)} \right)\sin\alpha \right)\\ \label{QIIIedb} &=& \frac{1}{2} \sqrt{ \left(\nu\,x_0^{(x)}+\frac{g}{2}y_1^{(x)}+\frac{f}{2}z_1^{(x)} \right)^2+ \left(\nu\,x_0^{(y)}+\frac{g}{2}y_1^{(y)}+\frac{f}{2}z_1^{(y)} \right)^2 }\;. \end{eqnarray} As an example we consider the parameters $\omega_0=F=1$ and $G=\frac{1}{2}$. The quasienergy curve $\omega\mapsto {\mathcal E}(1,1,\frac{1}{2},\omega)$ has its largest zero at $\omega_1=0.781665$. This value has been determined numerically; the analytical approximation (\ref{QIII3}) yields $\omega_1=0.781023$. At this point the two solutions ${\mathbf S}^{(1)}$ and ${\mathbf S}^{(2)}$ are obtained with initial values $x(0)=\cos\alpha,\;y(0)=\sin\alpha$, and $x(0)=\cos\beta,\;y(0)=\sin\beta$, resp.~, where $\beta=-0.489254$ has been calculated according to (\ref{QIIIbeta}) and $\alpha=\beta+\frac{\pi}{2}$, see Figure \ref{FIGSP12}. The slope of the tangent of the quasienergy curve at $\omega=\omega_1$ has been determined via (\ref{QIIIedb}) and assumes the value $\epsilon_d=0.64787$, see Figure \ref{FIGS2}. \section{Resonances}\label{sec:RES} \begin{figure}[h] \centering \includegraphics[width=0.75\linewidth]{FIGRES1.eps} \caption[T1] {The quasienergy ${\mathcal E}(\omega_0,F,G,\omega)$ as a function of $\omega_0$ for fixed values of $\omega=1$, $F=0.5$ and $G=0.1$ (solid curves) calculated by numerical solutions of the Schr\"odinger equation (\ref{SE5}). One observes maxima of the quasienergy at $\omega_0\approx 1,3,5,\ldots$. The dotted curves are various branches of the analytical form (\ref{RESC1}) of the quasienergy for the case of circular polarization, i.~e., $G=0$ and $\omega=1$, $F=0.5$. } \label{FIGRES1} \end{figure} The function $\omega_0\mapsto {\mathcal E}(\omega_0,F,G,\omega)$, restricted to the domain (\ref{QIIIbranch}), has an infinite number of maxima, see Figure \ref{FIGRES1}. These satisfy the condition \begin{equation}\label{RES0} 0=\frac{\partial }{\partial \omega_0} {\mathcal E}(\omega_0,F,G,\omega) \;. \end{equation} defining an infinite number of hypersurfaces in the parameter space ${\mathcal P}$ with points $(\omega_0,F,G,\omega)\in{\mathcal P}$. Solving (\ref{RES0}) for $\omega$ gives the so-called ``resonance frequencies" \begin{equation}\label{RES01} \omega=\omega_{\text{res}}^{(n)}\left(\omega_0,F,G\right),\; n=1,2,3,\ldots \;. \end{equation} In the circular case a smooth representative of the quasienergy ${\mathcal E}_c$ assumes the form \begin{equation}\label{RESC1} {\mathcal E}_c={\textstyle\frac{1}{2}}\left( \omega-\Omega\right)= {\textstyle\frac{1}{2}} \left(\omega -\sqrt{F^2+\left(\omega -\omega _0\right){}^2}\right) \;, \end{equation} and has a unique maximum at $\omega_0=\omega$, see Figure \ref{FIGRES1}. This conforms with the intuitive picture that a resonance occurs if the driving frequency $\omega$ equals the Larmor frequency $\omega_0$ of the energy level splitting. The other maxima of the quasienergy, restricted to the domain (\ref{QIIIbranch}), are represented by intersections of suitable branches of the quasienergy of the form $\pm {\mathcal E}_c+n\,\omega,\; n\in{\mathbbm Z}$. For example, the next maximimum at $\omega_0\approx 3\,\omega$ is obtained by the intersection of $-{\mathcal E}_c$ and ${\mathcal E}_c+\omega$ at \begin{equation}\label{RESC2} \omega_0=\omega+\sqrt{4\,\omega^2-F^2}= 3\,\omega-\frac{F^2}{4\,\omega}+O(F^4) \;. \end{equation} Note that an arbitrarily small admixture of eccentricity to the polarization leads to an avoided level crossing and a smooth maximum close to the value $\omega_0$ of the intersection, see Figure \ref{FIGRES1}. According to \cite{S65}, the time average of the transition probability between different Floquet states assumes its maximum value $\overline{P}={\textstyle\frac{1}{2}}$ at the resonance frequencies, which justifies the denotation. Although Shirley's derivation of the resonance condition refers to the RPL case, see (1) in \cite{S65}, one can easily check that it also holds in the more general RPE case. Moreover, it has been shown \cite{S18} that for $\omega=\omega_{res}^{(n)}$ the classical periodic solution of (\ref{D1}) has a vanishing time-average into the direction of the constant component of the magnetic field. According to our definitions this means that \begin{equation}\label{RES1} x_0= x_0^{(x)}\,\cos\alpha +x_0^{(y)}\,\sin\alpha =0 \;, \end{equation} where $\alpha$ is the auxiliary parameter leading to a periodic solution given by (\ref{FS4}). Together with \begin{equation}\label{RES2} y_0=y_0^{(x)}\,\cos\alpha +y_0^{(y)}\,\sin\alpha=0 \;, \end{equation} see (\ref{FS3}), this implies that the matrix \begin{equation}\label{RES2a} \Xi\equiv\left( \begin{array}{cc} x_0^{(x)} & x_0^{(y)}\\ y_0^{(x)} & y_0^{(y)} \end{array} \right) \end{equation} has a non-vanishing null-vector and hence \begin{equation}\label{RES3} \det\Xi= x_0^{(x)}\,y_0^{(y) }-x_0^{(y)}\,y_0^{(x)}=0 \;. \end{equation} We use truncated versions of (\ref{H8e}) and (\ref{H12e}) in order to derive the first terms of the power series representations \begin{equation}\label{RES4} \frac{\omega_{res}^{(n)}}{\omega_0} = \sum_{m,k=0}^{\infty}\Omega^{(n)}_{m,k}\,\left(\frac{F}{\omega_0}\right)^m\,\left(\frac{G}{\omega_0}\right)^k \;, \end{equation} analogously to \cite{S18}. We will show a few results. The first resonance $\omega_{\text{res}}^{(1)}$ is determined by \begin{equation}\label{RES5} \Omega^{(1)}=\left( \begin{array}{cccccccccc} 1 & 0 & \frac{1}{16} & 0 & \frac{1}{1024} & 0 & -\frac{35}{131072} & 0 & \frac{103}{8388608}&\ldots \\ 0 & -\frac{1}{8} & 0 & \frac{3}{256} & 0 & \frac{27}{65536} & 0 & -\frac{69}{262144} & 0&\ldots \\ \frac{1}{16} & 0 & -\frac{13}{512} & 0 & \frac{611}{131072} & 0 & \frac{433}{2097152} & 0 & * &\ldots \\ 0 & \frac{3}{256} & 0 & -\frac{315}{32768} & 0 & \frac{609}{262144} & 0 & * & 0 \\ \frac{1}{1024} & 0 & \frac{611}{131072} & 0 & -\frac{19115}{4194304} & 0 & * & 0 & *&\ldots \\ 0 & \frac{27}{65536} & 0 & \frac{609}{262144} & 0 & * & 0 & * & 0 &\ldots \\ -\frac{35}{131072} & 0 & \frac{433}{2097152} & 0 & * & 0 & * & 0 & * &\ldots \\ 0 & -\frac{69}{262144} & 0 & * & 0 & * & 0 & * & 0 &\ldots \\ \frac{103}{8388608} & 0 & * & 0 & * & 0 & * & 0 & * &\ldots \\ \vdots &\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots&\vdots \end{array} \right) \;. \end{equation} We note that $\Omega^{(1)}$ is a symmetric matrix due to the symmetry of the Rabi problem under the exchange $G\leftrightarrow F$. The matrix elements $\Omega^{(1)}_{m,k}$ vanish for odd $m+k$. Further, it is instructive to look at the limit cases of linear or circular polarization. For $G=0$ the first column of $\Omega^{(1)}$ agrees with the corresponding known results in the case of linear polarization, see Table $1$ in \cite{S18}. For $F=G$ the power series (\ref{RES4}) coalesces into a series of a single variable $F$ with coefficients $\tilde{\Omega}^{(1)}_M=\sum_{m=0}^{M}\Omega^{(1)}_{m,M-m},\;M=0,2,4,\ldots$. On the other hand, the resonance frequency $\omega_{res}^{(1)}$ of the circularly polarized case is known to be $\omega_{res}^{(1)}=\omega_0$. Hence the anti-diagonal sums of $\Omega^{(1)}$-entries $\tilde{\Omega}^{(1)}_M$ must vanish for $M=2,4,\ldots$. This can be confirmed for $M=0,2,\ldots,8$ in the above-shown part of $\Omega^{(1)}$, see (\ref{RES5}). The $2^{nd}$ resonance is described by the matrix \begin{equation}\label{RES6} \Omega^{(2)}=\left( \begin{array}{ccccccccc} \frac{1}{3} & 0 & \frac{3}{32} & 0 & -\frac{135}{8192} & 0 & \frac{2133}{1048576} & 0 & \ldots \\ 0 & \frac{1}{16} & 0 & -\frac{9}{2048} & 0 & -\frac{3591}{524288} & 0 & * & \ldots \\ \frac{3}{32} & 0 & -\frac{21}{4096} & 0 & \frac{6075}{1048576} & 0 & * & 0 & \ldots \\ 0 & -\frac{9}{2048} & 0 & \frac{4095}{262144} & 0 & * & 0 & * & \ldots \\ -\frac{135}{8192} & 0 & \frac{6075}{1048576} & 0 & * & 0 & * & 0 & \ldots \\ 0 & -\frac{3591}{524288} & 0 & * & 0 & * & 0 & * & \ldots \\ \frac{2133}{1048576} & 0 & * & 0 & * & 0 & * & 0 & \ldots \\ 0 & * & 0 & * & 0 & * & 0 & * & \ldots \\ \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots & \vdots \\ \end{array} \right)\;. \end{equation} Here analogous remarks apply as in the case of $\Omega^{(1)}$, except that the anti-diagonal sums of $\Omega^{(2)}$-entries $\tilde{\Omega}^{(2)}_M$ no longer vanish. They can be determined by the following consideration. In the circular limit the $2^{nd}$ resonance is defined by the level crossing \begin{equation}\label{RES7} \frac{1}{2}\left( -\omega+\Omega\right)=\frac{1}{2}\left(3\,\omega-\Omega\right) \;, \end{equation} where $\Omega\equiv \sqrt{F^2+(\omega_0-\omega)^2}$. (Recall that an arbitrary small amount of eccentricity $F-G$ produces an avoided level crossing and hence a smooth maximum of the quasienergy). After some manipulations the condition (\ref{RES7}) can be transformed into \begin{eqnarray}\label{RES8a} \frac{\omega_{res}^{(2)}}{\omega_0}&=&\frac{1}{3}\left(-1+\sqrt{3\left( \frac{F}{\omega_0}\right)^2+4}\right)\\ \label{RES8b} &=&\frac{1}{3}+\sum_{n=1}^\infty \frac{(-1)^{n+1} 3^{n-1} (2 n-3)\text{!!}}{ 2^{3 n-1}\,n!}\left( \frac{F}{\omega_0}\right)^{2n}\\ \label{RES8c} &=& \frac{1}{3}+\frac{1}{4} \left(\frac{F}{\omega _0}\right)^2-\frac{3}{64} \left(\frac{F}{\omega_0}\right)^4 +\frac{9}{512} \left(\frac{F}{\omega _0}\right)^6+O\left(\frac{F}{\omega _0}\right)^8 \;. \end{eqnarray} It can be easily checked that the coefficients of the power series (\ref{RES8c}) coincide with the anti-diagonal sums, i.~e., $\tilde{\Omega}^{(0)}_2=\frac{1}{3}$, $\tilde{\Omega}^{(2)}_2=\frac{1}{4}$, $\tilde{\Omega}^{(2)}_4=-\frac{3}{64}$, and $\tilde{\Omega}^{(2)}_6=\frac{9}{512}$. Finally, we consider the $3^{rd}$ resonance described by \begin{equation}\label{RES9} \Omega^{(3)}=\left( \begin{array}{cccccc} \frac{1}{5} & 0 & \frac{5}{96} & 0 & -\frac{2125}{221184} & \ldots \\ 0 & \frac{1}{48} & 0 & -\frac{125}{55296} & 0 & \ldots \\ \frac{5}{96} & 0 & -\frac{205}{36864} & 0 & * &\ldots \\ 0 & -\frac{125}{55296} & 0 & * & 0 &\ldots \\ -\frac{2125}{221184} & 0 & * & 0 & * &\ldots \\ \vdots& \vdots & \vdots & \vdots & \vdots & \vdots \\ \end{array} \right) \;, \end{equation} the anti-diagonal sums of which are obtained via \begin{eqnarray}\label{RES10a} \frac{\omega_{res}^{(3)}}{\omega_0}&=&\frac{1}{15}\left(-1+\sqrt{15\left( \frac{F}{\omega_0}\right)^2+16}\right)\\ \label{RES10b} &=&\frac{1}{5}+\sum_{n=1}^\infty \frac{(-15)^{n-1} (-3+2 n)\text{!!}}{2^{4 n-1}\,n!}\left( \frac{F}{\omega_0}\right)^{2n}\\ \label{RES10c} &=&\frac{1}{5}+\frac{1}{8} \left(\frac{F}{\omega _0}\right){}^2 -\frac{15}{512} \left(\frac{F}{\omega_0}\right)^4+O\left(\frac{F}{\omega _0}\right)^6 \;. \end{eqnarray} The first non-trivial anti-diagonal of $\Omega^{(n)}$ can be given in closed form. According to the recurrence relation given in \cite{S18} we conjecture that \begin{equation}\label{RES9a} \Omega^{(n)}_{2,0}= \Omega^{(n)}_{0,2}=\frac{2 n-1}{16 (n-1) n} \;, \end{equation} for $n>1$. Employing the circular limit \begin{equation}\label{RES10} \frac{\omega_{res}^{(n)}}{\omega_0}=\frac{\sqrt{(2 n-3) (2 n-1) \left(\frac{F^2}{\omega _0^2}+1\right)+1}-1}{4 (n-2) n+3} =\frac{1}{2n-1}+\frac{1}{4(n-1)}\left(\frac{F}{\omega_0}\right)^2+O\left(\frac{F}{\omega_0}\right)^4 \end{equation} we obtain \begin{equation}\label{RES11} \Omega^{(n)}_{1,1}= \frac{1}{8 (n-1) n} \;, \end{equation} for $n>1$. These results can be checked for $n=2,3$ by inspection of (\ref{RES6}) and (\ref{RES9}). \section{Special limit cases}\label{sec:L} \subsection{Limit case $\omega\rightarrow 0$}\label{sec:LOM} \begin{figure}[h] \centering \includegraphics[width=0.75\linewidth]{FIGSEPS2.eps} \caption[T1] {Various branches of the quasienergy ${\mathcal E}(\omega_0,F,G,\omega)$ as a function of $\omega$ for fixed values of $\omega_0=1$, $F=3$ and $G=2$. The different branches are generated by adding integer multiples of $\omega$ to $\pm {\mathcal E}$ and can be distinguished by their color. The black dashed curve represents the adiabatic approximation ${\mathcal E}_0+\omega\,{\mathcal E}_1+\omega^2\,{\mathcal E}_2$ according to (\ref{LOM2d}), (\ref{LOM5}) and (\ref{LOM8}). } \label{FIGSEPS2} \end{figure} This limit case (``adiabatic limit") has been already treated in \cite{S18} in sufficient generality, such that we only need to recall the essential issues. We adopt a series representation \begin{equation}\label{LOM1} {\mathbf S}(\omega t)=\sum_{n=0}^{\infty}\omega^n\,{\mathbf S}^{(n)}(\omega t) \end{equation} of the periodic solution of (\ref{D1}) and obtain a recursive system of inhomogeneous linear differential equations for the ${\mathbf S}_n$. The starting point is \begin{equation}\label{LOM2} {\mathbf S}^{(0)}(\omega t)=\frac{{\mathbf h}(t)}{\left\|{\mathbf h}(t)\right\|}= \frac{1} {\sqrt{F^2 \sin^2(\omega t )+G^2 \cos ^2(\omega t )+\omega _0^2}} \left(\begin{array}{c} \omega _0 \\ G\,\cos\omega t \\ F\,\sin\omega t \end{array} \right) \;, \end{equation} that is, the spin vector follows the direction of the slowly varying magnetic field. The corresponding zeroth term of the series for the quasienergy \begin{equation}\label{LOM2a} {\mathcal E}= \overline{\frac{1}{2}\left({\mathbf h}_1+\frac{{\mathbf h}_2{\mathbf S}_2+{\mathbf h}_3{\mathbf S}_3}{1+{\mathbf S}_1} \right)} =\sum_{n=0}^{\infty} {\mathcal E}_n\,\omega^n \end{equation} can be obtained as \begin{eqnarray} \label{LOM2b} {\mathcal E}_0 &=& \overline{\frac{1}{2}\left({\mathbf h}_1+\frac{{\mathbf h}_2{\mathbf S}^{(0)}_2+{\mathbf h}_3{\mathbf S}^{(0)}_3}{1+{\mathbf S}^{(0)}_1} \right)} =\overline{\frac{1}{2}\sqrt{{\mathbf h }\cdot{\mathbf h}}} \\ \label{LOM2c} &=& \overline{\frac{1}{2} \sqrt{F^2 \sin ^2(\omega t )+G^2 \cos ^2(\omega t )+\omega _0^2}} \\ \label{LOM2d} &=& \frac{\sqrt{G^2+\omega _0^2}}{\pi } E\left(\frac{G^2-F^2}{G^2+\omega _0^2}\right) \;, \end{eqnarray} where $E(\ldots)$ denoted the complete elliptic integral of the $2^{nd }$ kind. Note that in the adiabatic limit the quasienergy $ {\mathcal E}_0$ can be completely reduced to its dynamical part ${\mathcal E}_d$, since the geometrical part ${\mathcal E}_g$ is proportional to $\omega$ and only contributes to the next term $ {\mathcal E}_1$. For $G=0$ the formula for ${\mathcal E}_0$ agrees with Eq.~(253) in \cite{S18}. In the circular case ($G=F$) the series expansion \begin{equation}\label{LOM2e} {\mathcal E}=\frac{\omega+\Omega}{2}=\frac{1}{2} \sqrt{F^2+\omega _0^2}+\left(\frac{1}{2}-\frac{\omega _0}{2 \sqrt{F^2+\omega _0^2}}\right) \omega +\frac{F^2 \omega ^2}{4 \left(F^2+\omega _0^2\right){}^{3/2}}+O\left(\omega ^3\right) \end{equation} yields the zeroth order contribution $\lim_{\omega\rightarrow 0}{\mathcal E}=\lim_{\omega\rightarrow 0}\frac{\omega+\Omega}{2}=\frac{1}{2}\sqrt{F^2+\omega_0^2}$ that also follows from (\ref{LOM2d}) and $E(0)=\frac{\pi}{2}$.\\ The next term ${\mathbf S}^{(1)}$ of the series (\ref{LOM1}) is obtained as the solution of \begin{equation}\label{LOM3} \frac{d}{dt} {\mathbf S}^{(0)} = {\mathbf h}\times {\mathbf S}^{(1)} \;, \end{equation} such that ${\mathbf S}^{(0)}\cdot{\mathbf S}^{(1)}=0$ in order to guarantee normalization in linear $\omega$-order. The result is \begin{equation}\label{LOM4} \omega\,{\mathbf S}^{(1)}(t)=\left( \frac{d}{dt}{\mathbf S}^{(0)}(t)\right)\times\frac{{\mathbf h}(t)}{\left\|{\mathbf h}(t)\right\|^2}= \frac{2 \sqrt{2}\,\omega }{\left(\left(G^2-F^2\right) \cos (2 \omega t )+F^2+G^2+2 \omega _0^2\right)^{3/2}} \left( \begin{array}{c} -F G \\ F \, \omega _0\,\cos \omega t \\ G\, \omega _0\, \sin \omega t \\ \end{array} \right) \;. \end{equation} It leads to a linear contribution to the quasienergy of \begin{equation}\label{LOM5} \omega\,{\mathcal E}_1=\omega\left( \frac{1}{2}-\frac{F \omega _0 \Pi \left(1-\frac{F^2}{G^2}|\frac{G^2-F^2}{G^2+\omega_0^2}\right)}{\pi G \sqrt{G^2+\omega _0^2}}\right) \;, \end{equation} where $\Pi(\ldots|\ldots)$ denotes the complete elliptic integral of the $3^{rd}$ kind. According to (\ref{LOM4}), ${\mathbf S}_1\cdot {\mathbf h}=0$ and hence the dynamical part ${\mathcal E}_{1d}$ of ${\mathcal E}_1$ vanishes. ${\mathcal E}_1$ consists only of the geometrical part that can be identified with the Berry phase \cite{B84}, \cite{AA87}, \cite{MB14} divided by the period since in the adiabatic limit the solid angles swept by the elliptically polarized magnetic field and by the spin vector are identical. Consequently, ${\mathcal E}_1$ vanishes in the limit of linear polarization. For $G=F$ the limit of (\ref{LOM5}) and the linear term in the series expansion (\ref{LOM2e}) agree since $\Pi(0,0)=\frac{\pi}{2}$. According to \cite{S18}, the next, quadratic term of (\ref{LOM1}) is given by \begin{eqnarray}\label{LOM6a} {\mathbf S}^{(2)}&=&\left(\frac{1}{\omega}\frac{d}{dt}{\mathbf S}^{(1)}\right)\times\frac{\mathbf h}{\|{\mathbf h}\|^2} -\frac{\mathbf h}{2\|{\mathbf h}\|^2}{\mathbf S}^{(1)}\cdot{\mathbf S}^{(1)}\\ \label{LOM6b} &=&\frac{1}{\left(\left(G^2-F^2\right) \cos (2 t \omega )+F^2+G^2+2 \omega_0^2\right)^{7/2}} \left( \begin{array}{c} {\mathbf S}^{(2)}_{1,0}+{\mathbf S}^{(2)}_{1,2}\cos(2\omega t)+{\mathbf S}^{(2)}_{1,4}\cos(4\omega t) \\ {\mathbf S}^{(2)}_{2,1}\cos(\omega t)+{\mathbf S}^{(2)}_{2,3}\cos(3\omega t) \\ {\mathbf S}^{(2)}_{3,1}\sin(\omega t)+{\mathbf S}^{(2)}_{3,3}\sin(3\omega t) \end{array} \right) \;, \end{eqnarray} where \begin{eqnarray} \label{LOM7a} {\mathbf S}^{(2)}_{1,0} &=& -6 \sqrt{2} \omega _0 \left(F^4+\omega _0^2 \left(F^2+G^2\right)+G^4\right),\\ \label{LOM7b} {\mathbf S}^{(2)}_{1,2} &=& 2 \sqrt{2} \omega _0 \left(F^2-G^2\right) \left(2 F^2+2 G^2+\omega _0^2\right), \\ \label{LOM7c} {\mathbf S}^{(2)}_{1,4} &=& 2 \sqrt{2} \omega _0 \left(F^2-G^2\right)^2, \\ \label{LOM7d} {\mathbf S}^{(2)}_{2,1} &=& \sqrt{2} G \left(-6 F^4+F^2 \left(2 G^2-7 \omega _0^2\right)+11 G^2 \omega _0^2+8 \omega_0^4\right),\\ \label{LOM7e} {\mathbf S}^{(2)}_{2,3} &=& 3 \sqrt{2} G (F-G) (F+G) \left(2 F^2+\omega _0^2\right),\\ \label{LOM7f} {\mathbf S}^{(2)}_{3,1} &=& \sqrt{2} F \left(F^2 \left(2 G^2+11 \omega _0^2\right)-6 G^4-7 G^2 \omega _0^2+8 \omega_0^4\right),\\ \label{LOM7g} {\mathbf S}^{(2)}_{3,3} &=&3 \sqrt{2} F \left(F^2-G^2\right) \left(2 G^2+\omega _0^2\right) \;. \end{eqnarray} The corresponding quadratic correction to the quasienergy is too complicated to be calculated here. We confine ourselves to determine ${\mathcal E}_2$ for a special set of physical parameters, namely $F=3$, $G=2$, and $\omega_0=1$. The result is \begin{equation}\label{LOM8} {\mathcal E}_2=57-\frac{16147}{200 \sqrt{2}}+ \frac{1}{\pi}\left( \frac{4777\, \Gamma \left(\frac{1}{4}\right)^2+21036\, \Gamma \left(\frac{3}{4}\right)^2}{240 \sqrt{10 \pi }}-\frac{171\, \Pi \left(\left.-\frac{5}{4}\right|-1\right)}{\sqrt{5}}\right) \approx 0.217319\ldots \;. \end{equation} The corresponding adiabatic approximation of the quasienery has been shown in Figure \ref{FIGSEPS2} together with the various branches of the form $n\,\omega\pm {\mathcal E}$. It turns out that the adiabatic approximation is a kind of envelope of a certain family of branches that interpolates between the numerous avoided level crossings of this family. This finding is insofar plausible, since by definition the adiabatic limit of quasi-energy is an analytical function of $\omega$, while the different branches $n\,\omega\pm {\mathcal E}$ for $\omega\rightarrow 0$ get stronger and stronger kinks. \subsection{Limit case $F, G\rightarrow 0$}\label{sec:FG} For sake of comparison with the analogous results in \cite{S18} we rewrite the equation of motion (\ref{D1}) in the form \begin{eqnarray} \label{FG1a} \frac{d X}{dt} &=&\lambda\,G\,\cos(\omega t)\,Z-\lambda\,F\,\sin(\omega t)\,Y\;, \\ \label{FG1b} \frac{d Y}{dt} &=&\lambda\,F\,\sin(\omega t)\,X-\omega_0\,Z\;, \\ \label{FG1c} \frac{d Z}{dt} &=&\omega_0\,Y-\lambda\,G\,\cos(\omega t)\,X \;, \end{eqnarray} where $\lambda$ is a formal expansion parameter that is ultimately set to $\lambda=1$. In the case $\lambda=0$ there are only two normalized solutions of the classical Rabi problem that are $T$-periodic for all $T>0$, namely ${\mathbf X}(t)=\pm (1,0,0)^\top$. Hence for infinitesimal $\lambda$ we expect that we still have $X(t)=\pm 1+O(\lambda^2)$ but $(Y(t),Z(t))$ will describe an infinitesimal ellipse, i.~e.~, $Y(t)= A \cos\omega t+O(\lambda^3)$ and $Z(t)=B \sin\omega t+O(\lambda^3)$, such that $A$ and $B$ depend linearly on $\lambda F$ and $\lambda G$. These considerations and numerical investigations suggest the following Fourier-Taylor (FT) series ansatz, not yet normalized, \begin{eqnarray} \nonumber X(t)&=&\sum_{n=0}^{\infty}\lambda^{2n}\sum_{m=0}^{n}R_{n,m}(F,G,\omega,\omega_0)\cos\,2m\omega t\;, \\ &&\label{FL2a}\\ \nonumber Y(t) &=& \sum_{n=0}^{\infty}\lambda^{2n+1}\sum_{m=0}^{n}S_{n,m}(F,G,\omega,\omega_0)\cos\,(2m+1)\omega t\;, \\ \label{FL2b} && \\ \label{FL2c} Z(t)&=& \sum_{n=0}^{\infty}\lambda^{2n+1}\sum_{m=0}^{n}T_{n,m}(F,G,\omega,\omega_0)\sin\,(2m+1)\omega t\;. \end{eqnarray} Inserting these series into the differential equations (\ref{FG1a}) -- (\ref{FG1c}) and collecting powers of $\lambda$ yields recurrence relations for the functions $R_{n,m},\,S_{n,m}$ and $T_{n,m}$. As initial conditions we use the following choices that result from the above considerations and the lowest orders $\lambda^0$ and $\lambda^1$ of the differential equations (\ref{FG1a}) -- (\ref{FG1c}): \begin{eqnarray} \label{FL3a} R_{0,0}(F,G,\omega,\omega_0) &=& 1\;,\\ \label{FL3b} R_{n,0}(F,G,\omega,\omega_0) &=& 0\quad \mbox{for } n=1,2,\ldots,\\ \label{FL3c} S_{0,0}(F,G,\omega,\omega_0)&=& -\frac{F \omega +G \omega _0}{\left(\omega -\omega _0\right) \left(\omega +\omega _0\right)}\;,\\ \label{FL3d} T_{0,0}(F,G,\omega,\omega_0)&=& -\frac{F \omega _0+G \omega }{\left(\omega -\omega _0\right) \left(\omega +\omega _0\right)}\;. \end{eqnarray} For $n>0$ the FT coefficients $R_{n,m},\,S_{n,m}$ and $T_{n,m}$ can be recursively determined by means of the following relations: \begin{eqnarray} \nonumber R_{n+1,m} &=& \frac{1}{4\,m\,\omega}\left(F\,S_{n,m-1} -F\,S_{n,m}-G\,T_{n,m-1}-G\,T_{n,m}\right)\\ \label{FL4a} && \mbox{ for } 1\le m\le n+1\;, \\ \nonumber S_{n,m} &=& \frac{1}{2 \left(((2 m +1)\omega )^2-\omega _0^2\right)}\, \left(\left(-G \omega _0-F (2 m+1) \omega \right)R_{n,m} + \left( -G \omega _0+F (2 m+1) \omega \right)R_{n,m+1} \right)\\ \label{FL4b} && \mbox{ for } 0\le m\le n\;,\\ \nonumber T_{n,m} &=& \frac{1}{2 \left(((2 m+1) \omega )^2-\omega _0^2\right)} \left( \left(-G (1+2 m) \omega -F \omega _0\right) R_{n,m}+\left(-G (1+2 m) \omega +F \omega _0\right) R_{n,m+1} \right) \\ && \mbox{ for } 0\le m\le n\;. \label{FL4c} \end{eqnarray} where, of course, we have to set $R_{n,n+1}=S_{n,n+1}=0$ in (\ref{FL4a}) - (\ref{FL4c}). It follows that $R_{n,m}(F,G,\omega,\omega_0)$, $S_{n,m}(F,G,\omega,\omega_0)$ and $T_{n,m}(F,G,\omega,\omega_0)$ are rational functions of their arguments. We will show the first few terms of the FT series for $X(t), Y(t)$ and $Z(t)$: \begin{eqnarray} \nonumber X(t) &=&1-\frac{(F-G) (F+G)}{4 \left(\omega^2 -\omega_0^2\right)}\,\cos 2\omega t\quad + \\ \nonumber && -\frac{(F-G) (F+G) \left(3 F^2 \omega ^2+3 G^2 \omega ^2-4 F G \omega \omega _0-F^2 \omega _0^2-G^2 \omega _0^2\right)}{8 \left(\omega^2 -\omega_0^2\right)^2 \left(9\omega^2 -\omega_0^2\right)}\,\cos 2\omega t\\ \nonumber &&+ \left( \frac{3 (F-G)^2 (F+G)^2}{64 \left(\omega^2 -\omega_0^2\right) \left(9 \omega^2 - \omega_0^2\right)} \right) \cos 4\omega t\, + O(\lambda^6), \\ \label{FL5a} &&\\ \nonumber Y(t)&=& \left( -\frac{F \omega +G \omega _0}{\left(\omega^2 -\omega_0^2\right)} \right)\,\cos \omega t\\ \label{FL5b} &&+ \left( -\frac{(F-G) (F+G) \left(F \omega -G \omega _0\right)}{8 \left(\omega^2 -\omega_0^2\right){}^2} \right)\,\cos 3 \omega t + O(\lambda^5)\;,\\ \nonumber Z(t)&=& \left( -\frac{G \omega +F \omega _0}{\left(\omega^2 -\omega_0^2\right) } \right)\,\sin \omega t\\ \label{FL5c} &&+ \left( -\frac{(F-G) (F+G) \left(-G \omega +F \omega _0\right)}{8 \left(\omega^2 -\omega_0^2\right)^2 } \right)\,\sin 3 \omega t + O(\lambda^5) \;, \end{eqnarray} where $\lambda$ stands for any linear combination of $F$ and $G$. We note that the coefficients contain denominators of the form $\omega^2-\omega_0^2$ and $9\omega^2-\omega_0^2$ due to the denominator $(2m+1)^2\omega^2-\omega_0^2$ in the recursion relations (\ref{FL4b}) and (\ref{FL4c}). Hence the FT series breaks down at the resonance frequencies $\omega_{res}^{(m)}=\frac{\omega_0}{2m-1}$. This is the more plausible since according to the above ansatz $z_0=1$ which is not compatible with the resonance condition $z_0=0$ mentioned above. Using the FT series solution (\ref{FL2a}) -- (\ref{FL2c}) it is a straightforward task to calculate the quasienergy ${\mathcal E}=a_0$ as the time-independent part of the FT series of \begin{equation}\label{FL6} \frac{1}{2}\left(\omega_0+\frac{G \cos(\omega t)Y(t)+F \sin(\omega t)Z(t)}{R+Z(t)}\right) =a_0+\sum_{\stackrel{n\in{\mathbbm Z}}{n\neq 0}}a_n\,e^{{\sf i}\,n\,\omega\, t}\;, \end{equation} according to (\ref{D8}). The first few terms of the result are given by \begin{eqnarray} \nonumber {\mathcal E} &=& \frac{\omega_0}{2} -\frac{2 F G \omega +F^2 \omega _0+G^2 \omega _0}{8 \left(\omega ^2-\omega_0^2\right)} \\ \nonumber &&+\frac{4 F G \left(F^2+G^2\right) \omega ^3+\left(F^4+22 F^2 G^2+G^4\right) \omega ^2 \omega _0+12 F G \left(F^2+G^2\right) \omega \omega _0^2+\left(3 F^4+2 F^2 G^2+3 G^4\right) \omega _0^3}{128 \left(\omega ^2-\omega _0^2\right){}^3} + O(\lambda^6)\;.\\ \label{FL7} && \end{eqnarray} This is in agreement with the result for linear polarization, see \cite{S18}, eq.~(198), if we set $G=0$.\\ It will be instructive to check the first two terms of (\ref{FL7}) by using the decomposition of the quasienergy into a dynamical and a geometrical part. In lowest order in $\lambda$ the classical RPE solution is a motion on an ellipse with semi axes \begin{equation}\label{FL8} a=\frac{F \omega +G \omega _0}{\left|\omega^2 -\omega_0^2\right|}\;, \quad\mbox{and } b=\frac{G \omega +F \omega _0}{\left|\omega^2 -\omega_0^2\right|} \;. \end{equation} Hence the geometrical part of the quasienergy reads \begin{equation}\label{FL9} {\mathcal E}_g=\frac{\omega}{4\pi}\,\pi\,a\,b+O\left(\lambda^4\right) = \frac{\omega \left(G \omega +F \omega _0\right) \left(F \omega +G \omega _0\right)} {4\left(\omega ^2-\omega _0^2\right)^2}+O(\lambda^4)\;. \end{equation} The dynamical part is obtained as \begin{equation}\label{FL10} {\mathcal E}_d=\overline{\frac{\omega_0\,X+ G \,\cos(\omega t)\,Y+F \,\sin(\omega t)\,Z}{2 R}} =\frac{\omega_0}{2} +\frac{-4 F G \omega ^3-3 \left(F^2+G^2\right) \omega^2 \omega_0+\left(F^2+G^2\right) \omega_0^3}{8 \left(\omega^2-\omega _0^2\right)^2} +O\left(\lambda^4\right). \end{equation} The sum of both parts together correctly yields \begin{equation}\label{FL11} {\mathcal E}={\mathcal E}_d + {\mathcal E}_g= \frac{\omega_0}{2}-\frac{2 F G \omega +\left(F^2+G^2\right) \omega _0}{8 \left(\omega^2-\omega_0^2\right)} +O\left(\lambda^4\right)\;. \end{equation} Moreover, the slope relation (\ref{QIIIslope}) is satisfied in the considered order, \begin{equation}\label{FL12} \frac{\partial {\mathcal E}}{\partial \omega} = \frac{\left(G \omega +F \omega _0\right) \left(F \omega +G \omega _0\right)}{4\left(\omega ^2-\omega _0^2\right){}^2}+O(\lambda^4) =\frac{ {\mathcal E}_g}{\omega} \;, \end{equation} in accordance with \cite{S18}, eq.~(202). However, as mentioned above, the FT series for the quasienergy has poles at the values $\omega=\omega_{res}^{(m)} = \frac{1}{2m-1},\;m=1,2,\ldots$ and hence the present FT series ansatz is not suited to investigate the Bloch-Siegert shift for small $\lambda$. We have thus chosen another approach in Section \ref{sec:RES}. \subsection{Limit case $\omega_0\rightarrow 0$}\label{sec:LOMO} It is well-known, see, e.~g., \cite{S18} or \cite{SSH20a}, that for $\omega_0=0$ and linear polarization ($F=0$) the equation of motion (\ref{FG1a}) - (\ref{FG1a}) has the exact solution \begin{eqnarray}\label{LOMO1a} X(t)&=&\cos \left(\frac{G}{\omega}\, \sin \,\omega t\right) =J_0\left(\frac{G}{\omega}\right)+2 \sum_{m=1}^{\infty}J_{2m}\left(\frac{G}{\omega}\right)\,\cos\,2m\omega t \;,\\ \label{LOMO1b} Y(t)&=&0\;,\\ \label{LOMO1c} Z(t)&=&- \sin \left(\frac{G}{\omega}\, \sin \,\omega t\right) = -2\sum_{n=0}^{\infty}J_{2m+1}\left(\frac{G}{\omega}\right)\,\sin\,(2m+1)\omega t \;, \end{eqnarray} where the $J_k(\ldots)$ denote the Bessel functions of the first kind and the series representation results from the Jacobi-Anger expansion. Upon inserting the Taylor series of $J_k(x)$, that starts with the lowest power $x^k$, into (\ref{LOMO1a}) and (\ref{LOMO1c}) we would obtain the Fourier-Taylor (FT) series of $X(t)$ and $Z(t)$. On the other hand, we have considered an FT series of $X(t), Y(t)$ and $Z(t)$ in section \ref{sec:FG} that can be specialized to $\omega_0=F=0$. (We will indicate the specialization to $\omega_0=F=0$ by using the notation ${\sf X}(t), {\sf Y}(t)$ and ${\sf Z}(t)$.) The only difference is normalization: The solution (\ref{LOMO1a}) - (\ref{LOMO1c}) is already normalized and satisfies $\overline{{\sf X}(t)}=J_0\left(\frac{G}{\omega}\right)$, whereas the ansatz (\ref{FL2a}) - (\ref{FL2c}) assumes $\overline{{\sf X}(t)}=1$. It follows that the FT series (\ref{FL2a}) - (\ref{FL2c}), specialized to $\omega_0=F=0$ is identical with the FT series obtained by (\ref{LOMO1a}) - (\ref{LOMO1c}) upon division by $J_0\left(\frac{G}{\omega}\right)$. We have checked this for a couple of examples. Especially, it follows that \begin{equation}\label{LOMO2} {\sf R}_{n,m}(g)=\left[\frac{2 J_{2 m}(g)}{J_0(g)} \right]_{2n}\,g^{2n} \;, \end{equation} where $g\equiv \frac{G}{\omega}$ and $[f(x)]_n$ denotes the coefficient $a_n$ of the Taylor series $f(x)=\sum_n a_n\,x^n$. Unfortunately, it does not seem possible to generalize the above $\omega_0=0$ solution obtained for the linear polarization case to the elliptical case. However, its FT series is already known: We have only to specialize (\ref{FL2a}) - (\ref{FL2c}) to the case $\omega_0=0$. But unlike in the case of $\omega_0=F=0$, the summation over $n$ involved in this FT series cannot be performed to obtain a result in closed form. \subsubsection{Limit case $\omega_0=0$ and $F\rightarrow 0$}\label{sec:LOMOF} \begin{figure}[h] \centering \includegraphics[width=0.75\linewidth]{FIGXYZ.eps} \caption[T1] {The periodic solution of the equation of motion (\ref{FG1a}) - (\ref{FG1a}) with the values of the parameters $F=1/4,\; G=\omega=1,\; \omega_0=0$ according to numerical integration (blue curve) and analytical approximation (\ref{LOMO1a}), (\ref{LOMO5}) and (\ref{LOMO1c}) (dashed red curve). The green curve represents the ellipse in the $y-z$-plane swept by the magnetic field vector. } \label{FIGXYZ} \end{figure} We can only get a result for ``almost linear" polarization, i.~e., in the lowest linear order of $F$. To achieve this result we first note that for $\omega_0=0$ the functions $X(t)$ and $Z(t)$ will be even functions of $F$ and $Y(t)$ will be an odd one. This is compatible with the above-mentioned fact that ${\sf Y}(t)$ vanishes for $F=0$ and can be shown by induction over $n$ using the recurrence relations (\ref{FL4a}) - (\ref{FL4c}). It follows that the linear part $Y_1(t)$ of $Y(t)=Y_1(t)\, F + Y_3(t)\,F^3+\ldots$ can be obtained by applying the recurrence relation $(\ref{FL4b})$ that reduces to \begin{eqnarray}\label{LOMO3a} S_{n,m}&=&\frac{F}{2 ((2 m+1) \omega )}\left( R_{n,m+1}-R_{n,m}\right)\\ \label{LOMO3b} &\stackrel{(\ref{LOMO2})}{=}& \frac{F g^{2 n}}{2 ((2 m+1) \omega )}\left( \left[\frac{2 J_{2( m+1)}(g)}{J_0(g)} \right]_{2n} -\left[\frac{2 J_{2 m}(g)}{J_0(g)} \right]_{2n}\right) \;. \end{eqnarray} Now we can perform the sum over $n=0,\ldots,\infty$ without any problems: \begin{eqnarray} \label{LOMO4a} \sum_{n=0}^{\infty}S_{n,m} &=& \sum_{n=0}^{\infty}\frac{F g^{2 n}}{2 ((2 m+1) \omega )}\left( \left[\frac{2 J_{2 (m+1)}(g)}{J_0(g)} \right]_{2n} -\left[\frac{2 J_{2 m}(g)}{J_0(g)} \right]_{2n}\right) \\ &=& \frac{F (J_{2 (m+1)}(g)-J_{2 m}(g))}{(1+2 m) \omega J_0(g)} \;, \end{eqnarray} which, finally, yields \begin{equation}\label{LOMO5} Y(t)=Y_1(t)F+O(F^3)= \frac{F}{\omega}\,\sum_{m=0}^{\infty}\frac{J_{2 (m+1)}(g)-J_{2 m}(g)}{(1+2 m)}\,\cos (2m+1)\omega t +O(F^3) \;, \end{equation} where we have multiplied the result by $ J_0(g)$ in order to obtain a normalized solution. The analytical approximation given by (\ref{LOMO1a}), (\ref{LOMO5}) and (\ref{LOMO1c}) is surprisingly of good quality even for relative large values of, say, $\frac{F}{G}\sim 1/4$, see Figure \ref{FIGXYZ}. \subsubsection{Limit case $\omega_0=0$ and $F\rightarrow G$}\label{sec:LOMOC} \begin{figure}[h] \centering \includegraphics[width=0.75\linewidth]{FIGC1.eps} \caption[T1] {The periodic solution of the equation of motion (\ref{FG1a}) - (\ref{FG1a}) with the values of the parameters $F=1,\; G=3/4,\;\omega=1,\; \omega_0=0$ according to numerical integration (blue curve) and (normalized) analytical approximations (\ref{LOMOC6a}) - (\ref{LOMOC6c}) (dashed red curve). The green curve represents the ellipse in the $y-z$-plane swept by the magnetic field vector. } \label{FIGC1} \end{figure} The Rabi problem with circular polarization ($F=G$) has two simple periodic (not yet normalized) solutions of (\ref{FG1a}) - (\ref{FG1c}), namely \begin{equation}\label{LOMOC1} \left( \begin{array}{c} X(t) \\ Y(t) \\ Z(t) \end{array} \right)= \pm \left( \begin{array}{c} \omega-\omega_0 \\ - F \cos\omega t \\ - F \sin\omega t \end{array} \right) \;, \end{equation} see, e.~g., \cite{S18}, eq.~(69). Let us consider the special solution for $\omega_0=0$ \begin{equation}\label{LOMOC2} \left( \begin{array}{c} X_c(t) \\ Y_c(t) \\ Z_c(t) \end{array} \right)= \left( \begin{array}{c} 1 \\ - \frac{F}{\omega} \cos\omega t \\ - \frac{F}{\omega} \sin\omega t \end{array} \right) \;, \end{equation} and look for corrections in linear order of the parameter $\delta$ describing eccentricity, namely \begin{equation}\label{LOMOC3} \delta\equiv F-G \;. \end{equation} To this end we insert $\omega_0=0$ and $G=F-\delta$ into the FT series solution (\ref{FL2a}) - (\ref{FL2c}) and expand the FT series coefficients up to terms linear in $\delta$. The $\delta=0$ parts of the coefficients satisfy \begin{eqnarray} \label{LOMOC4a} R_{0,0} &=& 1\;, \\ \label{LOMOC4b} S_{0,0} &=& -\frac{F}{\omega}\;, \\ \label{LOMOC4c} T_{0,0} &=& -\frac{F}{\omega}\;, \end{eqnarray} in accordance with (\ref{LOMOC2}). The $\delta$-linear parts are given by \begin{eqnarray} \label{LOMOC5a} R_{n,1} &=& -\frac{3^{1-n}}{2}\frac{F^{2 n-1}}{ \omega ^{2 n}}\,\delta,\quad\mbox{for }n=1,2,\ldots\;, \\ \label{LOMOC5b} S_{n,0} &=&-\frac{3^{1-n}}{4}\frac{F^{2 n}}{ \omega ^{2 n-1}}\,\delta,\quad\mbox{for }n=1,2,\ldots\;, \\ \label{LOMOC5c} T_{0,0} &=&\frac{\delta}{\omega}\;, \\ \label{LOMOC5d} T_{n,0} &=&\frac{3^{1-n}}{4}\frac{F^{2 n}}{ \omega ^{2 n+1}}\,\delta,\quad\mbox{for }n=1,2,\ldots\;, \\ \label{LOMOC5e} S_{n,1} &=&\frac{3^{-n}}{4}\frac{F^{2 n}}{ \omega ^{2 n+1}}\,\delta,\quad\mbox{for }n=1,2,\ldots\;. \end{eqnarray} It is straightforward to perform the summations over $n$ and to insert the results into (\ref{FL2a}) - (\ref{FL2c}) thus obtaining the analytical approximations \begin{eqnarray} \label{LOMOC6a} X_a(t) &=&1+\frac{3 \delta F }{2 \left(F^2-3 \omega ^2\right)}\cos (2 \omega t )\;, \\ \label{LOMOC6b} Y_a(t) &=& \left(-\frac{F}{\omega }+\frac{3 \delta F^2}{4 \omega \left(F^2-3 \omega ^2\right)}\right) \cos (\omega t )-\frac{\delta F^2 } {4 \omega \left(F^2-3 \omega ^2\right)}\cos (3 \omega t)\;,\\ \label{LOMOC6c} Z_a(t) &=& \left(-\frac{F}{\omega }+\frac{\delta}{F} \left(\frac{1}{\omega }-\frac{3 F^2} {4 \omega (F^2- 3 \omega^2)}\right)\right) \sin (\omega t)-\frac{\delta F^2 }{4 \omega \left(F^2-3 \omega ^2\right)} \sin (3 \omega t ) \;. \end{eqnarray} The quality of these approximations is surprisingly high, see Figure \ref{FIGC1}, where a deviation between analytical approximation and numerical integration is only visible for $\delta \sim \frac{1}{4}$. \section{Application: Work performed on a two level system}\label{sec:WO} As an application of the results obtained in the preceding sections we consider the work performed on a two level system by an elliptically polarized magnetic field during one period. For a related experiment see \cite{N18}. In contrast to classical physics this work is not just a number but, following \cite{TLH07}, has to be understood in terms of two subsequent energy measurements. At the time $\tau=0$ the two level system is assumed to be in a mixed state according to the canonical ensemble \begin{equation}\label{W1} W=\exp\left(-\beta H(0)\right)/\mbox{Tr}\left(\exp\left(-\beta H(0)\right)\right) \;, \end{equation} with dimensionless inverse temperature $\beta=\frac{\hbar \,\omega}{k_B\,T}$ and \begin{equation}\label{W1a} H(0)=\frac{\nu}{2}\left( \begin{array}{cc} 0 & 1\\ 1&0 \end{array} \right) \;. \end{equation} Then at the time $\tau=0$ one performs a L\"uders measurement of the instantaneous energy $H(0)$ with the two possible outcomes $\pm\frac{\nu}{2}$. Hence after the measurement the system is in the pure state $P_1$ with probability $\mbox{Tr}\left( P_1 W\right)=\frac{1}{Z}e^{-\beta\nu/2}$ or in the pure state $P_2$ with probability $\mbox{Tr}\left( P_2 W\right)=\frac{1}{Z}e^{\beta\nu/2}$, where $P_1$ and $P_2$ are the projectors onto the eigenstates of $H(0)$, i.~e., \begin{equation}\label{W2} P_1=\frac{1}{2}\left( \begin{array}{cc} 1 & 1\\ 1&1 \end{array} \right) \;, \quad P_2=\frac{1}{2}\left( \begin{array}{rr} 1 & -1\\ -1&1 \end{array} \right) \;, \end{equation} and $Z=e^{-\beta\nu/2}+e^{\beta\nu/2}$. \begin{figure}[h] \centering \includegraphics[width=1.0\linewidth]{FIGWORK.eps} \caption[W1] {The mean value $\langle w\rangle$ of the work performed of a TLS as a function of the normalized driving frequency $\omega/\omega_0$. The left panel contains the numerical results for the fixed values $F=0.5,\,G=0.1,\,\beta=10$ and shows a prominent maximum at $\omega_\text{max}\approx 0.941843\,\omega_0$ as well as a large number of smaller maxima. The right panel is devoted to the limit of small amplitudes and contains the numerical results for $F=0.05,\,G=0.01,\,\beta=10$ (blue dots) that agree well with the analytical limit according to (\ref{W7}) (red curve). For the right panel the work is maximal at $\omega_\text{max}^{(0)}\approx 0.857295 \,\omega_0$. } \label{FIGWORK} \end{figure} After this measurement the system evolves according to the Schr\"odinger equation (\ref{SE1}) with Hamiltonian $H(\tau)$. At the time $\tau=2\pi$ the system hence is in the pure state $U(2\pi,0)\,P_1\, U(2\pi,0)^\ast$ with probability $\mbox{Tr}\left( P_1 W\right)$ or in the pure state $U(2\pi,0)\,P_2\, U(2\pi,0)^\ast$ with probability $\mbox{Tr}\left( P_2 W\right)$. Then a second measurement of the instantaneous energy $H(2\pi)=H(0)$ is performed, again with the two possible outcomes $\pm \frac{\nu}{2}$. Both measurements together have four possible outcomes symbolized by pairs $(i,j)$ where $i,j=1,2$ that occur with probabilities \begin{equation}\label{W3} p_{i,j}=\mbox{Tr}\left(W\,P_i\right) \mbox{Tr}\left(P_j\,U(2\pi,0)\,P_i\, U(2\pi,0)^\ast\right) \;, \end{equation} such that $\sum_{i,j=1}^{2}p_{i,j}=1$. The differences of the outcomes of the energy measurements yield three possible values $w=\pm \nu,\,0$ for the work performed on the system with respective probabilities that can be calculated by using the monodromy matrix (\ref{QQ1}). The result is identical to that obtained for the case of linear polarization in \cite{SSH20a} since it depends only on the parameters $\alpha, r$ of the monodromy matrix. Using the above probabilities it is straightforward to calculate the mean value of the performed work \begin{equation}\label{W5} \left\langle w\right\rangle =\omega_0\left( p_{2,1}-p_{1,2}\right)= 4\,\omega_0 r^2 \left(1-r^2\right) \sin ^2\alpha \tanh \left(\frac{\beta \nu }{2}\right)\ge 0 \;, \end{equation} see \cite{SSH20a}, eq.~(55). A detailed investigation of the work statistics is beyond the scope of the present article. We will only give an example of the frequency dependence of $\left\langle w\right\rangle$ that exhibits resonance phenomena similar to those mentioned in Section \ref{sec:RES}, see Figure \ref{FIGWORK}.\\ However, a clear difference to the situation dealt with in Section \ref{sec:RES} is that for small amplitudes the frequency $\omega_\text{max}$ where $\left\langle w\right\rangle$ is maximal does not approach the eigenfrequency $\omega_0$ of the TLS but some other limit $\omega_\text{max}^{(0)}$ in the interval \begin{equation}\label{W6} 0.8\,\omega_0 < \omega_\text{max}^{(0)} < 0.9\, \omega_0 \;, \end{equation} depending on the eccentricity of the elliptic polarization. The small amplitude limit $\left\langle w\right\rangle^{(0)}$ of $\left\langle w\right\rangle$ can be calculated by using the lowest order approximation derived in Section \ref{sec:FG} and reads: \begin{equation}\label{W7} \left\langle w\right\rangle^{(0)}=\frac{4\,\omega _0}{\left(\omega ^2-\omega _0^2\right)^2}\, \sin ^2\left(\frac{\pi \omega _0}{\omega }\right) \tanh \left(\frac{\beta \nu }{2}\right) \left(F \omega +G \omega _0\right)^2 \;, \end{equation} see Figure \ref{FIGWORK} for an example. \section{Summary and Outlook}\label{sec:SO} The time evolution of the two level system (TLS) subject to a monochromatic, circularly polarized external field (RPC) can be solved in terms of elementary functions, and the analogous problem with linear polarization (RPL) leads to the confluent Heun functions. However, these two problems are only limit cases of the general Rabi problem with elliptical polarization (RPE), and it is a natural question to look for a solution of the latter valid in the realm where the rotating wave approximation breaks down. This is done in the present paper by performing the following steps: \begin{enumerate} \item Reduction to the classical RPE, \item reduction of the classical time evolution to the first quarter period, \item transformation of the classical equation of motion to two $3^{rd}$ order differential equations, and \item solution of the latter by power series. \end{enumerate} This strategy has been checked by comparison with the numerical integration of the equations of motion for an example. Moreover, we have calculated the various Fourier series of the components of the periodic solution and the corresponding quantum or classical Floquet exponent (or quasienergy). Further, we have obtained the first terms of the power series for the resonance frequencies w.~r.~t.~the semi-axes $F$ and $G$ of the polarization ellipse. The latter were checked by comparison with the partially known results in the circular ($F=G$) and in the linear polarization limit ($G=0$). This kind of result could not be obtained by a pure numerical treatment of RPE and thus justifies our analytical approach. Analogous remarks apply to the problem of how much work is performed on a two level system by the driving field. For a first overview numerical methods are sufficient, see Figure \ref{FIGWORK}, but analytical methods yield more detailed results, e.~g., for the small amplitude limit, see Section \ref{sec:WO}. Other limit cases that can be discussed without recourse to the $3^{rd}$ order differential equation are the adiabatic limit ($\omega\rightarrow 0$), the small amplitude limit ($F,G \rightarrow 0$) and the limit of vanishing energy splitting of the TLS ($\omega_0\rightarrow 0$). In the latter case it turns out that the exact solution of the special case $\omega_0=F=0$ cannot be transferred to the elliptical domain except for the limit cases $F\rightarrow 0$ and $F\rightarrow G$. Moreover, we have checked some general statements on the Rabi problem \cite{S18} like the slope relation (\ref{QIIIslope}) using our analytical approximations for some of these limit cases as well as the power series solutions mentioned above. It appears that this completes the set of problems related to the RPE that can be addressed with the present methods, with one exception: In principle, it would also be possible to solve the underlying $s=1/2$ Schr\"odinger equation directly by a transformation into a third-order differential equation. However, we have omitted this topic, firstly because of lack of space, and secondly because it is not clear which new results would follow from the direct solution. \section*{Acknowledgment} I am indebted to the members of the DFG research group FOR 2692 for continuous support and encouragement, especially to Martin Holthaus and J\"urgen Schnack. Moreover, I gratefully acknowledge discussions with Thomas Br\"ocker on the subject of this paper.
\section{Introduction} \label{sec:intro} The era of analytics \cite{Tukey62}, data science \cite{Tukey77}, and big data \cite{Mckinsey11} has driven substantial governmental, industrial, and disciplinary interest, goal and strategy transformation as well as a paradigm shift in research and innovation. This has resulted in significant new opportunities and prospects becoming available which were not previously possible, while an increasing and overwhelming amount of fanfare and hype has spread across multiple domains, areas and events. In reviewing the related initiatives, progress, and status of data science, analytics and big data \cite{cao16-2}, and the diversified discussions about prospects, challenges and directions \cite{Cao16ds}, the controversy caused by the potential conflict of these various elements becomes clear. This review discloses the need for deep discussions about the nature and pitfalls of data science, the clarification of fundamental concepts and myths, and the demonstration of the intrinsic characteristics and opportunities of data science. This paper thus focuses on discussing the two fundamental issues in data science: the nature and the pitfalls of data science. Addressing the first highlights the status, intrinsic factors, characteristics, and features of the era of data science and analytics, as well as the challenges and opportunities for new generation innovation, research and disciplinary development. The second summarizes common pitfalls about the concepts of data science, data volume, infrastructure, analytics, and capabilities and roles. Building on the above discussions, the concepts and possible future directions of data science are then presented. \section{Features of the Data Science Era} \label{sec:features} Drawing a picture of the features and characteristics of the era of data science is critical and challenging. We explore this from the perspective of the transformation and paradigm shift caused by data science, and discuss the core driving forces, as well as the status of a number of typical issues confronting the data science field. \subsection{The Era's Transformation and Paradigm Shift} \label{subsec:transformation} The emergence of the era of data science and analytics can be highlighted by three key indicators: a significant \textit{disciplinary paradigm shift}, \textit{technological transformation}, and \textit{innovative production}. \begin{itemize} \item Disciplinary paradigm shifting: The shifting of data-centric disciplinary paradigms from one to another. \item Technological transformation: The upgrading of data technology from one generation to another. \item Innovative production: The innovation of technical and practical data products. \end{itemize} These are discussed below. The disciplinary paradigm shift of data-oriented and data-centric research, innovation and profession can be embodied by such aspects as: \begin{itemize} \item From data analysis to data analytics; \item From descriptive analytics to deep analytics; \item From data analytics to data science; \end{itemize} The disciplinary paradigm shift promotes data-related technological transformation by such means as follows: \begin{itemize} \item From large-scale data to big data; \item From business operational systems to business analytical systems; \item From World Wide Web to Wisdom web; \item From Internet to Internet of Everything (incl. Internet of Things, mobile network, social network); \end{itemize} Innovative production in the data and analytics areas can be represented by typical indicators such as the following: \begin{itemize} \item From digital economy to data economy; \item From closed government to open government; \item From e-commerce to online business; \item From telephone to smart phone; \item From Internet to mobile and social network. \end{itemize} \subsection{Data-centric Driving Forces} \label{subsec:drivers} The transformation and paradigm shift of data-oriented discipline, technologies and production are driven by core forces including data-enabled opportunities, data-related ubiquitous factors, and various complexities and intelligences embedded in data-oriented production and products. Ubiquitous data-oriented factors include data, behavior, complexity, intelligence, service, and opportunities. \begin{itemize} \item Data is ubiquitous: Involving historical, real-time and future data; \item Behavior is ubiquitous: Bridging the gaps between the physical world and the data world; \item Complexity is ubiquitous: The types and extent of complexity differentiate one data system from another; \item Intelligence is ubiquitous: Diversified intelligences are embedded in a data system; \item Service is ubiquitous: Data services present in various forms and domains; \item Opportunities are ubiquitous: Data enables enormous opportunities. \end{itemize} Data-enabled opportunities, also called \textit{X-opportunities}, are overwhelming and extend from research, innovation, education, and government to economy. We briefly elaborate on them below. \begin{itemize} \item Research opportunities: Inventing data-focused breakthrough theories and technologies; \item Innovation opportunities: Developing data-based cutting-edge services, systems and tools; \item Education opportunities: Innovating data-oriented courses and training; \item Government opportunities: Enabling data-driven government decision-making and objectives; \item Economic opportunities: Fostering data economy, services, and industrialization; \item Lifestyle opportunities: Promoting data-enabled smarter living and smarter cities; \item Entertainment opportunities: Creating data-driven entertainment activities, networks, and societies. \end{itemize} A data science problem is a complex system \cite{Mitchel2011,Metasynthetic15} in which comprehensive system complexities, also called \textit{X-complexities} \cite{Cao16ds}, are embedded. These comprise complexities of data characteristics, behavior, domain, society (social complexity), environment, learning, and decision-making. \begin{itemize} \item Data complexity: Embodied by such factors as comprehensive data circumstances and characteristics; \item Behavior complexity: Demonstrated by such aspects as individual and group activities, evolution, utility, impact and change; \item Domain complexity: Represented by such aspects as domain factors, processes, norms, policies, knowledge and domain expert engagement in problem-solving; \item Social complexity: Indicated by such aspects as social networking, community formation and divergence, sentiment, the dissemination of opinion and influence, and other social issues such as trust and security; \item Environment complexity: Capturing such aspects as contextual factors, interactions with systems, changes, and uncertainty. \item Learning complexity: Including the development of appropriate methodologies, frameworks, processes, models and algorithms, and theoretical foundation and explanation; \item Decision complexity: Involving such issues as the methods and forms of deliverables, communications and decision-making actions. \end{itemize} In a complex data science problem, ubiquitous intelligence, also called \textit{X-intelligence} \cite{Cao16ds}, is often demonstrated and has to be incorporated and synergized \cite{Metasynthetic15} in problem-solving processes and systems. \begin{itemize} \item Data intelligence: Highlighting the interesting information, insights and stories hidden in data about business problems and driving forces. \item Behavior intelligence: Demonstrating the insights of activities, processes, dynamics, impact and trust of individual and group behaviors by human and action-oriented organisms. \item Domain intelligence: Domain values and insights emerge from involving domain factors, knowledge, meta-knowledge, and other domain-specific resources. \item Human intelligence: Contributions made by the empirical knowledge, beliefs, intentions, expectations, critical thinking and imaginary thinking of human individual and group actors. \item Network intelligence: Intelligence created by the involvement of networks, web, and networking mechanisms in problem comprehension and problem-solving. \item Organizational intelligence: Insights and contributions created by the involvement of organization-oriented factors, resources, competency and capabilities, maturity, evaluation and dynamics. \item Social intelligence: Contributions and values generated by the inclusion of social, cultural, and economic factors, norms and regulation. \item Environmental intelligence: This may be embodied through other intelligences specific to the underlying domain, organization, society, and actors. \end{itemize} The above data-oriented and data-driven factors, complexities, intelligences and opportunities constitute the nature and characteristics of data science, and drive the evolution and dynamics of data science problems. \subsection{Data DNA} \label{subsec:dna} In the biological domain, DNA is a molecule that carries genetic instructions that are uniquely valuable to the biological development, functioning and reproduction of humans and all known living organisms. As a result of data quantification, data is everywhere, and is present in the public Internet, Internet of Things, sensor networks, socio-cultural, economic and geographical repositories and quantified personalized sensors, including mobile, social, living, entertaining and emotional sources. This forms the ``datalogical'' constituent: ``data DNA'', which plays a critical role in data organisms and performs a similar function to biological DNA in living organisms. \begin{definition}[Data DNA] \emph{Data DNA} is the datalogical ``molecule'' of data, consisting of fundamental and generic constituents: entity (E), property (P) and relationship (R). Here ``datalogical'' means that data DNA plays a similar role in data organisms as biological DNA plays in living organisms. \emph{Entity} can be an object, an instance, a human, an organization, a system, or a part of a sub-system of a system. \emph{Property} refers to the attributes that describe an entity. \emph{Relationship} corresponds to (1) entity interactions, and (2) property interactions, including property value interactions. \end{definition} Entity, property and relationship present different characteristics in terms of quantity, type, hierarchy, structure, distribution and organization. A data-intensive application or system is often composed of a large number of diverse entities, each of which has specific properties, and different relationships are embedded within and between properties and entities. From the very lowest level to the very highest level, data DNA presents heterogeneity and hierarchical couplings across levels. On each level, it maintains \textit{consistency} (inheritance of properties and relationships) as well as \textit{variations} (mutations) across entities, properties and relationships, while \textit{personalized characteristics} are supported for each individual entity, property and relationship. For a given data, its entities, properties and relationships are instantiated into diverse and domain-specific forms, which carry most of the data ecological and genetic information in data generation, development, functioning, reproduction, and evolution. In the data world, \emph{data DNA} is embedded in the whole body of personal \cite{personaldata11} and non-personal data organisms, and in the generation, development, functioning, management, analysis and use of all data-based applications and systems. Data DNA drives the evolution of a data-intensive organism. For example, university data DNA connects the data of students, lecturers, administrative systems, corporate services and operations. The student data DNA further consists of academic, pathway, library access, online access, social media, mobile service, GPS, and Wifi usage data. Such student data DNA is both steady and evolving. In complex data, data DNA is embedded within various X-complexities (see detailed discussions in \cite{Cao16ds} and \cite{Metasynthetic15}) and ubiquitous X-intelligence (more details in \cite{Cao16ds} and \cite{Metasynthetic15}) in a data organism. This makes data rich in content, characteristics, semantics and value, but challenging in acquisition, preparation, presentation, analysis and interpretation. \subsection{Data Quality} \label{subsec:quality} Data science tasks involve roles and follow processes different from more generalized IT projects, since data science and analytics works tend to be creative, intelligent, exploratory, non-standard, unautomated and personalized, and have the objective of discovering evidence and indicators for decision-making actions. They inevitably involve quality issues such as data validity, veracity, variability and reliability, and social issues such as privacy, security, accountability and trust, which need to be taken into account in data science and analytics. \textit{Data quality} is a critical problem in data science and engineering. Given a data science problem, we should not assume that \begin{itemize} \item The data available or given is perfect, \item The data always generates good outcomes, \item The outputs (findings) generated are always good and meaningful, and \item The outcomes can always inform better decisions. \end{itemize} These assumption myths involve the quality of the data (input), the model, and the outcomes (output), in particular, validity, veracity, variability and reliability. We briefly discuss these aspects below. Data and analytics \emph{validity} determines whether a data model, concept, conclusion or measurement is well-founded and corresponds accurately to the data characteristics and real-world facts, making it capable of giving the right answer. Similarly, data and analytics \emph{veracity} determines the correctness and accuracy of data and analytics outcomes. Both validity and veracity also need to be checked from the perspectives of data content, representation, design, modeling, experiments, and evaluation. Data and analytics \emph{variability} is determined by the changing and uncertain nature of data, reflecting business dynamics (including the problem context and problem-solving purposes), and thus requires the corresponding analytics to adapt to the dynamic nature of the data. Due to the changing nature of data, the need to check the validity, veracity and reliability of the data used and analytics undertaken is thus highly important. Data and analytics \emph{reliability} refers to the consistency, redundancy, repeatability and trust properties of the data used, the analytic models generated, and the outcomes delivered on the data. Reliable data and analytics are not necessarily static. Making data analytics adaptive to the evolving, streaming and dynamic nature of data, business and decision requests is a critical challenge in data science and analytics. \begin{figure*}[ht!] \centerline{\includegraphics[width=0.65\textwidth]{extreme-data-challenges.2.eps}} \caption{The extreme data challenge.} \label{fig:five} \end{figure*} \subsection{Social Issues} \label{subsec:socialissues} Domain-specific data and business are embedded in social contexts and incorporated with social issues. Data science tasks typically involve such social issues as \textit{privacy}, \textit{security}, \textit{accountability} and \textit{trust} on data, modeling and deliverables, which we discuss below. Data and analytics \emph{privacy} addresses the challenge of collecting, analyzing, disseminating and sharing data and analytics while protecting personally identifiable or other sensitive information and analytics from improper disclosure. Protection technology, regulation and policies are required to balance protection and appropriate disclosure in the process of data manipulation. Data and analytics \emph{security} protects target objects from destructive forces and from the unwanted actions of unauthorized users, including improper use or disclosure, and not only addresses privacy issues but also other aspects beyond privacy, such as software and hardware backup and recovery. Data and analytics security also involves the development of regulating, political or legal mechanisms and systems to address such issues. Data and analytics \emph{accountability} refers to an obligation to comply with data privacy and security legislation, and to report, explain, trace and identify the data manipulated and analytics conducted to maintain the transparency and traceability, liability and warranty of both measurement and results, as well as the efficacy and verifiability of analytics and protection. Data and analytics \emph{trust} refers to the belief in the reliability, truth or ability of data and analytics to achieve the relevant goals. This involves the development of appropriate technology, social norms, ethical rules, or legislation to ensure, measure and protect trust in the data and analytics used and confidence in the corresponding outcomes and evaluation of analytics. \subsection{The Extreme Challenge} \label{subsec:extrechallenge} Different types and levels of analytical problems trouble the existing knowledge base, and we are especially challenged by the complex problems in complex data and in complex environments. Our particular focus on data science research and innovation concerns the type of scenario we call an \emph{extreme data challenge} in data science and analytics. The \emph{extreme data challenge as illustrated in Fig. \ref{fig:five}, seeks to discover and deliver complex knowledge in complex data taking into account complex behavior within a complex environment to achieve actionable insights that will inform and enable decision action-taking in complex business problems} that cannot be better handled by other methods. The critical future directions of data science research and innovation in this case are focused on \begin{itemize} \item \textit{Complex data} with complex characteristics and various complexities (as discussed above on data complexity and intelligence; for more, see \cite{Cao16ds} and \cite{Metasynthetic15}), \item \textit{Complex behaviors} with complex relationships and dynamics (as discussed above on behavior complexity and intelligence; for more, see \cite{Cao16ds} and \cite{Metasynthetic15}), \item \textit{Complex environment} in which complex data and behaviors are embedded and interacted with (as discussed above on domain-specific, organizational, social and environmental complexities and intelligence; for more, see \cite{Cao16ds} and \cite{Metasynthetic15}), \item \textit{Complex models} to address the data and behavior complexities in complex environment (as discussed about learning complexities and decision complexities), \item \textit{Complex findings} to uncover hidden but technically interesting and business-friendly observations, indicators or evidence, statements or presentations, and \item \textit{Actionable insights} to evidence the next best or worst situation and inform the optimal strategies that should be taken to support effective business decision-making (see more discussion on actionability in \cite{Cao10dddm,dddm10}. \end{itemize} Many real-life problems fall into this level of complexities and challenges, as shown in the extreme data challenge, and they have not been addressed well; for example, \begin{itemize} \item Understanding group behaviors by multiple actors where there are complex interactions and relationships, such as in the manipulation of large-scale cross-capital markets pool by internationally collaborative investors \cite{Cao2012cba}, each of whom plays a specific role by connecting information from the underlying markets, social media, other financial markets, socio-economic data and policies \cite{noniid14}; \item Predicting local climate change and effect by connecting local, regional and global climate data, geographical data, agricultural data and other information \cite{Faghmous14}. \end{itemize} \section{Disciplinary Development of Data Science} \label{sec:opp} In this section, we present a status summary of the disciplinary development of data science by reviewing the development gaps between the potential that data may have and the state-of-the-art capabilities to fulfill such potential, the research map of data science, and the course framework of data science. \subsection{Data-to-Capability Development Gaps} \label{subsec:gaps} The rapid increase in big data unfortunately does not only present opportunities. As discussed in \cite{Cao10dddm} and \cite{dddm10}, there are significant gaps between what we are of and what we are capable of understanding. An empirical observation of the \emph{data development gaps} between (1) the growth of \textit{data potentials} and (2) the \textit{state-of-the-art capabilities} is shown in Fig. \ref{fig:four}. Such gaps have increased in the last 10 years and especially recently, due to the imbalance between potential exponential increase and progressive state-of-the-art capability development. We illustrate several such gaps below. \begin{itemize} \item Gap between data availability and currently understandable data level, scale and degree; \item Gap between data complexities and currently available analytics theories and tools; \item Gap between data complexities and currently available technical capabilities; \item Gap between possible values and impact and currently achievable outcomes and benefits; \item Gap between organizational needs and currently available talents/data scientists; \item Gap between potential opportunities and current outcomes and benefits achievable. \end{itemize} Such growth gaps are driven by critical challenges for which there is a shortage of effective theories and tools. For example, a typical challenge in complex data concerns intrinsic complex coupling relationships and heterogeneity, forming non-IID data \cite{noniid14}, which cannot be simplified in such a way that they can be handled by classic IID learning theories and systems. Other examples include the real-time learning of large-scale online data, such as learning shopping manipulation and making real-time recommendations on extremely high frequency data in the ``11-11'' shopping seasons launched by Alibaba, or identifying suspects in an extremely imbalanced and multi-source data and environment such as fraud detection in high frequency marketing trading. Other challenges are high invisibility, high frequency, high uncertainty, high dimensionality, dynamic nature, mixed sources, online learning at the web scale, and developing human-like thinking. \begin{figure*}[ht!] \centerline{\includegraphics[width=0.85\textwidth]{gap-complexity-capability.4.c.eps}} \caption{Critical development gaps between data potentials and state-of-the-art capabilities.} \label{fig:four} \end{figure*} \subsection{Research Map of Data Science} \label{subsec:advanalytics} The way to explore the fundamental challenges and innovative opportunities facing big data and data science is to conduct problem-, data-, and goal-driven discovery. \begin{itemize} \item \textit{Problem-driven discovery}: This requires understanding the intrinsic nature, characteristics, complexities, and boundaries of the problem, and then analyzing the gaps between the problem complexities and the existing capability set. This gap analysis is critical for original research and breakthrough scientific discovery. \item \textit{Goal-driven discovery}: This requires understanding the business, technical and decision goals to be achieved by understanding the problem, and conducting gap analysis of what has been implemented and achieved and what is expected to be achieved. \item \textit{Data-driven discovery}: This requires understanding the data characteristics, complexities and challenges in data, and the gaps between the nature of a problem and the data capabilities. Due to the limitations of existing data systems, projection from the underlying physical world where the problem sits to the data world where the problem is datafied may be biased, dishonest, or highly manipulated. As a result, the data does not completely capture the problem and thus cannot create a full picture of of the through any type of data exploration. \end{itemize} There are two ways to explore major research challenges: one is to summarize what concerns the relevant communities, and the other is to scrutinize the potential issues arising from the intrinsic complexities and nature of data science problems as complex systems \cite{Metasynthetic15}, \cite{Metasynthetic15}. Taking the first approach, we can obtain a picture of the main research challenges by summarizing the main topics and issues in the statistics communities \cite{Chambers93}, \cite{wu97}, \cite{amstatnews15}, informatics and computing communities \cite{Rudin14}, \cite{Cao16ds}, vendors \cite{Stonebraker13}, government initiatives \cite{USNSF}, \cite{UNpulse}, \cite{CNbd}, \cite{ECbd14}, \cite{UKbd} and research institutions \cite{UTSAAI}, \cite{IAA}, which focus on data science and analytics. The second approach is much more challenging, as it requires us to explore the unknown space of the complexities and comprehensive intelligence in complex data problems. Below, we list some of the main challenges confronting the data science community in addressing the big data complexities represented by key topics in the data A-Z (see Section \ref{subsec:dataa-z}). We categorize the challenges facing domain-specific data applications and problems in terms of the following major areas: \begin{itemize} \item Challenges in data/business understanding, \item Challenges in mathematical and statistical foundations, \item Challenges in X-analytics and data/knowledge engineering, \item Challenges in data quality and social issues, \item Challenges in data value, impact and usability, \item Challenges in data-to-decision and actions. \end{itemize} X-analytics and data/knowledge engineering encompass many specific research issues that have not been addressed properly; for example: \begin{itemize} \item Behavior and event processing, \item Data storage and management systems, \item Data quality enhancement, \item Data modeling, learning and mining, \item Deep analytics, learning and discovery, \item Simulation and experimental design, \item High-performance processing and analytics, \item Analytics and computing architectures and infrastructure, \item Networking, communication and interoperation. \end{itemize} \subsection{Course Framework of Data Science} \label{subsec:courseframework} The goal of data science and analytics education is to train and generate the data and analytics knowledge and proficiency required to manage the capability and capacity gaps in the creation of a data science profession \cite{Walker15,Manieri15-1}, and to achieve the goals of data science innovation and the data economy. Accordingly, different levels of education and training are necessary, from attending public courses, corporate training, and undergraduate courses, to joining a master of data science and/or PhD in data science program. \emph{Public courses} are designed for the general community, to lift their understanding, skills, profession and specialism in data science through multi-level short courses. They range from basic courses to intermediary and advanced courses. The knowledge map consists of such components as data science, data mining, machine learning, statistics, data management, computing, programming, system analysis and design, and modules related to case studies, hands-on practices, project management, communication, and decision support. \emph{Corporate training} and workshops are customized to upgrade and foster corporate thinking, knowledge, capability and practices for entire enterprise innovation and raising productivity. This involves offering courses and workshops for the workforce, from senior corporate executives to business owners, business analysts, data modelers, data scientists, data engineers, and deployment and enterprise strategists. Such courses cover scope and topics such as data science, data engineering, analytics science, decision science, data and analytics software engineering, project management, communications, and case management. \emph{Undergraduate courses} may be offered on either a general data science basis that focuses on building data science foundations and data and analytics computing, or specific areas such as data engineering, predictive modeling, and visualization. Double degrees or majors may be offered to train professionals who will gain knowledge and abilities across disciplines such as business and analytics, or statistics and computing. \emph{Master of data science and analytics} aims to train specialists and foster the talent of those who have the capacity to conduct a deep understanding of data and undertake analytics tasks in data mining, knowledge discovery and machine learning-based advanced analytics. Interdisciplinary experts may be trained from those who have a solid foundation in statistics, business, social science or other specific disciplines and are able to integrate data-driven exploration technologies with disciplinary expertise and techniques. A critical area in which data science and analytics should be incorporated is the classic master of business administration course. This is where new generation business leaders can be trained for the new economy and a global view of economic growth. \emph{PhD in data science and analytics} aims to train high level talent and specialists who have independent thinking, leadership, research, innovation and better practices for theoretical innovation to manage the significant knowledge and capability gaps, and for substantial economic innovation and raising productivity. Interdisciplinary research is encouraged to train leaders who have a systematic and strategic understanding of the what, how and why of data and economic innovation. Fig. \ref{fig:12} shows the level, objective, capability set and outcomes of hierarchical data science and analytics education and training. \begin{figure*}[ht!] \centerline{\includegraphics[width=0.85\textwidth]{ds-course-framework.2.c.eps}} \caption{Data science course framework.} \label{fig:12} \end{figure*} \section{Data Science as A New Science} \label{sec:concepts} So, what makes data science a new science? In this section, we discuss \textit{data A-Z}, which may be used to capture every aspect of data science to form a data science ontological system, \textit{the concept of data science}, which is built on the above discussions about the features and disciplinary development of data science, and \textit{the future of data science}. \subsection{Data A-Z} \label{subsec:dataa-z} In the big data community, multiple Vs are typically used to describe what constitutes big data, i.e., the characteristics, challenges and opportunities of big data. They include the volume (size), velocity (speed), variety (diversity), veracity (quality and trust), value (insight), visualization, and variability (formality) of data. In fact, these big Vs cannot describe a complete picture of big data, and cannot capture the field of data science. Therefore, it is very valuable to build a \emph{data A-Z dictionary} to represent and capture the intrinsic comprehensive but diverse aspects, characteristics, challenges, domains, tasks, processes, purposes, applications and outcomes of, or related to, data. To this end, we list a sample sequence of data science keywords: \begin{eqnarray} Actionability/Adaptation, Behavior/Boosting, \nonumber \\ Causality/Change, Dimensionality/Divergence, \nonumber \\ Embedding/Ethics, Fusion/Forecasting, \nonumber \\ Governance/Generalization, Heterogeneity/ \nonumber \\ Hashing, Integrity/Inference, Join/Jungle, \nonumber \\ Kernelization/Knowledge, Linkage/Learning, \nonumber \\ Metrology/Migration, Normalization/Novelty, \nonumber \\ Optimization/Outlier, Privacy/Provenance, \nonumber \\ Quality/Quantity, Relation/Regularization, \nonumber \\ Scalability/Sparsity, Transformation/Transfer, \nonumber \\ Utility/Uncertainty, Variation/Visibility, \nonumber \\ Wrangling/Weighting, X-analytics/ \nonumber \\ X-informatics, Yield/Yipit, Zettabyte/Zenit. \end{eqnarray} It is notable that such a data A-Z ontology probably covers most of the topics of interest to major data science communities. The exercise of constructing data A-Z can substantially deepen and broaden the understanding of intrinsic data characteristics, complexities, challenges, prospects and opportunities \cite{Geczy14}. \subsection{What Is Data Science} \label{subsec:ds} Generally speaking, \textit{data science is the science of data}, which concerns the study of data. There are different ways to define what data science is: it may be object-focused, process-based, and/or discipline-oriented \cite{Cao16ds}. \begin{definition}[Data Science] From the \textit{process} perspective, data science is a systematic approach to `think with wisdom', `understand domain', `manage data', `compute with data', `mine on knowledge', `communicate with stakeholders', `deliver products', and `act on insights'. \end{definition} A \textit{process-based data science formula} is accordingly given below: \begin{eqnarray} data~science = think + understand + manage + \nonumber \\ compute + mine + communicate + deliver + act \end{eqnarray} In contrast, \textit{data analytics understands data and its underlying business, discovers knowledge, delivers actionable insights, and enable decision-making}. From this perspective, we can say that analytics is a keystone of data science. From the \textit{disciplinary} perspective, \textit{data science is a new interdisciplinary field} in which to study data and its domain in terms of a data-to-knowledge-to-wisdom thinking for generating data products \cite{Cao16ds}. Data science integrates \textit{traditionally data-oriented disciplines} such as statistics, informatics and computing with \textit{traditionally data-independent fields} such as communication, management and sociology. \subsection{The Future of Data Science} \label{subsec:dsfuture} It is difficult at this very early stage of data science to predict specific future data science innovation and research, thus the next-generation data science will need to address the unknown space that is currently invisible to existing science and create new data products. We will need to: \begin{itemize} \item Deepen our \textit{understanding of data invisibility} (i.e., \textit{invisible data characteristics}) in the hidden and blind spaces (Spaces B and D in Fig. 1 \cite{Cao16ds}), to understand their X-complexities (see \cite{Cao16ds}) and X-intelligence (see \cite{Cao16ds}), and strengthen our capabilities; \item Invent \textit{new data representation capabilities}, including designs, structures, schemas and algorithms to make invisible data in Spaces B and D in Fig. 1 \cite{Cao16ds} more visible and explicit; \item Create \textit{new analytical and learning capabilities}, including original theories, algorithms and models, to disclose the unknown knowledge in unknown Space D in Fig. 1 \cite{Cao16ds}; \item Build new intelligent systems and services, including corporate and Internet-based collaborative platforms and services, to support collaborative and collective exploration of invisible and unknown challenges in the fully unknown space D in Fig. 1 \cite{Cao16ds}. \item Train a generation of qualified data science professionals in data literacy, thinking, competency, consciousness and cognitive intelligence to work on the above data science agenda. \end{itemize} \section{Pitfalls in Data Science} \label{sec:pitfall} A typical feature of data science being at this very early stage is that different and sometimes contradictory views appear in various communities. It is essential to share and discuss the myths and reality \cite{Jagadish15}, memes \cite{Donoho15}, and pitfalls to ensure the healthy development of the field. Based on our observations about the relevant communities, and our experience and lessons learned in conducting data science and analytics research, education and services, we list the following myths and pitfalls for discussion. \subsection{About Data Science Concepts} \label{subsec:dsc} Typically, data science has been defined in terms of specific disciplinary foundations, principles, goals, inputs, algorithms and models, processes, tools, outputs, applications, and/or professions. Often, a fragmented statement is given, which may cause debate and result in the phenomenon of ``how does a bind person recognize an elephant?'' In this section, we discuss some common arguments and observations. \begin{itemize} \item Data science is statistics \cite{Broman13,Diggle15}; ``why do we need data science when we've had statistics for centuries'' \cite{Wladawsky14}? How does data science really differ from statistics \cite{Donoho15}? (Comments: Data science provides systematic, holistic and multi-disciplinary solutions for learning explicit and implicit insights and intelligence from complex and large-scale data and generates evidence or indicators from data by undertaking diagnostic, descriptive, predictive and/or prescriptive analytics, in addition to supporting other tasks on data such as computing and management.) \item Why do we need data science when information science and data engineering have been explored for many years? (Comments: Consider the issues faced in related areas by the enormity of the task and the parallel example of enabling a blind person to recognize an animal as large as an elephant. Information science and data engineering alone cannot achieve this. Other aspects may be learned from the discussion about greater or fewer statistics; more in \cite{Chambers93}.) \item I have been doing data analysis for dozens of years; data science has nothing new to offer me. (Comments: Classic data analysis and technologies focus mostly on explicit observation analysis and hypothesis testing on small and simpler data.) \item Is data science old wine in a new bottle? What are the new grand challenges foregrounded by data science? (Comments: The analysis of the gaps between existing developments and the potential of data science (see Fig. \ref{fig:four}) shows that many opportunities can be found to fill the theoretical gaps when data complexities extend significantly beyond the level that can be handled by the state-of-the-art theories and systems, e.g., classic statistical and analytical theories and systems were not designed to handle the non-IIDness \cite{noniid14} in complex real-life systems.) \item Data science mixes statistics, data engineering and computing, and does not contribute to breakthrough research. (Comments: Data science attracts attention because of the significant complexities in handling complex real-world data, applications and problems that cannot be addressed well by existing statistics, data engineering and computing theories and systems. This drives significant innovation and produces unique opportunities to generate breakthrough theories.) \item Data science is also referred to as data analytics and big data \cite{Anderson14}. (Comments: This confuses the main objectives, features, scopes of the three concepts and areas. Data science needs to be clearly distinguished from both data analytics and big data.) \item Other definitions ascribed to data science are that it is big data discovery \cite{Davenport12}, prediction \cite{Dhar13}, or the combination of principle and process with technique \cite{Provost13}. \end{itemize} It is also worth noting attention that the terms ``big data'', ``data science'' and ``advanced analytics'' are often extensively misused, over-used or improperly used by diverse communities and for various purposes, particularly given the influence of media hype and buzz. A large proportion of Google searches on these keywords returns results that are irrelevant to their intrinsic semantics and scope, or simply repeat familiar arguments about the needs of data science and existing phenomena. In many such findings \cite{Brown,Stanton12,Chawla14,Faris11,Anya15,Dierick15,Priebe15,Kanter15,Kirkpatrick15,Clancy14,Stevens14,Miller13, Pal15,Moraes15,Horton15,Loukides12,Neil13,Hand15,Hazena14,Manieri15-2,Cuzzocrea13,Casey15,Siart15,Gold13,Gupta15}, big data is described as being simple, data science has nothing to do with the science of data, and advanced analytics is the same as classic data analysis and information processing. There is a lack of deep thinking and exploration of why, what and how these new terms should be defined, developed and applied. The above observations strongly illustrate that data science is still in a very early stage. They also justify the urgent need to develop sound terminology, standards, a code of conduct, statement and definitions, theoretical frameworks, and better practices that will exemplify typical data science professional practices and profiles. \subsection{About Data Volume} \label{subsec:dv} \begin{itemize} \item What makes data ``big''? (Comments: It is usually not the volume but the complexities (as discussed in \cite{Cao16ds,Metasynthetic15}) and large values that make data big.) \item Why is the bigness of data important? (Comments: The bigness (referring to data science complexities) of data heralds new opportunities for theoretical, technological, practical, economic and other development or revolution.) \item Big data refers to massive volumes of data. (Comments: Here, ``big'' refers mainly to significant data complexities. From the volume perspective, a data set is big when the size of the data itself becomes a quintessential part of the problem.) \item Data science is big data analytics. (Comments: Data science is a comprehensive field centered on manipulating data complexities and extracting intelligence, in which data can be big or small and analytics is a core component and task.) \item I do not have big data so I cannot do big data research. (Comments: Most researchers and practitioners do not have sizeable amounts of data and do not have access to big infrastructure either. However, significant research opportunities still exist to create fundamentally new theories and tools to address respective X-complexities and X-intelligence.) \item The data I can find is small and too simple to be explored. (Comments: While scale is a critical issue in data science, small data, which is widely available, may still incorporate interesting data complexities that have not been well addressed. Often, we see experimental data, which is usually small, neat and clean. Observational data from real business is live, complex, large and frequently messy.) \item I am collecting data from all sources in order to conduct big data analytics. (Comments: Only relevant data is required to achieve a specific analytical goal.) \item It is better to have too much data than too little. (Comments: While more data generally tends to present more opportunities, the data amount needs to be relevant to the data needed and the data manipulation goals. Whether bigger is better depends on many aspects.) \end{itemize} \subsection{About Data Infrastructure} \label{subsec:di} \begin{itemize} \item I do not have big infrastructure, so I cannot do big data research. (Comments: While big infrastructure is useful or necessary for some big data tasks, theoretical research on significant challenges may not require big infrastructure.) \item My organization will purchase a high performance computer to support big data analytics (Comments: Many big data analytics tasks can be done without a high performance computer. It is also essential to differentiate between distributed/parallel computing and high performance computing.) \end{itemize} \subsection{About Analytics} \label{subsec:ana} \begin{itemize} \item Thinking data-analytically is crucial for data science. (Comments: Data-analytic thinking is not only important for a specific problem-solving, but is essential for obtaining a systematic solution and for a data-rich organization. Converting an organization to think data analytically is a critical competitive advantage in the data era.) \item The task of an analyst is mainly to develop common task frameworks and conduct inference \cite{Breiman01} from the particular to the general. (Comments: Analytics in the real world is often specific. Focusing on certain common task frameworks may trigger incomplete or even misleading outcomes. As discussed in Section \ref{subsec:ds}, an analyst may take other roles, e.g., predictive modeling is typically problem-specific.) \item I only trust the quality of models built in commercial analytical tools. (Comments: Such tools may produce misleading or even incorrect outcomes if the assumption of their theoretical foundation does not fit the data, e.g., if they only suit imbalanced data, normal distribution-based data, or IID data.) \item Most published models and algorithms and their experimental outcomes are not repeatable. (Comments: Such works seem to be more hand-crafted rather than manufactured. Repeatability, reproducibility, open data and data sharing are critical to the healthy field development.) \item I want to do big data analytics, can you tell me which algorithms and program language I should learn? (Comments: Public survey outcomes (see examples in \cite{cao16-2}) give responses to such questions. Which algorithms, language and platform should be chosen also depends on organizational maturity and needs. For long-term purposes, big data analytics is about building competencies rather than specific functions). \item My organization's data is private and thus you cannot be involved in our analytics. (Comments: Private data can still be explored by external parties by implementing proper privacy protection and setting up appropriate policies for onsite exploration.) \item Let me (an analyst) show you (business people) some of my findings which are statistically significant. (Comments: As domain-driven data mining \cite{dddm10} shows, many outcomes are often statistically significant but are not actionable. An evaluation of those findings needs to be conducted to discover what business impact \cite{cao08-3} might be generated if the findings they may generate are operationalized.) \item Strange, why can I not understand and interpret the outcomes? (Comments: This may be because the problem has been misstated, the model may be invalid for the data, or the data used is not relevant or correct.) \item Your outcomes are too empirical without theoretical proof and foundation. (Comments: While it would be ideal if questions about the outcomes could be addressed from theoretical, optimization and evaluation perspectives, real-life complex data analytics may often be more exploratory and it may initially be difficult to optimize empirical performance.) \item My analysis shows what you delivered is not the best for our organization. (Comments: It may be challenging to claim ``the best'' when a variety of models, workflows and data features are used in analytics. It is not unusual for analysts to obtain different or contradictory outcomes on the same data as a result of the application of different theories, settings and models. It may turn out to be a very challenging job to find a solid model that perfectly and stably fits the invisible aspect of data characteristics. It is important to appropriately check the relevance and validity of the data, models, frameworks and workflows available and used. Doing the right thing at the right time for the right purpose is a very difficult task when attempting to understand complex real-life data and problems.) \item Can your model address all of my business problems? (Comments: Different models are often are required to address diverse business problems, as a single model cannot handle a problem sufficiently well.) \item This model is very advanced with solid theoretical foundation, let us try it in your business. (Comments: While having solid scientific understanding of a model is important, it is data-driven discovery may better capture the actual data characteristics in real-life problem solving. A model may be improperly used without a deep understanding of model and data suitability. Combining data driven approaches with model driven approaches may be more practical.) \item My analytical reports consist of lots of figures and tables that summarize the data mining outcomes, but my boss seems not so interested in them. (Comments: Analytics is not just about producing meaningful analytical outcomes and reports; rather, it concerns insights, recommendations and communication with upper management for decision-making and action.) \item It is better to have advanced rather than simple models. (Comments: Generally, simpler is better. The key to deploying a model is to fit the model to the data while following the same assumption taken by the model.) \item We just tuned the models last month, but again they do not work well. (Comments: Monitoring a model's performance by watching the dynamics and significant change that may take place in the data and business is critical. Real-time analytics requires adaptive and automated re-learning and adjustment.) \item I designed the model, so I trust the outcomes. (Comments: The reproducibility of model outcomes relies on many factors. A model that is properly constructed may fall short in other aspects such as data leakage, overfitting, insufficient data cleaning, and poor understanding of data characteristics and business. Similarly, a lack of communication with the business may cause serious problems in the quality of the outcome.) \item Data science and analytics projects are just other kinds of IT projects. (Comments: While data projects share many similar aspects to mainstream IT projects, certain distinctive features in data, the manipulation process, delivery, and especially the exploratory nature of data science and analytics projects require different strategies, procedures and treatments. Data science projects are more exploratory, ad hoc, decision-oriented and intelligence-driven.) \end{itemize} \subsection{About Capabilities and Roles} \label{subsec:cap} \begin{itemize} \item I am a data scientist. (Comments: Lately, it seems that everyone has suddenly become a data scientist. Most data scientists simply conduct normal data engineering and descriptive analytics. Do not expect omnipotence from data scientists.) \item ``A human investigative journalist can look at the facts, identify what's wrong with the situation, uncover the truth, and write a story that places the facts in context. A computer can't.'' \cite{Kirkpatrick15} (Comments: The success of AlphaGo \cite{deepmind} may show the potential that a data science-enabled computer has to undertake a large proportion of the job a journalist does.) \item My organization wants to do big data analytics, can you recommend some of your PhD graduates to us? (Comments: While data science and advanced analytics tasks usually benefit from the input of PhDs, an organization requires different roles and competencies according to the maturity level of the analytics and the organization.) \item Our data science team consists of a group of data scientists. (Comments: An effective data science team may consist of statisticians, programmers, physicists, artists, social scientists, decision-makers, or even entrepreneurs.) \item A data scientist is a statistical programmer. (Comments: In addition to the core skills of coding and statistics, a data scientist needs to handle many other matters; see discussions in \cite{cao16-2}.) \end{itemize} \subsection{Other Matters} In addition to the above aspects, there are other matters that require careful consideration in conducting data science and analytics. We list some here. \begin{itemize} \item Garbage in, garbage out. (Comments: The quality of data determines the quality of output.) \item More complex data, a more advanced model, and better outcomes. (Comments: Good data does not necessarily lead to good outcomes; A good model also does not guarantee good outcomes.) \item More general models, better applicability. (Comments: General models may lead to weaker outcomes on a specific problem. It is not reasonable or practical to expect a single tool for all tasks.) \item More frequent patterns, more interesting. (Comments: It has been shown that frequent patterns mined by existing theories are generally not useful and actionable.) \item We're interested in outcomes, not theories. (Comments: Actionable outcomes may need to satisfy both technical and business significance \cite{dddm10}.) \item The goal of analytics is to support decision-making actions, not just to present outcomes about data understanding and analytical results. (Comments: This addresses the need for actionable knowledge delivery \cite{Cao10dddm} to recommend actions from data analytics for decision-support.) \item Whatever you do, you can at least get some values. (Comments: This is true, but it may be risky or misleading. Informed data manipulation and analytics requires a foundation for interpreting why the outcomes look the way they do.) \item Many end users are investing in big data infrastructure without project management. (Comments: Do not rush into data infrastructure investment without a solid strategic plan of your data science initiatives, which requires the identification of business needs and requirements, the definition of reasonable objectives, the specification of timelines, and the allocation of resources.) \item Pushing data science forward without suitable talent. (Comments: On one hand, you should not simply wait for the right candidate to come along, but should, actively plan and specify the skills needed for your organization's initiatives and assemble a team according to the skill-sets required. On the other hand, getting the right people on board is critical, as data science is essentially about intelligence and talent.) \item No culture for converting data science insights into actionable outcomes. (Comments: This may be common in business intelligence and technically focused teams. Fostering a data science-friendly culture requires a top-down approach driven by business needs, and making data-driven decisions that enable data science specialists and project managers to be part of the business process, and to conduct change management.) \item Correct evaluation of outcomes. (Comments: This goes far beyond such technical metrics as Area Under the ROC Curve and Normalized Mutual Information. Business performance after adopting the recommended outcomes needs to be evaluated \cite{Cao10dddm}. For example, recent work on high utility analysis \cite{yin12} and high impact behavior analysis \cite{cao08-3} study how business performance can be taken into data modeling and evaluation account. Solutions that lack business viability are not actionable.) \item Apply a model in a consistent way. (Comments: It is essential to understand the hypothesis behind a model and to apply a model consistent with its hypothesis.) \item Overthinking and overusing models. (Comments: All models and methods are specific to certain hypotheses and scenarios. No models are universal and sufficiently ``advanced'' to suit everything. Do not assume that if the data is tortured long enough, it will confess to anything.) \item Know nothing about the data before applying a model. (Comments: Data understanding is a must-do step before a model is applied.) \item Analyze data for the sake of analysis only. (Comments: This involves the common bad practice of overusing analytics.) \item What makes an insight (knowledge) actionable? (Comments: This is dependent on not only the statistical and practical values of the insight, but also predictive power and business impact.) \item Do not assume the data you are given is perfect. (Comments: Data quality forms the basis of obtaining good models, outcomes and decisions. Poor quality data, the same as poor quality models, can lead to misleading or damaging decisions. Real-life data often contains imperfect features such as incompleteness, uncertainty, bias, rareness, imbalance and non-IIDness.) \end{itemize} \section{Conclusions} \label{sec:concl} In the era of data science, big data and advanced analytics, numerous debates have emerged from a wide range of backgrounds, domains, areas and perspectives and for diversified reasons and purposes. It is difficult but critical to explore the nature of data science. To do so, a fundamental perspective is to explore the intrinsic characteristics, challenges, working mechanisms, and dynamics of data and the science about data. As part of our comprehensive review of data science \cite{cao16-1,cao16-2,Cao16ds}, the discussions about the nature and pitfalls of data science in this work will hopefully stimulate deep and intrinsic discussions about what makes data science a new science, and what makes data science valuable for research, innovation, the economy, services and professionals. \section*{Acknowledgment} This work is partially sponsored by the Australian Research Council Discovery Grant (DP130102691). \ifCLASSOPTIONcaptionsoff \newpage \fi \bibliographystyle{abbrv}
\section{Introduction}\label{sec:introduction} In recent years there has been a surge of research interest in developing varieties of Graph Neural Networks (GNNs) -- specialized deep learning architectures for dealing with graph-structured data, such as social networks \cite{perozzideepwalk}, recommender graphs \cite{ying2018graph}, or molecular graphs~\cite{defferrard2016,ying2018}. GNNs leverage the structure of the data as computational graph, allowing the information to propagate across the edges of graphs~\cite{scarselli2008}. When many real-wold systems are represented as graphs, they exhibit locally inhomogeneous distributions of edges, forming \emph{clusters} (also called \emph{communities} or \emph{modules}) -- groups of nodes with high in-group edge density, and relatively low out-group density. Clusters can correspond to interesting phenomena in the underlying graph, for example to education \cite{traud2011comparing} or employment \cite{papacharissi2009virtual} in social graphs. GNNs have been shown to benefit from leveraging higher-order structural information that could arise from clusters ~\cite{chen2018harp,ying2018,lee2019}, for example through pooling or trainable attention over edges~\cite{velickovic2017}. Interestingly, most existing work on GNNs to leverage higher-order structure does not directly address node partitioning or the estimation of clusters within the computational graph. Furthermore, most works explore these mechanisms only within a semi-supervised or supervised framework, ignoring the fact that \emph{unsupervised} graph clustering is often an extremely useful end-goal in itself -- whether for data exploration \cite{perozzi2018discovering}, visualization \cite{clemenccon2012hierarchical, cui2008geometry}, genomic feature discovery \cite{cabreros2016detecting}, anomaly detection \cite{perozzi2016scalable}, or for many other use-cases discussed e.g.\ in \cite{fortunato2016community}. Additionally, many of the existing structure-aware methods have undesirable properties, such as relying on a multi-step optimization process which does not allow to optimize the objective via gradient descent end-to-end \cite{perozzi2014focused}. \clearpage In this work, we take an \emph{ab initio} approach to the clustering problem in the GNN domain, bridging the gap between traditional graph clustering objectives and deep neural networks. We start by drawing a connection between graph pooling, which was typically studied in the literature as a regularizer for supervised GNN architectures, and fully unsupervised clustering. Specifically, we contribute: \vspace{-2mm} \begin{itemize}[leftmargin=0.2cm,itemindent=.3cm,labelwidth=\itemindent,labelsep=0cm,align=left,topsep=0pt,itemsep=-1ex,partopsep=0ex,parsep=1ex] \item \textsc{DMoN}\xspace, a method for unsupervised clustering in GNNs that allows optimization of cluster assignments in an end-to-end differentiable way. \item An empirical study of performance on synthetic graphs, illustrating the problems with existing work and how \textsc{DMoN}\xspace allows for improved model performance in those regimes. \item Thorough experimental evaluation on real-world data, showing that many pooling methods poorly reflect hierarchical structures and are not able to make use of both graph structure and node attributes. \end{itemize} % \section{Related Work}\label{sec:related-work} \begin{table}[!t] \small \centering{ \newcolumntype{R}{>{\raggedleft\arraybackslash}X} \newcolumntype{C}{>{\centering\arraybackslash}X} \newcolumntype{L}{>{\hsize=1.05\hsize}C} \newcolumntype{S}{>{\hsize=0.75\hsize}C} \caption{Related work in terms of six desirable clustering properties outlined in Section~\ref{sec:related-work}.} \label{tbl:related-work} \begin{tabularx}{\linewidth}{p{1cm}SSSLLS@{}} \toprule \emph{method} & Trainable & Unsupervised & Sparse & \mbox{Node pooling} & \mbox{Soft assignments} & Stable \\ \midrule Graclus~\cite{defferrard2016} & \textcolor{cycle2}{\ding{56}} & \cmark & \cmark & \cmark & \textcolor{cycle2}{\ding{56}} & \cmark \\ DiffPool~\cite{ying2018} & \cmark & \cmark & \textcolor{cycle2}{\ding{56}} & \cmark & \cmark & \textcolor{cycle2}{\ding{56}} \\ \mbox{Top-k}~\cite{gao2019} & \cmark & \textcolor{cycle2}{\ding{56}} & \textcolor{cycle2}{\ding{56}} & \textcolor{cycle2}{\ding{56}} & \textcolor{cycle2}{\ding{56}} & \cmark \\ \mbox{SAG}~\cite{lee2019} & \cmark & \textcolor{cycle2}{\ding{56}} & \textcolor{cycle2}{\ding{56}} & \textcolor{cycle2}{\ding{56}} & \textcolor{cycle2}{\ding{56}} & \cmark \\ \mbox{MinCut}~\cite{bianchi2020} & \cmark & \cmark & \cmark & \cmark & \cmark & \textcolor{cycle2}{\ding{56}} \\ \midrule \mbox{\textsc{DMoN}\xspace} & \cmark & \cmark & \cmark & \cmark & \cmark & \cmark \\ \bottomrule \end{tabularx}} \end{table} \vspace{-4mm} Our work builds upon a rich line of research on graph neural networks and graph pooling methods. \spara{Graph Neural Networks} (GNNs)~\cite{scarselli2008,duvenaud2015,niepert2016,gilmer2017,kipf2017} allow end-to-end differentable losses over data with arbitrary structure. They have been applied to an incredible range of applications, from social networks \cite{perozzideepwalk}, to recommender systems \cite{ying2018graph}, to computational chemistry~\cite{gilmer2017}. While GNNs are flexible enough to allow for unsupervised losses, most work follows the semi-supervised setting for node classification from \cite{kipf2017}. For a complete introductions to the vast topic we refer interested readers to detailed surveys~\cite{bronstein2017,hamilton2017survey,chami2020}. \spara{Unsupervised training of GNNs} is commonly done via maximizing mutual information~\cite{belghazi2018,hjelm2018,tschannen2019,song2019} in a self-supervised fashion. Deep Graph Infomax (DGI)~\cite{velickovic2018} adapted the mutual informaton-based learning from Deep InfoMax~\cite{hjelm2018}, learning unsupervised representations for nodes in attributed graphs. InfoGraph~\cite{sun2020} extended the idea to learning representations of whole graphs instead of just nodes. A very similar approach was introduced independently in~\cite{hu2020} in the context of pre-training GNNs for producing representations of graphs, which was first tackled in~\cite{navarin2018}. \spara{Graph pooling} aims to tackle the hierarchical nature of graphs via iterative coarsening. Early architectures~\cite{defferrard2016} resorted to fixed axiomatic pooling, with no optimization of clustering while the network learns. DiffPool~\cite{ying2018} suggests to include a \emph{learnable} pooling to GNN architecture. To help the convergence, DiffPool includes a link prediction loss to help encapsulate the clustering structure of graphs and an additional entropy loss % to penalize soft assignments. Top-k~\cite{gao2019} and SAG pooling~\cite{lee2019} learn to sparsify the graph (select top-k edges for each node) with learned weights. MinCutPool~\cite{bianchi2020} pooling studies differentiable formulation of spectral clustering as a pooling strategy. We summarize mainstream graph pooling methods in Table~\ref{tbl:related-work} in terms of six desirable properties related to their clustering capabilities: \vspace{-2mm} \begin{itemize}[leftmargin=0.2cm,itemindent=.3cm,labelwidth=\itemindent,labelsep=0cm,align=left,topsep=0pt,itemsep=-1ex,partopsep=0ex,parsep=1ex] \item \textbf{Trainable.} End-to-end training allows to capture both graph structure and node features. \item \textbf{Unsupervised} training is a desirable setting for clustering models. Works on \emph{supervised} graph clustering~\cite{yang2019,wang2019cvpr} are outside of the scope of this work. \item \textbf{Sparse.} As graphs in the real-world vary in size and sparsity, methods can not be limited by a $\mathcal{O}(n^2)$ link prediction objectives, like DiffPool~\cite{ying2018}, or computing $\mathbf{A}^2$, like top-k pooling methods~\cite{gao2019,lee2019} . \item \textbf{Node aggregation} is crucial for our interpretation of graph pooling in terms of graph clustering. Both Top-k~\cite{gao2019} and SAG pooling~\cite{lee2019} only sparsify the graph and do not reduce the nodeset. \item \textbf{Soft assignments} allow for more flexibility reasoning about the interactions of clusters. \item \textbf{Stable} -- the method should be stable in terms of the graph structure. DiffPool~\cite{ying2018} is not stable in terms of graph sparsity, while MinCutPool~\cite{bianchi2020} can not deal with uneven degree distribution. \end{itemize} \spara{Graph embeddings}~\cite{perozzi2014,grover2016,tsitsulin2018} can be thought of as (very restricted) unsupervised GNNs with an identity feature matrix, meaning each node learns its own positional representation~\cite{you2019}. The learning process in graph embeddings is often done in a similar way to DGI though noise contrastive estimation~\cite{gutmann2010}. As far as we know, all pooling strategies for learning node embeddings without attributes have been axiomatic~\cite{chen2018,liang2018,deng2020}. % \section{Preliminaries}\label{sec:preliminaries} We introduce the necessary background for \textsc{DMoN}\xspace{}, starting with the problem formulation, reviewing common graph clustering objectives and how they can be made differentiable efficiently. Graph $G=(V,E)$ is defined via a set of nodes $V=(v_1,\ldots,v_n), |V|=n$ and edges $ E\subseteq V\times V, |E|=m$. We are interested in measuring the quality of graph partitioning function $\mathcal{F}: n \rightarrow k$ that splits the set of nodes $V$ into $k$ partitions $V_i=\{v_j, \mathcal{F}(v_j)=i\}$. Additionally, in contrast to standard graph clustering, we are also provided with node attributes $\mathbf{X}\in\mathbb{R}^{n\times s}$ that provide additional information not reflected in the graph structure, but also correlated with it. \subsection{Graph Clustering Quality Functions}\label{ssec:modularity} Design of the objective function is crucial for the algorithm performance. We review two families of clustering quality functions amenable to spectral optimization, and review some of their shortcomings. \spara{Cut-based metrics.} In his seminal work~\cite{fiedler1973algebraic}, Fiedler suggested that the second (Fiedler) eigenvector of a graph Laplacian produces a graph \emph{cut} minimal in terms of the weight of the edges. This plain notion of cut degenerates on real-world graphs, as it does not require partitions to be balanced in terms of size. It is possible to get normalized partitions with the use of ratio cut~\cite{wei1989towards}, which normalizes the cut by the product of the number of nodes in two partitions, or normalized cut~\cite{shi2000normalized}, which uses total edge volume of the partition as normalization. In real networks, however, there is evidence \emph{against} existence of good cuts~\cite{leskovec2008statistical} in ground-truth communities. This can be explained by the fact than a single node implicitly participates in many different clusters~\cite{epasto2017ego}, e.g.\ a person in a social network is simultaneously connected with family and work friends, forcing the algorithm to merge these communities together. Recently, MinCutPool~\cite{bianchi2020} adapted the notion of the normalized cut to use as a regularizer for pooling. While, theoretically, MinCutPool objective should be suitable for clustering nodes in graphs, we (i) show that it does not optimize its own objective function and (ii) provide evidence against this in the synthetic and real-world experiments. \spara{Modularity}~\cite{newman2006} approaches the same problem from a statistical perspective, incorporating a \emph{null model} to quantify the significance of the clustering with respect to the random graph. In a fully random graph with given degrees, nodes $u$ and $v$ with degrees $d_u$ and $d_v$ are connected with probability $\nicefrac{d_ud_v}{2m}$. Modularity measures the divergence between the intra-cluster edges from the expected one: \begin{equation}\label{eq:modularity} \mathcal{Q} = \frac{1}{2m}\sum_{ij}\left[\mathbf{A}_{ij}-\frac{d_id_j}{2m}\right]\delta(c_i, c_j), \end{equation} \noindent where $\delta(c_i, c_j)=1$ if $i$ and $j$ are in the same cluster and 0 otherwise. Note $\mathcal{Q}\in(\nicefrac{-1}{2}; 1]$ (it is 0 when there is no correlation of clusters with edge density), but it is not necessarily maximized at 1, and is only comparable across graphs with the same degree distribution. While problems with the modularity metric have been identified \cite{good2010performance}, it remains one of the most commonly-used and eminently useful graph clustering metrics in scientific literature \cite{fortunato2016community}. \subsection{Spectral Modularity Maximization}\label{ssec:spectral-modularity} Maximizing the modularity is proven to be $\mathbf{NP}$-hard\xspace~\cite{brandes2006maximizing}, however, a spectral relaxation of the problem can be solved efficiently~\cite{newman2006finding}. Let $\mathbf{C}\in{0, 1}^{n\times k}$ be the cluster assignment matrix and $\mathbf{d}$ be the degree vector. Then, with \emph{modularity matrix} $\mathbf{B}$ defined as $\mathbf{B}=\mathbf{A}-\frac{\mathbf{d}\vD^\top}{2m}$, the modularity $\mathcal{Q}$ can be reformulated as: \begin{equation}\label{eq:spectral_modularity} \mathcal{Q} = \frac{1}{2m}\tr(\mathbf{C}^\top\mathbf{B}\mathbf{C}) \end{equation} Relaxing $\mathbf{C}\in\mathbb{R}^{n\times k}$, the optimal $\mathbf{C}$ maximizing $\mathcal{Q}$ is the top-k eigenvectors of the modularity matrix $\mathbf{B}$. While $\mathbf{B}$ is dense, iterative eigenvalue solvers can take advantage of the fact that $\mathbf{B}$ is a sum of a sparse $\mathbf{A}$ and rank-one matrix $-\frac{\mathbf{d}\vD^\top}{2m}$, meaning that the matrix-vector product $\mathbf{B}\mathbf{x}$ can be computed efficiently as \begin{equation*}\label{eq:modularity-matvec} \mathbf{B}\mathbf{x} = \mathbf{A}\mathbf{x} - \frac{\mathbf{d}^\top\mathbf{x}\mathbf{d}}{2m} \end{equation*} \noindent and optimized efficiently with iterative methods such as power iteration or Lanczos algorithm. One can then obtain clusters by means of spectral bisection~\cite{newman2006finding} with iterative refinement akin to Kernighan-Lin algorithm~\cite{kernighan1970efficient}. However, these formulations operate entirely on the graph structure, and it is non-trivial to adapt them to work with attributed graphs. \subsection{Graph Neural Networks}\label{sec:gnns} Graph Neural Networks are a flexible class of models that perform nonlinear feature aggregation with respect to graph structure. For the purposes of this work, we consider transductive GNNs that output a single embedding per node. Graph convolutional networks (GCNs)~\cite{kipf2017} are simple yet effective~\cite{shchur2018} message-passing networks that fit our criteria. Let $\mathbf{X}^0\in\mathbb{R}^{n\times s}$ be the initial node features and $\Tilde{\mathbf{A}} = \mathbf{D}^{-\frac{1}{2}}\mathbf{A}\mathbf{D}^{-\frac{1}{2}}$ be the normalized adjacency matrix, the output of $t$-th layer $\mathbf{X}^{t+1}$ is \begin{equation}\label{eq:gcn} \mathbf{X}^{t+1} = \mathrm{SeLU}(\Tilde{\mathbf{A}}\mathbf{X}^{t}\mathbf{W} + \mathbf{X}\mathbf{W}_{\mathrm{skip}}) \end{equation} We make two changes to the classic GCN architecture: first, we remove the self-loop creation and instead use an $\mathbf{W}_{\mathrm{skip}}\in\mathbb{R}^{s\times s}$ trainable skip connection, and, second, we replace ReLU nonlinearity with SeLU~\cite{klambauer2017self} for better convergence. % \section{Method}\label{sec:method} In this section, we present \textsc{DMoN}\xspace, our method for attributed graph clustering with graph neural networks. Inspired by the modularity function and its spectral optimization, we propose a fully differentiable unsupervised clustering objective which optimizes soft cluster assignments using a null model to control for inhomogeneities in the graph. We then discuss the challenge of regularizing cluster assignments, and present collapse regularization, a softer version of orthogonality loss, that against trivial solutions. \subsection{\textsc{DMoN}\xspace: Deep Modularity Networks} The challenge of clustering boils down to defining an optimization procedure over the cluster assignment matrix $\mathbf{C}$. In \textsc{DMoN}\xspace, we propose to obtain $\mathbf{C}$ via the output of a softmax function, which allows the (soft) cluster assignment to be differentiable. The input to the cluster assignment can be any differentiable message passing function, but here we specifically consider the case where a graph convolutional network is used to obtain soft clusters for each node as follows: \begin{equation}\label{eq:dmon-architecture} \mathbf{C} = \mathrm{softmax}(\mathrm{GCN}(\Tilde{\mathbf{A}}, \mathbf{X})), \end{equation} \noindent where $\mathrm{GCN}$ is a (possibly) multi-layer convolutional network operating on an normalized adjacency matrix $\Tilde{\mathbf{A}} = \mathbf{D}^{-\frac{1}{2}}(\mathbf{A})\mathbf{D}^{-\frac{1}{2}}$. We then propose to optimize this assignment with the following objective, which combines insights from spectral modularity maximization \eqref{eq:spectral_modularity} with a regularization to ensure informative clusters: \begin{equation}\label{eq:dmon-objective} \mathcal{L}_\text{{\textsc{DMoN}\xspace}} = \underbrace{-\frac{1}{2m}\tr ( \mathbf{C}^\top \mathbf{B} \mathbf{C})}_{\mathrm{modularity}} + \underbrace{\frac{\sqrt{k}}{n}\left\lVert \sum_i\mathbf{C}^\top_i\right\rVert_F - 1}_{\mathrm{collapse~regularization}}, \end{equation} where $\lVert\cdot\rVert_F$ is the Frobenius norm. We decompose the computation of $\tr(\mathbf{C}^\top\mathbf{B}\mathbf{C})$ as a sum of sparse matrix-matrix multiplication and rank-one degree normalization $\tr(\mathbf{C}^\top\mathbf{A}\mathbf{C}-\mathbf{C}^\top\mathbf{d}^\top\mathbf{d}\mathbf{C})$. This allows us to efficiently optimize \textsc{DMoN}\xspace parameters in sparse regime. \subsection{Collapse regularization}\label{ssec:clustersize} \begin{wrapfigure}[16]{R}{0.4\textwidth} \vspace{-12mm} \centering \begin{tikzpicture} \begin{groupplot}[group style={ group name=myplot, group size= 1 by 2,vertical sep=0.75cm}, height=3cm, width=1.2\linewidth, title style={at={(0.5,0.9)},anchor=south}, every axis x label/.style={at={(axis description cs:0.5,-0.2)},anchor=north}, yticklabels={,,}, xmin=0, xmax=200] \nextgroupplot[ title = \textbf{\textsc{DMoN}\xspace{}}, legend columns=2, legend style={at={(0.5,1.4)},anchor=south}, legend entries={Objective, Regularizer}, xticklabels={,,}, ] \addplot[very thick,color=cycle2] table[x=epoch,y=mgcn] {data/loss_histories.tex}; \addplot[very thick,color=cycle3] table[x=epoch,y=mgcn-reg] {data/loss_histories.tex}; \nextgroupplot[ title = \textbf{MinCutPool}, xlabel=epoch, ] \draw [color=black, dashed, very thick, draw opacity=0.75] (0, -0.9972) -- (200,-0.9972); \draw[->,thick,color=black](axis cs:60,-0.2)--(axis cs:75,-0.8); \node[anchor=east] (text) at (axis cs:60,-0.2){\tiny \textbf{not improving}}; \addplot[very thick,color=cycle2] table[x=epoch,y=mincut] {data/loss_histories.tex}; \addplot[very thick,color=cycle3] table[x=epoch,y=mincut-reg] {data/loss_histories.tex}; \end{groupplot} \end{tikzpicture} \vspace*{-7mm} \caption{\label{fig:loss-evolution}\small Optimization progress of {MinCut} and \textsc{DMoN}\xspace{} on Cora dataset. MinCut optimizes the regularizer, while \textsc{DMoN}\xspace{} minimizes its main objective.} \end{wrapfigure} Without additional constraints on the assignment matrix $\mathbf{C}$, spectral clustering for both min-cut and modularity objectives has spurious local minima: assigning all nodes to the same cluster produces a trivial locally optimal solution that traps gradient-based optimization methods. MinCut pooling~\cite{bianchi2020} addresses this problem by adapting spectral orthogonality constraint in the form of soft-orthogonality~\cite{bansal2018can} regularization $\left\lVert \mathbf{C}^\top\mathbf{C} - \mathbf{I}\right\rVert_F$. We notice that this term is overly restrictive when combined with softmax class assignment -- intuitively, when the value range of $\mathbf{C}$ is restricted to $\mathbb{R}\cap[0, 1]$ the optimization of the soft-orthogonality regularizer dominates the loss. We illustrate this problem in Figure~\ref{fig:loss-evolution}, which depicts the progress of optimization for both methods in terms of their main objective and regularizer term over the course of 200 epochs on Cora dataset. The soft orthogonality regularization term dominates the optimization for MinCutPool, such that the cut objective becomes \emph{worse than random} over the course of training. We fix this problem by proposing a relaxed notion of \emph{collapse regularization} that prevents the trivial partition while not restricting the optimization of the main objective. The regularizer is a Frobenius norm of the (soft) cluster membership counts, normalized to range $[0, 1]$. It gets value of $0$ when cluster sizes are perfectly balanced, and $1$ in the case all clusters collapse to one. We also propose to stabilize the training by applying dropout~\cite{srivastava2014dropout} to GNN representations before the softmax, preventing the gradient descent from getting stuck in the local optima of the highly non-convex objective function. % \vspace{-5mm} \section{Experiments}\label{sec:experiments} \vspace{-4mm} We assess the clustering performance of \textsc{DMoN}\xspace{} in terms of both graph clustering and label alignment. We release the implementation of \textsc{DMoN}\xspace{} at this URL\footnote{\href{https://github.com/google-research/google-research/tree/master/graph_embedding/dmon}{\texttt{github.com/google-research/google-research/tree/master/graph\_embedding/dmon}}}. \begin{wrapfigure}[10]{r}{7cm} \vspace{-5mm} % \footnotesize \centering{ \newcolumntype{C}{>{\centering\arraybackslash}X} \caption{\label{tbl:datasets}Dataset statistics.} \vspace*{-2mm} \begin{tabularx}{7cm}{p{1.5cm}CCCC@{}} \toprule \emph{dataset} & Nodes & Edges & Features & Classes \\ \midrule Cora\xspace & 2708 & 5278 & 1433 & 7 \\ Citeseer\xspace & 3327 & 4614 & 3703 & 6 \\ Pubmed\xspace & 19717 & 44325 & 500 & 3 \\ \mbox{Amazon PC\xspace} & 13752 & 143604 & 767 & 10 \\ \mbox{Amazon Photo\xspace} & 7650 & 71831 & 745 & 8 \\ \mbox{Coauthor CS\xspace} & 18333 & 81894 & 6805 & 15 \\ \mbox{Coauthor PHY\xspace} & 34493 & 247962 & 8415 & 5 \\ \bottomrule \end{tabularx}} \end{wrapfigure} \spara{Datasets.} We use 7 real-world datasets for assessing model quality. Cora, Citeseer, and Pubmed~\cite{sen2008} are citation networks; nodes represent papers connected by citation edges; features are bag-of-word abstracts, and labels represent paper topics. Amazon PC\xspace and Amazon Photo\xspace~\cite{shchur2018} are subsets of the Amazon co-purchase graph for the computers and photo sections of the website, where nodes represent goods with edges between ones frequently purchased together; node features are bag-of-word reviews, and class labels are product category. Coauthor CS\xspace and Coauthor PHY\xspace~\cite{shchur2018} are co-authorship networks based on the Microsoft Academic Graph for the computer science and physics fields respectively; nodes are authors, which are connected by edge if they co-authored a paper together; node features are a collection of paper keywords for author’s papers; class labels indicate most common fields of study. \spara{Baselines.} As we study how to leverage the information from both the graph and attributes, we employ two baselines that employ either strictly graph or attribute information. We give a brief description of the baselines used below: \vspace{-2mm} \begin{itemize}[leftmargin=0.2cm,itemindent=.3cm,labelwidth=\itemindent,labelsep=0cm,align=left,topsep=0pt,itemsep=-1ex,partopsep=0ex,parsep=1ex] \item \textbf{k-means(features)} is our baseline that only considers the feature data. We use the local Lloyd algorithm~\cite{lloyd1982} with the k-means++ seeding~\cite{arthur2007} strategy. \item \textbf{SBM}~\cite{peixoto2014} is a baseline that only relies on the graph structure. We estimate a constrained stochastic block model with given number of $k$ clusters, maximizing the modularity~\cite{newman2006} of the network. \item \textbf{k-means(DGI)}~\cite{velickovic2018} demonstrates the need of joint learning of clusters and representations. We learn unsupervised node representation with DGI and run k-means on the resulting representations. \item \textbf{MinCutPool(graph, features)}~\cite{bianchi2020} is a deep pooling method that we re-interpret as clustering. \end{itemize} \begin{table}[!t] \small \centering{ \newcolumntype{R}{>{\raggedleft\arraybackslash}X} \newcolumntype{C}{>{\centering\arraybackslash}X} \caption{Results on four datasets from~\cite{sen2008} in terms of graph conductance $\mathcal{C}$, modularity $\mathcal{Q}$, NMI with ground-truth labels, and pairwise F1 measure. We highlight best neural method performance.} \begin{tabularx}{\linewidth}{p{2cm}CCCCCCCCCCCC@{}} \toprule \multicolumn{1}{C}{} & \multicolumn{4}{c}{\textbf{Cora\xspace}} & \multicolumn{4}{c}{\textbf{Citeseer\xspace}} & \multicolumn{4}{c}{\textbf{Pubmed\xspace}} \\ \multicolumn{1}{C}{} & \multicolumn{2}{c}{\emph{graph}} & \multicolumn{2}{c}{\emph{labels}} & \multicolumn{2}{c}{\emph{graph}} & \multicolumn{2}{c}{\emph{labels}} & \multicolumn{2}{c}{\emph{graph}} & \multicolumn{2}{c}{\emph{labels}} \\ \cmidrule(lr){2-5}\cmidrule(lr){6-9}\cmidrule(lr){10-13} \emph{method} & $\mathcal{C}\downarrow$ & $\mathcal{Q}\uparrow$ & NMI$\uparrow$ & F1$\uparrow$ & $\mathcal{C}\downarrow$ & $\mathcal{Q}\uparrow$ & NMI$\uparrow$ & F1$\uparrow$ & $\mathcal{C}\downarrow$ & $\mathcal{Q}\uparrow$ & NMI$\uparrow$ & F1$\uparrow$\\ \midrule \mbox{k-means(features)} & 61.7 & 19.8 & 18.5 & 27.0 & 60.5 & 30.3 & 24.5 & 29.2 & 55.8 & 33.4 & 19.4 & 24.4 \\ \mbox{SBM} & 15.4 & 77.3 & 36.2 & 30.2 & 14.2 & 78.1 & 15.3 & 19.1 & 39.0 & 53.5 & 16.4 & 16.7 \\ \midrule \mbox{k-means(DGI)} & 28.0 & 64.0 & \textbf{52.7} & 40.1 & 17.5 & 73.7 & \textbf{40.4} & 39.4 & 82.9 & 9.6 & 22.0 & 26.4 \\ \mbox{MinCut} & 23.3 & 70.3 & 35.8 & 25.0 & 14.1 & 78.9 & 25.9 & 20.1 & 29.6 & 63.1 & 25.4 & 15.8 \\ \midrule \mbox{\textsc{DMoN}\xspace} & \textbf{12.2} & \textbf{76.5} & 48.8 & \textbf{48.8} & \textbf{5.1} & \textbf{79.3} & 33.7 & \textbf{43.2} & \textbf{17.7} & \textbf{65.4} & \textbf{29.8} & \textbf{33.9} \\ \bottomrule \end{tabularx}} \label{tbl:clustering} \end{table} \begin{table}[!t] \small \centering{ \newcolumntype{R}{>{\raggedleft\arraybackslash}X} \newcolumntype{C}{>{\centering\arraybackslash}X} \caption{Results on four datasets from~\cite{shchur2018} in terms of graph conductance $\mathcal{C}$, modularity $\mathcal{Q}$, NMI with ground-truth labels, and pairwise F1 measure. We highlight best neural method performance.} \begin{tabularx}{\linewidth}{@{}p{1cm}CCCCCCCCCCCCCCCC@{}} \toprule \multicolumn{1}{C}{} & \multicolumn{4}{c}{\textbf{Amazon PC\xspace}} & \multicolumn{4}{c}{\textbf{Amazon Photo\xspace}} & \multicolumn{4}{c}{\textbf{Coauthor CS\xspace}} & \multicolumn{4}{c}{\textbf{Coauthor PHY\xspace}} \\ \multicolumn{1}{C}{} & \multicolumn{2}{c}{\emph{graph}} & \multicolumn{2}{c}{\emph{labels}} & \multicolumn{2}{c}{\emph{graph}} & \multicolumn{2}{c}{\emph{labels}} & \multicolumn{2}{c}{\emph{graph}} & \multicolumn{2}{c}{\emph{labels}} & \multicolumn{2}{c}{\emph{graph}} & \multicolumn{2}{c}{\emph{labels}} \\ \cmidrule(lr){2-5}\cmidrule(lr){6-9}\cmidrule(lr){10-13}\cmidrule(lr){14-17} \emph{method} & $\mathcal{C}\downarrow$ & $\mathcal{Q}\uparrow$ & NMI$\uparrow$ & F1$\uparrow$ & $\mathcal{C}\downarrow$ & $\mathcal{Q}\uparrow$ & NMI$\uparrow$ & F1$\uparrow$ & $\mathcal{C}\downarrow$ & $\mathcal{Q}\uparrow$ & NMI$\uparrow$ & F1$\uparrow$ & $\mathcal{C}\downarrow$ & $\mathcal{Q}\uparrow$ & NMI$\uparrow$ & F1$\uparrow$\\ \midrule \mbox{k-m(feat)} & 84.5 & 5.4 & 21.1 & 19.2 & 79.6 & 10.5 & 28.8 & 19.5 & 49.1 & 23.1 & 35.7 & 39.4 & 57.0 & 19.4 & 30.6 & 42.9 \\ \mbox{SBM} & 31.0 & 60.8 & 48.4 & 34.6 & 18.6 & 72.7 & 59.3 & 47.4 & 20.3 & 72.7 & 58.0 & 47.7 & 25.9 & 66.9 & 45.4 & 30.4 \\ \midrule \mbox{k-m(DGI)} & 61.9 & 22.8 & 22.6 & 15.0 & 51.5 & 35.1 & 33.4 & 23.6 & 35.1 & 57.8 & 64.6 & 51.9 & 38.6 & 51.2 & 51.0 & 30.6 \\ \mbox{MinCut} & --- & --- & --- & --- & --- & --- & --- & --- & 22.7 & 70.5 & 64.6 & 47.8 & 27.8 & 64.3 & 48.3 & 24.9 \\ \midrule \mbox{\textsc{DMoN}\xspace} & \textbf{18.0} & \textbf{59.0} & \textbf{49.3} & \textbf{45.4} & \textbf{12.7} & \textbf{70.1} & \textbf{63.3} & \textbf{61.0} & \textbf{17.5} & \textbf{72.4} & \textbf{69.1} & \textbf{59.8} & \textbf{18.8} & \textbf{65.8} & \textbf{51.9} & \textbf{37.0} \\ \bottomrule \end{tabularx}} \label{tbl:clustering2} \end{table} \spara{Metrics.} We measure both the graph-based metrics of clustering and label correlation to study clustering performance of attributed graphs both in terms of graph and attribute structure. For graph-level metrics, we report average cluster conductance (as per definition from~\cite{yang2015}) and graph modularity~\cite{newman2006}. For ground-truth label correlation analysis, we report normalized mutual information (NMI) between the cluster assignments and labels and pairwise F-1 score between all node pairs and their associated cluster pairs. Where possible, we normalize all metrics by multiplying them by 100 for ease of comparison. \spara{Parameter settings.} We run all experiments for 10 times and average results across runs. All models were implemented in Tensorflow 2 and trained on CPUs. We fix the architecture for all clustering networks to have one hidden layer with 512 neurons in it for real-world datasets and 64 for small synthetic graphs. We set the number of clusters to 16 for all datasets and methods. \begin{table}[!b] \vspace{-2em} \small \centering \newcolumntype{S}{>{\hsize=.1\hsize}X} \newcolumntype{L}{>{\hsize=.3\hsize}X} \caption{\label{tab:synthetic-scenarios} Synthetic ADC-SBM benchmark scenarios.} \begin{tabularx}{\textwidth}{SLX} \toprule Scenario & Parameter & Description \\ \midrule 1 & $d_{out}\in[2.0, 5.0]$ & Increase graph cluster mixing signal. Higher = weaker clusters. \\ 2 & $\sigma_c\in[10^{-2}, 10^1]$ & Increase feature cluster center variance. Higher = stronger clusters.\\ 3 & $\sigma_c\in[10^{-2}, 10^1]$ & Increase feature cluster center variance, with nested feature clusters.\\ 4 & $\sigma_c\in[10^{-2}, 10^1]$ & Increase feature cluster center variance, with grouped feature clusters.\\ 5 & $d\in [2^2, 2^7]$ & Increase average degree. Higher = clearer graph signal.\\ 6 & $d_{max} \in [2^2, 2^{10}]$ & Increase power law upper-bound. Higher = more extreme power law.\\ \bottomrule \end{tabularx} \end{table} \subsection{Simulation Experiments on Stochastic Block Model}\label{ssec:sbm-experiments} To better explore the robustness of our approach to variance in the graph and node features, we propose a study on synthetic graphs using an \emph{attributed}, \emph{degree-corrected} stochastic block model (ADC-SBM). The SBM~\cite{snijders1997estimation} plants a partition of clusters (``blocks'') in a graph, and generates edges via a distribution conditional on that partition. This model has been used extensively to benchmark graph clustering methods~\cite{fortunato2016community}, and has recently been used for experiments on state-of-the-art GNNs~\cite{dwivedi2020benchmarking}. In our version of the model, node features are also generated, using a multivariate mixture model, with the mixture memberships having some correspondence to the cluster memberships. To generate an instance of the ADC-SBM, we fix a number of nodes $n$ and a number of clusters $k$, and choose node cluster memberships uniformly-at-random. Define the matrix $\mathbf{D}_{k\times k}$ where $\mathbf{D}_{ij}$ is the expected number of edges shared between nodes in clusters $i$ and $j$. We determine $\mathbf{D}$ by fixing (1) the expected \emph{average} degree of the nodes $d\in \{1, n\}$, and (2) the expected \emph{average} sub-degree $d_{out} \leq d$ of a node to any cluster other than its own. Note that the difference $d_{in} - d_{out}$, where $d_{in}:=d - d_{out}$, controls the spectral detectability of the clusters~\cite{nadakuditi2012graph}. Finally, we generate a power-law $n$-vector $\theta$, where $\theta_i$ is proportional to $i$'s expected degree. With the memberships and the parameters $D$ and $\theta$. We use \texttt{graph-tool}~\cite{peixoto_graph-tool_2014} generate the graphs. \begin{figure}[!t] \begin{subfigure}[b]{0.24\linewidth} \centering \includegraphics[width=\linewidth]{figures/adj.png}% \caption{} \end{subfigure}\hfill \begin{subfigure}[b]{0.24\linewidth} \centering \includegraphics[width=\linewidth]{figures/cov1.png}% \caption{} \end{subfigure}\hfill \begin{subfigure}[b]{.24\linewidth} \centering \includegraphics[width=\linewidth]{figures/cov2.png}% \caption{} \end{subfigure}\hfill \begin{subfigure}[b]{0.24\linewidth} \centering \includegraphics[width=\linewidth]{figures/cov3.png} \caption{} \end{subfigure} \caption{\label{fig:synthetic-illustration}\textbf{Illustration of synthetic data.} a): 4-cluster graph adjacency matrix. b): Covariance matrix of ``matched'' features: features that are clustered according to the graph clusters. c): Covariance matrix of ``nested'' features: features that are clustered by nesting of the graph clusters. d): Covariance matrix of ``grouped'' features: features that are clustered by grouping of the graph clusters.} \vspace{-1.5em} \end{figure} To generate $s$-dimensional features, we first generate feature memberships from $k_f$ cluster labels. For graph clustering GNNs that operate both on edges and node features, it is important to examine performance on data where feature clusters diverge from or segment the graph clusters: thus potentially $k_f\ne k$. We examine cases where feature memberships \emph{match}, \emph{group}, or \emph{nest} the graph memberships, as illustrated in Figure~\ref{fig:synthetic-illustration}. With feature memberships in-hand, we generate $k$ zero-mean feature cluster centers from a $s$-multivariate normal with covariance matrix $\sigma_c^2\cdot \mathbf{I}_{s\times s}$. Then, for feature cluster $i\leq k_f$, we generate its features from a $s$-multivariate normal with covariance matrix $\sigma^2\cdot \mathbf{I}_{s\times s}$. Note that the ratio $\sigma^2_c/\sigma^2$ controls the expected value of the classical between/within-sum-of-squares of the clusters. The above paragraphs describe a single generation of our synthetic benchmark model, the ADC-SBM. To explore robustness, we define a ``default'' ADC-SBM, and explore model parameters in a range around the defaults. We configure our default model as follows: we generate graphs with $n=1,000$ nodes grouped in $k=4$ clusters, and $s=32$-dimensional features grouped in $k_f=4$ matching feature clusters with $\sigma=1$ intra-cluster center variance and $\sigma_c=3$ cluster center variance. We try to model real-world graphs' degree distribution with $d=20$ average degree and $d_{out}=2$ average inter-cluster degree with power law parameters $d_{min}=2, d_{max}=4, \alpha=2$. In total, we consider 6 different scenarios, as described in Table~\ref{tab:synthetic-scenarios}. \begin{wrapfigure}[10]{R}{0.3\linewidth} \vspace{-6mm} \centering \begin{subfigure}[b]{0.475\linewidth} \centering \includegraphics[width=\linewidth]{figures/mincut.png}% \caption{} \end{subfigure}\hfill \begin{subfigure}[b]{.475\linewidth} \centering \includegraphics[width=\linewidth]{figures/mgcn2.png}% \caption{} \end{subfigure} \vspace*{-3mm} \caption{\label{fig:viz}\small(a) MinCutPool fails to recover ground-truth clusters while (b) \textsc{DMoN}\xspace perfectly recovers ground-truth partition.} \end{wrapfigure} Figure~\ref{fig:synthetic-results} demonstrates overwhelming superiority of \textsc{DMoN}\xspace{} in all considered scenarios. In scenario 1 we see that \textsc{DMoN}\xspace{} can effectively leverage the feature signal to obtain outstanding clustering performance even when the graph structure is close to random, far beyond the spectral detectability threshold (pictured in gray). Scenario 2 demonstrates that even in the presence of a weak feature signal \textsc{DMoN}\xspace outperforms stochastic SBM minimization, while MinCutPool needs \emph{two orders of magnitude} stronger signal to attain the same performance. Scenario 3 demonstrates that \textsc{DMoN}\xspace{} is not susceptible to nested feature clusters and can correctly recover underlying graph structure. Scenario 4 shows that \textsc{DMoN}\xspace is more susceptible to grouped features, as it becomes hard to differentiate graph clusters with similar features, however, MinCutPool is struggling to pick up \emph{any} signal in the data. Scenarios 5\&6 demonstrate that \textsc{DMoN}\xspace is stable in terms of the degree distribution of the graph, while MinCutPool is not. We also notice that while the k-means(DGI) baseline offers some improvements over using features or the graph structure alone, it never surpasses the strongest signal provider in the graph, never being better than the best one between k-means(features) and SBM. Finally, we provide an illustration of the how MinCutPool collapsing into a single cluster while \textsc{DMoN}\xspace succeeds in Figure~\ref{fig:viz}. \begin{figure}[!t] \centering \begin{tikzpicture} \begin{groupplot}[group style={ group name=myplot, group size= 3 by 2, horizontal sep=0.75cm,vertical sep=1.3cm},height=3.75cm,width=0.375 \linewidth,ymin=0,ymax=100,title style={at={(0.5,0.9)},anchor=south},every axis x label/.style={at={(axis description cs:0.5,-0.15)},anchor=north}] \nextgroupplot[ title = \textbf{Scenario 1}, legend columns=5, legend style={at={(1.675,1.25)},anchor=south}, legend entries={\textsc{DMoN}\xspace{}, SBM, k-means(features), MinCut, k-means(DGI)}, ylabel=NMI$\times100$, xlabel=$d_{out}$, xmin=1, xmax=5 ] \addplot[very thick,color=cycle2] table[x=param,y=mgcn2] {data/scenario1.tex}; \addplot[very thick,color=cycle3] table[x=param,y=sbm] {data/scenario1.tex}; \addplot[very thick,color=cycle4] table[x=param,y=km] {data/scenario1.tex}; \addplot[very thick,color=cycle5] table[x=param,y=mincut] {data/scenario1.tex}; \addplot[very thick,color=cycle6] table[x=param,y=dgi] {data/scenario1.tex}; \addplot[name path=mgcn_top_,color=cycle2!70,forget plot] table[x=param,y=mgcn2_high] {data/scenario1.tex}; \addplot[name path=mgcn_btm_,color=cycle2!70,forget plot] table[x=param,y=mgcn2_low] {data/scenario1.tex}; \addplot[cycle2!50,fill opacity=0.5,forget plot] fill between[of=mgcn_top_ and mgcn_btm_]; \addplot[name path=sbm_top_,color=cycle3!70,forget plot] table[x=param,y=sbm_high] {data/scenario1.tex}; \addplot[name path=sbm_btm_,color=cycle3!70,forget plot] table[x=param,y=sbm_low] {data/scenario1.tex}; \addplot[cycle3!50,fill opacity=0.5,forget plot] fill between[of=sbm_top_ and sbm_btm_]; \addplot[name path=km_top_,color=cycle4!70,forget plot] table[x=param,y=km_high] {data/scenario1.tex}; \addplot[name path=km_btm_,color=cycle4!70,forget plot] table[x=param,y=km_low] {data/scenario1.tex}; \addplot[cycle4!50,fill opacity=0.5,forget plot] fill between[of=km_top_ and km_btm_]; \addplot[name path=mincut_top_,color=cycle5!70,forget plot] table[x=param,y=mincut_high] {data/scenario1.tex}; \addplot[name path=mincut_btm_,color=cycle5!70,forget plot] table[x=param,y=mincut_low] {data/scenario1.tex}; \addplot[cycle5!50,fill opacity=0.5,forget plot] fill between[of=mincut_top_ and mincut_btm_]; \addplot[name path=dgi_top_,color=cycle6!70,forget plot] table[x=param,y=dgi_high] {data/scenario1.tex}; \addplot[name path=dgi_btm_,color=cycle6!70,forget plot] table[x=param,y=dgi_low] {data/scenario1.tex}; \addplot[cycle6!50,fill opacity=0.5,forget plot] fill between[of=dgi_top_ and dgi_btm_]; \draw [color=cyclegray, ultra thick, draw opacity=0.75] (2.76393202250021,0) -- (2.76393202250021,100); \draw[->,thick,color=black](axis cs:3.15,28.5)--(axis cs:2.85,60); \node[anchor=east] (text) at (axis cs:3.9,20){\tiny \textbf{detectability limit}}; \nextgroupplot[ title = \textbf{Scenario 2}, yticklabels={,,}, xlabel=$\sigma_c$, xmode=log, xmin=0.01, xmax=10 ] \addplot[very thick,color=cycle2] table[x=param,y=mgcn2] {data/scenario2.tex}; \addplot[very thick,color=cycle3] table[x=param,y=sbm] {data/scenario2.tex}; \addplot[very thick,color=cycle4] table[x=param,y=km] {data/scenario2.tex}; \addplot[very thick,color=cycle5] table[x=param,y=mincut] {data/scenario2.tex}; \addplot[very thick,color=cycle6] table[x=param,y=dgi] {data/scenario2.tex}; \addplot[name path=mgcn_top_,color=cycle2!70,forget plot] table[x=param,y=mgcn2_high] {data/scenario2.tex}; \addplot[name path=mgcn_btm_,color=cycle2!70,forget plot] table[x=param,y=mgcn2_low] {data/scenario2.tex}; \addplot[cycle2!50,fill opacity=0.5,forget plot] fill between[of=mgcn_top_ and mgcn_btm_]; \addplot[name path=sbm_top_,color=cycle3!70,forget plot] table[x=param,y=sbm_high] {data/scenario2.tex}; \addplot[name path=sbm_btm_,color=cycle3!70,forget plot] table[x=param,y=sbm_low] {data/scenario2.tex}; \addplot[cycle3!50,fill opacity=0.5,forget plot] fill between[of=sbm_top_ and sbm_btm_]; \addplot[name path=km_top_,color=cycle4!70,forget plot] table[x=param,y=km_high] {data/scenario2.tex}; \addplot[name path=km_btm_,color=cycle4!70,forget plot] table[x=param,y=km_low] {data/scenario2.tex}; \addplot[cycle4!50,fill opacity=0.5,forget plot] fill between[of=km_top_ and km_btm_]; \addplot[name path=mincut_top_,color=cycle5!70,forget plot] table[x=param,y=mincut_high] {data/scenario2.tex}; \addplot[name path=mincut_btm_,color=cycle5!70,forget plot] table[x=param,y=mincut_low] {data/scenario2.tex}; \addplot[cycle5!50,fill opacity=0.5,forget plot] fill between[of=mincut_top_ and mincut_btm_]; \addplot[name path=dgi_top_,color=cycle6!70,forget plot] table[x=param,y=dgi_high] {data/scenario2.tex}; \addplot[name path=dgi_btm_,color=cycle6!70,forget plot] table[x=param,y=dgi_low] {data/scenario2.tex}; \addplot[cycle6!50,fill opacity=0.5,forget plot] fill between[of=dgi_top_ and dgi_btm_]; \nextgroupplot[ title = \textbf{Scenario 3}, yticklabels={,,}, xlabel=$\sigma_c$, xmode=log, xmin=0.01, xmax=10 ] \addplot[very thick,color=cycle2] table[x=param,y=mgcn2] {data/scenario3.tex}; \addplot[very thick,color=cycle3] table[x=param,y=sbm] {data/scenario3.tex}; \addplot[very thick,color=cycle4] table[x=param,y=km] {data/scenario3.tex}; \addplot[very thick,color=cycle5] table[x=param,y=mincut] {data/scenario3.tex}; \addplot[very thick,color=cycle6] table[x=param,y=dgi] {data/scenario3.tex}; \addplot[name path=mgcn_top_,color=cycle2!70,forget plot] table[x=param,y=mgcn2_high] {data/scenario3.tex}; \addplot[name path=mgcn_btm_,color=cycle2!70,forget plot] table[x=param,y=mgcn2_low] {data/scenario3.tex}; \addplot[cycle2!50,fill opacity=0.5,forget plot] fill between[of=mgcn_top_ and mgcn_btm_]; \addplot[name path=sbm_top_,color=cycle3!70,forget plot] table[x=param,y=sbm_high] {data/scenario3.tex}; \addplot[name path=sbm_btm_,color=cycle3!70,forget plot] table[x=param,y=sbm_low] {data/scenario3.tex}; \addplot[cycle3!50,fill opacity=0.5,forget plot] fill between[of=sbm_top_ and sbm_btm_]; \addplot[name path=km_top_,color=cycle4!70,forget plot] table[x=param,y=km_high] {data/scenario3.tex}; \addplot[name path=km_btm_,color=cycle4!70,forget plot] table[x=param,y=km_low] {data/scenario3.tex}; \addplot[cycle4!50,fill opacity=0.5,forget plot] fill between[of=km_top_ and km_btm_]; \addplot[name path=mincut_top_,color=cycle5!70,forget plot] table[x=param,y=mincut_high] {data/scenario3.tex}; \addplot[name path=mincut_btm_,color=cycle5!70,forget plot] table[x=param,y=mincut_low] {data/scenario3.tex}; \addplot[cycle5!50,fill opacity=0.5,forget plot] fill between[of=mincut_top_ and mincut_btm_]; \addplot[name path=dgi_top_,color=cycle6!70,forget plot] table[x=param,y=dgi_high] {data/scenario3.tex}; \addplot[name path=dgi_btm_,color=cycle6!70,forget plot] table[x=param,y=dgi_low] {data/scenario3.tex}; \addplot[cycle6!50,fill opacity=0.5,forget plot] fill between[of=dgi_top_ and dgi_btm_]; \nextgroupplot[ title = \textbf{Scenario 4}, xlabel=$\sigma_c$, ylabel=NMI$\times100$, xmode=log, xmin=0.01, xmax=10 ] \addplot[very thick,color=cycle2] table[x=param,y=mgcn2] {data/scenario4.tex}; \addplot[very thick,color=cycle3] table[x=param,y=sbm] {data/scenario4.tex}; \addplot[very thick,color=cycle4] table[x=param,y=km] {data/scenario4.tex}; \addplot[very thick,color=cycle5] table[x=param,y=mincut] {data/scenario4.tex}; \addplot[very thick,color=cycle6] table[x=param,y=dgi] {data/scenario4.tex}; \addplot[name path=mgcn_top_,color=cycle2!70,forget plot] table[x=param,y=mgcn2_high] {data/scenario4.tex}; \addplot[name path=mgcn_btm_,color=cycle2!70,forget plot] table[x=param,y=mgcn2_low] {data/scenario4.tex}; \addplot[cycle2!50,fill opacity=0.5,forget plot] fill between[of=mgcn_top_ and mgcn_btm_]; \addplot[name path=sbm_top_,color=cycle3!70,forget plot] table[x=param,y=sbm_high] {data/scenario4.tex}; \addplot[name path=sbm_btm_,color=cycle3!70,forget plot] table[x=param,y=sbm_low] {data/scenario4.tex}; \addplot[cycle3!50,fill opacity=0.5,forget plot] fill between[of=sbm_top_ and sbm_btm_]; \addplot[name path=km_top_,color=cycle4!70,forget plot] table[x=param,y=km_high] {data/scenario4.tex}; \addplot[name path=km_btm_,color=cycle4!70,forget plot] table[x=param,y=km_low] {data/scenario4.tex}; \addplot[cycle4!50,fill opacity=0.5,forget plot] fill between[of=km_top_ and km_btm_]; \addplot[name path=mincut_top_,color=cycle5!70,forget plot] table[x=param,y=mincut_high] {data/scenario4.tex}; \addplot[name path=mincut_btm_,color=cycle5!70,forget plot] table[x=param,y=mincut_low] {data/scenario4.tex}; \addplot[cycle5!50,fill opacity=0.5,forget plot] fill between[of=mincut_top_ and mincut_btm_]; \addplot[name path=dgi_top_,color=cycle6!70,forget plot] table[x=param,y=dgi_high] {data/scenario4.tex}; \addplot[name path=dgi_btm_,color=cycle6!70,forget plot] table[x=param,y=dgi_low] {data/scenario4.tex}; \addplot[cycle6!50,fill opacity=0.5,forget plot] fill between[of=dgi_top_ and dgi_btm_]; \nextgroupplot[ title = \textbf{Scenario 5}, yticklabels={,,}, xlabel=$d$, xmode=log, xmin=4, xmax=128, log basis x={2} ] \addplot[very thick,color=cycle2] table[x=param,y=mgcn2] {data/scenario5.tex}; \addplot[very thick,color=cycle3] table[x=param,y=sbm] {data/scenario5.tex}; \addplot[very thick,color=cycle4] table[x=param,y=km] {data/scenario5.tex}; \addplot[very thick,color=cycle5] table[x=param,y=mincut] {data/scenario5.tex}; \addplot[very thick,color=cycle6] table[x=param,y=dgi] {data/scenario5.tex}; \addplot[name path=mgcn_top_,color=cycle2!70,forget plot] table[x=param,y=mgcn2_high] {data/scenario5.tex}; \addplot[name path=mgcn_btm_,color=cycle2!70,forget plot] table[x=param,y=mgcn2_low] {data/scenario5.tex}; \addplot[cycle2!50,fill opacity=0.5,forget plot] fill between[of=mgcn_top_ and mgcn_btm_]; \addplot[name path=sbm_top_,color=cycle3!70,forget plot] table[x=param,y=sbm_high] {data/scenario5.tex}; \addplot[name path=sbm_btm_,color=cycle3!70,forget plot] table[x=param,y=sbm_low] {data/scenario5.tex}; \addplot[cycle3!50,fill opacity=0.5,forget plot] fill between[of=sbm_top_ and sbm_btm_]; \addplot[name path=km_top_,color=cycle4!70,forget plot] table[x=param,y=km_high] {data/scenario5.tex}; \addplot[name path=km_btm_,color=cycle4!70,forget plot] table[x=param,y=km_low] {data/scenario5.tex}; \addplot[cycle4!50,fill opacity=0.5,forget plot] fill between[of=km_top_ and km_btm_]; \addplot[name path=mincut_top_,color=cycle5!70,forget plot] table[x=param,y=mincut_high] {data/scenario5.tex}; \addplot[name path=mincut_btm_,color=cycle5!70,forget plot] table[x=param,y=mincut_low] {data/scenario5.tex}; \addplot[cycle5!50,fill opacity=0.5,forget plot] fill between[of=mincut_top_ and mincut_btm_]; \addplot[name path=dgi_top_,color=cycle6!70,forget plot] table[x=param,y=dgi_high] {data/scenario5.tex}; \addplot[name path=dgi_btm_,color=cycle6!70,forget plot] table[x=param,y=dgi_low] {data/scenario5.tex}; \addplot[cycle6!50,fill opacity=0.5,forget plot] fill between[of=dgi_top_ and dgi_btm_]; \nextgroupplot[ title = \textbf{Scenario 6}, yticklabels={,,}, xlabel=$d_{\max}$, xmode=log, xmin=4, xmax=1024, log basis x={2}, max space between ticks=20, ] \addplot[very thick,color=cycle2] table[x=param,y=mgcn2] {data/scenario6.tex}; \addplot[very thick,color=cycle3] table[x=param,y=sbm] {data/scenario6.tex}; \addplot[very thick,color=cycle4] table[x=param,y=km] {data/scenario6.tex}; \addplot[very thick,color=cycle5] table[x=param,y=mincut] {data/scenario6.tex}; \addplot[very thick,color=cycle6] table[x=param,y=dgi] {data/scenario6.tex}; \addplot[name path=mgcn_top_,color=cycle2!70,forget plot] table[x=param,y=mgcn2_high] {data/scenario6.tex}; \addplot[name path=mgcn_btm_,color=cycle2!70,forget plot] table[x=param,y=mgcn2_low] {data/scenario6.tex}; \addplot[cycle2!50,fill opacity=0.5,forget plot] fill between[of=mgcn_top_ and mgcn_btm_]; \addplot[name path=sbm_top_,color=cycle3!70,forget plot] table[x=param,y=sbm_high] {data/scenario6.tex}; \addplot[name path=sbm_btm_,color=cycle3!70,forget plot] table[x=param,y=sbm_low] {data/scenario6.tex}; \addplot[cycle3!50,fill opacity=0.5,forget plot] fill between[of=sbm_top_ and sbm_btm_]; \addplot[name path=km_top_,color=cycle4!70,forget plot] table[x=param,y=km_high] {data/scenario6.tex}; \addplot[name path=km_btm_,color=cycle4!70,forget plot] table[x=param,y=km_low] {data/scenario6.tex}; \addplot[cycle4!50,fill opacity=0.5,forget plot] fill between[of=km_top_ and km_btm_]; \addplot[name path=mincut_top_,color=cycle5!70,forget plot] table[x=param,y=mincut_high] {data/scenario6.tex}; \addplot[name path=mincut_btm_,color=cycle5!70,forget plot] table[x=param,y=mincut_low] {data/scenario6.tex}; \addplot[cycle5!50,fill opacity=0.5,forget plot] fill between[of=mincut_top_ and mincut_btm_]; \addplot[name path=dgi_top_,color=cycle6!70,forget plot] table[x=param,y=dgi_high] {data/scenario6.tex}; \addplot[name path=dgi_btm_,color=cycle6!70,forget plot] table[x=param,y=dgi_low] {data/scenario6.tex}; \addplot[cycle6!50,fill opacity=0.5,forget plot] fill between[of=dgi_top_ and dgi_btm_]; \end{groupplot} \end{tikzpicture} \vspace*{-5mm} \caption{Synthetic results on the ADC-SBM model with 6 different scenarios described in Table~\ref{tab:synthetic-scenarios}.}\label{fig:synthetic-results} \end{figure} \subsection{Real-world Data}\label{ssec:real-experiments} We now move on to studies on real-world networks, featuring \textsc{DMoN}\xspace and 4 baselines on 7 different datasets. \textsc{DMoN}\xspace achieves better clustering performance than its neural counterparts on every single dataset and metric besides losing twice to DGI+k-means on Cora and Citeseer in terms of NMI. Compared to SBM, a method that exclusively optimizes modularity, we are able to stay within 2 NMI percentage points, while simultaneously clustering the features. Surprisingly, on Citeseer and Pubmed we achieve better modularity than the method designed to optimize it -- we attribute that to very high correlation between graph structure and the features. We also highlight that we beat MinCutPool in terms of conductance (average graph cut) on all datasets, even though it attempts to optimize for this metric. On Amazon PC\xspace and Amazon Photo\xspace MinCutPool failed to converge, even with tuning the orthogonality regularization parameter. We attribute that to extremely uneven structure of these graphs, as popular products are co-purchased with a lot of other items, so the effects discussed in~\cite{epasto2017ego,leskovec2008statistical} are prohibiting good cuts. This corresponds to high values of $d$ ad $d_{\max}$ in our synthetic scenarios 5 and 6. Overall, \textsc{DMoN}\xspace demonstrates excellent performance on both graph clustering and label correlation, successfully leveraging both graph and attribute information. Both synthetic and real-world experiments prove that \textsc{DMoN}\xspace is vastly superior to its counterparts in attributed graph clustering. % \section{Conclusion}\label{sec:conclusion} In this work, we study GNN pooling through the lens of attributed graph clustering. We introduce Deep Modularity Networks (\textsc{DMoN}\xspace), an unsupervised objective and realize it with a GNN which can recover high quality clusters. We compare against challenging baselines that baselines that optimize structure (SBM), features (kmeans), or both (DGI+k-means), in addition to a recently proposed state-of-the-art pooling method (MinCutPool). We explore the limits of GNN clustering methods in terms of both graph and feature signals using synthetic data, where we see that \textsc{DMoN}\xspace better leverages structure and attributes than all existing methods. In extensive experiments on real datasets we show that the clusters found by \textsc{DMoN}\xspace are more likely to correspond to ground truth labels, and have better properties as illustrated by clustering metrics (e.g.\ conductance or modularity). We hope that this work will further advancements in unsupervised learning for GNNs as well as attributed graph clustering, allowing further advances in graph learning. \newpage \section*{Broader Impact} We believe that better understanding of graph pooling through the lens of attributed graph clustering will allow for the design of more effective graph neural network architectures. Our reformulation encourages explicit grouping of nodes in graphs, which we envision will be useful in domains with naturally occurring community structure, e.g.\ social networks or information retrieval. Additionally, our M-GCN could serve as the ``graph-context'' head in semi-supervised architectures \cite{yang2016revisiting}, allowing for stronger community-based constraints in those systems. Our work also allows translation of open questions in network science about attributed graph clustering to the GNN domain, potentially enabling powerful new modelling solutions. Specifically, existing combinatorial \cite{yang2013community} and bayesian \cite{newman2016structure} methods for attributed graph clustering use graph features to improve clustering accuracy. \cite{newman2016structure} shows that using features allows their estimation-based approach to overcome the spectral ``detectability'' limit for graphs \cite{nadakuditi2012graph}, a result that we replicate in this study. Using our model, more ideas from the network science community may be ported to GNN architectures. \bibliographystyle{plain}
\section*{Acknowledgments} This work was partially supported by FAPERJ and CNPq, Brazil, and UBACyT, Argentina. The third author is supported by CAPES, Brazil. We would like to thank V\'{\i}ctor Braberman for some ideas for the reduction in the \textsf{NP}-completeness proof. \section{Characterization of \fp{k} and \fpp{k} Graphs} \label{chpt:characterization} This section describes a characterization of \fp{k} and \fpp{k} graphs for a given partition. First, we define some further concepts. A graph $G$ is a \emph{split} graph if there is a bipartition $(V_1,V_2)$ of $V(G)$ such that $V_1$ is a clique and $V_2$ a stable set of $G$. A graph $G$ is called a \emph{threshold} graph if $G$ is a split graph and there is an ordering of $V_1$ (resp. $V_2$), named \emph{threshold ordering}, such that the neighborhood of vertices of $V_1$ (resp. $V_2$) are ordered by inclusion, that is, if $u$ precedes $v$ in the threshold ordering, $N[u] \subseteq N[v]$ (resp. $N(u) \subseteq N(v)$). For the following characterization, we will define the split graph $S_G(V_1,V_2)$ with respect to a bipartition $(V_1,V_2)$ of a graph $G$. Such a graph is obtained from $G$ by the completion of edges among the vertices of $V_1$ and the removal of all edges among the vertices of $V_2$, hence transforming $V_1$ into a clique and $V_2$ into a stable set. The Figures~\ref{fig:b} and~\ref{fig:d} illustrate the corresponding split graphs of the graphs in the Figures~\ref{fig:a} and~\ref{fig:c}, respectively. Let $s = s_1s_2$ be an ordering of $V(G)$. We define $(s_1,s_2)$ as \emph{in accordance} with $G$ if $s_1$ is a threshold ordering of $S_G(V(s_1),V(s_2))$, and if $s_1$ and $s_2$ are canonical orderings of $G[V(s_1)]$ and $G[V(s_2)]$, respectively. Additionally, we define $(s_1,s_2)$ as \emph{strongly in accordance} with $G$ if $s_1$ and $s_2$ are proper canonical orderings of $G[V(s_1)]$ and $G[V(s_2)]$, respectively, and both $s_1$ and $\bar{s_2}$ are threshold orderings of $S_G(V(s_1),V(s_2))$. As an example, let $s_1$ and $s_2$ be the orderings represented in the Figure~\ref{fig:abcd} by reading the vertices of each part, of each graph, from left to right. The related pair $(s_1,s_2)$ of Figure~\ref{fig:a} is in accordance, but is not strongly in accordance, with the given graph. In the order hand, Figure~\ref{fig:c} depicts a pair $(s_1$,$s_2)$ which is strongly in accordance with the associated graph. Finally, Figure~\ref{fig:e} exemplifies a case where the given orderings are neither in accordance or strongly in accordance with its correlated graph. In fact, since both $V_1$ and $V_2$ in Figure~\ref{fig:e} induce subgraphs that admit only four canonical orderings each, it can be easily verified that there is no $(s_1, s_2)$ which is in accordance, or strongly in accordance, with the graph. \begin{figure}[htb] \centering \subfigure[$G_1$]{\label{fig:a}\includegraphics[width=30mm]{figures/characterization/exemplo2FPraw.pdf}}\hfil \subfigure[$S_{G_1}(V_1,V_2)$]{\label{fig:b}\includegraphics[width=30mm]{figures/characterization/exemploS2FP.pdf}}\hfil \\ \subfigure[$G_2$]{\label{fig:c}\includegraphics[width=30mm]{figures/characterization/exemplo2FPPraw.pdf}}\hfil \subfigure[$S_{G_2}(V_1,V_2)$]{\label{fig:d}\includegraphics[width=30mm]{figures/characterization/exemploS2FPP.pdf}}\hfil \\ \subfigure[$G_3$]{\label{fig:e}\includegraphics[width=30mm]{figures/characterization/exemploN2FPPraw.pdf}}\hfil \subfigure[$S_{G_3}(V_1,V_2)$]{\label{fig:f}\includegraphics[width=30mm]{figures/characterization/exemploSN2FPP.pdf}} \caption{Corresponding split graphs ($V_1$ is the set of orange vertices and $V_2$ the black ones).} \label{fig:abcd} \end{figure} \vspace{.2cm} \begin{lemma} \label{lem:2pt} Let $G$ be a graph. Then, $G$ is \fp{2} if, and only if, there is a consistent ordering $s = s_1s_2$ for which $\mathcal{V}=(V(s_1),V(s_2))$ is a bipartition of $V(G)$ such that $(s_1,s_2)$ is in accordance with $G$. \end{lemma} \begin{proof} Let $\mathcal{V} = \{V_1, V_2\}$ be a bipartition of $V(G)$ and $s_1$ and $s_2$ be two total orderings of $V_1$ and $V_2$, respectively. Consider $G$ is \fp{2} concerning $\mathcal{V}$. Let $s=s_1s_2$ be a precedence consistent ordering of $V(G)$. Thus, $s_1$ is a canonical ordering of $G[V_1]$. Suppose by absurd that $s_1$ is not a threshold ordering of $S_G(V_1,V_2)$. That is, there are $u,v \in V_1$ and $w \in V_2$, with $u<v$ in $s_1$, such that $w \in N[u]$ and $w \not\in N[v]$. As $u<v<w$ em $s$, there is a contradiction with the fact that $s$ is a precedence consistent ordering of $V(G)$. Therefore, $(s_1,s_2)$ is in accordance with $G(V_1,V_2)$. On the other hand, consider that $(s_1,s_2)$ is in accordance with $G$. Thus, both $s_1$ and $s_2$ are canonical orderings of $G[V_1]$ and $G[V_2]$, respectively, and $s_1$ is a threshold ordering of $S_G(V_1,V_2)$. Now we prove that $s=s_1s_2$ is a precedence consistent ordering of $V(G)$ concerning $\mathcal{V}$. Suppose by absurd that this statement does not hold. That is, there are $u,v \in V_1$ and $w \in V_2$, with $u < v$ in $s$, such that $(u,w) \in E(G)$ and $(v,w) \notin E(G)$. This is a contradiction with the fact that $s_1$ is a threshold ordering ordering of $S_G(V_1,V_2)$. Hence, $s=s_1s_2$ is a precedence consistent ordering of $V(G)$ concerning $\mathcal{V}$. \end{proof} \begin{lemma}\label{lem:2ppt} Let $G$ be a graph. Then, $G$ is \fpp{2} if, and only if, there is a strongly consistent ordering $s = s_1s_2$ for which $\mathcal{V}=(V(s_1),V(s_2))$ is a bipartition of $V(G)$ such that $(s_1,s_2)$ is strongly in accordance with $G$. \end{lemma} \begin{proof} Let $\mathcal{V} = \{V_1, V_2\}$ be a bipartition of $V(G)$ and $s_1$ and $s_2$ be two total orderings of $V_1$ and $V_2$, respectively. Consider $G$ is \fpp{2} concerning $\mathcal{V}$. Let $s=s_1s_2$ be a precedence strongly consistent ordering of $V(G)$. Thus, $s_1$ is a proper canonical ordering of $G[V_1]$ and, as $G$ is also a \fp{2} graph, $s_1$ is a threshold ordering of $S_G(V_1,V_2)$, according Lemma~\ref{lem:2pt}. Suppose by absurd that $\bar{s_2}$ is not a threshold ordering of $S_G(V_1,V_2)$. That is, there are $u,v \in V_2$ and $w \in V_1$, with $u<v$ in $s_2$, such that $w\in N(v)$ e $w\not\in N(u)$. That is, a contradiction with the fact that $s$ is a precedence strongly consistent ordering, as $w < u < v$ in $s$. Hence, $(s_1,s_2)$ is strongly in accordance with $G(V_1,V_2)$. Now consider ($s_1$,$s_2$) is strongly in accordance with $G$. That is, both $s_1$ and $\bar{s_2}$ (resp. $s_1$ and $s_2$) are threshold orderings (proper canonical orderings) of $S_G(V_1,V_2)$ (resp. $G[V_1]$ and $G[V_2]$, respectively). By Lemma~\ref{lem:2pt}, $s=s_1s_2$ is a precedence consistent ordering of $V(G)$. Next, we prove that $s=s_1s_2$ is also a precedence strongly consistent ordering of $V(G)$ concerning $\mathcal{V}$. For the sake of contradiction, suppose that the statement does not hold. That is, there are $u,v \in V_2$ and $w \in V_1$, with $u < v$ in $s$, such that $(v,w) \in E(G)$ and $(u,w) \notin E(G)$. This is an absurd, as $\bar{s_2}$ is a threshold ordering ordering of $S_G(V_1,V_2)$. Consequently, $s=s_1s_2$ is a precedence strongly consistent ordering of $V(G)$ concerning $\mathcal{V}$. \end{proof} The above lemmas can be generalized to an arbitrary number of parts as follows. \begin{theorem}\label{teo:kppt} Let $G$ be a graph. For all $k > 2$, $G$ is \fp{k} (resp. \fpp{k}) if, and only if, there is a precedence consistent (resp. strongly consistent) ordering $s = s_1 \ldots s_k$ for which $\mathcal{V}=(V(s_1),V(s_2)),\ldots,V(s_k))$ is a $k$-partition of $V(G)$ such that for all $1 \leq i<j \leq k$, $(s_i,s_j)$ is in accordance (resp. strongly in accordance) with $G[V(s_i) \cup V(s_j)]$. \end{theorem} \begin{proof} Suppose there are a total ordering $s = s_1 \ldots s_k$ and a partition $\mathcal{V}=(V(s_1),V(s_2)),\ldots,V(s_k))$ of $V(G)$. Notice that $s$ is a precedence consistent (resp. strongly consistent) ordering if, and only if, for all $1 \leq i < j \leq k$, $s_i s_j$ is a precedence consistent (resp. strongly consistent) ordering of $G[V_i \cup V_j]$ concerning the bipartition $(V_i, V_j)$. By Lemma~\ref{lem:2pt} (resp. Lemma~\ref{lem:2ppt}), it holds if, and only if, $(s_i,s_j)$ is in accordance (resp. strongly in accordance) with $G[V(s_i) \cup V(s_j)]$. \end{proof} \section{Conclusions and open problems}\label{chpt:future} In this work, we study two classes of graphs: \fpExt{k} and \fppExt{k} graphs, subclasses of $k$-thin and proper $k$-thin graphs, respectively. Concerning \fpExt{k} graphs, we present a polynomial time algorithm that receives as input a graph $G$ and a $k$-partition of $V(G)$ and decides whether $G$ is a precedence $k$-thin graph with respect to the given partition. This result is presented in Section~\ref{chpt:pthinness}. Regarding \fppExt{k} graphs, for the same input, we prove that if $k$ is a fixed value, then it is possible to decide whether $G$ is a precedence proper $k$-thin graph with respect to the given partition in polynomial time. For variable $k$, the related recognition problem is \textsf{NP}-complete. These results are presented in Section~\ref{chpt:ppthinness}. Also, using threshold graphs, we characterize both \fpExt{k} and \fppExt{k} graphs. Concerning the classes defined in this paper, some open questions are highlighted: \begin{itemize} \item Given a graph $G$, what is the complexity of evaluating \fpPar{G} and \fppPar{G}? \item Given a graph $G$ and an integer $k$, what is the complexity of determining if \fpPar{G}, or \fppPar{G}, is at most $k$? \item How do \fpPar{G} and \fppPar{G} relate to $thin(G)$ and $pthin(G)$, respectively? \item Is it possible to extend the results of this paper to consider other types of orderings (partial orders) and restrictions? \end{itemize} \section{Introduction}\label{chpt:introduction} The class of $k$-thin graphs has recently been introduced by Mannino, Oriolo, Ricci and Chandran in~\cite{Carl07} as a generalization of interval graphs. Motivated by this work, Bonomo and de Estrada~\cite{Bono18} defined the class of proper $k$-thin graphs, which generalizes proper interval graphs. A \emph{$k$-thin graph} $G$ is a graph for which there is a $k$-partition $(V_1,V_2 \ldots, V_k)$, and an ordering $s$ of $V(G)$ such that, for any triple $(p,q,r)$ of $V(G)$ ordered according to $s$, if $p$ and $q$ are in a same part $V_i$ and $(p,r) \in E(G)$, then $(q,r)\in E(G)$. Such an ordering and partition are said to be \emph{consistent}. A graph $G$ is called a \emph{proper $k$-thin graph} if $V(G)$ admits a $k$-partition $(V_1, \ldots, V_k)$, and an ordering $s$ of $V(G)$ such that both $s$ and its reversal are consistent with the partition $(V_1, \ldots,V_k)$. An ordering of this type is said to be a \emph{strongly consistent} ordering. The interest on the study of both these classes comes from the fact that some \textsf{NP}-complete problems can be solved in polynomial time when the input graphs belong to them~\cite{Carl07,Bono18,B-M-O-thin-tcs}. Some of those efficient solutions have been exploited to solve real world problems as presented in~\cite{Carl07}. On a theoretical perspective, defining general graphs in terms of the concept of interval graphs has been of recurring interest in the literature. Firstly, note that these concepts measure ``how far'' a given graph $G$ is from being an interval graph, or yet, how $G$ can be ``divided'' into interval graphs, mutually bonded by a vertex order property. Namely, the vertices can be both partitioned and ordered in such a way that, for every part $V'$ of the partition and every vertex $v$ of the ordering, the vertex ordering obtained from the original by the removal of all vertices except from $v$ and those in $V'$ that precede $v$, no matter which part $v$ belongs, is a canonical ordering of an interval graph. Characterizing general graphs in terms of the concept of interval graphs, or proper interval graphs, is not new. A motivation for such an approach is that the class of interval graphs is well-known, having several hundreds of research studies on an array of different problems on the class, and formulating general graphs as a function of interval graphs is a way to extend those studies to general graphs. Given that, both $k$-thin and proper $k$-thin graphs are new generalizations of this kind. The complexity of recognizing whether a graph is $k$-thin, or proper $k$-thin, is still an open problem even for a fixed $k \geq 2$. For a given vertex ordering, there are polynomial time algorithms that compute a partition into a minimum number of classes for which the ordering is consistent (resp. strongly consistent)~\cite{Bono18,B-M-O-thin-tcs}. On the other hand, given a vertex partition, the problem of deciding the existence of a vertex ordering which is consistent (resp. strongly consistent) with that partition is \textsf{NP}-complete~\cite{Bono18}. Other generalizations of interval graphs have been proposed. As examples, we may cite the $k$-interval and $k$-track interval graphs. A \emph{$k$-interval} is the union of $k$ disjoint intervals on the real line. A \emph{$k$-interval graph} is the intersection graph of a family of $k$-intervals. Therefore, the $k$-interval graphs generalize the concept of interval graphs by allowing a vertex to be associated with a set of disjoint intervals. The \emph{interval number} $i(G)$ of $G$~\cite{Trotter1979OnDA} is the smallest number $k$ for which $G$ has a $k$-interval model. Clearly, interval graphs are the graphs with $i(G) = 1$. A \emph{$k$-track interval} is the union of $k$ disjoint intervals distributed in $k$ parallel lines, where each interval belongs to a distinct line. Those lines are called \emph{tracks}. A \emph{$k$-track interval graph} is the intersection graph of $k$-track intervals. The \emph{multitrack number} $t(G)$ of $G$~\cite{Kumar94,Gyarfas95} is the minimum $k$ such that $G$ is a $k$-track interval graph. Interval graphs are equivalent to the $1$-interval graphs and $1$-track interval graphs. The problems of recognizing $k$-interval and $k$-track interval graphs are both \textsf{NP}-complete~\cite{West84,Jiang2013}, for every $k \geq 2$. In this paper, we define subclasses of $k$-thin and proper $k$-thin graphs called \emph{\fpExt{k}} and \emph{\fppExt{k}} graphs, respectively, by adding the requirement that the vertices of each class have to be consecutive in the order. In both cases, when the vertex order is given, it can be proved that a greedy algorithm can be used to find a (strongly) consistent partition into consecutive sets with minimum number of parts. When, instead, the partition into $k$ parts is given, the problem turns out to be more interesting. We will call \emph{partitioned \fpExt{k} graphs} (resp. \emph{partitioned \fppExt{k} graphs}) the graphs for which there exists a (strongly) consistent vertex ordering in which the vertices of each part are consecutive for the given partition. Concerning partitioned \fpExt{k} graphs, we present a polynomial time recognition algorithm. With respect to partitioned \fppExt{k} graphs, we provide a proof of \textsf{NP}-completeness for arbitrary $k$, and a polynomial time algorithm when $k$ is fixed. Also, we provide a characterization for both classes based on threshold graphs. This work is organized as follows. Section~\ref{chpt:preliminaries} introduces the basic concepts and terminology employed throughout the text. Section~\ref{chpt:pthinness} presents a polynomial time recognition algorithm for partitioned \fpExt{k} graphs. Section~\ref{chpt:ppthinness} proves the \textsf{NP}-completeness for the recognition problem of partitioned \fppExt{k} graphs. Moreover, it proves that if the number of parts of the partition is fixed, then the problem is solvable in polynomial time. In Section~\ref{chpt:characterization}, we describe a characterization for \fpExt{k} and \fppExt{k} graphs. Finally, Section~\ref{chpt:future} presents some concluding remarks. \section{Literature Review on Thinness in Graphs}\label{chpt:literature:review} In this section, we present a literature review concerning thinness in graphs. Since the subject has very recently been introduced, this review is mainly based on that presented in~\cite{Bono18} and the results presented in there. Firstly, we show how the thinness compares to other graph parameters. The first parameter is the boxicity~\cite{roberts69Box}. The \emph{boxicity} of a graph $G$, or \emph{$box(G)$}, consists of the smallest integer $k$ for which $G$ is a intersection graph on the family of axis-parallel boxes in a $k$-dimensional space. In~\cite{Mannino_theindependent} it was proved that $box(G) \leq thin(G)$. Also, in the same work, it was noted that this bound is not tight due to the fact that the $(r \times r)$-grid has thinness $\Theta(n)$ and boxicity $2$. A sequence $X_1 , \ldots, X_r$ of subsets of $V(G)$ is a \emph{path decomposition} of $G$ if the following conditions are satisfied: \begin{itemize} \item for every $e\in E(G)$, some $X_i$, $1 \leq i \leq r$, contains both ends of $e$; \item for $1 \leq i \leq i' \leq i'' \leq r$, $X_i \cap X_{i''} \subseteq X_{i'}$. \end{itemize} The \emph{pathwidth}~\cite{pathwidth83} of a graph $G$, or \emph{$pathw(G)$}, is the minimum value of $k \geq 0$ such that $G$ has a path decomposition $X_1 , \ldots, X_r$ with $|X_i| \leq k+ 1$, $1 \leq i \leq r$. In~\cite{Carl07}, it is shown that $thin(G) \leq pathw(G)+1$. Moreover, it shows that the difference between these parameters may be arbitrarily large since $pathw(K_n) = n-1$ and $thin(K_n) = 1$. The \emph{linear MIM-width} of $G$ c.f.~\cite{Bono18}, denoted by \emph{$lmimw(G)$}, is the smallest integer $k$ such that $V(G)$ can be arranged in a linear layout $v_1, \ldots, v_n$ in such a way that, for all $1 \leq i \leq n-1$, the size of the maximum induced matching of $G[E']$ is $k$, where $E'= \{(u,v)\in E(G) \mid u\in\{v_1, \ldots, v_i\}\text{ and } v\in\{v_{i+1}, \ldots, v_n\}\}$. In~\cite{Bono18}, it is proved that $lmimw(G) \leq thin(G)$. The \emph{cutwidth} of a graph $G$, or \emph{$cutw(G)$}, is the smallest integer $k$ such that $V(G)$ can be arranged in a linear layout $v_1, \ldots, v_n$ in such a way that, for all $1\leq i \leq n-1$, there are at most $k$ edges with one endpoint in $\{v_1,\ldots,v_i\}$ and the other in $\{v_{i+1},\ldots,v_n\}$. In~\cite{Bono18}, it is proved that the layout related to the cutwidth leads to a $(cutw(G)+1)$-partition of $V(G)$ for which there is a consistent ordering. Consequently, $thin(G) \leq cutw(G)+1$. The \emph{vertex isoperimetric peak} of $G$ c.f.~\cite{Bono18}, or \emph{$b_v(G)$}, is defined as $$\max_s \min_{X \subset V,|X|=s} |N(X)|$$. In~\cite{Mannino_theindependent}, it is proved that $thin(G) \geq \frac{b_v(G)}{\Delta (G)}$. We define $f$ as a \emph{t-rainbow dominating function} of a graph $G$ if it assigns a subset $f(v)$ of $\{1, \ldots , t\}$ to each $v \in V(G)$ such that $\bigcup_{u \in N(v)} f(u) = \{1, \ldots , t\}$ for all $v$ with $f(v) = \emptyset$. The \emph{$t$-rainbow domination problem} consists in determining a $t$-rainbow dominating function that minimizes $\sum_{v\in V(G)}|f(v)|$. Regarding the thinness of graphs resulting from graph operations, in~\cite{Bono18}, it is shown some result relating the (proper) thinness of the resulting graph to the (proper) thinness of the graphs under operation. Let $G_1$ and $G_2$ be graphs such that $V(G_1) \cap V(G_2) = \emptyset$. It was proved that: \begin{itemize} \item $thin(G_1\; \cup \; G_2) = \max\{thin(G_1),thin(G_2)\}$ \item If $G_2$ is complete, then $\thin(G_1\; \vee \; G_2) = \thin(G_1)$. Otherwise, $\thin(G\; \vee \; 2K_1) = \thin(G)+1$ and $\thin(G_1\; \vee \; G_2) \leq \thin(G_1)+\thin(G_2)$. \item $thin(G_1 \; \square \; G_2) \leq thin(G_1)|V(G_2)|$ \end{itemize} All these results also hold for proper thinness. In special, the last result was employed to solve the $t$-rainbow domination problem in graphs with bounded thinness, for a fixed $t$. Given an interval graph $G$, the \emph{interval count} $IC(G)$ of $G$~\cite{Leibowitz78,ceriolisurvey} is the minimum number of distinct interval lengths needed to an interval model of $G$. An interval graph $G$ is said to be a \emph{$k$-length interval} graph if $IC(G) \leq k$. An interval graph $G$ is a \emph{$k$-nested}~\cite{Klavik2019} graph if it has a model in which no $k+1$ intervals can be linearly ordered by set inclusion. The class of $k$-length graphs is a subclass of $k$-nested graphs. Let $\overline{tK_2}$ be the complement of a matching of size $t$. We now present results concerning graph classes in general. In~\cite{Carl07}, it was shown that $thin(\overline{tK_2}) = t$, for all $t \geq 1$. In~\cite{Bono18}, it is proved the following results. For the class of interval graphs, the proper thinness parameter is unbounded. For a given cograph $G$, $thin(G) \leq t$ if, and only if, $G$ does not contains $\overline{(t+1)K_2}$ as an induced subgraph. The thinness of a complete $m$-ary tree is $\Theta(\log n)$. Considering other generalizations based on interval graphs, $k$-nested interval graphs are proper $k$-thin but, for $k \geq 3$, there are proper $3$-thin graphs that are not $k$-nested interval graphs. Also in~\cite{Bono18}, it is presented an efficient algorithm to determine the minimum partition of $V(G)$ for which a given vertex ordering is (strongly) consistent. Moreover, it is proved that the problem of determining the existence of a (strongly) consistent ordering for a given partition of $V(G)$ with an arbitrary number of parts is $NP$-complete. Besides that, the problem of determining the existence of a (strongly) consistent ordering for a given partition of $V(G)$ with an fixed number of parts is open. In general, even for a fixed $k \geq 2$, the complexity of deciding whether a graph is (proper) $k$-thin is still open. Additionally, a characterization based on forbidden subgraphs, for all $k\geq 2$, is also open. \section{Precedence Proper Thinness for a Given Partition}\label{chpt:ppthinness} In this section, we discuss precedence proper thinness for a given partition. First, we prove that this problem is \textsf{NP}-complete for an arbitrary number of parts. Then, we propose a polynomial time algorithm for a fixed number of parts based on the one presented in Section~\ref{chpt:pthinness}. Formally, we will prove that the following problem is \textsf{NP}-complete. \begin{flushleft} \begin{tabular}{ l l } \hline \textbf{\textsc{Problem}:} & \textsc{Partitioned \fpp{k}} (Recognition of \fpp{k} graphs for a given\\ & partition)\\ \textbf{\textsc{Input}:} & A natural $k$, a graph $G$ and a partition $(V_1,\ldots,V_k)$ of $V(G)$.\\ \textbf{\textsc{Question}:} & Is there a strongly consistent ordering $s$ of $V(G)$ such that the\\& vertices of $V_i$ are consecutive in $s$, for all $1 \leq i \leq k$?\\ \hline \end{tabular} \end{flushleft} The \textsf{NP}-hardness of the previous problem is accomplished by a reduction from the problem \textsc{Not all equal 3-SAT}, which is \textsf{NP}-complete~\cite{Schaefer1978b}. The details are described in Theorem~\ref{theo:npc:ppthinness}. \begin{flushleft} \begin{tabular}{ l l } \hline \textbf{\textsc{Problem}:} & \textsc{Not all equal 3-SAT}\\ \textbf{\textsc{Input}:} & A formula $\varphi$ on variables $x_1,\dots, x_r$ in conjunctive normal form,\\& with clauses ${\mathcal C}_1, \dots, {\mathcal C}_s$, where each clause has exactly three lite-\\&rals.\\ \textbf{\textsc{Question}:} & Is there a truth assignment for $x_1,\dots, x_r$ such that each clause \\&${\mathcal C}_i$, $i = 1, \dots, s$, has at least one true literal and at least one fal-\\&se literal? \\ \hline \end{tabular} \end{flushleft} \begin{theorem}\label{theo:npc:ppthinness} Recognition of \fpp{k} graphs for a given partition is \textsf{NP}-complete, even if the size of each part is at most 2. \end{theorem} \begin{proof} A given precedence strongly consistent ordering for the partition of $V(G)$ can be easily verified in polynomial time. Therefore, this problem is in \textsf{NP}. Given an instance $\varphi$ of \textsc{Not all equal 3-SAT}, we define a graph $G$ and a partition of $V(G)$ in which each part has size at most two. The graph $G$ is defined in such a way that $\varphi$ is satisfiable if, and only if, there is a precedence strongly consistent ordering of $V(G)$ for the partition. The graph $G$ is constructed as follows. For each variable $x_i$ appearing in the clause ${\mathcal C}_j$, create the part $$X_{ij} = \{x_{ij}^T,x_{ij}^F\}$$ For each variable $x_i$, create the parts $$X_{i}^T = \{x_{i}^T\} \mbox{ and } X_{i}^F = \{x_{i}^F\}$$ The edges of the graph between these parts are $(x_i^T, x_{ij}^T)$ and $(x_i^F, x_{ij}^F)$ for every $i,j$ such that variable $x_i$ appears in clause ${\mathcal C}_j$. Notice that in any strongly consistent ordering, part $X_{ij}$ must be between parts $X_i^F$ and $X_i^T$. Moreover, if $x_i^F < x_i^T$, then $x_{ij}^F < x_{ij}^T$, and conversely. In particular, in any valid vertex order, for each $i \in \{1, \dots, r\}$, either $x_{ij}^F < x_{ij}^T$ for every $j \in \{1, \dots, s\}$ or $x_{ij}^T < x_{ij}^F$ for every $j \in \{1, \dots, s\}$. The \textsc{Partitioned \fpp{k}} instance will be such that if there is a precedence strongly consistent ordering for the vertices with respect to the given parts, then the assignment $x_i = (x_i^F < x_i^T)$ (that is, $x_i$ is true if $x_i^F$ precedes $x_i^T$ in such an ordering and $x_i$ is false otherwise) satisfies $\varphi$ in the context of \textsc{Not all equal 3-SAT} and, conversely, if there is a truth assignment satisfying $\varphi$ in that context, then there exists a strongly consistent ordering for the \textsc{Partitioned \fpp{k}} instance in which $x_i^F < x_i^T$ if $x_i$ is true and $x_i^T < x_i^F$ otherwise. In what follows, if the $k$-th literal $\ell_{ij}$ of ${\mathcal C}_j$ is the variable $x_i$ (resp. $\neg x_i$), we denote by $O_{ij}$ the ordered part $\{x_{ij}^F,x_{ij}^T\}$ (resp. $\{x_{ij}^T,x_{ij}^F\}$). Given a 2-vertex ordered part $C$, we denote by $C^1$ and $C^2$ the first and second elements of $C$. By $\pm C$, we denote ``either $C$ or $\bar C$''. For each clause ${\mathcal C}_j = \ell_{1j} \vee \ell_{2j} \vee \ell_{3j}$, we add the 2-vertex ordered parts $Y_{1j}$, $Y_{2j}$, and $Y_{3j}$, and the edges $(O_{1j}^2,Y_{1j}^1)$, $(O_{1j}^1,Y_{2j}^1)$, $(O_{1j}^2,Y_{2j}^1)$, $(O_{2j}^1,Y_{1j}^2)$, $(O_{2j}^1,Y_{1j}^1)$, $(O_{2j}^2,Y_{2j}^1)$, $(O_{2j}^2,Y_{2j}^2)$, $(O_{2j}^1,Y_{3j}^1)$, $(O_{2j}^1,Y_{3j}^2)$, $(O_{3j}^1,Y_{1j}^2)$, $(O_{3j}^2,Y_{1j}^2)$, $(O_{3j}^1,Y_{2j}^2)$, $(O_{3j}^2,Y_{2j}^2)$, $(O_{3j}^2,Y_{3j}^1)$, $(O_{3j}^2,Y_{3j}^2)$. These edges ensure the following properties in every strongly consistent ordering of the graph with respect to the defined partition. \begin{enumerate} \item\label{it:1} Since $(O_{1j}^2,Y_{1j}^1)$ is the only edge between $O_{1j}$ and $Y_{1j}$, their only possible relative positions are $O_{1j}<Y_{1j}$ and its reverse $\bar Y_{1j}<\bar O_{1j}$. \item\label{it:2} Since $(O_{1j}^1,Y_{2j}^1)$ and $(O_{1j}^2,Y_{2j}^1)$ are the edges between $O_{1j}$ and $Y_{2j}$, their possible relative positions are $\pm O_{1j}<Y_{2j}$ and $\bar Y_{2j}<\pm O_{1j}$. \item\label{it:3} Since $(O_{2j}^1,Y_{1j}^1)$ and $(O_{2j}^1,Y_{1j}^2)$ are the edges between $O_{2j}$ and $Y_{1j}$, their possible relative positions are $\bar O_{2j}<\pm Y_{1j}$ and $\pm Y_{1j}<O_{2j}$. \item\label{it:4} Since $(O_{2j}^2,Y_{2j}^1)$ and $(O_{2j}^2,Y_{2j}^2)$ are the edges between $O_{2j}$ and $Y_{2j}$, their possible relative positions are $O_{2j}<\pm Y_{2j}$ and $\pm Y_{2j}<\bar O_{2j}$. \item\label{it:5} Since $(O_{2j}^1,Y_{3j}^1)$ and $(O_{2j}^1,Y_{3j}^2)$ are the edges between $O_{2j}$ and $Y_{3j}$, their possible relative positions are $\bar O_{2j}<\pm Y_{3j}$ and $\pm Y_{3j}<O_{2j}$. \item\label{it:6} Since $(O_{3j}^1,Y_{1j}^2)$ and $(O_{3j}^2,Y_{1j}^2)$ are the edges between $O_{3j}$ and $Y_{1j}$, their possible relative positions are $\pm O_{3j}<\bar Y_{1j}$ and $Y_{1j}<\pm O_{3j}$. \item\label{it:7} Since $(O_{3j}^1,Y_{2j}^2)$ and $(O_{3j}^2,Y_{2j}^2)$ are the edges between $O_{3j}$ and $Y_{2j}$, their possible relative positions are $\pm O_{3j}<\bar Y_{2j}$ and $Y_{2j}<\pm O_{3j}$. \item\label{it:8} Since $(O_{3j}^2,Y_{3j}^1)$ and $(O_{3j}^2,Y_{3j}^2)$ are the edges between $O_{3j}$ and $Y_{3j}$, their possible relative positions are $O_{3j}<\pm Y_{3j}$ and $\pm Y_{3j}<\bar O_{3j}$. \end{enumerate} Notice that, by items \ref{it:1} and \ref{it:6} (resp. \ref{it:2} and \ref{it:7}), the vertices of $Y_{1j}$ (resp. $Y_{2j}$) are forced to lie between those of $O_{1j}$ and those of $O_{3j}$. More precisely, the possible valid orders are $O_{1j}<Y_{1j},Y_{2j}<\pm O_{3j}$ and their reverses $\pm O_{3j}<\bar Y_{2j} , \bar Y_{1j}<\bar O_{1j}$. By items \ref{it:3} and \ref{it:4}, the vertices of $O_{2j}$ are forced to be between those of $Y_{1j}$ and those of $Y_{2j}$. More precisely, the possible valid orders are $\pm Y_{1j}<O_{2j}<\pm Y_{2j}$ and their reverses $\pm Y_{2j}<\bar O_{2j}<\pm Y_{1j}$. By items \ref{it:3} and \ref{it:5}, the vertices of $Y_{1j}$ and $Y_{3j}$ are forced to be on the same side with respect to the vertices of $O_{2j}$, either $\bar O_{2j}<\pm Y_{1j},\pm Y_{3j}$ or $\pm Y_{1j}, \pm Y_{3j}<O_{2j}$. Hence, taking also into account item \ref{it:8}, the possible valid orders are \begin{itemize} \item $O_{1j}<Y_{1j}, \pm Y_{3j} < O_{2j}<Y_{2j}<\bar O_{3j}$ \item $O_{1j}<Y_{2j}<\bar O_{2j}<Y_{1j} , \pm Y_{3j}<\bar O_{3j}$ \item $O_{1j}<Y_{2j}<\bar O_{2j}<Y_{1j}<O_{3j}<\pm Y_{3j}$ \end{itemize} and their reverses, \begin{itemize} \item $O_{3j}<\bar Y_{2j}<\bar O_{2j}<\bar Y_{1j} , \pm Y_{3j}<\bar O_{1j}$ \item $O_{3j}<\bar Y_{1j} , \pm Y_{3j}<O_{2j}<\bar Y_{2j}<\bar O_{1j}$ \item $\pm Y_{3j}<\bar O_{3j}<\bar Y_{1j}<O_{2j}<\bar Y_{2j}<\bar O_{1j}$ \end{itemize} and will correspond to truth assignments that make true, respectively, \begin{enumerate}[a)] \item $\ell_{1j} \wedge \ell_{j2} \wedge \neg \ell_{3j}$ \item $\ell_{1j} \wedge \neg \ell_{2j} \wedge \neg \ell_{3j}$ \item $\ell_{1j} \wedge \neg \ell_{2j} \wedge \ell_{3j}$ \item $\neg \ell_{1j} \wedge \neg \ell_{2j} \wedge \ell_{3j}$ \item $\neg \ell_{1j} \wedge \ell_{2j} \wedge \ell_{3j}$ \item $\neg \ell_{1j} \wedge \ell_{2j} \wedge \neg \ell_{3j}$ \end{enumerate} Suppose first that there is a precedence strongly consistent ordering of $V(G)$ with respect to its vertex partition. Define a truth assignment for variables $x_1, \dots, x_r$ as $x_i = (x_i^F < x_i^T)$, for $i \in \{1, \dots, r\}$. As observed above, if the value of $x_i$ is true (resp. false), then for every $j \in \{1, \dots, s\}$, the part $X_{ij}$ is ordered $x_{ij}^F$ $x_{ij}^T$ (resp. $x_{ij}^T$ $x_{ij}^F$). So, for each clause ${\mathcal C}_j$, the part corresponding to its $k$-th literal will be ordered as $O_{kj}$ if the literal is assigned true and as $\bar O_{kj}$ if the literal is assigned false. Since for each valid order of the vertices there exist $k, k' \in \{1,2,3\}$ such that the part corresponding to the $k$-th literal is ordered $O_{kj}$ and the part corresponding to the $k'$-th literal is ordered $\bar O_{k'j}$, the truth assignment satisfies the instance $\varphi$ of \textsc{Not all equal 3-SAT}. Suppose now that there is a truth assignment for variables $x_1, \dots, x_r$ that satisfies the instance $\varphi$ of \textsc{Not all equal 3-SAT}. Define the order of the vertices in the following way. The first $r$ vertices are $\{x_i^F : x_i \mbox{ is true}\} \cup \{x_i^T : x_i \mbox{ is false}\}$, and the last $r$ vertices are $\{x_i^T : x_i \mbox{ is true}\} \cup \{x_i^F : x_i \mbox{ is false}\}$. Between these first and last $r$ vertices, place all the parts $X_{ij}$, $Y_{1j}$,$Y_{2j}$ and $Y_{3j}$ associated with each clause $\mathcal{C}_j$, $j=1,\dots,s$. In particular, the parts $X_{ij}$, $Y_{1j}$, $Y_{2j}$ and $Y_{3j}$ are ordered accordingly to which of the conditions (a)--(f) is satisfied. By the analysis above, this is a precedence strongly consistent ordering of the vertices of $G$, with respect to the defined parts. As an example, Figure~\ref{fig:ppthinnes:npc:instance} depicts the instance of the \textsc{Partitioned \fpp{k}} problem built from the instance $\varphi = \{(x_1\wedge x_2 \wedge x_3)\}$ of \textsc{Not all equal 3-SAT} problem. \end{proof} \begin{figure}[htbp] \centering \includegraphics[width=80mm]{figures/ppthinness/qualiNPcInstance.pdf} \caption{ Instance of the \textsc{Partitioned \fpp{k}} problem built from the instance $\varphi = \{(x_1\wedge x_2 \wedge x_3)\}$ of \textsc{Not all equal 3-SAT} problem.} \label{fig:ppthinnes:npc:instance} \end{figure} The remaining of this section is dedicated to discuss a polynomial time solution to a variation of the \textsc{Partitioned \fpp{k}} problem. This variation consists in considering a fixed number of parts for $V(G)$, that is, $k$ is removed from the input and taken as a constant for the problem. The strategy that will be adopted is the same used for \textsc{Partitioned \fp{k}} problem. It is not difficult to see that Property~\ref{prop:thinness} is not sufficient to describe the requirements that must be imposed in the ordering of vertices in a precedence strongly consistent ordering. This is so because, unlike what occurs in a precedence consistent ordering, in a precedence strongly consistent ordering the vertices of each part $V_i$ may impose an ordering to vertices that belong to parts that precede and succeed $V_i$. Given this fact, we observe the following property to describe such relation. \begin{property}\label{prop:pthinness} Let $(V_1,V_2, \ldots, V_k)$ be a partition of $V(G)$, $s$ a precedence strongly consistent ordering and $1 \leq i , j \leq k$. If $V_i$ precedes $V_j$ in $s$, then for all $u,v \in V_i$ and $w \in V_j$, if $(u,w) \not\in E(G)$ and $(v,w) \in E(G)$, then $u$ precedes $v$ in $s$. Moreover, for all $u \in V_i$ and $w,x \in V_j$, if $(u,w) \not\in E(G)$ and $(u,x) \in E(G)$, then $x$ precedes $w$ in $s$ \end{property} \begin{figure}[htbp] \centering \includegraphics[width=80mm]{figures/ppthinness/qualiPropPThin.pdf} \caption{Precedence relations among the vertices in a precedence strongly consistent ordering.} \label{fig:propthinness} \end{figure} Notice that the greedy strategy used in Section~\ref{chpt:pthinness} does not work in the problem being considered. This is so because, according to Property~\ref{prop:pthinness} and visually depicted in Figure~\ref{fig:propthinness}, the ordering of vertices of $V_i$ in a precedence strongly consistent ordering $s$ is influenced by both the parts that precede and succeed $V_i$ in $s$. Despite this, the method described in the Section~\ref{chpt:pthinness} to validate whether a part can precede a set of parts is also useful to present a solution to this problem. Let $G$ be a graph, $\mathcal{V} =(V_1,V_2, \ldots, V_k)$ a partition of $V(G)$ and $s$ a precedence strongly consistent ordering of $V(G)$ for the given partition. Clearly, for all $1 \leq 1 \leq k$, $G[V_i]$ must be a proper interval graph for $s$ to be a precedence strongly consistent ordering. Verifying whether $G[V_i]$ is a proper interval graph can be accomplished in linear time. If one of the parts does not induce a proper interval graph, then the answer is \textsc{NO}. Otherwise, each part has a $PQ$ tree associated to it. For a given sequence $s_\mathcal{V}$ of parts of $\mathcal{V}$, suppose that $V_j<V_i<V_z$ in $s_\mathcal{V}$, for $1 \leq j,i,z \leq k$. Let $T_i$ be a $PQ$ tree of $G[V_i]$. Notice that, considering the Property~\ref{prop:pthinness}, if we apply Theorem~\ref{theo:thinness} to get the ordering constraints imposed by $V_j$ and $V_z$ to $T_i$, and add the directed edges to $T_i$ in the same way that has been done in Section~\ref{chpt:pthinness} and $T_i$ can meet the constraints, then $T_i$ is compatible to being at that position. That is, the vertices of $V_i$ can precede the vertices of $V_z$ and succeed the vertices of $V_j$ in any precedence strongly consistent ordering. We show that for any $s_\mathcal{V}$, it is possible to verify whether there is a precedence strongly consistent ordering $s$ in which the ordering of the parts in $s$ is precisely $s_\mathcal{V}$. To solve the problem, we will test all $k!$ possible permutations $s_\mathcal{V}= V'_1,V'_2,\ldots\allowbreak , V'_k$ among the parts of $\mathcal{V}$ and validate, using a digraph and $PQ$ trees, if each part $V'_i$ can precede $V'_z$ and succeed $V'_j$, for all $1\leq j <i< z \leq k$. This validation is done exactly as described in Section~\ref{chpt:pthinness}, except for using Property~\ref{prop:pthinness} instead of Property~\ref{prop:thinness}. If there is some $s$ that satisfies this condition, then there is a precedence strongly consistent ordering with respect to $s$ and $G$ is a \fpp{k} graph concerning $\mathcal{V}$. Otherwise, $G$ is not a \fpp{k} graph with respect to $\mathcal{V}$. Algorithm~\ref{alg:kfpp} formalizes the procedure. \begin{algorithm}[htbp] \textbf{Input}: $G$: a graph; $\mathcal{V}$: a $k$-partition $(V_1, V_2, \ldots, V_k)$ of $V(G)$ for some fixed $k$ \\ \vspace{0.20cm} \KpptF{ \For{\Each $V_i \in \mathcal{V}$ }{ \If{\textsf{\upshape $G[V_i]$ is not a proper interval graph}}{ \Return (\textsc{NO}, $\emptyset$) } } \For{\Each \textsf{\upshape permutation $s_\mathcal{V}$ of $\mathcal{V}$ }}{ $s \leftarrow \emptyset$\\ $foundValidPermutation \leftarrow$ \TRUE\\ \For{\Each $V_i \in s_\mathcal{V}$}{ Create a digraph $D = (V_i, \emptyset)$\\ Build a $PQ$ tree $T_i$ of $G[V_i]$\\ \For{\Each \textsf{\upshape $V_j \in s_\mathcal{V}$ such that $V_j \neq V_i$}}{ Let $S$ be the set of precedence relations among the vertices of $V_i$ concerning $V_j$ (Property~\ref{prop:pthinness})\\ \For{\Each $(u<v) \in S$}{ $E(D) \leftarrow E(D) \cup \{(u,v)\}$ \\ \For{\textsf{\upshape \Each node $X$ of $T_i$}}{ Add the direct edges, deriving from $(u<v)$, among the children of $X$ (Theorem~\ref{theo:thinness}) \\ } } \For{\textsf{\upshape \Each node $X$ of $T_i$}}{ Let $D = (V', E')$ be the digraph where $V'$ is the set of the children of $X$ and $E'$ are the directed edges added among them\\ \If{\textsf{\upshape there is a topological ordering $s$ of $D$}}{ Arrange the children of $X$ according to $s$ \\ } \Else{ $foundValidPermutation \leftarrow$ \FALSE \\ } } } \If{ foundValidPermutation}{ \AddEdgesFromPQTree{$G[V_i]$, $D$, $T_i$}\\ \If{\textsf{\upshape there is a topological ordering $s_i$ of $D$}}{ $s \leftarrow ss_i$\\ } \Else{$foundValidPermutation \leftarrow$ \FALSE \\ \Break} } } \If{ foundValidPermutation}{ \Return (\textsc{YES}, $s$) } } \Return (\textsc{NO}, $\emptyset$) } \caption{\textsc{Partitioned \fpp{k}}} \label{alg:kfpp} \end{algorithm} Concerning the time complexity of the algorithm, first note that to create in $T_i$ the directed edges derived from Property~\ref{prop:pthinness} related to $V'_j$ (resp. $V'_z$) can be done in $O(n^5)$ time. Also, for each $V_i$ we apply this property considering all the other parts, that is, $O(k)$ times, and therefore $O(k^2)$ times overall considering each $V_i$. As this operation must be executed for all $k!$ possible permutations, and considering the analysis of this same method in Section~\ref{chpt:pthinness}, the given strategy yields a worst case time complexity of $O(k!k^2n^5) = O(n^5)$ as $k$ is fixed. We end this section by mentioning an even more restricted case of the problem. Namely, the recognition of \fpp{k} graphs for a fixed number of parts such that each part induces a connected graph. Note that, as each part induces a connected graph, the proper interval graph induced by each part has an unique proper canonical ordering but reversion or mutual true twins permutation. This fact implies that the $PQ$ tree related to each one of these proper interval graphs is formed by one node of type $Q$, which is the root, that has all the maximal cliques as its children. That is, there are only two possible configurations for each one of these $PQ$ trees. As the number of possible configurations is a constant, this property leads to a more efficient algorithm. Instead of using Theorem~\ref{theo:thinness} to map restrictions to the $PQ$ tree in order to obtain a compatible tree, the algorithm can check both configurations of the $PQ$ tree independently. As the step which uses Theorem~\ref{theo:thinness} is no longer required, this approach leads to an algorithm that yields a worst case time complexity of $O(k!k^22^kn^3)=O(n^3)$. This strategy is presented in Algorithm~\ref{alg:kfppc}. \begin{algorithm}[htbp] \textbf{Input}: $G$: a graph; $\mathcal{V}$: a $k$-partition $(V_1, V_2, \ldots, V_k)$ of $V(G)$, for some fixed $k$, such that $G[V_i]$ is connected for all $1 \leq i \leq k$ \\ \vspace{0.20cm} \KpptFC{ \For{\Each $V_i \in \mathcal{V}$ }{ \If{\textsf{\upshape $G[V_i]$ is not a proper interval graph}}{ \Return (\textsc{NO}, $\emptyset$) } } \For{\Each \textsf{\upshape permutation $s_\mathcal{V}$ of $\mathcal{V}$ }}{ $s \leftarrow \emptyset$\\ $foundValidPermutation \leftarrow$ \TRUE\\ \For{\Each $V_i \in s_\mathcal{V}$}{ $foundValidTree \leftarrow$ \FALSE\\ Build a $PQ$ tree $T_i$ of $G[V_i]$\\ Let $T_i'$ be the $PQ$ tree obtained from $T_i$ by reversing the order of the children of the root\\ \For{\Each $T \in \{T_i,T_i'\}$}{ Create a digraph $D = (V_i, \emptyset)$\\ \For{\Each $V_j \in s_\mathcal{V}$ such that $V_j \neq V_i$}{ Let $S$ be the set of precedence relations among the vertices of $V_i$ concerning $V_j$ (Property~\ref{prop:pthinness})\\ \For{\Each $(u<v) \in S$}{ $E(D) \leftarrow E(D) \cup \{(u,v)\}$ \\ } } \AddEdgesFromPQTree{$G[V_i]$, $D$, $T$}\\ \If{\textsf{\upshape there is a topological ordering $s_i$ of $D$}}{ $s \leftarrow ss_i$\\ $foundValidTree \leftarrow$ \TRUE\\ \Break } } \If{\Not foundValidTree}{ $foundValidPermutation \leftarrow$ \FALSE\\ \Break } } \If{ foundValidPermutation}{ \Return (\textsc{YES}, $s$) } } \Return (\textsc{NO}, $\emptyset$) } \caption{\textsc{Partitioned \fpp{k}}} \label{alg:kfppc} \end{algorithm} \section{Preliminaries}\label{chpt:preliminaries} All graphs in this work are finite and have no loops or multiple edges. Let $G$ be a graph. Denote by $V(G)$ its vertex set, by $E(G)$ its edge set. Denote the \emph{size} of a set $S$ by $|S|$. Unless stated otherwise, $|V(G)| = n$ and $|E(G)| = m$. Let $u,v \in V(G)$, define $u$ and $v$ as \emph{adjacent} if $(u,v) \in E(G)$. Let $V' \subseteq V(G)$. The \emph{induced subgraph} of $G$ by $V'$, denoted by $G[V']$, is the graph $G[V']= (V',E')$, where $E' = \{ (u,v)\in E(G) \mid u, v \in V' \}$. Analogously, for some $E' \subseteq E(G)$, let the \emph{induced subgraph} of $G$ by $E'$, denoted by $G[E']$, be the graph $G[E']= (V',E')$, where $V' = \{ u, v \in V(G) \mid (u,v)\in E' \}$. A graph $G'$ obtained from $G$ by \emph{removing} the vertex $v \in V(G)$ is defined as $G' = (V(G) \setminus \{v\}, E')$, where $E'=\{(u,w) \in E \mid u \neq v \text{ and } w \neq v\}$ Let $v \in V(G)$, denote by $N(v)= \{u \in V(G) \mid v \text{ and } u \text{ are adjacent} \}$ the \emph{neighborhood} of $v \in V(G)$, and by $N[v] = N(v)\cup\{v\}$ the \emph{closed neighborhood} of $v$. We define $u, v \in V(G)$ as \emph{true twins} (resp. \emph{false twins}) if $N[u] = N[v]$ (resp. $N(u) = N(v)$). A vertex $v$ of $G$ is \emph{universal} if $N[v] = V(G)$. We define the \emph{degree} of $v \in V(G)$, denoted by \emph{$d(v)$}, as the number of neighbors of $v$ in $G$, i.e. $d(v) = |N(v)|$ A \emph{clique} or \emph{complete set} (resp.\ \emph{stable set} or \emph{independent set}) is a set of pairwise adjacent (resp.\ nonadjacent) vertices. We use \emph{maximum} to mean maximum-sized, whereas \emph{maximal} means inclusion-wise maximal. The use of \emph{minimum} and \emph{minimal} is analogous. A vertex $v \in V(G)$ is said to be \emph{simplicial} if $G[N(v)]$ is a clique. A \emph{coloring} of a graph is an assignment of colors to its vertices such that any two adjacent vertices are assigned different colors. The smallest number $t$ such that $G$ admits a coloring with $t$ colors (a \emph{$t$-coloring}) is called the \emph{chromatic number} of $G$ and is denoted by $\chi(G)$. A coloring defines a partition of the vertices of the graph into stable sets, called \emph{color classes}. A graph $G(V,E)$ is a \emph{comparability graph} if there exists an ordering $v_1, \dots , v_n$ of $V$ such that, for each triple $(r,s,t)$ with $r<s<t$, if $v_r v_s$ and $v_s v_t$ are edges of $G$, then so is $v_r v_t$.\ Such an ordering is a \emph{comparability ordering}. A graph is a \emph{co-comparability graph} if its complement is a comparability graph. A \emph{tree} $T$ is a connected graph that has no cycles. A \emph{rooted tree} $T_v$ is a tree in which a vertex $v \in V(T)$ is labeled as the \emph{root} of the tree. All vertices, known as \emph{nodes} of $T_v$, have implicit positions in relation to the root. Let $u,w \in V(T_v)$, $w$ is a \emph{descendant} of $u$ if the path from $w$ to $v$ includes $u$. The node $w$ is said to be a \emph{child} of $u$ if it is a descendant of $u$ and $(w,u) \in E(T_v)$. The \emph{children} of $u$ is defined as the set that containing all child nodes of $u$. The node $u$ is said to be a \emph{leaf} of $T_v$ if it has no child in $T_v$. The \emph{subtree} $T_u$ of $T_v$ \emph{rooted at} the node $u$ is the \emph{rooted} tree that consists of $u$ as the root and its descendants in $T_v$ as the nodes. A \emph{directed graph}, or \emph{digraph}, is a graph $D = (V,E)$ such that $E$ consists of ordered pairs of $V(G)$. A \emph{directed cycle} of a digraph $D$ is a sequence $v_1,v_2, \ldots,v_i$, $1 \leq i \leq n$, of vertices of $V(D)$ such that $v_1 = v_i$ and, for all $1 \leq j<i$, $(v_j,v_{j+1}) \in E(D)$. A \emph{directed acyclic graph} (\emph{DAG}) $D$ is a digraph with no directed cycles. A \emph{topological ordering} of a DAG $D$ is a sequence $v_1,v_2,\ldots ,v_n$ of $V(D)$ such that there are no $1\leq i <j\leq n$ such that $(v_j,v_i) \in E(D)$. Determining a topological ordering of a DAG can be done in time $O(n+m)$~\cite{Knuth1}. An \emph{ordering} $s$ of elements of a set $\mathcal{C}$, denoted by $V(s)$, consists of a sequence $e_1,e_2,\ldots,e_n$ of all elements of $\mathcal{C}$. We define $\bar{s}$ as the \emph{reversal} of $s$, that is, $\bar{s} = e_n,e_{n-1},\ldots,e_1$. We say that $e_i$ \emph{precedes} $e_j$ in $s$, denoted by $e_i < e_j$, if $i < j$. An ordered tuple $(a_1, a_2, \ldots, a_k)$ of some elements of $\mathcal{C}$ is \emph{ordered according to} $s$ when, for all $1 \leq i < k$, if $a_i = e_j$ and $a_{i+1} = e_z$, then $j < z$. Given orderings $s_1$ and $s_2$, the ordering obtained by concatenating $s_1$ to $s_2$ is denoted by $s_1s_2$. \subsection{Interval graphs} The \emph{intersection graph} of a family $\mathcal{F}$ of sets is the graph $G$ such that $V(G) = \mathcal{F}$ and $S,T \in V(G)$ are adjacent if and only if $S \cap T \neq \emptyset$. An \emph{interval graph} $G$ is the intersection graph of a family $\mathcal{R}$ of intervals of the real line; such a family is called an \emph{interval model}, or a \emph{model}, of the graph. We say that $\mathcal{R}$ is associated to $G$ and vice-versa. It is worth mentioning that an interval graph can be associated to several models but an interval model can be associated to a unique graph. Concerning interval graphs, there are some characterizations which are relevant to this work, that we present next. \begin{theorem}[\cite{Olariu91}]\label{theo:can:ordering} A graph $G$ is an interval graph if, and only if, there is an ordering $s$ of $V(G)$ such that, for any triple $(p,q,r)$ of $V(G)$ ordered according to $s$, if $(p,r) \in E(G)$, then $(q,r) \in E(G)$. \end{theorem} The ordering described in Theorem~\ref{theo:can:ordering} is said to be a \emph{canonical} ordering. Figure~\ref{fig:canonico} depicts an interval graph in which the vertices are presented from left to right in one of its canonical orderings. \begin{figure} \centering \subfigure[]{\label{fig:canonico}\includegraphics[width=64mm]{figures/preliminaries/qualiOrdCan.pdf}} \hspace{0.45cm} \subfigure[]{\label{fig:canonicoproprio}\includegraphics[width=64mm]{figures/preliminaries/qualiOrdCanP.pdf}} \caption{(a) Canonical ordering and (b) proper canonical ordering.} \end{figure} Let $\mathcal{R}$ be an interval model of an interval graph $G$. Note that, if we consider a vertical line that intersects a subset of intervals in $\mathcal{R}$, then these intervals consist of a clique in $G$. This is true because they all contain the point in which this line is defined. Moreover, if the given line traverses a maximal set of intervals, then the corresponding clique is maximal. Figure~\ref{fig:model} depicts an interval model and the vertical lines that correspond to maximal cliques of the graph in Figure~\ref{fig:canonico}. The following is a characterization of interval graphs in terms of the maximal cliques of the graph. \begin{figure}[htb] \centering \includegraphics[width=90mm]{figures/preliminaries/qualiModel.pdf} \caption{ An interval model an the maximal cliques of the graph in Figure~\ref{fig:canonico}.} \label{fig:model} \end{figure} \begin{theorem}[\cite{Roberts69}]\label{theo:clique:ordering} A graph $G$ is an interval graph if, and only if, there is an ordering $s_C = C_1,C_2, \ldots, C_k$ of its maximal cliques such that if $v \in C_i \cap C_z$ with $1 \leq i \leq z \leq k$, then $v \in C_j$, for all $i \leq j \leq z$. \end{theorem} The ordering described in Theorem~\ref{theo:clique:ordering} is said to be a \emph{canonical clique} ordering. The ordering of the maximal cliques depicted in Figure~\ref{fig:model}, read from left to right, represents a canonical clique ordering. A \emph{proper interval graph} is an interval graph that admits an interval model in which no interval properly contains another. There is a characterization of proper interval graphs which is similar to that presented in Theorem~\ref{theo:can:ordering}, as described next. \begin{theorem}[\cite{Roberts69}]\label{theo:procan:ordering} A graph $G$ is a proper interval graph if, and only if, there is an ordering $s$ of $V(G)$ such that, for any triple $(p,q,r)$ of $V(G)$ ordered according to $s$, if $(p,r) \in E(G)$, then $(p,q), (q,r) \in E(G)$. \end{theorem} The ordering specified in the previous theorem is defined as a \emph{proper canonical} ordering. The ordering of the vertices of the graph depicted in Figure~\ref{fig:canonicoproprio} from left to right is proper canonical. Note that a proper canonical ordering is also a canonical ordering. An important property of proper canonical orderings is the following: \begin{lemma}[\cite{Roberts69}] If $G$ is a connected proper interval graph. Then a proper canonical ordering of $G$ is unique up to reversion and permutation of mutual true twin vertices. \end{lemma} As a consequence, if a proper interval graph $G$ is disconnected, since each component has a unique proper canonical ordering, then the canonical ordering of $G$ consists of a permutation of canonical orderings of each of those components. Let $s$ be an ordering of $V(G)$ and $s_C = C_1,C_2, \ldots, C_k$ an ordering of the maximal cliques of $G$. The sequence $s$ is said to be \emph{ordered according} to $s_C$ if for all $u,v \in V(G)$ such that $u<v$ in $s$, there are no $ 1\leq i <j \leq k$ such that $v \in C_i \setminus C_j$ and $u \in C_j$. As an example, note that the canonical ordering of the Figure~\ref{fig:canonico} is ordered according to the maximal clique ordering $s_C = C_1,C_2, \ldots, C_6$ of the Figure~\ref{fig:model}. The following lemma relates the characterization of canonical orderings and canonical clique orderings. \begin{lemma}\label{lemma:clique:canonical} Let $G$ be a graph and $s$ be an ordering of $V(G)$. The ordering $s$ is a canonical ordering of $V(G)$ if, and only if, $s$ is ordered according to a canonical clique ordering of $G$. \end{lemma} \begin{proof} Consider $s_C$ a canonical clique ordering of $G$. We will show that is possible to build a canonical ordering $s$ from $s_C$, respecting its clique ordering. To achieve this, first start with an empty sequence $s$. Iteratively, for each element $X$ of the sequence $s_C$, choose all simplicial vertices of $X$, adding them to $s$ in any order and removing them from $G$. Note that some of the vertices of $X$ that were not removed from $G$, because they were not simplicial in $G$, now may be turned simplicial by the removal of vertices. Clearly, at the end of the process, $s$ will contain all the vertices of $G$. Suppose $s$ is not a canonical ordering, that is, there are $p,q,r \in V(G)$, $p<q<r$ in $s$, such that $(p,r) \in E(G)$ and $(q,r) \not \in E(G)$. Let $C_p$, $C_q$ and $C_r$ be the maximal cliques of $s_C$ being processed at moment $p$, $q$ and $r$ were choose, respectively. Note that $C_p < C_q < C_r$ in $S_c$ and, as $C_p$ is the last maximal clique in $s_C$ that contains $p$ and $(p,r) \in E(G)$, $r \in C_p$. Besides, as $(q,r) \not \in E(G)$, $r \not\in C_q$ . Therefore, $r \in C_p \cap C_r$ and $r \not\in C_q$. A contradiction with the fact that $s_C$ is a canonical clique ordering. Hence, $s$ is a canonical ordering. Consider $s= v_1,v_2, \ldots, v_n$ be a canonical ordering of $G$. We prove by induction in $|V(G)| = n$ that $s$ is ordered according to a canonical clique ordering. Clearly, the statement is true for $n = 1$. Suppose that the statement is true for any $1 \leq n'< n$. Let $s'$ be the sequence obtained from $s$ by removing $v_n$. Clearly $s'$ is also a canonical ordering and, by the induction hypothesis, $s'$ is ordered according with a canonical clique ordering $s'_C = C_1,C_2, \ldots, C_k$. Let $C_i$, with $1 \leq i \leq k$, be the first clique of $s'_C$ such that $v_n \in N(C_i)$. Let $C' _j = \{C_j \cap N(v_n)\} \cup \{v_n\}$, $i \leq j \leq k$. Note that, as $s$ is a canonical ordering, for all $C_j$ of $s'_C$, $i < j \leq k$, $\{C_j \cap N(v_n)\}\cup \{v_n\}$ is a maximal clique of $G$. If $C_i \subseteq N(v_n)$, then $s'_C = C_1,C_2, \ldots, C'_i,C'_{i+1}, \ldots, C'_k$ is a canonical clique ordering that matches $s$. Otherwise, $s'_C = C_1,C_2, \ldots, C_i,C'_i,C'_{i+1}, \ldots, C'_k$ is a canonical clique ordering that matches $s$. Therefore, $s$ is ordered according to a canonical clique ordering of $G$. \end{proof} \subsubsection {PQ trees} A \emph{$PQ$ tree}~\cite{BOOTH76} $T$ is a data structure consisting of an ordered tree that describes a family $\mathcal{F}$ of permutations of elements from a given set $\mathcal{C}$. In a $PQ$ tree $T$, the set of leaves is $\mathcal{C}$ and the permutation being represented by $T$ is the sequence of the leaves from left to right. Regarding internal nodes, they are classified into two types, the $P$ and the $Q$ nodes. An \emph{equivalent} $PQ$ tree $T'$ to $T$ is a tree obtained from $T$ by any sequence of consecutive transformations, each consisting of either permuting the children of a $P$ node, or reversing the children of a $Q$ node. The family $\mathcal{F}$ of permutations of elements from $\mathcal{C}$ represented by $T$ is that of permutations corresponding to all equivalent $PQ$ trees to $T$. Graphically, in a $PQ$ tree, leaves and $P$ nodes are represented by circles and $Q$ nodes by rectangles. In representations of schematic $PQ$ trees, a node represented by a circle over a rectangle will denote that, in any concrete $PQ$ tree conforming the scheme, such a node is either a $P$ node, or a $Q$ node. Figure~\ref{fig:PQT:exeOp} depicts the described operations. In Figure~\ref{fig:PQT:1}, we have a partial representation of a $PQ$ tree. Figure~\ref{fig:PQT:2} depicts an equivalent $PQ$ tree obtained from a permutation of children of a $P$ node of this tree and Figure~\ref{fig:PQT:3} exemplifies an equivalent $PQ$ tree from the reversion of the children of a $Q$ node. \begin{figure}[htbp] \centering \subfigure[]{\label{fig:PQT:1}\includegraphics[width=37.7mm]{figures/preliminaries/PQT.pdf}} \subfigure[]{\label{fig:PQT:2}\includegraphics[width=37.7mm]{figures/preliminaries/PQT1_1.pdf}}\hfill \subfigure[]{\label{fig:PQT:3}\includegraphics[width=37.7mm]{figures/preliminaries/PQT2_1.pdf}}\\\ \caption{A $PQ$ tree (a) and an example of permutations (b) and reversions (c) of children of its nodes. } \label{fig:PQT:exeOp} \end{figure} One of the applications from the seminal paper introducing $PQ$ trees is that of recognizing interval graphs. In such an application, each leaf of the $PQ$ tree is a maximal clique of an interval graph $G$ and the family of permutations the tree represents is precisely all the canonical clique orderings of $G$~\cite{BOOTH76}. A $PQ$ tree can be constructed from an interval graph in time $O(n+m)$~\cite{BOOTH76}. We will say that a vertex $v$ belongs to a node $X$ of a $PQ$ tree, and naturally denote by $v \in X$, if it belongs to any leaf that descends from this node. Figure~\ref{fig:pre:PQT} depicts a $PQ$ tree of the interval graph of Figure~\ref{fig:canonico} according to the maximal cliques in Figure~\ref{fig:model}. The permutations implicitly represented by this $PQ$ tree are: \begin{minipage}[t]{0.9\linewidth} \vspace{2ex} \begin{minipage}[t]{0.4\linewidth} \centering \begin{itemize} \item $C_1,C_2,C_3,C_4,C_5,C_6$ \item $C_1,C_2,C_3,C_4,C_6,C_5$ \item $C_1,C_2,C_4,C_3,C_5,C_6$ \item $C_1,C_2,C_4,C_3,C_6,C_5$ \item $C_6,C_5,C_4,C_3,C_2,C_1$ \item $C_5,C_6,C_4,C_3,C_2,C_1$ \item $C_6,C_5,C_3,C_4,C_2,C_1$ \item $C_5,C_6,C_3,C_4,C_2,C_1$ \end{itemize} \end{minipage} \hfill \begin{minipage}[t]{0.4\linewidth} \captionsetup{type=figure} \vspace{-1.5ex} \centering \includegraphics[width=40mm]{figures/preliminaries/exPQT.pdf} \caption{A $PQ$ tree of the interval graph of Figure~\ref{fig:canonico} according to the maximal cliques in Figure~\ref{fig:model}.} \label{fig:pre:PQT} \end{minipage} \end{minipage} \subsection {Thinness and proper thinness} A graph $G$ is called a \emph{$k$-thin graph} if there is a $k$-partition $(V_1,V_2 \ldots, V_k)$ of $V(G)$ and an ordering $s$ of $V(G)$ such that, for any triple $(p,q,r)$ of $V(G)$ ordered according to $s$, if $p$ and $q$ are in a same part $V_i$ and $(p,r) \in E(G)$, then $(q,r)\in E(G)$. An ordering and a partition satisfying that property are called \emph{consistent}. That is, a graph is $k$-thin if there is an ordering consistent with some $k$-partition of its vertex set. The \emph{thinness} of $G$, denoted by \emph{$thin(G)$}, is the minimum $k$ for which $G$ is a $k$-thin graph. A graph $G$ is called a \emph{proper $k$-thin graph} if $G$ admits a $k$-partition $(V_1, \ldots, V_k)$ of $V(G)$ and an ordering $s$ of $V(G)$ consistent with the partition and, additionally, for any triple $(p,q,r)$ of $V(G)$, ordered according to $s$, if $q$ and $r$ are in a same part $V_i$ and $(p,r) \in E(G)$, then $(p,q)\in E(G)$. Equivalently, an ordering $s$ of $V(G)$ such that $s$ and its reverse are consistent with the partition. Such an ordering and partition are called \emph{strongly consistent}. The \emph{proper thinness} of $G$, or \emph{$pthin(G)$}, is the minimum $k$ for which $G$ is a proper $k$-thin graph. Figures~\ref{fig:c4thin} and~\ref{fig:c4pthin} depict two bipartitions of a graph, in which the classes are represented by distinct colors, and two different vertex orderings. The ordering of Figure~\ref{fig:c4thin} is consistent with the corresponding partition but not strongly consistent, while the ordering of Figure~\ref{fig:c4pthin} is strongly consistent with the corresponding partition. Note that $k$-thin graphs (resp. proper $k$-thin graphs) generalize interval graphs (resp. proper interval graphs). The $1$-thin graphs (resp. proper $1$-thin graphs) are the interval graphs (resp. proper interval graphs). The parameter $\thin(G)$ (resp. $\pthin(G)$) is in a way a measure of how far a graph is from being an interval graph (resp. proper interval graph). For instance, consider the graph $C_4$. Since $C_4$ is not an interval graph, $\pthin(C_4) \geq \thin(C_4) > 1$. Figure~\ref{fig:c4} proves that $\thin(C_4) = \pthin(C_4) = 2$. A characterization of $k$-thin or proper $k$-thin graphs by forbidden induced subgraphs is only known for $k$-thin graphs within the class of cographs~\cite{Bono18}. Graphs with arbitrary large thinness were presented in~\cite{Carl07}, while in~\cite{Bono18} a family of interval graphs with arbitrary large proper thinness was used to show that the gap between thinness and proper thinness can be arbitrarily large. The relation of thinness and other width parameters of graphs like boxicity, pathwidth, cutwidth and linear MIM-width was shown in~\cite{Carl07,Bono18}. Let $G$ be a graph and $s$ an ordering of its vertices. The graph $G_{s}$ has $V(G)$ as vertex set, and $E(G_{s})$ is such that for $v < w$, $(v,w) \in E(G_{s})$ if and only if there is a vertex $z$ in $G$ such that $v < w < z$, $(z,v) \in E(G)$ and $(z,w) \not \in E(G)$. Similarly, the graph $\tilde{G}_s$ has $V(G)$ as vertex set, and $E(\tilde{G}_{s})$ is such that for $v < w$, $(v,w) \in E(\tilde{G}_{s})$ if and only if either there is a vertex $z$ in $G$ such that $v < w < z$, $(z,v) \in E(G)$ and $(z,w) \not \in E(G)$ or there is a vertex $x$ in $G$ such that $x < v < w$, $(x,w) \in E(G)$ and $(x,v) \not \in E(G)$. \begin{theorem}\label{thm:coloring-order}\cite{Bono18,B-M-O-thin-tcs} Given a graph $G$ and an ordering ${s}$ of its vertices, a partition of $V(G)$ is consistent (resp. strongly consistent) with the ordering ${s}$ if and only if the partition is a valid coloring of $G_{s}$ (resp. $\tilde{G}_s$), which means that each part corresponds to a color in the coloring under consideration. \end{theorem} \begin{figure}[htbp] \centering \subfigure[]{\label{fig:c4thin}\includegraphics[width=40mm]{figures/preliminaries/qualiC4thin.pdf}}\hfil \subfigure[]{\label{fig:c4pthin}\includegraphics[width=40mm]{figures/preliminaries/qualiC4pthin.pdf}}\hfil \caption{(a) A consistent ordering and a (b) strongly consistent ordering of $V(C_4)$, for the corresponding $2$-partitions.} \label{fig:c4} \end{figure} \subsection {Precedence thinness and precedence proper thinness} In this work, we consider a variation of the problems described in the last subsection by requiring that, given a vertex partition, the (strongly) consistent orderings hold an additional property. A graph $G$ is \emph{\fpExt{k}} (resp. \emph{\fppExt{k}}), or \emph{\fp{k}} (resp. \emph{\fpp{k}}), if there is a $k$-partition of its vertices and a consistent (resp. strongly consistent) ordering $s$ for which the vertices that belong to a same part are consecutive in $s$. Such an ordering is called a \emph{precedence consistent ordering} (resp. \emph{precedence strongly consistent ordering}) for the given partition. We define \fpPar{G} (resp. \fppPar{G}) as the minimum value $k$ for which $G$ is \fp{k} (resp. \fpp{k}). The Figure~\ref{fig:C4-2ppt} illustrates a graph that is a \fpp{2} graph. The convention assumed is that the strongly consistent ordering being represented consists of the vertices ordered as they appear in the figure from bottom to top and, for vertices arranged in a same horizontal line, from left to right. Therefore, the strongly consistent ordering represented in Figure~\ref{fig:C4-2ppt} is $s =a,b,c,a',b',c'$. The graph $C_4$ is not \fpp{2}, despite $\pthin(C_4)=2$. It can be easily verified by brute-force that, for all possible bipartitions of its vertex set and for all possible orderings $s$ in which the vertices of a same part are consecutive in $s$, the ordering and the partition are not strongly consistent. On the other hand, a \fpp{k} graph is a proper $k$-thin graph. Therefore, the class of \fpp{k} graphs is a proper subclass of that of proper $k$-thin graphs. \begin{figure}[htbp] \centering \includegraphics[width=35mm]{figures/preliminaries/qualiExemplo2FPP.pdf} \caption{A \fpp{2} graph.} \label{fig:C4-2ppt} \end{figure} If a vertex order $s$ is given, by Theorem~\ref{thm:coloring-order}, any partition which is precedence (strongly) consistent with $s$ is a valid coloring of $G_s$ (resp. $\tilde{G}_s$) such that, additionally, the vertices on each color class are consecutive according to $s$. A greedy algorithm can be used to find a minimum vertex coloring with this property in polynomial time. Such method is described next, in Theorem~\ref{teo:kpptGreddy}. \begin{theorem}\label{teo:kpptGreddy} Let $G$ be a graph and $s$ an ordering of $V(G)$. It is possible to obtain a minimum $k$-partition $\mathcal{V}$ of $V(G)$, in polynomial time, such that $s$ is a precedence (strongly) consistent ordering concerning $\mathcal{V}$. \end{theorem} \begin{proof} Consider the following greedy algorithm that obtains an optimum coloring of $G_s$ (resp. $\tilde{G}_s$) in which vertices having a same color are consecutive in $s$. That is, $s$ is a precedence consistent (resp. precedence strongly consistent) ordering concerning the partition defined by the coloring. Color $v_1$ with color~$1$. For each $v_i$, $i>1$, let $c$ be the last color used. Then color $v_i$ with color $c$ if there is no $v_j$, $j<i$, colored with $c$ such that $(v_j,v_i) \in E(G_s)$ (resp. $(v_j,v_i) \in E(\tilde{G_s})$). Otherwise, color $v_i$ with color $c+1$. We show, by induction on $|s| = n$, that the algorithm finds an optimal coloring in which each vertex has the least possible color. The case where $n=1$ is trivial. Suppose that the algorithm obtains an optimum coloring of $G_s$ (resp. $\tilde{G_s}$), for orderings having size less than $n$. Remove the last vertex $v_n$ from $s$ and $G_s$ (resp. $\tilde{G_s}$) and use the given algorithm to color the resulting graph. By the induction hypothesis, the chosen coloring for $v_1,v_2,\ldots,v_{n-1}$ is optimal. Moreover, the colors are non-decreasing and each vertex is colored with the least possible color. Now, add the removed vertex $v_n$ to $s$ and to the graph $G_s$ (resp. $\tilde{G_s}$), with its respective edges, and let the algorithm choose a coloring for it. If the color of $v_n$ is equal to the color of $v_{n-1}$ the algorithm is optimal by the induction hypothesis. Otherwise, $v_n$ is colored with a new color $c'$. Suppose the chosen coloring is not optimal. That is, it is possible to color $v$ with an existing color. This implies that there is at least a neighbor $v_j$ of $v_n$, in $G_s$ (resp. $\tilde{G_s}$), that can be recolored with a smaller color. This is an absurd because the algorithm has already chosen the least possible color for all the vertices of $G_s \setminus \{v_n\}$ (resp. $\tilde{G_s}\setminus \{v_n\}$), relative to $s$. \end{proof} In the following sections, we will deal with the case where the vertex partition is given and the problem consists of finding the vertex ordering. From now on, we will then simply call \emph{precedence consistent ordering} (resp. \emph{precedence strongly consistent ordering}) to one that is such for the given partition. \section{Preliminaries}\label{chpt:preliminaries} In this section, we describe all the necessary terminology to the understanding of this work. \subsection{General graph theory terminology} A \emph{graph} $G$ is a pair $(V,E)$ of sets. The set $V$ is named \emph{vertex set} and $E$ the \emph{edge set} of $G$. The set $E$ consists of pairs of elements of $V$. A graph represents a set of objects (vertices) and a pairwise mutual relation (edges). By convention, $V(G)$ and $E(G)$ are the vertex set and the edge set of the graph $G$, respectively. Unless stated otherwise, $|V(G)| = n$ and $|E(G)| = m$. We say the pair of vertices $u,v \in V(G)$ are \emph{adjacent} in $G$ if $(u,v) \in E(G)$. A \emph{simple graph} is a graph in which no vertex is adjacent to itself and there are no two edges consisting of the same pair of vertices. In the context of this work, we refer to simple graphs simply as graphs. A vertex $u\in V(G)$ is said to be \emph{universal} (in $G$) if it is adjacent to all the other vertices of $G$. The \emph{complement} $\overline{G}$ of $G$ is the graph defined as $\overline{G} = (G(V),E')$, where $E' = \{(u,v)\not \in E(G) \}$. A \emph{matching} in a graph $G$ is a subset $E'\subseteq E(G)$ in which there are no $e_1,e_2 \in E'$ having a vertex in common. An \emph{induced matching} in a graph $G$ is a matching $E'$ of $G$ in which there are no $e_1, e_2 \in E'$ such that an edge of $G$ has a common vertex to both $e_1$ and $e_2$ (that is, no edges of the matching can be ''linked'' by an edge) Two graphs $G$ and $H$ are said to be \emph{isomorphic}, denoted by $G \cong H$, if there is a bijection $\theta : V(G) \rightarrow V(H)$ such that $(u,v) \in E(G)$ if, and only if, $(\theta(u),\theta(v)) \in E(H)$. Let $V' \subseteq V(G)$. The \emph{induced subgraph} of $G$ by $V'$, denoted by $G[V']$, is the graph $G[V']= (V',E')$, where $E' = \{ (u,v)\in E(G) \mid u, v \in V' \}$. Analogously, for some $E' \subseteq E(G)$, let the \emph{induced subgraph} of $G$ by $E'$, denoted by $G[E']$, be the the graph $G[E']= (V',E')$, where $V' = \{ u, v \in V(G) \mid (u,v)\in E' \}$. A graph $G'$ obtained from $G$ by \emph{removing} the vertex $v \in V(G)$ is defined as $G' = (V \setminus \{v\}, E')$, where $E'=\{(u,w) \in E \mid u \neq v \text{ and } w \neq v\}$ A \emph{path} of a graph $G$ is a sequence $v_1,v_2, \ldots,v_i$ of distinct vertices of $V(G)$, $1 \leq i \leq n$, such that for all $1 \leq j<i$, $v_j$ and $v_{j+1}$ are adjacent in $G$. The \emph{length} of a path $v_1,v_2, \ldots,v_i$ is defined as $i-1$. The \emph{path} graph $P_n$ is a graph consisting of a unique path with length $n-1$. A \emph{cograph} $G$ is a graph in which there is no $V' \subseteq V(G)$ such that $G[V'] \cong P_4$. A \emph{cycle} of a graph $G$ is a path $v_1,v_2, \ldots,v_i$ of $G$ in which $(v_1,v_i) \in E(G)$. A graph $G$ is \emph{connected} if for all $u, v \in V(G)$, there is a path $v_1, \ldots, v_i$ in $G$ such that $v_1 = u$ and $v_i = v$. A $tree$ $T$ is a connected graph that has no cycles. A \emph{rooted tree} $T_v$ is a tree in which a vertex $v \in V(T)$ is labeled as the \emph{root} of the tree. All the other vertices, known as \emph{nodes} of $T_v$, have implicit positions in relation to the root. Let $u,w \in V(T_v)$, $w$ is a \emph{descendant} of $u$ if the path from $w$ to $v$ includes $u$. The node $w$ is said to be a \emph{child} of $u$ if it is a descendant of $u$ and $(w,u) \in E(T_v)$. The \emph{children} of $u$ is defined as the set that containing all child nodes of $u$. The node $u$ is said to be a \emph{leaf} of $T_v$ if it has no child in $T_v$. The \emph{subtree} $T_u$ of $T_v$ \emph{rooted at} the node $u$ is the tree that consists of $u$ as the root and its descendants in $T_v$. A subset $L \subseteq V(G)$ is called an \emph{independent set} of $G$ if, for all distinct $u,v \in L$, $(u, v) \not \in E(G)$. The \emph{(open) neighborhood} of $u \in V(G)$ is $N_G(u) = \{v \in V(G) \mid (u, v) \in E(G) \}$. Let $U \subseteq V(G)$ and define $N_G(U) = \bigcup_{u \in U} N_G(u) \setminus U$. The \emph{(closed) neighborhood} of $u \in V(G)$ is defined as $N_G[u] = N_G(u) \cup \{u\}$. Similarly, let $U \subseteq V(G)$, $N_G[U] = N_G(u) \cup \{u\}$. When $G$ is clear in the context, it may be omitted from both notations. We define $u, v \in V(G)$ as \emph{false twins} if $N(u) = N(v)$. A vertex subset $C \subseteq V(G)$ is a \emph{clique} (of $G$) if its vertices are pairwise adjacent in $G$. A clique $C$ is \emph{maximal} if there is no $v \in V(G) \setminus C$ such that $C \cup \{v\}$ is a clique. A vertex $v \in V(G)$ is said to be \emph{simplicial} if $G[N(v)]$ is a clique. A \emph{complete graph} $K_n$ is a graph such that $|V(K_n)| = n$ and $V(K_n)$ is a clique. A \emph{directed graph}, or \emph{digraph}, is a graph $D = (V,E)$ such that $E$ consisted of by ordered pairs of $V(G)$. A \emph{directed cycle} of a digraph $D$ is a sequence $v_1,v_2, \ldots,v_i$, $1 \leq i \leq n$, of vertices of $V(D)$ such that $v_1 = v_i$ and, for all $1 \leq j<i$, $(v_j,v_{j+1}) \in E(D)$. A \emph{directed acyclic graph} (\emph{DAG}) $D$ is a digraph with no directed cycles. A \emph{topological ordering} of a DAG $D$ is a sequence $v_1,v_2,\ldots ,v_n$ of $V(D)$ such that there are no $1\leq i <j\leq n$ such that $(v_j,v_i) \in E(D)$. Determining a topological ordering of a DAG can be solved in time $O(n)$. Let $G_1$ and $G_2$ be graphs such that $V(G_1) \cap V(G_2) = \emptyset$. The \emph{union} $G_1 \cup G_2$ is defined as the graph $G = (V(G_1) \cup V(G_2), E(G_1) \cup E(G_2))$. The \emph{join} $G_1 \vee G_2$ is defined as the graph $G = (V(G_1) \cup V(G_2), E(G_1) \cup E(G_2)\cup V(G_1)\times V(G_2))$. The \emph{cartesian product} $G_1 \;\square\; G_2$ is defined as the graph $G = (V(G_1) \times V(G_2),E')$ where $E' = \{((u_1,u_2),(v_1,v_2)) \in V(G_1) \times V(G_2) \mid \text{either } [u_1 = v_1\text{ and } (u_2,v_2) \in E(G_2)] \text{ or } [u_2 = v_2\text{ and } (u_1,v_1) \in E(G_1)]\} $. The \emph{$(m\times n)$-grid} is $P_m \;\square\; P_n$. An \emph{ordering} $s$ of elements of a set $\mathcal{C}$ consists of a sequence $e_1,e_2,\ldots,e_n$ of all elements of $\mathcal{C}$. We say that $e_i$ \emph{precedes} $e_j$ in $s$, denoted by $e_i < e_j$, if $i < j$. An ordered tuple $(a_1, a_2, ... a_k)$ of some elements of $\mathcal{C}$ is according to $s$ if, for all $1 \leq i < k$, if $a_i = e_j$ and $a_{i+1} = e_z$, then $j < z$. Given orderings $s_1$ and $s_2$, the ordering obtained by concatenating $s_1$ to $s_2$ is denoted by $s_1s_2$. We define $\bar{s}$ as the \emph{reversal} of $s$. That is, $\bar{s} = e_n,e_{n-1},\ldots,e_1$. If $\mathcal{C}$ consists of a vertex subset of a graph, we define $V(s)=\mathcal{C}$. \subsection{Interval Graphs} The \emph{intersection graph} of a family $\mathcal{F}$ of sets is the graph $G$ such that $V(G) = \mathcal{F}$ and $S,T \in V(G)$ are adjacent if and only if $S \cap T \neq \emptyset$. An \emph{interval graph} $G$ is the intersection graph of a family $\mathcal{R}$ of intervals of the real line; such a family is called an \emph{interval model}, or a \emph{model}, of the graph. We say that $\mathcal{R}$ is associated to $G$ and vice-versa. It is worth mentioning that an interval graph can be associated to several models but an interval model can be associated to a unique graph. Concerning interval graphs, there are some characterizations of them which are relevant to this work, which we present next. \begin{theorem}[\cite{Olariu91}]\label{theo:can:ordering} A graph $G$ is an interval graph if, and only if, there is an ordering $s$ of $V(G)$ such that, for any triple $(p,q,r)$ of $V(G)$ ordered according to $s$, if $(p,r) \in E(G)$, then $(q,r) \in E(G)$. \end{theorem} The ordering described in Theorem~\ref{theo:can:ordering} is said to be a \emph{canonical} ordering. Figure~\ref{fig:canonico} depicts an interval graph in which the vertices are presented from left to right in one of its canonical orderings. \begin{figure} \centering \subfigure[]{\label{fig:canonico}\includegraphics[width=64mm]{figures/preliminaries/qualiOrdCan.pdf}} \hspace{0.45cm} \subfigure[]{\label{fig:canonicoproprio}\includegraphics[width=64mm]{figures/preliminaries/qualiOrdCanP.pdf}} \caption{(a) Canonical ordering and (b) proper canonical ordering.} \end{figure} Let $\mathcal{R}$ be an interval model of an interval graph $G$. Note that, if we draw a vertical line that intersects a subset of intervals in $\mathcal{R}$, then these intervals consist of a clique in $G$. This is true because they all contain the point in which this line traverses. Moreover, if the given line traverses a maximal set of intervals, then the corresponding clique is maximal. Figure~\ref{fig:model} depicts an interval model and its maximal cliques for the graph in Figure~\ref{fig:canonico}. The following is a characterization of interval graphs in terms of the maximal cliques of the graph. \begin{figure}[htb] \centering \includegraphics[width=90mm]{figures/preliminaries/qualiModel.pdf} \caption{ An interval model an the maximal cliques of the graph in Figure~\ref{fig:canonico}.} \label{fig:model} \end{figure} \begin{theorem}[\cite{Roberts69}]\label{theo:clique:ordering} A graph $G$ is an interval graph if, and only if, there is an ordering $s_C = C_1,C_2, \ldots, C_k$ of its maximal cliques such that if $v \in C_i \cap C_z$ with $1 \leq i \leq z \leq k$, then $v \in C_j$, for all $i \leq j \leq z$. \end{theorem} The ordering described in Theorem~\ref{theo:clique:ordering} is said to be a \emph{canonical clique} ordering. The ordering of the maximal cliques depicted in Figure~\ref{fig:model}, read from left to right, represents a canonical clique ordering. A \emph{proper interval graph} is an interval graph that admits an interval model in which no interval properly contains another. There is a characterization of proper interval graphs which is similar to that presented in Theorem~\ref{theo:can:ordering}, as described next. \begin{theorem}[\cite{Roberts69}]\label{theo:procan:ordering} A graph $G$ is a proper interval graph if, and only if, there is an ordering $s$ of $V(G)$ such that, for any triple $(p,q,r)$ of $V(G)$ ordered according to $s$, if $(p,r) \in E(G)$, then $(p,q), (q,r) \in E(G)$. \end{theorem} The ordering specified in the previous theorem is defined as a \emph{proper canonical} ordering. The ordering of the vertices of the graph depicted in Figure~\ref{fig:canonicoproprio} from left to right is proper canonical. Note that a proper canonical ordering is also a canonical ordering. An important property of proper canonical orderings is the following: \begin{lemma}[\cite{Roberts69}] Let $G$ be a graph. If $G$ is connected, then a proper canonical ordering of $G$ is unique up to reversion and permutation of true twin vertices. \end{lemma} As a consequence, if $G$ is disconnected, since each component has a unique proper canonical ordering, then the canonical ordering of $G$ consists of a permutation of canonical orderings of each of those components. Let $s$ be an ordering of $V(G)$ and $s_C = C_1,C_2, \ldots, C_k$ an ordering of the maximal cliques of $G$. The sequence $s$ is said to be \emph{ordered according} to $s_C$ if for all $u,v \in V(G)$ such that $u<v$ in $s$, there are no $ 1\leq i <j \leq k$ such that $v \in C_i$, $v \not \in C_j$ and $u \in C_j$. As an example, note that the canonical ordering of the Figure~\ref{fig:canonico} is ordered according to the maximal clique ordering $s_C = C_1,C_2, \ldots, C_6$ of the Figure~\ref{fig:model}. The following lemma relates the characterization of canonical orderings and canonical clique ordering. \begin{lemma}\label{lemma:clique:canonical} Let $G$ be a graph and $s$ be an ordering of $V(G)$. The ordering $s$ is a canonical ordering of $V(G)$ if, and only if, $s$ is ordered according to a canonical clique ordering of $G$. \end{lemma} \begin{proof} Consider $s_C$ a canonical clique ordering of $G$. We will show that is possible to build a canonical ordering $s$ from $s_C$, respecting its clique ordering. To achieve this, first start with an empty sequence $s$. Iteratively, for each element $X$ of the sequence $s_C$, choose all simplicial vertices of $X$, adding them to $s$ in any order and removing them from $G$. Note that some of the vertices of $X$ that were not removed from $G$, because they were not simplicial in $G$, now may be turned simplicial by the removal of vertices. Clearly, at the end of the process, $s$ will contain all the vertices of $G$. Suppose $s$ is not a canonical ordering, that is, there are $p,q,r \in V(G)$, $p<q<r$ in $s$, such that $(p,r) \in E(G)$ and $(q,r) \not \in E(G)$. Let $C_p$, $C_q$ and $C_r$ be the maximal cliques of $s_C$ being processed at moment $p$, $q$ and $r$ were choose, respectively. Note that $C_p < C_q < C_r$ in $S_c$ and, as $C_p$ is the last maximal clique in $s_C$ that contains $p$ and $(p,r) \in E(G)$, $r \in C_p$. Besides, as $(q,r) \not \in E(G)$, $r \not\in C_q$ . Therefore, $r \in C_p \cap C_r$ and $r \not\in C_q$. A contradiction with the fact that $s_C$ is a canonical clique ordering. Hence, $s$ is a canonical ordering. Consider $s= v_1,v_2, \ldots, v_n$ be a canonical ordering of $G$. We prove by induction in $|V(G)| = n$ that $s$ is ordered according to a canonical clique ordering. Clearly, the statement is true for $n = 1$. Suppose that the statement is true for any $1 \leq n'< n$. Let $s'$ be the sequence obtained from $s$ by removing $v_n$. Clearly $s'$ is also a canonical ordering and, by the induction hypothesis, $s'$ is ordered according with a canonical clique ordering $s'_C = C_1,C_2, \ldots, C_k$. Let $C_i$, with $1 \leq i \leq k$, be the first clique of $s'_C$ such that $v_n \in N(C_i)$. Let $C' _j = \{C_j \cap N(v_n)\} \cup \{v_n\}$, $i \leq j \leq k$. Note that, as $s$ is a canonical ordering, for all $C_j$ of $s'_C$, $i < j \leq k$, $\{C_j \cap N(v_n)\}\cup \{v_n\}$ is a maximal clique of $G$. If $C_i \subseteq N(v_n)$, then $s'_C = C_1,C_2, \ldots, C'_i,C'_{i+1}, \ldots, C'_k$ is a canonical clique ordering that matches $s$. Otherwise, $s'_C = C_1,C_2, \ldots, C_i,C'_i,C'_{i+1}, \ldots, C'_k$ is a canonical clique ordering that matches $s$. Therefore, $s$ is ordered according to a canonical clique ordering of $G$. \end{proof} \subsubsection {PQ trees} A \emph{$PQ$ tree}~\cite{BOOTH76} $T$ is a data structure that describes a family $\mathcal{F}$ of permutations of elements from a given set $\mathcal{C}$. In this tree, the set of leaves is $\mathcal{C}$ and the permutation being represented by the tree is the sequence of the leaves from left to right. Regarding internal nodes, they are classified into two types, the $P$ and the $Q$ nodes. An \emph{equivalent} $PQ$ tree $T'$ to $T$ is a tree obtained from $T$ by any sequence of consecutive transformations, each consisting of either permuting the children of a $P$ node, or reversing the children of a $Q$ node. The family $\mathcal{F}$ of permutations of elements from $\mathcal{C}$ represented by $T$ is that of permutations corresponding to all equivalent $PQ$ trees to $T$. Graphically, in a $PQ$ tree, leaves and $P$ nodes are represented by circles and $Q$ nodes by rectangles. Figure~\ref{fig:PQT:exeOp} depicts the described operations. In Figure~\ref{fig:PQT:1}, we have a partial representation of a $PQ$ tree. Figure~\ref{fig:PQT:2} depicts an equivalent $PQ$ tree obtained from a permutation of children of a $P$ node of this tree and Figure~\ref{fig:PQT:3} exemplifies an equivalent $PQ$ tree from the reversion of the children of a $Q$ node. \begin{figure}[htb] \centering \subfigure[]{\label{fig:PQT:1}\includegraphics[width=40mm]{figures/preliminaries/qualiEqPQT.pdf}}\hfil \subfigure[]{\label{fig:PQT:2}\includegraphics[width=40mm]{figures/preliminaries/qualiEqPQT1_1.pdf}}\\ \subfigure[]{\label{fig:PQT:3}\includegraphics[width=40mm]{figures/preliminaries/qualiEqPQT2_1.pdf}}\\\ \caption{A $PQ$ tree (a) and an example of permutations (b) and reversions (c) of children of its nodes. } \label{fig:PQT:exeOp} \end{figure} \clearpage One of the applications from the seminal paper introducing $PQ$ trees is that of recognizing interval graphs. In such an application, each leaf of the $PQ$ tree is a maximal clique of an interval graph $G$ and the family of permutations the tree represents is precisely all the canonical clique orderings of $G$~\cite{BOOTH76}. A $PQ$ tree can be constructed from an interval graph in time $O(n+m)$~\cite{BOOTH76}. In this work we consider $PQ$-trees only in this context. We will say that a vertex belongs to a node of a $PQ$ tree if it belongs to any leaf that descends from this node. Figure~\ref{fig:pre:PQT} depicts a $PQ$ tree of the interval graph of Figure~\ref{fig:canonico} according to the maximal cliques in Figure~\ref{fig:model}. The permutations implicitly represented by this $PQ$ tree are: \begin{itemize} \item $C_1,C_2,C_3,C_4,C_5,C_6$ \item $C_1,C_2,C_3,C_4,C_6,C_5$ \item $C_1,C_2,C_4,C_3,C_5,C_6$ \item $C_1,C_2,C_4,C_3,C_6,C_5$ \item $C_6,C_5,C_4,C_3,C_2,C_1$ \item $C_5,C_6,C_4,C_3,C_2,C_1$ \item $C_6,C_5,C_3,C_4,C_2,C_1$ \item $C_5,C_6,C_3,C_4,C_2,C_1$ \end{itemize} \begin{figure}[htb] \centering \includegraphics[width=40mm]{figures/preliminaries/qualiPQT.pdf} \caption{A $PQ$ tree of the interval graph of Figure~\ref{fig:canonico} according to the maximal cliques in Figure~\ref{fig:model}.} \label{fig:pre:PQT} \end{figure} \subsection {Thinness in Graphs} A graph $G$ is called a \emph{$k$-thin graph} if there is a $k$-partition $(V_1,V_2 \ldots, V_k)$ of $V(G)$ and an ordering $s$ of $V(G)$ such that, for any triple $(p,q,r)$ of $V(G)$ ordered according to $s$, if $p$ and $q$ are in a same part $V_i$ and $(p,r) \in E(G)$, then $(q,r)\in E(G)$. An ordering and a partition satisfying that property are called \emph{consistent}. That is, a graph is $k$-thin if there is an ordering consistent with some $k$-partition of its vertex set. The \emph{thinness} of $G$, or \emph{$thin(G)$}, is the minimum value $k$ for which $G$ is a $k$-thin graph. A graph $G$ is called a \emph{proper $k$-thin graph} if $G$ admits a $k$-partition $(V_1, \ldots, V_k)$ of $V(G)$ and an ordering $s$ of $V(G)$ consistent with the partition and, additionally, for which any triple $(p,q,r)$ of $V(G)$, ordered according to $s$, if $q$ and $r$ are in a same part $V_i$ and $(p,r) \in E(G)$, then $(p,q)\in E(G)$. Equivalently, an ordering $s$ of $V(G)$ such that $s$ and its reverse are consistent with the partition. Such an ordering and partition are called \emph{strongly consistent}. The \emph{proper thinness} of $G$, or \emph{$pthin(G)$}, is the minimum value $k$ for which $G$ is a proper $k$-thin graph. Figures~\ref{fig:c4thin} and~\ref{fig:c4pthin} depict two bipartitions of a graph (where the classes are represented by distinct colors) and two different vertex orderings. The ordering of Figure~\ref{fig:c4thin} is consistent with the corresponding partition but not strongly consistent, while the ordering of Figure~\ref{fig:c4pthin} is strongly consistent with the corresponding partition. Note that $k$-thin graphs (resp. proper $k$-thin graphs) generalize interval graphs (resp. proper interval graphs). The parameter $thin(G)$ (resp. $pthin(G)$) is in a way a measure of how far a graph is from being an interval graph (resp. proper interval graph). The $1$-thin graphs (resp. proper $1$-thin graphs) are the interval graphs (resp. proper interval graphs). For instance, consider the graph $C_4$. Since $C_4$ is not an interval graph, $thin(C_4) > 1$. Figure~\ref{fig:c4} proves that $thin(C_4) = pthin(C_4) = 2$. A characterization of $k$-thin or proper $k$-thin graphs by forbidden induced subgraphs is only known for $k$-thin graphs within the class of cographs~\cite{Bono18}. Graphs with arbitrary large thinness were presented in~\cite{Carl07}, while in~\cite{Bono18} a family of interval graphs with arbitrary large proper thinness was used to show that the gap between thinness and proper thinness can be arbitrarily large. The relation of thinness and other width parameters of graphs like boxicity, pathwidth, cutwidth and mim-width was shown in~\cite{Carl07,Bono18}. Let $G$ be a graph and ${<}$ an ordering of its vertices. The graph $G_{<}$ has $V(G)$ as vertex set, and $E(G_{<})$ is such that for $v < w$, $(v,w) \in E(G_{<})$ if and only if there is a vertex $z$ in $G$ such that $v < w < z$, $(z,v) \in E(G)$ and $(z,w) \not \in E(G)$. Similarly, the graph $\tilde{G}_<$ has $V(G)$ as vertex set, and $E(\tilde{G}_{<})$ is such that for $v < w$, $(v,w) \in E(\tilde{G}_{<})$ if and only if either there is a vertex $z$ in $G$ such that $v < w < z$, $(z,v) \in E(G)$ and $(z,w) \not \in E(G)$ or there is a vertex $x$ in $G$ such that $x < v < w$, $(x,w) \in E(G)$ and $(x,v) \not \in E(G)$. \begin{theorem}\label{thm:coloring-order}\cite{B-M-O-thin-tcs,Bono18} Given a graph $G$ and an ordering ${<}$ of its vertices, a partition of $V(G)$ is consistent (resp. strongly consistent) with the ordering ${<}$ if and only if it is a valid coloring of $G_{<}$ (resp. $\tilde{G}_<$). \end{theorem} \begin{figure}[htb] \centering \subfigure[]{\label{fig:c4thin}\includegraphics[width=40mm]{figures/preliminaries/qualiC4thin.pdf}}\hfil \subfigure[]{\label{fig:c4pthin}\includegraphics[width=40mm]{figures/preliminaries/qualiC4pthin.pdf}}\hfil \caption{(a) A consistent ordering and a (b) strongly consistent ordering of $V(C_4)$, for the corresponding $2$-partitions.} \label{fig:c4} \end{figure} \subsection {Precedence Thinness and Precedence Proper thinness in Graphs} In this work, we consider a variation of the problems described in the last subsection by requiring that, given a vertex partition, the (strongly) consistent orderings hold an additional property. Next, we define the two graph classes deriving from this additional restriction. A graph $G$ is \emph{\fpExt{k}} (resp. \emph{\fppExt{k}}), or \emph{\fp{k}} (resp. \emph{\fpp{k}}), if there is a $k$-partition of its vertices and a consistent (resp. strongly consistent) ordering $s$ for which the vertices that belong to a same part are consecutive in $s$. Such an ordering is called a \emph{precedence consistent ordering} (resp. \emph{precedence strongly consistent ordering}) for the given partition. We define \fpPar{G} (resp. \fpPar{G}) as the minimum value $k$ for which $G$ is \fp{k} (resp. \fpp{k}). The Figure~\ref{fig:a} illustrates a graph that is a \fpp{2} graph. The convention assumed is that the strongly consistent ordering being represented consists of the vertices ordered as they appear in the figure from bottom to top and, for vertices arranged in a same horizontal line, from left to right. Therefore, the strongly consistent ordering represented in Figure~\ref{fig:a} is $s =a,b,c,a',b',c'$. The graph $C_4$ is not \fpp{2}, despite $\pthin(C_4)=2$. It can be easily verified by brute-force that for all possible bipartitions of its vertex set and for all possible orderings $s$ in which the vertices of a same class are consecutive in $s$, the ordering and the partition are not strongly consistent. On the other hand, a \fpp{k} graph is a proper $k$-thin graph. Therefore, the class of \fpp{k} graphs is a proper subclass of that of proper $k$-thin graphs. \begin{figure}[htb] \centering \includegraphics[width=40mm]{figures/preliminaries/qualiExemplo2FPP.pdf} \caption{A \fpp{2} graph.} \label{fig:a} \end{figure} If a vertex order ${<}$ is given, by Theorem~\ref{thm:coloring-order}, any partition which is precedence (strongly) consistent with ${<}$ is a valid coloring of $G_{<}$ (resp. $\tilde{G}_{<}$) such that, additionally, the vertices on each color class are consecutive according to ${<}$. Without loss of generality, the coloring is non-decreasing with respect to the given vertex order. It is easy to prove by induction that a greedy algorithm that starts coloring the vertices with color $1$ and increases by one the color each time the current vertex has a neighbor already colored with the current color, gives to each vertex the minimum color it can have over all proper non-decreasing colorings. In particular, the algorithm uses the minimum possible number of colors. In the following sections we will deal with the case where the vertex partition is given and the problem consists of finding the vertex order. From now on, we will then simply call \emph{precedence consistent ordering} (resp. \emph{precedence strongly consistent ordering}) to one that is such for the given partition. \section{Precedence thinness for a given partition}\label{chpt:pthinness} In this section, we present an efficient algorithm to \fpExt{k} graph recognition for a given partition. This algorithm uses $PQ$ trees and some related properties to validate precedence consistent orderings in a greedy fashion, iteratively choosing an appropriate ordering of the parts of the given partition that satisfies precedence consistence, if one does exist. Formally, the problem addressed in this chapter is the following. \begin{flushleft} \begin{tabular}{ l l } \hline \textbf{\textsc{Problem}:} & \textsc{Partitioned \fp{k}} (Recognition of \fp{k} graphs for a given \\ & partition)\\ \textbf{\textsc{Input}:} & A natural $k$, a graph $G$ and a partition $(V_1,\ldots,V_k)$ of $V(G)$.\\ \textbf{\textsc{Question}:} & Is there a consistent ordering $s$ of $V(G)$ such that the vertices\\ & of $V_i$ are consecutive in $s$, for all $1 \leq i \leq k$? \\ \hline \end{tabular} \end{flushleft} It should be noted that a precedence consistent ordering $s$ consists of a concatenation of the consistent orderings of $G[V_i]$, for all $1 \leq i \leq k$. That is, $s = s_1s_2\ldots s_k$, where $s_1,s_2,\ldots,s_k$ is a permutation of $s'_1,s'_2,\ldots,s'_k$ and $s'_i$ is a canonical ordering of $G[V_i]$, for all $1 \leq i \leq k$. The following property is straightforward from the definition of a precedence consistent ordering. \begin{property}\label{prop:thinness} Let $(V_1,V_2, \ldots, V_k)$ be a partition of $V(G)$, $s$ a precedence consistent ordering and $1 \leq i , j \leq k$. If $V_i$ precedes $V_j$ in $s$, then, for all $u,v \in V_i$ and $w \in V_j$, if $(u,w) \not\in E(G)$ and $(v,w) \in E(G)$, then $u$ precedes $v$ in $s$. \end{property} Property~\ref{prop:thinness} shows that, for any given consistent ordering $s = s_1s_2\ldots s_k$, the vertices of $s_j$ impose ordering restrictions on the vertices of $s_i$, for all $1 \leq i < j \leq k$. This relation is depicted in Figure~\ref{fig:thinness}. This property will be used as a key part of the greedy algorithm to be presented later on. \begin{figure}[htbp] \centering \includegraphics[width=80mm]{figures/pthinness/qualiPropThin.pdf} \caption{Precedence relations among the vertices in a precedence consistent ordering.} \label{fig:thinness} \end{figure} Let $s_T= C_1,C_2, \ldots, C_q$ be a ordering of the maximal cliques of an interval graph $G$ obtained from a $PQ$ tree $T$. Recall from Section~\ref{chpt:preliminaries} that it is possible to obtain a canonical ordering $s$ ordered according to $s_T$. Let $u,v\in V(G)$. We define $T$ as \emph{compatible with the ordering restriction} $u<v$ if there exists a canonical ordering $s$ ordered according to $s_T$ such that $u<v$ in $s$. The following theorem describes compatibility conditions between a $PQ$ tree and an ordering restriction $u<v$. \begin{theorem}\label{theo:thinness} Let $G$ be an interval graph and $T$ be a $PQ$ tree of $G$. Let $X$ be a node of $T$ with children $X_1, \ldots, X_k$ and $u,v \in X$. Denote by $T_X$ the subtree rooted at $X$. The following statements are true. \begin{enumerate}[(i)] \item if $v$ belongs to all leaves of $T_X$, then $T_X$ is compatible with $u<v$ (see Figure~\ref{fig:theo:thinness:1}). \item Let $X_i,X_j \in \{X_1,\ldots,X_k\}$. If $u \in X_i$, $v\not \in X_i$, $v \in X_j$ and $T_X$ is compatible with $u<v$, then $X_i$ precedes $X_j$ in $T_X$ (see Figure~\ref{fig:theo:thinness:2}). \end{enumerate} \end{theorem} \begin{proof}\leavevmode \\ Let $G_X$ be the graph induced by the union of the leaves of $T_X$. \begin{enumerate}[(i)] \item Let $s_x$ be a canonical ordering of $G_X$ and $s'_x$ the ordering obtained from $s_x$ by moving $v$ to the last position. As $v$ is an universal vertex from $G_X$, $s'_x$ is also a canonical ordering of this graph. Consequently, $T_X$ is compatible with $u<v$. \item Suppose $X_j$ precedes $X_i$ in $T_X$ and $T_X$ is compatible with $u<v$. As $v \not \in X_i$, then by Theorem~\ref{theo:clique:ordering}, there is no $X_z$ such that $X_i$ precedes $X_z$ and $v \in X_z$. Otherwise, there would exist three maximal cliques $C_i,C_j,C_z$ such that $C_j<C_i<C_z$ in the ordering of cliques represented in $T_X$ and such that $v \not \in C_i$, $v \in C_j \cap C_z$. Therefore $v<u$ in any canonical ordering $s_X$ of $G$ (Lemma~\ref{lemma:clique:canonical}), a contradiction because $T_X$ is compatible with $u<v$. Thus, $X_i$ precedes $X_j$ in $T_X$. \qedhere \end{enumerate} \end{proof} \begin{figure}[htbp] \centering \subfigure[]{\label{fig:theo:thinness:1}\includegraphics[width=43mm]{figures/pthinness/qualiPQTeo1.pdf}} \hfil \subfigure[]{\label{fig:theo:thinness:2}\includegraphics[width=43mm]{figures/pthinness/qualiPQTeo2.pdf}} \caption{Ordering imposed by Theorem~\ref{theo:thinness} item $i$ ($a$) and item $ii$ ($b$).} \end{figure} Theorem~\ref{theo:thinness} can be used to determine the existence of a $PQ$ tree compatible with an ordering restriction $u<v$. This task can be achieved by considering as the node $X$ of Theorem~\ref{theo:thinness}, each one of the nodes of a given $PQ$ tree $T$. If $T$ violates the conditions imposed by the theorem, $T$ is ``annotated'' in a way that the set of equivalent $PQ$ trees is restricted, avoiding precisely the violations. This procedure continues until all nodes produce their respective restrictions, in which case any equivalent $PQ$ tree allowed by the ``annotated'' tree $T$ is compatible with the given ordering restrictions. If there is no equivalent $PQ$ tree to the ``annotated'' tree $T$, which means there is no way to avoid the violations, then there is no tree which is compatible with such an ordering restriction. The general idea to ``anotate'' a $PQ$ tree is to use an auxiliary digraph to represent required precedence relations among the vertices. This digraph is constructed for each part and any topological ordering of it results in a precedence consistent ordering concerning the vertices of this part. Property~\ref{prop:thinness} is applied to determine the ordering restrictions of the vertices and Theorem~\ref{theo:thinness} to ensure that at the end of the algorithm the vertices are ordered according to a canonical clique ordering. Such a procedure is detailed next. First, the algorithm validates if each part of the partition induces an interval graph. This step can be accomplished, for each part, in linear time~\cite{BOOTH76}. If at least one of these parts does not induce an interval graph, then the answer is \textsc{NO}. Otherwise, the algorithm tries each part as the first of a precedence consistent ordering. For each candidate part $V_i$, $1 \leq i \leq k$, it builds a digraph $D$ to represent the order conditions that the vertices of $V_i$ must satisfy in the case in which $V_i$ precedes all the other parts of the partition. That is, $V_i$ must be ordered in such a way that it is according to a canonical clique ordering and respects the restrictions imposed by Property~\ref{prop:thinness}. In this strategy, the vertex set of $D$ is $V_i$ and its directed edges represent the precedence relations among its vertices. Namely, $(u,v) \in E(D)$ if, and only if, $u$ must precede $v$ in all precedence consistent orderings that have $V_i$ as its first part. The algorithm uses Property~\ref{prop:thinness} to find all the ordering restrictions $u < v$ among the vertices of $V_i$ imposed by the others parts, adding the related directed edges to $D$. Then, by building a $PQ$ tree $T$ of $G[V_i]$, Theorem~\ref{theo:thinness} is used to transform $T$ into $T'$ ensuring that all those ordering restrictions $u < v$ are satisfied. If there is a $PQ$ tree $T'$ of $G[V_i]$ that is compatible with all the ordering restrictions imposed by Property~\ref{prop:thinness}, then the algorithm adds directed edges to $D$ according to the canonical clique ordering represented by $T'$. This step is described below in the Algorithm~\ref{alg:pqtco} and it is similar to the one described in Lemma~\ref{lemma:clique:canonical}. At this point, $D$ is finally constructed and the existence of a topological ordering for its vertices determines whether $V_i$ can be chosen as the first part of a precedence consistent ordering for the given partition. If that is the case, $V_i$ is chosen as the first part and the process is repeated in $G \setminus V_i$ to choose the next part. If no part can be chosen at any step, the answer is \textsc{NO}. Otherwise, a feasible ordering of the parts and of the vertices within each part is obtained and the answer is \textsc{YES}. Next, the validation of the compatibility of $T$ is described in more detail. \begin{algorithm}[htbp] \textbf{Input}: $G$: an interval graph; $D$: a digraph; $T$: a $PQ$-tree;\\ \vspace{0.20cm} \addEdgesFromPQTree{ Let $s_C$ be the canonical clique ordering relative to $T$ \For{\Each $C_i \in s_C$ }{ Let $S$ be the set of simplicial vertices of $C_i$ \For{\Each $v \in S$ }{ \For{\Each $u \in C_{i+1}$} $E(D) \leftarrow E(D) \cup \{(v,u)\}$ } } $G \leftarrow G \setminus S$ } } \caption{\textsc{Adding edges from $PQ$-tree to $D$}} \label{alg:pqtco} \end{algorithm} For each imposed ordering $u<v$ (that is, $(u, v) \in E(D)$), $T$ is traversed node by node, applying Theorem~\ref{theo:thinness}. As a consequence of such an application, if the order of the children of some node $X$ of $T$ must be changed to meet some restrictions, directed edges are inserted on $T$ to represent such needed reorderings. Those directed edges appear among nodes that are children of a same node in $T$. At the end, to validate if $T$ is compatible with all needed reorderings of children of nodes, a topological ordering is applied to the children of each node. If there are no cycles among the children of each node, then there is an equivalent $PQ$ tree $T'$ compatible with all the restrictions. In this case, $T'$ is obtained from $T$ applying the sequence of permutations of children of $P$ nodes and reversals of children of $Q$ nodes which are compliant to the topological orderings. Otherwise, if it is detected a cycle in some topological sorting, then there is no $PQ$ tree of $G[V_i]$ which is compatible with all the set of restrictions. In other words, $V_i$ can not be chosen as the first part in a precedence consistent ordering for the given partition. Algorithm~\ref{alg:kfp} formalizes the procedure. \begin{algorithm}[htbp] \textbf{Input}: $G$: a graph; $k$: a natural number; $\mathcal{V}$: a $k$-partition $(V_1, V_2, \ldots, V_k)$ of $V(G)$; \\ \vspace{0.20cm} \Kpt{ $s \leftarrow \emptyset$\\ \For{\Each $V_i \in \mathcal{V}$ }{ \If{$G[V_i]$ \textsf{\upshape is not an interval graph}}{ \Return (\textsc{NO}, $\emptyset$) } } \While{$\mathcal{V} \neq \emptyset$}{ \For{\Each $V_i \in \mathcal{V}$ }{ $foundFirstPart$ $\leftarrow$ \TRUE \\ Create a digraph $D = (V_i, \emptyset)$\\ Build a $PQ$ tree $T_i$ of $G[V_i]$\\ \For{\Each $V_j \in \mathcal{V}$ \textsf{\upshape such that } $V_j \neq V_i$}{ Let $S$ be the set of precedence relations among the vertices of $V_i$ concerning $V_j$ (Property~\ref{prop:thinness})\\ \For{\Each $(u<v) \in S$}{ $E(D) \leftarrow E(D) \cup \{(u,v)\}$ \\ \For{\Each \textsf{\upshape node $X$ of $T_i$}}{ Add the direct edges, deriving from $(u<v)$, among the children of $X$ (Theorem~\ref{theo:thinness}) \\ } } \For{\Each \textsf{\upshape node} $X$ \textsf{\upshape of} $T_i$}{ Let $D_X = (V', E')$ be the digraph where $V'$ is the set of the children of $X$ and $E'$ are the directed edges added among them\\ \If{\textsf{\upshape there is a topological ordering $s_X$ of $D_X$}}{ Arrange the children of $X$ according to $s_X$ \\ } \Else{ $foundFirstPart \leftarrow$ \FALSE \\ } } } \If{ foundFirstPart}{ \AddEdgesFromPQTree{$G[V_i]$, $D$, $T_i$}\\ \If{\textsf{\upshape there is a topological ordering $s_i$ of $D$}}{ $s \leftarrow ss_i$\\ $\mathcal{V} \leftarrow \mathcal{V} \setminus V_i$\\ \Break } \Else{$foundFirstPart \leftarrow$ \FALSE \\} } } \If{ \Not $foundFirstPart$}{ \Return (\textsc{NO}, $\emptyset$) } } \Return (\textsc{YES}, $s$) } \caption{\textsc{Partitioned \fp{k}}} \label{alg:kfp} \end{algorithm} To illustrate the execution of Algorithm~\ref{alg:kfp}, consider the graph $G$ as defined in Figure~\ref{fig:thinEx} and the $3$-partition $\mathcal{V} = (V_1,V_2,V_3)$ of $V(G)$ where $V_1 = \{a,b,c,d,e,f,g,h,i,j,k,l\}$, $V_2 = \{a',b',c',d',e',f',g,h',i',j',k',l'\}$ e $V_3 = \{a'',$ $b'',c'',d'',e'',f'',g'',h'',i'',j'',k'',l''\}$. For the sake of clearness, in Figure~\ref{fig:thinEx}, the edges with endpoints in distinct parts are depicted in black, the edges with endpoints in a same part are in light gray and the vertices belonging to distinct parts are represented with different colors. Moreover, the vertices of each part, read from the left to right, consist of a canonical ordering of the graph induced by that part. Each part of $\mathcal{V}$ induces the interval graph $G'$ depicted in Figure~\ref{fig:g1:graph}. Figure~\ref{fig:g1:model} depicts a model of $G'$. In this model, all maximal cliques are represented by vertical lines. Figure~\ref{fig:g1:PQT} represents a $PQ$ tree of $G'$ in which each maximal clique is labeled according to the model in Figure~\ref{fig:g1:model}. \begin{figure}[htbp] \centering \includegraphics[width=90mm]{figures/pthinness/qualiThinEx.pdf} \caption{A graph $G$ and a $3$-partition $\mathcal{V} = (V_1,V_2,V_3)$ of its vertices where $V_1 = \{a,b,c,d,e,f,g,h,i,j,k,l\}$, $V_2 = \{a',b',c',d',e',f',g,h',i',j',k',l'\}$ e $V_3 = \{a'',$ $b'',c'',d'',e'',f'',g'',h'',i'',j'',k'',l''\}$.} \label{fig:thinEx} \end{figure} \begin{figure}[htb] \centering \subfigure[]{\label{fig:g1:graph}\includegraphics[width=80mm]{figures/pthinness/qualiG1.pdf}}\\ \subfigure[]{\label{fig:g1:model}\includegraphics[width=90mm]{figures/pthinness/qualiG1Modelaux.pdf}}\\ \subfigure[]{\label{fig:g1:PQT}\includegraphics[width=44mm]{figures/pthinness/G1PQT.pdf}} \caption{An interval graph $G'$ ($a$); an interval model ($b$) and a $PQ$ tree (c) of $G$.} \end{figure} Suppose that, at the first step, the algorithm tries to choose $V_1$ as the first part of the precedence consistent ordering. As mentioned, $G[V_1]\cong G'$ and, according to the model in Figure~\ref{fig:g1:model}, $G[V_1]$ has maximal cliques $C_1 = \{a,b,c\}$, $C_2=\{c,d\}$, $C_3 = \{d,l\}$, $C_4 = \{e,l\}$, $C_5 = \{f,g,l\}$, $C_6 = \{g,j,l\}$, $C_7 = \{h,i,j,l\}$ and $C_8 = \{i,j,k,l\}$. Concerning the edges between $V_1$ and $V_2$ and according to Property~\ref{prop:thinness}, the vertex $a$ of $V_1$ must succeed all the other vertices of this part in any valid canonical ordering. This requirement is translated into the corresponding $PQ$ tree through directed edges as depicted in Figure~\ref{fig:thinEX:PQT:v1v2}. Let $X$ be the current node of $T$. Note that if $X$ is a $Q$ node, then any imposed ordering of a pair of its children implies in ordering all of them. In Figure~\ref{fig:thinEX:PQT:v1v2}, the oriented edges deriving from Property~\ref{prop:thinness} are represented in blue and the edges deriving from the orientation demanded by $Q$ nodes, due to the presence of the blue ones, are represented in orange. Clearly, there is a valid $PQ$ tree that satisfies such orientations. Now the algorithm adds the directed edges to the tree deriving from fact that $V_1$ must also precede $V_3$. Considering the edges between $V_1$ and $V_3$, and according to Property~\ref{prop:thinness}, the vertex $f$ of $V_1$ must succeed all the other vertices of $V_1$ in any valid canonical ordering. This requirement is translated into the $PQ$ tree in Figure~\ref{fig:thinEX:PQT:v1v2}, resulting in the $PQ$ tree in Figure~\ref{fig:thinEX:PQT:v1v3v1v2}. Clearly, no $PQ$ tree can satisfy the given orientation due to the directed cycle at the first level of the tree. Then, $V_1$ can not precede both $V_2$ and $V_3$. \begin{figure}[htb] \centering \subfigure[]{\label{fig:thinEX:PQT:v1v2}\includegraphics[width=44mm]{figures/pthinness/ThinExPQT_V1V2.pdf}}\hfill \subfigure[]{\label{fig:thinEX:PQT:v1v3v1v2}\includegraphics[width=44mm]{figures/pthinness/ThinExPQT_V1V3V1V2.pdf}} \\ \subfigure[]{\label{fig:thinEX:PQT:v2v1}\includegraphics[width=44mm]{figures/pthinness/ThinExPQT_V2V1.pdf}}\hfill \subfigure[]{\label{fig:thinEX:PQT:v1v3}\includegraphics[width=44mm]{figures/pthinness/ThinExPQT_V1V3.pdf}} \caption{The edges added to the $PQ$ tree of Figure~\ref{fig:g1:PQT} through the example of execution of the Algorithm~\ref{alg:kfp}.} \end{figure} \begin{figure}[htb] \centering \subfigure[]{\label{fig:v2:d}\includegraphics[width=90mm]{figures/pthinness/DAM_DV2.pdf}} \subfigure[]{\label{fig:v1:d}\includegraphics[width=90mm]{figures/pthinness/DAM_DV1.pdf}}\\ \caption{Related digraph $D$ when $V_2$ is chosen as the first part ($a$) and when $V_1$ is chosen as the second part ($b$) in Algorithm~\ref{alg:kfp}.} \end{figure} As $V_1$ can not be chosen as the first part, the algorithm tries another part as the first of the precedence consistent ordering. Suppose it now chooses $V_2$ as the first part. The interval graph $G[V_2]$ has as maximal cliques $C_1 = \{a',b',c'\}$, $C_2=\{c',d'\}$, $C_3 = \{d',l'\}$, $C_4 = \{e',l'\}$, $C_5 = \{f',g',l'\}$, $C_6 = \{g',j',l'\}$, $C_7 = \{h',i',j',l'\}$ and $C_8 = \{i',j',k',l'\}$. Note that, as there are no edges between $V_2$ and $V_3$, $V_2$ can precede $V_3$ in any valid consistent ordering. The algorithm must decide whether $V_2$ can precede $V_1$. According to the Figure~\ref{fig:thinEx} and Property~\ref{prop:thinness}, the vertices $\{a',b',c',d'\}$ of $V_2$ must succeed all the other vertices of the same part in any valid consistent ordering. This requirement is again translated into directed edges in the $PQ$ tree of $V_2$ as depicted in Figure~\ref{fig:thinEX:PQT:v2v1}. Clearly, there is a $PQ$ tree $T'$ satisfying those directed edges. Then, the algorithm adds the edges deriving from the canonical clique ordering represented by $T'$ to $D$. Figure~\ref{fig:v2:d} depicts the final state of $D$ once the necessary edges has been added. In this figure, the edges deriving from Property~\ref{prop:thinness} are presented with an orange color and the edges related to $T'$ are presented in a blue color. For readability, in these figures the edges that can be obtained by transitivity are omitted. As there no cycles in $D$, $V_2$ can precede $V_1$ and $V_3$. A topological ordering of $D$ leads to the canonical ordering $s =e',f',g',h',i',j',k',l',d',a',b',c'$ of $G[V_2]$. After deciding $V_2$ as the first part, the algorithm uses the same process to choose the second part. Suppose it tries $V_1$ as the second part. Figure~\ref{fig:thinEX:PQT:v1v3} depicts the edges added to the $PQ$ tree of $G[V_1]$. As there are no cycles in the edges added, there is a tree which is compatible with the precedence relations associated with $V_1<V_3$. Figure~\ref{fig:v1:d} depicts the final state of the digraph $D$ related to $V_1$. As there are no cycles in $D$, $V_1$ can precede $V_3$, so the algorithm chooses it as the second part. Finally, the algorithm chooses $V_3$ as the last part and determine that there is a precedence consistent ordering such that $V_2<V_1<V_3$. Concerning the complexity of the given strategy, each time one of the $k$ parts is tried to be the first, we build a new digraph $D$, a new $PQ$ tree $T$ and obtain the precedence relations according to Property~\ref{prop:thinness}. Enumerating all the precedence relations requires at most $O(n^3)$ steps, which is the time that it takes to iterate over all triples of vertices of the graph. Moreover, each one of these relations must be mapped to $D$, which takes time $O(1)$, and $T$. First, note that the number of nodes of $T$ is asymptotically bounded by its number of leaves, that is, by the number of maximal cliques of the part being processed. As the number of maximal cliques is bounded by the number of vertices of the given part, the number of nodes of $T$ is $O(n)$. Consequently, it is possible to model a precedence relation of type $u<v$ into $T$, using Theorem~\ref{theo:thinness}, in time $O(n^2)$. To achieve this, first $T$ is traversed, in order to decide which nodes contain (resp. not contain) $u$ and $v$. A traversal of $T$ can be done in time $O(n)$, and $T$ can be constructed in $O(n+m)$ time. Additional steps will be necessary and generate new traversals in $T$ following the tree levels, with the purpose to add the necessary directed edges among the vertices that are children of the same node. This step can be done in $$\sum_{v \in V(T)}{ d^2(v)} \leq \sum_{v \in V(T)}{d(v)|V(T)|} = O(|E(T)| |V(T)|) = O(|V(T)|^2) = O(n^2)$$ \noindent as $|E(T)| = O(|V(T)|)$ and $|V(T)| = O(n)$. Aiming to verify the existence of a compatible tree, the algorithm applies a topological ordering to the children of each node of $T$, which takes overall time $O(n(n+m))$. Then, the ordering in $T$ is translated to $D$ through directed edges. By using the Algorithm~\ref{alg:pqtco}, this step requires no more than $O(n^2+m)$ operations. Finally, a topological ordering is applied to $D$. Thus, the algorithm has $$O(k^2(n+m+n^3n^2+n^2+nm+n^2+m+n+m)) = O(k^2n^5)$$ time complexity.
\section{Introduction} \label{intro} The three-dimensional Schr{\"o}dinger equation has a closed-form analytical solution for only a very small class of systems (i.e. a free particle in a box, harmonic oscillator, or some central potentials). In all other cases, one has to rely on approximations, perturbation theory, or numerical solutions. In particular, most quark models used for phenomenological descriptions of QCD bound states are described by the three-dimensional Schr{\"o}dinger equation with a wide variety of potentials. Potential-based quark models have enjoyed a long history of success in describing below-threshold charmonium production and bottomonium spectra and have helped to establish confidence in QCD as the first-principle description of hadronic matter, see e.g. Refs.\cite{Ebert:2002pp, Eichten:2007qx, Segovia:2016xqb}. In recent years, non-relativistic effective field theory methods have allowed for a first-principles approach to potential-based non-relativistic QCD (pNRQCD)~\cite{Brambilla:1999xf,Brambilla:1999qa}. Additionally, in order to describe quarkonium evolution in the quark-gluon plasma, such potential models have been extended to finite temperature \cite{Laine:2006ns,Brambilla:2008cx,Brambilla:2010xn} and non-equilibrium \cite{Dumitru:2007hy,Burnier:2009yu,Dumitru:2009fy,Dumitru:2009ni,Guo:2018vwy}, in which case, the potentials are no longer real-valued or spherically symmetric. In the full non-equilibrium case, it is necessary to use a full three-dimensional Schr{\"o}dinger equation solver that allows for complex potentials In the past, a parallelized solver called \texttt{quantumfdtd} has been made available for real-valued~\cite{Strickland:2009ft} and complex-valued \cite{Margotta:2011ta} potentials. The two previous versions of \texttt{quantumfdtd} use local operators in a finite-difference time-domain (FDTD) scheme for solving the non-relativistic three-dimensional Schr{\"o}dinger~equation. However, if light quarks are involved, such as in heavy-light mesons, e.g. in B mesons, these have to be described as relativistic degrees of freedom. The light quark's relativistic dispersion results in a much larger average radius of the state, namely with the wave-function's falloff in the case of a linearly rising Cornell potential $V(r) = -A/r+C r$ like $\psi(r) \sim \exp(-\mu r)$ instead of $\psi(r) \sim \exp(-\mu r^{3/2})$ ($\mu$ being the reduced mass of the system)~\cite{Duncan:1994uq}. While spin-orbit and spin-spin corrections can be accounted for in terms of angular-momentum-dependent contributions beyond a simple central potential, at a fundamental level, the change to relativistic dispersion requires an implementation of a relativistic kinetic term in the Schr{\"o}dinger equation. For this reason we extend the existing \texttt{quantumfdtd} parallelized 3D Schr{\"o}dinger solver~\cite{Strickland:2009ft, Margotta:2011ta} to permit a relativistic kinetic term. These relativistic quark model calculations have a purpose beyond the purely phenomenological calculations. It has been clearly demonstrated in the past~\cite{Duncan:1994uq} that heavy-light meson wave-functions from relativistic quark models provide interpolating operators for heavy-light mesons with excellent excited-state suppression in first-principle lattice QCD calculations, see i.e. Fig.~\ref{fig:effMass} for a very recent application. In this context, the question of heavy-light tetraquarks looms large. A three-dimensional relativistic Schr{\"o}dinger equation solver may be able to deliver interpolating operators for first-principle lattice QCD studies that are able to enhance overlap factor for certain geometries\footnote{The present version of the \texttt{quantumfdtd} code is not particularly well suited for an extension to systems with two fermionic degrees of freedom interacting with each other in the background of another potential, which would be needed if the two light quarks were not represented as a light diquark.} (i.e. spherical symmetry in a light-diquark heavy-antidiquark system, or cylindric symmetry in a light-diquark heavy-antiquark heavy-antiquark system) of tetraquarks, while effectively suppressing the excited states. Such an approach might make a resolution of the geometric structure of tetraquarks feasible and distinguish between a wide range of possible scenarios. \begin{figure}[!ht] \centering \igg{effM_fin.pdf} \caption{\label{fig:effMass} Effective mass plot for a heavy-strange meson correlation function (static limit for the heavy quark with 1 step of 4D hypercubic smearing~\cite{Hasenfratz:2001hp}, and the highly improved staggered quark discretization~\cite{Follana:2006rc} for the strange quark) with different source and sink operators. The source operators are either point-type (namely, random Z(2) noise sources with no momentum projection) or wall-type (namely, corner wall sources, with momenta $p_i = n\pi/A$). The sinks are either point sinks, wall sinks or relativistic quark model inspired wave-functions obtained with the code discussed here. Simulations were conducted in (2+1+1)-flavor QCD with physical sea and lattice spacing $a \approx 0.15$~fm using MILC ensembles~\cite{Bazavov:2017lyh} and the publicly available MILC code~\cite{MILC}. The dotted line shows the average of the data obtained using the wave-function sink and the gray band shows the respective standard deviation. It is clearly visible how much excited state suppression can be gained by using wave-functions at the sink.} \end{figure} In this work, we extend the original \texttt{quantumfdtd} code~\cite{Strickland:2009ft, Margotta:2011ta}. The new version, like the old version, allows one to compute the ground-state and low-lying excited state three-dimensional (3D) wave-functions and their corresponding energies for both real- and complex-valued potentials. We implement a new relativistic kinetic term and add two new non-relativistic ones, both of which are Fast Fourier Transform (FFT) based and implemented using the paralleized \texttt{FFTW} library. In addition, the original code has been extended so that it supports arbitrary external potentials and the option to project out distinct parity eigenstates from the solutions. These options also work with the original implementation of the finite-difference time-domain (FDTD) solver for the non-relativistic Schr{\"o}dinger equation. Because of the original code design, we use a 3-D Cartesian, homogeneous and isotropic lattice with $N$ points in each dimension and lattice spacing $A$ (in units of $\text{GeV}^{-1}$). No adaptive engine has been implemented. The solver depends on the MPI library to distribute the lattice between the MPI processes. Finally, we note that by construction, the original FDTD solver for the non-relativistic Schr{\"o}dinger equation used Dirichlet boundary conditions. For the new kinetic terms, based on the Fast Fourier Transform (FFT), periodic boundary conditions are used. The potential can be centered either in the lattice volume at the point $(N/2,N/2,N/2)$ or in the origin at the point $(0,0,0)$. We use the original iterative solver (see Ref.~\cite{Strickland:2009ft} and section~\ref{subsec_iter} where we review the method). This paper is organized as follows: In section~\ref{sec_rel_kin} we introduce the newly implemented kinetic terms (subsection~\ref{subsec_kin}), the iterative procedure (subsection~\ref{subsec_iter}), and the parity projection scripts (subsection~\ref{subsec_parity_proy}). In section~\ref{sec_examples} we show and compare results obtained using the different kinetic terms. In section~\ref{sec_compile}, the program requirements are listed and basic instructions for compilation and running are provided. In section~\ref{sec_params}, we show the basic configuration parameters of the program (subsection~\ref{subsec_basic_params}) and list the different initial conditions (subsection~\ref{subsec_icond}) that are implemented. We furthermore list the hard-coded potentials in subsection~\ref{subsec_hpot}, and present a newly implemented option that allows the user to load potentials from external files (subsection~\ref{subsec_epot}). The new post-processing scripts, which include parity projection scripts for wave-functions, are explained in section~\ref{subsec_post_scripts}. We end with a conclusion in section~\ref{sec_conclus}. \section{The new relativistic kinetic term} \label{sec_rel_kin} The Schr{\"o}dinger Hamiltonian \begin{equation} H = H_{K} + V(\vec{r}) \,, \end{equation} can be generally split into a kinetic piece, $H_{K}$, and into a potential $V(\vec{r})$. On the one hand, the non-relativistic kinetic term is given by \begin{equation} \label{eq:HKnr} H_{K}^{nr} = \sum\limits_{i=1,2,3} \frac{p_{i}^{2}}{2m} \,, \end{equation} where $\vec{p} = (p_{1},p_{2},p_{3})$ is the spatial three momentum. On the other hand, the relativistic term is given by \begin{equation} \label{eq:HKrel} H_{K}^{rel} = \sqrt{ m^2 + \sum\limits_{i=1,2,3} p_{i}^{2} } \,, \end{equation} if neither spin nor antiparticle degrees of freedom are given consideration. In the following subsections we describe the newly implemented (relativistic) kinetic terms. \subsection{Kinetic terms} \label{subsec_kin} There are three newly implemented kinetic terms, $H_{K}^{(i)}$, ($i = 1,2,3$), on top of the one based on the finite-difference time-domain (FDTD) method, $H_{K}^{(0)}$, with Dirichlet boundary conditions ($\Psi(\text{boundary}) \equiv 0$). Its action on a wave-function $\Psi = \Psi(\vec{r})$, ($\vec{r} = (Ax_{1},Ax_{2},Ax_{3})$ being spatial coordinates and $x_{1},x_{2},x_{3} \in \{0,1,\ldots, N-1\}$) is given by \begin{equation} \label{eq:HK0} H_{K}^{(0)} \Psi = - \frac{1}{2M} \sum_{l = \pm 1}^{\pm 3} \frac{1}{2A}\frac{\Psi(r + \hat{e}_l) - \Psi(\vec{r})}{A} \,, \end{equation} where $\hat{e}_{l}$ denotes the (signed) unit vector in the $l$ direction ($l = \pm 1,\pm 2, \pm 3$). We write $\Psi(\vec{r}) \equiv \Psi[(Ax_{1}, Ax_{2}, Ax_{3})]$ for convenience reasons. In particular, the FDTD kinetic term $H_{K}^{(0)}$ is based on Taylor expansions on the lattice sites and assumes continuity and differentiability. In momentum space this term corresponds to \begin{equation} \label{eq:HK0_momentum_space_1} H_{K}^{(0)} \Psi(\vec{p}) = \frac{1}{2M} \sum\limits_{l=1}^{3} \frac{4}{A^2}\sin^{2}\left(\frac{A p_{l}}{2}\right) \Psi(\vec{p}) \,, \end{equation} where$ A p_{l}$ is real-valued and satisfies $-\pi < A p_{l} \le \pi$. These coefficients are not constrained to a finite set of momenta (due to the absence of periodic boundary conditions). In the following we write $k_l \equiv A p_l$ for convenience. Note that there are no fundamental limitations for a modified FDTD kinetic term with periodic boundary conditions, although it would require a substantial addition of structure encoding the communication across this boundary in the present version of the code. The newly implemented kinetic terms depend on the FFT and, hence, use periodic boundary conditions, and have the momenta constrained to the eigenmodes of the finite box, i.e. \begin{equation} \label{eq:eigenmodes} k_{l} \equiv A p_{l} \in \{ -\pi+2\pi/N, \ldots, 0, 2\pi/N, 4\pi/N, \ldots \pi \} \,, \end{equation} for $l = 1,2,3$. The action of the new kinetic terms on a wave-function $\Psi = \Psi(\vec{r})$ ($\vec{r} = (Ax_{1}, Ax_{2}, Ax_{3})$ being spatial coordinates) is given in terms of the Fast Fourier Transform (FFT) and Inverse Fast Fourier Transform (IFFT) operators (realized through \texttt{FFTW}) by \begin{align} & H_{K}^{(1)} \Psi = \frac{1}{2A^{2}M N^{3}} \cdot \mathop{\text{IFFT}}\left[ \sum\limits_{l=1,2,3} \left(k_{l}\right)^{2} \cdot \mathop{\text{FFT}}[\Psi] \right] \,, \label{eq:HK1} \\ & H_{K}^{(2)} \Psi = \frac{1}{2A^{2}M N^{3}} \cdot \mathop{\text{IFFT}}\left[ 4\sum\limits_{l=1,2,3} \sin^{2}\!\left(\frac{k_{l}}{2}\right) \cdot \mathop{\text{FFT}}[\Psi] \right] \,, \label{eq:HK2} \\ & H_{K}^{(3)} \Psi = \frac{1}{A N^{3}} \cdot \mathop{\text{IFFT}}\left[ \sqrt{4\sum\limits_{l=1,2,3} \sin^{2}\!\left(\frac{k_{l}}{2}\right) + (AM)^{2}} \cdot \mathop{\text{FFT}}[\Psi] \right] \,,\label{eq:HK3} \end{align} where the FFT and IFFT operations are defined via \begin{align} & \left(\mathop{\text{FFT}}[\psi]\right)(k_1,k_2,k_3) = \sum\limits_{x_1,x_2,x_3} \Psi \cdot \exp\left( -\sum_{l=1}^3 k_{l}\cdot x_l \right) \,, \\ & \left(\mathop{\text{IFFT}}[\tilde{\Psi}]\right)(x_1,x_2,x_3) = \!\! \sum\limits_{k_{1},k_{2},k_{3}} \!\! \tilde{\Psi} \cdot \exp\left( \sum_{l=1}^3 k_{l}\cdot x_l \right) \,. \end{align} Due to the realization of the kinetic terms through the FFT, optimized communications across the inter-node boundaries, as done in the FDTD approach, are not required here. The term $H_{K}^{(1)}$ is a discretized FFT implementation of the classical non-relativistic kinetic term $H_{K}^{nr}$, Eq.~\eqref{eq:HKnr}. For this reason, the discretization errors of Eq.~\eqref{eq:HK0_momentum_space_1}, namely, \begin{equation} \label{eq:HK0_momentum_space} \left[ H_{K}^{(0)} -H_{K}^{nr} \right] \Psi(\vec{p}) = \frac{1}{2M}\sum\limits_{l=1}^3 \frac{2}{A^2}\sum\limits_{n=2}^\infty (-1)^n \frac{(A p_l)^{2n}}{(2n)!} \Psi(\vec{p}) \,, \end{equation} are completely absent in $H_{K}^{(1)}$. Note that although $H_{K}^{(1)}$ formally seems to avoid the breaking of the $O(3)$ symmetry to the cubic group, this symmetry breaking is implicit in the FFT. The $2\pi$ periodicity and restriction to the interval of Eq.~\eqref{eq:eigenmodes} is automatically realized in the FFT implementation. Using the Symanzik effective field theory~\cite{Symanzik:1983dc, Symanzik:1983gh} the discretization errors of $H_{K}^{(0)}$ could be systematically reduced by including more extended stencils with adjusted coefficients, e.g. \begin{align} \label{eq:HK0imp_momentum_space} &\begin{aligned} H_{K}^{(0), \text{imp}} \Psi(\vec{p}) &= \frac{1}{2M}\sum\limits_{l=1}^{3} \frac{4}{A^2} \left[ c_0\sin^2\left(\frac{A p_l}{2}\right)+ c_1\sin^2(A p_l) \right] \Psi(\vec{p}), \\ &= \frac{1}{2M}\sum\limits_{l=1}^{3} \frac{2}{A^2} \sum\limits_{n=1}^\infty \frac{c_0+2^{2n}c_1}{(2n)!} (Ap_l)^{2n} \Psi(\vec{p}) \,, \end{aligned} \\ \label{eq:HK0imp_coordinate_space} &\begin{aligned} H_{K}^{(0), \text{imp}} \Psi(\vec{r}) &= \frac{1}{2M}\sum\limits_{l=\pm 1}^{\pm 3} \frac{1}{2A} \frac{c_0\left[ \Psi(\vec{r}+\hat{e}_l) -\Psi(\vec{r}) \right] + c_1\left[ \Psi(\vec{r}+2\hat{e}_l) -\Psi(\vec{r}) \right]}{A} \,. \end{aligned} \end{align} The choice $c_0 = 4/3$, $c_1 = -1/12$ restores the leading term to its continuum coefficient and cancels the second term in the series. Hence, there cannot be any local coordinate space representation of $H_{K}^{(1)}$, since infinitely many stencils up to infinite extent would be required to completely remove the discretization errors. The term $H_{K}^{(2)}$ is an FFT implementation of the classical non-relativistic kinetic term $H_{K}^{(0)}$ for periodic boundary conditions. Due to the different boundary conditions there are differences between those terms that vanish in the infinite volume limit. However, the discretization errors of $H_{K}^{(0)}$ and $H_{K}^{(2)}$ are formally equivalent as they have the same coefficients in the Symanzik effective theory in the infinite volume limit. The term $H_{K}^{(3)}$ is the newly implemented relativistic kinetic term, which realizes the most simple discretized version of Eq.~\eqref{eq:HKrel}. It is inspired by a relativistic quark model (RQM)~\cite{Duncan:1994uq} and can be used by means of the \texttt{KINTERM} parameter (see Section~\ref{sec_params}). There is no local or continuously differentiable coordinate space representation of the relativistic kinetic term, as is evident from the momentum dependent term under the square root. Using Symanzik effective theory~\cite{Symanzik:1983dc, Symanzik:1983gh} the discretization errors of $H_{K}^{(3)}$ could be systematically reduced by including more extended stencils with adjusted coefficients just as in the non-relativistic case. It is also straightforward to construct an relativistic analog to $H_{K}^{(1)}$. None of these two obvious extensions have been pursued in this version of the program. Note that the FDTD kinetic term, $H_{K}^{(0)}$, and each of the FFT kinetic terms, $H_{K}^{(i)}$, $i = 1,2,3$, are qualitatively different and, in practice, exhibit different numerical behavior. On the one hand, comparing the results of $H_{K}^{(0)}$ and $H_{K}^{(2)}$ permits a quantitative study of finite volume errors while using a single volume, due to the different boundary conditions. On the other hand, comparing the results of $H_{K}^{(1)}$ and $H_{K}^{(2)}$ permits a quantitative study of discretization errors while using a single lattice spacing, due to different coefficients in the Symanzik effective theory. Nevertheless, the dependence of the low-energy spectrum on these differences is usually very small. On the contrary, the relativistic kinetic term encodes qualitatively different physics already in the low-energy spectrum. \subsection{The iterative procedure} \label{subsec_iter} The iterative procedure is unmodified w.r.t. \texttt{quantumfdtd v.2}. That is, it is the very same procedure as described in section~3 of Ref.~\cite{Strickland:2009ft}, \begin{equation} \label{iter_proced} \Psi(x_{1},x_{2},x_{3},\tau+\Delta\tau) = \mathcal{A} \Psi(x_{1},x_{2},x_{3},\tau) - \mathcal{B} \Delta\tau H_{K} \Psi(x_{1},x_{2},x_{3},\tau) \,. \end{equation} Equation~\ref{iter_proced} is the result of a Wick rotation of the Schr{\"o}dinger Equation, $it \to \tau$. The evolution with $\tau$ is given by Eq.~(2.5) of Ref.~\cite{Strickland:2009ft}, \begin{equation} \label{iter_decay} \Psi(x_{1},x_{2},x_{3},\tau) = \sum_{i=0}^{\infty} a_{n}\Psi_{i}(x_{1},x_{2},x_{3}) e^{-E_{i} \tau} \,, \end{equation} where $E_{i}$ is the $i$-th eigen-energy of the Hamiltonian and $\{a_0,a_1,\dots\}$ are the decomposition coefficients of the initial guess $\Psi(x_{1},x_{2},x_{3},0)$ in the basis of eigenvectors. In order to compute excited states, overlaps between the last wave-function snapshots\footnote{% See flag \texttt{SNAPUPDATE} on page~\pageref{flag_snapupdate}, section~\ref{flag_snapupdate}.} are used. Note that, at some point $e^{-E_{i} \tau}$ will become smaller than the machine precision. Hence, for large enough values of $\tau$, the only wave-function that can be recovered is the ground state and the overlap procedure will not be able to recover any excited states, as we will see in detail in the next section~\ref{sec_examples}. We improve the previous version of the code by adding the option of using a kinetic term $H_{K}^{(i)}$, $i = 1,2,3$, based on the FFT scheme of section~\ref{subsec_kin}, instead of the one based on finite differences, $H_{K}^{(0)}$. In all cases, the values of $\mathcal{A}$ and $\mathcal{B}$ are taken to be the same as in~\cite{Strickland:2009ft}, \begin{equation} \mathcal{A} = \frac{1 - \frac{\Delta\tau}{2} V_{b}(x_{1},x_{2},x_{3})}{1 + \frac{\Delta\tau}{2} V_{b}(x_{1},x_{2},x_{3})} \,,\quad \mathcal{B} = \frac{1}{1 + \frac{\Delta\tau}{2} V_{b}(x_{1},x_{2},x_{3})} \,. \end{equation} The time step $\Delta\tau$ is an independent parameter that should be chosen as small as necessary to reduce the discretization errors of the time evolution and achieve good convergence, while being as large as permissible to minimize the computational expense. Both of these limitations depend on the combination of the kinetic term and the potential. \subsection{Parity projection} \label{subsec_parity_proy} We include a script\footnote{% See section~\ref{subsec_post_scripts}, page~\pageref{subsec_post_scripts}.} for computing the positive, $P^{+}$, negative, $P^{-}$, and negative-around-an-axis, $P^{-}_{p_{k}}$, parity projections of the wave-function, \begin{align} \label{eq_parity} & P^{\pm} \Psi(\vec{r}) = \frac{1}{2} \left(\Psi(\vec{r}) \pm \Psi(-\vec{r})\right) \,, \\ \label{eq_parity_axis} &\begin{aligned} P^{-}_{\vec{p}_{k} = \hat{e}_{3}} \Psi(x_{1},x_{2},x_{3}) & = \frac{1}{2} \left[ \Psi(x_{1},x_{2},x_{3}) + \Psi(-x_{1},-x_{2},x_{3}) \right. \\ & \left. - \Psi(x_{1},x_{2},-x_{3}) - \Psi(-x_{1},-x_{2}-x_{3}) \right] \,. \end{aligned} \end{align} Here, we have chosen $\vec{p}_{k} = \hat{e}_{3} = (0,0,1)$, although the script accepts $\hat{e}_{1}$ and $\hat{e}_{2}$ as well. The aim is to separate the positive parity $s$-waves from the negative-parity $p$-waves. For the $p$-wave states, the negative-around-an-axis, $P^-_{\vec{p}_k}$ separate the states with different magnetic quantum number $m \in \{0,\ \pm 1\}$. It is straightforward to extend these scripts for projection to the higher multipoles, if the need should arise. We include a second script that normalizes the wave-function via enforcing that $\int_{V} dV \lvert\Psi\rvert^2 = 1$, within the lattice volume $V$. \section{Examples} \label{sec_examples} \subsection{Initial conditions and studied cases} \label{subsec_examples} \begin{figure}[ht] \centering \begin{minipage}{.54\textwidth} \igg{potential_KIN0.png} \end{minipage} \begin{minipage}{.44\textwidth} \caption{\label{fig_pots} The Coulomb potential used for the following analysis. The lattice spacing is $A=0.12$~fm. We use $N=64$ points in each spacial direction, and the potential is centered in the lattice volume at the point $(N/2,N/2,N/2) = (32,32,32)$.} \end{minipage} \end{figure} We discuss the convergence of the iterative procedure (see the previous sections~\ref{subsec_kin} and~\ref{subsec_iter}) in the following. Furthermore, we study the performance of the overlap method for separating the excited states (see section~\ref{subsec_iter}), as well as the behavior of the parity projections (see section~\ref{subsec_parity_proy}). We use, unless stated otherwise, the Coulomb-like potential as our benchmark one, setting \texttt{POTENTIAL=2} (see subsection~\ref{subsec_hpot}) as it is shown in Fig.~\ref{fig_pots}. This lattice implementation of the Coulomb potential has a discretization artifact at its center, leading to suppressed contributions from radii at the order of the lattice spacing, $r \sim A$. This is the dominant discretization artifact at small distances in all of the following examples. Along these lines we use the Coulomb-like initial conditions, setting \texttt{INITCONDTYPE=2} (see subsection~\ref{subsec_icond}). We set the lattice spacing $A=0.12$~fm and use a reduced mass $M=0.3$~GeV. Due to $(A\cdot M)^2 \approx 0.03$, we expect mild finite mass discretization errors. In all of the cases, we do not plot points that are closer than $0.15N$ to one of the edges\footnote{% $\texttt{max\_\allowbreak{}sep\_\allowbreak{}edge} = 0.3$ (see section~\ref{subsec_post_python}).}, in order to avoid zones where finite volume effects are prominent. All of the wave-functions are normalized within the resulting box so that \begin{equation} \sum\limits_{r} \lvert\Psi(r)\rvert^2 = 1 \,, \end{equation} where the sum over $r$ evaluates over all of the points that are effectively plotted. We plot the positive parity projection $P^+$ (Eq.~\ref{eq_parity}), and the negative parity around-an-axis $P^-_{\vec{p}_k}$. We do not plot a projected wave-function if its weight is less than $10^{-5}$. However, we need to stress that the overlapping procedure used for extracting ground and excited states out of the iterative procedure (section~\ref{subsec_iter}) can also introduce numerical artefacts affecting excited states. This section is organized as follows: In subsection~\ref{subsec_ex_relativ}, we study the convergence of the relativistic $H_{K}^{(3)}$ kinetic term. A selection of wave-functions at different $\tau$ is shown, as well as the evolution of the energies and the weights of the parity projections for each state. In subsection~\ref{subsec_ex_nonrelativ}, we compare the non-relativistic kinetic terms $H_{K}^{(0)}$ (FDTD based), $H_{K}^{(1)}$, and $H_{K}^{(2)}$ (both FFT based). In subsection~\ref{subsec_ex_relativ_vs_nonrelativ_high_mass}, we increase the reduced mass to $M=3$~GeV, and compare the relativistic kinetic term $H_{K}^{(3)}$ with the non-relativistic one $H_{K}^{(2)}$. In subsection~\ref{subsec_ex_increase_volume}, we compare the non-relativistic kinetic terms $H_{K}^{(0)}$ (FDTD based) with $H_{K}^{(2)}$ (FFT based) at an increased lattice volume using $N=128$. In subsection~\ref{subsec_ex_parity_fixing}, we study the parity fixing machinery of \texttt{quantumfdtd}, for both symmetrization and anti-symmetrization. We use the non-relativistic kinetic term $H_{K}^{(0)}$ (FDTD) as an example. Finally, in subsection~\ref{subsec_conv_conditions}, we summarize the convergence conditions and numerical behavior of the program. \subsection{\texorpdfstring{The relativistic kinetic term $H_{K}^{(3)}$}{The relativistic kinetic term H\_K(3)}} \label{subsec_ex_relativ} In this section, the relativistic FFT based kinetic term $H_{K}^{(3)}$ (Eq.~\ref{eq:HK3}, section~\ref{subsec_kin}), is studied. We use $N=64$ points in each direction and plot the convergence of the energies with $\tau$ (left plot in Fig.~\ref{fig_energ_KIN3}), the relative weights of the parity projection for the 3 lowest states vs. $\tau$ (right plot in Fig.~\ref{fig_energ_KIN3} and Fig.~\ref{fig_proj_KIN3}). Finally we plot the parity projections of the wave-functions for 4 selected values of $\tau$ (Figs.~\ref{fig_fig_KIN3_1} and~\ref{fig_fig_KIN3_2}). Note that, for $\tau > 125$~GeV$^{-1}$, the weights of the excited states fall below the computational accuracy, $\epsilon$, of the computer. For a 64 bit architecture, $\epsilon \sim 10^{-16}$. Below this threshold we expect numerical artefacts which can be seen in the right plot of Fig.~\ref{fig_energ_KIN3}, where the exponential decay breaks for a weight of the minor component of the parity projection $\sim 10^{-21}$. See also, on the left side of Fig.~\ref{fig_energ_KIN3}, that the energy of the first excited state decays to that of the ground state because the overlap method is no longer able to separate the first excited state from the ground state once numerical artefacts show up. For large values of $\tau$, the energy of the \emph{excited states} decays to that of the ground state, whose energy eigenvalue remains stable throughout the evolution. The relative weights of the parity projections of the excited states decay exponentially, as expected from Eq.~\ref{iter_decay}, but their behavior starts to deviate from the exponential decay for high enough values of $\tau$, where numerical artefacts are expected. Note also a first crucial point at $\tau \sim 60-65$~GeV$^{-1}$, where the energy, $E_2$, of the second excited state degenerates with $E_1$. This can also be seen in the relative weights of the parity projections of the second excited state shown in the right plot of Fig.~\ref{fig_proj_KIN3}. For high values of $\tau$, but not high enough to hit the aforementioned cancellation issues, the parity projected wave-functions are stable with $\tau$. The negative parity projections around an axis, $P^-_{\vec{p}_k}$, of different separated states are compatible (they actually come from the same $2p$ state). Additionally, there are 2 positive parity projections, $P^+$. The $1s$ ground state and the $2s$ excited state. This can be seen in Fig.~\ref{fig_fig_KIN3_2}. In the captions of Figs.~\ref{fig_fig_KIN3_1} and~\ref{fig_fig_KIN3_2} we also list the average radii~in the box normalization, $\langle r \rangle^{\Box}$, for each of the plotted wave-functions, computed after normalizing the wave functions in the effective lattice volume. Their values lie well within the considered lattice volume such that we do not expect considerable finite volume effects. Note also that, for $\tau > 100$~GeV$^{-1}$ (compare $\tau=104.72$ and $123.3$~GeV$^{-1}$ on Fig.~\ref{fig_fig_KIN3_2}), these average radii become stable with $\tau$~(see the table associated with Fig.~\ref{fig_fig_KIN3_2}). The average radii of the parity projections, $P^{+}\Psi_1$ and $P^{+}\Psi_2$, are compatible. Similarly for the parity projections, $P^{-}_{\vec{p}_k}\Psi_1$ and $P^{-}_{\vec{p}_k}\Psi_2$. That is, the overlapping procedure of section~\ref{subsec_iter} can separate the first excited states of each parity, but cannot identify the higher states. Note that the typical radii in the box normalization are substantially smaller for the relativistic kinetic term than for the non-relativistic kinetic term (see subsection~\ref{subsec_ex_nonrelativ}). This is somewhat counter-intuitive given that the more compact wave-function with the Cornell potential is known to exhibit a slower decay for the relativistic kinetic term compared to the non-relativistic kinetic term (see section~\ref{intro}). \begin{figure}[ht] \centering \ig{energ_KIN3.png} \hfill \ig{proj_KIN3_0.png} \caption{\label{fig_energ_KIN3} Left: Energies obtained as a function of $\tau$ using the relativistic kinetic term $H_{K}^{(3)}$.\\ Right: Weights of the parity projection of the corresponding ground state as a function of $\tau$.} \end{figure} \begin{figure}[ht] \centering \ig{proj_KIN3_1.png} \hfill \ig{proj_KIN3_2.png} \caption{\label{fig_proj_KIN3} Weights of the parity projections of the first and second excited state as in Fig~\ref{fig_energ_KIN3}.} \end{figure} \begin{figure}[ht] \centering \ig{figure_KIN3_500.png} \hfill \ig{figure_KIN3_4500.png} \caption{\label{fig_fig_KIN3_1} Parity-projected wave-functions as a function of $r/A$ using the relativistic kinetic term $H_{K}^{(3)}$ at two different snapshot time steps. The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ \\ \hline $\langle r \rangle^{\Box}_{\text{left}}$ & $18.17$ & $6.11$ & $19.58$ & $4.97$ & $10.26$ & $8.78$ \\ \hline $\langle r \rangle^{\Box}_{\text{right}}$ & $-$ & $3.36$ & $15.95$ & $16.49$ & $16.28$ & $11.83$ \end{tabular} \end{figure} \begin{figure}[ht] \centering \ig{figure_KIN3_8500.png} \hfill \ig{figure_KIN3_10000.png} \caption{\label{fig_fig_KIN3_2} Parity-projected wave-functions as a function of $r/A$ using the relativistic kinetic term $H_{K}^{(3)}$ at two different snapshot time steps as in Fig.~\ref{fig_fig_KIN3_1}. The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ \\ \hline $\langle r \rangle^{\Box}_{\text{left}}$ & $-$ & $3.36$ & $15.79$ & $15.86$ & $15.79$ & $15.86$ \\ \hline $\langle r \rangle^{\Box}_{\text{right}}$ & $-$ & $3.36$ & $15.78$ & $15.87$ & $15.78$ & $15.87$ \end{tabular} \end{figure} \FloatBarrier \subsection{Comparison between the different non-relativistic kinetic terms} \label{subsec_ex_nonrelativ} We now compare the three non-relativistic kinetic terms introduced in section~\ref{subsec_kin}: $H_{K}^{(0)}$, (Eq.~\ref{eq:HK0}), based on the FDTD with Dirichlet boundary conditions; $H_{K}^{(1)}$, (Eq.~\ref{eq:HK1}), based on a discretized FFT implementation of the continuum kinetic term $H_{K}^{nr}$, (Eq.~\ref{eq:HKnr}); and $H_{K}^{(2)}$, (Eq.~\ref{eq:HK2}), based on the discretized FFT implementation of the FDTD kinetic term. Both $H_{K}^{(1)}$ and $H_{K}^{(2)}$ use periodic boundary conditions. In the wave-function plots shown below\footnote{% Right plots of Figs.~\ref{fig_comp_KIN_0} to~\ref{fig_comp_KIN_2} and all of the plots of Figs.~\ref{fig_fi_comp_KIN_0} to~\ref{fig_fi_comp_KIN_2}.}, we show with dashed lines the analytic solutions using the \emph{non-relativistic} kinetic term with a Coulomb potential, whereas the solid lines are those computed via the \texttt{quantumfdtd} program. We use $N=64$ points in each direction. The analytic solutions are the well known eigen-solutions of the Hydrogen atom, \begin{equation} \label{eq:non-rel-theo} R_{1s}(r) = N_{1s} e^{-\mu r} \,, \quad R_{2s}(r) = N_{2s} (2-\mu r) e^{-\mu r/2} \,, \quad R_{2p}(r) = N_{2p} \mu r e^{-\mu r/2} \,, \end{equation} where $\mu$ is the reduced mass and the continuum normalization is given by \begin{equation} N_{1s}^{\infty} = 2\mu^{3/2} \,, \quad N_{2s}^{\infty} = \frac{\mu^{3/2}}{2\sqrt{2}} \,, \quad N_{2p}^{\infty} = \frac{\mu^{3/2}}{2\sqrt{6}}\,. \end{equation} However, for the sake of comparability, we use the box normalization \begin{equation} \int_{V} dV |R(r)|^{2} = \sum_{x \in V} |R(x)|^{2} = 1 \,. \end{equation} The corresponding average radii in the continuum are given by \begin{align} \label{eq:analytic_avg_radii} \langle r \rangle^{\infty}_{1s} = \frac{3}{2\mu} \,, \quad \langle r \rangle^{\infty}_{2s} = \frac{6}{\mu} \,, \quad \langle r \rangle^{\infty}_{2p} = \frac{5}{\mu} \,. \end{align} We list the average radii obtained using the box normalization as $\langle r \rangle^{\Box}$. Although the $1s$, $2p$, and $2s$ states can be recognized, and the wave-functions that can be extracted via parity projection from different \texttt{quantumfdtd} states (see section~\ref{subsec_parity_proy}) are compatible, there are some differences between the 3 kinetic terms, due to finite volume errors or due to the discretization errors. A study of the former is performed in the next subsection~\ref{subsec_ex_increase_volume} where we increase the lattice volume to $N=128$. For the FDTD kinetic term, $H_{K}^{(0)}$, the most prominent finite volume effect is a faster than expected decay of the $2p$ and $2s$ wave-functions close to the borders of the lattice volume which can be seen in Figs.~\ref{fig_comp_KIN_0} and~\ref{fig_fi_comp_KIN_0}. This is expected because of the Dirichlet boundary conditions. The $1s$ wave-function decays exponentially, so that its theoretical value at the borders of the finite volume is also low and therefore, this wave-function is not as severely affected by the Dirichlet boundary conditions. For the FFT kinetic terms, $H_{K}^{(1)}$ and $H_{K}^{(2)}$, the most prominent finite size effects can be seen in Figs.~\ref{fig_comp_KIN_1}, \ref{fig_comp_KIN_2}, \ref{fig_fi_comp_KIN_1}, and~\ref{fig_fi_comp_KIN_2} and are located at values of $r$ close to the lattice spacing $A$. We remind that this artifact is due to the lattice implementation of the Coulomb potential. The periodic boundary conditions smoothen the behavior of the wave-function close to the borders, but at the expense of being less able to minimize the discretization artifacts for values close to the origin, where the continuum potential is actually divergent. This effect is not present for the $2p$ wave-function, that vanishes at the origin. But it is especially prominent for the $2s$ wave-function. The continuum average radii in units of $A$ are given by $\langle r \rangle^{\infty}_{1s} = 8.21$, $\langle r \rangle^{\infty}_{2s} = 32.83$, and $\langle r \rangle^{\infty}_{2p} = 27.36$. However, in the considered effective lattice volumes, the average radii of the continuum solutions of Eq.~\ref{eq:non-rel-theo} (in units of $A$) are $\langle r \rangle^{\Box}_{1s} = 8.14$, $\langle r \rangle^{\Box}_{2s} = 20.30$, and $\langle r \rangle^{\Box}_{2p} = 19.06$. The lower values are linked to finite volume effects, that make larger values of $r$ being discarded. These box normalized theoretical average radii should be compared with those listed in the captions of Figs.~\ref{fig_fi_comp_KIN_0} to~\ref{fig_fi_comp_KIN_2}. The wave-functions of figures~\ref{fig_comp_KIN_0} to~\ref{fig_comp_KIN_2}, with $\tau=6.16$~GeV$^{-1}$, are still not stabilized on $\tau$. Hence, there are big differences between theoretical and simulated values. This is especially prominent for the $1s$ state, that still has non-vanishing components of positive parity higher states with larger radii like the $2s$. Things become more interesting with figures~\ref{fig_fi_comp_KIN_0} to~\ref{fig_fi_comp_KIN_2}, where the left plot is $\tau=61.6$~GeV$^{-1}$ and the right one, $\tau=123.2$~GeV$^{-1}$. The values of $\langle r \rangle^{\Box}_{P^+\Psi_0}$ get closer to $\langle r \rangle^{\Box}_{1s}$, the ones of $\langle r \rangle^{\Box}_{P^-_{\vec{p}_k}\Psi_{1,2}}$ get closer to $\langle r \rangle^{\Box}_{2p}$, and the ones of $\langle r \rangle^{\Box}_{P^+\Psi_{1,2}}$ get closer to $\langle r \rangle^{\Box}_{2s}$. However, note that $\langle r \rangle^{\Box}_{2p} \approx 20.30$ is pretty close to $\langle r \rangle^{\Box}_{2s}\approx 19.06$. Indeed, the only difference between these states is the angular quantum number $l$, while $n=1$ is equal. This fact makes the comparisons harder. Anyhow, the average radii of the wave-functions of the FFT kinetic terms $H_{K}^{(1)}$ (Figs.~\ref{fig_fi_comp_KIN_1}) and $H_{K}^{(2)}$ (Fig.~\ref{fig_fi_comp_KIN_2}) are pretty similar. But the FDTD kinetic term $H_{K}^{(0)}$ (Fig.~\ref{fig_fi_comp_KIN_0}) shows smaller average radii than the FFT ones. This is especially prominent on the $2s$ and $2p$ states. Looking at the tail of the wave-functions, the decay of the excited state wave-functions is faster in the FDTD case. This fast decay is explicitly enforced by the Dirichlet boundary conditions. For the FFT kinetic terms, periodic boundary conditions are used. Such boundary conditions do not enforce $\Psi(\text{boundary}) \equiv 0$, and the tail of the corresponding wave-functions are closer to the continuum ones as can be seen in Figs.~\ref{fig_fi_comp_KIN_1} and~\ref{fig_fi_comp_KIN_2}. The effect of the Dirichlet boundary conditions would be an unphysically low value of the average radii, an effect that is shown in the table in Fig.~\ref{fig_fi_comp_KIN_0}. The $1s$ state is less affected by finite volume effects because its theoretical average radius $\langle r \rangle^{\Box}_{1s}\approx 8.14$ is well within the finite lattice volume. \begin{figure}[ht] \centering \ig{energ_KIN0.png} \hfill \ig{figure_KIN0_500.png} \caption{\label{fig_comp_KIN_0} Left: Energies obtained as a function of $\tau$ using the non-relativistic kinetic term $H_{K}^{(0)}$.\\ Right: Parity-projected wave-functions as a function of $r/A$ using the non-relativistic kinetic term $H_{K}^{(0)}$. The broad line of the $P^-_{\vec{p}_k}\Psi_2$ wave-function denotes lack of spherical symmetry, which is explicitly broken by the discretization. For low values of $\tau$ (as in this plot, $\tau=6.16$~GeV$^{-1}$), higher states with quantum number $l>0$ could show up as broad lines on the plots. Such states decay exponentially with $\tau$, according to Eq.~\ref{iter_decay}, so that they do not show up for higher values of $\tau$. In particular, the negative parity-projected ground state $P^-_{\vec{p}_k}\Psi_0$ is dominated by the $\Psi_{2p}$ contribution, and the positive parity-projected first excited state $P^+\Psi_1$ is actually dominated by the true ground state $\Psi_{1s}$. The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}$ & $18.74$ & $15.58$ & $17.25$ & $9.60$ & $21.41$ & $13.94$ & $8.14$ & $20.30$ & $19.06$ \end{tabular} \end{figure} \begin{figure}[ht] \centering \ig{energ_KIN1.png} \hfill \ig{figure_KIN1_500.png} \caption{\label{fig_comp_KIN_1} Energies and parity projected wave-functions as in Fig.~\ref{fig_comp_KIN_0} using the non-relativistic kinetic term $H_{K}^{(1)}$. The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}$ & $18.85$ & $16.66$ & $24.50$ & $9.60$ & $20.11$ & $9.26$ & $8.14$ & $20.30$ & $19.06$ \end{tabular} \end{figure} \begin{figure}[ht] \centering \ig{energ_KIN2.png} \hfill \ig{figure_KIN2_500.png} \caption{\label{fig_comp_KIN_2} Energies and parity projected wave-functions as in Fig.~\ref{fig_comp_KIN_0} using the non-relativistic kinetic term $H_{K}^{(2)}$. The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}$ & $18.84$ & $16.55$ & $24.47$ & $9.40$ & $20.07$ & $9.29$ & $8.14$ & $20.30$ & $19.06$ \end{tabular} \end{figure} \begin{figure}[ht] \centering \ig{figure_KIN0_5000.png} \hfill \ig{figure_KIN0_10000.png} \caption{\label{fig_fi_comp_KIN_0} Parity projected wave-functions as in Fig.~\ref{fig_comp_KIN_0} using the non-relativistic kinetic term $H_{K}^{(0)}$ at two later snapshot time steps. The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}_{\text{left}}$ & $17.64$ & $8.36$ & $17.64$ & $19.09$ & $16.87$ & $18.96$ & \multirow{2}{*}{$8.14$} & \multirow{2}{*}{$20.30$} & \multirow{2}{*}{$19.06$} \\ \cline{1-7} $\langle r \rangle^{\Box}_{\text{right}}$ & $-$ & $8.38$ & $17.63$ & $18.90$ & $17.63$ & $18.90$ & & & \end{tabular} \end{figure} \begin{figure}[ht] \centering \ig{figure_KIN1_5000.png} \hfill \ig{figure_KIN1_10000.png} \caption{\label{fig_fi_comp_KIN_1} Parity projected wave-functions as in Fig.~\ref{fig_comp_KIN_1} using the non-relativistic kinetic term $H_{K}^{(1)}$ at two later snapshot time steps. The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}_{\text{left}}$ & $18.46$ & $8.38$ & $18.45$ & $21.32$ & $18.41$ & $21.99$ & \multirow{2}{*}{$8.14$} & \multirow{2}{*}{$20.30$} & \multirow{2}{*}{$19.06$} \\ \cline{1-7} $\langle r \rangle^{\Box}_{\text{right}}$ & $-$ & $8.49$ & $18.47$ & $20.93$ & $18.47$ & $21.70$ & & & \end{tabular} \end{figure} \begin{figure}[!ht] \centering \ig{figure_KIN2_5000.png} \hfill \ig{figure_KIN2_10000.png} \caption{\label{fig_fi_comp_KIN_2} Parity projected wave-functions as in Fig.~\ref{fig_comp_KIN_2} using the non-relativistic kinetic term $H_{K}^{(2)}$ at two later snapshot time steps. The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}_{\text{left}}$ & $18.44$ & $8.33$ & $18.44$ & $21.29$ & $18.39$ & $21.97$ &\multirow{2}{*}{$8.14$} & \multirow{2}{*}{$20.30$} & \multirow{2}{*}{$19.06$} \\ \cline{1-7} $\langle r \rangle^{\Box}_{\text{right}}$ & $-$ & $8.43$ & $18.45$ & $20.93$ & $18.45$ & $20.46$ & & & \end{tabular} \end{figure} \FloatBarrier \subsection{\texorpdfstring{Comparison of the relativistic $H_{K}^{(3)}$ and the non-relativistic $H_{K}^{(2)}$ kinetic terms at high mass}{Comparison of the relativistic H\_K(3) and the non-relativistic H\_K(2) kinetic terms at high mass}} \label{subsec_ex_relativ_vs_nonrelativ_high_mass} In this subsection, we increase the reduced mass up to $M=3$~GeV~for demonstration purposes. In all of the following figures, Figs.~\ref{fig_energ_HEAVYMASS} to~\ref{fig_figure_HEAVYMASS_2}, the relativistic kinetic term, $H_{K}^{(3)}$, (Eq.~\ref{eq:HK3}) is being used in the left plots, whereas the non-relativistic one, $H_{K}^{(2)}$, (Eq.~\ref{eq:HK2}) is being used in the right plots, respectively. Our next goal is to compare the numerical behavior of the relativistic and the non-relativistic kinetic terms in the regime of high mass, where they should become more similar. Comparing these results with the results from the previous subsections~\ref{subsec_ex_relativ} and~\ref{subsec_ex_nonrelativ} shows that the increase of the reduced mass from $M=0.3$~GeV to $M=3$~GeV leads to the expected decrease of the characteristic average radius of the wave-functions. Due to $(AM)^2 \approx 3.3$ we expect large finite mass discretization errors. For this reason, this setup is not appropriate for production purposes, where one should reduce the lattice spacing by (approximately) the inverse factor from $A=0.12$ fm to $A \lesssim 0.02$ fm. The energies and parity projections of the wave-functions evolve faster with $\tau$ (see Figs.~\ref{fig_energ_HEAVYMASS} to \ref{fig_proj_HEAVYMASS_2}), such that the energy of the second excited state, $E_2$, degenerates with $E_{1}$ at $\tau \sim 25$~GeV$^{-1}$ and $E_1$ degenerates with $E_{0}$ at $\tau \sim 70$~GeV$^{-1}$. For $\tau > 60-65$~GeV$^{-1}$, numerical cancellation effects start showing up (see Figs.~\ref{fig_proj_HEAVYMASS_0} to~\ref{fig_proj_HEAVYMASS_2}). As expected, the wave-functions (see Fig.~\ref{fig_figure_HEAVYMASS_1} and~\ref{fig_figure_HEAVYMASS_2}) of the relativistic and the non-relativistic cases are closer to one another due to the increased reduced mass. However, the results are visibly non-smooth due to discretization artifacts. Note that the increase on the reduced mass $M$ by an order of magnitude has decreased the characteristic average radii of the wave-functions. For the non-relativistic case, $\langle r \rangle^{\infty}_{1s} = 0.82$ in units of $A$, below a single lattice spacing. For the $2s$ and $2p$ excited states, the continuum average radii are $\langle r \rangle^{\infty}_{2s} = 3.28$ and $\langle r \rangle^{\infty}_{2p} = 2.74$, respectively. This strongly impacts a precise analysis of this case. On the right side of Figs.~\ref{fig_figure_HEAVYMASS_2} and~\ref{fig_figure_HEAVYMASS_2}, it can be seen that, although the wave-function computed via the non-relativistic FFT kinetic term $H_{K}^{(2)}$ are close to the continuum limit, there are clear discrepancies that originate in the discretization of the potential. This is very prominent for the $1s$ and $2s$ states, that have a non-vanishing value close to the origin. Anyhow, in Figs.~\ref{fig_figure_HEAVYMASS_1} to~\ref{fig_figure_HEAVYMASS_3}, it can be seen that the wave-functions computed via the relativistic kinetic term, $H_{K}^{(3)}$, and the non-relativistic one, $H_{K}^{(2)}$, (both based on a FFT with periodic boundary conditions) are pretty close. Compare with the cases of right sides of Figs.~\ref{fig_fi_comp_KIN_2} (right side, non-relativistic $H_{H}^{(2)}$, step=10000, $M=0.3$~GeV) and~\ref{fig_fig_KIN3_2} (right side, relativistic kinetic term $H_{K}^{(3)}$, step=10000), where the differences between relativistic and non-relativistic are quite prominent. The similarities can be also seen in Fig.~\ref{fig_energ_HEAVYMASS}, where the decay curves are quite similar after taking into account an additive factor of $3$~GeV on the energies due to the rest mass on the relativistic approach. \begin{figure}[ht] \centering \ig{energ_KIN3_HEAVYMASS.png} \hfill \ig{energ_KIN2_HEAVYMASS.png} \caption{\label{fig_energ_HEAVYMASS} Energies obtained as a function of $\tau$ using the relativistic kinetic term $H_{K}^{(3)}$ (left) and $H_{K}^{(2)}$ (right) using the increased reduced mass $M = 3$~GeV.} \end{figure} \begin{figure}[ht] \centering \ig{proj_KIN3_HEAVYMASS_0.png} \hfill \ig{proj_KIN2_HEAVYMASS_0.png} \caption{\label{fig_proj_HEAVYMASS_0} Weights of the parity projection of the ground state as a function of $\tau$ using the relativistic kinetic term $H_{K}^{(3)}$ (left) and $H_{K}^{(2)}$ (right) using the increased reduced mass $M = 3$~GeV.} \end{figure} \begin{figure}[ht] \centering \ig{proj_KIN3_HEAVYMASS_1.png} \hfill \ig{proj_KIN2_HEAVYMASS_1.png} \caption{\label{fig_proj_HEAVYMASS_1} Weights of the parity projection of the first excited state as in Fig.~\ref{fig_proj_HEAVYMASS_0}. Left: $H_{K}^{(3)}$; right: $H_{K}^{(2)}$.} \end{figure} \begin{figure}[ht] \centering \ig{proj_KIN3_HEAVYMASS_2.png} \hfill \ig{proj_KIN2_HEAVYMASS_2.png} \caption{\label{fig_proj_HEAVYMASS_2} Weights of the parity projection of the second excited state as in Fig.~\ref{fig_proj_HEAVYMASS_0}. Left: $H_{K}^{(3)}$; right: $H_{K}^{(2)}$.} \end{figure} \begin{figure}[ht] \centering \ig{figure_KIN3_HEAVYMASS_500.png} \hfill \ig{figure_KIN2_HEAVYMASS_500.png} \caption{\label{fig_figure_HEAVYMASS_1} Parity-projected wave-functions as a function of $r/A$ using the relativistic kinetic term $H_{K}^{(3)}$ (left) and the non-relativistic kinetic term $H_{K}^{(2)}$ (right) using the increased reduced mass $M = 3$~GeV. The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}_{\text{left}}$ & $2.24$ & $1.40$ & $2.35$ & $2.20$ & $1.63$ & $3.28$ & $-$ & $-$ & $-$ \\ \hline $\langle r \rangle^{\Box}_{\text{right}}$ & $2.60$ & $1.49$ & $2.63$ & $2.54$ & $1.78$ & $3.14$ & 1.02 & 3.39 & 2.74 \end{tabular} \end{figure} \begin{figure}[ht] \centering \ig{figure_KIN3_HEAVYMASS_1000.png} \hfill \ig{figure_KIN2_HEAVYMASS_1000.png} \caption{\label{fig_figure_HEAVYMASS_2} Parity-projected wave-functions as in Fig.~\ref{fig_figure_HEAVYMASS_1} at a later snapshot time step. Left: $H_{K}^{(3)}$; right: $H_{K}^{(2)}$. The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}_{\text{left}}$ & $2.13$ & $1.27$ & $2.15$ & $3.52$ & $2.11$ & $3.52$ & $-$ & $-$ & $-$ \\ \hline $\langle r \rangle^{\Box}_{\text{right}}$ & $2.57$ & $1.37$ & $2.57$ & $3.90$ & $2.11$ & $3.75$ & 1.02 & 3.39 & 2.74 \end{tabular} \end{figure} \begin{figure}[ht] \centering \ig{figure_KIN3_HEAVYMASS_3000.png} \hfill \ig{figure_KIN2_HEAVYMASS_3000.png} \caption{\label{fig_figure_HEAVYMASS_3} Parity-projected wave-functions as in Fig.~\ref{fig_figure_HEAVYMASS_1} at a later snapshot time step. Left: $H_{K}^{(3)}$; right: $H_{K}^{(2)}$. The average radii in units of $A$ are given by} \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}_{\text{left}}$ & $-$ & $1.27$ & $2.11$ & $3.65$ & $2.11$ & $3.65$ & $-$ & $-$ & $-$ \\ \hline $\langle r \rangle^{\Box}_{\text{right}}$ & $-$ & $1.37$ & $2.56$ & $4.07$ & $2.56$ & $4.07$ & 1.02 & 3.39 & 2.74 \end{tabular} \end{figure} \FloatBarrier \subsection{\texorpdfstring{Comparison between the non-relativistic kinetic terms at larger $N$}{Comparison between the non-relativistic kinetic terms at larger N}} \label{subsec_ex_increase_volume} In this subsection we compare the FDTD kinetic term, $H_{K}^{(0)}$, (left plots in all figures) with the FFT kinetic term, $H_{K}^{(2)}$, (right plots in all figures) for a increased lattice volume, using $N=128$ and reduced mass $M=0.3$~GeV. This should be compared with the $N=64$ case from the previous section~\ref{subsec_ex_nonrelativ}. The dashed lines again represent the analytic solutions for the \emph{non-relativistic} kinetic term with Coulomb potential. From Figs.~\ref{fig_energ_comp_KIN_128} to~\ref{fig_figure_comp_KIN_128_2}, we plot the FDTD-based non-relativistic kinetic term, $H_{K}^{0}$ (Dirichlet boundary conditions), on the left vs. the non-relativistic FFT-based, $H_{K}^{(2)}$ (periodic boundary conditions), on the right. The continuum average radii in units of $A$ using the box normalization are given by $\langle r \rangle^{\Box}_{1s} = 8.22$, $\langle r \rangle^{\Box}_{2s} = 30.77$, and $\langle r \rangle^{\Box}_{2p} = 26.18$, respectively. As it happened for $N=64$ in section~\ref{subsec_ex_nonrelativ}, the infinite volume continuum solutions of Eq.~\ref{eq:non-rel-theo} in units of $A$ have larger average radii: $\langle r \rangle^{\infty}_{1s} = 8.21$, $\langle r \rangle^{\infty}_{2s} = 32.83$, and $\langle r \rangle^{\infty}_{2p} = 27.36$, respectively. However, note that the difference is not as prominent as in the $N=64$ case. Actually, $r/A=31$ falls well inside the lattice volume of $N^3=128^3$, so that finite volume effects are not so dramatic. Indeed, when comparing the results with the ones from the previous sections, we see that the finite volume effects are greatly reduced. Even if we are comparing Dirichlet boundary conditions (FDTD kinetic term) vs. periodic boundary conditions (FFT kinetic term). Additionally, the FDTD ($H_{K}^{(0)}$) and FFT ($H_{K}^{(2)}$) based solutions agree with one another and with the theoretical predictions (dashed lines). This can especially be seen in Fig.~\ref{fig_figure_comp_KIN_128_2}, and on the associated table of average radii. Compare with the previous Figs.~\ref{fig_fi_comp_KIN_0} (FDTD, Dirichlet boundary conditions) and~\ref{fig_fi_comp_KIN_2} (FFT, periodic boundary conditions) in section~\ref{subsec_ex_nonrelativ} ($N=64$). In particular, the problem with the tail behavior of Figs.~\ref{fig_fi_comp_KIN_0}, that was attributed to finite volume effects and the Dirichlet boundary conditions, disappears when the volume is increased so that it can accommodate most of the wave-functions. The computed values for the average radii in the box normalization, $\langle r \rangle^{\Box}_{P^+\Psi_{0,1,2}}$, are still systematically higher than the corresponding theoretical values $\langle r\rangle^{\Box}_{1s,2s}$, with the FDTD (Dirichlet boundary conditions) being more accurate than the FFT (periodic boundary conditions). This is due to discretization errors close to $r\sim A$, where $1s$ and $2s$ wave-functions have a maxium at the origin. In the case of $\langle r \rangle^{\Box}_{P^-_{\vec{p}_k}\Psi_{1,2}}$ and the theoretical $\langle r \rangle^{\Box}_{2p}$, the computed value is smaller than the corresponding theortical value because it has a node at the origin. On Fig.~\ref{fig_figure_comp_KIN_128_2} it can be seen that, especially for the FFT case (right side), the behavior of the $2s$ and $2p$ of the computed wave-functions deviate from the continuum limit close to the origin. The continuum limit curves are higher than the computed ones close to the origin. This points to an issue with the lattice implementation of the Coulomb potential on the origin as mentioned earlier. This is to be expected, since the Coulomb potential has a pole on the origin. Hence, we are facing discretization artifacts originating from the discretization of the potential. The FFT approach seems slightly worse than the FDTD approach in handling this kind of effect. \begin{figure}[ht] \centering \ig{energ_KIN0_128.png} \hfill \ig{energ_KIN2_128.png} \caption{\label{fig_energ_comp_KIN_128} Energies obtained as a function of $\tau$ using the non-relativistic kinetic terms $H_{K}^{(0)}$ (FDTD-based, left) and the non-relativistic kinetic term $H_{K}^{(2)}$ (FFT-based, right) using the increased lattice volume ($N = 128$).} \end{figure} \begin{figure}[ht] \centering \ig{proj_KIN0_128_0.png} \hfill \ig{proj_KIN2_128_0.png} \caption{\label{fig_proj_comp_KIN_128_0} Weights of the parity projection of the ground state as a function of $\tau$ using the non-relativistic kinetic terms $H_{K}^{(0)}$ (FDTD-based, left) and the non-relativistic kinetic term $H_{K}^{(2)}$ (FFT-based, right) using the increased lattice volume ($N = 128$).} \end{figure} \begin{figure}[ht] \centering \ig{proj_KIN0_128_1.png} \hfill \ig{proj_KIN2_128_1.png} \caption{\label{fig_proj_comp_KIN_128_1} Weights of the parity projection of the first excited state as in Fig.~\ref{fig_proj_comp_KIN_128_0}.} \end{figure} \begin{figure}[ht] \centering \ig{proj_KIN0_128_2.png} \hfill \ig{proj_KIN2_128_2.png} \caption{\label{fig_proj_comp_KIN_128_2} Weights of the parity projection of the second excited state as in Fig.~\ref{fig_proj_comp_KIN_128_0}.} \end{figure} \begin{figure}[ht] \centering \ig{figure_KIN0_128_1500.png} \hfill \ig{figure_KIN2_128_1500.png} \caption{\label{fig_figure_comp_KIN_128_1} Parity-projected wave-functions as a function of $r/A$ using the non-relativistic kinetic term $H_{K}^{(0)}$ (FDTD-based, left) and the non-relativistic kinetic term $H_{K}^{(2)}$ (FFT-based, right) using the increased lattice volume ($N = 128$). The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}_{\text{left}}$ & $26.21$ & $19.28$ & $26.35$ & $11.61$ & $31.17$ & $27.47$ & \multirow{2}{*}{$8.22$} & \multirow{2}{*}{$30.77$} & \multirow{2}{*}{$26.18$} \\ \cline{1-7} $\langle r \rangle^{\Box}_{\text{right}}$ & $26.22$ & $19.39$ & $26.28$ & $11.54$ & $41.80$ & $27.10$ & & & \end{tabular} \end{figure} \clearpage \begin{figure}[!ht] \centering \ig{figure_KIN0_128_10000.png} \hfill \ig{figure_KIN2_128_10000.png} \caption{\label{fig_figure_comp_KIN_128_2} Parity-projected wave-functions as in Fig.~\ref{fig_figure_comp_KIN_128_1} at a later snapshot time step. The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}_{\text{left}}$ & $-$ & $8.50$ & $26.05$ & $30.77$ & $25.85$ & $30.71$ & \multirow{2}{*}{$8.22$} & \multirow{2}{*}{$30.77$} & \multirow{2}{*}{$26.18$} \\ \cline{1-7} $\langle r \rangle^{\Box}_{\text{right}}$ & $-$ & $8.50$ & $26.16$ & $31.69$ & $26.14$ & $32.66$ & & & \end{tabular} \end{figure} \subsection{Quantumfdtd internal parity fixing machinery} \label{subsec_ex_parity_fixing} In this section, we investigate the ability to specify the initial spatial symmetry of the wave-function using the \texttt{INITSYMMETRY} parameter (see section~\ref{subsec_icond}). We set \texttt{INITSYMMETRY=1} for the left plots in all figures, which corresponds to symmetrization along the $z$ axis, and we set \texttt{INITSYMMETRY=2} for the right plots in all figures, which corresponds to anti-symmetrization. We again use $N=64$ and $M=0.3$~GeV and the non-relativist kinetic term $H_{K}^{(0)}$. The dashed lines again represent the analytic solutions for the non-relativistic kinetic term with Coulomb potential. The results should be compared with the figures of subsection~\ref{subsec_ex_nonrelativ} and with the FDTD based kinetic term, $H_{K}^{(0)}$, therein. That is, with Figs.~\ref{fig_comp_KIN_0} and~\ref{fig_fi_comp_KIN_0}. It can be seen that the choice \texttt{INITSYMMETRY=1} removes the $2p_z$ state completely. However, there is still a residual negative parity component, most likely due to higher lying states or due to $2p$ states that are symmetric around the $z$ axis. On the other hand, \texttt{INITSYMMETRY=2} removes all $s$ states, leaving only $2p$ and higher lying states. In particular, there are $3d$ states, which are odd under $P^-_{\vec{p}_k}$ for two directions while being even under parity. These states are not separated by the post-processing parity projections (see section~\ref{subsec_parity_proy}). Hence, these positive parity wave-functions mix contributions from states with different geometry that show as the broad bands in the Figures even for late time steps. Note that, on the right energy plot of Fig.~\ref{fig_energ_comp_MIKE}, the ground state energy no longer corresponds to the ground state energy of the left plot. It now corresponds to the first excited state energy of the left plot which is the $2p$ state, since it is the lowest lying state compatible with the anti-symmetrization. The continuum average radii in units of $A$ are given by $\langle r \rangle^{\infty}_{1s} = 8.21$, $\langle r \rangle^{\infty}_{2s} = 32.83$, and $\langle r \rangle^{\infty}_{2p} = 27.36$. As explained in the previous sections~\ref{subsec_ex_nonrelativ} and~\ref{subsec_ex_increase_volume}, the values are lower when computed using the box normalization: $\langle r \rangle^{\Box}_{1s} = 8.14$, $\langle r \rangle^{\Box}_{2s} = 20.30$, and $\langle r \rangle^{\Box}_{2p} = 19.06$, respectively. At sufficiently large times, the average radii agree reasonably well with the theory expectations. \begin{figure}[ht] \centering \ig{energ_KIN0_MIKE_PARITY.png} \hfill \ig{energ_KIN0_MIKE_PARITY_ANTISYM.png} \caption{\label{fig_energ_comp_MIKE} Energies obtained as a function of $\tau$ using the non-relativistic kinetic terms $H_{K}^{(0)}$ with \texttt{INITSYMMETRY=1} (left, symmetric along the $z$ axis) and \texttt{INITSYMMETRY=2} (right, antisymmetric along the $z$ axis).} \end{figure} \begin{figure}[ht] \centering \ig{proj_KIN0_MIKE_PARITY_0.png} \hfill \ig{proj_KIN0_MIKE_PARITY_ANTISYM_0.png} \caption{\label{fig_proj_comp_MIKE_0} Weights of the parity projection of the ground state as a function of $\tau$ using the non-relativistic kinetic terms $H_{K}^{(0)}$ with \texttt{INITSYMMETRY=1} (left, symmetric along the $z$ axis) and \texttt{INITSYMMETRY=2} (right, antisymmetric along the $z$ axis).} \end{figure} \begin{figure}[ht] \centering \ig{proj_KIN0_MIKE_PARITY_1.png} \hfill \ig{proj_KIN0_MIKE_PARITY_ANTISYM_1.png} \caption{\label{fig_proj_comp_MIKE_1} Weights of the parity projection of the first excited state as in Fig.~\ref{fig_proj_comp_MIKE_0}.} \end{figure} \begin{figure}[ht] \centering \ig{proj_KIN0_MIKE_PARITY_2.png} \hfill \ig{proj_KIN0_MIKE_PARITY_ANTISYM_2.png} \caption{\label{fig_proj_comp_MIKE_2} Weights of the parity projection of the second excited state as in Fig.~\ref{fig_proj_comp_MIKE_0}.} \end{figure} \begin{figure}[ht] \centering \ig{figure_KIN0_MIKE_PARITY_1500.png} \hfill \ig{figure_KIN0_MIKE_PARITY_ANTISYM_1500.png} \caption{\label{fig_comp_MIKE_1} Parity-projected wave-functions as a function of $r/A$ using the non-relativistic kinetic term $H_{K}^{(0)}$ with \texttt{INITSYMMETRY=1} (left, symmetric along the $z$ axis) and \texttt{INITSYMMETRY=2} (right, antisymmetric along the $z$ axis). The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}_{\text{left}}$ & $-$ & $12.44$ & $-$ & $11.66$ & $-$ & $21.71$ & \multirow{2}{*}{$8.14$} & \multirow{2}{*}{$20.30$} & $-$ \\ \cline{1-7}\cline{10-10} $\langle r \rangle^{\Box}_{\text{right}}$ & $18.64$ & $22.09$ & $15.09$ & $21.92$ & $17.48$ & $23.76$ & & & 19.06 \end{tabular} \end{figure} \clearpage \begin{figure}[!ht] \centering \ig{figure_KIN0_MIKE_PARITY_10000.png} \hfill \ig{figure_KIN0_MIKE_PARITY_ANTISYM_10000.png} \caption{\label{fig_comp_MIKE_2} Parity-projected wave-functions as in Fig.~\ref{fig_comp_MIKE_1} at a later snapshot time step. The average radii in units of $A$ are given by} \small \begin{tabular}{r|c|c|c|c|c|c|c|c|c} & $P_{\vec{p}_{k}}^{-} \Psi_{0}$ & $P^{+} \Psi_{0}$ & $P_{\vec{p}_{k}}^{-} \Psi_{1}$ & $P^{+} \Psi_{1}$ & $P_{\vec{p}_{k}}^{-} \Psi_{2}$ & $P^{+} \Psi_{2}$ & $\Psi_{1s}^{\text{th}}$ & $\Psi_{2s}^{\text{th}}$ & $\Psi_{2p}^{\text{th}}$ \\ \hline $\langle r \rangle^{\Box}_{\text{left}}$ & $-$ & $8.38$ & $-$ & $18.90$ & $-$ & $18.90$ & \multirow{2}{*}{$8.14$} & \multirow{2}{*}{$20.30$} & $-$ \\ \cline{1-7}\cline{10-10} $\langle r \rangle^{\Box}_{\text{right}}$ & $17.63$ & $-$& $18.28$ & $22.13$ & $19.64$ & $22.01$ & & & 19.06 \end{tabular} \end{figure} \subsection{Convergence conditions} \label{subsec_conv_conditions} The convergence of the wave-functions shown in Figs.~\ref{fig_energ_KIN3} to~\ref{fig_comp_MIKE_2} is pretty clean. Discretization errors that are predominantly due to the lattice implementation of the Coulomb potential are visible on the coarser lattices and excited states are affected by finite volume effects in small lattice volumes. The wave-functions generated by the \texttt{quantumfdtd} can be considered reliable, only after the following conditions are met: \begin{itemize} \item Appropriate parity projection and normalization has been performed using the provided post-processing scripts for separating the wave-functions (see section~\ref{subsec_parity_proy}). \item Using the snapshot facility of the code for multiple values of $\tau$ the wave-function has been shown to be stable within small changes of $\tau$ and the energy $E_{s,i}(\tau)$ should be in a plateau, i.e., flat or, at least, in a saddle point. \item $A < M^{-1}$, such that the typical radius of the ground state is substantially larger than the lattice spacing $A$, $\langle r \rangle^{\Box}_{P^+\Psi_0} \gg A$. This condition is violated in section~\ref{subsec_ex_relativ_vs_nonrelativ_high_mass} in the example. \item $2\langle r \rangle^{\Box}_{P^{\pm}\Psi_{1,2}} \ll N\cdot A$, such that typical radii of the excited states are substantially smaller than half of the box size $N\cdot A$. \end{itemize} \clearpage \section{Compilation and running} \label{sec_compile} We require $\text{\texttt{\$\{NCORES\}}}$ MPI processes, with $\text{\texttt{\$\{NCORES\}}}$ being a divisor of $N$. The following external libraries are used: \begin{itemize} \item MPI library \item \texttt{FFTW\_MPI}, version 3 \footnote{ \href{http://fftw.org/}{http://fftw.org/} and Ref.~\cite{fftw3}} \item GNU Scientific Library (GSL) \footnote{ \href{https://www.gnu.org/software/gsl/}{https://www.gnu.org/software/gsl/} and Ref.~\cite{gsl}}, with the CBLAS link \footnote{ \href{https://www.netlib.org/blas/}{https://www.netlib.org/blas/} and Refs.~\cite{blas1,blas2}} \item For some of the post-processing scripts, Python~3 is required\footnote{ \href{https://www.python.org/downloads/}{https://www.python.org/downloads/}} \end{itemize} There are both, open source (Open MPI\footnote{ \href{https://www.open-mpi.org/}{https://www.open-mpi.org/}}) and proprietary implementations of the MPI library. The open source Open~MPI~2.1.1 and the proprietary IBM MPI~1.4 versions of the MPI library have been used for testing purposes. Concerning \texttt{FFTW\_MPI} and GSL, both are open source. Versions \texttt{FFTW\_MPI}~3.5.7 and GSL~2.5 have been used for testing. Hence, the usage of this code does not require any proprietary software. The directory structure is as follow: \begin{description} \item[\texttt{build/src}:] Source code. \item[\texttt{build/include}:] Header files. \item[\texttt{build/obj}:] Folder for intermediate object files. \item[\texttt{data}:] Folder for default output files. \item[\texttt{input}:] Folder for default input files. The file \texttt{input/params.txt} is necessary for running the program. \item[\texttt{license}:] GNU Public License. \item[\texttt{archive}:] Several versions of the \texttt{Makefile}, for different machine configurations (architecture). \item[\texttt{scripts}:] Examples of scripts for running the program and post-processing of the output data. This includes the Python3~\cite{python} module \texttt{quantumfdtd.py}, that offers a Python class (\texttt{quantumfdtd}) for the post-analysis inside the Pandas~\cite{pandas, reback2020pandas, mckinney-proc-scipy-2010} framework as well as the scripts \texttt{symmetrize.sh}, for computing parity projections, and several scripts for extracting plots\footnote{% \texttt{postprocessing.sh} for the potential, energies and wave-functions and \texttt{postprocessing\_\allowbreak{}sym.sh} for the parity projections. In both cases, plots of the full 3D wave-functions snapshots are obtained if they have been computed.}. \end{description} The root directory contains a \texttt{Makefile} that allows one to build the program provided that all of the external libraries are installed. If the libraries are installed in non-standard locations, this \texttt{Makefile} should be modified accordingly. The following commands, executed in the root folder of the provided tarball, are required for building and executing the program: \begin{verbatim} $ make $ mpirun -N ${NCORES} ./mpisolve \end{verbatim} Here, \texttt{\$\{NCORES\}} is the number of cores to be used which should be a divisor of the number of the spatial grid points.\\[1em] \noindent The source code is available on GitHub: \url{https://github.com/quantumfdtd/quantumfdtd_v3} \section{Parameters of the program} \label{sec_params} The parameters listed in the following subsections should be defined in the standard parameter file located at \texttt{input/params.txt}. The \texttt{input} directory should be located in the directory where the program is also run from. The configuration file accepts full line comments, that are marked with an initial double backslash, \texttt{\textbackslash\textbackslash}, on the commented line. For convenience, the program accepts command line parameters as well. They can be parsed as follows: \begin{verbatim} $ mpirun -N ${NCORES} ./mpisolve -KEY1 ARG1 -KEY2 ARG2 ... \end{verbatim} Unless stated differently, all of the numerical values are separated by tabs in all of the output files. \subsection{Basic configuration} \label{subsec_basic_params} This program is based on an iterative method for finding both the ground state energy and the two first excited state energies. The corresponding wave-functions are computed as well. Hence, most of the basic configuration flags that are required for running the program are related both to the setup of the lattice (discretization) and the termination conditions of the iterative procedure. The following parameters are required for running the program: \begin{description} \item[\texttt{NUM}:] Number of spatial grid points. Note that they should be divisible by the number of computational nodes, i.e., $\text{\texttt{NUM}} \mod N_{\text{MPI cores}} = 0$. \item[\texttt{A}:] Spatial grid spacing. Default units: 1/GeV. \item[\texttt{MASS}:] Reduced mass of the simulated system. Default units: GeV. \item[\texttt{KINTERM}:] Selection of the kinetic term to be used (see subsection~\ref{subsec_kin}): \begin{itemize} \item The non-relativistic kinetic term based on finite difference time domain (\texttt{0}). \item The relativistic kinetic term (\texttt{3}). \item 2 other non-relativistic kinetic terms based on FFT (\texttt{1},\texttt{2}). \end{itemize} \item[\texttt{POTENTIAL}:] Potential to simulate. There are 6 hard-coded potentials described in subsection~\ref{subsec_hpot} and 4 different options to read the potential from file described in subsection~\ref{subsec_epot}. \item[\texttt{EPS}:] Temporal grid spacing. Should be $\leq \text{\texttt{A}}^{2}/3$. \item[\texttt{UPDATE}:]\label{explan_bare} How many steps should be taken before checking the \texttt{SNAP\-UPDATE}, \texttt{SNAP\-DUMP} and \texttt{STEPS} variables, and computing observables\footnote{% Ground state energy and the expectation values $\braket{r^{2}}$, $\braket{x}$, $\braket{y}$, and $\braket{z}$. Note that here $\braket{r^{2}}$ is w.r.t. the center of lattice, i.e., w.r.t. the point $(x_{1},x_{2},x_{3}) = (N/2,N/2,N/2)$.} and printing them to command line.\\ If the \texttt{SAVEDECAY} flag is enabled, observables are also saved to the file \emph{decay.dat}, as an ASCII table: $T$, $E_{b}$. Here, $T$ stands for the total time (\texttt{EPS}$\times$\texttt{\#steps}) and $E_{b}$ is the bare ground state energy.\\ Note that some hard-coded potentials split the potential in two parts\footnote{% There is an option for using this splitting for externally provided potentials as well, see sec.~\ref{subsec_epot}.}: A \emph{bare} ($V_{b}$) and a \emph{subtracted} ($V_{s}$) potential. $V_{b}$ is the one used inside the iterative procedure, for computing the wave-functions $\Psi_i$ and energies $E_{b}$. Afterwards, the \emph{subtracted} value of the energy, $E_{s}$, is computed via \begin{equation} E_{s,i} = E_{b,i} - \int_{V} |\Psi(r)|^{2} V_{s}(r) dV \,, \end{equation} where the integral extends over all of the lattice positions. This is correct for the potential $V(r)$ in the particular case $V(r) = V_{b}(r) - V_{s}(r)$, where $V_{s}(r) = V_{s}$, a scalar constant. \item[\texttt{SNAPUPDATE}:]\label{flag_snapupdate} How many steps should be taken before enforcing both normalization of the ground state wave-function ($\int_{V} dV |\psi_{0}|^{2} = 1$) and its required symmetries (see the flag \texttt{INITCONDTYPE}). It triggers the check of the tolerance condition (see \texttt{TOLERANCE} flag). It also triggers the storage of the 2 snapshots that are required for the extraction of the first and second excited states via overlapping (see section~\ref{subsec_iter}). \item[\texttt{SNAPDUMP}:] In case \texttt{DUMPSNAPS} (see below) is set to a non-null value, how many steps should be taken before storing a wave-function snapshots to disk. \item[\texttt{TOLERANCE}:] Convergence tolerance w.r.t. the ground state energy. The stop condition being\footnote{% $E_{b,i} - E_{b,i-1}$ stands for the difference between the current bare ground state energy and the one obtained when \texttt{SNAPUPDATE} was triggered previously.} $E_{b,i} - E_{b,i-1} < \texttt{TOLERANCE}$. It can be disabled by setting a negative value. \item[\texttt{STEPS}:] Maximum number of steps to take. This limit is enforced each time a number of steps given by the variable \texttt{UPDATE} is evaluated. Hence, the actual number of steps to take is exactly \texttt{STEPS} only if \texttt{STEPS} is divisible by \texttt{UPDATE}. Otherwise, it will be the smallest multiple of \texttt{UPDATE} bigger than \texttt{STEPS}. This is the actual number of steps to take if the \texttt{TOLERANCE} parameter is set to a negative value. \item[\texttt{SAVEWAVEFNCS}:] Save a full snapshot of the 3d wave-functions at the end of the run. Set to \texttt{1} for activation. \item[\texttt{SAVEDECAY}:] Save a table of energy vs. time. This is particularly useful for checking the convergence of the iterative procedure to the ground state, especially, when using the FFT-based kinetic terms. \item[\texttt{SAVEPOT}:] Name of the external file where the potential that is used will be saved to. The file format is an ASCII list containing: \begin{equation*} x_{1}/A \quad x_{2}/A \quad x_{3}/A \quad r^2/A^2 \quad \mathop{\text{Re}} V \quad \mathop{\text{Im}} V \,, \end{equation*} where $r^2/A^2=(x_{1}/A)^2 + (x_{2}/A)^2 + (x_{3}/A)^2$, centered at the point $(x_{1},x_{2},x_{3})=(0,0,0)$. \item[\texttt{DATAFOLD}:] Name of the folder where the full output, wave-functions, and snapshots will be saved to. By default, is set to \texttt{data}. The file format is an ASCII list containing: \begin{equation*} x_{1}/A \quad x_{2}/A \quad x_{3}/A \quad r^2/A^2 \quad \mathop{\text{Re}}\psi_i \quad \mathop{\text{Im}}\psi_i \,, \end{equation*} where $r^2/A^2=(x_{1}/A)^2 + (x_{2}/A)^2 + (x_{3}/A)^2$, centered at the point $(x_{1},x_{2},x_{3})=(0,0,0)$, and $i=0$ (ground state), $1$ (first excited state), or $2$ (second excited state). \item[\texttt{DUMPSNAPS}:] Dump debugging files containing either "snapshot slices" or full 3D wave-functions: \begin{itemize} \item Disables snapshot recording (\texttt{0}). \item Store "snapshot slices" of the ground state (\texttt{1}). Only valid for potentials centered on $(N/2,N/2,N/2)$. Do not use when centering the potential on $(0,0,0)$. \item Store full 3D wave-functions of the ground state (\texttt{2}). \item Store "snapshot slices" of the ground state, and of the first and second excited states (\texttt{3}). Only valid for potentials centered on $(N/2,N/2,N/2)$. Do not use when centering the potential on $(0,0,0)$. \item Stores full 3D wave-functions of the groundstate, and of the first and second excited states (\texttt{4}). \end{itemize} The full 3D wave-functions are stored in the same way as the ones triggered by \texttt{DATAFOLD}.\\ The file format for the "slices" consists of three concatenated ASCII lists, separated by a row containing "\&\&", respectively. These lists are, respectively: \begin{align*} x_{1}/A && \mathop{\text{Re}} V[x_{1}, N/(2A), N/(2A)] && \mathop{\text{Im}} V[x_{1}, N/(2A), N/(2A)] \\ x_{2}/A && \mathop{\text{Re}} V[N/(2A), x_{2}, N/(2A)] && \mathop{\text{Im}} V[N/(2A), x_{2}, N/(2A)] \\ x_{3}/A && \mathop{\text{Re}} V[N/(2A), N/(2A), x_{3}] && \mathop{\text{Im}} V[N/(2A), N/(2A), x_{3}] \end{align*} In both cases, the output is stored in the folder \texttt{data/snapshot} and such a folder must exist prior to running the program. The file names is \texttt{data/\allowbreak{}snapshot\_\allowbreak{}wave-function\_\allowbreak{}step\_\allowbreak{}i.dat}, where \texttt{step} is the step associated to the snapshot ($\tau=\text{EPS}\cdot\text{step}$) and \texttt{i} is an index running over the computational nodes. \end{description} \subsection{Initial conditions} \label{subsec_icond} The following parameters allow changing the initial state condition. The Coulomb-type initial conditions are intended to be a sensible initial guess for spherically symmetric confining central potentials. \begin{description} \item[\texttt{INITCONDTYPE}:] Initial condition to use. Valid values: \begin{description} \item[\texttt{0}:] Read initial condition from \texttt{wave-function\_\allowbreak{}0\_\allowbreak{}\#.dat} files in the \texttt{data} directory. \item[\texttt{1}:] Random Gaussian noise with standard deviation given by the \texttt{SIG} parameter. \item[\texttt{2}:] Non-relativistic Coulomb-type initial condition, centered at the same point where the potential is centered. I.e., either in the center of the lattice volume at the point $(N/2,N/2,N/2)$ (this applies to all of the hard-coded potentials with code <\texttt{100}), or in the origin of the lattice at the point $(x_{1},x_{2},x_{3}) = (0,0,0)$, otherwise. By default, we introduce a linear combination of the states $1s$, $2s$, $2p(m=0)$ and the real part of the $2p(l=1)$. Note that the selection of the $z$ axis of the $2p$ states is chosen through the flag \texttt{INITCONDAXIS}. \item[\texttt{3}:] Constant wave-function with value $0.1$. \item[\texttt{4}:] Boolean test grid, $V = (x_{1} \mod 2) \cdot (x_{2} \mod 2) \cdot (x_{3} \mod 2)$. \item[\texttt{5}:] This was an intermediate step during the development of the new version of \texttt{quantumfdtd}. The idea was to define an initial wave-function containing a sensible selection of Fourier components. We ended up with the function shown in Listing~\ref{listing} on page~\pageref{listing}. If the need arises to modify this function in order to include own guesses for particular potentials, we advise looking into the function\newline \texttt{void setInitialConditions(int seedMult)}, contained in the file \texttt{build/\allowbreak{}src/\allowbreak{}initialconditions.cpp}. \end{description} \item[\texttt{INITCONDAXIS}:] For \texttt{INITCONDTYPE} set to \texttt{2}, this flag sets the $z$ axis of the $2p_z$ components of the wave-function. For the choices \texttt{0}, \texttt{1}, or \texttt{2} the axis is set to $x_{1}$, $x_{2}$, or $x_{3}$, respectively. \item[\texttt{INITSYMMETRY}:] Symmetrize the wave-function. Valid values are: \begin{description} \item[\texttt{0}:] Disable option. \item[\texttt{1}:] Symmetric w.r.t. the $x_{3}$ direction. \item[\texttt{2}:] Antisymmetric w.r.t. the $x_{3}$ direction. \item[\texttt{3}:] Symmetric w.r.t. the $x_{2}$ direction. \item[\texttt{4}:] Antisymmetric w.r.t. the $x_{2}$ direction. \end{description} Note that because of the internal memory layout, it is not possible to offer options in the $x_{1}$ direction without a high MPI overhead. \item[\texttt{SIG}:] Standard deviation - used when \texttt{INITCONDTYPE} is set to \texttt{1}. \end{description} \clearpage { \captionsetup[table]{name=Listing} \begin{table}[p] \centering \begin{minipage}[t]{\textwidth} \centering \fbox{\lstinputlisting{initcondtype_5.cpp}} \end{minipage} \caption{\label{listing} Implementation of \texttt{INITCONDTYPE=5}: a selection of Fourier components as initial guess.} \end{table} } \clearpage \subsection{Hard-coded potentials} \label{subsec_hpot} The program comes bundled with several hard-coded potentials, that were already present in the original code~\cite{Strickland:2009ft, Dumitru:2009ni, Dumitru:2009fy}. The user should be aware that some of these potentials may be unphysical depending on the boundary conditions. \begin{description} \item[\texttt{0}:] No potential ($V(\vec{r}) = 0$). This is equivalent to an infinitely deep 3d well due to boundary conditions - provided that $\text{\texttt{KINTERM}} = 0$ is used. \item[\texttt{1}:] 3d square well in the center of the lattice volume: \begin{equation} V(x_{1},x_{2},x_{3}) = -10 \, \Theta(L/4 - |x_{1}|) \Theta(L/4 - |x_{2}|) \Theta(L/4 - |x_{3}|) \,, \end{equation} where $\Theta(x)$ is the Heaviside Theta function. \item[\texttt{2}:] Radial Coulomb potential: \begin{equation} V(x_{1},x_{2},x_{3}) = \begin{cases} -\frac{1}{r} \,, & \text{for } r > \texttt{A} \,, \\ -\frac{1}{\texttt{A}} \,, & \text{for } r \leq \texttt{A} \,, \end{cases} \end{equation} where $r = \sqrt{x_{1}^2 + x_{2}^2 + x_{3}^2}$. \item[\texttt{3}:] Elliptical Coulomb potential: \begin{equation} V(x_{1},x_{2},x_{3}) = \begin{cases} -\frac{1}{\tilde{r}} \,, & \text{for } \tilde{r} > \texttt{A} \,, \\ -\frac{1}{\texttt{A}} \,, & \text{for } \tilde{r} \leq \texttt{A} \,, \end{cases} \end{equation} where $\tilde{r} = \sqrt{x_{1}^2 + x_{2}^2 + 4 x_{3}^2}$. \item[\texttt{4}:] 3d harmonic oscillator: \begin{equation} V(x_{1},x_{2},x_{3}) = -\frac{1}{2} (x_{1}^2 + x_{2}^2 + x_{3}^2) \,. \end{equation} \item[\texttt{5}:] Complex 3d harmonic oscillator: \begin{equation} V(x_{1},x_{2},x_{3}) = -\frac{1}{2} (1 + \text{i}) (x_{1}^2 + x_{2}^2 + x_{3}^2) \,. \end{equation} \item[\texttt{6}:] Cornell potential with string breaking:\\ We take the string-breaking scale to be $r_{\text{sb}} = 5.5745$~GeV$^{-1}$ and define \begin{equation} \hat{r} = \begin{cases} r \,, & \text{for } r < r_{\text{sb}} \,, \\ r_{\text{sb}} \,, & \text{for } r \geq r_{\text{sb}} \,, \end{cases} \end{equation} where $r = \sqrt{x_{1}^2 + x_{2}^2 + x_{3}^2}$, and \begin{equation} V(x_{1},x_{2},x_{3}) = -\frac{0.385}{\hat{r}} + \texttt{SIGMA} \, \hat{r} + 4 \, \texttt{MASS} \,, \end{equation} where \texttt{MASS} is the \texttt{quantumfdtd} reduced mass and \texttt{SIGMA} is an independent parameter. \item[>\texttt{99}:] If $100$ is added to any of the previous potential codes, the corresponding potential will be loaded with its origin centered at the point $(x_{1},x_{2},x_{3}) = (0,0,0)$ instead of at the point $(x_{1},x_{2},x_{3}) = (N/2,N/2,N/2)$. This is especially useful for periodic boundary conditions. \end{description} \subsection{External potentials} \label{subsec_epot} The following values of \texttt{POTENTIAL} offer different options to read external potentials from files: \begin{description} \item[\texttt{90}:] Read external potential as a table containing \begin{equation*} x_{1} \text{\textvisiblespace} x_{2} \text{\textvisiblespace} x_{3} \text{\textvisiblespace} \Re(V) \text{\textvisiblespace} \Im(V) \,, \end{equation*} separated by spaces. \item[\texttt{91}:] Read external potential as a table containing \begin{equation*} R^{2} \text{\textvisiblespace} \Re(V) \text{\textvisiblespace} \Im(V) \,, \end{equation*} separated by spaces. \item[>\texttt{189}:] As in the previous section~\ref{subsec_hpot}, \texttt{190} and \texttt{191} are, respectively, the same that \texttt{90} and \texttt{91} but centered on $(0,0,0)$. \end{description} The following configuration flags are only valid when loading potentials from external files\footnote{Values of the \texttt{POTENTIAL} parameter: \texttt{90}, \texttt{91}, \texttt{190} and \texttt{191}}: \begin{description} \item[\texttt{EXPOT}:] Name of the file containing the external potential. The file format depends on the selected kind of external potential as described above. \item[\texttt{POTCRITR}:] Defines a point from which on (in units of the lattice spacing), the potential will be a $\chi^{2}$ adjustment to the following function: \begin{equation} V_{A,B,\sigma}(r) = A + B/r + \sigma\cdot r \end{equation} The parameters $A$, $B$, and $\sigma$ are written to console. Only valid for values of the \texttt{POTENTIAL} parameter: \texttt{90} and \texttt{190}. \item[\texttt{POTFLATR}:] Defines a point from which on (in units of the lattice spacing), the potential is flat taking the value of the point previous to it. Only valid for \texttt{POTENTIAL} values \texttt{90} and \texttt{190}. \end{description} \subsection{Post-processing scripts} \label{subsec_post_scripts} The following \texttt{bash} and \texttt{Python~3} scripts have been included for the post-processing of the wave-functions. They can be found in the \texttt{scripts} folder. Unless otherwise stated, they should be run from the parent folder where both the \texttt{data} and \texttt{input} folders are located: \begin{description} \item[\texttt{symmetrize.sh}:] Computes the projections and normalizations of all of the wave-functions, using the scripts \texttt{symmetrize\_\allowbreak{}wf.py} and \texttt{normalize.py}. It accepts direct output stored in the \texttt{data} folder or it accepts wave-functions which are stored in \texttt{gz} compressed \texttt{tar} archives named \texttt{wave-function.tgz} which allows for batch evaluation of results from many runs. Non-normalized output files named \texttt{wave-function\_\allowbreak{}\%i\_\allowbreak{}\%p.dat} and normalized ones named \texttt{wave-function\_\allowbreak{}\%i\_\allowbreak{}\%p\_\allowbreak{}norm.dat} are generated. \texttt{\%i}=0,1,2 denotes the ground, first and second excited states, respectively. \texttt{\%p} stands for the projection of the wave-function, as follows: \begin{description} \item[\texttt{wave-function\_\allowbreak{}\%i\_\allowbreak{}all.dat.gz}:] The wave-function as computed by \texttt{quantumfdtd}, but in a single file instead of one file per computational node. \item[\texttt{wave-function\_\allowbreak{}\%i\_\allowbreak{}p.dat.gz}:] Positive parity projection $P^+$ (Eq.~\ref{eq_parity}). \item[\texttt{wave-function\_\allowbreak{}\%i\_\allowbreak{}m.dat.gz}:] Negative parity projection $P^-$ (Eq.~\ref{eq_parity}). \item[\texttt{wave-function\_\allowbreak{}\%i\_\allowbreak{}pk.dat.gz}:] Negative parity projection around-an-axis $P^-_{\vec{p}_k}$ (Eq.~\ref{eq_parity_axis}). \item[\texttt{wave-function\_\allowbreak{}\%i\_\allowbreak{}all\_\allowbreak{}norm.dat.gz}:] Full normalized wave-function. \item[\texttt{wave-function\_\allowbreak{}\%i\_\allowbreak{}p\_\allowbreak{}norm.dat.gz}:] Normalized $P^+$ projection. \item[\texttt{wave-function\_\allowbreak{}\%i\_\allowbreak{}m\_\allowbreak{}norm.dat.gz}:] Normalized $P^-$ projection. \item[\texttt{wave-function\_\allowbreak{}\%i\_\allowbreak{}pk\_\allowbreak{}norm.dat.gz}:] Normalized $P^-_{\vec{p}_k}$ projection. \item[\texttt{wave-function\_\allowbreak{}\%i\_\allowbreak{}proj.dat}:] Weights of the parity projections. \end{description} For all of the cases but the normalized projection $P^-_{\vec{p}_k}$, the output is a gzipped ASCII file containing: \begin{equation*} x_{1}/A \quad x_{2}/A \quad x_{3}/A \quad r^2/A^2 \quad \mathop{\text{Re}}\Psi_i \quad \mathop{\text{Im}}\Psi_i \,, \end{equation*} For the normalized projection $P^-_{\vec{p}_k}$, the output follows the format: \begin{equation*} x_{1}/A \quad x_{2}/A \quad x_{3}/A \quad r/A \quad \cos\theta \quad \mathop{\text{Re}}\Psi_i \quad \mathop{\text{Im}}\Psi_i \,, \end{equation*} \item[\texttt{postprocess.sh}:] Generates plots of the potential and the wave-functions. \item[\texttt{postprocess\_\allowbreak{}sym.sh}:] Generates plots of the parity projected wave-functions obtained with \texttt{symmetrize.sh}. \item[\texttt{allpostprocess.sh}:] Runs \texttt{postprocess.sh}, \texttt{symmetrize.sh} and \texttt{postprocess\_\allowbreak{}sym.sh}, sequentially. \item[\texttt{cleandatafiles.sh}:] Runs \texttt{rm -rf data/*.* \allowbreak{}data/snapshot/*.* \allowbreak{}debug/*.*} for cleaning up a previous run. \item[\texttt{symmetrize\_\allowbreak{}wf.py}:] Computes the positive and negative parity projections of the given wave-function. It is called as:\\ \texttt{../scripts/symmetrize\_\allowbreak{}wf.py [params.txt] wave-function\_\allowbreak{}\%i\_\allowbreak{}\%d.dat}\\ The optional parameter \texttt{[params.txt]} encode the path to the config file, from which the simulation parameters like $N$, $A$, or the centering of the lattice are taken. If not provided, the script expects to be called from the \texttt{data} folder and tries to load the config file from the relative path \texttt{../input/params.txt}.\\ \texttt{\%i} should be substituted by the numbers 0, 1 and 2 for the ground, first and second excited states, respectively.\\ \texttt{\%d} should be left on the actual call. It means that the script will look for files where \texttt{\%d} is a numerical index starting on 0. This procedure has been implemented because \texttt{quantumfdtd} splits the output data between as many files as computational nodes are used. This \texttt{\%d} is the numerical index of these files. In practice, for the ground state wave-function, the call (from the \texttt{data} folder) is\\ \texttt{../scripts/symmetrize\_\allowbreak{}wf.py wave-function\_\allowbreak{}0\_\allowbreak{}\%d.dat} \item[\texttt{normalize.py}:] Normalizes the wave-funtions to unity over the lattice volume. It is expected to be run from inside the \texttt{data} folder, but it can be run from any folder where wave-functions are stored. It is called as:\\ \texttt{../scripts/symmetrize\_\allowbreak{}wf.py wave-function.dat out.dat}. \end{description} \subsection{Post-processing Python module} \label{subsec_post_python} We provide a post-processing Python~3 module in \texttt{scripts/quantumfdtd.py}, whose class \texttt{quantumfdtd} aims at helping with the analysis via Python~3~\cite{python}, Pandas~\cite{pandas, reback2020pandas, mckinney-proc-scipy-2010}, NumPy~\cite{numpy, oliphant2006guide, 5725236}, and Matplotlib~\cite{matplotlib, 4160265}. It accepts as input the output of either \texttt{symmetrize.sh} or \texttt{allpostprocess.sh} from the previous section~\ref{subsec_post_scripts}. The class functions are: \begin{description} \item[\texttt{\_\_init\_\_(self, case, config=None)}:] Constructor. It requires a \texttt{case} parameter that is a parent folder where \texttt{input} and \texttt{data} folders of an individual run of \texttt{quantumfdtd} and \texttt{allpostprocess.sh} are stored. There is an optional parameter, \texttt{config}, to provide an absolute or relative path to a \texttt{params.txt} (config file). The function \texttt{load\_\allowbreak{}energies}, that loads the energies of the final wave-function (and the intermediate snapshots, if they are taken), is also called by the constructor. \item[\texttt{load\_case(self, case, config=None)}:] In case the default constructor is called, this function accepts the same arguments as the constructor in order to perform a proper initialization of the class. It also allows to load a different \emph{case}\footnote{% Path where a run of \texttt{quantumfdtd} is stored.} without destroying and creating a new class. \item[\texttt{load\_energies(self)}:] This function is implicitly called by the constructor and by the \texttt{load\_\allowbreak{}case} function, so that it does not need to be called explicitly. It loads the eigen-energies as a function of $\tau$ into the \texttt{self.e\_wf} variable, as a Pandas \texttt{DataFrame}. It also loads the \texttt{decay.dat} table, that encodes the eigen-energy of the ground state with a higher frequency on $\tau$, and returns it as a \texttt{DataFrame} via the \texttt{self.e\_dec} variable. \item[\texttt{load\_potential(self)}:] This function loads the potential and returns it as a \texttt{DataFrame} with the columns $x$, $y$, $z$ (integers, coordinates in lattice space in units of $A$), $r$ (in units of $A$), \texttt{re\_v} and \texttt{im\_v} (real and imaginary part of the potential, in GeV). \item[\texttt{load\_wf(self, snap, state, figure, min\_sep\_edge=-1., normalization=True)}:]\hfill\\ This function loads a wave function and returns it as a \texttt{DataFrame}. If \texttt{snap=-1}, the final wave-function is loaded. Otherwise, an intermediate 3D snapshot is loaded, whose \texttt{STEP} value is given by the \texttt{snap} parameter. Remember that $\tau = \text{\texttt{STEP}}\cdot\text{\texttt{EPS}}$. The argument \texttt{state} is an integer value from 0 to 2, corresponding to the ground state, or to the first or second excited state. The \texttt{figure} variable is \texttt{m}, \texttt{p}, \texttt{pk} or \texttt{all}, corresponding to the projection that is going to be loaded: negative parity projection $P^{-}$, positive parity projection $P^{+}$, negative-around-an-axis $P^{-}_{p_{k}}$ and non-projected wave-function, respectively. \item[\texttt{fix\_positive\_wf(self,wf,lim=0.05)}:] This function returns the wave-function, inverting its sign if the integration of its real values for the points $r < A \cdot N \cdot \text{\texttt{lim}}$ is negative. \item[\texttt{get\_avg\_r(self,wf)}:] This function returns the average radius, $\langle r \rangle$, of the wave-function passed by the \texttt{wf} parameter. \item[\texttt{load\_proj\_components(self)}:] This function adds additional rows to \texttt{self.e\_wf}. In these rows, the weights of the parity projections of each excited state are stored. If snapshots are taken, this option is very useful for measuring the decay of the different excited states through the iterative procedure explained in section~\ref{subsec_iter}. \item[\texttt{get\_snaps(self)}:] This function returns an \texttt{array} of snapshots. For each snapshot, the value of \texttt{STEP} is stored on the array, where $\tau = \text{\texttt{STEP}}\cdot\text{\texttt{EPS}}$. \end{description} \section{Conclusions} \label{sec_conclus} In this work, the \texttt{quantumfdtd} code version~2.1~\cite{Strickland:2009ft,Margotta:2011ta} has been extended to include the case of a relativistic Schr{\"o}dinger equation. This is accomplished via a FFT implementation for the RQM inspired kinetic Hamiltonian and working with the iterative solver in imaginary time. Additionally, we have extended the program to have support for arbitrary external potentials, introduced as ASCII tables, and included several analysis scripts. One of them allows to extract parity projections of the extracted wave-functions. This greatly improves the flexibility and usability of the original program and makes this version~3 valuable even if the original finite-difference time-domain (FDTD) solver (for the non-relativistic Schr{\"o}dinger equation) is being used. We have seen in section~\ref{sec_examples} that the ground-state wave-function is stable for high values of the time evolution parameter $\tau$. The output wave-functions are linear combinations of the first excited states. The overlap method is an approximation to increase the weight of the first and second excited state in the corresponding wave-functions. But the evolution Eq.~\ref{iter_decay}, and a periodic internal normalization to one of the evolved wave-function, makes the weight of the excited states in the wave-function decay exponentially. These weights will eventually decay below the machine precision, eliminating the information about excited states from the runs with the highest values of $\tau$. The parity projection scripts are a useful tool for separating excited states when they are nearly degenerated in energy which is especially noticeable for the $2s$ and the $2p$-states. To sum up: the ground-state wave-function should be easy to recover in all of the situations, provided that the corresponding energy is in a plateau and the wave-function is stable w.r.t. $\tau$. For increased precision, the positive parity projection can be used. The $2p$-state can be separated by means of the negative-around-an-axis parity projection operator. The $2s$-state can be also separated, but is more challenging due to the behavior of the tail after the first node on a periodic potential. A large lattice volume can help here. In the examples presented in this paper, we focused on relatively small lattices ($N \leq 128$) {that are most relevant for interfacing with lattice gauge theory simulations} in order to assess the numerical accuracy of the newly introduced relativistic and non-relativistic kinetic energy terms. In practice, due to the parallelized implementation of both the FDTD and FFT-based algorithms it is possible to use \texttt{quantumfdtd} on quite large lattices. For example, there have been past studies with lattices as large as $N=1024$~\cite{Strickland:2009ft}. Possible future improvements include: \begin{itemize} \item Implementing an automatized algorithm in order to look for saddle points of $E_{s,i}(\tau)$ for $i=0,\,1,\,2$. \item Implementing new projection operators on the post-processing stage (see subsection~\ref{subsec_parity_proy}). For instance, separation of $d$ states. For larger overlaps this may involve including contributions from higher states in the initial wave-function (see subsection~\ref{subsec_icond}). \item Implementing a suitable binary format for the wave-functions. \end{itemize} Such improvements are beyond the scope of the present work. However, it would be useful to consider them as a guidance for further improvements of the \texttt{quantumfdtd} program. \section*{Acknowledgments} R.L.D. was financially supported by the Ram{\'o}n Areces Foundation, the INFN post-doctoral fellowship AAOODGF-2019-0000329 and the Spanish grant MICINN: PID2019-108655GB-I00. M.S. was supported by the U.S. Department of Energy, Office of Science, Office of Nuclear Physics Award No.~DE-SC0013470. J.H.W. was supported by the U.S. Department of Energy, Office of Science, Office of Nuclear Physics and Office of Advanced Scientific Computing Research within the framework of Scientific Discovery through Advance Computing (SciDAC) award Computing the Properties of Matter with Leadership Computing Resources. We acknowledge the support by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) under Germany's Excellence Strategy -- EXC-2094 -- 390783311 via the Excellence Cluster "ORIGINS". The simulations have been carried out on the computing facilities of the Computational Center for Particle and Astrophysics (C2PAP) and the Leibniz Supercomputing Center (SuperMUC), on the local theory cluster (T30 cluster) of the Physics Department of the Technische Universit{\"a}t M{\"u}nchen (TUM), and on local computing facilities at the INFN-Firenze.
\section{Introduction} During the last decade, deep learning \citep{goodfellow2016dlbook}, the study of neural networks (NNs), has achieved ground-breaking results in diverse areas such as computer vision \citep{krizhevsky12alexnet,he2016resnet,long15fully,chen2018deeplab}, natural language processing \citep{hinton2012speech,vaswani2017attention,devlin2019bert}, generative modeling \citep{kingma2014vae,goodfellow2014gan} and reinforcement learning \citep{mnih2015dqn,silver2016alphago}, and various network designs have been proposed. However, neural networks have been treated largely as ``black-box'' function approximators, and their designs have chiefly been found via trial-and-error, with little or no theoretical justification. A major cause that hinders the theoretical analysis is the current overly generic modeling of neural networks as function approximators: simply interpreting a neural network as a composition of parametrized functions provides little insight to decipher the nature of its components or its behavior during the learning process. In this paper, we show that a neural network can actually be interpreted as a probabilistic graphical model (PGM) called chain graph (CG) \citep{koller2009pgmbook}, and feed-forward as an efficient approximate probabilistic inference on it. This offers specific interpretations for various neural network components, allowing for in-depth theoretical analysis and derivation of new approaches. \begin{figure}[t] \centering \includegraphics[width=0.39\linewidth]{banner} \hspace{0.02\linewidth} \includegraphics[width=0.39\linewidth]{activation} \caption{Neural networks can be interpreted as layered chain graphs where activation functions are determined by node distributions. \textsl{Left}: An example neural network interpreted as a chain graph with three chain components which represent its layers; \textsl{Right}: A variety of activation functions (softplus, ReLU, leaky ReLU) approximated by nodes following rectified Gaussian distributions ($e,q$ as in Eq.~\eqref{eq:ff}). We visualize the approximations stochastically by averaging over 200 samples.} \label{fig:banner} \end{figure} \subsection{Related work} \label{subsec:relatedwork} In terms of theoretical understanding of neural networks, a well known result based on the function approximator view is the universal approximation theorem \citep{goodfellow2016dlbook}, however it only establishes the representational power of NNs. Also, there have been many efforts on alternative NN interpretations. One prominent approach identifies infinite width NNs as Gaussian processes \citep{neal1996phd,lee2018dnnasgp}, enabling kernel method analysis \citep{jacot2018ntk}. Other works also employ theories such as optimal transport \citep{genevay2017gan,chizat2018global} or mean field \citep{mei2019mean}. These approaches lead to interesting findings, however they tend to only hold under limited or unrealistic settings and have difficulties interpreting practical real-world NNs. Alternatively, some existing works study the post-hoc interpretability \citep{lipton2018mythos}, proposing methods to analyze the empirical behavior of trained neural networks: activation maximization \citep{erhan2009visualizing}, typical input synthesis \citep{nguyen2016synthinput}, deconvolution \citep{zeiler2014deconv}, layer-wise relevance propagation \citep{bach2015lrp}, etc. These methods can offer valuable insights to the practical behavior of neural networks, however they represent distinct approaches and focuses, and are all limited within the function approximator view. Our work links neural networks to probabilistic graphical models \citep{koller2009pgmbook}, a rich theoretical framework that models and visualizes probabilistic systems composed of random variables (RVs) and their interdependencies. There are several types of graphical models. The chain graph model \citep{koller2009pgmbook} used in our work is a general form that unites directed and undirected variants, visualized as a partially directed acyclic graph (PDAG). Interestingly, there exists a series of works on constructing hierarchical graphical models for data-driven learning problems, such as sigmoid belief network \citep{neal1992sbn}, deep belief network \citep{hinton2006dbn}, deep Boltzmann machine \citep{salakhutdinov2012dbm} and sum product network \citep{poon2011spn}. As alternatives to neural networks, these models have shown promising potentials for generative modeling and unsupervised learning. Nevertheless, they are yet to demonstrate competitive performances over neural network for discriminative learning. Neural networks and graphical models have so far been treated as two distinct approaches in general. Existing works that combine them \citep{zheng2015crfasrnn, chen2018deeplab, lampe2016crfnlp} treat either neural networks as function approximators for amortized inference, or graphical models as post-processing steps. Some consider neural networks as graphical models with deterministic hidden nodes \citep{buntine1994gmasnn}. However this is an atypical degenerate regime. To the best of our knowledge, our work provides the first rigorous and comprehensive formulation of a (non-degenerate) graphical model interpretation for neural networks in practical use. \subsection{Our contributions} The main contributions of our work are summarized as follows: \begin{itemize} \item We propose a layered chain graph representation of neural networks, interpret feed-forward as an approximate probabilistic inference procedure, and show that this interpretation provides an extensive coverage of practical NN components (Section~\ref{sec:nnascg}); \item To illustrate its advantages, we show with concrete examples (residual block, RNN, dropout) that the chain graph interpretation enables coherent and in-depth theoretical support, and provides additional insights to various empirically established network structures (Section~\ref{sec:case_studies}); \item Furthermore, we demonstrate the potential of the chain graph interpretation for discovering new approaches by using it to derive a novel stochastic inference method named partially collapsed feed-forward, and establish experimentally its empirical effectiveness (Section~\ref{sec:pcff}). \end{itemize} \section{Chain graph interpretation of neural networks} \label{sec:nnascg} Without further delay, we derive the chain graph interpretation of neural networks in this section. We will state and discuss the main results here and leave the proofs in the appendix. \subsection{The layered chain graph representation} \label{subsec:cgrepr} We start by formulating the so called \textsl{layered chain graph} that corresponds to neural networks we use in practice: Consider a system represented by $L$ layers of random variables $(\mathbf{X}^{1}, \dots, \mathbf{X}^{L})$, where $X^{l}_i$ is the $i$-th variable node in the $l$-th layer, and denote $N^l$ the number of nodes in layer $l$. We assume that nodes $X^{l}_i$ in the same layer $l$ have the same distribution type characterized by a feature function $\mathbf{T}^l$ that can be multidimensional. Also, we assume that the layers are ordered topologically and denote $Pa(\mathbf{X}^l)$ the parent layers of $\mathbf{X}^l$. To ease our discussion, we assume that $\mathbf{X}^1$ is the input layer and $\mathbf{X}^L$ the output layer (our formulation can easily extend to multi-input/output cases). A layered chain graph is then defined as follows: \begin{atdef} A \textsl{layered chain graph} that involves $L$ layers of random variables $(\mathbf{X}^{1}, \dots, \mathbf{X}^{L})$ is a chain graph that encodes the overall distribution $P(\mathbf{X}^2, \dots, \mathbf{X}^L | \mathbf{X}^1)$ such that: \begin{enumerate} \item It can be factored into layerwise chain components $P(\mathbf{X}^{l}|Pa(\mathbf{X}^l))$ following the topological order, and nodes $X^{l}_i$ within each chain component $P(\mathbf{X}^{l}|Pa(\mathbf{X}^l))$ are conditionally independent given their parents (this results in bipartite chain components), thus allowing for further decomposition into nodewise conditional distributions $P(X^{l}_i|Pa(\mathbf{X}^l))$ . This means we have \begin{equation} P(\mathbf{X}^2, \dots, \mathbf{X}^L | \mathbf{X}^1) = \prod_{l=2}^{L} P(\mathbf{X}^{l}|Pa(\mathbf{X}^l)) = \prod_{l=2}^{L} \prod_{i=1}^{N^{l}} P(X_i^{l}|Pa(\mathbf{X}^l)); \end{equation} \item For each layer $l$ with parent layers $Pa(\mathbf{X}^l)=\{ \mathbf{X}^{p_1}, \dots \mathbf{X}^{p_n} \}, p_1,\dots,p_n \in \{ 1,\dots,l-1 \}$, its nodewise conditional distributions $P(X^{l}_i|Pa(\mathbf{X}^l))$ are modeled by pairwise conditional random fields (CRFs) with with unary ($\mathbf{b}^{l}_i$) and pairwise ($\mathbf{W}_{j, i}^{p, l}$) weights (as we will see, they actually correspond to biases and weights in NN layers): \begin{align} &P(X^{l}_i|Pa(\mathbf{X}^l)) = f^{l} \big( \mathbf{T}^l(X^{l}_i), \mathbf{e}^{l}_i\big(\mathbf{T}^{p_1}(\mathbf{X}^{p_1}),\dots,\mathbf{T}^{p_n}(\mathbf{X}^{p_n})\big) \big) \label{eq:activgeneral} \\ \text{with}\quad &\mathbf{e}^{l}_i\big(\mathbf{T}^{p_1}(\mathbf{X}^{p_1}),\dots,\mathbf{T}^{p_n}(\mathbf{X}^{p_n})\big) = \mathbf{b}^{l}_i + \sum_{p=p_1}^{p_n} \sum_{j=1}^{N^{p}} \mathbf{W}_{j, i}^{p, l} \mathbf{T}^{p}(X^{p}_j). \label{eq:activgeneralpreact} \end{align} \end{enumerate} \end{atdef} Figure~\ref{fig:banner}~Left illustrates an example three-layer network as layered chain graph and its chain component factorization. For exponential family distributions \citep{koller2009pgmbook}, the general form in Eq.~\eqref{eq:activgeneral} simply becomes $P(X^{l}_i|Pa(\mathbf{X}^l)) \propto \exp \big( \mathbf{T}^l(X^{l}_i) \cdot \mathbf{e}^{l}_i\big(\mathbf{T}^{p_1}(\mathbf{X}^{p_1}),\dots,\mathbf{T}^{p_n}(\mathbf{X}^{p_n})\big) \big)$. \subsection{Feed-forward as approximate probabilistic inference} \label{subsec:ffprobainfer} To identify layered chain graphs with real-world neural networks, we need to show that they can behave the same way during inference and learning. For this, we establish the fact that feed-forward can actually be seen as performing an approximate probabilistic inference on a layered chain graph: Given an input sample $\tilde{\mathbf{x}}^1$, we consider the problem of inferring the marginal distribution $Q^l_i$ of a node $X^l_i$ and its expected features $\mathbf{q}^l_i$, defined as \begin{equation} Q^l_i (x^l_i | \tilde{\mathbf{x}}^1) = P(X^l_i=x^l_i | \mathbf{X}^1=\tilde{\mathbf{x}}^1);\quad \mathbf{q}^l_i = \mathbb{E}_{Q^l_i}[\mathbf{T}^l(X^l_i)] \enspace ( \mathbf{q}^1 = \tilde{\mathbf{x}}^1). \label{eq:qdefs} \end{equation} Consider a non-input layer $l$ with parent layers $p_1,\dots,p_n$, the independence assumptions encoded by the layered chain graph lead to the following recursive expression for marginal distributions $Q$: \begin{equation} Q^l_i (x^l_i | \tilde{\mathbf{x}}^1) = \mathbb{E}_{Q^{p_1},\dots,Q^{p_n}}[P(x^l_i | Pa(\mathbf{X}^l))]. \label{eq:qrecursive} \end{equation} However, the above expression is in general intractable, as it integrates over the entire admissible states of all parents nodes in $Pa(\mathbf{X}^l)$. To proceed further, simplifying approximations are needed. Interestingly, by using linear approximations, we can obtain the following results (in case of discrete random variable the integration in Eq.~\ref{eq:ff} is replaced by summation): \begin{atprop} \label{thm:ff} If we make the assumptions that the corresponding expressions are approximately linear w.r.t.\ parent features $\mathbf{T}^{p_1}(\mathbf{X}^{p_1}),\dots,\mathbf{T}^{p_n}(\mathbf{X}^{p_n})$, we obtain the following approximations: \begin{align} &Q^l_i (x^l_i | \tilde{\mathbf{x}}^1) \approx f^{l} \big( \mathbf{T}^l(x^{l}_i), \mathbf{e}^{l}_i(\mathbf{q}^{p_1},\dots,\mathbf{q}^{p_n}) \big); \label{eq:distff} \\ &\mathbf{q}^l_i \approx \int_{x^l_i} \mathbf{T}^l(x^l_i) f^{l} \big( \mathbf{T}^l(x^{l}_i), \mathbf{e}^{l}_i(\mathbf{q}^{p_1},\dots,\mathbf{q}^{p_n}) \big) dx^l_i := \mathbf{g}^l(\mathbf{e}^{l}_i(\mathbf{q}^{p_1},\dots,\mathbf{q}^{p_n})). \label{eq:ff} \end{align} Especially, Eq.~\eqref{eq:ff} is a feed-forward expression for expected features $\mathbf{q}^l_i$ with activation function $\mathbf{g}^l$ determined by $\mathbf{T}^l$ and $f^l$, i.e.\ the distribution type of random variable nodes in layer $l$. \end{atprop} The proof is provided in Appendix~\ref{asubsec:proof_thm_ff}. This allows us to identify feed-forward as an approximate probabilistic inference procedure for layered chain graphs. For learning, the loss function is typically a function of $(Q^L,\mathbf{q}^L)$ obtainable via feed-forward, and we can follow the same classical neural network parameter update using stochastic gradient descent and backpropagation. Thus we are able to replicate the exact neural network training process with this layered chain graph framework. The following corollary provides concrete examples of some common activation functions $\mathbf{g}$ (we emphasize their names in bold, detailed formulations and proofs are given in Appendix~\ref{asubsec:proof_cor_activationfuncs}): \begin{atcor} \label{cor:activationfuncs} We have the following node distribution \-- activation function correspondences: \begin{enumerate} \item Binary nodes taking values $\{\alpha, \beta\}$ results in sigmoidal activations, especially, we obtain \textbf{sigmoid} with $\alpha=0, \beta=1$ and \textbf{tanh} with $\alpha=-1, \beta=1$ ($\alpha, \beta$ are interchangeable); \item Multilabel nodes characterized by label indicator features result in the \textbf{softmax} activation; \item Variants of (leaky) rectified Gaussian distributions ($T^{l}_i(X^{l}_i) = X^{l}_i = \max(\epsilon Y^{l}_i, Y^{l}_i)$ with $Y^{l}_i \sim \mathcal{N} \big( e^{l}_i, (s^l_i(e^{l}_i))^2 \big)$) can approximate activations such as \textbf{softplus} ($\epsilon=0, s^l_i \approx 1.7761$) and \textbf{$\epsilon$-leaky rectified linear unit} (ReLU) ($s^l_i =\tanh (e^{l}_i)$) including \textbf{ReLU} ($\epsilon=0$) and \textbf{identity} ($\epsilon=1$). \end{enumerate} \end{atcor} Figure~\ref{fig:banner}~Right illustrates activation functions approximated by various rectified Gaussian variants. We also plotted (in orange) an alternative approximation of ReLU with sigmoid-modulated standard deviation proposed by \citet{nair2010relu} which is less accurate around the kink at the origin. The linear approximations, needed for feed-forward, is coarse and only accurate for small pairwise weights ($\|\mathbf{W}\| \ll 1$) or already linear regions. This might justify weight decay beyond the general ``anti-overfit'' argument and the empirical superiority of piecewise linear activations like ReLU \citep{nair2010relu}. Conversely, as a source of error, it might explain some ``failure cases'' of neural networks such as their vulnerability against adversarial samples, see e.g.,\ \citet{goodfellow2015adversarial}. \subsection{Generality of the chain graph interpretation} \label{subsec:gen_nnascg} The chain graph interpretation formulated in Sections~\ref{subsec:cgrepr} and \ref{subsec:ffprobainfer} is a general framework that can describe many practical network structures. To demonstrate this, we list here a wide range of neural network designs (marked in bold) that are chain graph interpretable. \begin{itemize} \item In terms of network architecture, it is clear that the chain graph interpretation can model networks of arbitrary depth, and with general multi-branched structures such as \textbf{inception modules} \citep{szegedy2015googlenet} or \textbf{residual blocks} \citep{he2016resnet, he2016resnet2} discussed in Section~\ref{subsec:residual}. Also, it is possible to built up \textbf{recurrent neural networks (RNNs)} for sequential data learning, as we will see in Section~\ref{subsec:rnn}. Furthermore, the modularity of chain components justifies \textbf{transfer learning via partial reuse of pre-trained networks}, e.g.,\ backbones trained for image classification can be reused for segmentation \citep{chen2018deeplab}. \item In terms of layer structure, we are free to employ sparse connection patterns and shared/fixed weight, so that we can obtain not only \textbf{dense connections}, but also connections like \textbf{convolution}, \textbf{average pooling} or \textbf{skip connections}. Moreover, as shown in Section~\ref{subsec:dropout}, \textbf{dropout} can be reproduced by introducing and sampling from auxiliary random variables, and normalization layers like \textbf{batch normalization} \citep{ioffe2015batchnorm} can be seen as reparametrizations of node distributions and fall within the general form (Eq.~\eqref{eq:activgeneral}). Finally, we can extend the layered chain graph model to allow for intra-layer connections, which enables \textbf{non-bipartite CRF layers} which are typically used on output layers for structured prediction tasks like image segmentation \citep{zheng2015crfasrnn, chen2018deeplab} or named entity recognition \citep{lampe2016crfnlp}. However, feed-forward is no longer applicable through these intra-connected layers. \item Node distributions can be chosen freely, leading to a variety of nonlinearities (e.g.,\ Corollary~\ref{cor:activationfuncs}). \end{itemize} \section{Selected case studies of existing neural network designs} \label{sec:case_studies} The proposed chain graph interpretation offers a detailed description of the underlying mechanism of neural networks. This allows us to obtain novel theoretical support and insights for various network designs which are consistent within a unified framework. We illustrate this with the following concrete examples where we perform in-depth analysis based on the chain graph formulation. \subsection{Residual block as refinement module} \label{subsec:residual} The residual block, proposed originally in \citet{he2016resnet} and improved later \citep{he2016resnet2} with the preactivation form, is an effective design for building up very deep networks. Here we show that a preactivation residual block corresponds to a refinement module within a chain graph. We use \textsl{modules} to refer to encapsulations of layered chain subgraphs as input--output mappings without specifying their internal structures. A refinement module is defined as follows: \begin{atdef} \label{def:refinementmodule} Given a base submodule from layer $\mathbf{X}^{l-1}$ to layer $\mathbf{X}^l$, a \textsl{refinement module} augments this base submodule with a side branch that chains a copy of the base submodule (sharing weight with its original) from $\mathbf{X}^{l-1}$ to a duplicated layer $\tilde{\mathbf{X}}^l$, and then a refining submodule from $\tilde{\mathbf{X}}^l$ to $\mathbf{X}^l$. \end{atdef} \begin{figure}[ht] \centering \includegraphics[width=0.24\linewidth]{resnet_chaingraph} \hspace{0.02\linewidth} \includegraphics[width=0.6\linewidth]{resnet_compgraph2} \caption{Example of a refinement module (left) and its corresponding computational graph (right), composed of a base submodule $X^{l-1} \to X^l$ (blue background) and a refining submodule $\tilde{X}^l \to Z^l \to X^l$ (red background). In the computational graph each $W,b$ represents a linear connection (Eq.~\eqref{eq:activgeneralpreact}) and $\sigma$ an activation function. Same color identifies corresponding parts in the two graphs. We see that this refinement module corresponds exactly to a preactivation residual block.} \label{fig:residualblock} \end{figure} \begin{atprop} \label{prop:residual} A refinement module corresponds to a preactivation residual block. \end{atprop} We provide a proof in Appendix~\ref{asubsec:proof_prop_residual} and illustrate this correspondence in Figure~\ref{fig:residualblock}. An interesting remark is that the refinement process can be recursive: the base submodule of a refinement module can be a refinement module itself. This results in a sequence of consecutive residual blocks. While a vanilla layered chain component encodes a generalized linear model during feed-forward (c.f.\ Eqs.~\eqref{eq:ff},\eqref{eq:activgeneralpreact}), the refinement process introduces a nonlinear extension term to the previously linear output preactivation, effectively increasing the representational power. This provides a possible explanation to the empirical improvement generally observed when using residual blocks. Note that it is also possible to interpret the original postactivation residual blocks, however in a somewhat artificial manner, as it requires defining identity connections with manually fixed weights. \subsection{Recurrent neural networks} \label{subsec:rnn} Recurrent neural networks (RNNs) \citep{goodfellow2016dlbook} are widely used for handling sequential data. An unrolled recurrent neural network can be interpreted as a dynamic layered chain graph constructed as follows: a given base layered chain graph is copied for each time step, then these copies are connected together through recurrent chain components following the Markov assumption \citep{koller2009pgmbook}: each recurrent layer $\mathbf{X}^{l,t}$ at time $t$ is connected by its corresponding layer $\mathbf{X}^{l,t-1}$ from the previous time step $t-1$. Especially, denoting $Pa^t(\mathbf{X}^{l,t})$ the non-recurrent parent layers of $\mathbf{X}^{l,t}$ in the base chain graph, we can easily interpret the following two variants: \begin{atprop} \label{prop:rnn} Given a recurrent chain component that encodes $P(\mathbf{X}^{l,t}|Pa^t(\mathbf{X}^{l,t}), \mathbf{X}^{l,t-1})$, \begin{enumerate} \item It corresponds to a simple (or vanilla / Elman) recurrent layer \citep{goodfellow2016dlbook} if the connection from $\mathbf{X}^{l,t-1}$ to $\mathbf{X}^{l,t}$ is dense; \item It corresponds to an independently RNN (IndRNN) \citep{li2018indrnn} layer if the conditional independence assumptions among the nodes $X^{l,t}_i$ within layer $l$ are kept through time: \begin{equation} \forall i \in \{1,\dots, N^l\}, \ P(X^{l,t}_i|Pa^t(\mathbf{X}^{l,t}), \mathbf{X}^{l,t-1}) = P(X^{l,t}_i|Pa^t(\mathbf{X}^{l,t}), X^{l,t-1}_i). \end{equation} \end{enumerate} \end{atprop} We provide a proof in Appendix~\ref{asubsec:proof_prop_rnn} and illustrates both variants in Figure~\ref{fig:rnn}. \begin{figure}[ht] \centering \includegraphics[width=0.35\linewidth]{srn} \hspace{0.06\linewidth} \includegraphics[width=0.35\linewidth]{indrnn} \caption{Comparison of an simple recurrent layer (left) v.s.\ an IndRNN (right) recurrent layer. IndRNN, the better variant, enforces the intra-layer conditional independence through time.} \label{fig:rnn} \end{figure} The simple recurrent layer, despite its exhaustive dense recurrent connection, is known to suffer from vanishing/exploding gradient and can not handle long sequences. The commonly used long-short term memory \citep{hochreiter1997lstm} and gated recurrent unit \citep{cho2014gru} alleviate this issue via long term memory cells and gating. However, they tend to result in bloated structures, and still cannot handle very long sequences \citep{li2018indrnn}. On the other hand, IndRNNs can process much longer sequences and significantly outperform not only simple RNNs, but also LSTM-based variants \citep{li2018indrnn,li2019indrnn}. This indicates that the assumption of intra-layer conditional independence through time, analogue to the local receptive fields of convolutional neural networks, could be an essential sparse network design tailored for sequential modeling. \subsection{Dropout} \label{subsec:dropout} Dropout \citep{srivastava2014dropout} is a practical stochastic regularization method commonly used especially for regularizing fully connected layers. As we see in the following proposition, from the chain graph point of view, dropout corresponds to introducing Bernoulli auxiliary random variables that serve as noise generators for feed-forward during training: \begin{atprop} \label{prop:dropout} Adding dropout with drop rate $1 - p^l$ to layer $l$ corresponds to the following chain graph construction: for each node $X^l_i$ in layer $l$ we introduce an auxiliary Bernoulli random variable $D^l_i \sim \text{Bernoulli}(p^l)$ and multiply it with the pairwise interaction terms in all preactivations (Eq.~\eqref{eq:activgeneralpreact}) involving $X^l_i$ as parent (this makes $D^l_i$ a parent of all child nodes of $X^l_i$ and extend their pairwise interactions with $X^l_i$ to ternary ones). The behavior of dropout is reproduced exactly if: \begin{itemize} \item During training, we sample auxiliary nodes $D^l_i$ during each feed-forward. This results in dropping each activation $\mathbf{q}^l_i$ of node $X^l_i$ with probability $1 - p^l$; \item At test time, we marginalize auxiliary nodes $D^l_i$ during each feed-forward. This leads to deterministic evaluations with a constant scaling of $p^l$ for the node activations $\mathbf{q}^l_i$. \end{itemize} \end{atprop} We provide a proof in Appendix~\ref{asubsec:proof_prop_dropout}. Note that among other things, this chain graph interpretation of dropout provides a theoretical justification of the constant scaling at test time. This was originally proposed as a heuristic in \citet{srivastava2014dropout} to maintain consistent behavior after training. \section{Partially collapsed feed-forward} \label{sec:pcff} The theoretical formulation provided by the chain graph interpretation can also be used to derive new approaches for neural networks. It allows us to create new deep learning methods following a coherent framework that provides specific semantics to the building blocks of neural networks. Moreover, we can make use of the abundant existing work from the PGM field, which also serves as a rich source of inspiration. As a concrete example, we derive in this section a new stochastic inference procedure called partially collapsed feed-forward (PCFF) using the chain graph formulation. \subsection{PCFF: chain graph formulation} \label{subsec:pcffcg} A layered chain graph, which can represent a neural network, is itself a probabilistic graphical model that encodes an overall distribution conditioned on the input. This means that, to achieve stochastic behavior, we can directly draw samples from this distribution, instead of introducing additional ``noise generators'' like in dropout. In fact, given the globally directed structure of layered chain graph, and the fact that the conditioned input nodes are ancestral nodes without parent, it is a well-known PGM result that we can apply forward sampling (or ancestral sampling) \citep{koller2009pgmbook} to efficiently generate samples: given an input sample $\tilde{\mathbf{x}}^1$, we follow the topological order and sample each non-input node $X^l_i$ using its nodewise distribution (Eq.~\eqref{eq:activgeneral}) conditioned on the samples $(\mathbf{x}^{p_1}, \dots,\mathbf{x}^{p_n})$ of its parents. Compared to feed-forward, forward sampling also performs a single forward pass, but generates instead an unbiased stochastic sample estimate. While in general an unbiased estimate is preferable and the stochastic behavior can also introduce regularization during training \citep{srivastava2014dropout}, forward sampling can not directly replace feed-forward, since the sampling operation is not differentiable and will jeopardize the gradient flow during backpropagation. To tackle this, one idea is to apply the reparametrization trick \citep{kingma2014vae} on continuous random variables (for discrete RVs the Gumbel softmax trick \citep{jang2017gumbelsoftmax} can be used but requires additional continuous relaxation). An alternative solution is to only sample part of the nodes as in the case of dropout. The proposed partially collapse feed-forward follows the second idea: we simply ``mix up'' feed-forward and forward sampling, so that for each forward inference during training, we randomly select a portion of nodes to sample and the rest to compute deterministically with feed-forward. Thus for a node $X_i^l$ with parents $(\mathbf{X}^{p_1},\dots,\mathbf{X}^{p_n})$, its forward inference update becomes \begin{equation} \mathbf{q}_i^l \gets \begin{cases} \mathbf{g}^l(\mathbf{e}^l_i(\mathbf{q}^{p_1}, \dots, \mathbf{q}^{p_n})) &\text{ if collapsed (feed-forward)}; \\ \mathbf{T}^l(x_i^l),\ x_i^l \sim f^{l} \big( \mathbf{T}^l(X^{l}_i), \mathbf{e}^{l}_i(\mathbf{q}^{p_1},\dots,\mathbf{q}^{p_n}) \big) &\text{ if uncollapsed (forward sampling)}. \end{cases} \end{equation} Following the collapsed sampling \citep{koller2009pgmbook} terminology, we call this method the partially collapsed feed-forward (PCFF). PCFF is a generalization over feed-forward and forward sampling, which can be seen as its fully collapsed / uncollapsed extremes. Furthermore, it offers a bias--variance trade-off, and can be combined with the reparametrization trick to achieve unbiased estimates with full sampling, while simultaneously maintaining the gradient flow. \subsection{PCFF: experimental validation} \label{subsec:pcffexp} In the previous sections, we have been discussing existing approaches whose empirical evaluations have been thoroughly covered by prior work. The novel PCFF approach proposed in this section, however, requires experiments to check its practical effectiveness. For this we conduct here a series of experiments\footnote{Implementation available at: \url{https://github.com/tum-vision/nnascg}}. Our emphasis is to understand the behavior of PCFF under various contexts and not to achieve best result for any specific task. We only use chain graph interpretable components, and we adopt the reparameterization trick \citep{kingma2014vae} for ReLU PCFF samples. The following experiments show that PCFF is overall an effective stochastic regularization method. Compared to dropout, it tends to produce more consistent performance improvement, and can sometimes outperform dropout. This confirms that our chain graph based reasoning has successfully found an interesting novel deep learning method. \begin{figure}[ht] \centering \includegraphics[width=0.47\linewidth]{mnist_} \hspace{0.04\linewidth} \includegraphics[width=0.36\linewidth]{cifar} \caption{Comparison of stochastic methods (None/Dropout/PCFF) in terms of image classification test errors (lower is better) under various settings. Left: MNIST/FashionMNIST datasets with a simple dense network and tanh/ReLU activation functions; Right: CIFAR-10 dataset with ResNet20 and varying drop/sample rates. All reported results are average values of three runs. Compared to dropout, PCFF can achieve comparable results, and tend to deliver more consistent improvements. } \label{fig:pcffexp} \end{figure} \paragraph{Simple dense network} We start with a simple network with two dense hidden layers of 1024 nodes to classify MNIST \citep{lucun1998mnist} and FashionMNIST \citep{xiao2017fashionmnist} images. We use PyTorch \citep{paszke2017pytorch}, train with stochastic gradient descent (learning rate $0.01$, momentum $0.9$), and set up 20\% of training data as validation set for performance monitoring and early-stopping. We set drop rate to 0.5 for dropout, and for PCFF we set the sample rate to 0.4 for tanh and 1.0 (full sampling) for ReLU. Figure~\ref{fig:pcffexp}~Left reports the test errors with different activation functions and stochastic regularizations. We see that dropout and PCFF are overall comparable, and both improve the results in most cases. Also, the ReLU activation consistently produces better results that tanh. Additional experiments show that PCFF and dropout can be used together, which sometimes yields improved performance. \paragraph{Convolutional residual network} To figure out the applicability of PCFF in convolutional residual networks, we experiment on CIFAR-10 \citep{krizhevsky09cifar} image classification. For this we adapt an existing implementation \citep{Idelbayev18a} to use the preactivation variant. We focus on the ResNet20 structure, and follow the original learning rate schedule except for setting up a validation set of 10\% training data to monitor training performance. Figure~\ref{fig:pcffexp}~Right summarizes the test errors under different drop/sample rates. We observe that in this case PCFF can improve the performance over a wide range of sample rates, whereas dropout is only effective with drop rate $0.1$, and large drop rates in this case significantly deteriorate the performance. We also observe a clear trade-off of the PCFF sample rate, where a partial sampling of 0.3 yields the best result. \paragraph{Independently RNN} We complete our empirical evaluations of PCFF with an RNN test case. For this we used IndRNNs with 6 layers to solve the sequential/permuted MNIST classification problems based on an existing Implementation\footnote{\url{https://github.com/Sunnydreamrain/IndRNN_pytorch}} provided by the authors of IndRNN \citep{li2018indrnn,li2019indrnn}. We tested over dropout with drop rate 0.1 and PCFF with sample rate 0.1 and report the average test accuracy of three runs. We notice that, while in the permuted MNIST case both dropout (0.9203) and PCFF (0.9145) improves the result (0.9045), in the sequential MNIST case, dropout (0.9830) seems to worsen the performance (0.9841) whereas PCFF (0.9842) delivers comparable result. \section{Conclusions and discussions} In this work, we show that neural networks can be interpreted as layered chain graphs, and that feed-forward can be viewed as an approximate inference procedure for these models. This chain graph interpretation provides a unified theoretical framework that elucidates the underlying mechanism of real-world neural networks and provides coherent and in-depth theoretical support for a wide range of empirically established network designs. Furthermore, it also offers a solid foundation to derive new deep learning approaches, with the additional help from the rich existing work on PGMs. It is thus a promising alternative neural network interpretation that deepens our theoretical understanding and unveils a new perspective for future deep learning research. In the future, we plan to investigate a number of open questions that stem from this work, especially: \begin{itemize} \item Is the current chain graph interpretation sufficient to capture the full essence of neural networks? Based on the current results, we are reasonably optimistic that the proposed interpretation can cover an essential part of the neural network mechanism. However, compared to the function approximator view, it only covers a subset of existing techniques. Is this subset good enough? \item On a related note: can we find chain graph interpretations for other important network designs (or otherwise some chain graph interpretable alternatives with comparable or better performance)? The current work provides a good start, but it is by no means an exhaustive study. \item Finally, what other new deep learning models and procedures can we build up based on the chain graph framework? The partially collapsed feed-forward inference proposed in this work is just a simple illustrative example, and we believe that many other promising deep learning techniques can be derived from the proposed chain graph interpretation. \end{itemize}
\section{Introduction}\label{sec:intro} Research on multigrid~(MG)~methods~\cite{Alcouffe81, Dendy82, Dendy83} has been very active in recent years. The MG methods are efficient, scalable, and often computationally optimal for solving sparse linear systems of equations arising from discretizations of partial differential equations~(PDEs). Therefore, they have been widely used in practical applications~\cite{Hackbusch85, Xu92, Bramble93, Briggs00, Trottenberg01, Xu02, Vassilevski08}, especially the algebraic multigrid~(AMG)~methods~\cite{Brandt82, Ruge83, Ruge84, Brandt85, Ruge87, Xu17,LinCowenHescottHu2018a}. However, the performance and efficiency of MG methods with standard V- or W-cycle may degenerate when the physical and geometric properties of the PDEs become more and more complicated. For symmetric positive definite~(SPD)~problems, more involved cycles have been proposed. Axelsson and Vassilevski introduced the algebraic multilevel iteration (AMLI)-cycle MG method~\cite{Axelsson89, Axelsson90, Vassilevski92}, which uses Chebyshev polynomial to define the coarse-level solver. However, the AMLI-cycle MG method requires an accurate estimation of extreme eigenvalues on coarse levels to compute the coefficients of the Chebyshev polynomial, which may be difficult in practice. The K-cycle MG method~\cite{Axelsson94, Kraus02}, which is a nonlinear version of the AMLI-cycle and does not need to estimate the extreme eigenvalues, was developed thanks to the introduction of the nonlinear preconditioning method~\cite{Axelsson91, Golub99, Saad03}. In the K-cycle MG method, $k$ steps of the nonlinear preconditioned conjugate gradient~(NPCG)~method, with the MG on a coarser level as a preconditioner, are applied to define the coarse-level solver. Under the assumption that the convergence factor of the V-cycle MG with a bounded-level difference is bounded, the uniform convergence property of the K-cycle MG is shown in~\cite{Kraus02} if~$k$~is chosen to be sufficiently large. In~\cite{Hu13}, a comparative analysis was presented to show that the K-cycle method is always better~(or no worse) than the corresponding~$k$-fold V-cycle~($k$V-cycle)~method. Although the K-cycle method does not need to estimate extreme eigenvalues, its nonlinear nature requires the usage of the NPCG method, which increases the computational and memory cost due to the loss of the three-term recurrence relationship of the standard conjugate gradient~(CG)~method. In this work, we propose momentum accelerated MG cycles that have potential to overcome the drawbacks of the AMLI- and K-cycle MG methods. The idea is to rewrite the linear systems on coarse levels as optimization problems and apply the momentum acceleration techniques for optimizations. Two types of accelerations are considered, one is the heavy ball~(HB)~method~\cite{Polyak64} and the other one is the Nesterov acceleration~(NA)~\cite{Nesterov83, Nesterov04, Nesterov18}. We use these momentum accelerations to define the coarse-level solvers and the resulting MG cycles are referred to as H-cycle~(using the HB method)~and N-cycle~(using the NA method), respectively. We show that the HB and NA methods, when applied to quadratic optimization problems, can be related to special polynomials approximation. For example, the polynomial associated with the HB method coincides with the best polynomial approximation to~$1/x$~proposed in~\cite{Kraus10, Kraus12}. Thus, H- and N-cycle are essentially special cases of AMLI-cycle. Following standard analysis of the AMLI-cycle, we show that both cycles converge uniformly assuming the extreme eigenvalues are available. The theoretical results are verified numerically when accurate estimations of the extreme eigenvalues are provided. From our preliminary numerical tests, the H- and N-cycle methods show their efficiency in practice when the extreme eigenvalues~(or accurate estimations)~are not available. By simply choosing~$\lambda_{\max}=1$~and~$\lambda_{\min}=0$, the N-cycle MG method shows its superior performance in practice and, surprisingly, is even better than the two-grid method for some cases. N-cycle shares advantages of both AMLI- and K-cycle. Namely, similar to K-cycle, N-cycle does not require the estimation of the extreme eigenvalues while its computational cost is the same as the AMLI-cycle since it is still a linear method. Additionally, since the N-cycle is derived from the optimization point of view, it has the potential to be generalized to other types of problems rather than the SPD problems. The rest of this paper is organized as follows. In~\cref{sec:pre}~we introduce the~$k$V-cycle MG algorithm and the HB and NA methods. In~\cref{sec:Methods for Preconditioned Linear Problem}, we present the HB method and NA method for the preconditioned linear system and their relationships with polynomial approximations to~$1/x$. Then, the momentum accelerated MG methods and their uniform convergence results are discussed in~\cref{sec:Momentum Accelerated Multigrid Cycles}. In~\cref{sec:num}, we present some numerical experiments that illustrate the efficiency of momentum accelerated MG methods, especially N-cycle. Finally, some conclusions are drawn in~\cref{sec:conc}. \section{Preliminaries}\label{sec:pre} In this section, since our proposed momentum accelerated multigrid methods combine multigrid cycles with momentum accelerations, we first recall the basic multigrid method for solving linear systems, including the~$k$V-cycle and AMLI-cycle methods. Then we will review two classical momentum accelerated gradient descent methods, i.e., the HB and NA methods, for solving general unconstrained convex optimization problems. \subsection{Multigrid} \label{sec:MG} We consider solving the following linear system \begin{equation} \label{eqn:linear-system} A \mathbf{x} = \mathbf{b} \end{equation} where~$A \in \mathbb{R}^{n \times n}$ is SPD. Assume we have constructed a hierarchical structure of the matrices~$A_\ell \in \mathbb{R}^{n_\ell \times n_\ell}$, $\ell = 1, 2, \cdots,J$, with~$A_1 = A$, the prolongations~$P_{\ell} \in \mathbb{R}^{n_\ell \times n_{\ell+1}}$, $\ell = 1, 2, \cdots,J-1$, and the restrictions~$R_{\ell} = P_{\ell}^T \in \mathbb{R}^{n_{\ell+1} \times n_{\ell}}$, $\ell = 1, 2, \cdots,J-1$. Here, we assume that~$A_{\ell+1} = R_{\ell}A_{\ell}P_{\ell}$, $\ell = 1, 2, \cdots,J-1$. Furthermore, let~$M_{\ell}$~denote the smoother on level~$\ell$, such as Jacobi or Gauss-Seidel method. Now we define the~$k$V-cycle $B_{\ell}$~on level~$\ell$~(more precisely, the action of~$B_\ell \mathbf{b}$)~recursively as shown in~\cref{alg:kVcycle}. Note that, when~$k=1$~or~$k=2$, $k$V-cycle MG becomes the classical V-cycle and W-cycle MG, respectively. \begin{algorithm}[h!] \caption{$k$V-cycle MG: $B_\ell \mathbf{b}$} \label{alg:kVcycle} \begin{algorithmic}[1] \IF{$\ell == J$} \STATE $\mathbf{x}_{\ell} = A_{\ell}^{-1} \mathbf{b}$ \ELSE \STATE $\textbf{Presmoothing}$: $\mathbf{x}_{\ell} \leftarrow M_{\ell}\mathbf{b}$ \STATE $\textbf{Restriction}$: $\mathbf{r}_{\ell+1} = R_{\ell}(\mathbf{b} - A_{\ell} \mathbf{x}_{\ell})$ \STATE $\textbf{Coarse-grid\ correction}$: set~$\mathbf{e}_{\ell+1} = \mathbf{0}$~and repeat~$\mathbf{e}_{\ell+1} \leftarrow \mathbf{e}_{\ell+1} + B_{\ell+1} (\mathbf{r}_{\ell+1} - A_{\ell+1} \mathbf{e}_{\ell+1}) $ $k$ times \STATE $\textbf{Prolongation}$: $\mathbf{x}_{\ell} \leftarrow \mathbf{x}_{\ell} + P_{\ell} \mathbf{e}_{\ell+1}$ \STATE $\textbf{Postsmoothing}$: $\mathbf{x}_{\ell} \leftarrow \mathbf{x}_{\ell} + M_{\ell}^{T} (\mathbf{b} - A_\ell\mathbf{x}_{\ell})$ \ENDIF \STATE $B_\ell \mathbf{b} \gets \mathbf{x}_{\ell}$ \end{algorithmic} \end{algorithm} Next, we recall AMLI-cycle. Several polynomials have been proposed to define the coarse-grid correction, which leads to different AMLI-cycle methods. Here we consider the classical choice, the Chebyshev polynomial. Therefore, we first recall the Chebyshev polynomial~$C_{k}(t)$, $ k=0,1,...$, \begin{equation} \label{eqn:Chebyshev polynomial} C_{k}(t)=2tC_{k-1}(t)-C_{k-2}(t),\ k=2,3,...,\ C_{0}(t)=1,\ C_{1}(t)=t. \end{equation} Denote the condition number of a matrix~$A$~by~$\kappa(A)$, \cref{alg:Chebyshev with B}~gives the classical Chebyshev semi-iterative method~\cite{golubChebyshevSemiiterativeMethods}. \begin{algorithm}[h] \caption{Chebyshev semi-iterative method for preconditioned linear system:~$\widehat{B}^C $} \label{alg:Chebyshev with B} \begin{algorithmic}[1] \STATE $\mathbf{x}^{0}$~is the given initial guess and~$\mathbf{x}^{1} \gets \mathbf{x}^{0} + B(\mathbf{b} - A \mathbf{x}^{0})$ \FOR{$k = 1,2,...$} \STATE $\mathbf{x}^{k+1} \gets \frac{2C_{k}(\frac{1}{\rho})}{\rho C_{k+1}(\frac{1}{\rho})}[\mathbf{x}^{k} - B(A\mathbf{x}^{k}-\mathbf{b})-\mathbf{x}^{k-1}]+\mathbf{x}^{k-1}$, where~$\rho = 1-\frac{1}{\kappa(BA)}$~and B is the preconditioner \ENDFOR \end{algorithmic} \end{algorithm} In AMLI-cycle, instead of just repeating coarse-grid correction~$k$~times in~\cref{alg:kVcycle}, \cref{alg:Chebyshev with B}~is used to define the coarse-level solver. \cref{alg:AMLIcycle}~summarizes the AMLI-cycle method. \begin{algorithm}[H] \caption{AMLI-cycle MG:~$B_\ell \mathbf{b}$} \label{alg:AMLIcycle} \begin{algorithmic}[1] \IF{$\ell == J$} \STATE $\mathbf{x_\ell} = A_{\ell}^{-1} \mathbf{b}$ \ELSE \STATE $\textbf{Presmoothing}$: $\mathbf{x}_{\ell} \leftarrow M_{\ell}\mathbf{b}$ \STATE $\textbf{Coarse-grid\ correction}$: $\mathbf{x}_{\ell} \leftarrow \mathbf{x}_{\ell} + P_{\ell} \widehat{B}^C_{\ell+1} R_{\ell}(\mathbf{b} - A_\ell\mathbf{x}_{\ell})$, where~$\widehat{B}^C_{\ell+1}$~is implemented as in~\cref{alg:Chebyshev with B}~with~$B_{\ell+1}$~as the preconditioner for $k$ steps \STATE $\textbf{Postsmoothing}$: $\mathbf{x}_{\ell} \leftarrow \mathbf{x}_{\ell} + M_{\ell}^{T} (\mathbf{b} - A_\ell\mathbf{x}_{\ell})$ \ENDIF \STATE $B_{\ell} \mathbf{b} \gets \mathbf{x}_{\ell}$ \end{algorithmic} \end{algorithm} To implement~\cref{alg:AMLIcycle}~in practice, since~\cref{alg:Chebyshev with B}~uses a parameter~$\rho$, we need to compute~$\rho = 1 - \frac{1}{\kappa(B_{\ell}A_{\ell})}$~on each level. This means that we need to estimate the smallest eigenvalue~$\lambda_{\min}(B_{\ell}A_{\ell})$~and the largest eigenvalue~$\lambda_{\max}(B_{\ell}A_{\ell})$~since~$\kappa(B_{\ell}A_{\ell}) = \frac{\lambda_{\max}(B_{\ell}A_{\ell})}{\lambda_{\min}(B_{\ell}A_{\ell})}$. The overall performance of AMLI-cycle~\cref{alg:AMLIcycle}~depends on the estimation of those extreme eigenvalues. In SPD case, a good estimation for the largest eigenvalue is~$\lambda_{\max}(B_{\ell}A_{\ell}) = 1$, However, a good estimation of the smallest eigenvalue~$\lambda_{\min}(B_{\ell}A_{\ell})$~is not a straightforward task. This fact motivates the development of nonlinear AMLI-cycle, i.e., the K-cycle MG method. However, the nonlinear feature makes K-cycle less efficient than AMLI-cycle in practice in terms of computation and storage. Therefore, in this work, we aim to develop linear MG cycles that can take advantages of both AMLI- and K-cycles. \subsection{Momentum Acceleration Methods}\label{sec:Momentum Acceleration Methods} In this section, we introduce the momentum acceleration techniques which are essential for our proposed momentum accelerated MG cycles. We consider the heavy ball and the Nesterov acceleration methods. Both of them are the first-order momentum acceleration methods for solving the following unconstrained optimization problem, \begin{equation} \label{eqn:opt problem} \min_{\mathbf{x} \in \mathbb{R}^{n}}\mathbf{f}(\mathbf{x}), \end{equation} where~$\mathbf{f}:\mathbb{R}^{n}\rightarrow \mathbb{R}$~is a continuously differentiable strongly convex function satisfies \begin{equation}\label{property of f} \frac{\mu}{2}\|\mathbf{x} - \mathbf{y}\|^{2} \leq \mathbf{f}(\mathbf{x}) - \mathbf{f}(\mathbf{y}) - ( \nabla \mathbf{f}(\mathbf{y}), \mathbf{x} - \mathbf{y}) \leq \frac{L}{2}\|\mathbf{x} - \mathbf{y}\|^{2},\ \forall\ \mathbf{x},\mathbf{y}\in \mathbb{R}^{n}, \end{equation} with~$L >0 $~being the Lipschitz constant and~$\mu > 0$~being the convexity constant. Here~$(\cdot,\cdot)$ denotes a generic inner product of~$\mathbb{R}^n$~and~$\| \cdot \|$~denotes the corresponding induced norm. The optimization problem~\cref{eqn:opt problem}~is usually solved by the gradient descent~(GD)~method. Under proper assumptions, GD converges linearly with convergence rate~$\frac{L-\mu}{L+\mu}$~\cite{Nesterov18}. Many algorithms have been developed to accelerate the convergence rate and the HB method is a classical GD method by adding momentum at each iteration~\cite{Polyak64}, \begin{algorithm}[H] \caption{Heavy ball method} \label{alg:HB} \begin{algorithmic}[1] \STATE $\mathbf{x}^{0}, \mathbf{x}^{1}$~are given as initial iterates, $\alpha$~and~$\beta$~are given parameters \FOR{$k =1,2,...$,} \STATE $\mathbf{x}^{k+1} \gets \mathbf{x}^{k} - \alpha \nabla \mathbf{f}(\mathbf{x}^{k}) + \beta(\mathbf{x}^{k} - \mathbf{x}^{k-1} )$ \ENDFOR \end{algorithmic} \end{algorithm} Let us denote the minimizer of the optimization problem~\cref{eqn:opt problem}~by~$\mathbf{x}^*$, then the next theorem shows that the HB method indeed speeds up the convergence under proper assumptions. \begin{theorem}[\cite{Polyak64}]\label{thm:convergence theorem of HB} If~$\mathbf{f}(\mathbf{x})$ satisfies~\cref{property of f}, let~$\alpha = \frac{4}{(\sqrt{L}+\sqrt{\mu})^{2}}$, $\beta = (\frac{\sqrt{L}-\sqrt{\mu}}{\sqrt{L}+\sqrt{\mu}})^{2}$~in~\cref{alg:HB}, then the following convergence rate estimate holds, \begin{equation*} \|\mathbf{x}^{k}-\mathbf{x}^{\ast}\|\leq \frac{\sqrt{L}-\sqrt{\mu}}{2\sqrt{\mu}}\bigg(\frac{\sqrt{L}-\sqrt{\mu}}{\sqrt{L}+\sqrt{\mu}}\bigg)^{k-1}\|\mathbf{x}^{0}-\mathbf{x}^{\ast}\|. \end{equation*} \end{theorem} Asymptotically, the convergence rate for the HB method is~$\frac{\sqrt{L}-\sqrt{\mu}}{\sqrt{L}+\sqrt{\mu}}$~which improves the convergence rate of the GD method since~$\frac{\sqrt{L}-\sqrt{\mu}}{\sqrt{L}+\sqrt{\mu}} \leq \frac{L-\mu}{L+\mu}$~in general. Another momentum acceleration technique is the so-called Nesterov acceleration~\cite{Nesterov83}. The NA method uses a different momentum and is effective and robust for a wide range of problems~\cite{Nesterov83, Neubauer16}. Following~\cite{Nesterov83}, the NA method for solving~\cref{eqn:opt problem}~is presented in~\cref{alg:NA}. \begin{algorithm}[h] \caption{Nesterov acceleration method} \label{alg:NA} \begin{algorithmic}[1] \STATE $\mathbf{x}^{0}, \mathbf{y}^{0}$~are given as initial iterates and~$\beta$~is a given parameter \FOR{$k =1,2,...$} \STATE $\mathbf{y}^{k} \gets \mathbf{x}^{k-1} - \frac{1}{L}\nabla \mathbf{f}(\mathbf{x}^{k-1})$ \STATE $\mathbf{x}^{k} \gets \mathbf{y}^{k} + \beta(\mathbf{y}^{k} - \mathbf{y}^{k-1} )$ \ENDFOR \end{algorithmic} \end{algorithm} We recall the convergence results of the NA method~\cref{alg:NA}~in the following theorem. \begin{theorem}[\cite{Nesterov18}]\label{thm:convergence theorem of NA} If~$\mathbf{f}(\mathbf{x})$~satisfies~\cref{property of f}, let~$\beta = \frac{\sqrt{L}-\sqrt{\mu}}{\sqrt{L}+\sqrt{\mu}}$, ~\cref{alg:NA}~generates a sequence of points~$\{\mathbf{x}^{k}\}_{k=0}^{\infty}$~such that \begin{equation*} \mathbf{f}(\mathbf{x}^{k})-\mathbf{f}^*\leq \left(1-\sqrt{\frac{\mu}{L}}\right)^{k}\bigg[\mathbf{f}(\mathbf{x}^{0})-\mathbf{f}^*+\frac{\mu}{2}\|\mathbf{x}^{0}-\mathbf{x}^{\ast}\|^{2}\bigg], \end{equation*} where~$\mathbf{f}^*=\mathbf{f}(\mathbf{x}^*)$. \end{theorem} Asymptotically, the NA method's convergence rate is~$1-\sqrt{\frac{\mu}{L}}$~which also improves the convergence rate of the GD method. Here, we only present the NA method for the strongly convex functions which is enough for our purpose since we are considering solving SPD linear systems. In fact, as discussed in~\cite{Nesterov83}, the NA method can be applied to convex functions~(i.e., $\mu=0$) or even nonconvex cases~\cite{Nesterov98, Ghadimi16}. This makes the NA method more attractive in practice. \section{Momentum Acceleration Methods for Preconditioned Linear Systems}\label{sec:Methods for Preconditioned Linear Problem} Since we consider solving linear systems~\cref{eqn:linear-system}~with MG preconditioners, in this section, we present how to apply heavy ball and Nesterov acceleration to preconditioned linear systems, and this will be used to define the coarse-grid correction in our proposed cycles later. To make the application of the HB and NA methods straightforward, we rewrite solving the linear system~\cref{eqn:linear-system}~with an SPD preconditioner~$B$~as solving the following quadratic optimization problem, \begin{equation}\label{eqn:opt problem with B} \min_{\mathbf{x} \in \mathbb{R}^{n}}\frac{1}{2}(A \mathbf{x},\mathbf{x})_{B} - (\mathbf{b},\mathbf{x})_{B}, \end{equation} where~$(\mathbf{x},\mathbf{x})_B := (B \mathbf{x}, \mathbf{x})$. Now we can derive the HB and NA methods for solving~\cref{eqn:opt problem with B}~and discuss their convergence behaviors, respectively. Moreover, similar to the semi-iterative method~\cref{alg:Chebyshev with B}, which uses Chebyshev polynomials~\cref{eqn:Chebyshev polynomial}, we show that the HB and NA methods applied to~\cref{eqn:opt problem with B}~can be considered as semi-iterative methods based on different polynomials. Roughly speaking, the HB method is related to the polynomial of best uniform approximation to $1/x$~\cite{Kraus12}~and the NA method is also related to a polynomial that converges to~$1/x$. \subsection{Heavy Ball Method for Preconditioned Linear Systems}\label{sec:HB Method for Linear Problem} We first consider the HB method, applying~$k$~steps of the HB method~(\cref{alg:HB})~to~\cref{eqn:opt problem with B}~leads to~\cref{alg:HBwithB}, which is the HB method for solving preconditioned linear systems. \begin{algorithm}[H] \caption{Heavy ball method for preconditioned linear systems:~$\widehat{B}^{H}$} \label{alg:HBwithB} \begin{algorithmic}[1] \STATE $\mathbf{x}^{0}, \mathbf{x}^{1}$~are given as initial iterates, $\alpha$~and~$\beta$~are given parameters \FOR{$i =2,...,k$ } \STATE $\mathbf{x}^{i} \gets \mathbf{x}^{i-1} + \alpha B(\mathbf{b} - A\mathbf{x}^{i-1}) + \beta(\mathbf{x}^{i-1} - \mathbf{x}^{i-2} )$ \ENDFOR \end{algorithmic} \end{algorithm} \cref{alg:HBwithB}~is essentially a linear iterative method that uses two previous iterates. Therefore, it is a semi-iterative method. Moreover, since it is linear, after~$k$~iterations, we associate it with a linear operator~$\widehat{B}^H$~(a matrix in our case since we consider~$\mathbb{R}^n$). The convergence of the HB method for the preconditioned linear systems follows directly from the general convergence analysis of the HB method presented in~\cref{thm:convergence theorem of HB}. Note that in this case, we have~$L = \lambda_{\operatorname{max}}(BA)$~and~$\mu = \lambda_{\operatorname{min}}(BA)$~and~ the result is presented in the following theorem. \begin{theorem}\label{thm:convergence theorem of HB with B} Let~$\alpha = \frac{4}{\left(\sqrt{\lambda_{\operatorname{max}}(BA)}+\sqrt{\lambda_{\operatorname{min}}(BA)}\right)^{2}}$, $\beta = \left(\frac{\sqrt{\lambda_{\operatorname{max}}(BA)}-\sqrt{\lambda_{\operatorname{min}}(BA)}}{\sqrt{\lambda_{\operatorname{max}}(BA)}+\sqrt{\lambda_{\operatorname{min}}(BA)}}\right)^{2}$ in~\cref{alg:HBwithB}, then the following convergence estimate holds, \begin{equation*} \|\mathbf{x}^{k}-\mathbf{x}^{\ast}\|\leq \frac{\kappa(BA)-1}{2}\bigg(\frac{\sqrt{\kappa(BA)}-1}{\sqrt{\kappa(BA)}+1}\bigg)^{k-1}\|\mathbf{x}^{0}-\mathbf{x}^{\ast}\|. \end{equation*} \end{theorem} \subsubsection{Relationship with the Polynomial Approximation of $ 1/x $}\label{sec:Relationship of 1/xHB} To better understand~\cref{alg:HBwithB}~as a semi-iterative method, we aim to find the underlying polynomial associated with it. To this end, we need to look at how the error propagates and, from~\cref{alg:HBwithB}, the error~$\mathbf{e}^k := \mathbf{x}^* - \mathbf{x}^k$~satisfies the following three-term recurrence relationship, \begin{equation*} \mathbf{e}^{k+1} = (I - \alpha BA)\mathbf{e}^{k} + \beta(\mathbf{e}^{k} - \mathbf{e}^{k-1}). \end{equation*} This implies that~$\mathbf{e}^k = p_k(BA)\mathbf{e}^0$~where~$p_k(x)$~is a polynomial of degree at most~$k$~and satisfies~$p_k(0) = 1$, \begin{equation}\label{eqn:recurrence relation of pk HB} p_{k+1}(x) = (1 - \alpha x)p_{k}(x) + \beta(p_{k}(x)-p_{k-1}(x)). \end{equation} Rewrite~$p_{k}(x) = 1 - x q_{k-1}(x)$, where~$q_{k-1}(x)$~is a polynomial of degree at most~$k-1$. Substituting it into~\cref{eqn:recurrence relation of pk HB}, we have the following three-term recurrence relationship of~$q_k(x)$, \begin{equation}\label{eqn:3-term-qHB} q_{k+1}(x)=q_{k}(x)+\alpha[1 - x q_{k}(x)]+\beta[q_{k}(x)- q_{k-1}(x)]. \end{equation} Actually, if $$ q_{0}(x)=\frac{1}{2\lambda_{\max}(BA)}+\frac{1}{2\lambda_{\min}(BA)}, $$ and $$ q_{1}(x)=\frac{1}{\sqrt{\lambda_{\max}(BA)\lambda_{\min}(BA)}}+\frac{1}{2\lambda_{\max}(BA)} +\frac{1}{2\lambda_{\min}(BA)} -\frac{x}{\lambda_{\max}(BA)\lambda_{\min}(BA)}, $$ then~$q_{k}(x)$ is the polynomial of best approximation of~$1/x$ respect to~$\|\cdot\|_{\infty}$ norm when~$\alpha = \frac{4}{(\sqrt{\lambda_{\max}(BA)}+\sqrt{\lambda_{\max}(BA)})^{2}}$ and~$\beta= ( \frac{ \sqrt{\lambda_{\max}(BA)}-\sqrt{\lambda_{\min}(BA)} }{ \sqrt{\lambda_{\max}(BA)}+\sqrt{\lambda_{\min}(BA)}} )^{2}$, see~\cite{Kraus12}~for details. By relating the HB method with the polynomial of the best uniform approximation to~$1/x$, we give a different perspective to understand the acceleration mechanism of the HB method. In the next section, we will show that the NA method is also related to polynomial approximation to~$1/x$, which emphasizes the strong connection between the momentum acceleration and polynomial approximation to~$1/x$. \subsection{Nesterov Acceleration Method for Preconditioned Linear Systems Now we consider Nesterov acceleration. Applying~$k$~steps of the NA method~\cref{alg:NA}~to~\cref{eqn:opt problem with B}, and eliminating~$\mathbf{y}^k$~lead to~\cref{alg:NAwithB}. \begin{algorithm}[H] \caption{NA method for preconditioned linear systems:~$\widehat{B}^{N}$} \label{alg:NAwithB} \begin{algorithmic}[1] \STATE $\mathbf{x}^{0}, \mathbf{x}^{1}$~are given as initial iterates and~$\beta$~is a given parameter \FOR{$i = 2,...,k$} \STATE $\mathbf{x}^{i} \gets (1+\beta)[\mathbf{x}^{i-1} + \frac{1}{L} B(\mathbf{b} - A\mathbf{x}^{i-1})]- \beta[\mathbf{x}^{i-2} - \frac{1}{L} B(\mathbf{b}- A\mathbf{x}^{i-2})]$ \ENDFOR \end{algorithmic} \end{algorithm} \cref{alg:NAwithB}~shows that the NA method for solving preconditioned linear systems also is a linear iterative method that uses the previous two steps. It takes a weighted average of the previous two updates. Essentially, \cref{alg:NAwithB}~is another semi-iterative method, and, due to its linearity, we associate it with a linear operator~(or a matrix)~$\widehat{B}^N$. Similarly, based on~\cref{thm:convergence theorem of NA}, the convergence of the NA method for the preconditioned linear systems follows directly. Note that~$L = \lambda_{\operatorname{max}}(BA)$~and~$\mu = \lambda_{\operatorname{min}}(BA)$, the convergence result is presented in~\cref{thm:convergence theorem of NA with B}. \begin{theorem}\label{thm:convergence theorem of NA with B} Choose~$\beta = \frac{\sqrt{\lambda_{\operatorname{max}}(BA)}-\sqrt{\lambda_{\operatorname{min}}(BA)}}{\sqrt{\lambda_{\operatorname{max}}(BA)}+\sqrt{\lambda_{\operatorname{min}}(BA)}}$~in~\cref{alg:NAwithB}, then the following convergence rate estimate holds, \begin{equation*} \|\mathbf{x}^{k}-\mathbf{x}^{\ast}\|_{A}^{2}\leq 2\bigg(1-\frac{1}{\sqrt{\kappa(BA)}}\bigg)^{k}\|\mathbf{x}^{0}-\mathbf{x}^{\ast}\|_{A}^{2}. \end{equation*} \end{theorem} \subsubsection{Relationship with the Polynomial Approximation of $ 1/x $}\label{sec:Relationship of 1/x NA} Next we show that the NA method is also related to the polynomial approximation of~$1/x$~when it is applied to the preconditioned linear systems. To this end, denote the error at the~$k$-th step of the NA method as~$\mathbf{e}^k := \mathbf{x}^* - \mathbf{x}^k$~and, from~\cref{alg:NAwithB}, it satisfies the following three-term recurrence relationship, \begin{equation*} \mathbf{e}^{k+1} = (1+\beta)(I - \frac{1}{L} BA)\mathbf{e}^{k} - \beta(I - \frac{1}{L} BA)\mathbf{e}^{k-1}. \end{equation*} This implies that~$\mathbf{e}^k = p_k(BA)\mathbf{e}^0$~where~$p_k(x)$~is a polynomial of degree at most~$k$~and satisfies~$p_k(0)=1$, \begin{equation}\label{eqn:recurrence relation of pk nesterov} p_{k+1}(x) = (1+\beta)(1 - \frac{x}{L} )p_{k}(x) - \beta(1 - \frac{x}{L})p_{k-1}(x). \end{equation} Rewrite~$p_{k}(x) = 1 - x q_{k-1}(x)$, where~$q_{k-1}(x)$~is a polynomial of degree at most~$k-1$. Substituting it into~\eqref{eqn:recurrence relation of pk nesterov}, we have the following three-term recurrence relationship of~$q_k(x)$, \begin{equation}\label{eqn:3-term-q} q_{k+1}(x)=q_{k}(x)+\frac{1}{L}[1 - x q_{k}(x)]+\beta(1 - \frac{x}{L})[q_{k}(x)- q_{k-1}(x)]. \end{equation} From~\cref{eqn:3-term-q}, we have~$q_k(x) \rightarrow 1/x $~as~$k \rightarrow \infty$. Comparing with the polynomial of best uniform approximation to~$1/x$~given in~\cite{Kraus12}~(or the polynomial related to the HB method as discussed in~\cref{sec:HB Method for Linear Problem}, the polynomial associated with the NA method is different although it also converges to~$1/x$~as we increase the polynomial degree~$k$. In~\cite{Liu18}, this polynomial was explicitly derived. \subsection{Discussion on Polynomials Associated with Different Methods}~\label{sec:poly-discuss} To better understand the behavior of the polynomial associated with the NA method and its comparison with Chebyshev polynomial used to define the standard AMLI-cycle~\cref{alg:AMLIcycle}~(i.e., the scaled version of~\eqref{eqn:Chebyshev polynomial})~the polynomial~\eqref{eqn:recurrence relation of pk HB}~associated with the HB method, we plot them in~\cref{Fig:pk_L1_mu01}-~\cref{Fig:pk_L1_mu0}~together for different polynomial degree~$k$~and different choice of~$\lambda_{\min}$~while keeping~$\lambda_{\max}=1$. Here, to better illustrate how the error converges to~$0$, we choose to look at the polynomial~$p_k(x)$, which converges to~$0$~for all cases instead of~$q_k(x)$, which converges to~$1/x$. We emphasis that they are related by~$p_k(x) = 1 - x q_{k-1}(x)$. \begin{figure}[H] \centering \subfigure[$k=2$]{ \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=2.4in]{pk_L1_mu01_k2.eps} \end{minipage \subfigure[$k=3$]{ \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=2.4in]{pk_L1_mu01_k3.eps} \end{minipage \quad \subfigure[$k=4$]{ \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=2.4in]{pk_L1_mu01_k4.eps} \end{minipage} \subfigure[$k=5$]{ \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=2.4in]{pk_L1_mu01_k5.eps} \end{minipage} \quad \subfigure[$k=6$]{ \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=2.4in]{pk_L1_mu01_k6.eps} \end{minipage} \subfigure[$k=7$]{ \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=2.4in]{pk_L1_mu01_k7.eps} \end{minipage} \centering \caption{The polynomials~$p_{k}(x)$~with~$\lambda_{\max}=1, \lambda_{\min}=0.1$~and different~$k$.} \label{Fig:pk_L1_mu01} \end{figure} \cref{Fig:pk_L1_mu01}~shows the case that~$\lambda_{\min} = 0.1$~and all the polynomials converge to~$0$~as we increase the degree~$k$. We can also see that on the interval of interest, $[0.1,1]$, all three polynomials give comparable results. The polynomial associated with the HB method usually gives the best results near~$0.1$~and the polynomial associated with the NA method usually gives the best results near~$1$, while the Chebyshev polynomial gives the best results overall due to its well-known min-max property. This suggests us, in this case, we can use the polynomials associated with the HB and NA methods to define the AMLI-cycle method, and the resulting MG method should have comparable performance with the standard AMLI-cycle method using the Chebyshev polynomial. \begin{figure}[H] \centering \subfigure[$k=2$]{ \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=2.4in]{pk_L1_mu0_k2.eps} \end{minipage \subfigure[$k=3$]{ \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=2.4in]{pk_L1_mu0_k3.eps} \end{minipage \quad \subfigure[$k=4$]{ \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=2.4in]{pk_L1_mu0_k4.eps} \end{minipage} \subfigure[$k=5$]{ \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=2.4in]{pk_L1_mu0_k5.eps} \end{minipage} \quad \subfigure[$k=6$]{ \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=2.4in]{pk_L1_mu0_k6.eps} \end{minipage} \subfigure[$k=7$]{ \begin{minipage}[t]{0.48\linewidth} \centering \includegraphics[width=2.4in]{pk_L1_mu0_k7.eps} \end{minipage} \centering \caption{ The polynomials~$p_{k}(x)$ with~$\lambda_{\max}=1, \lambda_{\min}=0$ and different $k$.} \label{Fig:pk_L1_mu0} \end{figure} However, in practice, estimating~$\lambda_{\min}$~might be difficult and expensive. Thus, let us look at the simple choice~$\lambda_{\min} = 0$. In this case, the polynomial associated with the HB method is not well-defined since neither~$q_0(x)$~nor~$q_1(x)$~is well-defined. Therefore, we only plot the other two polynomials in~\cref{Fig:pk_L1_mu0}. As we can see, the polynomial associated with the NA methods could provide a better approximation than the Chebyshev methods especially when the polynomial degree~$k$~increases. This observation suggests that, in practice, if we replace the Chebyshev polynomial with the polynomial associated with the NA method in AMLI-cycle~\cref{alg:AMLIcycle}, the resulting MG method would be more robust and efficient when we simply choose~$\lambda_{\min} = 0$. This is verified by our numerical results presented in~\cref{sec:num}. \section{ Momentum Accelerated Multigrid Cycles}\label{sec:Momentum Accelerated Multigrid Cycles} In this section, we present the momentum accelerated MG cycles. The basic idea is to use~$k$~steps of the HB method~(\cref{alg:HBwithB})~or the NA method~(\cref{alg:NAwithB})~to define the coarse-gird corrections. Since both momentum acceleration methods are semi-iterative methods based on certain polynomials, the resulting MG cycles are essentially special cases of AMLI-cycle. However, to distinguish them from the AMLI-cycle based on Chebyshev polynomials, i.e.,~\cref{alg:AMLIcycle}, we call them heavy ball MG cycle~(H-cycle) and Nesterov acceleration MG cycle~(N-cycle), respectively. Besides presenting the momentum accelerated MG cycles, we also study their convergence rates by combining the standard analysis of AMLI-cycle and the convergence results in~\cref{thm:convergence theorem of HB with B}~and~\cref{thm:convergence theorem of NA with B}, respectively. \subsection{H-cycle MG Method}\label{sec:Hcycle} In this subsection, we present the H-cycle method, which uses~$k$~steps of the heavy ball method~(\cref{alg:HBwithB})~to define the coarse-grid correction. Based on the notation introduced in~\cref{sec:MG}, \cref{alg:kVcycle}, and~\cref{alg:HBwithB}, we present the H-cycle MG method in~\cref{alg:Hcycle}. \begin{algorithm}[H] \caption{H-cycle MG: $B^H_\ell \mathbf{b}$} \label{alg:Hcycle} \begin{algorithmic}[1] \IF{$\ell == J$} \STATE $\mathbf{x}_{\ell} = A_{\ell}^{-1} \mathbf{b}$ \ELSE \STATE $\textbf{Presmoothing}$: $\mathbf{x}_{\ell} \leftarrow M_{\ell}\mathbf{b}$ \STATE $\textbf{Coarse-grid\ correction}$: $\mathbf{x}_{\ell} \leftarrow \mathbf{x}_{\ell} + P_{\ell} \widehat{B}^{H}_{\ell+1} R_{\ell}(\mathbf{b} - A_\ell\mathbf{x}_{\ell})$, where~$\widehat{B}^{H}_{\ell+1}$~is implemented as in~\cref{alg:HBwithB}~with~$B^H_{\ell+1}$~as the preconditioner for~$k$~steps \STATE $\textbf{Postsmoothing}$: $\mathbf{x}_{\ell} \leftarrow \mathbf{x}_{\ell} + M_{\ell}^{T} (\mathbf{b} - A_\ell\mathbf{x}_{\ell})$ \ENDIF \STATE $B^H_{\ell} \mathbf{b} \gets \mathbf{x}_{\ell}$ \end{algorithmic} \end{algorithm} As mentioned before, H-cycle is essentially an AMLI-cycle MG method. Moreover, since the polynomial~\cref{eqn:3-term-qHB}~associated with the HB method is the polynomial of best uniform approximation to~$1/x$, therefore our H-cycle is equivalent to the AMLI-cycle method proposed in~\cite{Kraus10}~and the estimate of the condition number has been analyzed in~\cite{Kraus10}~as well. Here, to give a more intuitively expression, following standard analysis for the AMLI-cycle method presented in~\cite{Vassilevski08}~and utilizing the convergence theory of the HB method~(\cref{thm:convergence theorem of HB with B}), we will show that H-cycle MG method presented in~\cref{alg:Hcycle}~provides a uniform preconditioner under the assumption that the condition number of the two-grid method~$\kappa_{TG}$~is uniformly bounded. We summarize the results in~\cref{thm:Uniform Convergence theorem of Hcycle}~and comment that the general case can be analyzed similarly when the conditioned number of the V-cycle MG method with a bounded-level difference is uniformly bounded. \begin{theorem}\label{thm:Uniform Convergence theorem of Hcycle} Let~$B^H_{\ell}$~be defined by~\cref{alg:Hcycle}~and~$\widehat{B}^{H}_{\ell}$~be implemented as in~\cref{alg:HBwithB}~with~$B^H_{\ell}$~as the preconditioner with~$\alpha = \frac{4}{\left(\sqrt{\lambda_{\operatorname{max}}(B^H_{\ell}A_{\ell})}+\sqrt{\lambda_{\operatorname{min}}(B^H_{\ell}A_{\ell})}\right)^{2}}$ and $\beta= \left( \frac{ \sqrt{\lambda_{\operatorname{max}}(B^H_{\ell}A_{\ell})}-\sqrt{\lambda_{\operatorname{min}}(B^H_{\ell}A_{\ell})} }{ \sqrt{\lambda_{\operatorname{max}}(B^H_{\ell}A_{\ell})}+\sqrt{\lambda_{\operatorname{min}}(B^H_{\ell}A_{\ell})}} \right)^{2}$. Assume that the two-grid method has uniformly bounded condition number~$\kappa_{TG}$, then the condition number of~$B^H_{\ell}A_{\ell}$~can be uniformly bounded. More specifically, we can choose~$\delta \in [0,1)$~and~$k\in \mathbb{N}$, satisfying \begin{equation}\label{eqn:inequality of k and deltaHB} 2(1-\delta)(1+\sqrt{1-\delta})^{k-1}-\delta(1-\sqrt{1-\delta})^{k-1}>0, \end{equation} such that \begin{equation}\label{eqn:inequality of deltaHB} (1-\delta)\kappa_{TG}+\kappa_{TG}\frac{\delta(1-\delta)(1-\sqrt{1-\delta})^{k-1}} {2(1-\delta)(1+\sqrt{1-\delta})^{k-1}-\delta(1-\sqrt{1-\delta})^{k-1}}\leq1. \end{equation} Then we have the following uniform estimate for the H-cycle preconditioner~$B^H_{\ell}$~defined by~\cref{alg:Hcycle}, \begin{equation}\label{eqn:uniform estimate for preconditionerHB} \mathbf{x}^{T}A_{\ell}\mathbf{x}\leq \mathbf{x}^{T}(B^H_{\ell})^{-1}\mathbf{x}\leq \frac{1}{1-\delta} \mathbf{x}^{T}A_{\ell}\mathbf{x} \end{equation} \end{theorem} \begin{proof} First of all, it is clear that, as~$\delta \rightarrow 1 $, the left-hand side of~\cref{eqn:inequality of deltaHB} tends to~$0$ , which implies that there exists a~$\delta$~satisfies~\cref{eqn:inequality of deltaHB}. In order to proof the inequality~\cref{eqn:uniform estimate for preconditionerHB}, assume by induction that $1-\delta\leq\frac{1}{1+\delta_{\ell+1}}$, where the eigenvalue of~$B^H_{\ell+1}A_{\ell+1}$ are in the interval~$[\frac{1}{1+\delta_{\ell+1}},1]$ for some~$\delta_{\ell+1}\geq0$. Then we want to show that the eigenvalues of $B^H_{\ell}A_{\ell}$ are contained in an interval~$[\frac{1}{1+\delta_{\ell}},1]$ for some~$\delta_{\ell}\geq0$. Since we use~$k$ steps of~\cref{alg:HBwithB} with~$B^H_{\ell}$ as a preconditioner to define~$\widehat{B}^H_{\ell}$~in~\cref{alg:Hcycle}, we have that \begin{equation*} \lambda(\widehat{B}^H_{\ell+1}A_{\ell+1}) \in \left[\frac{1}{1+\widetilde{\delta}_{\ell+1}},1\right] \end{equation*} where \begin{equation*} \widetilde{\delta}_{\ell+1} = \sup\left\{ \frac{1}{1-p_{k}(x)}-1, x \in \left[\frac{1}{1+\delta_{\ell+1}},1 \right]\right\}\leq \sup\left\{\frac{p_{k}(x)}{1-p_{k}(x)}, x \in [1-\delta,1]\right\}, \end{equation*} and~$p_{k}$ is the polynomial defined by~\cref{eqn:recurrence relation of pk HB}. According to~\cref{thm:convergence theorem of HB with B}, we have \begin{align*} p_{k}(x)&\leq \frac{\kappa(B_{\ell+1}^{H}A_{\ell+1})-1}{2}\left( \frac{\sqrt{\kappa(B_{\ell+1}^{H}A_{\ell+1})}-1}{\sqrt{\kappa(B_{\ell+1}^{H}A_{\ell+1})}+1}\right)^{k-1}\\ &\leq \frac{\delta}{2(1-\delta)}\left( \frac{1-\sqrt{1-\delta}}{1+\sqrt{1-\delta}}\right)^{k-1}, \quad \forall\ x \in [1-\delta,1],\\ \end{align*} then we have`$0 \leq p <1$ for all~$x\in[1-\delta,1]$ due to the choice of~$k$. Because~$\frac{t}{(1 - t)}$ is an increasing function of~$t \in [0, 1)$, we have \begin{align*} \widetilde{\delta}_{\ell+1} &\leq \displaystyle{ \frac{ \sup \left\{p_{k}(x),x \in [1-\delta,1]\right\} }{ 1 - \sup \{p_{k}(x),x \in [1-\delta,1]\} }} \\ &= \displaystyle{\frac{\delta(1-\sqrt{1-\delta})^{k-1}} {2(1-\delta)(1+\sqrt{1-\delta})^{k-1}-\delta(1-\sqrt{1-\delta})^{k-1}}}. \end{align*} On the other hand, use Corollary 5.11 in~\cite{Vassilevski08}, we have $1+\delta_{\ell}\leq(1+\widetilde{\delta}_{\ell+1})\kappa_{TG}$. Therefore, in order to confirm the induction assumption, we need to choose $\delta$ such that $1+\delta_{\ell}\leq(1+\widetilde{\delta}_{\ell+1})\kappa_{TG}\leq\frac{1}{1-\delta}$, which is \begin{equation*} \begin{array}{l} \displaystyle{\kappa_{TG}\left[1+ \frac{\delta(1-\sqrt{1-\delta})^{k-1}} {2(1-\delta)(1+\sqrt{1-\delta})^{k-1}-\delta(1-\sqrt{1-\delta})^{k-1}}\right]\leq\frac{1}{1-\delta}}. \end{array} \end{equation*} This inequality is equivalent to~\cref{eqn:inequality of deltaHB}. On the other hand, under the assumption of~\cref{eqn:inequality of k and deltaHB}, it is obviously that \begin{equation*} \begin{array}{l} \displaystyle{\kappa_{TG}\left[1+ \frac{\delta(1-\sqrt{1-\delta})^{k-1}} {2(1-\delta)(1+\sqrt{1-\delta})^{k-1}-\delta(1-\sqrt{1-\delta})^{k-1}}\right]\geq1}. \end{array} \end{equation*} Thus, this completes the proof of~\cref{eqn:uniform estimate for preconditionerHB}. \end{proof} \begin{remark} \cref{thm:Uniform Convergence theorem of Hcycle} shows that H-cycle provides a uniform preconditioner under the assumption that the condition number of the two-grid method~$\kappa_{TG}$ is bounded. When~$k=2$, we have~$\delta \in [0,2\sqrt{2}-2)$ from~\cref{eqn:inequality of k and deltaHB}. Note that the convergence factor $\delta_{TG}=1- 1/\kappa_{TG}$, inequality~\cref{eqn:inequality of deltaHB} reduces to \begin{equation*} (1-\delta)+\frac{\delta(1-\delta)(1-\sqrt{1-\delta})} {2(1-\delta)(1+\sqrt{1-\delta})-\delta(1-\sqrt{1-\delta})}=\frac{1}{\kappa_{TG}}=1-\delta_{TG}. \end{equation*} This implies that~$\delta_{TG} \in (0,0.5464)$, which means that, if the two-grid method at any level~$\ell$~(with exact solution at coarse level $\ell+1$ has a uniformly bounded convergence factor~$\delta_{TG} < 0.5464$, then the corresponding H-cycle has a uniformly bounded convergence factor $\delta$. Obviously, it is better than W-cycle ($2$-fold V-cycle), because, for W-cycle to be uniformly convergent, the convergence factor of the two-grid method should be bounded to be~$\delta_{TG} <0.5$ (See Corollary 5.30 in~\cite{Vassilevski08}). \end{remark} \subsection{N-cycle MG Method}\label{sec:Ncycle algorithm} Similarly, our proposed the N-cycle MG method uses $k$ steps of the NA method~\cref{alg:NAwithB} to define the coarse-level solvers. Based on the notation introduced in~\cref{sec:MG}, \cref{alg:kVcycle}, and~\cref{alg:NAwithB}, \cref{alg:Ncycle} presents the N-cycle algorithm recursively. \begin{algorithm}[H] \caption{N-cycle MG: $B^N_\ell \mathbf{b}$} \label{alg:Ncycle} \begin{algorithmic}[1] \IF{$\ell == J$} \STATE $\mathbf{x}_{\ell} = A_{\ell}^{-1} \mathbf{b}$ \ELSE \STATE $\textbf{Presmoothing}$: $\mathbf{x}_{\ell} \leftarrow M_{\ell}\mathbf{b}$ \STATE $\textbf{Coarse-grid\ correction}$: $\mathbf{x} \leftarrow \mathbf{x}_{\ell} + P_{\ell} \widehat{B}^{N}_{\ell+1} R_{\ell}(\mathbf{b} - A_\ell\mathbf{x}_{\ell})$, where~$\widehat{B}^{N}_{\ell+1}$ is implemented as in Algorithm~\ref{alg:NAwithB} with~$B^N_{\ell+1}$ as the preconditioner for~$k$ steps \STATE $\textbf{Postsmoothing}$: $\mathbf{x}_{\ell} \leftarrow \mathbf{x}_{\ell} + M_{\ell}^{T} (\mathbf{b} - A_\ell\mathbf{x}_{\ell})$ \ENDIF \STATE $B^N_{\ell} \mathbf{b} \gets \mathbf{x}_{\ell}$ \end{algorithmic} \end{algorithm} The N-cycle MG method can be viewed as an AMLI-cycle method using the polynomial defined in~\cref{eqn:3-term-q}. Following standard analysis of the AMLI-cycle method presented in~\cite{Vassilevski08} and utilizing the convergence theory of the NA method~(\cref{thm:convergence theorem of NA with B}), we can show that N-cycle MG method presented in~\cref{alg:Ncycle} provides a uniform preconditioner under the assumption that the condition number of the two-grid method~$\kappa_{TG}$ is uniformly bounded. We summarize the results in~\cref{thm:Uniform Convergence theorem of Ncycle} and comment that the general case ban analyzed similarly when the conditioned number of the V-cycle MG method with a bounded-level difference is uniformly bounded. \begin{theorem}\label{thm:Uniform Convergence theorem of Ncycle} Let~$B^N_{\ell}$ be defined by~\cref{alg:Ncycle} and~$\widehat{B}^{N}_{\ell}$ be implemented as in~\cref{alg:NAwithB} wit~ $B^N_{\ell}$ as the preconditioner with~$\beta = \frac{\sqrt{\lambda_{\operatorname{max}}(B^N_{\ell}A_{\ell})}-\sqrt{\lambda_{\operatorname{min}}(B^N_{\ell}A_{\ell})}} {\sqrt{\lambda_{\operatorname{max}}(B^N_{\ell}A_{\ell})}+\sqrt{\lambda_{\operatorname{min}}(B^N_{\ell}A_{\ell})}}$. Assume that the two-grid method has a uniformly bounded condition number $\kappa_{TG}$, then the condition number of~$B^N_{\ell}A_{\ell}$ can be uniformly bounded. More specifically, there exists~$\delta \in [0,1)$ and~$k\in \mathbb{N}$, satisfying~$2(1-\sqrt{1-\delta})^{k}<1$, such that \begin{equation}\label{eqn:inequality of delta} (1-\delta)\kappa_{TG}+\kappa_{TG}\frac{(1-\delta)\sqrt{2(1-\sqrt{1-\delta})^{k}}} {1-\sqrt{2(1-\sqrt{1-\delta})^{k}}}\leq1. \end{equation} And we have the following uniform estimate for the N-cycle method~$B^N_{\ell}$ defined by~\cref{alg:Ncycle}, \begin{equation}\label{eqn:uniform estimate for preconditioner} \mathbf{x}^{T}A_\ell\mathbf{x}\leq \mathbf{x}^{T}(B^N_{\ell})^{-1}\mathbf{x}\leq \frac{1}{1-\delta} \mathbf{x}^{T}A_\ell\mathbf{x}. \end{equation} \end{theorem} \begin{proof} The proof is essentially the same as the proof of~\cref{thm:Uniform Convergence theorem of Hcycle}. The only two differences are, the polynomial~$p_{k}(x)$ used here is the one defined by~\cref{eqn:recurrence relation of pk nesterov}, and the corresponding convergence property is that presented in~\cref{thm:convergence theorem of NA with B}. More precisely, since we use~$k$ steps of~\cref{alg:NAwithB} with~$B^N_{\ell}$ as a preconditioner to define~$\widehat{B}^N_{\ell}$ in ~\cref{alg:Ncycle}, we have that the eigenvalues of~$\widehat{B}^N_{\ell+1}A_{\ell+1}$ are contained in the interval $[\frac{1}{1+\widetilde{\delta}_{\ell+1}},1]$, where \begin{equation*} \begin{array}{l} \widetilde{\delta}_{\ell+1} = \displaystyle{\sup\left\{ \frac{1}{1-p_{k}(x)}-1, x \in [\frac{1}{1+\delta_{\ell+1}},1]\right\}}\leq \displaystyle{\sup\left\{\frac{p_{k}(x)}{1-p_{k}(x)}, x \in [1-\delta,1]\right\}},\\ \end{array} \end{equation*} and~$p_k(x)$ is the polynomial defined by~\cref{eqn:recurrence relation of pk nesterov}. According to~\cref{thm:convergence theorem of NA with B}, we have \begin{equation*} p_{k}^2(x)\leq 2\left(1-\frac{1}{\sqrt{\kappa(B^N_{\ell+1}A_{\ell+1})}}\right)^{k}\leq 2\left(1-\sqrt{1-\delta}\right)^{k}, \ \forall\ x \in [1-\delta,1], \end{equation*} then~$p_{k}^2(x)<1 $ for all~$x \in [1-\delta,1]$ due to the choice of~$k$. Because~$\frac{t}{(1 - t)}$ is an increasing function of~$t \in (-1, 1)$, we have \begin{equation*} \begin{array}{l} \widetilde{\delta}_{\ell+1} \leq \displaystyle{ \frac{ \sup \left\{p_{k}(x),x \in [1-\delta,1]\right\} }{ 1 - \sup \{p_{k}(x),x \in [1-\delta,1]\} } } =\displaystyle{ \frac{\sqrt{2\left(1-\sqrt{1-\delta}\right)^{k}}}{1-\sqrt{2\left(1-\sqrt{1-\delta}\right)^{k}} } }. \end{array} \end{equation*} On the other hand, use Corollary 5.11 in~\cite{Vassilevski08}, we have~$ 1+\delta_{\ell}\leq(1+\widetilde{\delta}_{\ell+1})\kappa_{TG}$. Therefore, in order to confirm the induction assumption, we need to choose~$\delta$ such that $ 1+\delta_{\ell}\leq(1+\widetilde{\delta}_{\ell+1})\kappa_{TG}\leq\frac{1}{1-\delta}$, which is \begin{equation*} \begin{array}{l} \displaystyle{ \kappa_{TG}\left[ 1+\frac{\sqrt{2\left(1-\sqrt{1-\delta}\right)^{k}}}{1-\sqrt{2\left(1-\sqrt{1-\delta}\right)^{k}} }\right]\leq\frac{1}{1-\delta}}. \end{array} \end{equation*} This inequality is equivalent to~\cref{eqn:inequality of delta}. On the other hand, under the assumption that~$2(1-\sqrt{1-\delta})^{k}<1$, it is obviously that \begin{equation*} \begin{array}{l} (1+\widetilde{\delta}_{\ell+1})\kappa_{TG}=\displaystyle{ \kappa_{TG}\left[ 1+\frac{\sqrt{2\left(1-\sqrt{1-\delta}\right)^{k}}}{1-\sqrt{2\left(1-\sqrt{1-\delta}\right)^{k}} }\right]} \geq 1. \end{array} \end{equation*} Thus, this completes the proof of~\cref{eqn:uniform estimate for preconditioner}. \end{proof} Next, we provide several remarks to better interpret the theoretical results of~\cref{thm:Uniform Convergence theorem of Ncycle}, comparison with standard AMLI-cycle, and limitations in predicting the performance of the N-cycle method in practice. \begin{remark} When~$k=2$, we have~$\delta \in [0,\sqrt{2}-1/2)$ due to $2(1-\sqrt{1-\delta})^{2}<1$. Note that the convergence factor of the two-grid method satisfies~$\delta_{TG}=1- 1/\kappa_{TG}$, inequality~\cref{eqn:inequality of delta} reduces to \begin{equation*} (1-\delta)+\frac{\sqrt{2}(1-\delta)(1-\sqrt{1-\delta})} {1-\sqrt{2}(1-\sqrt{1-\delta})}=\frac{1}{\kappa_{TG}}=1-\delta_{TG}. \end{equation*} This implies that~$\delta_{TG} \in (0,0.7071)$, which means that, if the two-grid method at any level~$\ell$~(with exact solution at coarse level~$\ell+1$) has a uniformly bounded convergence factor~$\delta_{TG} < 0.7071$, then the corresponding N-cycle has a uniformly bounded convergence factor~$\delta$. It is better than W-cycle~($2$-fold V-cycle) because, for W-cycle to be uniformly convergent, the convergence factor of the two-grid method should be bounded to be~$\delta_{TG} <0.5$~(See Corollary 5.30 in~\cite{Vassilevski08}). \end{remark} \begin{remark} If we want AMLI-cycle using Chebyshev polynomial~\cref{eqn:Chebyshev polynomial} (i.e.,~\cref{alg:AMLIcycle}) to be uniformly convergent, the convergence factor of the two-grid method should be~$\delta_{TG} <0.75$, which is slightly better than N-cycle theoretically due to the min-max property of the Chebyshev polynomials. However, it is a theoretical result based on the assumption that the extreme eigenvalues of the MG preconditioned coarse-level problems are available, which could be quite expensive or even impossible in practice. As we will see from our numerical experiments in~\cref{sec:num}, we can simply use the estimations~$\lambda_{\operatorname{max}} = 1$ and~$\lambda_{\operatorname{min}} = 0$, i.e., $\beta = 1$, to define the N-cycle method in practice and still obtain a good performance. Moreover, the N-cycle MG method could outperform the AMLI-cycle in practice with such a simple choice of the parameter~$\beta =1$. \end{remark} \section{Numerical Results}\label{sec:num} In this section, we present some numerical experiments to illustrate the efficiency of the N-cycle MG method. In our numerical experiments, we discretize all the examples using the linear finite-element method on uniform triangulations of the domain~$\Omega$ with mesh size~$h$. Namely, the matrix~$A$ in~\eqref{eqn:linear-system} is the stiffness matrix of the finite-element discretizations. The true solution of the linear system is~$\mathbf{x} = [1,2,...,N]^T \mathbf{R}^N$, $N = 1/h$, and the right hand side~$\mathbf{b}$ is computed accordingly for all the examples. We use the unsmoothed aggregation AMG~(UA-AMG) method~\cite{Kim03} in all the experiments since it is well-known that, the V-cycle UA-AMG method does not converge uniformly in general and more involved cycles are needed. For all the MG cycles, we use Gauss-Seidel (GS) smoother ($1$ step forward GS for pre-smoothing and~$1$ step backward GS for post-smoothing). In our implementations of~\cref{alg:HBwithB}~(used in H-cycle~\cref{alg:Hcycle}) and~\cref{alg:NAwithB}~(used in N-cycle~\cref{alg:Ncycle}), we choose~$\mathbf{x}^{0} = 0$ and~$\mathbf{x}^1= \frac{(B\mathbf{b},B \mathbf{b})}{(B \mathbf{b},B \mathbf{b})_{A}}B \mathbf{b}$~(i.e., one step of steepest descent method for solving~\eqref{eqn:opt problem with B} with~$\mathbf{x}^0 = 0$). We always use~$\lambda_{\max} =1$~(which is a good estimation for SPD problems in general) and choose different~$\lambda_{\min}$ to test the performance. In all the numerical experiments, all the MG methods are used as stand-alone iterative solvers. We use zero initial guess and the stopping criteria is that the relative residual is less than or equal to~$10^{-12}$. Besides the number of iterations to convergence, the average convergence factor of the last five iterations is reported to illustrate the performance of the MG methods. \begin{example}\label{exp:poisson} Consider the model problem on~$\Omega = [0, 1] \times [0, 1]$. \begin{equation*} \begin{array}{rcl} - \Delta \mathbf{u} &=& \mathbf{f}, \ \ \ \text{in} \ \ \Omega,\\ \mathbf{u} &=& 0, \ \ \ \text{on} \ \ \partial \Omega. \end{array} \end{equation*} \end{example} \begin{table}[H] \begin{center} \caption{Convergence factors (and number of iterations to convergence) for different MG cycles on~\cref{exp:poisson}. (``-'' means the method diverges)} \label{tab:1twogrid and cycles} \renewcommand{\arraystretch}{1.02} \begin{tabular}{ccccc} \hline \hline & $h=1/64$ & $h=1/128$ & $h=1/256$ & $h=1/512$ \\ \hline &\multicolumn{4}{c}{Two-grid} \\ \cline{2-5} & 0.502005 (34) & 0.503784 (34) & 0.505978 (35) & 0.505159 (35) \\ \hline &\multicolumn{4}{c}{ $k$V-cycle } \\ \cline{2-5} $k=1$ & 0.804198 (109) & 0.841594 (129) & 0.856977 (135) & 0.862513 (133) \\ $k=2$ & 0.703505 (67) & 0.744310 (77) & 0.763329 (79) & 0.763709 (77) \\ $k=3$ & 0.639391 (63) & 0.677776 (58) & 0.692216 (59) & 0.690056 (58) \\ \hline &\multicolumn{4}{c}{K-cycle } \\ \cline{2-5} $k=2$ & 0.514746 (38) & 0.521637 (38) & 0.525396 (39) & 0.526877 (39) \\ $k=3$ & 0.513212 (36) & 0.517616 (36) & 0.518201 (36) & 0.518781 (36) \\ \hline &\multicolumn{4}{c}{AMLI-cycle (estimate $\lambda_{\min}$)} \\ \cline{2-5} $k=2$ & 0.369682 (19) & 0.417879 (21) & 0.406392 (20) & 0.421880 (20)\\ $k=3$ & 0.404490 (21) & 0.420391 (22) & 0.439241 (21) & 0.396547 (24)\\ \hline &\multicolumn{4}{c}{AMLI-cycle ($\lambda_{\min}=0$)} \\ \cline{2-5} $k=2$ & 0.369628 (19) & 0.417948 (21) & 0.406392 (20) & 0.421880 (20) \\ $k=3$ & 0.305806 (21) & 0.318781 (22) & 0.310708 (21) & 0.323530 (22)\\ \hline &\multicolumn{4}{c}{H-cycle (estimate $\lambda_{\min}$) } \\ \cline{2-5} $k=2$ & 0.531629 (38) & 0.545223 (39) & 0.550238 (38) & 0.541994 (37) \\ $k=3$ & 0.498365 (34) & 0.501108 (34) & 0.497384 (34) & 0.494567 (33)\\ \hline &\multicolumn{4}{c}{H-cycle ($\lambda_{\min} = 0.1$ )} \\ \cline{2-5} $k=2$ & 0.495479 (34) & 0.519374 (35) & 0.528661 (36) & 0.526969 (35)\\ $k=3$ & 0.477346 (31) & 0.491798 (32) & 0.490162 (33) & 0.492058 (32)\\ \hline &\multicolumn{4}{c}{H-cycle ($\lambda_{\min} = 0$) } \\ \cline{2-5} $k=2$ & 0.260674 (16) & 0.314143 (17) & 0.214169 (16) & 0.192636 (16)\\ $k=3$ & - & - & - & - \\ \hline &\multicolumn{4}{c}{N-cycle (estimate $\lambda_{\min}$) } \\ \cline{2-5} $k=2$ & 0.484492 (35) & 0.489757 (36) & 0.490731 (36) & 0.491870 (35) \\ $k=3$ & 0.482751 (34) & 0.481927 (34) & 0.476483 (34) & 0.476189 (33)\\ \hline &\multicolumn{4}{c}{N-cycle ($\lambda_{\min} = 0$) } \\ \cline{2-5} $k=2$ & 0.407385 (29) & 0.416979 (29) & 0.417469 (29) & 0.420126 (29)\\ $k=3$ & 0.391101 (25) & 0.390428 (25) & 0.394326 (26) & 0.388651 (25)\\ \hline \hline \end{tabular} \end{center} \end{table} In~\cref{tab:1twogrid and cycles}, we show the convergence factor and number of iterations of different MG cycles when the mesh size~$h = 1/64, 1/128, 1/256, 1/512$. As we can see, although the two-grid method achieves uniform convergence, the performance of the V-cycle~(i.e., $k$V-cycle with~$k=1$) degenerates as expected since we use the UA-AMG method. Because the convergence factor of Two-grid is slightly larger than~$0.5$, W-cycle (i.e., $k$V-cycle with~$k=2$) still does not converge uniformly as both the convergence factor and the number of iterations grow as~$h$ gets smaller. $k$V-cycle becomes uniformly convergent when~$k=3$. The K- and AMLI-cycle methods, which are designed for this case, all achieve uniform convergence when~$k = 2$. For the proposed H- and N-cycle, when we estimate~$\lambda_{\min}$ on each level to compute the parameters used in the HB and NA method, we obtain uniform convergence. This confirms the theoretical results~\cref{thm:Uniform Convergence theorem of Hcycle} and~\cref{thm:Uniform Convergence theorem of Ncycle}. As we mentioned, estimating~$\lambda_{\min}$ might be difficult and expensive in practice. Therefore, we investigate the performances of AMLI-, H-, and N-cycle when simply choose~$\lambda_{\min} = 0$. As shown in~\cref{tab:1twogrid and cycles}, while all three cycles converge nicely when~$k=2$, H-cycle diverges when~$k =3$. In fact, it diverges for~$k \geq 3$. This is because the HB method, which is used to define H-cycle, was developed for strongly convex functions, and the choice~$\lambda_{\min} = 0$ only implies convexity. Once we choose~$\lambda_{\min} = 0.1 > 0$, H-cycle converges uniformly again. On the other hand, for the simple choice~$\lambda_{\min} = 0$, the N-cycle method not only achieves uniform convergence but also outperforms the $k$V-cycle, K-cycle, and, surprisingly, even two-grid method, which demonstrates its efficiency in practice. From~\cref{tab:1twogrid and cycles}, we notice that AMLI-cycle~\cref{alg:AMLIcycle} with simple choice~$\lambda_{\min} = 0$ also performs quite well, even better than N-cycle, when~$k=2$ or~$3$. However, our investigation in~\cref{sec:poly-discuss} shows that it is not the case when we increase $k$, which is confirmed by the numerical results presented in~\cref{tab:1AMLI and Ncycle}. When~$k$ increases, AMLI-cycle's performance deteriorates due to the lack of accurate estimation of~$\lambda_{\min}$. In contrast, H-cycle with~$\lambda_{\min}=0.1$ and N-cycle with~$\lambda_{\min}=0$ converge uniformly when $k$ increases. In practice, considering the trade-off between the performance~(fast convergence and robustness with respect to parameters) and the efficiency~(low computational and storage cost), we would recommend using N-cycle with~$\lambda_{\min} = 0$ and~$k=2$ or~$3$. \begin{table}[H] \begin{center} \caption{Convergence factors~(and number of iterations to convergence) for the AMLI-, H- and N-cycle with fixed~$\lambda_{\min}$ on~\cref{exp:poisson} } \label{tab:1AMLI and Ncycle} \begin{tabular}{ccccc} \hline \hline & $h=1/64$ & $h=1/128$ & $h=1/256$ & $h=1/512$ \\ \hline &\multicolumn{4}{c}{AMLI-cycle method ($\lambda_{\min}=0$)} \\ \cline{2-5} $k=4$ & 0.743668 (88) & 0.925038 (329) & 0.980392 (999) & 0.995041 (999)\\ $k=5$ & 0.751663 (92) & 0.766853 (96) & 0.801483 (113) & 0.776317 (101) \\ $k=6$ & 0.852902 (144)& 0.855592 (142) & 0.869571 (158) & 0.881878 (155) \\ $k=7$ & 0.922309 (297)& 0.946864 (422) & 0.958507 (503) & 0.965900 (679) \\ \hline &\multicolumn{4}{c}{H-cycle method ($\lambda_{\min} = 0.1$) } \\ \cline{2-5} $k=4$ & 0.497761 (35) & 0.497349 (35) & 0.502591 (36) & 0.498534 (35) \\ $k=5$ & 0.495767 (34) & 0.494605 (34) & 0.500665 (35) & 0.497057 (34) \\ $k=6$ & 0.511109 (35) & 0.513025 (35) & 0.514338 (36) & 0.514755 (35) \\ $k=7$ & 0.524589 (37) & 0.507319 (35) & 0.509050 (35) & 0.508896 (35) \\ \hline &\multicolumn{4}{c}{N-cycle method ($\lambda_{\min} = 0$) } \\ \cline{2-5} $k=4$ & 0.395807 (26) & 0.417665 (27) & 0.406770 (27) & 0.404306 (26) \\ $k=5$ & 0.440458 (29) & 0.451704 (30) & 0.452052 (30) & 0.445281 (30) \\ $k=6$ & 0.482864 (33) & 0.489894 (33) & 0.496542 (34) & 0.492264 (34) \\ $k=7$ & 0.502005 (34) & 0.537300 (38) & 0.544519 (38) & 0.540128 (38) \\ \hline \hline \end{tabular} \end{center} \end{table} \begin{example}\label{exp:jump-poisson} The second model problem is a diffusion equation with jump coefficient on $\Omega = [0,1] \times [0,1]$, \begin{equation*} \begin{array}{rcl} - \nabla \cdot (a(\mathbf{x}) \nabla \mathbf{u}) &=& \mathbf{f}, \ \ \ \text{in} \ \ \Omega ,\\ \mathbf{u} &=& 0, \ \ \ \text{on} \ \ \partial \Omega, \end{array} \end{equation*} where $a(\mathbf{x}) = 1$ in $[0.25, 0.5] \times [0.25,0.5] \cup [0.5, 0.75] \times [0.5,0.75]$ and $a(\mathbf{x}) = 10^{-6}$ everywhere else. \end{example} \begin{table}[H] \begin{center} \caption{Convergence factors~(and number of iterations to convergence) for different MG cycles on~\cref{exp:jump-poisson}. (``-'' means the method diverges)} \label{tab:2twogrid and cycles} \begin{tabular}{ccccc} \hline \hline & $h=1/64$ & $h=1/128$ & $h=1/256$ & $h=1/512$ \\ \hline &\multicolumn{4}{c}{Two-grid method} \\ \cline{2-5} & 0.533777 (44) & 0.524908 (43) & 0.555066 (45) & 0.543575 (45) \\ \hline &\multicolumn{4}{c}{k-fold V-cycle method } \\ \cline{2-5} $k=1$ & 0.762328 (101) & 0.827267 (141) & 0.860452 (187) & 0.902543 (202)\\ $k=2$ & 0.673176 (69) & 0.723526 (87) & 0.782840 (110) & 0.802340 (115) \\ $k=3$ & 0.617277 (57) & 0.669389 (68) & 0.728067 (83) & 0.730747 (86) \\ \hline &\multicolumn{4}{c}{K-cycle method } \\ \cline{2-5} $k=2$ & 0.529076 (44) & 0.524365 (43) & 0.534955 (44) & 0.528044 (44) \\ $k=3$ & 0.534470 (44) & 0.529453 (43) & 0.533266 (44) & 0.530886 (44) \\ \hline &\multicolumn{4}{c}{AMLI-cycle method (estimate $\lambda_{\min}$)} \\ \cline{2-5} $k=2$ & 0.432465 (33) & 0.420315 (32) & 0.461580 (35) & 0.447631 (35) \\ $k=3$ & 0.451159 (34) & 0.430807 (33) & 0.470242 (37) & 0.463407 (36) \\ \hline &\multicolumn{4}{c}{AMLI-cycle method ($\lambda_{\min}=0$)} \\ \cline{2-5} $k=2$ & 0.432465 (33) & 0.420315 (32) & 0.461580 (35) & 0.447631 (35) \\ $k=3$ & 0.430666 (30) & 0.368431 (28) & 0.408762 (31) & 0.403546 (31) \\ \hline &\multicolumn{4}{c}{H-cycle method (estimate $\lambda_{\min}$) } \\ \cline{2-5} $k=2$ & 0.567908 (48) & 0.569448 (49) & 0.613660 (55) & 0.591049 (50) \\ $k=3$ & 0.528280 (43) & 0.515659 (42) & 0.530545 (44) & 0.527500 (43) \\ \hline &\multicolumn{4}{c}{H-cycle method ($\lambda_{\min} = 0.1$) } \\ \cline{2-5} $k=2$ & 0.525578 (43) & 0.535880 (45) & 0.598752 (52) & 0.595025 (51) \\ $k=3$ & 0.517179 (41) & 0.501953 (40) & 0.539879 (44) & 0.543111 (43) \\ \hline &\multicolumn{4}{c}{H-cycle method ($\lambda_{\min} = 0$) } \\ \cline{2-5} $k=2$ & 0.365756 (28) & 0.333696 (26) & 0.359729 (28) & 0.349733 (27)\\ $k=3$ & - & - & - & - \\ \hline &\multicolumn{4}{c}{N-cycle method (estimate $\lambda_{\min}$) } \\ \cline{2-5} $k=2$ & 0.518716 (42) & 0.507191 (41) & 0.513673 (42) & 0.497285 (40) \\ $k=3$ & 0.524168 (42) & 0.499282 (41) & 0.506174 (41) & 0.475311 (38) \\ \hline &\multicolumn{4}{c}{N-cycle method ($\lambda_{\min} = 0$) } \\ \cline{2-5} $k=2$ & 0.469765 (36) & 0.430731 (33) & 0.436282 (34) & 0.427501 (33)\\ $k=3$ & 0.485852 (36) & 0.421445 (32) & 0.449840 (33) & 0.413262 (31)\\ \hline \hline \end{tabular} \end{center} \end{table} We present the convergence factors and the number of iterations of different MG cycles for~\cref{exp:jump-poisson} in~\cref{tab:2twogrid and cycles}. We can see that the two-grid method converges uniformly, however, since we use the UA-AMG method and the problem has a large jump in the coefficient, the performance of the V-cycle (i.e., $k$V-cycle with $k=1$) degenerates as expected. In fact, the~$k$V-cycle still does not converge uniformly with respect to~$h$ when~$k=2$ or~$3$. The K- and AMLI-cycle methods achieve uniform convergence when~$k = 2$ and~$3$. For the H- and N-cycle, we obtain uniform convergence when we estimate~$\lambda_{\min}$ on each level to compute the parameters used in the HB and NA methods, and this again confirms the theoretical results~\cref{thm:Uniform Convergence theorem of Hcycle} and~\cref{thm:Uniform Convergence theorem of Ncycle}. Similar to~\cref{exp:poisson}, we also investigate the performances of AMLI-, H-, and N-cycle when simply choose~$\lambda_{\min} = 0$ for~\cref{exp:jump-poisson}. As shown in~\cref{tab:2twogrid and cycles}, all three cycles converge nicely when $k=2$, however H-cycle diverges when $k \geq 3$ as expected. If we choose $\lambda_{\min} = 0.1 > 0$, H-cycle converges uniformly again. On the other hand, the N-cycle method achieves uniform convergence and outperforms the~$k$V-cycle, K-cycle and even two-grid method when simply choose~$\lambda_{min} = 0$. We notice that the AMLI-cycle(~\cref{alg:AMLIcycle}) with~$\lambda_{\min} = 0$ also performs quite well, even better than N-cycle when~$k=3$. However, when~$k$ increases, see~\cref{tab:2AMLI and Ncycle}, AMLI-cycle's performance deteriorates due to the lack of accurate estimation of~$\lambda_{\min}$. In contrast, H-cycle with~$\lambda_{\min}=0.1$ and N-cycle with~$\lambda_{\min}=0$ converge uniformly when~$k$ increases. Therefore, due to the same reason, we would recommend to use N-cycle with~$\lambda_{\min} = 0$ and~$k=2$ or~$3$ in practice. \begin{table}[H] \begin{center} \caption{Convergence factors (and number of iterations to convergence) for the AMLI-, H- and N-cycle with fixed~$\lambda_{\min}$ on~\cref{exp:jump-poisson} } \label{tab:2AMLI and Ncycle} \begin{tabular}{ccccc} \hline \hline & $h=1/64$ & $h=1/128$ & $h=1/256$ & $h=1/512$ \\ \hline &\multicolumn{4}{c}{AMLI-cycle method ($\lambda_{\min}=0$)} \\ \cline{2-5} $k=4$ & 0.996892 (999) & 0.999999 (999) & 0.995185 (999) & 0.998921 (999)\\ $k=5$ & 0.535567 (44) & 0.834723 (130) & 0.818471 (88) & 0.855305 (110)\\ $k=6$ & 0.378095 (27) & 0.867270 (167) & 0.868751 (165) & 0.876993 (192)\\ $k=7$ & 0.536113 (44) & 0.916087 (246) & 0.948903 (349) & 0.987590 (500) \\ \hline &\multicolumn{4}{c}{H-cycle method ($\lambda_{\min} = 0.1$) } \\ \cline{2-5} $k=4$ & 0.484986 (38) & 0.518237 (42) & 0.521091 (43) & 0.533730 (44) \\ $k=5$ & 0.575869 (51) & 0.529464 (43) & 0.537867 (43) & 0.534727 (44)\\ $k=6$ & 0.506791 (41) & 0.533144 (44) & 0.536690 (45) & 0.549748 (45)\\ $k=7$ & 0.551618 (47) & 0.534299 (44) & 0.538227 (45) & 0.539220 (44) \\ \hline &\multicolumn{4}{c}{N-cycle method ($\lambda_{\min} = 0$)} \\ \cline{2-5} $k=4$ & 0.496458 (37) & 0.444554 (33) & 0.491654 (35) & 0.430365 (31) \\ $k=5$ & 0.512845 (39) & 0.477808 (36) & 0.510175 (37) & 0.463622 (34) \\ $k=6$ & 0.539741 (43) & 0.503168 (39) & 0.530205 (40) & 0.487052 (38) \\ $k=7$ & 0.565856 (49) & 0.548620 (43) & 0.554452 (44) & 0.553528 (46) \\ \hline \hline \end{tabular} \end{center} \end{table} \begin{example}\label{exp:aniso-poisson} The last example we consider here is the anisotropic diffusion problem, \begin{equation*} \begin{array}{rcl} - \partial _{\mathbf{x}\mathbf{x}}\mathbf{u}- 10^{-3} \partial _{\mathbf{y}\mathbf{y}}\mathbf{u} &=& \mathbf{f}, \ \ \ \text{in} \ \ \Omega,\\ \mathbf{u} &=& 0, \ \ \ \text{on} \ \ \partial \Omega. \end{array} \end{equation*} \end{example} In~\cref{tab:3twogrid and cycles}, we show the convergence factors and the corresponding number of iterations of different MG methods when~$h = 1/64, 1/128, 1/256, 1/512$. We can see that the two-grid method convergent uniformly, however, the performance of the V-cycle (i.e., $k$V-cycle with~$k=1$) degenerates as before. The~$k$V-, K- and AMLI-cycles all achieve uniform convergence when~$k = 2$ and $3$. For the H- and N-cycle, we obtain uniform convergence when we estimate~$\lambda_{\min}$ on each level to compute the parameters used in the HB and NA method which verifies~\cref{thm:Uniform Convergence theorem of Hcycle} and~\cref{thm:Uniform Convergence theorem of Ncycle}. From~\cref{tab:3twogrid and cycles}, the performances of AMLI-, H-, and N-cycle are similar as before when we simply choose~$\lambda_{\min}$. Again, for the simple choice~$\lambda_{min} = 0$, the N-cycle method not only achieves uniform convergence but also outperforms the~$k$V-cycle, K-cycle, and the two-grid methods. \begin{table}[H] \begin{center} \caption{Convergence factors (and number of iterations to convergence) for different MG cycles on~\cref{exp:aniso-poisson}. (``-'' means the method diverges) } \label{tab:3twogrid and cycles} \begin{tabular}{ccccc} \hline \hline & $h=1/64$ & $h=1/128$ & $h=1/256$ & $h=1/512$ \\ \hline &\multicolumn{4}{c}{Two-grid method} \\ \cline{2-5} & 0.517848 (39) & 0.484570 (33) & 0.520570 (39) & 0.439697 (33) \\ \hline &\multicolumn{4}{c}{kV-cycle method } \\ \cline{2-5} $k=1$ & 0.766498 (95) & 0.783893 (96) & 0.785853 (98) & 0.768224 (108) \\ $k=2$ & 0.665222 (62) & 0.679329 (60) & 0.675610 (62) & 0.650456 (67) \\ $k=3$ & 0.606226 (51) & 0.615689 (48) & 0.609319 (50) & 0.589726 (52) \\ \hline &\multicolumn{4}{c}{K-cycle method } \\ \cline{2-5} $k=2$ & 0.515318 (40) & 0.503099 (36) & 0.513573 (40) & 0.466510 (36) \\ $k=3$ & 0.518604 (39) & 0.493497 (34) & 0.515832 (40) & 0.455619 (34) \\ \hline &\multicolumn{4}{c}{AMLI-cycle method (estimate $\lambda_{\min}$) } \\ \cline{2-5} $k=2$ & 0.392120 (27) & 0.343612 (21) & 0.382445 (26) & 0.369934 (23) \\ $k=3$ & 0.425634 (30) & 0.404479 (24) & 0.415701 (30) & 0.394216 (26) \\ \hline &\multicolumn{4}{c}{AMLI-cycle method ($\lambda_{\min}= 0$) } \\ \cline{2-5} $k=2$ & 0.392120 (27) & 0.343612 (21) & 0.382445 (26) & 0.369934 (23)\\ $k=3$ & 0.367236 (26) & 0.295025 (20) & 0.363743 (26) & 0.300607 (21) \\ \hline &\multicolumn{4}{c}{H-cycle method (estimate $\lambda_{\min}$) } \\ \cline{2-5} $k=2$ & 0.545345 (42) & 0.536641 (37) & 0.538974 (41) & 0.500435 (41) \\ $k=3$ & 0.509014 (38) & 0.480544 (33) & 0.511492 (39) & 0.469347 (33) \\ \hline &\multicolumn{4}{c}{H-cycle method ($\lambda_{\min} = 0.1$) } \\ \cline{2-5} $k=2$ & 0.503061 (37) & 0.490633 (32) & 0.494788 (36) & 0.449807 (35) \\ $k=3$ & 0.486762 (35) & 0.452762 (30) & 0.495605 (37) & 0.434054 (30) \\ \hline &\multicolumn{4}{c}{H-cycle method ($\lambda_{\min} = 0$) } \\ \cline{2-5} $k=2$ & 0.36306 (26) & 0.290443 (20) & 0.336453 (25) & 0.401506 (26) \\ $k=3$ & - & - & - & - \\ \hline &\multicolumn{4}{c}{N-cycle method (estimate $\lambda_{min}$) } \\ \cline{2-5} $k=2$ & 0.514756 (40) & 0.509728 (36) & 0.517393 (41) & 0.495766 (37) \\ $k=3$ & 0.506457 (38) & 0.485206 (34) & 0.513759 (39) & 0.475344 (34) \\ \hline &\multicolumn{4}{c}{N-cycle method ($\lambda_{\min} = 0$) } \\ \cline{2-5} $k=2$ & 0.456491 (34) & 0.441552 (30) & 0.464606 (35) & 0.402454 (31) \\ $k=3$ & 0.435192 (31) & 0.384099 (25) & 0.451505 (33) & 0.366533 (25) \\ \hline \hline \end{tabular} \end{center} \end{table} Similarly, when~$k$ decreases, the performance of AMLI-cycle degenerates when we simply choose~$\lambda_{\min} = 0$, see~\cref{tab:3AMLI and Ncycle}. On the contrary, H-cycle with~$\lambda_{\min}=0.1$ and N-cycle with~$\lambda_{\min}=0$ converge uniformly when~$k$ increases, while N-cycle slightly outperforms H-cycle. \begin{table}[H] \begin{center} \caption{Convergence factors (and number of iterations to convergence) for the AMLI-, H- and N-cycle with fixed~$\lambda_{\min}$ on~\cref{exp:aniso-poisson}.} \label{tab:3AMLI and Ncycle} \begin{tabular}{ccccc} \hline \hline & $h=1/64$ & $h=1/128$ & $h=1/256$ & $h=1/512$ \\ \hline &\multicolumn{4}{c}{AMLI-cycle method ($\lambda_{\min}=0$)} \\ \cline{2-5} $k=4$ & 0.664373 (64) & 0.891205 (229) & 0.969667 (871) & 0.992628 (999) \\ $k=5$ & 0.725380 (84) & 0.751664 (95) & 0.765423 (103) & 0.743853 (99) \\ $k=6$ & 0.859835 (176) & 0.866940 (176) & 0.869709 (195) & 0.825102 (162) \\ $k=7$ & 0.909018 (244) & 0.940960 (386) & 0.921316 (359) & 0.887575 (341) \\ \hline &\multicolumn{4}{c}{H-cycle method ($\lambda_{\min} = 0.1$) } \\ \cline{2-5} $k=4$ & 0.530249 (40) & 0.488779 (34) & 0.530790 (41) & 0.444818 (32) \\ $k=5$ & 0.519710 (39) & 0.483458 (34) & 0.517017 (40) & 0.454664 (32) \\ $k=6$ & 0.525354 (39) & 0.497343 (34) & 0.522199 (40) & 0.473724 (33) \\ $k=7$ & 0.517816 (39) & 0.486335 (33) & 0.520537 (39) & 0.448281 (33) \\ \hline &\multicolumn{4}{c}{N-cycle method ($\lambda_{\min} = 0$) } \\ \cline{2-5} $k=4$ & 0.445674 (32) & 0.385037 (26) & 0.468399 (35) & 0.346655 (24) \\ $k=5$ & 0.479938 (35) & 0.429770 (29) & 0.498202 (37) & 0.397372 (28) \\ $k=6$ & 0.517073 (38) & 0.476330 (33) & 0.516010 (40) & 0.441860 (32) \\ $k=7$ & 0.543134 (41) & 0.516476 (36) & 0.536132 (42) & 0.487589 (35) \\ \hline \hline \end{tabular} \end{center} \end{table} \section{Conclusions}\label{sec:conc} In this work, we propose and analyze momentum accelerated MG cycles, H- and N-cycle, for solving~$A \mathbf{x} = \mathbf{b}$ where~$A$ is SPD. The H- and N-cycle methods, use~$k$ steps of the HB or NA methods to define the coarse-level solvers, respectively. We show that H- and N-cycle are both special cases of the AMLI-cycle. In particular, H-cycle is equivalent to an AMLI-cycle using the polynomial of the best uniform approximation to~$1/x$. Following the standard analysis of AMIL-cycle, we derive the uniform convergence of the H-cycle and prove the uniform convergence of the N-cycle under standard assumptions. In our preliminary numerical experiments, the momentum accelerated MG cycles share the advantages of both AMLI- and the K-cycle. Similar to the K-cycle, H- and N-cycles do not require the estimation of the extreme eigenvalues while their computational costs are the same as the AMLI-cycle. In addition, the N-cycle MG method outperforms all the other MG cycles (including the two-grid method) for our examples without the need of estimating extreme eigenvalues, which demonstrates its efficiency and robustness and should be recommended in practice. For the future work, since the NA method can be used to solve general optimization problems, including nonconvex cases, we plan to develop the N-cycle MG method for solving general non-SPD linear systems and investigate the performance both theoretically and numerically. \section*{Acknowledgments} The authors wish to thank Ludmil Zikatanov for many insightful and helpful discussions and suggestions. \bibliographystyle{siamplain}
\section{Introduction} The LSND \cite{lsnd} and MiniBooNE \cite{mb_oscnew,mb_oscnst} experiments have reported excesses of $\nu_e$ and $\bar \nu_e$ charge-current quasielastic (CCQE) events in $\nu_\mu$ beams. Exotic models beyond the three-neutrino paradigm that have been invoked to explain these anomalies include, for example, 3+N neutrino oscillation models involving three active neutrinos and N additional sterile neutrinos \cite{sorel,karagiorgi,collin,giunti,giunti2,giunti3,kopp,kopp2,white_paper,3+2,diaz}, resonant neutrino oscillations \cite{resonant}, Lorentz violation \cite{lorentz}, sterile neutrino decay \cite{sterile_decay}, scalar decay \cite{scalar_decay}, sterile neutrino nonstandard interactions \cite{NSI}, and altered dispersion relations with sterile neutrinos \cite{sterile_extra}. This paper presents improved MiniBooNE $\nu_e$ appearance results with increased statistics and with additional studies that disfavor neutral-current (NC) $\pi^0$ and external event backgrounds. \section{The MiniBooNE Experiment} The MiniBooNE experiment makes use of the Booster Neutrino Beam (BNB) that is produced by 8 GeV protons from the Fermilab Booster interacting on a beryllium target inside a magnetic focusing horn, followed by meson decay in a 50 m decay pipe. In neutrino mode, the $\nu_\mu$, $\bar \nu_\mu$, $\nu_e$, and $\bar \nu_e$ flux contributions at the detector are 93.5\%, 5.9\%, 0.5\%, and 0.1\%, respectively, while in antineutrino mode, the flux contributions are 15.7\%, 83.7\%, 0.2\%, and 0.4\%, respectively. The $\nu_\mu$ and $\bar{\nu}_{\mu}$ fluxes peak at approximately 600 MeV and 400 MeV, respectively. The MiniBooNE detector, described in detail in reference \cite{mb_detector}, consists of a 12.2 m diameter sphere filled with 818 tonnes of pure mineral oil (CH$_{2}$) and is located 541 m from the beryllium target. The detector is covered by 1520 8-inch photomultiplier tubes (PMTs), where 1280 PMTs are in the interior detector region and 240 PMTs are located in the optically isolated outer veto region. The PMTs detect the directed Cherenkov light and the isotropic scintillation light produced by charged particles from neutrino interactions in the mineral oil. Events are reconstructed \cite{mb_recon} from the hit PMT charge and time information, and the reconstructed neutrino energy, $E_\nu^{QE}$, is estimated from the measured energy and angle of the outgoing muon or electron, assuming the kinematics of CCQE scattering \cite{ccqe}. The MiniBooNE experiment has collected data from 2002-2019, based on a total of $11.27 \times 10^{20}$ protons-on-target (POT) in antineutrino mode and $18.75 \times 10^{20}$ POT in neutrino mode. Also, a special beam off-target run collected an additional $1.86 \times 10^{20}$ POT in a search for sub-GeV dark matter \cite{mb_dm}. During the 17 years of running, the BNB and MiniBooNE detector have been stable to within 3\% in neutrino energy. Fig. \ref{Michel} shows the energy distribution of Michel electrons from stopped muon decay for the first ($6.46 \times 10^{20}$ POT from 2002 to 2007), second ($6.38 \times 10^{20}$ POT from 2015 to 2017), and third running periods ($5.91 \times 10^{20}$ POT from 2017 to 2019) in neutrino mode. By adjusting the energy calibration by 2\% for the second running period and by 3\% for the third running period, good agreement is obtained for the Michel electron energy distribution. \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{cMichels.pdf}} \vspace{-0.2in} \caption{The Michel electron energy distribution for the first, second, and third running periods in neutrino mode. The events are normalized to the first running period. The bottom plot shows ratios of the second and third running periods to the first running period.} \label{Michel} \vspace{0.1in} \end{figure} \section{Data Analysis} The data analysis is optimized to measure $\nu_e$-induced CCQE events and reject $\nu_\mu$ induced events, and is identical to the previous analysis \cite{mb_oscnew}. Figs. \ref{PIDem}, \ref{PIDep}, and \ref{PIDpi0} show the ${\nu}_e$ CCQE data and background for the three particle identification variables in neutrino mode in the $200<E_\nu^{QE}<1250$~MeV energy range for the total $18.75 \times 10^{20}$ POT data. The comparison between data and background for the full range of particle identification variables was shown in the supplementary material of a previous publication \cite{mb_oscnst}. The average selection efficiency is $\sim 20\%$ ($\sim 0.1\%$) for $\nu_e$-induced CCQE events ($\nu_\mu$-induced background events) generated over the fiducial volume. The fraction of CCQE events in antineutrino mode that are from wrong-sign neutrino events was determined from the angular distributions of muons created in CCQE interactions and by measuring CC single $\pi^+$ events \cite{wrong_sign}. Table \ref{signal_bkgd} shows the predicted but unconstrained $\nu_e$ and $\bar{\nu}_e$ CCQE background events for the neutrino energy range $200<E_\nu^{QE}<1250$~MeV for both neutrino and antineutrino modes, where there are approximately twice as many Monte Carlo events compared to data events. Table \ref{signal_bkgd} also shows the total constrained background, where the overall normalization of the $\nu_e$ intrinsic background is constrained by the $\nu_\mu$ CCQE event sample. The upper limit of 1250 MeV was chosen by the collaboration before unblinding the data in 2007, while the lower limit of 200 MeV was chosen in 2013 \cite{mb_oscnew} because it is the lowest energy for reliably reconstructing the Cherenkov ring of $\nu_\mu$ CCQE events with a visible energy greater than 140 MeV. From the given detector resolution estimated from the Michel electron spectrum (Fig. \ref{Michel}), there is a negligible amount of migration from events below 200 MeV. Note that the original lower limit was chosen to be 300 MeV before unblinding the data in 2007. During the unblinding procedure, the lower limit was increased to 475 MeV due to the low probability of the two-neutrino oscillation fit and worries about the single-gamma background. However, careful studies of the single-gamma background were performed after unblinding and convinced the collaboration that the single-gamma background was estimated correctly within systematic uncertainties and agreed with theoretical calculations \cite{hill_zhang}. Finally, Table \ref{signal_bkgd} shows the expected number of events corresponding to the LSND best fit oscillation probability of 0.26\%, assuming large $\Delta m^2$ where the oscillations are washed out. LSND and MiniBooNE have the same average value of L/E, but MiniBooNE has a larger range of L/E. Therefore, the appearance probabilities for LSND and MiniBooNE should not be exactly the same at lower L/E values. Figs. \ref{numuCCE} and \ref{pi0mass} show the $\nu_\mu$ CCQE $E_\nu^{QE}$ energy distribution and the NC $\pi^0$ mass distribution in neutrino mode for the first, second, and third running periods. As shown in the figures, the three running periods have good agreement. \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{PIDem.pdf}} \vspace{-0.2in} \caption{The MiniBooNE neutrino mode electron-muon particle identification distributions, corresponding to the total $18.75 \times 10^{20}$ POT data in the $200<E_\nu^{QE}<1250$ MeV energy range, for ${\nu}_e$ CCQE data (points with statistical errors) and background (colored histogram). The dashed histogram shows the best fit to the neutrino-mode data assuming two-neutrino oscillations.} \label{PIDem} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{PIDep.pdf}} \vspace{-0.2in} \caption{The MiniBooNE neutrino mode electron-pion particle identification distributions, corresponding to the total $18.75 \times 10^{20}$ POT data in the $200<E_\nu^{QE}<1250$ MeV energy range, for ${\nu}_e$ CCQE data (points with statistical errors) and background (colored histogram). The dashed histogram shows the best fit to the neutrino-mode data assuming two-neutrino oscillations.} \label{PIDep} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{PIDpi0.pdf}} \vspace{-0.2in} \caption{The MiniBooNE neutrino mode two-ring invariant-mass particle identification distributions, corresponding to the total $18.75 \times 10^{20}$ POT data in the $200<E_\nu^{QE}<1250$ MeV energy range, for ${\nu}_e$ CCQE data (points with statistical errors) and background (colored histogram). The dashed histogram shows the best fit to the neutrino-mode data assuming two-neutrino oscillations.} \label{PIDpi0} \vspace{0.1in} \end{figure} \begin{table}[t] \vspace{-0.1in} \caption{\label{signal_bkgd} \em The expected (unconstrained) number of events for the $200<E_\nu^{QE}<1250$~MeV neutrino energy range from all of the backgrounds in the $\nu_e$ and $\bar{\nu}_e$ appearance analysis before using the constraint from the CC $\nu_\mu$ events. The ``Other'' backgrounds correspond mostly to neutrino-nucleon and neutrino-electron elastic scattering. Also shown are the constrained background, as well as the expected number of events corresponding to the LSND best fit oscillation probability of 0.26\%, assuming oscillations at large $\Delta m^2$. The table shows the diagonal-element systematic plus statistical uncertainties, which become substantially reduced in the oscillation fits when correlations between energy bins and between the $\nu_e$ and $\nu_\mu$ events are included.} \small \begin{ruledtabular} \begin{tabular}{ccc} Process&Neutrino Mode&Antineutrino Mode \\ \hline $\nu_\mu$ \& $\bar \nu_\mu$ CCQE & 107.6 $\pm$ 28.2 & 12.9 $\pm$ 4.3 \\ NC $\pi^0$ & 732.3 $\pm$ 95.5 & 112.3 $\pm$ 11.5 \\ NC $\Delta \rightarrow N \gamma$ & 251.9 $\pm$ 35.2 & 34.7 $\pm$ 5.4 \\ External Events & 109.8 $\pm$ 15.9 & 15.3 $\pm$ 2.8 \\ Other $\nu_\mu$ \& $\bar \nu_\mu$ & 130.8 $\pm$ 33.4 & 22.3 $\pm$ 3.5 \\ \hline $\nu_e$ \& $\bar \nu_e$ from $\mu^{\pm}$ Decay & 621.1 $\pm$ 146.3 & 91.4 $\pm$ 27.6 \\ $\nu_e$ \& $\bar \nu_e$ from $K^{\pm}$ Decay & 280.7 $\pm$ 61.2 & 51.2 $\pm$ 11.0 \\ $\nu_e$ \& $\bar \nu_e$ from $K^0_L$ Decay & 79.6 $\pm$ 29.9 & 51.4 $\pm$ 18.0 \\ Other $\nu_e$ \& $\bar \nu_e$ & 8.8 $\pm$ 4.7 & 6.7 $\pm$ 6.0 \\ \hline Unconstrained Bkgd. & $2322.6 \pm 258.3$ & $398.2 \pm 49.7$ \\ Constrained Bkgd. & $2309.4 \pm 119.6$ & $400.6 \pm 28.5$ \\ \hline Total Data & 2870 &478 \\ Excess & 560.6 $\pm$ 119.6 & 77.4 $\pm$ 28.5 \\ \hline 0.26\% (LSND) $\nu_\mu \rightarrow \nu_e$ & 676.3 & 100.0 \\ \end{tabular} \vspace{-0.2in} \end{ruledtabular} \normalsize \end{table} \bigskip \bigskip \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{cEccqe.pdf}} \vspace{-0.2in} \caption{The $\nu_\mu$ CCQE muon visible energy distribution for the first, second, and third running periods in neutrino mode. The events are normalized to the first running period. The bottom plot shows ratios of the second and third running periods to the first running period.} \label{numuCCE} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{cPiMass.pdf}} \vspace{-0.2in} \caption{The NC $\pi^0$ mass distribution for the first, second, and third running periods in neutrino mode. The events are normailzed to the first running period. The bottom plot shows ratios of the second and third running periods to the first running period.} \label{pi0mass} \vspace{0.1in} \end{figure} Systematic uncertainties are determined by considering the predicted effects on the $\nu_\mu$, $\bar{\nu}_{\mu}$, $\nu_e$, and $\bar{\nu}_e$ CCQE rates from variations of model parameters that include uncertainties in the neutrino and antineutrino flux estimates, uncertainties in neutrino cross sections, uncertainties from nuclear effects, and uncertainties in detector modeling and reconstruction. A covariance matrix in bins of $E^{QE}_{\nu}$ is constructed by considering the variation from each source of systematic uncertainty on the $\nu_e$ and $\bar{\nu}_e$ CCQE signal and background, and the $\nu_\mu$ and $\bar{\nu}_{\mu}$ CCQE prediction as a function of $E_{\nu}^{QE}$. This matrix includes correlations between any of the $\nu_e$ and $\bar{\nu}_e$ CCQE signal and background and $\nu_\mu$ and $\bar{\nu}_{\mu}$ CCQE samples, and is used in the $\chi^2$ calculation of the oscillation fits. \section{Electron-neutrino Appearance Results} Figs. \ref{evis}, \ref{costh}, and \ref{excessnat} show the visible energy, $\cos \theta$, and $E_\nu^{QE}$ distributions for ${\nu}_e$ CCQE data and background in neutrino mode in the $200<E_\nu^{QE}<1250$~MeV energy range for the total $18.75 \times 10^{20}$ POT data, where $\theta$ is the angle of the reconstructed electron relative to the incident beam direction. Each bin of reconstructed $E_\nu^{QE}$ corresponds to a distribution of ``true'' generated neutrino energies, which can overlap adjacent bins. In neutrino mode, a total of 2870 data events pass the $\nu_e$ CCQE event selection requirements with $200<E_\nu^{QE}<1250$~MeV, compared to a background expectation of $2309.4 \pm 48.1 (stat.) \pm 109.5 (syst.)$ events. The excess, as shown in Table \ref{excesses}, is then $560.6 \pm 119.6$ events or a $4.7 \sigma$ effect. Fig. \ref{Excess_old_new} shows the event excesses as a function of $E_\nu^{QE}$ in neutrino mode for the first, second, and third running periods. Combining the MiniBooNE neutrino and antineutrino data \cite{mb_oscnst}, there are a total of 3348 events in the $200<E_\nu^{QE}<1250$~MeV energy region, compared to a background expectation of $2710.0 \pm 52.1(stat.) \pm 122.2(syst.)$ events. This corresponds to a total $\nu_e$ plus $\bar \nu_e$ CCQE excess of $638.0 \pm 52.1(stat.) \pm 122.2(syst.)$ events with respect to expectation, where the statistical uncertainty is the square root of the background estimate and the systematic uncertainty includes correlated and uncorrelated systematic parameters. The overall significance of the excess, $4.8 \sigma$, is limited by systematic uncertainties, assumed to be Gaussian, as the statistical significance of the excess is $12.2 \sigma$. The fractional unconstrained systematic uncertainties in the $200<E_\nu^{QE}<1250$~MeV energy range are shown in Table \ref{systs}. \begin{table}[t] \vspace{-0.1in} \caption{\label{excesses} \em The number of data events, background events, and excess events in neutrino mode for different selection crteria. The errors include both statistical and systematic uncertainties. Also shown is the significance of each event excess. R is the radius of the reconstructed event interaction point. } \small \begin{ruledtabular} \begin{tabular}{ccccc} Selection&Data&Background&Excess&Significance \\ \hline $200<E_\nu^{QE}<1250$ MeV \& $R<5m$&2870&$2309.4 \pm 119.6$&$560.6 \pm 119.6$&4.7$\sigma$ \\ $150<E_\nu^{QE}<1250$ MeV \& $R<5m$&3172&$2560.4 \pm 131.5$&$611.6 \pm 131.5$&4.7$\sigma$ \\ $200<E_\nu^{QE}<1250$ MeV \& $R<4m$&1978&$1519.4 \pm 81.9$&$458.6 \pm 81.9$&5.6$\sigma$ \\ $200<E_\nu^{QE}<1250$ MeV \& $R<3m$&864&$673.9 \pm 41.2$&$190.1 \pm 41.2$&4.6$\sigma$ \\ \hline \end{tabular} \vspace{-0.2in} \end{ruledtabular} \normalsize \end{table} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{nuance_datamc_data_VisibleEnergyMeV_stage_1.pdf}} \vspace{-0.2in} \caption{The MiniBooNE neutrino mode visible energy distributions, corresponding to the total $18.75 \times 10^{20}$ POT data in the $200<E_\nu^{QE}<1250$ MeV energy range, for ${\nu}_e$ CCQE data (points with statistical errors) and background (colored histogram). The dashed histogram shows the best fit to the neutrino-mode data assuming two-neutrino oscillations.} \label{evis} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{nuance_datamc_data_costheta_stage_1.pdf}} \vspace{-0.2in} \caption{The MiniBooNE neutrino mode $\cos \theta$ distributions, corresponding to the total $18.75 \times 10^{20}$ POT data in the $200<E_\nu^{QE}<1250$ MeV energy range, for ${\nu}_e$ CCQE data (points with statistical errors) and background (colored histogram). The dashed histogram shows the best fit to the neutrino-mode data assuming two-neutrino oscillations.} \label{costh} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{histNu_stacked_wbf.pdf}} \vspace{-0.2in} \caption{The MiniBooNE neutrino mode $E_\nu^{QE}$ distributions, corresponding to the total $18.75 \times 10^{20}$ POT data in the $200<E_\nu^{QE}<3000$ MeV energy range, for ${\nu}_e$ CCQE data (points with statistical errors) and predicted backgrounds (colored histograms). The constrained background is shown as additional points with systematic error bars. The dashed histogram shows the best fit to the neutrino-mode data assuming two-neutrino oscillations. The last bin is for the energy interval from 1500-3000 MeV.} \label{excessnat} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{-0.0in} \centerline{\includegraphics[angle=0, width=9.0cm]{excessNue_CompDataSets.pdf}} \vspace{-0.2in} \caption{ The total event excesses in neutrino mode as a function of $E_\nu^{QE}$ for the first, second, and third running periods. Error bars include only statistical uncertainties.} \label{Excess_old_new} \vspace{0.1in} \end{figure} \begin{table}[t] \vspace{-0.1in} \caption{\label{systs} \em The fractional unconstrained systematic uncertainties in the $200<E_\nu^{QE}<1250$~MeV energy range. } \small \begin{ruledtabular} \begin{tabular}{cc} Systematic Uncertainty&Fraction of Event Excess \\ \hline Cross Section&35\% \\ Optical Model&23\% \\ $\pi^+$ Production&14\% \\ Neutrino Flux&7\% \\ $K^0$ Production&4\% \\ $K^+$ Production&4\% \\ \hline \end{tabular} \vspace{-0.2in} \end{ruledtabular} \normalsize \end{table} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{c_hEvisCosTheta_data_data.pdf}} \vspace{-0.2in} \caption{The total numbers of data events in neutrino mode as functions of reconstructed visible energy and $\cos \theta$. There are 20 columns of visible energy from 150 to 1250 MeV and 20 rows of $\cos \theta$ from -1 to 1.} \label{output_D} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{c_hEvisCosTheta_data_BG.pdf}} \vspace{-0.2in} \caption{The total numbers of background events in neutrino mode as functions of reconstructed visible energy and $\cos \theta$. There are 20 columns of visible energy from 150 to 1250 MeV and 20 rows of $\cos \theta$ from -1 to 1.} \label{output_B} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{c_hEvisCosTheta_data_Excess.pdf}} \vspace{-0.2in} \caption{The total numbers of excess events in neutrino mode as functions of reconstructed visible energy and $\cos \theta$. There are 20 columns of visible energy from 150 to 1250 MeV and 20 rows of $\cos \theta$ from -1 to 1.} \label{output_E} \vspace{0.1in} \end{figure} In order to test physics models, the numbers of data events, unconstrained background events, and excess events in neutrino mode with visible energy between 150 and 1250 MeV are shown in Figs. \ref{output_D}, \ref{output_B}, and \ref{output_E} as functions of visible energy and $\cos \theta$. In these figures, there are 20 columns of visible energy from 150 to 1250 MeV and 20 rows of $\cos \theta$ from -1 to 1. There are a total of 3182 data events, 2568.8 background events and 613.2 excess events. Fig. \ref{1D_data} shows the $\cos \theta$ distribution of data and background events for the 20 different energy bins, while Fig. \ref{Uz_E} shows the $\cos \theta$ distributions from 0.9 to 1 for 10 different visible energy bins. Neutrino-electron elastic scattering events are shown as the hatched region in the ``Others'' category. Fig. \ref{Uz0.9} shows the number of data and background events as a function of $\cos \theta$ for $\cos \theta > 0.9$, where neutrino-electron elastic scattering events are shown as the hatched region in the ``Others'' category and contribute to the $\cos \theta > 0.98$ bins. The neutrino-electron elastic events constitute 53\% (89\%) of the ``Others'' category for $\cos \theta > 0.90$ ($\cos \theta > 0.99$), and the category also includes neutrino-nucleon charged-current and neutral-current scattering events. As shown in the figure, the excess of data events over background events is approximately the same in each bin. Figs. \ref{EnuQE150} and \ref{Uz150} show the $E_\nu^{QE}$ and $\cos \theta$ distributions for the $150<E_\nu^{QE}<1250$ MeV energy range, and the total event excess as a function of $E_\nu^{QE}$ is shown in Fig. \ref{Excess_new}. The solid curve on the latter plot shows the two-neutrino oscillation prediction at the best-fit point ($\sin^22\theta = 0.807$, $\Delta m^2=0.043$ eV$^2$). The lowest energy data point has less acceptance than the other data points due to the requirement that the visible energy be greater than 140 MeV. Table \ref{excesses} lists the number of data events, background events, excess events, and excess significance for the $150<E_\nu^{QE}<1250$ MeV energy range. \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=18.0cm]{c1DX_h1DX_hEvisCosTheta_data_0.pdf}} \vspace{-0.2in} \caption{The $\cos \theta$ distribution of data events (points with error bars) and background events (colored histogram) in neutrino mode for the 20 different visible energy bins from 150 to 1250 MeV.} \label{1D_data} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=18.0cm]{c1DX_h1DX_hEvisCosTheta_09_data_0.pdf}} \vspace{-0.2in} \caption{The $\cos \theta$ distributions from 0.9 to 1 of data events (points with statistical errors) and background events (histogram) in neutrino mode for 10 different visible energy bins from 150 to 1250 MeV. Neutrino-electron elastic scattering events are shown as the hatched region in the ``Others'' category.} \label{Uz_E} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{cCosTheta.pdf}} \vspace{-0.2in} \caption{The MiniBooNE neutrino mode $\cos \theta$ distribution for $\cos \theta > 0.9$, corresponding to the total $18.75 \times 10^{20}$ POT neutrino data in the visible energy range from 150 to 1250 MeV, for ${\nu}_e$ CCQE data (points with statistical errors) and predicted backgrounds (colored histograms). Neutrino-electron elastic scattering events are shown as the hatched region in the ``Others'' category.} \label{Uz0.9} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{EnuQE_150_1250.pdf}} \vspace{-0.2in} \caption{The MiniBooNE neutrino mode $E_\nu^{QE}$ distributions, corresponding to the total $18.75 \times 10^{20}$ POT neutrino data in the $150<E_\nu^{QE}<1250$ MeV energy range, for ${\nu}_e$ CCQE data (points with statistical errors) and predicted backgrounds (colored histograms). The dashed histogram shows the best fit to the neutrino-mode data assuming two-neutrino oscillations.} \label{EnuQE150} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{+0.1in} \centerline{\includegraphics[angle=0, width=9.0cm]{Uz_150_1250.pdf}} \vspace{-0.2in} \caption{The MiniBooNE neutrino mode $\cos \theta$ distributions, corresponding to the total $18.75 \times 10^{20}$ POT neutrino data in the $150<E_\nu^{QE}<1250$ MeV energy range, for ${\nu}_e$ CCQE data (points with statistical errors) and predicted backgrounds (colored histograms). The dashed histogram shows the best fit to the neutrino-mode data assuming two-neutrino oscillations.} \label{Uz150} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{-0.0in} \centerline{\includegraphics[angle=0, width=18.0cm]{cBestFitSigma-2.pdf}} \vspace{-0.2in} \caption{ The total event excess in neutrino mode, corresponding to $18.75 \times 10^{20}$ POT in the $150<E_\nu^{QE}<3000$ MeV energy range. The solid curve shows the best fit to the neutrino-mode and antineutrino-mode data in the $200 < E_\nu^{QE} < 1250$ MeV energy range assuming two-neutrino oscillations, while the dashed curves show selected points on the 1 sigma contour. Also shown is the 1-sigma allowed band. The outer error bars include statistical plus constrained systematic uncertainties, while the inner error bars show the statistical uncertainties. The lowest energy data point shows only the unconstrained background statistical uncertainty.} \label{Excess_new} \vspace{0.1in} \end{figure} \section{Neutrino Oscillation Fits} Fig.~\ref{limitab2} shows the MiniBooNE allowed regions in both neutrino mode and antineutrino mode \cite{mb_oscnst} for events with $200 < E^{QE}_{\nu} < 3000$ MeV within a two-neutrino oscillation model. For this oscillation fit the entire data set is used and includes the $18.75 \times 10^{20}$ POT data in neutrino mode and the $11.27 \times 10^{20}$ POT data in antineutrino mode. Also shown are 90\% C.L. limits from the KARMEN \cite{karmen} and OPERA \cite{opera} experiments. The best combined neutrino oscillation fit occurs at ($\sin^22\theta$, $\Delta m^2$) $=$ (0.807, 0.043 eV$^2$). The $\chi^2/ndf$ for the best-fit point in the energy range $200<E_\nu^{QE}<1250$~MeV is 21.7/15.5 with a probability of $12.3\%$, and the background-only fit has a $\chi^2$ probability of $3 \times 10^{-7}$ relative to the best oscillation fit and a $\chi^2/ndf = 50.7/17.3$ with a probability of $0.01\%$. \begin{figure}[tbp] \vspace{-0.25in} \centerline{\includegraphics[width=9.0cm]{miniboone_fake_oct19_contNunubar_with_karmen.pdf}} \vspace{-0.3in} \caption{MiniBooNE allowed regions for combined neutrino mode ($18.75 \times 10^{20}$ POT) and antineutrino mode ($11.27 \times 10^{20}$ POT) data sets for events with $200 < E^{QE}_{\nu} < 3000$ MeV within a two-neutrino oscillation model. The shaded areas show the 90\% and 99\% C.L. LSND $\bar{\nu}_{\mu}\rightarrow\bar{\nu}_e$ allowed regions. The black point shows the MiniBooNE best fit point. Also shown are 90\% C.L. limits from the KARMEN \cite{karmen} and OPERA \cite{opera} experiments.} \label{limitab2} \vspace{0.1in} \end{figure} Fig. \ref{LoverE} compares the $L/E_\nu^{QE}$ distributions for the MiniBooNE data excesses in neutrino mode and antineutrino mode to the $L/E$ distribution from LSND \cite{lsnd}. The error bars show statistical uncertainties only. As shown in the figure, there is agreement among all three data sets. Assuming two-neutrino oscillations, the curves show fits to the MiniBooNE data described above. The significance of the combined LSND ($3.8 \sigma$) \cite{lsnd} and MiniBooNE ($4.8 \sigma$) excesses is $6.1 \sigma$, which is obtained by adding the significances in quadrature, as the two experiments have completely different neutrino energies, neutrino fluxes, reconstructions, backgrounds, and systematic uncertainties. \begin{figure}[tbp] \vspace{-0.0in} \centerline{\includegraphics[angle=0, width=9.0cm]{LoverE.pdf}} \vspace{-0.2in} \caption{A comparison between the $L/E_\nu^{QE}$ distributions for the MiniBooNE data excesses in neutrino mode ($18.75 \times 10^{20}$ POT) and antineutrino mode ($11.27 \times 10^{20}$ POT) to the $L/E$ distribution from LSND \cite{lsnd}. The error bars show statistical uncertainties only. The curves show fits to the MiniBooNE data, assuming two-neutrino oscillations, while the shaded area is the MiniBooNE $1 \sigma$ allowed band. The best-fit curve corresponds to ($\sin^22\theta$, $\Delta m^2$) $=$ (0.807, 0.043 eV$^2$), while the dashed curve corresponds to a $1 \sigma$ fit point at ($\sin^22\theta$, $\Delta m^2$) $=$ (0.01, 0.4 eV$^2$).} \label{LoverE} \vspace{0.1in} \end{figure} \section{Background Studies and Constraints} Constraints have been placed on the various backgrounds in Table \ref{signal_bkgd} by direct measurements of these backgrounds in the MiniBooNE detector. The $\nu_\mu$ CC background has been well measured \cite{mb_numuccqe} by using the Michel electrons from muon decay to identify the event topology. Likewise, the NC $\pi^0$ background has also been well measured \cite{mb_pi0} by reconstructing the two-gamma invariant mass. In addition, a fit to the vertex radial distribution, shown in Fig. \ref{Rdist}, allows a constraint to be placed on the NC $\pi^0$ background, due to this background having more events near the edge of the 5 m radius fiducial volume. (NC $\pi^0$ events near the edge of the fiducial volume have a greater chance of one photon leaving the detector with the remaining photon then mis-reconstructing as an electron candidate.) Fig. \ref{RExcess} shows the excess event radial distributions, where different processes are normalized to explain the event excess, while Table \ref{Rfit} shows the result of log-likelihood shape-only fits to the radial distribution and the multiplicative factor that is required for each hypothesis to explain the observed event excess. The two-neutrino oscillation hypothesis fits the radial distribution best with a $\chi^2 = 8.4/9 ndf$, while the NC $\pi^0$ hypothesis has a worse fit with a $\chi^2 = 17.2/9 ndf$. The intrinsic $\nu_e$ backgrounds have a worse $\chi^2$ than the two-neutrino oscillation hypothesis due to higher energy $\nu_e$ events having a different radial distribution than lower energy $\nu_e$ events. \begin{figure}[tbp] \vspace{-0.25in} \centerline{\includegraphics[angle=0,width=9.0cm]{nuance_datamc_data_R500cm3_stage_1.pdf}} \vspace{-0.3in} \caption{The MiniBooNE radial vertex distribution, corresponding to the total $18.75 \times 10^{20}$ POT data in neutrino mode in the $200<E_\nu^{QE}<1250$ MeV energy range, for ${\nu}_e$ CCQE data (points with statistical errors) and background (histogram). The dashed histogram shows the best fit to the neutrino-mode data assuming two-neutrino oscillations.} \label{Rdist} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{-0.25in} \centerline{\includegraphics[angle=0,width=18.0cm]{rshapes_v2.pdf}} \vspace{-0.3in} \caption{The excess event radial distributions in neutrino mode with only statistical errors in the $200<E_\nu^{QE}<1250$ MeV energy range, where different processes are normalized to explain the event excess. The different processes are the following: (a) $\Delta \rightarrow N \gamma$; (b) External Events; (c) $\nu_e$ \& $\bar \nu_e$ from $K^0_L$ Decay; (d) $\nu_e$ \& $\bar \nu_e$ from $K^{\pm}$ Decay; (e) $\nu_e$ \& $\bar \nu_e$ from $\mu^{\pm}$ Decay; (f) Other $\nu_e$ \& $\bar \nu_e$; (g) NC $\pi^0$; (h) Best Fit oscillations.} \label{RExcess} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{-0.25in} \centerline{\includegraphics[angle=0,width=9.0cm]{h1_TRWMZb1MeVBinHist.pdf}} \vspace{-0.3in} \caption{The bunch timing for data events in neutrino mode compared to the expected background in the $200<E_\nu^{QE}<1250$ MeV energy range. Almost all of the excess data events occur, as expected from neutrino events in the detector, within the first 8 ns of the bunch timing. This data sample uses events collected with the new fiber timing system and represents about 40\% of the entire neutrino mode sample.} \label{Timing} \vspace{0.1in} \end{figure} \bigskip \begin{table}[t] \vspace{-0.1in} \caption{\label{Rfit} \em The result of log-likelihood shape-only fits to the radial distribution in neutrino mode, assuming only statistical errors, where different processes are normalized to explain the observed event excess. The two-neutrino hypothesis fits the radial distribution best with a $\chi^2 = 8.4/9 ndf$, while the NC $\pi^0$ hypothesis has a worse fit with a $\chi^2 = 17.2/9 ndf$. Also shown is the multiplicative factor that is required for each hypothesis to explain the observed event excess. } \small \begin{ruledtabular} \begin{tabular}{ccc} Hypothesis&Multiplicative factor&$\chi^2 /9 ndf$ \\ \hline NC $\Delta \rightarrow N \gamma$ Background & 3.18 & 10.0 \\ External Event Background & 5.98 & 44.9 \\ $\nu_e$ \& $\bar \nu_e$ from $K^0_L$ Decay Background & 7.85 & 14.8 \\ $\nu_e$ \& $\bar \nu_e$ from $K^{\pm}$ Decay Background & 2.95 & 16.3 \\ $\nu_e$ \& $\bar \nu_e$ from $\mu^{\pm}$ Decay Background & 1.88 & 16.1 \\ Other $\nu_e$ \& $\bar \nu_e$ Background & 3.21 & 12.5 \\ NC $\pi^0$ Background & 1.75 & 17.2 \\ Best Fit Oscillations & 1.24 & 8.4 \\ \hline \end{tabular} \vspace{-0.2in} \end{ruledtabular} \normalsize \end{table} \bigskip \bigskip Single-gamma backgrounds from external neutrino interactions (``dirt" backgrounds) are estimated using topological and spatial cuts to isolate the events whose vertices are near the edge of the detector and point towards the detector center \cite{mb_lowe}. The external event background estimate has been confirmed by measuring the absolute time of signal events relative to the proton beam microstructure (52.81 MHz extraction frequency), which corresponds to buckets of beam approximately every 18.9 ns. Fig. \ref{Timing} shows that the event excess peaks in the 8 ns window associated with beam bunch time, as expected from neutrino events in the detector, and is inconsistent with external neutrino events or beam-off events, which would be approximately flat in time. Also, the observed background level outside of the beam agrees well with the predicted background estimate. In addition, good agreement is obtained for the event excess with $\cos \theta >0.9$. The timing reconstruction performed here is similar to the reconstruction in reference \cite{mb_dm}, but with a different time offset applied. The $\Delta \rightarrow N + \gamma$ background is determined from the NC $\pi^0$ event sample \cite{mb_pi0}, which has contributions from $\Delta$ production in $^{12}$C (52.2\%), $\Delta$ production in H$_2$ (15.1\%), coherent scattering on $^{12}$C (12.5\%), coherent scattering on H$_2$ (3.1\%), higher-mass resonances (12.9\%), and non-resonant background (4.2\%). The fraction of $\Delta$ decays to $\pi^0$ is 2/3 from the Clebsch-Gordon coefficients, and the probability of pion escape from the $^{12}$C nucleus is estimated to be 62.5\%. The $\Delta$ radiative branching fraction is 0.60\% for $^{12}$C and 0.68\% for H$_2$ after integration over all the invariant mass range, where the single gamma production branching ratio increases below the pion production threshold. With these values, the ratio of single gamma events to NC $\pi^0$ events, $R$, can be estimated to be $$R=0.151 \times 0.0068 \times 1.5 + 0.522 \times 0.0060 \times 1.5 /0.625 = 0.0091.$$ Note that single gamma events are assumed to come entirely from $\Delta$ radiative decay. The total uncertainty on this ratio is 14.0\% (15.6\%) in neutrino (antineutrino) mode. This estimate of $R=0.0091 \pm 0.0013$ agrees fairly well with theoretical calculations of the single gamma event rate \cite{hill_zhang}. The intrinsic $\nu_e$ background comes almost entirely from muon and kaon decay-in-flight in the beam decay pipe. MiniBooNE $\nu_\mu$ CCQE event measurements \cite{mb_numuccqe} constrain the size and energy dependence of the intrinsic $\nu_e$ background from muon decay, while the intrinsic $\nu_e$ background from kaon decay is constrained by fits to kaon production data and SciBooNE measurements \cite{sciboone_kaon}. Furthermore, due to the higher energy of the intrinsic $\nu_e$ background, this background is disfavored from the fit to the radial distribution, as shown in Table \ref{Rfit}. Finally, backgrounds from exotic $\pi^0$ decay in the neutrino production target are ruled out from the MiniBooNE beam-dump run, where the incident proton beam was steered above the Be target and interacted in the steel beam dump at the downstream end of the decay pipe. No excess of events was observed \cite{mb_dm}, which set limits on light dark matter and other exotic $\pi^0$ decays. \section{Constraints on NC $\pi^0$ Background with Tighter Radius Selection} Explanations for the event excess have included unsimulated photons entering the detector from external interactions and the undersimulation of photons lost from $\pi^0$ production within the detector. To test these explanations in a model-independent way, we can use our higher event statistics to study the change in the excess as a function of tighter fiducial volume cuts. The NC $\pi^0$ and external event backgrounds preferentially populate higher radius compared to electron neutrino interactions. Therefore, reducing the fiducial radius is expected to reduce the significance of the excess if it is due to these backgrounds and increase the significance of the excess if its distribution is $\nu_e$-like. If we change the standard 5 m cut to 4 m, we find there are 1978 data events in neutrino mode, $1519.4 \pm 81.9$ background events, and an excess of $458.6 \pm 81.9$ events ($5.6 \sigma$). If we use a 3 m cut, we find 864 data events, $673.9 \pm 41.2$ background events, and an excess of $190.1 \pm 41.2$ events ($4.6 \sigma$), consistent with what is expected if the signal is more $\nu_e$-like. The event statistics are shown in Table \ref{excesses}, while Figs. \ref{EnuQE_Rlt4} and \ref{Uz_Rlt4} show the reconstructed neutrino energy and $\cos \theta$ distributions for electronlike events with radius less than 4 m for both data events and background events. \begin{figure}[tbp] \vspace{-0.25in} \centerline{\includegraphics[angle=0,width=9.0cm]{nuance_datamc_data_E_QEMeV_stage_1_lt400cm.pdf}} \vspace{-0.3in} \caption{The MiniBooNE neutrino mode $E_\nu^{QE}$ distributions, corresponding to the total $18.75 \times 10^{20}$ POT data in neutrino mode in the $200<E_\nu^{QE}<1250$ MeV energy range, for ${\nu}_e$ CCQE data (points with statistical errors) and background (histogram) with radius less than 4 m. The dashed histogram shows the best fit to the neutrino-mode data assuming two-neutrino oscillations.} \label{EnuQE_Rlt4} \vspace{0.1in} \end{figure} \begin{figure}[tbp] \vspace{-0.25in} \centerline{\includegraphics[angle=0,width=9.0cm]{nuance_datamc_data_costheta_stage_1_lt400cm.pdf}} \vspace{-0.3in} \caption{The MiniBooNE neutrino mode $\cos \theta$ distributions, corresponding to the total $18.75 \times 10^{20}$ POT data in neutrino mode in the $200<E_\nu^{QE}<1250$ MeV energy range, for ${\nu}_e$ CCQE data (points with statistical errors) and background (histogram) with radius less than 4 m. The dashed histogram shows the best fit to the neutrino-mode data assuming two-neutrino oscillations.} \label{Uz_Rlt4} \vspace{0.1in} \end{figure} \section{Conclusion} In summary, the MiniBooNE experiment observes a total excess of $638.0 \pm 52.1(stat.) \pm 132.8(syst.)$ electronlike events in the energy range $200<E_\nu^{QE}<1250$~MeV in both neutrino and antineutrino running modes. The overall significance of the excess, $4.8 \sigma$, is limited by systematic uncertainties, assumed to be Gaussian, as the statistical significance of the excess is $12.2 \sigma$. All of the major backgrounds are constrained by in situ event measurements. Beam timing information shows that almost all of the excess is in time with neutrinos that interact in the detector. The radius distribution shows that the excess is distributed throughout the volume, while tighter cuts on the fiducal volume increase the significance of the excess. The data likelihood ratio disfavors models that explain the event excess due to entering or exiting photons. The MiniBooNE event excess will be further studied by the Fermilab short-baseline neutrino (SBN) program \cite{sbn} and by the JSNS$^2$ experiment at J-PARC \cite{jsns2}. \begin{acknowledgments} We acknowledge the support of Fermilab, the Department of Energy, and the National Science Foundation, and we acknowledge Los Alamos National Laboratory for LDRD funding. \vspace{-0.01in} \end{acknowledgments} \vspace{-0.2in}
\section*{Acknowledgements} \noindent We express our gratitude to our colleagues in the CERN accelerator departments for the excellent performance of the LHC. We thank the technical and administrative staff at the LHCb institutes. We acknowledge support from CERN and from the national agencies: CAPES, CNPq, FAPERJ and FINEP (Brazil); MOST and NSFC (China); CNRS/IN2P3 (France); BMBF, DFG and MPG (Germany); INFN (Italy); NWO (Netherlands); MNiSW and NCN (Poland); MEN/IFA (Romania); MSHE (Russia); MinECo (Spain); SNSF and SER (Switzerland); NASU (Ukraine); STFC (United Kingdom); DOE NP and NSF (USA). We acknowledge the computing resources that are provided by CERN, IN2P3 (France), KIT and DESY (Germany), INFN (Italy), SURF (Netherlands), PIC (Spain), GridPP (United Kingdom), RRCKI and Yandex LLC (Russia), CSCS (Switzerland), IFIN-HH (Romania), CBPF (Brazil), PL-GRID (Poland) and OSC (USA). We are indebted to the communities behind the multiple open-source software packages on which we depend. Individual groups or members have received support from AvH Foundation (Germany); EPLANET, Marie Sk\l{}odowska-Curie Actions and ERC (European Union); A*MIDEX, ANR, Labex P2IO and OCEVU, and R\'{e}gion Auvergne-Rh\^{o}ne-Alpes (France); Key Research Program of Frontier Sciences of CAS, CAS PIFI, and the Thousand Talents Program (China); RFBR, RSF and Yandex LLC (Russia); GVA, XuntaGal and GENCAT (Spain); the Royal Society and the Leverhulme Trust (United Kingdom). \section{${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair mass distributions in bins of ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$} \unboldmath \label{app:Mbinned} \begin{figure}[htbp] \begin{center} \includegraphics[width=1.0\linewidth]{./figs/FigS1.pdf} \vspace*{-0.1cm} \end{center} \caption{ Invariant mass spectra of ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair candidates in the six ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ regions with boundaries $\left\{ 0, 5, 6, 8, 9.5, 12, 50 \right\}\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$ with reconstructed ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ masses in the (black)~signal and (blue)~background regions, respectively. }\label{fig:Xmassbinned} \end{figure} \boldmath \section{Additional fits to the ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair mass spectrum} \unboldmath \label{app:morefits} Figure~\ref{fig:fitXcut2} shows the fits to the ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair mass spectrum with (a) the threshold structure described by a single Breit--Wigner (BW) lineshape and (b) using a model that contains a single BW resonance interfering with the SPS continuum. The $\ensuremath{\chi^2}\xspace/{\rm ndof}$ of the two fits are $125.6/92$ and $118.6/91$, corresponding to a probability of $1.2\%$ and $2.8\%$, respectively. Figure~\ref{fig:fitXcut3} shows the fit with an additional BW function introduced to describe the $7.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ structure, based on the model that contains two BW lineshapes for the threshold structure and a BW shape for the $X(6900)$ structure on top of the NRSPS plus DPS continuum. \begin{figure}[h] \begin{center} \sidesubfloat[]{\includegraphics[width=0.48\linewidth]{./figs/FigS2a.pdf}} \sidesubfloat[]{\includegraphics[width=0.48\linewidth]{./figs/FigS2b.pdf}}\\ \vspace*{-0.1cm} \end{center} \caption{Invariant mass spectra of weighted di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates with ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace>5.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$ and overlaid projections of the ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-threshold fit with (a)~the threshold structure described as a single BW function, and (b)~assuming a single BW interfering with the SPS continuum. }\label{fig:fitXcut2} \end{figure} \begin{figure}[h] \begin{center} \includegraphics[width=0.48\linewidth]{./figs/FigS3.pdf} \vspace*{-0.1cm} \end{center} \caption{Invariant mass spectra of weighted di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates with ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace>5.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$ and overlaid projections of the ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-threshold fit with an additional BW function introduced to describe the $7.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ structure, based on the model that contains two BW lineshapes for the threshold structure and a BW shape for the $X(6900)$ structure on top of the NRSPS plus DPS continuum. }\label{fig:fitXcut3} \end{figure} \boldmath \section{Supplement to fit result of model II} \unboldmath \label{app:itffit} In model II that contains a BW lineshape for the threshold structure interfering with the NRSPS, a BW shape for the $X(6900)$ structure and the DPS continuum, the parameters of the lower-mass BW lineshape is determined to $M=6741\pm6\aunit{(stat)}\xspace\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace$ and $\Gamma=288\pm16\aunit{(stat)}\xspace\aunit{Me\kern -0.1em V}\xspace$. The systematic uncertainties on the mass and natural width are not studied. Due to the complex nature of the threshold structure, and the simple interference scenario considered, this study is not considered to claim a state with the parameters reported here. Projections of the fit to the ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair invariant mass spectra in bins of ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ assuming the interference between the threshold structure and the SPS continuum are shown in Fig.~\ref{fig:fitXbinned_itf}. \begin{figure}[!htbp] \begin{center} \sidesubfloat[]{\includegraphics[width=0.45\linewidth]{./figs/FigS4a.pdf}} \sidesubfloat[]{\includegraphics[width=0.45\linewidth]{./figs/FigS4b.pdf}}\\ \sidesubfloat[]{\includegraphics[width=0.45\linewidth]{./figs/FigS4c.pdf}} \sidesubfloat[]{\includegraphics[width=0.45\linewidth]{./figs/FigS4d.pdf}}\\ \sidesubfloat[]{\includegraphics[width=0.45\linewidth]{./figs/FigS4e.pdf}} \sidesubfloat[]{\includegraphics[width=0.45\linewidth]{./figs/FigS4f.pdf}}\\ \vspace*{-0.1cm} \end{center} \caption{Invariant mass spectra of weighted di-$/{\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates in bins of ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ and overlaid projections of the ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-binned fit assuming that the threshold structure interferes with the SPS continuum. }\label{fig:fitXbinned_itf} \end{figure} \boldmath \section{Dependence of experimental efficiency on ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$} \unboldmath The variation of the experimental efficiency with respect to ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ is shown in Fig.~\ref{fig:eff}, which is marginal across the whole ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ range. The efficiency is estimated in the same way as described in Ref.~\cite{LHCb-PAPER-2016-057}. \begin{figure}[!htbp] \begin{center} \includegraphics[width=0.8\linewidth]{./figs/FigS5.pdf} \vspace*{-0.1cm} \end{center} \caption{Dependence of the experimental efficiency on ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$. The error bars include the statistical uncertainties only. }\label{fig:eff} \end{figure} \clearpage \section{Introduction} The strong interaction is one of the fundamental forces of nature and it governs the dynamics of quarks and gluons. According to quantum chromodynamics (QCD), the theory describing the strong interaction, quarks are confined into hadrons, in agreement with experimental observations. The quark model~\cite{GellMann:1964nj,Zweig:352337} classifies hadrons into conventional mesons~(${\ensuremath{\Pq}}\xspace{\ensuremath{\overline \quark}}\xspace$) and baryons~(${\ensuremath{\Pq}}\xspace\quark{\ensuremath{\Pq}}\xspace$ or ${\ensuremath{\overline \quark}}\xspace\quarkbar{\ensuremath{\overline \quark}}\xspace$), and also allows for the existence of exotic hadrons such as tetraquarks~(${\ensuremath{\Pq}}\xspace\quark{\ensuremath{\overline \quark}}\xspace\quarkbar$) and pentaquarks~(${\ensuremath{\Pq}}\xspace\quark{\ensuremath{\Pq}}\xspace{\ensuremath{\overline \quark}}\xspace\quarkbar$). Exotic states provide a unique environment to study the strong interaction and the confinement mechanism~\cite{Brambilla:2014jmp}. The first experimental evidence for an exotic hadron candidate was the $\chi_{c1}(3872)$ state observed in 2003 by the Belle collaboration~\cite{X3872}. Since then a series of novel states consistent with containing four quarks have been discovered~\cite{Olsen:2017bmm}. Recently, the \mbox{LHCb}\xspace collaboration observed resonances interpreted to be pentaquark states~\cite{LHCb-PAPER-2015-029,LHCb-PAPER-2016-009,LHCb-PAPER-2016-015,LHCb-PAPER-2019-014}. All hadrons observed to date, including those of exotic nature, contain at most two heavy charm~(${\ensuremath{\Pc}}\xspace$) or bottom~(${\ensuremath{\Pb}}\xspace$) quarks, whereas many QCD-motivated phenomenological models also predict the existence of states consisting of four heavy quarks, \mbox{\itshape i.e.}\xspace $T_{Q_1 Q_2 \overline{Q}_3 \overline{Q}_4}$, where $Q_i$ is a {\ensuremath{\Pc}}\xspace or a {\ensuremath{\Pb}}\xspace quark~\cite{Iwasaki:1976cn,Chao:1980dv,PhysRevD.25.2370,PhysRevD.29.426,Badalian:1985es, Berezhnoy:2011xn,Wu:2016vtq,Karliner:2016zzc, Barnea:2006sd,Debastiani:2017msn,Liu:2019zuc, Chen:2016jxd, Wang:2019rdo,Bedolla:2019zwg,Lloyd:2003yc, Chen:2020lgj,Wang:2018poa, Anwar:2017toa,Liu:2019zoy,Esposito:2018cwh, Becchi:2020mjz,Bai:2016int,Richard:2017vry,Vega-Morales:2017pmm,Chen:2019vrj,Berezhnoy:2012tu}. Theoretically, the interpretation of the internal structure of such states usually assumes the formation of a $Q_1 Q_2$ diquark and a $\overline{Q}_3\overline{Q}_4$ antidiquark attracting each other. Application of this diquark model successfully predicts the mass of the doubly charmed baryon ${\ensuremath{\Xires^{++}_{\cquark\cquark}}}\xspace$ \cite{Karliner:2014gca, LHCb-PAPER-2017-018} and helps to explain the relative rates of bottom baryon decays~\cite{LHCb-PAPER-2019-039}. Tetraquark states comprising only bottom quarks, $\bbbb$, have been searched for by the \mbox{LHCb}\xspace and \mbox{CMS}\xspace collaborations in the $\PUpsilon{\ensuremath{\Pmu^+\Pmu^-}}\xspace$ decay~\cite{LHCb-PAPER-2018-027,Sirunyan:2020txn}, with the $\PUpsilon$ state consisting of a ${\ensuremath{\Pb}}\xspace {\ensuremath{\overline \bquark}}\xspace$ pair. However, the four-charm states, $\cccc$, have not yet been studied in detail experimentally. A $\cccc$ state could disintegrate into a pair of charmonium states such as ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ mesons, with each consisting of a ${\ensuremath{\Pc}}\xspace {\ensuremath{\overline \cquark}}\xspace$ pair. Decays to a {\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace meson plus a heavier charmonium state, or two heavier charmonium states, with the heavier states decaying subsequently into a {\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace meson and accompanying particles, are also possible. Predictions for the masses of $\cccc$ states vary from $5.8$ to $7.4\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ ~\cite{Iwasaki:1976cn,Chao:1980dv,PhysRevD.25.2370,PhysRevD.29.426,Badalian:1985es,Berezhnoy:2011xn,Wu:2016vtq,Karliner:2016zzc,Barnea:2006sd,Debastiani:2017msn,Liu:2019zuc,Chen:2016jxd,Wang:2019rdo,Bedolla:2019zwg,Lloyd:2003yc,Chen:2020lgj,Wang:2018poa}, which are above the masses of known charmonia and charmonium-like exotic states and below those of bottomonium hadrons.~\footnote{Energy units $\aunit{Me\kern -0.1em V}\xspace=10^{6}\aunit{e\kern -0.1em V}\xspace$, $\aunit{Ge\kern -0.1em V}\xspace=10^{9}\aunit{e\kern -0.1em V}\xspace$ and $\aunit{Te\kern -0.1em V}\xspace=10^{12}\aunit{e\kern -0.1em V}\xspace$ are used in this paper.} This mass range guarantees a clean experimental environment to identify possible $\cccc$ states in the ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair (also referred to as di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$) invariant mass~(${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$) spectrum. In proton-proton ($pp$) collisions, a pair of ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ mesons can be produced in two separate interactions of gluons or quarks, named double-parton scattering\,(DPS)~\cite{Calucci:1997ii,Calucci:1999yz,DelFabbro:2000ds}, or in a single interaction, named single-parton scattering\,(SPS)~\cite{Sun:2014gca,Likhoded:2016zmk,Shao:2012iz,Shao:2015vga,Baranov:2011zz,Lansberg:2013qka,Lansberg:2014swa,Lansberg:2015lva}. The SPS process includes both resonant production via intermediate states, which could be $\cccc$ tetraquarks, and nonresonant production. Within the DPS process, the two ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ mesons are usually assumed to be produced independently, thus the distribution of any di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ observable can be constructed using the kinematics from single ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ production. Evidence of DPS has been found in studies at the Large Hadron Collider (\mbox{LHC}\xspace) experiments~\cite{ W2jets,CMSDJ,DUpsilon,JpsiW,JpsiZ,Aaboud:2016dea,ATLASDJ,LHCb-PAPER-2012-003,LHCb-PAPER-2013-062,LHCb-PAPER-2015-046} and the AFS experiment~\cite{4jets1} in $pp$ collisions, and at the Tevatron\xspace experiments~\cite{Abe:1993rv,Gamma3jets1,Gamma3jets2,Abazov:2014fha,Abazov:2015nnn} and the UA2 experiment~\cite{4jets2} in proton-antiproton collisions. The \mbox{LHCb}\xspace experiment has measured the di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ production in $pp$ collisions at centre-of-mass energies of $\ensuremath{\protect\sqrt{s}}\xspace=7$~\cite{LHCb-PAPER-2011-013} and $13\aunit{Te\kern -0.1em V}\xspace$~\cite{LHCb-PAPER-2016-057}. The DPS contribution is found to dominate the high ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ region, in agreement with expectation. In this paper, fully charmed tetraquark states $\cccc$ are searched for in the di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ invariant mass spectrum, using $pp$ collision data collected by \mbox{LHCb}\xspace at $\ensuremath{\protect\sqrt{s}}\xspace=7, 8$ and $13\aunit{Te\kern -0.1em V}\xspace$, corresponding to an integrated luminosity of $9\ensuremath{\fb^{-1}}\xspace$. The two ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates in a pair are reconstructed through the ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace\ensuremath{\rightarrow}\xspace{\ensuremath{\Pmu^+}}\xspace\mun$ decay, and are labelled randomly as either ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi_1\mskip 2mu}}}\xspace$ or ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi_2\mskip 2mu}}}\xspace$. \section{Detector and data set} The LHCb detector is designed to study particles containing {\ensuremath{\Pb}}\xspace\ or {\ensuremath{\Pc}}\xspace\ quarks at the \mbox{LHC}\xspace. It is a single-arm forward spectrometer covering the pseudorapidity range $2 < \eta < 5$, described in detail in Refs.~\cite{LHCb-DP-2008-001,LHCb-DP-2014-002}. The online event selection is performed by a trigger, which consists of a hardware stage, based on information from the calorimeter and muon systems, followed by a software stage, which applies a full event reconstruction. At the hardware stage, events are required to have at least one muon with high momentum transverse to the beamline, $\ensuremath{p_{\mathrm{T}}}\xspace$. At the software stage, two oppositely charged muon candidates are required to have high \ensuremath{p_{\mathrm{T}}}\xspace and to form a common vertex. Events are retained if there is at least one ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidate passing both the hardware and software trigger requirements. Imperfections in the description of the magnetic field and misalignment of subdetectors lead to a bias in the momentum measurement of charged particles, which is calibrated using reconstructed ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ and $B^+$ mesons~\cite{LHCb-PAPER-2011-035}, with well-known masses. Simulated ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace\ensuremath{\rightarrow}\xspace{\ensuremath{\Pmu^+}}\xspace\mun$ decays are used to study the signal properties, including the invariant mass resolution and the reconstruction efficiency. In the simulation, $pp$ collisions are generated using \mbox{\textsc{Pythia}}\xspace~\cite{Sjostrand:2007gs} with a specific \mbox{LHCb}\xspace configuration~\cite{LHCb-PROC-2010-056}. Decays of unstable particles are described by \mbox{\textsc{EvtGen}}\xspace~\cite{Lange:2001uf}, in which final-state radiation is generated using \mbox{\textsc{Photos}}\xspace~\cite{Golonka:2005pn}. The interaction of the generated particles with the detector and its response are implemented using the \mbox{\textsc{Geant4}}\xspace toolkit~\cite{Allison:2006ve}, as described in Ref.~\cite{LHCb-PROC-2011-006}. \section{Candidate selection} In the offline selection, two pairs of oppositely charged muon candidate tracks are reconstructed, with each pair forming a vertex of a ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidate. Each muon track must have \mbox{$\ensuremath{p_{\mathrm{T}}}\xspace>0.65\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$} and momentum \mbox{$p>6\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$}. The ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates are required to have a dimuon invariant mass in the range $3.0<M_{\mu\mu}<3.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$. A kinematic fit is performed for each {\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace candidate constraining its vertex to coincide with a primary $pp$ collision vertex (PV)~\cite{Hulsbergen:2005pu}. The requirement of a good kinematic fit quality strongly suppresses the contamination of di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates stemming from feed-down of ${\ensuremath{\Pb}}\xspace$-hadrons, which decay at displaced vertices. The four muon tracks in a ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair candidate are required to originate from the same PV, reducing to a negligible level the number of pile-up candidates with the two ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates produced in separated $pp$ collisions. Fake di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates, comprising two muon-track candidates reconstructed from the same real particle, are rejected by requiring muons of the same charge to have trajectories separated by an angle inconsistent with zero. For events with more than one reconstructed di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidate, accounting for about 0.8\% of the total sample, only one pair is randomly chosen. \begin{figure}[t] \begin{center} \includegraphics[width=1.0\linewidth]{./figs/Fig1.pdf} \vspace*{-1.cm} \end{center} \caption{\small (Bottom right) Two-dimensional \mbox{$(M^{(1)}_{\mu\mu},M^{(2)}_{\mu\mu})$} distribution of di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates and its projections on (bottom left)~$M^{(1)}_{\mu\mu}$ and (top)~$M^{(2)}_{\mu\mu}$. Four components are present as each projection consists of signal and background ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates. The labels ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace_{1,2}$ and bkg${}_{1,2}$ represent the signal and background contributions, respectively, in the $M^{(1),(2)}_{\mu\mu}$ distribution. }\label{fig:2DM} \end{figure} The di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ signal yield is extracted by performing an extended unbinned maximum-likelihood fit to the two\nobreakdash-dimensional distribution of ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi_1\mskip 2mu}}}\xspace$ and ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi_2\mskip 2mu}}}\xspace$ invariant masses, \mbox{$(M^{(1)}_{\mu\mu},M^{(2)}_{\mu\mu})$}, as displayed in Fig.~\ref{fig:2DM}, where projections of the data and the fit result are shown. For both ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates, the signal mass shape is modelled by a Gaussian kernel with power-law tails~\cite{Skwarnicki:1986xj}. Each component of combinatorial background, consisting of random combinations of muon tracks, is described by an exponential function. The total di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ signal yield is measured to be \mbox{$(33.57\pm0.23)\times10^3$}, where the uncertainty is statistical. The di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ transverse momentum (${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$) in SPS production is expected to be, on average, higher than that in DPS~\cite{Lansberg:2014swa}. The high-${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ region is thus exploited to select a data sample with enhanced SPS production, which could include contributions from $\cccc$ states. Two different approaches are applied. In the first approach~(denoted as ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-threshold), ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair candidates are selected with the requirement ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace>5.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$, which maximises the statistical significance of the SPS signal yield, $N_{\rm SPS}/\sqrt{N_{\rm total}}$. $N_{\rm SPS}$ and $N_{\rm total}$ are yields of the SPS component and total di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates in the ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ range between $6.2$ and $7.4\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$, respectively. This mass region covers the predicted masses of $\cccc$ states decaying into a ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ pair. In the second approach~(denoted as ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-binned), di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates are categorised into six ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ intervals with boundaries $\left\{ 0, 5, 6, 8, 9.5, 12, 50 \right\}\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$, defined to obtain equally populated bins of SPS signal events in the $6.2<{\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace<7.4\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ range. For both scenarios, the DPS yield in the $\cccc$ signal region is extrapolated from the high-${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ region using the wide-range distribution constructed from available double-differential {\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace cross-sections~\cite{LHCb-PAPER-2011-003,LHCb-PAPER-2013-016,LHCb-PAPER-2015-037} as performed in~\cite{LHCb-PAPER-2016-057}. The high-${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ region is chosen such that the SPS yield is negligible compared to DPS. The SPS yield is obtained by subtracting the DPS contribution from the total number of ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair signals. The ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ distribution for candidates with \mbox{${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace>5.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$} and \mbox{$3.065< M_{\mu\mu}^{(1),(2)}<3.135\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$} is shown in Fig.~\ref{fig:Xmass}. The di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ mass is calculated by constraining the reconstructed mass of each ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidate to its known value~\cite{PDG2019}. The spectrum shows a broad structure just above twice the ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ mass threshold ranging from $6.2$ to $6.8\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ (dubbed threshold enhancement in the following) and a narrower structure at about $6.9\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$, referred to hereafter as $X(6900)$. There is also a hint of another structure around $7.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$, whereas there are no evident structures at higher invariant mass. Several cross-checks are performed to investigate the origin of these structures and to exclude that they are experimental artifacts. The threshold enhancement and the $X(6900)$ structure become more pronounced in higher ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ intervals, and they are present in subsamples split according to different beam or detector configurations for data collection. The structures are not caused by the experimental efficiency, since the efficiency variation across the whole ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ range is found to be marginal. Residual background, in which a muon track is reused or at least one {\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace candidate is produced from a ${\ensuremath{\Pb}}\xspace$-hadron decay, is observed to have no structure. The possible contribution of ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ pairs from ${\ensuremath{\PUpsilon}}\xspace$ decays is estimated to be negligible and distributed uniformly in the ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ distribution. In Fig.~\ref{fig:Xmass}, the ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ distribution for background pairs with $M_{\mu\mu}^{(1),(2)}$ in the range $3.00-3.05\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ or $3.15-3.20\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ is also shown, with the yield normalised by interpolating the background into the ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ signal region, which accounts for around 15\% of the total candidates. There is no evidence of structures in the ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ distribution of background candidates. \begin{figure}[htb!] \begin{center} \includegraphics[width=0.6\linewidth]{./figs/Fig2.pdf} \vspace*{-0.1cm} \end{center} \caption{\small Invariant mass spectrum of ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair candidates passing the ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace>5.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$ requirement with reconstructed ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ masses in the (black)~signal and (blue)~background regions, respectively. }\label{fig:Xmass} \end{figure} \section{Investigation of the ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair invariant mass spectrum} To remove background pairs that have at least one background {\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace candidate, the \mbox{\em sPlot}\xspace weighting method~\cite{Pivk:2004ty} is applied, where the weights are calculated from the fit to the two\nobreakdash-dimensional \mbox{$(M^{(1)}_{\mu\mu},M^{(2)}_{\mu\mu})$} distribution. The background-subtracted di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ spectra in the range \mbox{$6.2<{\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace<9.0\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$} are shown in Fig.~\ref{fig:fitXcut} for candidates with ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace>5.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$ and~Fig.~\ref{fig:fitXbinned_2peak} for candidates in the six ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ intervals, which are investigated by weighted unbinned maximum-likelihood fits~\cite{Xie:2009rka}. The ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ distribution of signal events is expected to be dominated by the sum of the nonresonant SPS~(NRSPS) and DPS production, which have smooth shapes~(referred to as continuum in the following). The DPS continuum is described by a two-body phase-space function multiplied by the product of an exponential function and a second order polynomial function, whose parameters are fixed according to the ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ distribution constructed from ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ differential cross-sections. Its yield is determined by extrapolation from the ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace>12\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ region, which is dominated and well described by the DPS distribution. The continuum NRSPS is modelled by a two-body phase-space distribution multiplied by an exponential function determined from the data. The combination of continuum NRSPS and DPS does not provide a good description of the data, as is illustrated in Fig.~\ref{fig:fitXcut}(a). The ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ spectrum in the data is tested against the hypothesis that only NRSPS and DPS components are present in the range $6.2<{\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace<7.4\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ (null hypothesis) using a $\ensuremath{\chi^2}\xspace$ test statistic. Pseudoexperiments are generated and fitted according to the null hypothesis, and the fraction of these fits with a $\ensuremath{\chi^2}\xspace$ value exceeding that in the data is converted into a significance. Considering the sample in the ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace>5.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$ region, the null hypothesis is inconsistent with the data at $3.4$ standard deviations ($\sigma$). A test performed simultaneously in the aforementioned six ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ regions yields a discrepancy of $6.0\,\sigma$ with the null hypothesis. A higher value is obtained in the latter case attributed to the presence of the structure at the same ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ location in different ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ intervals. A cross-check is performed by dividing the data into five or seven ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ regions instead, which results in significance values consistent with the nominal $6.0\,\sigma$. The significance values are summarised in Table~\ref{tab:signif}~(Any structure beyond NRSPS plus DPS). The structures in the ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ distribution can have various interpretations. There may be one or more resonant states $\cccc$ decaying directly into a pair of ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ mesons, or $\cccc$ states decaying into a pair of ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ mesons through feed-down of heavier quarkonia, for example $\cccc\ensuremath{\rightarrow}\xspace{\ensuremath{\Pchi_\cquark}}\xspace(\ensuremath{\rightarrow}\xspace{\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace\gamma){\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ where the photon escapes detection. In the latter case, such a state would be expected to peak at a lower ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ position, close to the di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ mass threshold, and its structure would be broader compared to that from a direct decay. This feed-down is unlikely an explanation for the narrow $X(6900)$ structure. Rescattering of two charmonium states produced by SPS close to their mass threshold may also generate a narrow structure ~\cite{Braaten:2020iye,Liu:2015fea,Xie:2016lvs,Guo:2016bjq}. The two thresholds close to the $X(6900)$ structure could be formed by ${\ensuremath{\Pchi_{\cquark 0}}}\xspace\chiczero$ pairs at $6829.4\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace$ and ${\ensuremath{\Pchi_{\cquark 1}}}\xspace{\ensuremath{\Pchi_{\cquark 0}}}\xspace$ pairs at $6925.4\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace$, respectively. Whereas a resonance is often described by a relativistic Breit--Wigner (BW) function~\cite{PDG2019}, the lineshape of a structure with rescattering effects taken into account is more complex. In principle, resonant production can interfere with NRSPS of the same spin-parity quantum numbers~($J^\mathrm{PC}$), resulting in a coherent sum of the two components and thus a modification of the total ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ distribution. Two different models of the structure lineshape providing a reasonable description of the data are investigated. The $X(6900)$ lineshape parameters and yields are derived from fits to the ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-threshold sample. Simultaneous ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-binned fits are also performed as a cross-check and the variation of lineshape parameters is considered as a source of systematic uncertainties. Due to its low significance, the structure around $7.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ has been neglected. In model I, the $X(6900)$ structure is considered as a resonance, whereas the threshold enhancement is described through a superposition of two resonances. The lineshapes of these resonances are described by $S$-wave relativistic BW functions multiplied by a two-body phase-space distribution. The experimental resolution on ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ is below $5\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace$ over the full mass range and negligible compared to the widths of the structures. The projections of the ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-threshold fit using this model are shown in Fig.~\ref{fig:fitXcut}(b). The mass, natural width and yield are determined to be \mbox{$m[X(6900)]=6905\pm11\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace$}, \mbox{$\Gamma[X(6900)]=80\pm19\aunit{Me\kern -0.1em V}\xspace$} and \mbox{$N_{\rm sig}=252\pm63$}, where biases on the statistical uncertainties have been corrected using a bootstrap method~\cite{Langenbruch:2019nwe}. The goodness of fit is studied using a $\ensuremath{\chi^2}\xspace$ test statistic and found to be $\ensuremath{\chi^2}\xspace/{\rm ndof}=112.7/89$, corresponding to a probability of $4.6\%$. The fit is also performed assuming the threshold enhancement as due to a single wide resonance (see Supplementary Material); the fit quality is found significantly poorer and thus this model is not further investigated. \begin{figure}[htb!] \begin{center} \sidesubfloat[]{\includegraphics[width=0.48\linewidth]{./figs/Fig3a.pdf}}\\ \sidesubfloat[]{\includegraphics[width=0.48\linewidth]{./figs/Fig3b.pdf}} \sidesubfloat[]{\includegraphics[width=0.48\linewidth]{./figs/Fig3c.pdf}} \vspace*{-0.1cm} \end{center} \caption{\small Invariant mass spectra of weighted di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates with ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace>5.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$ and overlaid projections of the ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-threshold fit using (a)~the NRSPS plus DPS model, (b) model I, and (c) model II. }\label{fig:fitXcut} \end{figure} A comparison between the best fit result of model I and the data reveals a tension around $6.75\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$, where the data shows a dip. In an attempt to describe the dip, model II allows for interference between the NRSPS component and a resonance for the threshold enhancement. The coherent sum of the two components is defined as \begin{equation} \label{eq:itf} \left| A e^{i\phi} \sqrt{f_{\rm nr}({\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace)} + {\rm BW}({\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace) \right|^2, \end{equation} where $A$ and $\phi$ are the magnitude and phase of the nonresonant component, relative to the BW lineshape for the resonance, assumed to be independent of ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$, and $f_{\rm nr}({\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace)$ is an exponential function. The interference term in Eq.~(\ref{eq:itf}) is then added incoherently to the BW function describing the X(6900) structure and the DPS description. The fit to the ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-threshold sample with this model has a probability of $15.5\%$~($\ensuremath{\chi^2/\mathrm{ndf}}\xspace=104.7/91$), and its projections are illustrated in Fig.~\ref{fig:fitXcut}(c). In this case, the mass, natural width and yield are determined to be \mbox{$m[X(6900)]=6886\pm11\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace$}, \mbox{$\Gamma[X(6900)]=168\pm33\aunit{Me\kern -0.1em V}\xspace$} and \mbox{$N_{\rm sig}=784\pm148$}. A larger $X(6900)$ width and yield are preferred in comparison to model I. Here it is assumed that the whole NRSPS production is involved in the interference with the lower-mass resonance despite that there may be several components with different quantum numbers in the NRSPS and more than one resonance in the threshold enhancement. Fits to the ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ distributions in the six individual ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ bins are shown in Fig.~\ref{fig:fitXbinned_2peak} for model I, while those for model II are given in the Supplementary Material. An additional model describing the dip and the $X(6900)$ structure simultaneously by using the interference between the NRSPS and a BW resonance around $6.9\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ is also considered, however the fit quality is clearly poorer, as illustrated in the Supplementary Material. Alternative lineshapes, other than the BW, may also be possible to describe these structures and will be the subject of future studies. \begin{figure}[!tb] \begin{center} \sidesubfloat[]{\includegraphics[width=0.45\linewidth]{./figs/Fig4a.pdf}} \sidesubfloat[]{\includegraphics[width=0.45\linewidth]{./figs/Fig4b.pdf}}\\ \sidesubfloat[]{\includegraphics[width=0.45\linewidth]{./figs/Fig4c.pdf}} \sidesubfloat[]{\includegraphics[width=0.45\linewidth]{./figs/Fig4d.pdf}}\\ \sidesubfloat[]{\includegraphics[width=0.45\linewidth]{./figs/Fig4e.pdf}} \sidesubfloat[]{\includegraphics[width=0.45\linewidth]{./figs/Fig4f.pdf}}\\ \vspace*{-0.1cm} \end{center} \caption{\small Invariant mass spectra of weighted di-${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ candidates in bins of ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ and overlaid projections of the ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-binned fit with model I. }\label{fig:fitXbinned_2peak} \end{figure} The increase of the likelihood between the fits with or without considering the $X(6900)$ and the threshold enhancement structures on top of the continuum NRSPS plus DPS model is taken as the test statistic to calculate the combined global significance of the two structures~\cite{Cowan:2010js} in the \mbox{$6.2<{\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace<7.4\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$} region, where pseudoexperiments are also generated to evaluate the significance. Only model I is studied, where the interference between the NRSPS and the threshold enhancement is not included. Similarly, the significance for either the threshold enhancement or the $X(6900)$ structure is evaluated assuming the presence of the other along with the NRSPS and DPS continuum. The significance is determined from both ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-threshold and ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-binned fits, and summarised in Table~\ref{tab:signif}. The results are above $5\,\sigma$ for the two structures, with slightly higher significance for the ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-binned case. \begin{table}[!tb] \caption{\small Global significance evaluated under the various assumptions described in the text. }\label{tab:signif} \begin{center} \begin{tabular}{c|c|c} \toprule \multirow{2}{*}{Structure} & \multicolumn{2}{c}{Significance} \\ & ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-threshold & ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$-binned \\ \hline Any structure beyond NRSPS plus DPS & $3.4\,\sigma$ & $6.0\,\sigma$ \\ \hline Threshold enhancement plus $X(6900)$ & $6.4\,\sigma$ & $6.9\,\sigma$ \\ Threshold enhancement & $6.0\,\sigma$ & $6.5\,\sigma$ \\ $X(6900)$ & $5.1\,\sigma$ & $5.4\,\sigma$ \\ \bottomrule \end{tabular} \end{center} \end{table} \begin{table}[!tb] \caption{\small Systematic uncertainties on the mass~($m$) and natural width~($\Gamma$) of the $X(6900)$ structure. }\label{tab:sys} \begin{center} \begin{tabular}{c|cc|cc} \toprule & \multicolumn{2}{c|}{Without interference} & \multicolumn{2}{c}{With interference} \\ Component & $m$~[$\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace$] & $\Gamma$~[$\aunit{Me\kern -0.1em V}\xspace$] & $m$~[$\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace$] & $\Gamma$~[$\aunit{Me\kern -0.1em V}\xspace$] \\ \hline \mbox{\em sPlot}\xspace weights & 0.8 & 10.3 & 4.4 & 36.9 \\ Experimental resolution & 0.0 & 1.4 & 0.0 & 0.6 \\ NRSPS+DPS modelling & 0.8 & 16.1 & 3.5 & 9.3 \\ $X(6900)$ shape & 0.0 & 0.3 & 0.4 & 0.2 \\ Dependence on ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ & 4.6 & 13.5 & 6.2 & 56.7 \\ ${\ensuremath{\Pb}}\xspace$-hadron feed-down & 0.0 & 0.2 & 0.0 & 5.3 \\ Structure at $7.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ & 1.3 & 9.2 & 6.7 & 5.2 \\ Threshold structure shape & 5.2 & 20.5 & -- & -- \\ NRSPS phase & -- & -- & 0.3 & 1.3 \\ \hline Total & 7 & 33 & 11 & 69 \\ \bottomrule \end{tabular} \end{center} \end{table} Systematic uncertainties on the measurements of the mass and natural width of the $X(6900)$ structure are reported in Table~\ref{tab:sys}. They include variations of the results obtained by: including an explicit component in the ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ fits for the {\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace combinatorial background rather than subtracting it using the weighting method (\mbox{\em sPlot}\xspace weights in Table~\ref{tab:sys}); convolving the ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ fit functions with a Gaussian function of $5\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace$ width to account for the invariant mass resolution (Experimental resolution); using alternative functions to describe the NRSPS component and varying the DPS yield (NRSPS plus DPS modelling); using an alternative $P$-wave BW function for the $X(6900)$ structure and varying the hadron radius in the BW function from $2$ to $5\aunit{Ge\kern -0.1em V}\xspace^{-1}$ [$X(6900)$ shape]; obtaining results from a simultaneous fit to the ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ distributions in the six ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ bins which covers the uncertainty due to variations of the NRSPS, DPS shapes and the NRSPS-resonance interference with respect to ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ (Dependence on ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$); including an explicit contribution for {\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace mesons from ${\ensuremath{\Pb}}\xspace$-hadron feed-down ($b$-hadron feed-down) or adding a BW component for the $7.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ structure (Structure at $7.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$); modelling the threshold structure using an alternative Gaussian function with asymmetric power-law tails, or fitting in a reduced ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ range excluding the threshold structure (Threshold structure shape); allowing the relative phase in the NRSPS component to vary linearly with ${\ensuremath{M_{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ (NRSPS phase). The total uncertainties are determined to be $7\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace$ and $33\aunit{Me\kern -0.1em V}\xspace$ for the mass and natural width, respectively, without considering any interference, and $11\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace$ and $69\aunit{Me\kern -0.1em V}\xspace$ when the interference between NRSPS and the threshold structure is introduced. For the scenario without interference, the production cross-section of the $X(6900)$ structure relative to that of all ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ pairs~(inclusive), times the branching fraction ${\ensuremath{\mathcal{B}}}\xspace(X(6900)\ensuremath{\rightarrow}\xspace{\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace\jpsi)$, $\mathcal{R}$, is determined in the $pp$ collision data at $\ensuremath{\protect\sqrt{s}}\xspace=13\aunit{Te\kern -0.1em V}\xspace$. The measurement is obtained for both ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$ mesons in the fiducial region of transverse momentum below $10\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$ and rapidity between $2.0$ and $4.5$. An event-by-event efficiency correction is performed to obtain the signal yield at production. The residual contamination from ${\ensuremath{\Pb}}\xspace$-hadron feed-down is subtracted from inclusive ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair production following Ref.~\cite{LHCb-PAPER-2015-037}. The systematic uncertainties on the $X(6900)$ yield are estimated in a similar way to that for the mass and natural width, while other systematic uncertainties mostly cancel in the ratio. The production ratio is measured to be \mbox{$\mathcal{R}=[1.1\pm0.4\aunit{(stat)}\xspace\pm0.3\aunit{(syst)}\xspace]\%$} without any ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace$ requirement and \mbox{$\mathcal{R}=[2.6\pm0.6\aunit{(stat)}\xspace\pm0.8\aunit{(syst)}\xspace]\%$} for ${\ensuremath{p^{{\rm di}{\text -}\PJ\mskip -3mu/\mskip -2mu\Ppsi}_{\rm T}}}\xspace>5.2\ensuremath{\aunit{Ge\kern -0.1em V\!/}c}\xspace$. \section{Summary} In conclusion, using $pp$ collision data at centre-of-mass energies of $7$, $8$ and $13\aunit{Te\kern -0.1em V}\xspace$ collected with the \mbox{LHCb}\xspace detector, corresponding to an integrated luminosity of $9\ensuremath{\fb^{-1}}\xspace$, the ${\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace$-pair invariant mass spectrum is studied. The data in the mass range between $6.2$ and $7.4\ensuremath{\aunit{Ge\kern -0.1em V\!/}c^2}\xspace$ are found to be inconsistent with the hypothesis of NRSPS plus DPS continuum. A narrow structure, $X(6900)$, matching the lineshape of a resonance and a broad structure next to the di-{\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace mass threshold are found. The global significance of either the broad or the $X(6900)$ structure is determined to be larger than five standard deviations. Describing the $X(6900)$ structure with a Breit--Wigner lineshape, its mass and natural width are determined to be \begin{equation*} m[X(6900)]=6905\pm11\pm7\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace \end{equation*} and \begin{equation*} \Gamma[X(6900)]=80\pm19\pm33\aunit{Me\kern -0.1em V}\xspace, \end{equation*} assuming no interference with the NRSPS continuum is present, where the first uncertainty is statistical and the second systematic. When assuming the NRSPS continuum interferes with the broad structure close to the di-{\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace mass threshold, they become \begin{equation*} m[X(6900)]=6886\pm11\pm11\ensuremath{\aunit{Me\kern -0.1em V\!/}c^2}\xspace \end{equation*} and \begin{equation*} \Gamma[X(6900)]=168\pm33\pm69\aunit{Me\kern -0.1em V}\xspace. \end{equation*} The $X(6900)$ structure could originate from a hadron state consisting of four charm quarks, $\cccc$, predicted in various tetraquark models. The broad structure close to the di-{\ensuremath{{\PJ\mskip -3mu/\mskip -2mu\Ppsi}}}\xspace mass threshold could be due to a mixture of multiple four-charm quark states or have contributions from feed-down decays of four-charm states through heavier quarkonia. Other interpretations cannot presently be ruled out, for example the rescattering of two charmonium states produced close to their mass threshold. More data along with additional measurements, including determination of the spin-parity quantum numbers and $\ensuremath{p_{\mathrm{T}}}\xspace$ dependence of the production cross-section, are needed to provide further information about the nature of the observed structure.
\section{Introduction} \begin{comment} XXX OHDSI : ``real world data and evidence'', but not necessarily on comparable data due to the absence of randomization, contrary to clinical trials. In that sense, trial data is of a higher quality. XXX network meta-analyses \citep{Zarin2017} XXX VisualDecisionLinc: A visual analytics approach for comparative effectiveness-based clinical decision support in psychiatry \citep{visumed-fouillededonnees-dossierpatient-aidedecision} \end{comment} Clinical trials are the basis of Evidence-Based Medicine (EBM) \citep{Sheridan2016}. In particular, they provide evidence of the efficacy and the safety of drug treatments. Trial results are reviewed by medical experts and consensus panels during the process of performing meta-analyses and writing clinical practice guidelines. These processes remain widely manual and based on human expertise. However, reviewing trial results is a tedious task, and the independence of experts is somehow questionable \citep{Moynihan2008}, \emph{e.g.} it has been shown that up to 90\% of guidelines authors have ties to drug firms \citep{Cosgrove2013}. Independent experts are rare: to be an expert, one has to work on industry-funded trials, and disclosing links of interests does not necessarily prevent biases \citep{Elliott2009}. Beyond independence, human expertise is not reproducible \citep{Baker2016}, leading to variability in the recommendations across countries and organizations \citep{Cosgrove2013}. Finally, the analysis of trial data relies heavily on statistical methods that have known limits \citep{Gelman2006,Cerrito2011}, \emph{e.g.} a significant difference may actually be very small. For example, a recent meta-analysis on tapentadol, a new opioid drug for acute pain, included 8 randomized clinical trials and 3,706 patients, and showed that tapentadol was associated with fewer gastrointestinal adverse drug events (ADE) \citep{Wang2020}. However, such a meta-analysis requires months of tedious expert work \citep{Valkenhoef2012}, and is not updated each time a new trial is published. Moreover, clinicians might have difficulties to assess the quality of the study and the independence of the authors, despite two investigators were involved in the process. Indeed, lack of confidence and trust, and lack of time to appraise evidence have been identified as barriers to the use of EBM by GPs \citep{Zwolsman2012}.% \begin{comment} For instance, the aforementioned study claims that tapentadol has fewer digestive ADE than other opioids, but the meta-analysis actually considered only a single other opioid, oxycodone, other options being only discussed qualitatively. \end{comment} In many domains, the advent of data science, big data and visual analytics allowed moving from \emph{expert}-based to \emph{fact}-based knowledge \citep{Daniel2016}. These methods have been shown to be efficient for the analysis of medical risk \citep{Cerrito2011}. Today, regarding clinical trials, a lot of data is publicly available. Trial registration is mandatory since 2005 (International Committee of Medical Journal Editors) and 2008 (revised Declaration of Helsinki). Moreover, the publication of most trial results is mandatory in the US since 2017 (FDAAA 801, Final Rule). In May 2020, more than 42,000 study results are available in ClinicalTrials.gov, the largest trial registry. Nevertheless, methods from the field of data science have not yet been widely applied to clinical trial data. This may be explained by the fact that the full, per-patient, outcomes data are not publicly available. Only aggregated data are available in trial registries, such as the number of patients having a given ADE or the mean value of a biological marker. However, data science methods are often not suited for such aggregated data, and in particular the data aggregation prevents the application of machine learning algorithms, \emph{e.g.} one cannot learn a model to predict patient outcomes from patient characteristics using aggregated data. Consequently, the automated computer-based treatment of publicly available trial data is particularly challenging. In previous studies, we showed that semantic web technologies and visual analytics were an interesting option for accessing and comparing drug knowledge \citep{Lamy2017} and for ranking and visualizing the properties of antibiotic agents \citep{Tsopra2018_2,Lamy2020_2,Tsopra2019_2}. Here, our hypothesis is that similar methods could be applied to aggregated trial result data found in trial registries, and could complement the currently used statistical methods. Information visualization and visual analytics have been proposed as a solution to deal with mass of data in medicine \citep{visumed-infovisumed}. Two strategies can be distinguished when designing visual analytics-based systems. The first one consists of using well-known generic visual techniques, often in combination. For example, W. Wang \emph{et al.} \citep{Wang2020_2} applied interactive bubble charts and scatter plots to non-aggregated trial safety data. H. Ltifi \emph{et al.} \citep{Ltifi2020} combined graphs and 3D bar charts for the analysis of nosocomial infections in intensive care units. D.J. Feller \emph{et al.} \citep{Feller2018} combined heatmaps and density plots in Glucolyzer, a tool for helping dieticians identify patterns between blood glucose levels and meal composition in type 2 diabetes. ClinOmicsTrailbc \citep{Schneider2019} combined radar charts, scatter plots, histograms and circular sun plots for breast cancer treatment stratification. The second strategy, more rarely employed, consists of designing visual approaches that are specifically adapted to the desired domain. As stated by L. Chittaro \citep{visumed-infovisumed}, a key research problem is to discover new visual metaphors for representing medical information and to understand what task they can support. For example, CareVis \citep{visumed-gbp-plan} proposed a novel PlanningLine glyph for visualizing temporal care plan. J.M. Juarez \emph{et al.} \citep{Juarez2015} designed a multiple temporal axis model for the visualization of the activity of a single patient for homecare monitoring. J. Bernard \emph{et al.} \citep{Bernard2019} designed a specific dashboard for representing patient history, and used dashboard networks for visualizing multiple patients histories. Here, we will propose a specific visual metaphor for viewing and comparing ADE rates, grouped in 13 categories. In the previous example on tapentadol, data science methods may be used to easily and automatically produce rapid results on ADE rates. A data mining platform may contain all ADE observed during trials with publicly available results. A semantic search engine may allow to automatically search for trials testing tapentadol or other opioids for acute pain. Finally, the platform may aggregate and compare the results of the retrieved trials, using specifically designed visual analytics, showing within minutes that tapentadol has a lower risk of digestive ADE. Of course, the generated evidence will still need to be interpreted, and it would not have the strength of a full meta-analysis. Nevertheless, such a platform could help experts while performing meta-analyses, allowing to quickly test various hypotheses (\emph{e.g.} what about comparing tapentadol to morphine?). In addition, it could also be used by non-expert clinicians for verifying the results of a published meta-analysis and assessing its reproducibility, or for obtaining up-to-date results including the latest studies. The objective of this work is to design a web platform for the semantic and visual mining of ADE observed in clinical trials and published in trial registries, and to apply this platform to pain treatments. This platform aims at helping experts and clinicians, but also at illustrating what data science applied to trial public data may bring to drug safety. The rest of the paper is organized as follows. Section \ref{sec:Related-works} describes related works on trial data and visualization. Section \ref{sec:Materials_and_methods} describes the methods used for building the platform, including trial selection, ontology modeling and population, ontology querying, data correction and normalization, and visualization. Section \ref{sec:Results} presents the resulting ontology of pain treatment ADE and the proposed platform, and details several use cases and the comments of experts in drug safety. Section \ref{sec:Discussion} discusses the methods and the results, and, finally, section \ref{sec:Conclusion} concludes with perspectives. \begin{comment} Clinical trials are the basis of Evidence-Based Medicine (EBM) \citep{Sheridan2016}. In particular, they provide evidence of the efficacy and the safety of drug treatments. Trial results are reviewed by medical experts and consensus panels during the process of approving drugs for marketing, and writing clinical practice guidelines. These processes remain widely manual and based on human expertise. However, reviewing trial results is a tedious task, and the independence of experts is somehow questionable \citep{Moynihan2008}, \emph{e.g.} it has been shown that up to 90\% of guidelines authors have ties to drug firms \citep{Cosgrove2013}. Independent experts are rare: to be an expert, one has to work on industry-funded trials, and disclosing links of interests does not necessarily prevent biases \citep{Elliott2009}. Beyond independence, human expertise is not reproducible \citep{Baker2016}, leading to variability in the recommendations across countries and organizations \citep{Cosgrove2013}. In many domains, the advent of data science, big data and visual analytics allowed moving from \emph{expert}-based to \emph{fact}-based knowledge \citep{Daniel2016}. These methods have been shown to be efficient for the analysis of medical risk \citep{Cerrito2011}. Today, the data of many clinical trials is publicly available. Trial registration is mandatory since 2005 (International Committee of Medical Journal Editors) and 2008 (revised Declaration of Helsinki). Moreover, the publication of most trial results is mandatory in the US since 2017 (FDAAA 801, Final Rule). Trial registries include ClinicalTrials.gov in the US and EUCTR in Europe. In may 2020, more than 42,000 study results are available in ClinicalTrials.gov. However, the analysis of trial results still relies heavily on human expertise and statistical methods that have known limits \citep{Gelman2006,Cerrito2011}, \emph{e.g.} a significant difference may actually be very small. On the contrary, methods from the field of data science are yet to apply to clinical trial data. In previous studies, we showed that semantic web technologies and visual analytics were an interesting option for accessing and comparing drug knowledge \citep{Lamy2017} and for ranking and visualizing the properties of antibiotic agents \citep{Tsopra2018_2,Lamy2020_2,Tsopra2019_2}. Similar methods could also be applied to trial result data found in trial registries, and might complement the currently used statistical methods, such as meta-analyses. The objective of this work is to design a web platform for the semantic and visual mining of ADE observed in clinical trials, and to apply this platform to pain treatments. For example, a recent meta-analysis on tapentadol, a new opioid drug for acute pain, included 8 randomized clinical trials and 3,706 patients, and showed that tapentadol was as effective as other opioids, but associated with fewer gastrointestinal adverse drug events (ADE) \citep{Wang2020}. However, such a meta-analysis requires months of expert work, and is not updated each time a new trial is published. On the contrary, data science methods may provide easier and faster results. For instance, a data mining platform may contain all ADE observed during trials with publicly available results. A semantic search engine may allow to automatically search for trials testing tapentadol or other opioids for acute pain. Finally, the platform may aggregate and compare the results of the retrieved trials, showing within minutes that tapentadol has a lower risk of digestive ADE. Of course, the generated evidence will still need to be interpreted, and it would not have the strength of a full meta-analysis. Nevertheless, such a platform could help experts while performing meta-analyses, allowing to quickly test various hypotheses (\emph{e.g.} what about tapentadol for non-acute pain?). In addition, it could also be used by non-expert clinicians for verifying the results of a published meta-analysis and assessing its reproducibility, or for obtaining up-to-date results. The rest of the paper is organized as follows. Section \ref{sec:Related-works} describes related works on trial data and visualization. Section \ref{sec:Materials_and_methods} describes the methods used for building the platform, including trial selection, ontology modeling and population, ontology querying, data correction and normalization, and visualization. Section \ref{sec:Results} presents the resulting ontology of pain treatment ADE and the proposed platform, and details several use cases. Section \ref{sec:Discussion} discusses the methods and the results, and, finally, section \ref{sec:Conclusion} concludes with perspectives. \end{comment} \section{\label{sec:Related-works}Related works} \subsection{Usage of clinical trial registries} Clinical trial data is available publicly in online registries, such as ClinicalTrials.gov \citep{Zarin2011}. For some trials, it includes trial results, with the list of ADE observed in the various patient groups of the study. Today, trial registries are used for systematic reviews \citep{Honig2010} and network meta-analyses \citep{Zarin2017,Rudroju2013}, comparing several treatments by chaining trial results. But the efforts to standardize information from trials have not yet resulted in improvements in the dissemination of trial evidence \citep{Valkenhoef2012}. Similarly, in drug safety, many works focused on clinical data collection from EHR and hospitals, but a recent review \citep{Natsiavas2019} highlighted that most of these works focused on extracting, representing and integrating information, rather than the use and the dissemination of this information. For instance, C. Zhan \emph{et al.} applied computational methods to prescription data for detecting ADE signals \citep{Zhan2020}. On the contrary, clinical trial data is mostly analyzed with statistical methods, and few computational methods were proposed. A few pioneering works focused on the direct use of trial data. I. Atal \emph{et al.} proposed a visual approach for viewing on a mapping the research effort and the health needs of low-income regions \citep{Atal2018}. J. Warner \emph{et al.} proposed a network visualization of chemotherapy treatment regimens \citep{Warner2013}. Z. He \emph{et al.} proposed the use of text mining, bar charts and diagrams for the analysis of clinical trial target populations \citep{He2015}. Finally, J. Sjöbergh \emph{et al.} combined maps, parallel coordinates and diagrams for visualizing the individual patient data in a single trial \citep{Sjobergh2012}. Ontologies and semantic web technologies consist of formal and unambiguous models; they have been widely applied to the medical domain \citep{Schulz2013}. An ontology was proposed for structuring clinical trial data, named OCRe \citep{Sim2013}. However, this ontology is very complex, and no tool exists for the automatic population of the ontology from trial registries. \subsection{\label{subsec:Multidimensional-visualization-t}Multidimensional visualization techniques} Many techniques exist for the visualization of multidimensional numeric data; in this section we will briefly review the three main approaches. First, \emph{dimension reduction} consists of reducing the number of dimensions to 2 or 3, at the price of an information loss. Then, the data can be visualized using a simple scatter plot. The main dimension reduction techniques are Principal Component Analysis (PCA), Multidimensional Scaling (MDS) \citep{Borg2013_2}, Self-Organizing Map (SOM) \citep{Kohonen1995} and t-distributed Stochastic Neighbor Embedding (t-SNE) \citep{van2008}. Dimension reduction techniques are particularly useful for grouping similar items in clusters. t-SNE is commonly used in bioinformatics, \emph{e.g.} for the visualization of transcriptomic \citep{Cieslak2020}, but in medicine, it was also used for the classification of patients with Parkinson's disease \citep{Oliveira2018}. Second, parallel coordinates \citep{Inselberg2009} consist of representing each dimension by a parallel axis (usually vertical), and each data point by a broken line that crosses each axis at the corresponding value of the point in that dimension. Parallel coordinates are often associated with interactive interfaces allowing the selection of a subset of data points. They are particularly good at facilitating the discovery of patterns across the dimensions. Recently, parallel coordinates were proposed for the study of exposure to oxides of nitrogen and its relation to adverse birth outcomes \citep{Mitku2020}. Other applications include the visualization of multi-omics networks \citep{Kanai2018}. \begin{figure} \noindent \begin{centering} \includegraphics[width=1\columnwidth]{exemples_glyphes} \par\end{centering} \caption{\label{fig:ex_glyphs}Examples of star glyphs (left) and flower glyphs (right). Dimension axes are commonly omitted, especially in flower glyphs.} \end{figure} Third, glyphs consist of representing each data point by a small icon called a glyph, and each dimension by a characteristic of the glyph, \emph{e.g.} the length or the color of a given element \citep{Ward}. Two kinds of glyphs can be distinguished: metaphoric glyphs that aim at looking like a common object, often related to the data visualized but not necessarily, and abstract glyphs that are geometric construction with no similarity to any common object. An example of metaphoric glyph is Chernoff's faces \citep{visu-face-chernoff}: these glyphs look like human faces. An example of abstract glyph is the ``stardinates'' \citep{visu-glyphe-stardinate} or star glyphs \citep{Fuchs2014} (see examples in Figure \ref{fig:ex_glyphs}), which are similar to parallel coordinates but with the coordinates organized in a star. Each dimension is represented by an axis that crosses at the center, and each data point is represented by a polygon. Contrary to parallel coordinates, each data point is represented in a separate glyph. Flower glyphs \citep{Chau2011,Pilato2016,Keck2017,Keck2018} are close to star glyphs but follows a ``flower'' metaphor : each glyph is a flower having one petal per dimension, the size of the petal being proportional to the value of the data point in that dimension. An interest of flower glyphs is that they are less dependent on the order in which the dimensions are displayed. In Figure \ref{fig:ex_glyphs}, glyphs A and B are the same but the order of the dimensions differs. Notice that A and B have the same inner area with flower glyphs, but not with star glyphs. Glyphs have shown their ability to visualize large datasets with hundreds of dimensions \citep{visumed-glyph-100dimensions}. In medicine, they have been used for facilitating the analysis of semen \citep{Duffy2015}, for example. Glyphs are of particular interest for identifying similarity or differences between data point. \section{\label{sec:Materials_and_methods}Materials and methods} \subsection{\label{sec:Materials}Materials} Clinical trials were searched and extracted from ClinicalTrials.gov. We focused on pain, but we also considered fever, because of the large overlap between the two, both in terms of symptoms (fever is often associated with pain) and drugs (\emph{e.g.} paracetamol and ibuprofen are both antipyretics and painkillers). We used the following query: Condition (\emph{i.e.} ``pain'' or ``fever'') + Completed Studies + Studies With Results + Phase 3 or 4. Searches were performed on the 18\textsuperscript{th} January 2020. From the resulting list of trials, we manually excluded: (1) trials not involving the treatment of pain or fever (\emph{e.g.} trial evaluating the pain associated with the injection of a given vaccine, in which pain is an outcome measure but not an indication, or trials focused on insomnia caused by chronic low back pain), (2) trials whose protocol does not allow comparing treatments (\emph{e.g.} trials comparing two care protocols where each patient in a group did not receive the same treatment, or trials during which drug labeling errors occurred), (3) trials testing non-drug treatment (\emph{e.g.} behavioral training or surgery), (4) trials testing homeopathic drugs, (5) trials where pain is treated by disorder-specific drugs (\emph{e.g.} chest pain caused by angina pectoris and treated by cardiac drugs), and (6) trials testing anesthetic agents or painkillers used during surgical operation. Trials comparing a drug treatment with a non-drug treatment were included, but only the groups receiving drug treatments were considered in the present study. \subsection{Ontology modeling} We designed an ontology of pain treatment ADE in clinical trials. Its purpose was not to fully model the domain of clinical trials, as does OCRe for example. On the contrary, it aimed at being a simple model, limited to the needs of data mining of ADE, and allowing us to handle ADE data as semantically linked data. The use of the ontological formalism was motivated by the reuse of existing tools designed for ontologies, and by the fact that ontologies are good at dealing with inheritance, \emph{i.e.} various levels of granularity. Here, we widely used inheritance in the modeling of indications (\emph{e.g.} post-vaccination fever is more specific than fever) and active principles (\emph{e.g.} ibuprofen is more specific than NSAI, Non-Steroid Anti-Inflammatory drugs). This will allow querying the ontology at various levels of granularity. In the ontology, the central class, Group, represents a group of similar patients, receiving the same treatment(s) for the same indication. ADE are observed in groups. On the contrary, individual patients are not present in the ontology. ADE were classified in 2 levels of seriousness and 13 categories, including 12 anatomo-functional categories and 1 ``Unclassified'' category for general symptoms (such as fatigue or unspecified infectious diseases). These categories are more general than the 27 MedDRA top-level System Organ Classes (SOC). A given ADE was allowed to belong to more than one category, \emph{e.g.} allergic rhinitis belongs to both respiratory system and blood and immune system. We manually mapped the MedDRA terms to these 13 categories. Most MedDRA SOC could directly be mapped to a single category (\emph{e.g.} respiratory system). However, the ``Investigations'' SOC required more work, in order to associate each abnormal test result to the right category (\emph{e.g.} ``Tidal volume decreased'' was associated with the respiratory system category). The resulting ontology was interfaced with Python scripts using the Owlready 2 ontology-oriented programming module \citep{Lamy2017_5,Lamy2016_3}. The ontology was stored in the Owlready 2 quadstore, as an SQLite3 database. \subsection{Ontology population} \begin{comment} In the inclusion/exclusion process, we considered drug treatments before indications, because drugs were easier to identify than disorders, and were described in shorter text in ClinicalTrials.gov. \end{comment} The pain treatment ADE ontology was populated from ClinicalTrials.org XML data, using a semi-automatic process. In ClinicalTrials.org, trials, groups and ADE observations are well structured, and ADE are classified according to the 27 System Organ Class (SOC) of the MedDRA terminology, and in 2 classes of seriousness (serious \emph{vs} non-serious). In most cases, the ADE label corresponds to a MedDRA term. Consequently, we automatically extracted and inserted these pieces of data in the ontology, using Python scripts. On the contrary, the treatments received by the patient groups are not coded in ClinicalTrials.org, but only present in free-text fields. Similarly, the precise indications of these treatments are available only in free text; although MeSH (Medical Subject Headings) terms are provided, they often remain too general (\emph{e.g.} pain without more precision). Thus, treatments and indications cannot be extracted without a manual intervention. We wrote Python scripts for extracting the free-text values, and automatically recognizing named entities and dose regimens. The output was formatted in CSV files (Comma-Separated Values). Then these files were opened in a spreadsheet software (LibreOffice Calc) and manually reviewed by a pharmacist working in medical informatics (JBL). The entire process took about 1 month. A first script aimed at automatically detecting the names of active principles (using a list extracted from UMLS, Unified Medical Language System), their dose, dose unit and number of intakes per day (using regular expressions targeting common expressions such as ``bid'' : \emph{bis in die}, \emph{i.e.} twice per day). A second script aimed at automatically extracting indication, from trial summary, description and MeSH terms. We measured the performance of the two scripts, by comparing the data extracted automatically by the scripts with the same data after correction during the manual review. When coding doses and numbers of intakes per day, we allowed the use of a range with a minimum and a maximum value (\emph{e.g.} 5-10 mg or 1-2 intakes per day). In addition, when the dose varied over time, we kept only the maintenance dose.% \begin{comment} Loading doses, progressive dose increases and withdrawal doses were disregarded. \end{comment} The active principles and indications identified were added to the ontology, and hierarchically structured. Active principles were classified according to three dimensions: chemical structure (\emph{e.g.} steroid), pharmacological activity (\emph{e.g.} antihistamine) and main indication (\emph{e.g.} anti-epileptics). Indications were classified according to four dimensions: anatomy (\emph{e.g.} musculoskeletal pain), etiology (\emph{e.g.} neuropathic pain), chronicity (\emph{i.e.} chronic or acute pain) and severity (\emph{i.e.} mild, moderate or severe pain). These classifications were highly inspired by existing terminologies such as ATC (Anatomical Therapeutical Chemical classification of drugs) or ICD10 (International Classification of Diseases, release 10). ADE terms were extracted from ClinicalTrials.gov and automatically mapped to MedDRA terms using their textual English label. When no corresponding MedDRA term was found, the term was simply associated with the MedDRA SOC present in ClinicalTrials.gov. While more general, the SOC still permits relating the ADE to one of our 13 categories of ADE. Several trials include a titration period, mainly for opioid painkillers. A typical design study for comparing a given opioid with a placebo is as follows: an open-label titration period with the test drug, including all patients, then randomization followed by a maintenance period with two groups, one taking the test drug and the other taking a placebo. In this case, we chose to include in the ontology the ADE observed during the titration period, but without mixing them with those observed in the maintenance period, because there is no titration period for placebo and thus no comparison is possible. The ontology population was performed by a pharmacist working in medical informatics (JBL), and took about 1 month. \subsection{Ontology querying} We designed a query procedure for searching the ontology. The procedure takes as input one or more group definitions. Each group definition may include criteria regarding the trial (\emph{e.g.} restrict to randomized trials), the indication (\emph{e.g.} restrict to cancer pain) and the active principles (\emph{e.g.} opioid or morphine). The ontology allows the use of various levels of granularity in the formulation of the query, as in the latter example. Several active principles may be mentioned for a given group (corresponding to a bi- or tritherapy), and, for each, a specific release (immediate or modified), range of dose (\emph{e.g.} 5-10 mg) and number of intakes per day (\emph{e.g.} 1-2 times per day) may be specified. In addition, we considered two particular situations when querying on active principles. First, we also allowed an ``open list'' search, that returns groups with the active principles queried possibly in association with others, \emph{e.g.} morphine alone or associated with any other active principle. This ``open list'' search comes in addition to the usual ``closed list'' search, which is the default. Second, it is sometimes interesting to perform a comparison between two treatments defined at different levels of granularity, \emph{e.g.} to compare tapentadol \emph{vs} opioids. In this comparison, ``opioids'' implicitly means ``opioids other than tapentadol'', since tapentadol is an opioid. Thus, we also supported exclusion in the search process. For a single query, the procedure returns three sets of results. The first one, \emph{direct comparisons}, includes only direct comparisons, \emph{i.e.} trials in which all the groups queried are present. The second one, \emph{direct and indirect comparisons}, includes both direct comparisons and indirect comparisons \emph{via} placebo, \emph{i.e.} trials in which only some of the groups queried are present, and where a placebo group is present for performing an indirect comparison normalized by placebo (see next section). The third one, \emph{absolute values}, includes all trials containing at least one of the groups queried, without any correction or normalization. As a consequence, the first result set (direct comparisons) has the fewest number of trials and patients but the highest data quality. On the contrary, the third result set (absolute values) has the highest number of trials and patients but the lowest data quality. The user may choose the desired result sets, \emph{e.g.} one may use the direct comparisons and defaults to the other result sets when there are not enough patients. \subsection{\label{subsec:Data-correction}Data correction and normalization} We implemented three data correction and normalization methods. First, \emph{per-trial number of patients correction} was implemented for direct comparisons when more than one trial is involved in the comparison. For example, let us consider two trials $T_{1}$ and $T_{2}$, both comparing two drugs $D_{1}$ and $D_{2}$. $T_{1}$ includes 100 patients treated with $D_{1}$ and 100 patients treated with $D_{2}$, and $T_{2}$ includes 100 patients treated with $D_{1}$ but 200 patients treated with $D_{2}$. Without correction, a higher weight is given to the group $T_{2}$-$D_{2}$, since patients are more numerous in this group. This is a potential bias if $T_{2}$ is at higher (or lower) risk of ADE, \emph{e.g.} because the trial involves post-vaccination fever and the vaccine may cause additional ADE. Consequently, we need to normalize the data. We propose to reduce the weight given to each group using a correction factor, so as the weight given to each group is equivalent to the weight of the smallest group in the same trial. In the previous example, the correction factors will be 1.0 for groups $T_{1}$-$D_{1}$, $T_{1}$-$D_{2}$ and $T_{2}$-$D_{1}$, but 0.5 for $T_{2}$-$D_{2}$. This gives an equivalent weight to $T_{2}$ for both $D_{1}$ and $D_{2}$. In the general case, for a trial $T$ with $n$ groups $D_{1}$ to $D_{n}$, the correction factor for group $D_{x}$ is: \[ w_{x}=\frac{\,\,\min(\left|TD_{i}\right|\,\,for\,\,i\in[1,n])\,\,}{\left|TD_{x}\right|}\, \] where $\left|TD_{i}\right|$ is the number of patients in the group with drug $D_{i}$ in trial $T$. When computing the correction factor $w_{x}$, we used the minimum group size and not the average, because using the average would reduce the weight of the larger groups but also increase the weight of the smaller groups. In case of very small groups, using the average would give a disproportional importance to the rare events occurring in these small groups (\emph{e.g.} 1 stroke in a group of 10 patients). On the contrary, using the minimum ensures that no patient counts for ``more than one''. \begin{comment} \[ w_{x}=\frac{\,\,\frac{\underset{i=1}{\overset{n}{\sum}}\left|TD_{i}\right|}{n}\,\,}{\left|TD_{x}\right|} \] \[ E(P)=\frac{\sum_{i=1}^{n}E(T_{i}P)}{\sum_{i=1}^{n}\left|T_{i}P\right|} \] \end{comment} Second, \emph{placebo normalization} was implemented for indirect comparisons. In indirect comparisons, the number of ADE observed needs to be adjusted according to the number of ADE observed in placebo groups. For example, let us consider an indirect comparison between two drugs $D_{1}$ and $D_{2}$, using two trials $T_{1}$ and $T_{2}$. In $T_{1}$, $D_{1}$ is compared to placebo $P$, and, in $T_{2}$, $D_{2}$ is compared to $P$, each group including 100 patients. Let us consider $E$, a given ADE, \emph{e.g.} vomiting. We denote by $E(T_{i}D)$ the number of occurrences of $E$ in trial $T_{i}$ in the group taking drug $D$. Let $E(T_{1}D_{1})=20$, $E(T_{1}P)=10$, $E(T_{2}D_{2})=30$, $E(T_{2}P)=30$. These numbers suggest that, despite more vomitings were observed with $D_{2}$ than $D_{1}$, $D_{2}$ is at lower risk of causing vomiting because it caused as much vomitings as placebo, while $D_{1}$ caused more. In facts, the difference observed between $D_{1}$ and $D_{2}$ is partially due to the difference in clinical conditions between $T_{1}$ and $T_{2}$. Here, the average rate of $E$ in the placebo group is $\frac{10+30}{100+100}=20\%$. But, in $T_{1}$, the rate of $E$ in the placebo group is $\frac{10}{100}=10\%$, thus there is another $10\%$ missing. Adding these $10\%$ to the rate of $E$ in the $D_{1}$ leads to a corrected number of occurrences of $20+0.1\times100=30$. Similarly, for $D_{2}$ in trial $T_{2}$, the corrected number of occurrences will be $30-0.1\times100=20$. In the general case, the corrected number of occurrences of $E$ for the group $T_{x}D_{y}$ is: \[ E_{c}(T_{x}D_{y})=E(T_{x}D_{y})+\left(\frac{\sum_{i=1}^{n}E(T_{i}P)}{\sum_{i=1}^{n}\left|T_{i}P\right|}-\frac{E(T_{x}P)}{\left|T_{x}P\right|}\right)\times\left|T_{x}D_{y}\right| \] where $n$ is the number of trials, $\frac{\sum_{i=1}^{n}E(T_{i}P)}{\sum_{i=1}^{n}\left|T_{i}P\right|}$ is the average rate of $E$ in placebo over all trials, and $\frac{E(T_{x}P)}{\left|T_{x}P\right|}$ the average rate of $E$ in placebo in the considered trial $T_{x}$. Third, when direct and indirect comparisons are mixed, we need to ensure that the proportion of patients coming from direct comparisons is the same in each of the compared groups. Let us consider a mixed comparison between two drugs $D_{1}$ and $D_{2}$, including $T_{1}$ (direct comparison) with $E(T_{1}D_{1})=40$, $\left|T_{1}D_{1}\right|=100$, $E(T_{1}D_{2})=50$, $\left|T_{1}D_{2}\right|=100$, but also two indirect comparisons: $T_{2}$ with $E(T_{2}D_{1})=10$, $\left|T_{2}D_{1}\right|=100$ and $T_{3}$ with $E(T_{3}D_{2})=22$, $\left|T_{3}D_{1}\right|=200$ (after applying the placebo normalization described above). Despite the fact that $D_{1}$ is associated with lower ADE rate than $D_{2}$ in both direct ($T_{1}$) and indirect ($T_{2}$ \emph{vs} $T_{3}$) comparisons, the uncorrected mean ADE rate is higher for $D_{1}$ ($\frac{40+10}{100+100}=25\%$) than for $D_{2}$ ($\frac{50+22}{100+200}=24\%$). Actually, it gives a higher weight to $T_{1}$ for $D_{1}$, and $T_{1}$ is associated with a higher overall rate of ADE (possibly due to the trial conditions). We correct the data as follows. We compute the overall indirect / direct patient ratio $r$. In the previous example, $r=\frac{100+200}{100+100}=1.5$. Then, for each of the compared group $D$, we weighted the direct comparisons with a factor $k_{dir}(D)$ and the indirect comparisons with a factor $k_{ind}(D)$ in order to obtain a ratio equal to $r$. Let us note $\left|D\right|_{dir}$ and $\left|D\right|_{ind}$ the number of patients in the direct and indirect comparisons for group $D$, respectively. We have: \[ k_{dir}(D)=\min\left(1,\frac{\left|D\right|_{ind}}{\left|D\right|_{dir}\times r}\right) \] \[ k_{ind}(D)=\min\left(1,\frac{\left|D\right|_{dir}\times r}{\left|D\right|_{ind}}\right) \] As previously, the weight given to a patient cannot be higher than 1. In the previous example, we have $k_{dir}(D_{1})=\frac{100}{100\times1.5}=0.667$, $k_{ind}(D_{1})=1$, $k_{dir}(D_{2})=1$ and $k_{ind}(D_{2})=\frac{100\times1.5}{200}=0.75$. ~ \subsection{Visual analytics} Let us consider a 26-dimensional numeric dataset, with 2 dimensions for each ADE category, one for all ADE in the category and the other for serious ADE only. In this dataset, each group of similar patients in the query corresponds to a data point. We chose glyphs for the visualization of the dataset, because they are particularly efficient for identifying differences between data points. Moreover, dimension reduction techniques would imply an important information loss (see section \ref{subsec:Multidimensional-visualization-t}), and parallel coordinates consider each dimension in the same way, while our 26 dimensions are organized in $13\times2$ corresponding to the 13 ADE categories and the 2 levels of seriousness. \begin{figure} \noindent \begin{centering} \includegraphics[width=1\columnwidth]{glyphe_en_fleur_en} \par\end{centering} \caption{\label{fig:fleur}Structure of the flower glyph, with the 13 ADE categories.} \end{figure} We adapted flower glyphs for visualizing the per-category and per-seriousness level rates of ADE observed in a group. Unclassified ADE are represented by a white circle at the center of the flower, and each of the 12 remnant categories is represented by a colored petal. Both the position of the petal and its color were chosen in order to facilitate the understanding and the memorization of the category. For example, nervous system is at the top and in gray (think of the brain and the ``gray matter''), while the urinary system is in yellow at the bottom. When no ``obvious'' colors were available, arbitrary colors were used, e.g. green for genital system and reproduction. Figure \ref{fig:fleur} shows the structure of the flower glyph and the color and position of the 13 ADE categories. Contrary to what was found in the literature, we encoded the ADE rate by the area of the petal, and not by its length. The area of the center circle and the petals is thus proportional to the observed rate of the corresponding ADE (including both serious and non-serious ADE). When present, serious ADE were represented by a darker central circle or a darker smaller petal. The area of this darker region is proportional to the observed rate of serious ADE in the given category. This flower glyph takes advantage of the ability of the human vision to distinguish at least 12 directions, as in an analog clock, and its higher sensitivity to area rather than to distance \citep{Ware2008_2}. In addition, compared to a bar chart, the overall triangular shape of petals associated with area proportionality allows giving more attention to small values, \emph{i.e.} if the rate of ADE is multiplied by 2, the length of the petal is multiplied by less than 2, because the area increases faster than the length. This acts similarly to a logarithmic scale, although not logarithmic from a mathematical point of view. Consequently, small values remain visible when much higher values are present. We added interactivity to flower glyphs, as follows. When the mouse is over a region (the central circle or a petal), a popup bubble displays the ADE category label and the associated rate of ADE and serious ADE, with the most frequent ADE and serious ADE in the category. When the mouse is clicked, the webpage is scrolled down to display the entire list of ADE in this category. Finally, when several glyphs are present, we added a $\Delta$ (delta) button. When this button is mouse-hovered, the outline of the selected glyph is drawn as a wire frame over the other glyphs, in order to facilitate comparison. \subsection{Implementation details} The search procedure was implemented with Owlready, which translates the query into an SQL query. The visual analytics was implemented in a web platform, using Python 3 with Flask and Owlready, web technology (HTML, CSS) and Brython, a client-side Python interpreter. \subsection{Use cases and expert opinions} Several use cases were designed for the platform. Most of them were focused on trying to find back already known results, \emph{e.g.} from meta-analysis, in order to validate our approach. An additional use case was designed by selecting an indication in the ontology and comparing the available drugs, in order to search for possible new insights. The proposed platform was presented to four experts in drug safety, from the French drug agency (\emph{Agence Nationnale de Sécurité du Médicament et des produits de santé}, ANSM), using the use cases. Then, the comments, opinions and suggestions of the experts were collected during a focus group session. \section{\label{sec:Results}Results} \subsection{The ontology of pain treatment ADE} Figure \ref{fig:onto} shows the general model of the pain treatment ADE ontology, in UML (Unified Modeling Language). In this model, Group is the central class and represents a group of similar patients, in terms of clinical conditions and treatments received. A clinical trial contains one or more periods; most trials either include a single period or an open-label titration period followed by a maintenance period. A few also include an open-label continuation or pick-up period. Each period includes one or more comparable group. Each group has one or more drug treatments, prescribed for one or more indications. ADE are observed in groups, and are associated with a MedDRA term and a seriousness Boolean status. 18,090 ADE terms were extracted from ClinicalTrials.gov. 17,304 (95.7\%) were automatically mapped to MedDRA terms using their label, the others being associated with the MedDRA SOC present in ClinicalTrials.gov. ADE with the same MedDRA term may differ in seriousness, \emph{e.g.} diarrhea might be serious for newborns but not for adults. Finally, each MedDRA term is associated with one or two of the 13 ADE categories. \begin{figure}[t] \noindent \begin{centering} \includegraphics[width=1\columnwidth]{onto_en} \par\end{centering} \caption{\label{fig:onto}General model of the ontology of pain treatment ADE in UML. Relations in black were extracted automatically, while manual intervention was required for those in red.} \end{figure} \begin{figure}[!t] \noindent \begin{centering} \includegraphics[width=1\columnwidth]{ct_flow_en} \par\end{centering} \caption{\label{fig:ct_flow}Selection of clinical trials for the study.} \end{figure} Inheritance is present at three levels: ClinicalTrial, Indication and ActivePrinciple. Notice that OWL ontologies allow \emph{multiple instantiation} in addition to multiple inheritance, \emph{i.e.} a given clinical trial can belong to several classes, \emph{e.g.} RandomizedClinicalTrial and InterventionalClinicalTrial. In Figure \ref{fig:onto}, relations in red were extracted from ClinicalTrials.org semi-automatically, with manual intervention, while those in black were extracted automatically. Figure \ref{fig:ct_flow} shows the selection and exclusion of clinical trials during the study. 582 clinical trials were included. In addition to the criteria mentioned in section \ref{sec:Materials}, one trial was excluded because results data was not present in ClinicalTrials.gov (investigators lost data during flooding, NCT01401049), and two trials because they contain only results related to efficacy. Figure \ref{fig:histo} shows a histogram of the completion date of the selected trials. Most trials were completed after 2007. During the ontology population, 1,394 groups were extracted with 1,653 individual drug treatments (a group may have several treatments, \emph{e.g.} 2 in case of a bitherapy). The Python script extracted the right indication for 77.3\% of the groups, the right severity for 97.1\%, and the right chronicity for 71.2\%. It also extracted the right active principle for 77.7\% of the individual drug treatments, the right release for 90.1\%, the right route for 70.3\%, the right dose for 55.3\%, the right dose unit for 61.4\%, and the right number of intakes per day for 74.2\%. The resulting ontology includes 582 trials, 1,354 groups and 157,665 patients, 201 active principle classes, 194 indication classes, and 148,843 reported individual ADE. It was formalized in OWL 2.0 and saved in RDF/XML, and it contains 299,341 RDF triples. The ontology is publicly available at \href{http://www.lesfleursdunormal.fr/static/appliweb/pain/pain_onto.zip}{http://www.lesfleursdunormal.fr/static/appliweb/pain/pain\_onto.zip}. \begin{figure}[!t] \noindent \begin{centering} \includegraphics[width=0.9\columnwidth]{ct_date_histo} \par\end{centering} \caption{\label{fig:histo}Histogram of the completion dates of the selected trials.} \end{figure} \begin{figure*}[p] \noindent \begin{centering} \includegraphics[width=0.82\textwidth]{debm_pain_search_en} \par\end{centering} \caption{\label{fig:search}Screenshot of the search interface.} \end{figure*} \begin{figure*}[!p] \noindent \begin{centering} \includegraphics[width=0.82\textwidth]{debm_pain_results_en} \par\end{centering} \caption{\label{fig:results}Screenshot of the results interface, with two flower glyphs and a bubble showing details on a petal.} \end{figure*} \subsection{The data mining web platform} The proposed platform is available online at \href{http://www.lesfleursdunormal.fr/appliweb/pain}{http://www.lesfleursdunormal.fr/appliweb/pain}, and is fully bilingual (English and French). It has been tested with both Mozilla Firefox and Google Chrome. Figure \ref{fig:search} shows a screenshot of the search interface. The user can enter one or more groups. Each group may contain one or several comma-separated classes of trial, indication and active principle. Auto-completion is used for facilitating the entry of trial types, indications and active principles, and the entire hierarchies can be displayed by clinking on the field labels. If several active principles are entered for a given group, the per-drug fields (\emph{i.e.} release, route, daily dose, dose unit and intakes/day) are subdivided with one field for each active principle. In the results, each group will be displayed in a separate flower glyph. In Figure \ref{fig:search}, the user defined two groups: ``oral acetaminophen'' and ``oral ibuprofen''. When entering active principles, the ``etc'' special label can be used for defining an ``open list'' of active principles, \emph{e.g.} ``morphine, etc'' for any treatment that includes morphine (possibly with other active principles). In addition, when a group's active principles are more general than a previous group, we automatically exclude the results of the more specific group from the result of the more general group. For example, when comparing tapentadol with opioids, the search will automatically consider ``opioids other than tapentadol'' (labeled ``other opioid'' in the results, for brevity). Figure \ref{fig:results} shows a screenshot of the results interface, after the user performed the query shown in Figure \ref{fig:search}. The results interface includes three parts, organized vertically. First, the three tabs at the top of the screen allows selecting the result sets: direct comparisons, direct and indirect comparisons, or absolute values. The first one includes only trials with all searched groups, the second one also includes trials with only some of the queried groups and a placebo group allowing adjusting the ADE observed according to the values observed for the placebo (as explained in section \ref{subsec:Data-correction}), and the third one includes all groups found independently from the trial they belong to, without any corrections. The number of trials and patients increase from the left to the right tab, but the quality of the data decreases. The ``absolute values'' result set is surely not sufficient for drawing conclusions; however, it is very useful for confirming or invalidating the conclusions observed in the other result sets, or for obtaining general trends when the other result sets are not available. Second, flower glyphs display the rates of the various categories of ADE, for each group. The user can mouse over the region of the glyph to obtain more detail in a popup bubble, or click to scroll down to the entire list of ADE in the chosen category. At the bottom right of the glyph, the $\Delta$ button allows drawing the outline of the select glyph on top of the other glyphs. This permits fine comparison and facilitates the identification of small differences. At the bottom of the flower glyphs, a line of text summarizes the corrections that were applied to the data. Notice the very high ADE rates shown in Figure \ref{fig:results}: more than 200\%, \emph{i.e.} more than 2 ADE per patients on average. These rates correspond to the number of events observed during trials, but may not correspond to the real rate of ADE caused by the drug in normal clinical use: of course, the ADE rate of acetaminophen and ibuprofen is not 200\%. In particular, the ADE may be observed during a long period (several months or even years, \emph{i.e.} for acetaminophen and ibuprofen, some trials on post-vaccination fever cover all vaccinations during childhood), and the events observed may be due to the drug taken, but also to the patient disorders or the conditions of the trial (\emph{e.g.} ADE may be caused by the vaccine in the previous example) and to random hazards (\emph{e.g.} an infection may occur during the trial, unrelated to the treatment). However, the rates given by the platform are comparable for the ``direct'' and ``direct + indirect'' result sets, allowing the comparison of the various treatment options. \begin{figure}[!t] \noindent \begin{centering} \includegraphics[width=1\columnwidth]{debm_glyphs_en} \par\end{centering} \caption{\label{fig:glyphs}Flower glyphs corresponding to the 8 most common pain treatments in the ontology, using the \textquotedblleft absolute values\textquotedblright{} result set. Hence the glyphs are not comparable since the patient conditions may differ, but these glyphs give an idea of the type of ADE one may expect which each drug when used in its own typical conditions.} \end{figure} The size of the flower glyphs reduces when the number of glyphs increases. Figure \ref{fig:glyphs} shows a ``bouquet'' of flower glyphs for the 8 most common pain treatments in the ontology. We can observe that digestive ADE are the most frequent, followed by neurologic ADE. \begin{figure}[!t] \noindent \begin{centering} \includegraphics[width=1\columnwidth]{trajectoires_en} \par\end{centering} \caption{\label{fig:trajectoires}Example of typical search strategies in the platform.} \end{figure} Third, a second set of tabs allows displaying various tabular information. The tabs are: (1) ``All events'': this tab displays the entire list of all ADE, sorted by category and then by rate. Background reddish colors are used to represent frequencies visually, from white (0\%) to red (5\% or more) on a logarithmic scale. (2) ``Serious events'': this tab is similar to the previous one, but displays only serious ADE. (3) ``Indication summary'': this tab displays the indications of the selected trials, ordered by frequency. Radio buttons allow selecting one of the indications, in order to restrict the search to the chosen indication. (4) ``Treatment summary'': this tab displays the list of treatments tested in the selected trials, ordered by frequency. It is present only if no active principles were entered in the query, \emph{e.g.} the user may search for ``cancer pain'' and will find in this tab the most frequently tested treatments for cancer pain. Checkboxes allow selecting all or part of these treatments, with a button for performing a new search comparing the selected treatments in the previously entered indication. (5) ``Comparable treatments'': this tab displays similar treatments used as comparators in trials, ordered by frequency. It is present only if active principles were entered in the query. For example, the user may search for ``tramadol'', and will get in this tab the list of treatments compared to tramadol. Checkboxes allow selecting some comparable treatments, with a button for adding the selected treatment into the current search. (6) ``List of trials'': this tab lists all the trials in the current result set, with links to pages displaying the ADE observed in each trial. It also displays the per-trial rate of ADE for each group, allowing the identification of outlier trials. Finally, it includes checkboxes, allowing the exclusion of some trials from the result set. Figure \ref{fig:trajectoires} shows several search strategies made possible using tabs 3-5. \subsection{Use cases} \subsubsection{Acetaminophen \emph{vs} ibuprofen} Acetaminophen, ibuprofen and aspirin are the three main OTC (Over The Counter, \emph{i.e.} without medical prescriptions) painkillers taken by patients. However, aspirin is no longer recommended for such use. Thus, we found no recent trial involving aspirin as a painkiller. Figure \ref{fig:results} shows the direct comparison of oral acetaminophen \emph{vs} oral ibuprofen, including 9 trials and 3,042 patients\footnote{Available online at \href{http://www.lesfleursdunormal.fr/appliweb/pain?group_1_ap=acetaminophen&group_1_route=oral&group_2_ap=ibuprofen&group_2_route=oral}{http://www.lesfleursdunormal.fr/appliweb/pain? group\_1\_ap=acetaminophen\&group\_1\_route=oral\&group\_2\_ap=ibuprofen \&group\_2\_route=oral}}. The results show slightly fewer ADE with acetaminophen (203.1\% \emph{vs} 214.7\%), as well as for serious ADE (4.4\% \emph{vs} 4.9\%). In particular, acetaminophen is associated with fewer unclassified ADE (mostly fevers, 54\% \emph{vs} 70\%). Nevertheless, the difference is low and probably not significant, and the ADE profile of both drugs is very similar. These results are consistent with a meta-analysis that concluded, 10 years ago, that acetaminophen and ibuprofen are equally safe \citep{Pierce2010}, but the results presented here include more recent trials. Two main indications are present in the ``Indication summary'' tab: post-vaccination fever in children and pain following dental extraction. Interestingly, separate analyses (easily available using the radio buttons in the tab) suggest that acetaminophen has fewer ADE in the former indication and ibuprofen in the latter. \begin{comment} {*} Coxib vs AINS : + de risque d'AVC (d'après Prescrire) ? => Pas de différence dans Direct EBM => pas très intéressant ! \end{comment} \begin{comment} \subsubsection{Cancer pain treatments} XXX Dérivé du cannabis et augmentation de la tumeur \end{comment} \begin{figure}[!t] \noindent \begin{centering} \includegraphics[width=1\columnwidth]{elagolix} \par\end{centering} \caption{\label{fig:elagolix}Flower glyphs comparing elagolix to placebo.} \end{figure} \subsubsection{Elagolix} Elagolix is a gonadotropin-releasing hormone antagonist drug approved in 2018 in US, for the treatment of pain associated with endometriosis in women \citep{Lamb2018}. However, elagolix is known to be associated with frequent ADE such as hot flushes \citep{Vercellini2019}. After searching for elagolix alone, the ``comparable treatments'' tab shows that elagolix was only compared with placebo, during two trials. The tab's checkbox permits the addition of placebo to the query, leading to Figure \ref{fig:elagolix}\footnote{Available online at \href{http://www.lesfleursdunormal.fr/appliweb/pain?group_1_ap=elagolix&group_2_ap=placebo}{http://www.lesfleursdunormal.fr/appliweb/pain? group\_1\_ap=elagolix\&group\_2\_ap=placebo}}. We can clearly see that the ADE rate is higher for elagolix, especially for cardiovascular and genital/reproductive ADE (corresponding to the red and green petals). In particular, elagolix is associated with 34\% risk of hot flush (classified in both cardiovascular and genital/reproductive ADE categories, and thus counting for half in each) and a 5.6\% risk of amenorrhea. For placebo, these risks are 8.6\% and 0.27\%, respectively. These values can be easily obtained in the petal popup bubbles. These results clearly illustrate the high ADE rate with elagolix. \begin{figure}[!t] \noindent \begin{centering} \includegraphics[width=1\columnwidth]{tapentadol1} \par\end{centering} \caption{\label{fig:tapentadol}Flower glyphs comparing oral tapentadol to other oral opioids for acute pain.} \end{figure} \subsubsection{Tapentadol} As said in the introduction, a recent meta-analysis showed that tapentadol was associated with less digestive ADE than other opioids when prescribed for acute pain \citep{Wang2020}. Figure \ref{fig:tapentadol} shows the direct comparison of oral tapentadol with other oral opioids\footnote{Available online at \href{http://www.lesfleursdunormal.fr/appliweb/pain?group_1_indication=acute\%20pain&group_1_ap=tapentadol&group_1_route=oral&group_2_indication=acute\%20pain&group_2_ap=opioid&group_2_route=oral}{http://www.lesfleursdunormal.fr/appliweb/pain? group\_1\_indication=acute pain\&group\_1\_ap=tapentadol\&group\_1\_route=oral \&group\_2\_indication=acute pain\&group\_2\_ap=opioid\&group\_2\_route=oral}}. Six trials were found, involving 2,819 patients. On the flower glyphs, we can clearly see the difference in digestive ADE (56\% \emph{vs} 86\%). Contrary to the meta-analysis, the other opioids involved in the comparison are not limited to a single option, but include both oxycodone and morphine, as shown in the ``Treatment summary'' tab. One may perform additional searches to compare tapentadol to oxycodone and morphine separately, showing that tapentadol has fewer digestive ADE in each comparison. \begin{figure}[!t] \noindent \begin{centering} \includegraphics[width=1\columnwidth]{tramadol_en} \par\end{centering} \caption{\label{fig:tramadol}Flower glyphs comparing tramadol to other opioids.} \end{figure} \subsubsection{\label{subsec:Tramadol}Tramadol} \begin{comment} TRAMADOL : une mesure pour limiter le mésusage en France - Point d'information 16/01/2020 https://www.ansm.sante.fr/S-informer/Points-d-information-Points-d-information/TRAMADOL-une-mesure-pour-limiter-le-mesusage-en-France-Point-d-information XXX Ajouter Oxycodon ? Mais très similaire... In France, tramadol is, along with morphine, the most involved opioid in fatal overdoses \citep{2020_2}. The two flower glyphs are shown without (top) and with (bottom) the outline of the selected glyph (here, tramadol) drawn on top of the other glyph. \end{comment} Tramadol is an opioid painkiller used to treat moderate pain. It is classified as a level-2 painkiller (out of 3 levels). Tramadol was considered as having fewer risks of ADE compared with other more powerful opioids. However, it appeared that tramadol was involved in an important number of ADE, including serotoninergic syndrome \citep{Beakley2015}, vomiting and sleep disorders, and was at risks of misuses and dependence. A recent study involving Egyptian students showed that 12.3\% of them were taking tramadol, and that 30\% of the tramadol-consumers had dependence \citep{Bassiony2018}. Another study showed that patients receiving tramadol after surgery had similar, or even higher, risks of prolonged opioid use compared with patients receiving other opioids \citep{Thiels2019}. In France, the French drug agency (\emph{Agence Nationale de Sécurité du Médicament et des produits de santé}, ANSM) recently published a communicate\footnote{``TRAMADOL : une mesure pour limiter le mésusage en France - Point d'information'', 16/01/2020, \href{https://www.ansm.sante.fr/S-informer/Points-d-information-Points-d-information/TRAMADOL-une-mesure-pour-limiter-le-mesusage-en-France-Point-d-information}{https://www.ansm.sante.fr/S-informer/Points-d-information-Points-d-information/TRAMADOL-une-mesure-pour-limiter-le-mesusage-en-France-Point-d-information}}, and reduced the maximum prescription duration for tramadol, from 12 to 3 months. Figure \ref{fig:tramadol} shows the comparison of oral tramadol with other oral opioids\footnote{Available online at \href{http://www.lesfleursdunormal.fr/appliweb/pain/?group_1_ap=tramadol&group_1_route=oral&group_2_ap=opioid&group_2_route=oral}{http://www.lesfleursdunormal.fr/appliweb/pain/? group\_1\_ap=tramadol\&group\_1\_route=oral\&group\_2\_ap=opioid\&group\_2\_route=oral}}. Here, no direct comparisons were found; this was expected since tramadol is not considered as comparable with level-3 opioids like morphine. The indirect comparison result set, normalized by placebo, includes 29 trials (5 for tramadol and 24 for other opioids) and 8,851 patients. It clearly appears that the ADE profile of tramadol is very similar to the one of other oral opioids, with a high ADE rate and many digestive and nervous ADE. This supports the facts that tramadol is potentially as dangerous as other opioids. On the contrary, when looking at the details of the psychological ADE, no occurrences of drug abuse were found for tramadol. But this may be due to the conditions of clinical trials, which often have relatively short durations, and very controlled doses and protocols that limit the risk of drug abuse. Moreover, certain trials may exclude participants with a history of substance abuse. \begin{figure}[!t] \noindent \begin{centering} \includegraphics[width=1\columnwidth]{douleur_neuro_peri_en} \par\end{centering} \caption{\label{fig:douleur_neuro_peri}ADE observed during the treatment of peripheral neuropathic pain, and the treatment summary.} \end{figure} \subsubsection{Peripheral neuropathic pain and gabapentinoids} Peripheral neuropathic pain is a pain caused by damages to peripheral nerves. Typical causes of damages are diabetic neuropathy, postherpetic neuralgia and trauma. The 2010 guidelines on the pharmacological treatment of neuropathic pain \citep{Attal2010} from EFNS (European Federation of Neurological Societies) recommends duloxetine, pregabalin, gabapentin, tricyclic antidepressants or venlafaxine as first-line treatment for painful polyneuropathy (including diabetic neuropathic pain) and pregabalin, gabapentin, tricyclic antidepressants or lidocaine for post-herpetic neuralgia. In 2015, a systematic review and meta-analysis recommended gabapentin, gabapentin enacarbil, pregabalin, duloxetine, venlafaxine or tricyclic antidepressants as first-line treatment for neuropathic pain in adults \citep{Finnerup2015}. In 2013, a meta-analysis concluded that gabapentin has the most favorable balance between efficacy and safety for diabetic neuropathic pain \citep{Rudroju2013}, but since this study did not analyze efficacy and safety separately, it is difficult to know whether this conclusion is due to efficacy, safety or a mix of both. Figure \ref{fig:douleur_neuro_peri} shows the results obtained when searching for ``peripheral neuropathic pain'' in the platform\footnote{Available online at \href{http://www.lesfleursdunormal.fr/appliweb/pain?group_1_indication=peripheral\%20neuropathic\%20pain}{http://www.lesfleursdunormal.fr/appliweb/pain? group\_1\_indication=peripheral neuropathic pain}}. It shows the ADE caused by all drug treatments prescribed for peripheral neuropathic pain in the ontology. The ``Treatment summary'' tab can be used for finding the most prescribed active principles in that indication. \begin{figure}[!t] \noindent \begin{centering} \includegraphics[width=1\columnwidth]{douleur_neuro_peri2_en} \par\end{centering} \caption{\label{fig:douleur_neuro_peri2}Indirect comparison of the four main treatments for peripheral neuropathic pain.} \end{figure} Figure \ref{fig:douleur_neuro_peri2} shows the indirect comparison obtained after selecting the first four treatments in the ``Treatment summary'' tab (excluding placebo)\footnote{Available online at \href{http://www.lesfleursdunormal.fr/appliweb/pain?group_1_indication=peripheral\%20neuropathic\%20pain,&group_1_ap=pregabalin&group_2_indication=peripheral\%20neuropathic\%20pain,&group_2_ap=duloxetine&group_3_indication=peripheral\%20neuropathic\%20pain,&group_3_ap=tapentadol&group_4_indication=peripheral\%20neuropathic\%20pain,&group_4_ap=gabapentin}{http://www.lesfleursdunormal.fr/appliweb/pain? group\_1\_indication=peripheral neuropathic pain,\&group\_1\_ap=pregabalin \&group\_2\_indication=peripheral neuropathic pain,\&group\_2\_ap=duloxetine \&group\_3\_indication=peripheral neuropathic pain,\&group\_3\_ap=tapentadol \&group\_4\_indication=peripheral neuropathic pain,\&group\_4\_ap=gabapentin}}. There are 12 trials for pregabalin, 3 for duloxetine, 2 for tapentadol and 1 for gabapentin (Notice that these numbers are lower than those shown in Figure \ref{fig:douleur_neuro_peri}, because only trials with a placebo could be included in the indirect comparison of Figure \ref{fig:douleur_neuro_peri2}). We can see that all treatments are not equal in terms of ADE, despite the fact that three of them were recommended as first-line treatment (pregabalin, duloxetine and gabapentin). Duloxetine and tapentadol have the highest ADE rates, with a lot of digestive ADE for both, and of endocrine / metabolic / nutritional ADE for duloxetine, in addition to the nervous ADE present with all four treatments. Pregabalin and gabapentin seems better tolerated. Both belong to gabapentinoids, a family of antiepileptic drugs which are also prescribed for pain. Their mechanism of action is not fully known, but an auxiliary subunit of voltage-gated calcium channels seems to be involved \citep{Taylor2020}. In Figure \ref{fig:douleur_neuro_peri2}, gabapentin has the fewest ADE, but the evidence is weak because the gabapentin group includes only 1 trial and 221 patients. Figure \ref{fig:pregabaline} shows a direct and indirect mixed comparison of pregabalin \emph{vs} gabapentin, including 13 trials for pregabalin and 2 for gabapentin (one trial compare pregabalin to gabapentin with no placebo, and was thus not present in the previous indirect comparison)\footnote{Available online at \href{http://www.lesfleursdunormal.fr/appliweb/pain?group_1_indication=peripheral\%20neuropathic\%20pain&group_1_ap=pregabalin&group_2_indication=peripheral\%20neuropathic\%20pain&group_2_ap=gabapentin&tab=1}{http://www.lesfleursdunormal.fr/appliweb/pain? group\_1\_indication=peripheral neuropathic pain\&group\_1\_ap=pregabalin \&group\_2\_indication=peripheral neuropathic pain\&group\_2\_ap=gabapentin\&tab=1}}. The flower glyphs show that both drugs have a similar ADE profile, but with fewer ADE for gabapentin (64.1\% \emph{vs} 97.6\%). This suggests that gabapentin might be preferable in terms of safety. It also suggests that performing a comparative trial between pregabalin and gabapentin, or a network meta-analysis, may be a valuable study. \begin{comment} \begin{figure}[!t] \noindent \begin{centering} \includegraphics[width=1\columnwidth]{pregabaline4_peri.png} \par\end{centering} \medskip{} \noindent \begin{centering} \includegraphics[width=1\columnwidth]{pregabaline3_peri.png} \par\end{centering} \caption{\label{fig:pregabaline2}Direct (top) and indirect (bottom) comparison of pregabalin and gabapentin. In the indirect comparison, we activated the $\Delta$ button of gabapentin, thus showing the outline of the gabapentin glyph on top of the other glyph.} \end{figure} \subsubsection{Gabapentinoids} Gabapentinoids are a family of antiepileptic drugs which is also prescribed as pain treatments. Their mechanism of action is not fully known, but an auxiliary subunit of voltage-gated calcium channels seems to be involved \citep{Taylor2020}. Two main drugs exist in this family: pregabalin and gabapentin. Both can be prescribed for peripheral neuropathic pain, while only pregabalin is indicated for central neuropathic pain. However, little information is available regarding the difference between pregabalin and gabapentin. The 2010 guidelines on the pharmacological treatment of neuropathic pain \citep{Attal2010} from EFNS (European Federation of Neurological Societies) recommends both pregabalin and gabapentin as first-line treatment (among others) for post-herpetic neuralgia and painful polyneuropathy (including diabetic neuropathic pain). Similarly, in 2015 a systematic review and meta-analysis recommended both as first-line treatment for neuropathic pain in adults \citep{Finnerup2015}. In 2013, a meta-analysis concluded that gabapentin has the most favorable balance between efficacy and safety for diabetic neuropathic pain \citep{Rudroju2013}, but since this study did not analyze efficacy and safety separately, it is difficult to known whether this conclusion is due to efficacy, safety or a mix of both. Figure \ref{fig:pregabaline2} compares pregabalin and gabapentin for peripheral neuropathic pain. The top of the Figure shows the direct comparison. The glyphs show that both drugs have a similar ADE profile, but with fewer ADE for gabapentin (77.0\% \emph{vs} 110.9\%). This comparison is based on a single trial with 348 patients, so the evidence is limited. The bottom of Figure \ref{fig:pregabaline2} shows the indirect comparison of pregabalin and gabapentin, involving 14 trials and 3,581 patients. The indirect comparison also shows that gabapentin is associated with fewer ADE. This suggests that gabapentin might be preferable in term of safety, and could be prescribed to patient encountering ADE with pregabalin. It also suggests that performing a comparative trial between pregabalin and gabapentin, or a network meta-analysis, may be a valuable study. \end{comment} \begin{comment} However, little information is available regarding the difference between pregabalin and gabapentin, and this information is often of low quality. For example, an article published in 2015 in the ``pharmacy Times'' entitled ``How Gabapentin Differs From Pregabalin''\footnote{} says that: ``Switching {[}from gabapentin{]} to pregabalin resulted in improved pain relief and also fewer adverse events'' but the cited study actually does not mention a difference in ADE. \citep{Toth2010} \end{comment} \subsection{Expert opinions} \begin{comment} Avant et après AMM Application aux RCP ? Calcul de risque relatif Intéressant lorsqu'un médicament à obtenu une AMM pour une indication et qu'il est tester/prescrit dans une autre : les EI sont-ils les mêmes ? Interface très sympathique Très innovant (approche + interface) \end{comment} The four experts were very interested by this work. They found the proposed platform innovative and original, both in its approach and its presentation. They agreed that trial data are insufficiently exploited today by computer programs, and they found the visual interface easy to understand and very nice. They made several interesting suggestions. First, one expert asked for additional statistical computations, such as relative risks. Second, they suggested the use of the platform for approved drugs, but also before drug approval, in order to help regulators to take the decision to approve (or not) a new drug by comparing its adverse event profile with the other drugs already available in the same indication. Third, they also proposed to compare the adverse event profile of a given drug in various indications, when a drug is initially approved for an indication and then prescribed in others. For example, it might be interesting to compare the ADE of gabapentinoids when prescribed for epilepsy and for pain: since they were initially approved for epilepsy, their summaries of product characteristics (SPC) describe the ADE observed in epilepsy studies, but they might differ from those occurring when prescribed for pain. Finally, they suggested using the flower glyph to visualize the adverse effects described in SPC, and to compare them with those observed during clinical trials. \begin{figure}[!t] \noindent \begin{centering} \includegraphics[width=1\columnwidth]{pregabaline3_peri} \par\end{centering} \caption{\label{fig:pregabaline}Indirect comparison of pregabalin and gabapentin. We activated the $\Delta$ button of gabapentin, thus showing the outline of the gabapentin glyph on top of the other one.} \end{figure} \section{\label{sec:Discussion}Discussion} In this paper, we described how ADE mentioned in publicly available clinical trial results could be integrated in a data mining platform for drug safety. This platform relies on semantic web technologies for allowing queries at various levels of granularity, and on visual analytics, and in particular flower glyphs, for the presentation of the results. We illustrated the interest of this approach through case studies, and we showed that we were able to find back results already known in the literature (\emph{e.g.} regarding elagolix, tapentadol and tramadol) but also to suggest new results (\emph{e.g.} on gabapentinoids) that would require further confirmation. The key points of this work are the original approach producing fact-based evidence on drug safety, by applying data science to trial data, and the association of semantic methods with visual analytics. We found that there is a strong synergy between the semantic and the visual nature of the proposed data mining platform. The semantic nature allows searching the entire dataset in many ways, using the links and options proposed in the various tabs. The visual nature makes the platform ludic and enjoyable, thus giving the user the desire to test the many possibilities offered by the platform. A potential problem in meta-analyses is the \emph{confirmation bias} \citep{Goodyear-Smith2012}, \emph{i.e.} the tendency to search for, interpret and favor information in a way that confirms the investigator hypothesis. Since meta-analyses are performed with a hypothesis in mind, this hypothesis might bias the process. On the contrary, in the present work, the selection of clinical trials and their coding were performed in a systematic manner, without aiming at answering a specific medical question. In addition, the query procedure and the visualization are fully automatic. As a consequence, this might reduce the confirmation bias. The main limitation of the proposed approach is that it highly depends on the availability and the quality of clinical trial data. In particular, limited data are available for older drugs. For example, aspirin has been used for treating pain for long, but is no longer recommended. As a consequence, there is no recent trial involving aspirin as a painkiller, and thus we have no data in the proposed system. Thus our platform fails to identify the risks associated with the use of aspirin as a painkiller. Similarly, we have seen in section \ref{subsec:Tramadol} that limited data was available for situations of drug abuse or drug overdose. Another limitation is the training needed for using the proposed platform properly. The platform was presented to the experts during a guided tour. It includes contextual helps, but the ability of a naive user to understand it without the guided tour still need to be evaluated. The performances of the automatic scripts for populating the ontology from the trial registry are not good enough to allow a fully automatic process. Consequently, an automatic update of the ontology is not possible. Most sophisticated Natural Language Processing (NLP) methods, \emph{e.g.} Recurrent Neural Network (RNN) \citep{Mikolov2010}, might achieve better performances. These machine learning methods require a manually labeled training dataset, which was not available in our case. However, the ontology populated here could now be used as a training set, and, in future work, we plan to experiment RNN based NLP techniques. The model we proposed for structuring trials matches the needs of pain treatments, but remains very limited. A more complex model would be required for generalizing the platform beyond pain treatment, \emph{e.g.} a model able to represent chemotherapy regimen or time of drug intake. We designed specific classifications for indications and active principles, instead of reusing existing terminologies such as ATC, ICD10 or SNOMED CT. This was motivated by the known limits of publicly available classifications (\emph{e.g.} ATC and ICD10 do not have multiple inheritance and thus would be more limited for searching) and the fact that more sophisticated terminologies are not publicly available (\emph{e.g.} SNOMED CT in our country, France). Nevertheless, in the near future, we plan to map those specific classifications to existing classifications, such as ATC and ICD10. In the literature, the closest use of flower glyphs is the work of Pilato \emph{et al.} for the analysis of social sensing on Twitter \citep{Pilato2016}. The authors proposed flower glyphs with 7 colored petals and a center part, corresponding to various emotions (joy, fear,...). In the present work, we extended flower glyphs for the visualization of all \emph{vs} serious ADE, using an inner, darker, petal. Color blind people may not be able to distinguish the various colors of flower glyphs. However, the information carried by the color is redundant with the information carried by the orientation of the petal, thus color blind people should still be able to use flower glyphs efficiently. Most colors on the flower glyph are culturally independent (\emph{e.g.} red for blood). A notable exception is the color of the ``skin and subcutaneous tissue'' category. The proposed platform is limited to descriptive and visual analysis, but does not perform statistical tests, \emph{e.g.} in order to test whether a difference observed in ADE rate is significant or not. While theoretically feasible, implementing statistical tests raises a problem: each test is associated with a risk $\alpha$ (usually 5\%) and a risk $\beta$, and multiplying the test cumulates these risks. It is commonly accepted that, above 5-10 tests, a correction is necessary. Therefore, we decided not to propose statistical tests for now. For indirect comparison, we used placebo as a reference. This works well for mild to moderate pain, however, for severe pain such as cancer pain, placebo may not be a valid option from an ethical point of view. In this case, other references should be considered, \emph{e.g.} morphine. \begin{comment} Several clinical decision support systems were proposed for the management of pain, and reviewed by M.Y. Smith \emph{et al.} \citep{Smith2007_2} and N. Pombo \emph{et al.} \citep{Pombo2014}. They rely on expert knowledge, case-based reasoning, or machine-learning on clinical data collected from patients or Electronic Health Records (EHR). Contrary to the present study, none used trial data, which are of higher quality than clinical data from EHR become of the randomization of the patient during trials. \end{comment} \section{\label{sec:Conclusion}Conclusion} In conclusion, we proposed a method and a platform for the analysis of adverse events observed during clinical trials, and published in trial registries. We applied the platform to pain treatment, and we showed that we were able to obtain results already known from meta-analyses, but also to suggest new insights. These results interested drug safety experts. This work opens many perspectives for future research. First, the automatization of the ontology population from trial registries could be improved, \emph{e.g.} using deep learning and text mining for extracting drug treatments and their indication. Second, the proposed system could be extended to the visualization of patient outcomes in trials, in order to evaluate drug treatment efficacy, or to other data sources, such as ADE declared in pharmacovigilance databases, or ADE observed in real-world prescription data such as health records and OHDSI (Observational Health Data Sciences and Informatics). In this context, the proposed system should be connected to a data warehouse, in addition to an ontology. Third, flower glyphs could be adapted to the presentation of the rate of potential adverse effects described in drug summaries of product characteristics (SPC) or patient leaflets. Fourth, the proposed approach could be applied to other medical domains beyond pain treatment. Finally, the use of the proposed web platform could be experimented in medical initial and continuing education, or associated with decision support tools for prescriptions. \bibliographystyle{elsarticle-num}
\section{Introduction} Since the introduction of the Bost--Connes system in the mid '90s, \cite{BC}, a very rich interplay between number theory and quantum statistical mechanics developed, involving the Galois theory of abelian and non-abelian extensions of number fields (\cite{CoMaRa}, \cite{Corn1}, \cite{HaPa}, \cite{LLN}, \cite{ManMar3}, \cite{Yalk}), Shimura varieties (\cite{CoMa}, \cite{HaPa}, \cite{LLN2}), $L$-series and zeta functions (\cite{CCM}, \cite{Corn2}), etc. On the other hand, the work of Manin and Marcolli, \cite{ManMar}, and the subsequent work \cite{KesStra}, \cite{ManMar2}, \cite{Mar}, developed a theory of limiting modular symbols, and a related noncommutative geometry model of the boundary of modular curves. It was remarked in \S 7.9 of \cite{CoMa-book} that the noncommutative compactification of modular curves of \cite{ManMar} should fit as a ``boundary stratum" of the quantum statistical mechanical system of \cite{CoMa} that generalized the Bost--Connes system from the case of ${\rm GL}_1$ to the case of ${\rm GL}_2$ and has the geometry of modular curves directly built into its construction through the Shimura variety of ${\rm GL}_2$. However, the relation between the limiting modular symbols of \cite{ManMar} and the ${\rm GL}_2$ quantum statistical mechanical system of \cite{CoMa} has not been fully analyzed. It is the purpose of this note to outline a construction of a ``boundary algebra" for the ${\rm GL}_2$ system, endowed with an induced time evolution, that is built on the noncommutative boundary of modular curves described in \cite{ManMar} and on limiting modular symbols. \smallskip \section{The ${\rm GL}_2$-system}\label{GL2Sec} In this section we recall the basic properties of the ${\rm GL}_2$-quantum statistical mechanical system of \cite{CoMa}, in a version that accounts for the choice of a finite index subgroup of ${\rm GL}_2({\mathbb Z})$. \subsection{The ${\rm GL}_2$-quantum statistical mechanical system} The ${\rm GL}_2$-quantum statistical mechanical system constructed in \cite{CoMa} as a generalization of the Bost--Conne system of \cite{BC} has algebra of observables given by the non-commutative $C^*$-algebra describing the ``bad quotient" of the space of $2$-dimensional ${\mathbb Q}$-lattices up to scaling by the equivalence relation of commensurability. This algebra is made dynamical by a time evolution defined by the determinant of the ${\rm GL}_2^+({\mathbb Q})$ matrix that implements commensurability. There is an arithmetic algebra of unbounded multipliers on the $C^*$-algebra of observable, which is built in a natural way out of modular functions and Hecke operators (see \cite{CoMa} and Chapter~3 of \cite{CoMa-book}. The KMS-states for the time evolution have an action of ${\mathbb Q}^*\backslash {\rm GL}_2({\mathbb A}_{{\mathbb Q},f})$ by symmetries, which include both automorphisms and endomorphisms of the $C^*$-dynamical system. The KMS states at zero temperature, defined as weak limits of KMS-states at positive temperature, are evaluations of modular functions at points in the upper half plane and the induced action of symmetries on KMS-states recovers the Galois action of the automorphisms of the modular field. In the case of imaginary quadratic fields, the associated Bost--Connes system, constructed in \cite{HaPa} and \cite{LLN}, can be seen as a specialization of the ${\rm GL}_2$-quantum statistical mechanical system of \cite{CoMa} at $2$-dimensional ${\mathbb Q}$-lattices that are $1$-dimensional ${\mathbb K}$-lattices, with ${\mathbb K}$ the imaginary quadratic field, and to CM points in the upper half plane. \smallskip Our goal here is to adapt this construction to obtain a specialization of the ${\rm GL}_2$ system to the boundary $\P^1({\mathbb R})$ and a further specialization for real quadratic fields. Our starting point will be the same algebra of the ${\rm GL}_2$ system of \cite{CoMa}, hence we start by reviewing briefly that construction in order to use it in our setting. It is convenient, for the setting we consider below, to extend the construction of the ${\rm GL}_2$ system recalled above to the case where we replace ${\rm GL}_2^+({\mathbb Q})$ acting on the upper half plane $\H$ with ${\rm GL}_2({\mathbb Q})$ acting on $\H^\pm$ (the upper and lower half planes) and we consider a fixed finite index subgroup $G$ of ${\rm GL}_2({\mathbb Z})$, where the latter replaces $\Gamma={\rm SL}_2({\mathbb Z}) ={\rm GL}_2^+({\mathbb Q})\cap {\rm GL}_2(\hat{\mathbb Z})$ in the construction of the ${\rm GL}_2$-system. We can formulate the resulting quantum statistical mechanical system in the following way. We can consider two slightly different versions of the convolution algebra. \smallskip \begin{defn}\label{AcG} The involutive algebra ${\mathcal A}^c_G$ is given by complex valued functions on \begin{equation}\label{Upm} {\mathcal U}^\pm =\{ (g,\rho,z) \in {\rm GL}_2({\mathbb Q}) \times M_2(\hat Z) \times \H^\pm\,|\, g\rho \in M_2(\hat {\mathbb Z}) \} \end{equation} that are invariant under the action of $G\times G$ by $(g,\rho,z) \mapsto (\gamma_1 g \gamma_2^{-1}, \gamma_2 z)$, and that have finite support in $g\in G\backslash {\rm GL}_2({\mathbb Q})$, depend on the variable $\rho \in M_2(\hat {\mathbb Z})$ through the projection onto some finite level $p_N: M_2(\hat {\mathbb Z}) \to M_2({\mathbb Z}/N{\mathbb Z})$ and have compact support in the variable $z\in \H^\pm$. The convolution product on ${\mathcal A}^c_G$ is given by \begin{equation}\label{convolG} (f_1\star f_2)(g,\rho,z) =\sum_{h \in G\backslash {\rm GL}_2({\mathbb Q})\,:\, h\rho \in M_2(\hat{\mathbb Z})} f_1(g h^{-1}, h \rho, h(z)) g_2(h,\rho,z) \end{equation} and the involution is $f^*(g,\rho,z)=\overline{f(g^{-1}, g\rho, g(z))}$. The algebra ${\mathcal A}^c_G$ is endowed with a time evolution given by $\sigma_t(f)(g,\rho,z) = |\det(g)|^{it} f(g,\rho,z)$. \end{defn} \smallskip \smallskip Let $\Xi$ denote the coset space $\Xi={\rm GL}_2({\mathbb Z})\backslash {\rm GL}_2({\mathbb Q}) /{\rm GL}_2({\mathbb Z})$ and let ${\mathbb Z} \Xi$ denote the free abelian group generated by the elements of $\Xi$. For simplicity of notation we write $\Gamma ={\rm GL}_2({\mathbb Z})$. The following facts are well known from the theory of Hecke operators. For any double coset $T_\alpha=\Gamma \alpha \Gamma$ in $\Xi$, there are finitely many $\alpha_i \in \Gamma \alpha \Gamma$ such that $\Gamma \alpha \Gamma=\sqcup_i \Gamma \alpha_i$. Thus, one can define a product on $\Xi$ by setting \begin{equation}\label{HeckeOpsProd} T_\alpha T_\beta =\sum_\gamma c_{\alpha\beta}^\gamma T_\gamma \end{equation} where for $\Gamma \alpha \Gamma =\sqcup_i \Gamma \alpha_i$ and $\Gamma\beta \Gamma =\sqcup_j \Gamma \beta_j$, the coefficient $c_{\alpha\beta}^\gamma$ counts the number of pairs $(i,j)$ such that $\Gamma \alpha_i\beta_j =\Gamma \gamma$. The ring structure on ${\mathbb Z}\Xi$ determined by the product \eqref{HeckeOpsProd} can equivalently be described by considering finitely supported functions $f: \Xi \to {\mathbb Z}$ with the associative convolution product \begin{equation}\label{HeckeConv} (f_1\star f_2)(g) =\sum_h f_1(g h^{-1}) f_2(h) \end{equation} where the sum is over the cosets $\Gamma h$ with $h\in {\rm GL}_2({\mathbb Q})$ or equivalently over $\Gamma\backslash {\rm GL}_2({\mathbb Q})$. The Hecke operators are built in this form into the algebra of the ${\rm GL}_2$-system, through the dependence on the variable $g\in \Gamma\backslash {\rm GL}_2({\mathbb Q})/\Gamma$, see the discussion in \cite{CoMa-book}, Proposition~3.87. \smallskip We introduce here a variant ${\mathcal A}^c_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$ of the ${\rm GL}_2$-algebra, where an additional variable is introduced that accounts for the choice of the finite index subgroup $G\subset {\rm GL}_2({\mathbb Z})$ through the coset spaces $\P_\alpha={\rm GL}_2({\mathbb Z}) \alpha G/G$, for $\alpha \in {\rm GL}_2({\mathbb Q})$, which include for $\alpha=1$ the coset space $\P={\rm GL}_2({\mathbb Z})/G$. \begin{lem}\label{cosetsHecke} Let $G\subset {\rm GL}_2({\mathbb Z})$ be a finite index subgroup such that $\alpha^{-1} G \alpha \cap {\rm GL}_2({\mathbb Z})$ is also a finite index subgroup, for all $\alpha \in {\rm GL}_2({\mathbb Q})$. Consider the double coset ${\rm GL}_2({\mathbb Z}) \alpha G$, with the left action of ${\rm GL}_2({\mathbb Z})$ and the right action of $G$. The orbit spaces $\P_\alpha={\rm GL}_2({\mathbb Z}) \alpha G/G$ are finite. The algebra ${\mathbb Z}\Xi$ of Hecke operators acts on the module ${\mathbb Z} {\mathcal P}$ with ${\mathcal P}=\cup_\alpha \P_\alpha$. \end{lem} \proof We show that the map ${\rm GL}_2({\mathbb Z})\to {\rm GL}_2({\mathbb Z}) \alpha G$ given by multiplication $\gamma \mapsto \gamma \alpha$ induces a bijection between ${\rm GL}_2({\mathbb Z})/(\alpha^{-1} G \alpha \cap {\rm GL}_2({\mathbb Z}))$ and ${\rm GL}_2({\mathbb Z}) \alpha G/G$, hence the orbit space $\P_\alpha={\rm GL}_2({\mathbb Z}) \alpha G/G$ is finite. For $\ell=\alpha^{-1} g \alpha \in \alpha^{-1} G \alpha \cap {\rm GL}_2({\mathbb Z})$ and $\gamma \in {\rm GL}_2({\mathbb Z})$ we have $\gamma \ell \alpha =\gamma \alpha g \sim \gamma \alpha$ in $\Gamma \alpha G/G$ so the map is well defined on equivalence classes. It is injective since two $\gamma,\gamma'\in \Gamma$ with the same image differ by $\gamma'\gamma^{-1}=\alpha^{-1} \ell \alpha$ in $\alpha^{-1} G \alpha \cap \Gamma$ and it is also surjective by construction. The action of the algebra ${\mathbb Z}\Xi$ of Hecke operators is given by the usual multiplication of cosets. We write $\Gamma \alpha \Gamma=\sqcup_i \Gamma \alpha_i$ for finitely many $\alpha_i \in \Gamma \alpha \Gamma$ and $\Gamma \beta G=\sqcup_j \Gamma \beta_j$ for finitely many $\beta_j \in \Gamma \beta G$. The product is then given by $$ \Gamma \alpha \Gamma \cdot \Gamma \beta G =\sum_\gamma c_{\alpha\beta}^\gamma \Gamma \gamma G$$ where $c_\gamma$ counts the number of pairs $(i,j)$ such that $\Gamma \alpha_i \beta_j =\Gamma \gamma$. \endproof \smallskip The condition that $\alpha^{-1} G \alpha \cap {\rm GL}_2({\mathbb Z})$ is also a finite index subgroup, for all $\alpha \in {\rm GL}_2({\mathbb Q})$ is certainly satisfied, for instance, when $G$ is a congruence subgroup. \smallskip Given a generator $T_\alpha$ in the Hecke algebra ${\mathbb Z}\Xi$ and an element $\sum_s a_s \delta_s$ in ${\mathbb Z}{\mathcal P}$, we write the action of ${\mathbb Z}\Xi$ on the module ${\mathbb Z}{\mathcal P}$ as \begin{equation}\label{actionT1} T_\alpha \sum_s a_s \delta_s = \sum_s a_s T_\alpha \delta_s =\sum_s a_s \sum_i c_{\alpha,s}^i \delta_{s_i} = \sum_i (\sum_s a_s c_{\alpha,s}^i) \delta_{s_i}. \end{equation} We can equivalently write elements of ${\mathbb Z}{\mathcal P}$ as finitely supported functions $\xi: {\mathcal P} \to {\mathbb Z}$, and elements of ${\mathbb Z}\Xi$ as finitely supported functions $f: \Xi \to {\mathbb Z}$, and write the action \begin{equation}\label{actionT2} (f \star \xi)(s)=\sum_h f(gh^{-1}) \xi(hs) \end{equation} where the sum is over cosets $\Gamma h$ and for $\xi(s)=\sum_\sigma a_\sigma \delta_\sigma(s)$ we write $\xi(hs)$ for \begin{equation}\label{actionT3} \xi(hs):=\sum_i (\sum_\sigma a_\sigma c_{h,\sigma}^i) \delta_{s_i}(s). \end{equation} \smallskip \begin{defn}\label{AcGP} Let $G\subset {\rm GL}_2({\mathbb Z})$ be a finite index subgroup and let ${\mathcal P}=\cup_\alpha \P_\alpha$ with $\P_\alpha={\rm GL}_2({\mathbb Z}) \alpha G/G$ for $\alpha \in {\rm GL}_2({\mathbb Q})$. The involutive algebra ${\mathcal A}^c_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$ is given by complex valued functions on the space \begin{equation}\label{UpmGXi} {\mathcal U}^\pm_{G,{\mathcal P}} =\{ (g,\rho,z,\xi) \in {\rm GL}_2({\mathbb Q})\times M_2(\hat {\mathbb Z}) \times \H^\pm \times {\mathcal P} \,|\, g\rho \in M_2(\hat {\mathbb Z}) \} , \end{equation} that are invariant under the action of ${\rm GL}_2({\mathbb Z}) \times {\rm GL}_2({\mathbb Z})$ by $$(g,\rho,z,s) \mapsto (\gamma_1 g \gamma_2^{-1}, \gamma_2 z, \gamma_2 s). $$ Moreover, functions in ${\mathcal A}^c_{{\rm GL}_2({\mathbb Z}),\P}$ have finite support in ${\rm GL}_2({\mathbb Z})\backslash {\rm GL}_2({\mathbb Q})$ and in ${\mathcal P}$, compact support in $z\in \H^\pm$, and they depend on the variable $\rho \in M_2(\hat {\mathbb Z})$ through the projection onto some finite level $p_N: M_2(\hat {\mathbb Z}) \to M_2({\mathbb Z}/N{\mathbb Z})$. The convolution product of ${\mathcal A}^c_{{\rm GL}_2({\mathbb Z}),{\mathcal P}}$ is given by \begin{equation}\label{AGPconvol} (f_1\star f_2)(g,\rho,z,s) =\sum_{h \in {\rm GL}_2({\mathbb Z})\backslash {\rm GL}_2({\mathbb Q})\,:\, h\rho \in M_2(\hat{\mathbb Z})} f_1(g h^{-1}, h \rho, h(z), hs) f_2(h,\rho,z, s), \end{equation} where we are using the notation \eqref{actionT2}, \eqref{actionT3} for the action of Hecke operators on functions of ${\mathcal P}$. The involution is $f^*(g,\rho,z,s)=\overline{f(g^{-1}, g\rho, g(z), g s)}$. The algebra ${\mathcal A}^c_{{\rm GL}_2({\mathbb Z}),\P}$ is endowed with a time evolution given by $$\sigma_t(f)(g,\rho,z,s) = |\det(g)|^{it} f(g,\rho,z,s).$$ \end{defn} \smallskip We focus here on the algebra ${\mathcal A}^c_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$ and we construct Hilbert space representations analogous to the ones considered for the original ${\rm GL}_2$-system. \smallskip We consider the set ${\mathcal S}_\rho:={\rm GL}_2({\mathbb Z})\backslash \{ g\in {\rm GL}_2({\mathbb Q}) \,:\, g\rho \in M_2(\hat{\mathbb Z})\}$. For $\rho\in {\rm GL}_2(\hat{\mathbb Z})$ this set is ${\mathcal S}_\rho= {\rm GL}_2({\mathbb Z})\backslash M_2^\times({\mathbb Z})$, with $M_2^\times({\mathbb Z})=\{ M\in M_2({\mathbb Z})\,|\, \det(M)\neq 0\}$. Consider then the Hilbert space ${\mathcal H}_\rho =\ell^2({\mathcal S}_\rho)$, and the representations $\pi_{(\rho,z)}: {\mathcal A}^c_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}} \to {\mathcal B}({\mathcal H}_\rho)$ $$ \pi_{(\rho,z)}(f) \xi (g) =\sum_{h\in {\mathcal S}_\rho} f(gh^{-1}, h\rho, h(z), hs) \xi(h). $$ We can complete the algebra ${\mathcal A}^c_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$ to a $C^*$-algebra ${\mathcal A}_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$ in the norm $\| f \|=\sup_{(\rho,z,s)} \| \pi_{(\rho,z,s)}(f) \|_{{\mathcal B}({\mathcal H}_\rho)}$. The time evolution is implemented in the representation $\pi_{(\rho,z,s)}$ by the Hamiltonian $H \xi (g) = \log |\det(g)| \, \xi(g)$. \smallskip \subsection{The arithmetic algebra}\label{arithmSec} We proceed exactly as in the case of the ${\rm GL}_2$-system of \cite{CoMa} to construct an arithmetic algebra associated to ${\mathcal A}_{{\rm GL}_2({\mathbb Z}),\P}$. As in \cite{CoMa} this will not be a subalgebra but an algebra of unbounded multipliers. \smallskip The arithmetic algebra ${\mathcal A}^{ar}_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$ is the algebra over ${\mathbb Q}$ obtained as follows. We consider functions on ${\mathcal U}^\pm_{G,{\mathcal P}}$ of \eqref{UpmGXi} that are invariant under the action of ${\rm GL}_2({\mathbb Z}) \times {\rm GL}_2({\mathbb Z})$ by $(g,\rho,z) \mapsto (\gamma_1 g \gamma_2^{-1}, \gamma_2 \rho, \gamma_2 z)$ and that are finitely supported in $g\in G\backslash{\rm GL}_2({\mathbb Q})$ and in ${\mathcal P}$, that depend on $\rho$ through some finite level projection $p_N(\rho)\in M_2({\mathbb Z}/N{\mathbb Z})$ and that are holomorphic in the variable $z\in \H$ and satisfy the growth condition that $| f(g,\rho,z,s) |$ is bounded by a polynomial in $\max\{ 1, \Im(z)^{-1} \}$ when $\Im(z)\to \infty$. The resulting algebra ${\mathcal A}^{ar}_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$ acts, via the convolution product \eqref{AGPconvol}, as unbounded multipliers on the algebra ${\mathcal A}_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$. This construction and its properties are completely analogous to the original case of the ${\rm GL}_2$-system and we refer the reader to \cite{CoMa}, \cite{CoMa-book} for details. \smallskip The invariance property ensures that these are modular functions for $G$ (written as ${\rm GL}_2({\mathbb Z})$-invariant functions on $\H\times \P$ rather than as $G$-invariant functions on $\H$). These functions are endowed with the same convolution product \eqref{AGPconvol}. \medskip \section{Boundary ${\rm GL}_2$-system} We now consider how to extend this setting to incorporate the boundary $\P^1({\mathbb R})$ of the upper half-plane $\H$ and ${\mathbb Q}$-pseudo-lattices generalizing the ${\mathbb Q}$-lattices of \cite{CoMa}. A brief discussion of the boundary compactification of the ${\rm GL}_2$-system was given in \S 7.9 of \cite{CoMa-book}, but the construction of a suitable quantum statistical mechanical system associated to the boundary was never worked out in detail. We introduce here an algebra associated to the boundary $\P^1({\mathbb R})$ with the action of ${\rm GL}_2({\mathbb Z})$. Instead of considering the full $\P^1({\mathbb R})$, we restrict to $[0,1]$, which meets every orbit of the ${\rm GL}_2({\mathbb Z})$ action, and we implement the action of the semigroup of reduced matrices in ${\rm GL}_2({\mathbb Z})$ in the form of a crossed product algebra. We analyze Hilbert space representations, time evolution, Hamiltonian, partition function and KMS states. \subsection{Boundary dynamics and symmetries} The set $[0,1]\times \P$ meets every orbit of the action of ${\rm GL}_2({\mathbb Z})$ on $\P^1({\mathbb R})\times \P$, acting on $\P^1({\mathbb R})$ by fractional linear transformations and on $\P= {\rm GL}_2({\mathbb Z})/G$ by the left-action of ${\rm GL}_2({\mathbb Z})$ on itself. Moreover, two points $(x,s)$ and $(y,t)$ in $[0,1]\times \P$ are in the same ${\rm GL}_2({\mathbb Z})$-orbit iff there are integers $n,m\in {\mathbb N}$ such that $T^n(x,s)=T^m(y,t)$, where $T$ is the shift operator on $[0,1]\times \P$ given by \begin{equation}\label{Tmap} T: (x,s) \mapsto \left( \frac{1}{x}-\left[ \frac{1}{x} \right], \begin{pmatrix} -[1/x] & 1 \\ 1 & 0 \end{pmatrix} \cdot s \right). \end{equation} \smallskip \begin{lem}\label{actionP} The action of the shift map \eqref{Tmap} on $[0,1]\times \P$ extends to an action on $[0,1]\times \P_\alpha$, with $\P_\alpha={\rm GL}_2({\mathbb Z}) \alpha G/G$, for any given $\alpha \in {\rm GL}_2({\mathbb Q})$, hence to an action on $[0,1]\times {\mathcal P}$ with ${\mathcal P}=\cup_\alpha \P_\alpha$. \end{lem} \proof The action of $T$ on $(x,s)\in [0,1]\times \P$ is implemented by the action of the matrix $$ \begin{pmatrix} -[1/x] & 1 \\ 1 & 0 \end{pmatrix} \in {\rm GL}_2({\mathbb Z}). $$ The same matrix acts by left multiplication on $\P_\alpha={\rm GL}_2({\mathbb Z}) \alpha G/G$, hence it determines a map $T: [0,1]\times \P_\alpha \to [0,1]\times \P_\alpha$. \endproof \smallskip \begin{lem}\label{actionscommute} Let ${\mathbb C}{\mathcal P}$ denote the ring of finitely supported complex valued functions on ${\mathcal P}$ and let ${\mathcal B}={\mathcal B}([0,1],{\mathbb C}{\mathcal P})$ denote the ring of bounded functions from $[0,1]$ to ${\mathbb C}{\mathcal P}$. Consider the action of the semigroup ${\mathbb Z}_+$ on ${\mathcal B}$ determined by the action of $T$ on $[0,1]\times {\mathcal P}$ of Lemma~\ref{actionP} and the action on ${\mathcal B}$ by Hecke operators acting on ${\mathbb C}{\mathcal P}$. These two actions commute. \end{lem} \proof We write functions $f \in {\mathcal B}$ in the form $\sum_\alpha f_\alpha(x,s_\alpha) \delta_\alpha$ where $\delta_\alpha$ is the characteristic function of $\P_\alpha={\rm GL}_2({\mathbb Z}) \alpha G/G$ and $s_\alpha \in \P_\alpha$. The action of ${\mathbb Z}_+$ is given by $$ T^n: \sum_\alpha f_\alpha(x,s_\alpha)\delta_\alpha \mapsto \sum_\alpha f_\alpha(T^n(x,s_\alpha))\delta_\alpha, $$ with $T(x,s_\alpha)$ as in \eqref{Tmap}, while the action of a Hecke operator $T_\beta$ is given by \begin{equation}\label{THeckeact} T_\beta: \sum_\alpha f_\alpha(x,s_\alpha)\delta_\alpha \mapsto \sum_\gamma (\sum_\alpha c_{\beta,\alpha}^\gamma f_\alpha(x, s_\alpha)) \delta_\gamma, \end{equation} with $c_{\beta\alpha}^\gamma$ defined as in \eqref{actionT1}. It is then clear that these two actions commute. \endproof \smallskip \begin{lem}\label{Tactiongk} Let $X_k \subset [0,1]$ be the subset of points $x\in [0,1]$ with continued fraction expansion starting with the digit $k\in {\mathbb N}$. Let ${\mathcal B}$ denote the algebra of bounded complex valued functions on $[0,1] \times {\mathcal P}$. Let $\tau(f)=f\circ T$ denote the action of the shift $T: [0,1] \to [0,1]$ of the continued fraction expansion on $f\in {\mathcal B}$. Let ${\mathcal B}$ act as multiplication operators on $L^2([0,1],d\mu)$ with $d\mu$ the unique $T$-invariant probability measure on $[0,1]$, $$ d\mu(x)= \frac{1}{\log 2} \, \frac{1}{1+x} \, dx . $$ With the notation \begin{equation}\label{gkmat} g_k =\begin{pmatrix} 0 & 1 \\ 1 & k \end{pmatrix} \ \ \ \text{ with } \ \ \ g_k^{-1} = \begin{pmatrix} -k & 1 \\ 1 & 0 \end{pmatrix}, \end{equation} consider the operators \begin{equation}\label{Skops} S_k \xi (x) =\chi_{X_k}(x) \cdot \xi (g_k^{-1} x) \, \ \ \ \text{ and } \ \ \ \tilde S_k \xi (x) = \xi( g_k\, x ), \end{equation} for $\xi\in L^2([0,1],d\mu)$, with $\chi_{X_k}$ the characteristic function of the subset $X_k\subset [0,1]$. These satisfy $\tilde S_k=S_k^*$ with $S_k^* S_k =1$ and $\sum_k S_k S_k^*=1$ They also satisfy the relation \begin{equation}\label{TSk} \sum_k S_k \, f \, S_k^* =f\circ T . \end{equation} \end{lem} \proof The shift map of the continued fraction expansion, given by $T(x) =1/x - [1/x]$, acts on $x\in X_k$ as $x\mapsto g_k^{-1} x$ with the matrix $g_k^{-1}$ acting by fractional linear transformations. The operators $S_k$ defined as in \eqref{Skops} are not isometries on $L^2([0,1],dx)$ with respect to the Lebesgue measure $dx$. However, if we consider the unique $T$-invariant probability measure on $[0,1]$ given by $d\mu(x)=\log(2)^{-1}(1+x)^{-1} dx$, then we have $d\mu\circ g_k^{-1}|_{X_k}=d\mu |_{X_k}$ for all $k\in {\mathbb N}$, hence $\langle S_k \xi_1, S_k \xi_2\rangle =\int_{X_k} \bar \xi_1\circ g_k^{-1}\, \xi_2\circ g_k^{-1} \, d\mu= \int_{X_k} \bar \xi_1\circ g_k^{-1}\, \xi_2\circ g_k^{-1} \, d\mu\circ g_k^{-1} =\int_{[0,1]} \bar \xi_1\, \xi_2\, d\mu= \langle \xi_1, \xi_2\rangle$. We have $\tilde S_k\, S_k \xi(x) = \xi(x) \chi_{X_k}(g_k x)= \xi(x)$. Moreover, $\tilde S_k=S_k^*$ in this inner product since we have $\langle \xi_1, S_k \xi_2\rangle =\int_{X_k} \bar \xi_1\, \xi_2\circ g_k^{-1} \, d\mu = \int_{X_k} \bar \xi_1\, \xi_2\circ g_k^{-1} \, d\mu\circ g_k^{-1} = \int_{[0,1]} \bar \xi_1\circ g_k\, \xi_2 \, d\mu = \langle \tilde S_k \xi_1, \xi_2 \rangle$. We also have $\sum_k S_k \, f \, S_k^* \xi(x) = \sum_k f(g_k^{-1} x) \chi_{X_k}(x) \xi(x) =f(T(x))$. Thus we obtain $\sum_k S_k \, f \, S_k^* =f\circ T$, which in particular also implies $\sum_k S_k \, S_k^* =1$. \endproof \smallskip Consider the set of matrices in ${\rm GL}_2({\mathbb Z})$ of the form \begin{equation}\label{Redn} {\rm Red}_n:=\left\{ \, \begin{pmatrix} 0 & 1\\ 1 & k_1 \end{pmatrix} \ \dots \ \begin{pmatrix} 0 & 1\\ 1 & k_n \end{pmatrix}\,|\,k_1,\dots , k_n\ge 1;\, k_i\in{\mathbb Z}\right\} \end{equation} The semigroup of reduced matrices is defined as \begin{equation}\label{Red} {\rm Red}:=\cup_{n\ge 1}\, {\rm Red}_n \subset {\rm GL}_2({\mathbb Z}) \end{equation} An equivalent description of the ${\rm Red}$ semigroup is given by (\cite{LewZag}) $$ {\rm Red}=\{ \begin{pmatrix} a & b \\ c & d \end{pmatrix} \in {\rm GL}_2({\mathbb Z}) \,|\, 0\leq a \leq b, \, 0\leq c\leq d \}. $$ \smallskip \begin{lem}\label{homRed} Assigning to a matrix \begin{equation}\label{prodRed} \gamma = \begin{pmatrix} 0 & 1 \\ 1 & n_1 \end{pmatrix} \cdots \begin{pmatrix} 0 & 1 \\ 1 & n_N \end{pmatrix} \end{equation} in ${\rm Red}$ the product $n_1\cdots n_N \in {\mathbb N}$ is a well defined semigroup homomorphism. \end{lem} \proof We only need to check that the representation of a matrix $\gamma$ in ${\rm Red}$ as a product \eqref{prodRed} is unique so that the map is well defined. It is then by construction a semigroup homomorphism. The group ${\rm GL}_2({\mathbb Z})$ has generators $$ \sigma=\begin{pmatrix} 1 & 0 \\ 1 & 1 \end{pmatrix} \ \ \ \ \rho=\begin{pmatrix} 0 & 1 \\ 1 & 1 \end{pmatrix} $$ with relations $(\sigma^{-1}\rho)^2 =(\sigma^{-2}\rho^2)^6 =1$. The semigroup ${\rm Red}$ can be equivalently described as the subsemigroup of the semigroup generated by $\sigma$ and $\rho$ made of all the words in $\sigma$, $\rho$ that end in $\rho$, so elements are products of matrices of the form $\sigma^{n-1}\rho =\begin{pmatrix} 0 & 1 \\ 1 & n \end{pmatrix}$, $$ \gamma = \begin{pmatrix} 0 & 1 \\ 1 & n_1 \end{pmatrix} \cdots \begin{pmatrix} 0 & 1 \\ 1 & n_{\ell(\gamma)} \end{pmatrix} $$ where $\ell(\gamma)$ to be the number of $\rho$'s in the word in $\sigma$ and $\rho$ representing $\gamma$. The semigroup generated by $\sigma$ and $\rho$ is a free semigroup, as the only relations in ${\rm GL}_2({\mathbb Z})$ between these generators involve the inverse $\sigma^{-1}$. In an element $\gamma \in {\rm Red}$ had two different representations \eqref{prodRed}, for two different ordered sets $\{ n_1, \ldots, n_N \}$ and $\{ k_1, \ldots, k_L \}$ then we would have a relation $\sigma^{n_1-1}\rho \sigma^{n_2-1}\rho \cdots \sigma^{n_N-1}\rho = \sigma^{k_1-1}\rho \sigma^{k_2-1}\rho\cdots \sigma^{k_L-1}\rho$ involving the generators $\sigma$ and $\rho$ but not their inverses, which would contradict the fact that $\sigma$ and $\rho$ generate a free semigroup. \endproof \smallskip \begin{lem}\label{lemRedHecke} Let ${\mathcal B}$ denote the algebra of bounded complex valued functions on $[0,1] \times {\mathcal P}$ that are finitely supported in ${\mathcal P}$. The transformations $\alpha_\gamma(f)=\chi_{X_\gamma} \cdot f\circ \gamma^{-1}$ define a semigroup action of ${\rm Red}$ on ${\mathcal B}$. This action commutes with the action of Hecke operators. \end{lem} \proof We check that $\alpha_\gamma(f)=\chi_{X_\gamma} \cdot f\circ \gamma^{-1}$ is a well defined semigroup action of ${\rm Red}$ on ${\mathcal B}$. For $\gamma$ of the form \eqref{prodRed} we have $\alpha_\gamma=\alpha_{g_1}\cdots \alpha_{g_n}$ with the factors $g_k$ as in \eqref{gkmat}, since for two matrices $\gamma,\gamma'$ in ${\rm Red}$ related by $\gamma' =g_k \gamma$ for some $g_k$ as in \eqref{gkmat} we have $\chi_{X_k} \cdot \chi_{X_{\gamma'}}\circ g_k^{-1}=\chi_{X_\gamma}$. The commutation with the action of Hecke operators can be checked as in the case of the shift $T$ in Lemma~\ref{actionscommute}. We write elements of the algebra in the form $\sum_\alpha f_\alpha(x,s_\alpha) \delta_\alpha$ where $\delta_\alpha$ is the characteristic function of $\P_\alpha={\rm GL}_2({\mathbb Z}) \alpha G/G$ and $s_\alpha \in \P_\alpha$, with the action of Hecke operators as in \eqref{THeckeact}. The action of $\gamma \in {\rm Red}$ on the other hand is given by $\alpha_{\gamma}\, \sum_\alpha f_\alpha(x,s_\alpha)\delta_\alpha=\sum_\alpha \chi_{X_\gamma}(x)\, f(\gamma^{-1}(x,s_\alpha)) \delta_\alpha$. These actions commute, as in the case of Lemma~\ref{actionscommute}. \endproof \smallskip \subsection{A boundary algebra} We now introduce an algebra associated to the boundary of the ${\rm GL}_2$-system. Instead of requiring invariance with respect to the ${\rm GL}_2({\mathbb Z})$ action in the boundary variable $\theta \in \P^1({\mathbb R})$, we restrict the variable to the interval $[0,1]$, because of the prior observation that this set meets every ${\rm GL}_2({\mathbb Z})$-orbit and we implement the action of the shift operator $T$ in the form of a semigroup crossed product algebra. This corresponds to taking the quotient by the action of $T$ (hence by the action of ${\rm GL}_2({\mathbb Z})$) in a noncommutative way, by considering a crossed product algebra instead of an algebra of functions constant along the orbits. This will be a semigroup crossed product with respect to the semigroup ${\rm Red}$ discussed above, and in a form that will implement the action of the shift operator $T$ as in Lemma~\ref{Tactiongk}. The semigroup crossed product approach is better in the boundary case than requiring ${\rm GL}_2({\mathbb Z})$-invariance as in the bulk case, because, unlike the bulk case, the boundary action of ${\rm GL}_2({\mathbb Z})$ on $\P^1({\mathbb R})$ has dense orbits. We will also be considering bounded functions of $x\in [0,1]$, rather than continuous. The reason will be clear when we consider such boundary functions that are obtained as integration on certain configurations of geodesics in the bulk space. \smallskip \begin{defn}\label{subalg0} Let ${\mathcal A}_\partial^c$ denote the associative algebra of continuous complex valued functions on \begin{equation}\label{UG0} {\mathcal U}_{\partial,G}=\{ (g, \rho, s) \in {\rm GL}_2({\mathbb Q}) \times M_2(\hat {\mathbb Z})\times {\mathcal P} \,|\, g\rho\in M_2(\hat {\mathbb Z}) \} \end{equation} that are invariant with respect to the action of $\Gamma\times \Gamma$ by $(g,\rho) \mapsto (\gamma_1 g \gamma_2^{-1}, \gamma_2\rho)$ and are finitely supported in ${\mathcal P}$ and in ${\rm GL}_2({\mathbb Z}) \backslash {\rm GL}_2({\mathbb Q})$ with the dependence on $\rho$ through a finite level projection $p_N(\rho)\in M_2({\mathbb Z}/N{\mathbb Z})$, endowed with the convolution product \begin{equation}\label{convol0} (f_1\star f_2) (g, \rho, s) = \sum_{h\in \Gamma\backslash {\rm GL}_2({\mathbb Q})\,:\, h\rho\in M_2(\hat{\mathbb Z})} f_1(gh^{-1}, h\rho, hs) f_2(h,\rho,s) \end{equation} and with the involution $f^*(g, \rho, s) =\overline{f(g^{-1},g\rho,gs)}$. Let $\pi_{\rho,s}: {\mathcal A}_\partial^c \to {\mathcal B}({\mathcal H}_\rho)$ be the representation $\pi_{\rho,s}(f)\xi(g)=\sum_h f(gh^{-1},h\rho,hs) \xi(h)$ for $h\in \Gamma\backslash G_\rho$ with $G_\rho=\{ g\in {\rm GL}_2({\mathbb Q})\,|\, g\rho\in M_2(\hat{\mathbb Z})\}$. Let ${\mathcal A}_\partial$ denote the $C^*$-algebra completion of ${\mathcal A}_\partial^c$ with respect to $\| f \| =\sup \| \pi_{\rho,s}(f) \|_{{\mathcal H}_\rho}$. Let ${\mathcal B}_\partial ={\mathcal B}([0,1],{\mathcal A}_\partial)$ be the algebra of bounded functions from $[0,1]$ to ${\mathcal A}_\partial$, with pointwise product $$ (f_1\star f_2)(g,\rho,x,s)=\sum_h f_1(gh^{-1},h\rho,x,hs) f_2(h,\rho,x,s) $$ and involution $f^*(g,\rho,x,s)=\overline{f(g^{-1},g\rho,x,gs)}$. \end{defn} \smallskip \begin{defn}\label{semicrossdef} Let ${\mathcal A}_{\partial, G,{\mathcal P}}$ be the involutive associative algebra generated by ${\mathcal B}_\partial$ and by isometries $S_k$, $k\geq 1$ with $S_k^* S_k=1$ and $\sum_{k\in {\mathbb N}} S_k S_k^* =1$ and satisfying the relations \begin{equation}\label{relSkgk} S_k\, f =\chi_{X_k}\, \cdot\, f\circ g_k^{-1}\, \cdot \,S_k \ \ \ \text{ and } \ \ \ S_k^*\, f = f\circ g_k \, \cdot \, S_k^*, \end{equation} where $\chi_{X_k}$ is the characteristic function of the subset $X_k\subset [0,1]$ of points with continued fraction expansion starting with $k$, and the matrices $g_k, g_k^{-1}$ in ${\rm GL}_2({\mathbb Z})$ are as in \eqref{gkmat}, and also the relation \begin{equation}\label{relTSks} \sum_{k\in {\mathbb N}} S_k f S_k^* = f \circ T \end{equation} for all $f\in B_\partial$, where for $f=f(g,\rho,x,s)$ we have $(f\circ T)(g,\rho,x,s)=f(g,\rho,T(x,s))$, with the action of $T$ on $[0,1]\times {\mathcal P}$ as in Lemma~\ref{actionP}, and with $f\circ g_k^{\pm 1}(g,\rho,x,s)= f(g,\rho,g_k^{\pm 1} (x,s))$. The involution on ${\mathcal A}_{\partial, G,{\mathcal P}}$ is given by the involution on ${\mathcal B}_\partial$ and by $S_k \mapsto S_k^*$. \end{defn} In fact, the relation \eqref{relTSks} follows from the relations \eqref{relSkgk} as in Lemma~\ref{Tactiongk}, but we write it explicitly as it is the relation that implements the dynamical system $T$. Note that we are implicitly using in the construction of the algebra the fact that the semigroup action of ${\rm Red}$ and the action of Hecke operators (that is built into the convolution product of ${\mathcal B}_\partial$ commute as in Lemma~\ref{lemRedHecke}. \smallskip \begin{lem}\label{crossRed} The algebra ${\mathcal A}_{\partial, G,{\mathcal P}}$ can be identified with the semigroup crossed product ${\mathcal B}_\partial \rtimes {\rm Red}$ of the algebra ${\mathcal B}_\partial$ of Definition~\ref{subalg0} and the semigroup of reducible matrices, with respect to the action $\alpha: {\rm Red} \to {\rm Aut}(B_\partial)$ by $\alpha_\gamma(f)=\chi_{X_\gamma} \cdot f\circ \gamma^{-1}$, where for $\gamma$ of the form \eqref{prodRed}, the set $X_\gamma \subset [0,1]$ is the cylinder set consisting of points with continued fraction expansion starting with the sequence $n_1,\ldots, n_N$. \end{lem} \proof We see as in Lemma~\ref{lemRedHecke} that $\alpha_\gamma(f)=\chi_{X_\gamma} \cdot f\circ \gamma^{-1}$ defines a semigroup action of ${\rm Red}$ on ${\mathcal B}_\partial$. The semigroup crossed product algebra is generated by $B_\partial$ and by isometries $\mu_\gamma$ for $\gamma\in {\rm Red}$ satisfying $\mu_\gamma \mu_{\gamma'}=\mu_{\gamma \gamma'}$ for all $\gamma,\gamma' \in {\rm Red}$, $\mu_\gamma^* \mu_\gamma=1$ for all $\gamma\in {\rm Red}$ and $\mu_\gamma\, f\, \mu_\gamma^* =\alpha_\gamma(f)$. It suffices to consider isometries $\mu_{g_k} =:S_k$ associated to the elements $g_k \in {\rm Red}$ as in \eqref{gkmat} with $\mu_\gamma =S_{n_1}\cdots S_{n_N}$ for $\gamma\in {\rm Red}$ as in \eqref{prodRed}. We then see that the generators and relations of the algebras $B_\partial \rtimes {\rm Red}$ agree with those of the algebra ${\mathcal A}_{\partial, G,{\mathcal P}}$ of Definition~\ref{semicrossdef}. \endproof \smallskip \begin{cor}\label{BEsubalg} Let $E\subset [0,1]\times {\mathcal P}$ be a subset invariant under the action of the shift $T$ of the continued fraction expansion. Then $E$ determines an algebra of ${\mathcal A}_{\partial, G,{\mathcal P},E}$ given by $B_{\partial,E}\rtimes {\rm Red}$ where $B_{\partial,E}={\mathcal B}(E,{\mathcal A}_\partial)$ is the algebra of bounded functions from $E$ to ${\mathcal A}_\partial$ as in Definition~\ref{subalg0}. Extending the functions by zero outside of $E$ realizes ${\mathcal A}_{\partial, G,{\mathcal P},E}$ as a subalgebra of ${\mathcal A}_{\partial, G,{\mathcal P}}$. \end{cor} \proof If the set $E$ is $T$-invariant then the algebra $B_{\partial,E}$ is invariant under the action of the semigroup ${\rm Red}$ by $\alpha_\gamma(f)=\chi_{X_\gamma} \cdot f\circ \gamma^{-1}$, since for $\gamma=g_{k_1}\cdots g_{k_n}$, the matrix $\gamma^{-1}$ acts on $X_\gamma$ as the shift $T^n$. Thus, we can form the semigroup crossed product algebra $B_{\partial,E}\rtimes {\rm Red}$ as in Lemma~\ref{crossRed}. Since $B_{\partial,E}$ and $B_\partial$ are algebras of bounded functions that are not required to be continuous, extending the functions to zero outside of $E$ realizes $B_{\partial,E}$ as a subalgebra of $B_\partial$ compatibly with the action of the semigroup ${\rm Red}$. \endproof \smallskip \subsection{Representations and time evolution} Let ${\mathcal H}_\rho$ be the same Hilbert space considered above, ${\mathcal H}_\rho=\ell^2({\mathcal S}_\rho)$ with ${\mathcal S}_\rho={\rm GL}_2({\mathbb Z})\backslash G_\rho$ where $G_\rho=\{ g\in {\rm GL}_2({\mathbb Q}) \,|\, g\rho \in M_2(\hat{\mathbb Z}) \}$. We will consider the case of an invertible $\rho\in {\rm GL}_2(\hat{\mathbb Z})$, for which ${\mathcal S}_\rho ={\rm GL}_2({\mathbb Z})\backslash M_2^\times({\mathbb Z})$, with $M_2^\times({\mathbb Z})=\{ M \in M_2({\mathbb Z})\,|\, \det(M)\neq 0 \}$. Let ${\mathcal W}=\cup_N {\mathcal W}_N$ denote the set of all finite sequences $k_1,\ldots, k_N$ with $k_i \in {\mathbb N}$, including an element $\emptyset$ corresponding to the empty sequence. Consider the Hilbert spaces $\ell^2({\mathcal W})$ and $\tilde{\mathcal H}_\rho =\ell^2({\mathcal W})\otimes {\mathcal H}_\rho$. \smallskip \begin{lem}\label{lemRepCross} The algebra ${\mathcal A}_{\partial, G,{\mathcal P}}={\mathcal B}_\partial \rtimes {\rm Red}$ acts on the Hilbert space $\tilde{\mathcal H}_\rho$ through the representations \begin{equation}\label{repsCross} \pi_{\rho,x,s}(f)\, (\xi(g)\otimes \epsilon_{k_1,\ldots, k_N}) = \sum_{h\in {\mathcal S}_\rho} f(g h^{-1}, h\rho, g_\gamma (x, hs)) \, \xi(h)\otimes \epsilon_{k_1,\ldots, k_N} \end{equation} for $f\in B_\partial$ and with $g_\gamma=g_{k_1}\cdots g_{k_N}$, with $g_{k_i}$ as in \eqref{gkmat}, and \begin{equation}\label{repsCrossS} S_k\, (\xi\otimes\epsilon_{k_1,\ldots, k_N}) = \xi\otimes \epsilon_{k, k_1,\ldots, k_N},\ \ \ \text{ and } \ \ \ S_k^* (\xi\otimes \epsilon_{k_1,\ldots, k_N}) = \left\{ \begin{array}{ll} \xi\otimes \epsilon_{k_2,\ldots, k_N} & k_1=k \\ 0 & \text{otherwise.} \end{array}\right. \end{equation} \end{lem} \proof We check that \eqref{repsCross} gives a representation of the subalgebra $B_\partial$ and that the operators $\pi_{\rho,x,s}(f)$, $S_k$, $S^*_k$ of \eqref{repsCross} and \eqref{repsCrossS} satisfy the relations $S_k^* S_k=1$, $\sum_k S_k S_k^*=1$, $S_k \pi_{\rho,x,s}(f)=\pi_{\rho,x,s}(\chi_{X_k} \, f\circ g_k^{-1}) S_k$ and $S_k^* \pi_{\rho,x,s}(f)=\pi_{\rho,x,s}(f\circ g_k) S_k^*$. For the first property it suffices to see that $\pi_{\rho,x,s}(f_1 \star f_2)=\pi_{\rho,x,s}(f_1) \circ \pi_{\rho,x,s}(f_2)$. We have $$ \pi_{\rho,x,s}(f_1 \star f_2) \, (\xi(g)\otimes \epsilon_{k_1,\ldots, k_N}) =\sum_{h\in {\mathcal S}_\rho} (f_1\star f_2)(g h^{-1}, h\rho, g_\gamma (x, hs)) \, \xi(h)\otimes \epsilon_{k_1,\ldots, k_N} = $$ $$ \sum_{h\in {\mathcal S}_\rho} \sum_{\ell \in {\mathcal S}_\rho} f_1(g h^{-1} \ell^{-1}, \ell h \rho, g_\gamma (x, \ell h s)) f_2(\ell, h \rho, g_\gamma (x, hs)) \xi(h)\otimes \epsilon_{k_1,\ldots, k_N}, $$ where we used Lemma~\ref{lemRedHecke}. This is then equal to $$ \sum_{\ell \in {\mathcal S}_\rho} f_1(g h^{-1} \ell^{-1}, \ell h \rho, g_\gamma (x, \ell h s)) (\pi_{\rho,x,s}(f_2) \xi) (\ell) \otimes \epsilon_{k_1,\ldots, k_N} = \pi_{\rho,x,s}(f_1) \pi_{\rho,x,s}(f_2) \xi \otimes \epsilon_{k_1,\ldots, k_N}. $$ The relations $S_k^* S_k=1$ and $\sum_k S_k S_k^*=1$ follow directly from \eqref{repsCrossS}. For relations between the $S_k,S_k^*$ and the $\pi_{\rho,x,s}(f)$, we have $$ S_k \pi_{\rho,x,s}(f) \, \xi \otimes \epsilon_{k_1,\ldots, k_N} = S_k \sum_{h\in {\mathcal S}_\rho} f(g h^{-1}, h\rho, g_k^{-1} g_k g_\gamma (x, hs)) \, \xi(h)\otimes \epsilon_{k_1,\ldots, k_N} $$ $$ = \sum_{h\in {\mathcal S}_\rho} f(g h^{-1}, h\rho, g_k^{-1} g_k g_\gamma (x, hs))\, \chi_{X_k}(g_k g_\gamma x) \, \xi(h)\otimes \epsilon_{k, k_1,\ldots, k_N}, $$ for $g_\gamma=g_{k_1}\cdots g_{k_N}$, with $\chi_{X_k}(g_k g_\gamma x)=1$, so we get $$ \pi_{\rho,x,s}(\chi_{X_k}\cdot f\circ g_k^{-1}) \, S_k \, \xi \otimes \epsilon_{k, k_1,\ldots, k_N}. $$ The second relation is similar: we have $$ S_k^* \pi_{\rho,x,s}(f) \, \xi \otimes \epsilon_{k_1,\ldots, k_N} = S_k^* \sum_{h\in {\mathcal S}_\rho} f(g h^{-1}, h\rho, g_k^{-1} g_k g_\gamma (x, hs)) \, \xi(h)\otimes \epsilon_{k_1,\ldots, k_N} $$ $$ = \sum_{h\in {\mathcal S}_\rho} f(g h^{-1}, h\rho, g_k g_{\gamma'} (x, hs)) \, S_k^* \xi(h)\otimes \epsilon_{k_1,\ldots, k_N}, $$ with $g_{\gamma'}=g_{k_2}\cdots g_{k_n}$, so that we obtain $$ \pi_{\rho,x,s}(f\circ g_k)\, S_k^*\, \xi \otimes \epsilon_{k_1,\ldots, k_N}. $$ Thus, \eqref{repsCross} and \eqref{repsCrossS} determine a representation of ${\mathcal A}_{\partial, G,{\mathcal P}}={\mathcal B}_\partial \rtimes {\rm Red}$ by bounded operators on the Hilbert space $\tilde{\mathcal H}_\rho$. \endproof \smallskip \begin{prop}\label{timeevolZ} The transformations $\sigma_t(f)(g,\rho,x,s)=|\det(g)|^{it} f(g,\rho,x,s)$ and $\sigma_t(S_k)=k^{it} S_k$ define a time evolution $\sigma: {\mathbb R} \to {\rm Aut}({\mathcal A}_{\partial, G,{\mathcal P}})$. In the representations of Lemma~\ref{lemRepCross} on $\tilde{\mathcal H}_\rho$ with $\rho\in {\rm GL}_2(\hat{\mathbb Z})$ the time evolution is implemented by the Hamiltonian \begin{equation}\label{Hsigmat} H\, \xi(g)\otimes \epsilon_{k_1,\ldots, k_n}= \log (|\det(g)| \cdot k_1 \cdots k_n) \, \xi(g)\otimes \epsilon_{k_1,\ldots, k_n}, \end{equation} with partition function \begin{equation}\label{Zetabeta} Z(\beta)={\rm Tr}(e^{-\beta H}) =\frac{\zeta(\beta) \zeta(\beta-1)}{2-\zeta(\beta)} \end{equation} with $\zeta(\beta)$ the Riemann zeta function. \end{prop} \proof We have $$\sigma_t(f_1\star f_2)(g,\rho,x,s)=\sigma_t (\sum_h f_1(gh^{-1},h\rho,x,hs) f_2(h,\rho,x,s))= $$ $$ \sum_h |\det(gh^{-1}|^{it} |\det(h)|^{it} f_1(gh^{-1},h\rho,x,hs) f_2(h,\rho,x,s)=\sigma_t(f_1)\star \sigma_t(f_2).$$ We also have $\sigma_t(S_k^*)=k^{-it} S_k^*$ and we see that the action of $\sigma_t$ is compatible with the relations in ${\mathcal A}_{\partial, G,{\mathcal P}}$ and defines a $1$-parameter family of algebra homomorphisms. By direct comparison between \eqref{Hsigmat} and \eqref{repsCross} and \eqref{repsCrossS} we also see that $$ \pi_{\rho,x,s}(\sigma_t(f))= e^{it H}\, \pi_{\rho,x,s}(f) \, e^{-itH} \ \ \ \text{ and } \ \ \ \sigma_t(S_k) = e^{it H}\, S_k e^{-it H}\, .$$ We have $$ Z(\beta)=\sum_{g\in {\mathcal S}_\rho} |\det(g)|^{-\beta} \cdot \sum_{k=k_1\cdots k_n} k^{-\beta}. $$ For the first sum, for $\rho\in {\rm GL}_2(\hat{\mathbb Z})$ we have ${\mathcal S}_\rho={\rm GL}_2({\mathbb Z})\backslash M_2^\times({\mathbb Z})$, where $M_2^\times({\mathbb Z})=\{ M \in M_2({\mathbb Z}) \,|\, \det(M)\neq 0 \}$. Thus, we are counting $\{ M\in M_2^\times({\mathbb Z})\,|\, |\det(M)|=n \}$ modulo ${\rm GL}_2({\mathbb Z})$. Up to a change of basis in ${\rm GL}_2({\mathbb Z})$ we can always write a sublattice of ${\mathbb Z}^2$ in the form $$ \begin{pmatrix} a & b \\ 0 & d \end{pmatrix} {\mathbb Z}^2 $$ with $a,d\geq 1$ and $0\leq b < d$, \cite{Serre}. Thus, we are equivalently counting such matrices with determinant $n$. This counting is given by $\sigma_1(n)=\sum_{d|n} d$ so the first sum is $\sum_{n\geq 1} \sigma_1(n)\, n^{-\beta} =\zeta(\beta)\zeta(\beta-1)$ as in the original ${\rm GL}_2$-system. To compute the second sum, let $P_n$ denote the total number of ordered factorizations of $n$ into nontrivial positive integer factors. The sum we are considering is $$ \sum_{n\geq 1} P_n \, n^{-\beta} = 1 + \sum_{k=1}^\infty \sum_{n=2}^\infty n^{-\beta} \sum_{n=n_1\cdots n_k} 1 $$ $$ = 1 + \sum_{k\geq 1} \prod_{i=1}^k (\sum_{n_i\geq 2} n_i^{-\beta}) $$ $$ = \sum_{k=0}^\infty (\zeta(\beta)-1)^k = \frac{1}{2-\zeta(\beta)}. $$ \endproof \smallskip For the purpose of this paper we focus on the low temperature Gibbs states of the system $({\mathcal A}_{\partial,G,{\mathcal P}},\sigma_t)$. A more detailed analysis of the KMS states will be discussed separately. \begin{lem}\label{ZbetaPoles} The partition function $Z(\beta)$ of Proposition~\ref{timeevolZ} is defined by an absolutely convergent series $Z(\beta)={\rm Tr}(e^{-\beta H})=\sum_{\lambda\in {\rm Spec}(H)} e^{-\beta \lambda}$, for $\beta >2$. Its analytic continuation \eqref{Zetabeta} has poles at $\beta\in \{ 1, \beta_c , 2 \}$, for a point $\beta_c \sim 1.728647$. \end{lem} \proof The Riemann zeta function $\zeta(\beta)$ has a pole at $\beta=1$ and in the range $\beta \in (1,\infty)$ it is decreasing to $1$ and it crosses the value $\zeta(\beta)=2$ at a point $\beta_c \sim 1.728647$. The sum $\sum_{n\geq 1} \sigma_1(n) n^{-\beta}$ is convergent for $\beta>2$ and its analytic continuation $\zeta(\beta)\zeta(\beta-1)$ has poles at $\beta=2$ and $\beta=1$. \endproof Thus, the low temperature Gibbs states we will be considering are states in the range $\beta >2$ where the operator $e^{-\beta H}$ is trace class, of the form, for $X\in {\mathcal A}_{\partial,G,{\mathcal P}}$ $$ \varphi_\beta( X ) =\frac{{\rm Tr}( X e^{-\beta H })}{{\rm Tr}(e^{-\beta H}) }= Z(\beta)^{-1} \sum_{k_i, h} |\det(h)|^{-\beta} (k_1\cdots k_n)^{-\beta}\, \langle \delta_h \otimes \epsilon_{k_1,\ldots, k_n}, X \delta_h \otimes \epsilon_{k_1,\ldots, k_n}\rangle. $$ On the subalgebra $X=f(g,\rho,x,s) \in B_\partial$, these Gibbs states give $$ \varphi_{\beta,\rho,x,s}(f)=Z(\beta)^{-1} \sum_{k_i, g} |\det(g)|^{-\beta} (k_1\cdots k_n)^{-\beta} f(1,g\rho, g_\gamma(x,gs)), $$ for $\gamma \in {\rm Red}$ determined by the sequence $k_1, \ldots, k_n$. \smallskip As in \cite{CoMa} we consider the ground states at zero temperature as the weak limit of the Gibbs states for $\beta\to \infty$ $$ \varphi_{\infty,\rho,x,s}(f) =\lim_{\beta \to \infty} \varphi_{\beta,\rho,x,s}(f). $$ These give the projection onto the kernel of the Hamiltonian $$ \varphi_{\infty,\rho,x,s}(f) =\langle \delta_1 \otimes \epsilon_\emptyset, \pi_{\rho,x,s}(f)\, \delta_1 \otimes \epsilon_\emptyset\rangle = f(1,\rho,x,s), $$ the evaluation of the function $f$ at the point $g=1$ and $(\rho,x,s)$ that determines the representation $\pi_{\rho,x,s}$. \medskip \section{Averaging on geodesics and boundary values} In this section we construct boundary values of the observables of the ${\rm GL}_2$-system of \S \ref{GL2Sec}. We use the theory of limiting modular symbols of \cite{ManMar}. We show that the resulting boundary values are localized at the quadratic irrationalities. \subsection{Geodesics between cusps} Let $C_{\alpha,\epsilon,s}$ with $\alpha \in \P^1({\mathbb Q})\smallsetminus \{ 0 \}$, $\epsilon\in \{ \pm \}$, and $s\in \P$ denote the geodesic in $\H^\epsilon \times \P$ with endpoints at the cusps $(0,s)$ and $(\alpha,s)$ in $\P^1({\mathbb Q})\times \P$. \smallskip Let $p_k(\alpha), q_k(\alpha)$ be the successive numerators and denominators of the ${\rm GL}_2({\mathbb Z})$-continued fraction expansion of $\alpha\in {\mathbb Q}$ with $p_n(\alpha)/q_n(\alpha)=\alpha$ and let $$ g_k(\alpha):=\begin{pmatrix} p_{k-1}(\alpha) & p_k(\alpha) \\ q_{k-1}(\alpha) & q_k(\alpha) \end{pmatrix} \in {\rm GL}_2({\mathbb Z}). $$ \smallskip We denote by $C^k_{\alpha,\epsilon,s}$ the geodesic in $\H^\epsilon \times \P$ with endpoints at the cusps $$ \frac{p_{k-1}(\alpha)}{q_{k-1}(\alpha)} = g_k^{-1}(\alpha)\cdot 0 \ \ \text{ and } \ \ \frac{p_k(\alpha)}{q_k(\alpha)} = g_k^{-1}(\alpha)\cdot \infty , $$ where $g\cdot z$ for $g\in {\rm GL}_2({\mathbb Z})$ and $z\in \H^\pm$ is the action by fractional linear transformations. \smallskip For $C$ a geodesic in $\H^\pm$ let $ds_C$ denote the geodesic length element. In the case of $C_{\infty,\epsilon,s}$ we have $ds_{C_{\infty,\epsilon,s}}(z)=dz/z$. \smallskip We use the notation $\{ g\cdot 0, g\cdot \alpha \}_G$ to denote the homology class determined by the image in the quotient $X_G=G\backslash \H = {\rm GL}_2({\mathbb Z})\backslash (\H^\pm \times \P)$ of the geodesic $C_{\alpha,\epsilon,s}$, for $g$ a representative of $s\in \P$. Similarly we write $\{ \alpha, \beta \}_G$ for homology classes determined by the images in the quotient $X_G$ of geodesics in $\H^\pm \times \P$ with endpoints $\alpha,\beta$ at cusps in $\P^1({\mathbb Q})\times \P$. \smallskip \subsection{Limiting Modular Symbols} We recall briefly the construction of limiting modular symbols from \cite{ManMar}. We consider here some finite index subgroup $G\subset \Gamma$ of $\Gamma={\rm PGL}_2({\mathbb Z})$. We denote by $\P= \Gamma/G$ the finite coset space of this subgroup. We also write the quotient modular curve as $X_G=G\backslash \H = \Gamma\backslash (\H \times \P)$. \smallskip Recall that the classical modular symbols $\{ \alpha, \beta \}_G$, with $\alpha,\beta\in \P^1({\mathbb Q})$ are defined as the homology classes in $H_1(X_G,{\mathbb R})$ defined as functionals that integrate lifts to $\H$ of differentials on $X_G$ along the geodesic arc in $\H$ connecting $\alpha$ and $\beta$, see \cite{Man-modsymb}. They satisfy additivity and invariance: for all $\alpha,\beta,\gamma \in \P^1({\mathbb Q})$ $$ \{ \alpha,\beta \}_G + \{ \beta,\gamma \}_G =\{ \alpha, \gamma\}_G \ \ \text{ and } \ \ \{ g\alpha, g\beta \}_G =\{ \alpha, \beta \}_G \ \ \forall g\in G. $$ Thus, it suffices to consider the modular symbols of the form $\{ 0, \alpha \}_G$ with $\alpha\in {\mathbb Q}$. These satisfy the relation $$ \{ 0, \alpha \}_G = - \sum_{k=1}^n \{ \frac{p_{k-1}(\alpha)}{q_{k-1}(\alpha)}, \frac{p_k(\alpha)}{q_k(\alpha)} \}_G = - \sum_{k=1}^n \{ g_k^{-1}(\alpha)\cdot 0, g_k^{-1}(\alpha)\cdot \infty \}_G , $$ where $p_k(\alpha), q_k(\alpha)$ are the successive numerators and denominators of the ${\rm GL}_2({\mathbb Z})$-continued fraction expansion of $\alpha\in {\mathbb Q}$ with $p_n(\alpha)/q_n(\alpha)=\alpha$ and $$ g_k(\alpha)=\begin{pmatrix} p_{k-1}(\alpha) & p_k(\alpha) \\ q_{k-1}(\alpha) & q_k(\alpha) \end{pmatrix} . $$ (There is an analogous formula for the ${\rm SL}_2({\mathbb Z})$-continued fraction.) \smallskip Limiting modular symbols were introduced in \cite{ManMar}, to account for the noncommutative compactification of the modular curves $X_G$ by the boundary $\P^1({\mathbb R})$ with the $G$ action. One considers the infinite geodesics $L_\theta=\{ \infty, \theta \}$ given by the vertical lines $L_\theta =\{ z\in \H \,|\, \Re(z)=\theta \}$ oriented from the point at infinity to the point $\theta$ on the real line. Upon choosing an arbitrary base point $x\in L_\beta$ let $x(s)$ denote the point on $L_\beta$ at an arc-length distance $s$ from $x$ in the orientation direction. One considers the homology class $\{ x, x(s) \}_G \in H_1(X_G,{\mathbb R})$ determined by the geodesic arc between $x$ and $x(s)$. The limiting modular symbol is defined as the limit (when it exists) \begin{equation}\label{limmodsymb} \{\{ \star, \theta \}\}_G := \lim_{s\to \infty} \frac{1}{s} \{ x, x(s) \}_G \in H_1(X_G,{\mathbb R}). \end{equation} \smallskip It was shown in \cite{ManMar} that the limit \eqref{limmodsymb} exists on a full measure set and can be computed by an ergodic average. More generally, it was shown in \cite{Mar} that there is a multifractal decomposition of the real line by level sets of the Lyapunov exponent of the shift of the continued fraction expansion plus an exceptional set where the limit does not exist. On the level sets of the Lyapunov exponent the limit is again given by an average of modular symbols associated to the successive terms of the continued fraction expansion. More precisely, as in the previous section, let $T:[0,1] \to [0,1]$ denote the shift map of the continued fraction expansion, $$ T(x)=\frac{1}{x} - \left[ \frac{1}{x} \right], $$ extended to a map $T: [0,1]\times \P \to [0,1]\times \P$ with $\P=\Gamma/G$ as in \eqref{Tmap}. The Lyapunov exponent of the shift map is given by the limit (when it exists) \begin{equation}\label{Lyapexp} \lambda(x) = \lim_{n\to \infty} \frac{1}{n} \log |(T^n)^\prime(x)| = 2\lim_{n\to \infty} \frac{1}{n} \log q_n(x) , \end{equation} where $q_n(x)$ are the successive denominators of the continued fraction expansion of $x\in [0,1]$. There is a decomposition $[0,1]=\cup_\lambda {\mathcal L}_\lambda \cup {\mathcal L}'$ where ${\mathcal L}_\lambda=\{ x\in [0,1]\,|\, \lambda(x)=\lambda \}$ and ${\mathcal L}'$ the set on which the limit \eqref{Lyapexp} does not exist. For all $\theta\in {\mathcal L}_\lambda$ the limiting modular symbol \eqref{limmodsymb} is then given by \begin{equation}\label{lms2} \{\{ \star, \theta \}\}_G =\lim_{n\to \infty} \frac{1}{\lambda n} \sum_{k=1}^n \{ g_k^{-1}(\theta)\cdot 0, g_k^{-1}(\theta) \cdot \infty \}_G = \lim_{n\to \infty} \frac{1}{\lambda n} \sum_{k=1}^n \{ \frac{p_{k-1}(\theta)}{q_{k-1}(\theta)}, \frac{p_k(\theta)}{q_k(\theta)} \}_G . \end{equation} \smallskip The results of \cite{ManMar} and \cite{Mar} show that the limiting modular symbol \eqref{lms2} vanishes almost everywhere, with respect to the Hausdorff measure of ${\mathcal L}_\lambda$. However, non-vanishing values of the limiting modular symbols are obtained, for example, for all the quadratic irrationalities. \smallskip In the case of quadratic irrationalities, one obtains two equivalent descriptions of the limiting modular symbol, one that corresponds to integration on the closed geodesic $C_\theta =\Gamma_\theta\backslash S_\theta$ with $S_\theta$ the infinite geodesic with endpoints the Galois conjugate pair $\theta,\theta'$ and the other in terms of averaged integration on the modular symbols associated to the (eventually periodic) continued fraction expansion. We obtain the identification of homology classes in $H_1(X_G,{\mathbb R})$ \begin{equation}\label{lmsRM} \{\{ \star, \theta \}\}_G = \frac{\sum_{k=1}^\ell \{ \frac{p_{k-1}(\theta)}{q_{k-1}(\theta)}, \frac{p_k(\theta)}{q_k(\theta)} \}_G}{\lambda(\theta) \ell } = \frac{\{ 0, g\cdot 0 \}_G}{\ell(g)} \, \in H_1(X_G,{\mathbb R}). \end{equation} In the first expression $\ell$ is the minimal positive integer for which $T^\ell (\theta) =\theta$ and the limit defining the Lyapunov exponent $\lambda(\theta)$ exists for quadratic irrationalities. In the second expression $g\in \Gamma$ is the hyperbolic generator of $\Gamma_\theta$ with fixed points $\theta,\theta'$, with eigenvalues $\Lambda_g^\pm$ and $\{ 0, g\cdot 0 \}_G$ denotes the homology class in $H_1(X_G,{\mathbb R})$ of the closed geodesic $C_\theta$ and $\ell(g)=\log \Lambda_g^-=2\log \epsilon$ is the length of $C_\theta$. \smallskip A more complete analysis of the values of the limiting modular symbols was then carried out in \cite{KesStra}, where it was shown that, in fact, the limiting modular symbols is non-vanishing on a multifractal stratification of Cantor sets of positive Hausdorff dimension. We will recall more precisely this result in \S \ref{BoundValSec} below. \smallskip The construction recalled above of limiting modular symbols determine non-trivial real homology classes in the quotient $X_G$ associated to geodesics in $\H$ with endpoints in one of the multifractal level sets of \cite{KesStra}. These homology classes pair with 1-forms on $X_G$, and in particular with weight $2$ cusp forms for the finite index subgroup $G$. \smallskip Let ${\mathcal M}_{G,k}$ the ${\mathbb C}$-vector space of modular forms of weight $k$ for the finite index subgroup $G\subset {\rm GL}_2({\mathbb Z})$ and let ${\mathcal S}_{G,k}$ be the subspace of cusp forms. Let $X_G={\rm GL}_2({\mathbb Z})\backslash (\H^\pm \times \P)$ be the associated modular curve. We denote by \begin{equation}\label{pairSMod} \langle\cdot, \cdot \rangle: {\mathcal S}_{G,2} \times H_1(X_G,{\mathbb R}) \to {\mathbb C} \end{equation} the perfect pairing between cusp forms of weight two and modular symbols., which we equivalently write as integration \begin{equation}\label{pairSMod2} \langle \psi, \{ \alpha, \beta \}_G \rangle = \int_{\{\alpha, \beta\}_G} \psi(z)\, dz. \end{equation} \medskip \subsection{Boundary values}\label{BoundValSec} We consider now a linear map, constructed using cusp forms and limiting modular symbols, that assigns to an observable of the bulk ${\rm GL}_2$-system a boundary value. \smallskip Let ${\mathcal L}\subset [0,1]$ denote the subset of points such that the Lyapunov exponent \eqref{Lyapexp} of the shift of the continued fraction exists. The set ${\mathcal L}$ is stratified by level sets ${\mathcal L}_\lambda=\{ x\in [0,1]\,|\, \lambda(x)=\lambda \}$, with the Lyapunov spectrum given by the Hausdorff dimension function $\delta(\lambda)=\dim_H ({\mathcal L}_\lambda)$. Recall also that, for a continuous function $\phi$ on a $T$-invariant subset $E \subset [0,1]$, the Birkhoff spectrum (see \cite{FanFeng}) is the function \begin{equation}\label{BirSpec} f_E(\alpha):= \dim_H {\mathcal L}_{\phi,E,\alpha}, \end{equation} where ${\mathcal L}_{\phi,E,\alpha}$ are the level sets of the Birkhoff average by \begin{equation}\label{levelBirkhoff} {\mathcal L}_{\phi,E,\alpha}:= \{ x \in E \,|\, \lim_{n\to \infty} \frac{1}{n}\sum_{k=0}^{n-1} \phi \circ T^k(x) =\alpha \}. \end{equation} In particular, ${\mathcal L}_\lambda={\mathcal L}_{\phi,\lambda}$ for $\phi(x)=\log |T^\prime(x)|$. Lyapunov and Birkhoff spectra for the shift of the continued fraction expansion are analyzed in \cite{PoWe}, \cite{FLWW}. \smallskip In a similar way, one can consider the multifractal spectrum associated to the level sets of the limiting modular symbol, as analyzed in \cite{KesStra}. Let $f_1,\ldots, f_g$ be a basis of the complex vectors space ${\mathcal S}_{G,2}$ of cusp forms of weight $2$ for the finite index subgroup $G\subset {\rm GL}_2({\mathbb Z})$. Let $\Re(f_i)$, $\Im(f_i)$ be the corresponding basis as a real $2g$-dimensional vector space. Under the pairing \eqref{pairSMod}, \eqref{pairSMod2}, which identifies ${\mathcal S}_{G,2}$ with the dual of $H_1(X_G,{\mathbb R})$, we can define as in \cite{KesStra} the level sets $E_\alpha$, for $\alpha\in {\mathbb R}^{2g}$, of the limiting modular symbol as \begin{equation}\label{EalphaLimMod} E_\alpha:= \{ (x,s)\in [0,1]\times \P \,|\, ( \langle f_i, \{\{ \star, x \}\}_G \rangle =\alpha \in {\mathbb R}^{2g} \}. \end{equation} Equivalently, we write this as $$ E_\alpha =\{ (x,s) \in [0,1]\times \P \,|\, (\lim_{n\to \infty} \frac{1}{\lambda(x) n} \int_{ \{ g_k^{-1}(x)\cdot 0, g_k^{-1}(x)\cdot \infty \}_G } f_i(z)\, dz )_{i=1\ldots,g} =\alpha \in {\mathbb R}^{2g} \}. $$ For $(x,s)\in E_\alpha$ we have $$ \lim_{n\to \infty} \frac{1}{\lambda(x) n} \{ g_k^{-1}(x)\cdot 0, g_k^{-1}(x)\cdot \infty \}_G = h_\alpha \in H_1(X_G,{\mathbb R}), $$ where the homology class $h_\alpha$ is uniquely determined by the property that $\langle f_i, h_\alpha\rangle =\int_{h_\alpha} f_i(z) dz = \alpha_i$. \smallskip The main result of \cite{KesStra} shows that for a given finite index subgroup $G\subset {\rm GL}_2({\mathbb Z})$ with $X_G$ of genus $g\geq 1$, there is a strictly convex and differentiable function $\beta_G: {\mathbb R}^{2g}\to {\mathbb R}$ such that, for all $\alpha\in \nabla \beta_G({\mathbb R}^{2g})\subset {\mathbb R}^{2g}$ \begin{equation}\label{KSresult1} \dim_H(E_\alpha) =\hat \beta_G(\alpha) , \end{equation} where $\hat \beta_G(\alpha) =\inf_{v\in {\mathbb R}^{2g}} (\beta_G(v) - \langle \alpha, v \rangle)$ is the Legendre transform, and for all $(x,s) \in E_\alpha$ \begin{equation}\label{KSresult2} \lim_{n\to \infty} \frac{1}{\lambda(x) n} \{ g_k^{-1}(x)\cdot g \cdot 0, g_k^{-1}(x)\cdot g\cdot \infty \}_G = h_\alpha(x,s) \end{equation} with $g$ a representative of the class $s\in \P={\rm GL}_2({\mathbb Z})/G$. \smallskip We let ${\mathcal A}_{\partial,G,{\mathcal P},h_\alpha}= B_{\partial, E_\alpha}\rtimes {\rm Red}$ be the subalgebra of ${\mathcal A}_{\partial,G,{\mathcal P}}=B_\partial \rtimes {\rm Red}$ associated to the invariant set $E_\alpha$, as in Corollary~\ref{BEsubalg}. As an immediate consequence of the results \eqref{KSresult1}, \eqref{KSresult2} of \cite{KesStra} we have the following. \begin{lem}\label{SG2linT} The choice of a cusp form $\psi\in {\mathcal S}_{G,2}$ determines a bounded linear operator ${\mathcal I}_{\psi,\alpha}$ from ${\mathcal A}_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$ to $B_{\partial, E_\alpha}$ with for $(x,s)\in E_\alpha$ \begin{equation}\label{Iop} \begin{array}{rl} \displaystyle{ {\mathcal I}_{\psi,\alpha}(f)(g,\rho,x,s)} =&\displaystyle{ \int_{ \{ \star, x \}_G } f(g,\rho,z,s) \, \psi(z)\, dz} \\[3mm] =& \displaystyle{ \lim_{n\to \infty} \frac{1}{\lambda(x)\, n}\sum_{k=1}^n \int_{ \{ g_k^{-1}(x)\cdot 0, g_k^{-1}(x)\cdot \infty \}_G } f(g,\rho,z,s) \, \psi(z)\, dz} \\[3mm] = & \displaystyle{ \int_{h_\alpha(x)} f(g,\rho,z,s) \, \psi(z)\, dz . } \end{array} \end{equation} \end{lem} Here we pair the form $\omega(z)= f(z)\psi(z)dz$ with the limiting modular symbol $h_\alpha(x,s)$ of \eqref{KSresult2}. We use the notation $\omega(z)=\omega_{\rho,s}(z)$ to highlight the dependence on the variables $(\rho,s)$ that come from choosing an element $f$ in the arithmetic algebra ${\mathcal A}^{ar}_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$. \smallskip Note that ${\mathcal I}_{\psi,\alpha}$ is only a linear operator and {\em not} an algebra homomorphism. We obtain a subalgebra of ${\mathcal A}_{\partial,G,{\mathcal P}}$ as follows. \smallskip \begin{defn}\label{Ialg} Let ${\mathcal A}_{{\mathcal I},G,{\mathcal P}}$ denote the subalgebra of ${\mathcal A}_{\partial,G,{\mathcal P}}=B_\partial \rtimes {\rm Red}$ generated by all the images ${\mathcal I}_{\psi,\alpha}(f)$ for $f\in {\mathcal A}_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$, for $\psi\in {\mathcal S}_{G,2}$, and for $\alpha \in \nabla \beta_G({\mathbb R}^{2g})$, and by the $S_k, S_k^*$ with the relations as in Definition~\ref{semicrossdef}. The arithmetic algebra ${\mathcal A}^{ar}_{{\mathcal I},G,{\mathcal P}}$ is obtained in the same way as the algebra generated by the images ${\mathcal I}_{\psi,\alpha}(f)$ with $f$ in the arithmetic algebra ${\mathcal A}^{ar}_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$ of \S \ref{arithmSec}, for all $\psi\in {\mathcal S}_{G,2}$ and $\alpha \in \nabla \beta_G({\mathbb R}^{2g})$, and by the $S_k,S_k^*$ as above. \end{defn} \medskip \subsection{Evaluation of ground states on boundary values} When we evaluate zero-temperature KMS states on the elements ${\mathcal I}_{\psi,\alpha}(f)$, for an element $f\in {\mathcal A}^{ar}_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$, we obtain the pairing of a cusp form with a limiting modular symbol, \begin{equation}\label{KMSIpsi} \varphi_{\infty,\rho,x,s}({\mathcal I}_{\psi,\alpha}(f)) =\langle \omega_{\rho,s}, h_\alpha(x) \rangle, \end{equation} where $\omega_{\rho,s}(z)=f(1,\rho,z,s) \psi(z) dz$ is a cusp form in ${\mathcal S}_{G,2}$ for all $(\rho,s)$. Since elements $f\in {\mathcal A}^{ar}_{{\rm GL}_2({\mathbb Z}),G,{\mathcal P}}$ depend on the variable $\rho\in M_2(\hat{\mathbb Z})$ through some finite projection $\pi_N(\rho)\in {\mathbb Z}/N{\mathbb Z}$, we can write $\omega_{\rho,s}(z)$ as a finite collection $\{ \omega_{i,s}(z) \}_{i\in {\mathbb Z}/N{\mathbb Z}}$. \smallskip To illustrate the properties of the values of ground states on arithmetic boundary elements, we consider here the particular case where $G=\Gamma_0(N)$ and a state $\varphi_{\infty,\rho,x,s}$ with $s\in \P$. We also choose $f$ and $\psi$ so that the resulting $\omega_{i,s}$ are cusp forms for $\Gamma_0(N)$ that are Hecke eigenforms for all the Hecke operators $T(m)$. \smallskip Recall (see \cite{Serre}) that the Hecke operators $T(m)$ given by $$ T_m=\sum_{\gamma\,:\, \det(\gamma)=m} \Gamma_0(N) \gamma \Gamma_0(N) $$ satisfying $T_nT_m=T_mT_n$ for $(m,n)=1$ and $T_{p^n} T_p=T_{p^{n+1}} + p T_{p^{n-1}} R_p$ with $R_\lambda$ the scaling operator that acts on a modular form of weight $2k$ as multiplication by $\lambda^{-2k}$. The Hecke operators $T_m$ and the scaling operators $R_\lambda$ generate a commutative algebra, and the action of $T_m$ on a modular form of weight $2k$ is given by $$ T_m\, f(z) = n^{2k-1} \sum_{a\geq 1, ad=n, 0\leq b <d} d^{-2k} \, f(\frac{az+b}{d}). $$ \smallskip \begin{prop}\label{evalKMSinftyMerel} Let $G=\Gamma_0(N)$ and let $\omega_{i,s_0}$, with $i=0,\ldots, N-1$ and $s_0=\Gamma_0(N) g_0 \in \P$, be Hecke eigencuspforms of weight $2$. For $s\in \P$ with $s=\Gamma_0(N) g_0 \gamma$, with $\gamma\in {\rm GL}_2({\mathbb Z})$, let $\omega_{i,s}=\omega_{i,s_0 \gamma}:=\omega_{i,s_0}\circ \gamma^{-1}$. Consider the pairing $$ \xi_\omega(s)= \langle \omega_{\rho,s}, h_\alpha(x) \rangle =\int_{h_\alpha(x)} \omega_{i,s} $$ with the limiting modular symbol $h_\alpha(x)$, as in \eqref{Iop} and \eqref{KMSIpsi}. For $(m,N)=1$ we have the relations $$ a_{i,m} \, \xi_\omega(s) = \sum_{M \in \bar A_m} u_m\, \xi_\omega(s\, M) $$ where $a_{i,m}$ are the Hecke eigenvalues and $A_m=\{ M \in M_2({\mathbb Z})\,:\, \det(M)=m \}$, with $\bar A_m =A_m/\{ \pm 1\}$ and $\sum_M u_M\, M \in {\mathbb Z} \bar A_m$ is the Manin--Heilbronn lift of the Hecke operator $T_m$. \end{prop} \proof The condition that $\omega_{i,s \gamma}=\omega_{i,s}\circ \gamma^{-1}$ implies that $\langle \omega_{i,s}, h_\alpha(x) \rangle=\langle \omega_{i,s_0}, h_\alpha(x,s) \rangle$. The following facts are known from \cite{Man-modsymb}, \cite{Merel}. Let $$ A_{m,N}=\{ M=\begin{pmatrix} a & b \\ c & d \end{pmatrix} \in M_2({\mathbb Z})\,:\, \det(M)=m, \, \, N|c \}. $$ Let $R$ be a set of representatives for the classes $\Gamma_0(N)\backslash A_{m,N}$ The Hecke operators act on the modular symbols by $T_m \{ \alpha, \beta \}=\sum_{\lambda \in R} \{ \lambda \alpha, \lambda \beta \}$. For $(m,N)=1$ there is a bijection between the cosets $\Gamma_0(N)\backslash A_{m,N}$ and $A_m/{\rm SL}_2({\mathbb Z})$. For $s\in \P$ consider the assignment $\xi_\omega: s\mapsto \xi_\omega(s)= \langle \omega_{i,s}, h_\alpha(x,s)\rangle$, where $\omega_{i,s}$ is a Hecke eigencuspform. It is shown in \cite{Man-modsymb}, \cite{Merel} that there is a lift $\Theta_m$ of the action of the Hecke operators $T_m \circ \xi=\xi\circ \Theta_m$ (the Manin--Heilbronn lift), which is given by $\Theta_m =\sum_{\gamma \in A_m /{\rm SL}_2({\mathbb Z})} \Upsilon_\gamma$, where $\Upsilon_\gamma$ is a formal chain of level $m$ connecting $\infty$ to $0$ and of class $\gamma$. This means that $\Upsilon_\gamma=\sum_{k=0}^{n-1} \gamma_k$ in ${\mathbb Z} A_m$, for some $n\in {\mathbb N}$ where $$ \gamma_k =\begin{pmatrix} u_k & u_{k+1} \\ v_k & v_{k+1} \end{pmatrix} $$ with $u_0/v_0=\infty$ and $u_n/v_n=0$ and where $\gamma_k$ agrees with $\gamma$ in $A_m/{\rm SL}_2({\mathbb Z})$. An argument in \cite{Merel} based on the continued fraction expansion and modular symbols shows that it is always possible to construct such formal chains with $\gamma_k =\gamma g_k$ with $g_k\in {\rm SL}_2({\mathbb Z})$ and that the resulting $\Theta_m$ is indeed a lift of the Hecke operators. (The length $n$ of the chain of the Manin--Heilbronn lift is also computed, see \S 3.2 of \cite{Merel}.) Using the notation of Theorem~4 of \cite{Merel}, we write the Manin--Heilbronn lift as $\Theta_m = \sum_{M\in \bar A_m} u_M\, M$ as an element of ${\mathbb Z} A_m$. Each element $M\in \bar A_m$ maps $s\mapsto s\, M$ in ${\mathcal P}$, hence one obtains a map $\Theta_m: {\mathbb Z}{\mathcal P} \to {\mathbb Z}{\mathcal P}$. In particular, as shown in Theorem~2 of \cite{Merel}, for $s=\Gamma_0(N)g$ in $\P$ one has $\Theta_m(s)=\sum_{\gamma\in R} \sum_{k=0}^{n-1} \phi(g\gamma \gamma_k)$ where $\phi: A_m \to \Gamma_0(N)\backslash {\rm SL}_2({\mathbb Z})$ is the map that assigns $$ A_m \ni \gamma=\begin{pmatrix} a & b \\ c & d \end{pmatrix} \mapsto \Gamma_0(N) \begin{pmatrix} w & t \\ u & v \end{pmatrix} \in \Gamma_0(N) \backslash {\rm SL}_2({\mathbb Z}) $$ with $(c :d)=(u :v)$ in $\P^1({\mathbb Z}/N{\mathbb Z})\simeq \P =\Gamma_0(N) \backslash {\rm SL}_2({\mathbb Z})$. Thus, as in Theorem~2 of \cite{Merel} we then have $\Theta_m(s)=\sum_{\gamma\in R} \sum_{k=0}^{n-1} \phi(g\gamma) g_k=\sum_{\gamma\in R} \phi(g\gamma) \gamma^{-1}$, seen here as an element in ${\mathbb Z}{\mathcal P}$. Thus, in the pairing of limiting modular symbols and boundary elements we find $$ T_m \xi_\omega(s) =T_m \int_{h_\alpha(x,s)} \omega_{i,s_0} =\int_{h_\alpha(x,s)} T_m \omega_{i,s_0} = a_{i,m} \int_{h_\alpha(x,s)} \omega_{i,s_0} ,$$ where $a_{i,m}$ are the Hecke eigenvalues of the eigenform $\omega_{i,s_0}$, with $a_{i,1}=1$. On the other hand, using the Manin--Heilbronn lift we have $$ T_m \xi_\omega(s) = \xi_\omega (\Theta_m(s)) = \sum_{\gamma\in R} \int_{h_\alpha(x,s_\gamma)} \omega_{i,s_0} $$ with $s_\gamma \in {\mathcal P}$ given by $s_\gamma=\phi(g\gamma) \gamma^{-1}$ as above. We write the latter expression in the form $$ \sum_{M\in \bar A_m} u_M\, \int_{h_\alpha(x,s\, M)} \omega_{i,s_0} $$ for consistency with the notation of Theorem~4 of \cite{Merel}. \endproof \smallskip \begin{prop}\label{L1period} Under the same hypothesis as Proposition~\ref{evalKMSinftyMerel}, let $L_{\omega_{i,s_0}}(\sigma)=\sum_m a_{i,m} \, m^{-\sigma}$ be the $L$-series associated to the cusp form $\omega_{i,s_0}=\sum_m a_{i,m} \, q^m$. For $x$ a quadratic irrationality the evaluation \eqref{KMSIpsi} of KMS$_\infty$ states satisfies \begin{equation}\label{L1eval} \langle \omega_{i,s}, h(x) \rangle= \frac{1}{\lambda(x) n} \sum_{k=1}^n \langle \omega_{i,s_k}, \{0, \infty\} \rangle = \frac{1}{\lambda(x) n} \sum_{k=1}^n L_{\omega_{i,s_k}}(1), \end{equation} where $s_k=\Gamma_0(N) g g_k^{-1}(x)$ for $s=\Gamma_0(N) g$. \end{prop} \proof The special value $L_{\omega_{i,s_0}}(1)$ of the $L$-function gives the pairing with the modular symbol $\langle \omega_{i,s_0}, \{ 0, \infty\} \rangle$. Similarly, for $s\in \P$ with $s=\Gamma_0(N)g$, the special value gives $$L_{\omega_{i,s}}(1)=\langle \omega_{i,s}, \{ 0, \infty\} \rangle =\langle \omega_{i,s_0}, \{ g\cdot 0, g\cdot \infty\} \rangle.$$ In the case of a quadratic irrationality the limiting modular symbol satisfies $$ h(x)=\frac{1}{\lambda(x) n} \sum_{k=1}^n \{ g_k^{-1}(x)\cdot 0, g_k^{-1}(x) \cdot \infty \}_G, $$ where $n$ is the length of the period of the continued fraction expansion of $x$ and $\lambda(x)$ is the Lyapunov exponent. For $s_k=\Gamma_0(N) g g_k^{-1}(x)$ with $s=\Gamma_0(N) g$, we have $\langle \omega_{i,s_k}, \{0, \infty\} \rangle = \langle \omega_{i,s}, \{ g_k^{-1}(x)\cdot 0, g_k^{-1}(x) \cdot \infty \}\rangle$ hence one obtains \eqref{L1eval}. \endproof \smallskip As shown in Theorem~3.3 of \cite{Man-modsymb}, the special value $L_{\omega_{i,s_0}}(1)$ satisfies $$ (\sum_{d|m} d - a_{i,m}) L_{\omega_{i,s_0}}(1) = \sum_{d|m, \, b \, {\rm mod} \, d} \int_{\{ 0, b/d \}_G} \omega_{i,s_0}, $$ since one has $$ \int_0^{\infty} T_m \omega_{i,s_0} = a_{i,m} \int_0^{\infty} \omega_{i,s_0} = \sum_{d|m} \sum_{b=0}^{d-1} \int_{\{ b/d,0 \}_G +\{ 0, \infty \}_G} \omega_{i,s_0}. $$ \smallskip For a normalized Hecke eigencuspform $f=\sum_n a_n q^n$, let $L_f(s)=\sum_n a_n n^{-s}$ be the associated $L$-function and $\Lambda_f(s)=(2\pi)^{-s}\Gamma(s) L_f(s)$ the completed $L$-function, the Mellin transform $\Lambda_f(s)=\int_0^\infty f(iz) z^{s-1} dz$. \smallskip The relation between special values of $L$-functions and periods of Hecke eigenforms generalizes for higher weights, and it was shown in \cite{Man-Hecke} that ratios of these special values of the same parity are algebraic (in the field generated over ${\mathbb Q}$ by the Hecke eigenvalues). For a normalized Hecke eigencuspform $f=\sum_n a_n q^n$ of weight $k$ the coefficients of the period polynomial $r_f(z)$ are expressible in terms of special values of the $L$-function, $$ r_f(z)=-i \sum_{j=0}^{k-2} \binom{k-2}{j} (iz)^j \Lambda_f(j+1). $$ Manin's Periods Theorem shows that, for ${\mathbb K}_f$ the field of algebraic numbers generated over ${\mathbb Q}$ by the Fourier coefficients, there are $\omega_\pm(f)\in {\mathbb R}$ such that for all $1\leq s \leq k-1$ with $s$ even $\Lambda_f(s)/\omega_+(f)\in {\mathbb K}_f$, respectively $\Lambda_f(s)/\omega_-(f)\in {\mathbb K}_f$ for $s$ odd. \smallskip Shokurov gave a geometric argument based on Kuga varieties and a higher weight generalization of modular symbols, \cite{Shok}. It is expected that the limiting modular symbols of \cite{ManMar}, as well as the quantum statistical mechanics of the ${\rm GL}_2$-system and its boundary described here, will generalize to the case of Kuga varieties, with the relations between periods of Hecke eigencuspforms described in \cite{Man-Hecke} arising in the evaluation of zero-temperature KMS states of these systems. \bigskip \subsection*{Acknowledgment} The first author is partially supported by NSF grant DMS-1707882, by NSERC Discovery Grant RGPIN-2018-04937 and Accelerator Supplement grant RGPAS-2018-522593, and the Perimeter Institute for Theoretical Physics.